void 0.20.0 → 0.20.2

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.
Files changed (93) hide show
  1. package/README.md +5 -1
  2. package/dist/{auth-W9WII-mN.mjs → auth-DPl6kck4.mjs} +46 -26
  3. package/dist/{auth-cmd-CYVhSNFy.mjs → auth-cmd-gniL2fNt.mjs} +5 -4
  4. package/dist/auth-link-NZdjCmSc.mjs +28 -0
  5. package/dist/{build-cmd-CkVD1uOh.mjs → build-cmd-sI18tX_O.mjs} +3 -3
  6. package/dist/{cache-QcUfR-ff.mjs → cache-IHn5MwBC.mjs} +3 -3
  7. package/dist/{cancel-deploy-DsvWKFTe.mjs → cancel-deploy-C5qTOdLi.mjs} +3 -3
  8. package/dist/cf-access-DRsQRe6k.mjs +75 -0
  9. package/dist/cli/cli.mjs +364 -1883
  10. package/dist/cli/env-schema-probe.mjs +11 -2
  11. package/dist/{client-CyCHWSO_.mjs → client-dHfSJvAN.mjs} +336 -58
  12. package/dist/{cloudflare-auth-DRkGe7-s.mjs → cloudflare-auth-6M5llVPC.mjs} +53 -6
  13. package/dist/{cloudflare-cmd-D3ME2GAe.mjs → cloudflare-cmd-4RPGN3KB.mjs} +2 -2
  14. package/dist/{cloudflare-connect-BivMefMA.mjs → cloudflare-connect-t1UU5svD.mjs} +2 -2
  15. package/dist/{cloudflare-operations-CPTpRW6d.mjs → cloudflare-operations-BzWnlC1_.mjs} +1 -1
  16. package/dist/{config-BQFq7QvD.mjs → config-uNGuFsI2.mjs} +1 -1
  17. package/dist/{connect-D9Yr-T5f.mjs → connect-Bfk31O_8.mjs} +6 -6
  18. package/dist/{create-project-DMV-csEm.mjs → create-project-Bk9Z0-Jg.mjs} +6 -5
  19. package/dist/{db-BxoUWL0F.mjs → db-BkRoptAt.mjs} +75 -48
  20. package/dist/{delete-iJOqxBz1.mjs → delete-DouASY9P.mjs} +3 -3
  21. package/dist/{deploy-CcDoeBIf.mjs → deploy-DTaWUS1S.mjs} +137 -128
  22. package/dist/{dev-inbox-DkgRWLkW.mjs → dev-inbox-P0u4tM8Y.mjs} +1 -1
  23. package/dist/{domain-gu_iaHmn.mjs → domain-1RhhOVrC.mjs} +4 -4
  24. package/dist/email-C-lGh51B.mjs +795 -0
  25. package/dist/{env-D4Emu-M_.mjs → env-DBKmK4vc.mjs} +1 -0
  26. package/dist/{env-DmU2To0C.mjs → env-DJHsPE7Z.mjs} +5 -5
  27. package/dist/{env-validation-ENpMy6Ez.mjs → env-validation-CF6KvTRf.mjs} +3 -1
  28. package/dist/{gen-BKw6qHIg.mjs → gen-B_wPnVTK.mjs} +3 -3
  29. package/dist/generate-RTK8_kK1.mjs +47 -0
  30. package/dist/{github-cmd-DJS5Ab-H.mjs → github-cmd-PW7ZnWTp.mjs} +3 -3
  31. package/dist/{headers-D8QfRX9Y.mjs → headers-BAHwgHdW.mjs} +1 -1
  32. package/dist/help-CwOX-zmI.mjs +2216 -0
  33. package/dist/{inbound-BJ70in1n.d.mts → inbound-CH5Mksyy.d.mts} +37 -42
  34. package/dist/{inbound-CNKxb3FY.mjs → inbound-aVHEUhKo.mjs} +143 -101
  35. package/dist/index.mjs +69 -30
  36. package/dist/{init-Dx5cgKqK.mjs → init-BWZ7q5Z4.mjs} +11 -11
  37. package/dist/{link-D_rm5sRH.mjs → link-Rmvu2Wl_.mjs} +4 -4
  38. package/dist/{list-M8XShti7.mjs → list-DEE2S6mY.mjs} +4 -4
  39. package/dist/{local-d1-BE8KBbMy.mjs → local-d1-D2I6Ox5F.mjs} +1 -1
  40. package/dist/{login-C8-UuLnp.mjs → login-Uvferzmm.mjs} +28 -10
  41. package/dist/{logs-DwFU7dMW.mjs → logs-27FenuiC.mjs} +4 -4
  42. package/dist/{mime-BJD7d_qL.mjs → mime-D5Nmdzf7.mjs} +23 -9
  43. package/dist/{node-BkaXcpAc.mjs → node-Ez5KW5rn.mjs} +3 -3
  44. package/dist/operator-auth-B3e08unv.mjs +52 -0
  45. package/dist/operator-client-LUZnlnYk.mjs +82 -0
  46. package/dist/{operator-cmd-DYWRbWUA.mjs → operator-cmd-CjOTmAYE.mjs} +35 -55
  47. package/dist/{output-tFQLLj26.mjs → output-B0cfNSx5.mjs} +316 -2
  48. package/dist/pages/index.mjs +2 -2
  49. package/dist/platform-auth-config-DrbQXXiW.mjs +368 -0
  50. package/dist/platform-auth-protection-Bhtvp0B_.mjs +219 -0
  51. package/dist/platform-auth-recovery-CeOKGVeJ.mjs +310 -0
  52. package/dist/{platform-cmd-BEOVv1PN.mjs → platform-cmd-BFhieCdV.mjs} +16 -6
  53. package/dist/{platform-domain-BszUfiS8.mjs → platform-domain-C74PULqV.mjs} +4 -4
  54. package/dist/{platform-lifecycle-CjSr6xf0.mjs → platform-lifecycle-BwAIgz-t.mjs} +1667 -191
  55. package/dist/{platform-management-W30iCaTL.mjs → platform-management-COogu_Se.mjs} +33 -7
  56. package/dist/{platform-recovery-pHHv4ZSg.mjs → platform-recovery-ewqLefp1.mjs} +6 -5
  57. package/dist/{prepare-CBetXvsN.mjs → prepare-CtDJjoOj.mjs} +2 -2
  58. package/dist/{prepare-BfJvFUtJ.mjs → prepare-blNRQvQl.mjs} +2 -2
  59. package/dist/prerender-render.d.mts +11 -0
  60. package/dist/prerender-render.mjs +111 -0
  61. package/dist/{project-cmd-DCpk1cDt.mjs → project-cmd-DmZK9Hxf.mjs} +32 -14
  62. package/dist/project-team-D8jOJMUJ.mjs +130 -0
  63. package/dist/project-token-DA34bf-C.mjs +75 -0
  64. package/dist/{provision-Blnstcm2.mjs → provision-CSJOjjQk.mjs} +2 -0
  65. package/dist/{requests-Dn8Vheh1.mjs → requests-CUExwGQQ.mjs} +3 -3
  66. package/dist/{rollback-CtlPXEBi.mjs → rollback-CDNGU1gr.mjs} +4 -4
  67. package/dist/{runner-mysql-CgRFl3s6.mjs → runner-mysql-7BPUNGmL.mjs} +1 -1
  68. package/dist/{runner-pg-DCkWPsWS.mjs → runner-pg-BkEza-dX.mjs} +1 -1
  69. package/dist/runtime/ai.mjs +3 -2
  70. package/dist/runtime/email/testing.d.mts +1 -1
  71. package/dist/runtime/email/testing.mjs +3 -3
  72. package/dist/runtime/email-protocol.d.mts +15 -0
  73. package/dist/runtime/email-protocol.mjs +70 -0
  74. package/dist/runtime/email.d.mts +2 -2
  75. package/dist/runtime/email.mjs +189 -96
  76. package/dist/runtime/remote/index.mjs +5 -3
  77. package/dist/{secret-BqTxGqki.mjs → secret-Bzzi2e9E.mjs} +5 -5
  78. package/dist/{skills-Q46GZMO-.mjs → skills-C0RvGjeE.mjs} +1 -1
  79. package/dist/sqlite-validation-BzKMWnO4.mjs +25 -0
  80. package/dist/{subcommand-prompt-WfySCQ7S.mjs → subcommand-prompt-Bmyn5Rlc.mjs} +1 -1
  81. package/dist/{validate-Bihr8WBi.mjs → validate-tBBN_dXH.mjs} +1 -0
  82. package/package.json +12 -7
  83. package/skills/void/SKILL.md +35 -4
  84. package/skills/void/docs/guide/deployment.md +2 -0
  85. package/skills/void/docs/guide/email.md +121 -98
  86. package/skills/void/docs/guide/platform-administration.md +214 -2
  87. package/skills/void/docs/guide/platform-development.md +93 -2
  88. package/skills/void/docs/guide/project-collaboration.md +94 -0
  89. package/skills/void/docs/guide/self-hosted-platform.md +184 -30
  90. package/skills/void/docs/reference/cli.md +294 -15
  91. package/dist/cf-access-AJ1ehiFR.mjs +0 -42
  92. package/dist/cf-access-DsSsZUPr.mjs +0 -67
  93. package/dist/email-r6DHJyAB.mjs +0 -262
@@ -1,6 +1,6 @@
1
- import { D as log } from "./output-tFQLLj26.mjs";
1
+ import { D as log } from "./output-B0cfNSx5.mjs";
2
2
  import { o as resolveWranglerArgv } from "./preset-lAy0B0BQ.mjs";
3
- import { execFile, spawnSync } from "node:child_process";
3
+ import { execFile, spawn, spawnSync } from "node:child_process";
4
4
  //#region src/cli/cloudflare-auth.ts
5
5
  var CloudflareAuthenticationError = class extends Error {
6
6
  name = "CloudflareAuthenticationError";
@@ -102,7 +102,11 @@ function createBundledCloudflareAuthRunner(root) {
102
102
  env,
103
103
  maxBuffer: 10485760,
104
104
  shell: false,
105
- stdio: capture ? [
105
+ stdio: cloudflareKeyringNeedsTerminal(args) ? [
106
+ "inherit",
107
+ "inherit",
108
+ "ignore"
109
+ ] : capture ? [
106
110
  "ignore",
107
111
  "pipe",
108
112
  "pipe"
@@ -122,6 +126,37 @@ function createBundledCloudflareAuthRunner(root) {
122
126
  /** Run a captured auth command without blocking terminal input or exposing credentials. */
123
127
  function runCloudflareAuthCommand(root, args, signal) {
124
128
  const [command, ...prefix] = resolveWranglerArgv(root);
129
+ if (cloudflareKeyringNeedsTerminal(args)) return new Promise((resolve) => {
130
+ const child = spawn(command, [...prefix, ...args], {
131
+ cwd: root,
132
+ env: cloudflareAuthCommandEnvironment(args),
133
+ shell: false,
134
+ signal,
135
+ stdio: [
136
+ "inherit",
137
+ "inherit",
138
+ "ignore"
139
+ ],
140
+ timeout: 6e5,
141
+ windowsHide: true
142
+ });
143
+ child.once("error", (error) => {
144
+ resolve({
145
+ status: null,
146
+ stdout: "",
147
+ stderr: "",
148
+ error: error.message
149
+ });
150
+ });
151
+ child.once("close", (status, signal) => {
152
+ resolve({
153
+ status,
154
+ signal,
155
+ stdout: "",
156
+ stderr: ""
157
+ });
158
+ });
159
+ });
125
160
  return new Promise((resolve) => {
126
161
  execFile(command, [...prefix, ...args], {
127
162
  cwd: root,
@@ -145,9 +180,21 @@ function runCloudflareAuthCommand(root, args, signal) {
145
180
  }
146
181
  function cloudflareAuthCommandEnvironment(args, source = process.env) {
147
182
  const env = cloudflareAuthEnvironment(source);
148
- if (args[0] === "login" || args[0] === "logout") env.WRANGLER_LOG = "none";
183
+ if (args[0] === "login" || args[0] === "logout" || isCloudflareKeyringEnable(args)) env.WRANGLER_LOG = "none";
149
184
  return env;
150
185
  }
186
+ function isCloudflareKeyringEnable(args) {
187
+ return args.length === 3 && args[0] === "auth" && args[1] === "keyring" && args[2] === "enable";
188
+ }
189
+ /**
190
+ * Wrangler installs its Windows keyring backend only when stdin AND stdout are
191
+ * terminals. Capturing `auth keyring enable` makes first-time setup fail even
192
+ * inside PowerShell. This command only configures storage; it never reads or
193
+ * prints a credential. Keep every other auth command captured.
194
+ */
195
+ function cloudflareKeyringNeedsTerminal(args) {
196
+ return process.platform === "win32" && process.stdin.isTTY === true && process.stdout.isTTY === true && isCloudflareKeyringEnable(args);
197
+ }
151
198
  function cloudflareAuthEnvironment(source = process.env) {
152
199
  const env = { ...source };
153
200
  const scrubbedWranglerKeys = /* @__PURE__ */ new Set([
@@ -155,7 +202,7 @@ function cloudflareAuthEnvironment(source = process.env) {
155
202
  "WRANGLER_OUTPUT_FILE_PATH",
156
203
  "WRANGLER_LOG_SANITIZE"
157
204
  ]);
158
- for (const key of Object.keys(env)) if (/^VOID_PLATFORM_/i.test(key) || /^(?:DATABASE_URL|CF_ACCESS_CLIENT_ID|CF_ACCESS_CLIENT_SECRET|CF_ACCESS_TOKEN)$/i.test(key) || scrubbedWranglerKeys.has(key.toUpperCase())) delete env[key];
205
+ for (const key of Object.keys(env)) if (/^VOID_PLATFORM_/i.test(key) || /^(?:DATABASE_URL|CF_ACCESS_CLIENT_ID|CF_ACCESS_CLIENT_SECRET|CF_ACCESS_TOKEN|VOID_ACCESS_CREDENTIALS|VOID_ACCESS_ORIGIN)$/i.test(key) || scrubbedWranglerKeys.has(key.toUpperCase())) delete env[key];
159
206
  env.CLOUDFLARE_AUTH_USE_KEYRING = "true";
160
207
  env.WRANGLER_LOG_SANITIZE = "true";
161
208
  return env;
@@ -167,4 +214,4 @@ function announceCloudflareLogin() {
167
214
  log.info("Opening Cloudflare login in your browser. Press Ctrl+C to cancel.");
168
215
  }
169
216
  //#endregion
170
- export { enableCloudflareKeyring as a, runCloudflareAuthCommand as c, createBundledCloudflareAuthRunner as i, announceCloudflareLogin as n, ensureCloudflareAuthentication as o, cloudflareCredentialOverrides as r, parseCloudflareAuthSession as s, CloudflareAuthenticationError as t };
217
+ export { createBundledCloudflareAuthRunner as a, parseCloudflareAuthSession as c, cloudflareKeyringNeedsTerminal as i, runCloudflareAuthCommand as l, announceCloudflareLogin as n, enableCloudflareKeyring as o, cloudflareCredentialOverrides as r, ensureCloudflareAuthentication as s, CloudflareAuthenticationError as t };
@@ -1,7 +1,7 @@
1
1
  import { t as basename } from "./dist-BrsS7cai.mjs";
2
- import { D as log } from "./output-tFQLLj26.mjs";
2
+ import { D as log } from "./output-B0cfNSx5.mjs";
3
3
  import { v as readRootWranglerConfig } from "./wrangler--imS8n0d.mjs";
4
- import { a as enableCloudflareKeyring, i as createBundledCloudflareAuthRunner, o as ensureCloudflareAuthentication, r as cloudflareCredentialOverrides, s as parseCloudflareAuthSession } from "./cloudflare-auth-DRkGe7-s.mjs";
4
+ import { a as createBundledCloudflareAuthRunner, c as parseCloudflareAuthSession, o as enableCloudflareKeyring, r as cloudflareCredentialOverrides, s as ensureCloudflareAuthentication } from "./cloudflare-auth-6M5llVPC.mjs";
5
5
  //#region src/cli/cloudflare-cmd.ts
6
6
  async function runCloudflareCommand(root, args) {
7
7
  const runWrangler = createBundledCloudflareAuthRunner(root);
@@ -1,7 +1,7 @@
1
1
  import { o as join, t as basename } from "./dist-BrsS7cai.mjs";
2
- import { D as log, F as isCancel, j as select } from "./output-tFQLLj26.mjs";
2
+ import { D as log, I as isCancel, M as select } from "./output-B0cfNSx5.mjs";
3
3
  import { i as LATEST_KNOWN_COMPAT_DATE, k as writeProvisionedWranglerConfig, v as readRootWranglerConfig } from "./wrangler--imS8n0d.mjs";
4
- import { i as createBundledCloudflareAuthRunner, o as ensureCloudflareAuthentication } from "./cloudflare-auth-DRkGe7-s.mjs";
4
+ import { a as createBundledCloudflareAuthRunner, s as ensureCloudflareAuthentication } from "./cloudflare-auth-6M5llVPC.mjs";
5
5
  import { existsSync } from "node:fs";
6
6
  //#region src/cli/cloudflare-connect.ts
7
7
  async function connectCloudflare(root, interactive = Boolean(process.stdin.isTTY)) {
@@ -3,7 +3,7 @@ import { o as join } from "./dist-BrsS7cai.mjs";
3
3
  import { A as writeWranglerPublishedTrafficSnapshot, O as updateWranglerCustomDomain, S as readWranglerPublishedTrafficSnapshot, b as readWranglerCustomDomains } from "./wrangler--imS8n0d.mjs";
4
4
  import { r as scanWranglerDotenvKeys } from "./dotenv-VQxupEUv.mjs";
5
5
  import { o as resolveWranglerArgv } from "./preset-lAy0B0BQ.mjs";
6
- import { i as provisionEnv, o as resolvePinnedApiBaseUrl, r as deleteEnvVarCaseAware, t as assertNoTransportRedirectInProjectDotenv } from "./provision-Blnstcm2.mjs";
6
+ import { i as provisionEnv, o as resolvePinnedApiBaseUrl, r as deleteEnvVarCaseAware, t as assertNoTransportRedirectInProjectDotenv } from "./provision-CSJOjjQk.mjs";
7
7
  import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
8
8
  import { tmpdir } from "node:os";
9
9
  import { spawnSync } from "node:child_process";
@@ -2,7 +2,7 @@ import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.mjs";
2
2
  import { o as join } from "./dist-BrsS7cai.mjs";
3
3
  import { a as validateSourceDir } from "./project-paths-SK8nMHPp.mjs";
4
4
  import { i as isVoidAuthProvider, t as VOID_AUTH_PROVIDERS } from "./providers-CJlNS3kT.mjs";
5
- import { a as parseAddress, n as MimeError } from "./mime-BJD7d_qL.mjs";
5
+ import { a as parseAddress, n as MimeError } from "./mime-D5Nmdzf7.mjs";
6
6
  import { readFileSync } from "node:fs";
7
7
  //#region src/config.ts
8
8
  var config_exports = /* @__PURE__ */ __exportAll({
@@ -1,9 +1,9 @@
1
- import { D as log, F as isCancel, G as normalizePlatformApiUrl, W as listPlatformConnections, j as select } from "./output-tFQLLj26.mjs";
2
- import { C as writeDeploymentPlatform, b as readDeploymentPlatform, f as readPlatformToken, w as writePlatformSelection } from "./auth-W9WII-mN.mjs";
3
- import { a as isExpiredTokenError, n as PlatformClient } from "./client-CyCHWSO_.mjs";
4
- import { t as promptForLoginToken } from "./login-C8-UuLnp.mjs";
5
- import { t as connectCloudflare } from "./cloudflare-connect-BivMefMA.mjs";
6
- import { discoverPlatform, promptPlatformUrl, saveDiscoveredPlatform } from "./platform-cmd-BEOVv1PN.mjs";
1
+ import { D as log, I as isCancel, M as select, X as normalizePlatformApiUrl, Y as listPlatformConnections } from "./output-B0cfNSx5.mjs";
2
+ import { T as writePlatformSelection, p as readPlatformToken, w as writeDeploymentPlatform, x as readDeploymentPlatform } from "./auth-DPl6kck4.mjs";
3
+ import { a as isExpiredTokenError, n as PlatformClient } from "./client-dHfSJvAN.mjs";
4
+ import { n as promptForLoginToken } from "./login-Uvferzmm.mjs";
5
+ import { discoverPlatform, promptPlatformUrl, saveDiscoveredPlatform } from "./platform-cmd-BFhieCdV.mjs";
6
+ import { t as connectCloudflare } from "./cloudflare-connect-t1UU5svD.mjs";
7
7
  //#region src/cli/connect.ts
8
8
  async function selectVoidPlatform(interactive) {
9
9
  if (!interactive) throw new Error("connect: Supply a Void platform URL in non-interactive mode.");
@@ -1,7 +1,7 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.mjs";
2
- import { C as cancel, D as log, F as isCancel, N as text, c as import_picocolors, j as select, w as confirm } from "./output-tFQLLj26.mjs";
3
- import { T as writeProjectConfig, s as getSiteDomain, v as attachSelectedPlatform } from "./auth-W9WII-mN.mjs";
4
- import { t as PlatformApiError } from "./client-CyCHWSO_.mjs";
2
+ import { C as cancel, D as log, I as isCancel, M as select, P as text, c as import_picocolors, w as confirm } from "./output-B0cfNSx5.mjs";
3
+ import { E as writeProjectConfig, c as getSiteDomain, y as attachSelectedPlatform } from "./auth-DPl6kck4.mjs";
4
+ import { t as PlatformApiError } from "./client-dHfSJvAN.mjs";
5
5
  import { n as inferDefaultSlug } from "./resolve-project--Vxawf7z.mjs";
6
6
  //#region src/cli/project-slug.ts
7
7
  var project_slug_exports = /* @__PURE__ */ __exportAll({
@@ -39,7 +39,8 @@ async function promptProjectSelection(projects, message = "Select a project:", r
39
39
  label: "Create new project"
40
40
  }], ...projects.map((p) => ({
41
41
  value: p.id,
42
- label: `${p.slug} (${p.url ?? `${p.slug}.${getSiteDomain(root)}`})`
42
+ label: `${p.slug} (${p.url ?? `${p.slug}.${getSiteDomain(root)}`})`,
43
+ ...p.role ? { hint: p.role === "reader" ? "reader (read-only)" : p.role } : {}
43
44
  }))];
44
45
  const result = await select({
45
46
  message,
@@ -52,7 +53,7 @@ async function promptProjectSelection(projects, message = "Select a project:", r
52
53
  if (result === "__create__") return { action: "create" };
53
54
  const project = projects.find((p) => p.id === result);
54
55
  if (options.confirmExisting) {
55
- const confirmed = await confirm({ message: `Linking to an existing project. Running \`void deploy\` will overwrite the current deployment of ${project.url ?? `${project.slug}.${getSiteDomain(root)}`}. Continue?` });
56
+ const confirmed = await confirm({ message: project.role === "reader" ? `Link to ${project.slug} with read-only access? Deploying requires collaborator access or higher.` : `Linking to an existing project. Running \`void deploy\` will overwrite the current deployment of ${project.url ?? `${project.slug}.${getSiteDomain(root)}`}. Continue?` });
56
57
  if (isCancel(confirmed) || !confirmed) {
57
58
  cancel("Project link cancelled.");
58
59
  process.exit(0);
@@ -1,15 +1,15 @@
1
1
  import { c as relative, i as extname, l as resolve, o as join, t as basename } from "./dist-BrsS7cai.mjs";
2
- import { D as log, E as intro, F as isCancel, a as dim, c as import_picocolors, k as outro, r as cliTitle, w as confirm } from "./output-tFQLLj26.mjs";
2
+ import { A as outro, D as log, E as intro, H as ensurePlatformProxyAccess, I as isCancel, U as isCloudflareAccessChallenge, V as ensurePlatformAccessToken, a as dim, c as import_picocolors, r as cliTitle, w as confirm } from "./output-B0cfNSx5.mjs";
3
3
  import { n as readProjectPaths } from "./project-paths-SK8nMHPp.mjs";
4
- import { t as cfAccessHeaders } from "./cf-access-AJ1ehiFR.mjs";
5
- import { b as readDeploymentPlatform, c as getToken, o as getProxyUrl, x as readProjectConfig } from "./auth-W9WII-mN.mjs";
6
- import { c as getDatabaseDialect, f as readConfig, p as resolveBindingNames } from "./config-BQFq7QvD.mjs";
4
+ import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
5
+ import { S as readProjectConfig, l as getToken, s as getProxyUrl, x as readDeploymentPlatform } from "./auth-DPl6kck4.mjs";
6
+ import { c as getDatabaseDialect, f as readConfig, p as resolveBindingNames } from "./config-uNGuFsI2.mjs";
7
7
  import { r as detectFramework } from "./plugin-inference-BDRfZngg.mjs";
8
- import { c as collectMigrations, d as stripSqlExt, f as writeJournal, n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence, u as readJournal } from "./validate-Bihr8WBi.mjs";
9
- import { t as resolveLocalD1Target } from "./local-d1-BE8KBbMy.mjs";
10
- import { a as loadLocalEnv } from "./env-D4Emu-M_.mjs";
11
- import { n as PlatformClient, t as PlatformApiError } from "./client-CyCHWSO_.mjs";
12
- import { formatTimestamp } from "./gen-BKw6qHIg.mjs";
8
+ import { c as collectMigrations, d as stripSqlExt, f as writeJournal, n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence, u as readJournal } from "./validate-tBBN_dXH.mjs";
9
+ import { t as resolveLocalD1Target } from "./local-d1-D2I6Ox5F.mjs";
10
+ import { a as loadLocalEnv } from "./env-DBKmK4vc.mjs";
11
+ import { n as PlatformClient, t as PlatformApiError } from "./client-dHfSJvAN.mjs";
12
+ import { formatTimestamp } from "./gen-B_wPnVTK.mjs";
13
13
  import { createRequire } from "node:module";
14
14
  import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
15
15
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -233,7 +233,7 @@ async function runConnect(root, dialect, args) {
233
233
  if (result.dashboardUrl) log.info(`Dashboard: ${result.dashboardUrl}`);
234
234
  }
235
235
  if (!connectionString) {
236
- const { text: promptText, isCancel: isCancelCheck } = await import("./output-tFQLLj26.mjs").then((n) => n.T);
236
+ const { text: promptText, isCancel: isCancelCheck } = await import("./output-B0cfNSx5.mjs").then((n) => n.T);
237
237
  const answer = await promptText({
238
238
  message: `Enter your ${dialect === "mysql" ? "MySQL" : "PostgreSQL"} connection string:`,
239
239
  placeholder: dialect === "mysql" ? "mysql://user:pass@host:3306/database" : "postgresql://user:pass@host:5432/database"
@@ -278,19 +278,29 @@ async function runPush(root, dialect) {
278
278
  outro("Done.");
279
279
  }
280
280
  async function runGenerate(root, dialect) {
281
- const { prepareProject } = await import("./prepare-CBetXvsN.mjs");
281
+ const { prepareProject } = await import("./prepare-CtDJjoOj.mjs");
282
282
  const { writeDrizzleConfig } = await import("./config-NOG_U1aK.mjs").then((n) => n.t);
283
283
  await prepareProject(root);
284
284
  const authSchemaPath = join(root, ".void", "better-auth-schema.ts");
285
285
  const additionalSchemas = existsSync(authSchemaPath) ? [authSchemaPath] : void 0;
286
286
  const configPath = writeDrizzleConfig(root, dialect === "postgresql" ? "postgresql://dummy" : dialect === "mysql" ? "mysql://dummy" : ":memory:", dialect, { additionalSchemas });
287
287
  try {
288
- runDrizzleKit(root, [
288
+ if (dialect === "sqlite") {
289
+ const { generateValidatedSqliteMigrations } = await import("./generate-RTK8_kK1.mjs");
290
+ await generateValidatedSqliteMigrations(readProjectPaths(root).migrationsDir, () => {
291
+ runDrizzleKit(root, [
292
+ "generate",
293
+ "--config",
294
+ configPath
295
+ ]);
296
+ });
297
+ } else runDrizzleKit(root, [
289
298
  "generate",
290
299
  "--config",
291
300
  configPath
292
301
  ]);
293
- } catch {
302
+ } catch (error) {
303
+ log.error(getErrorMessage(error));
294
304
  process.exit(1);
295
305
  }
296
306
  outro("Done.");
@@ -334,7 +344,7 @@ async function runStatus(root, dialect) {
334
344
  localApplied = [];
335
345
  }
336
346
  else {
337
- const { getAppliedMigrations } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
347
+ const { getAppliedMigrations } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
338
348
  const { databasePath: dbPath } = getLocalD1Target(root);
339
349
  localApplied = await getAppliedMigrations(dbPath);
340
350
  }
@@ -344,12 +354,12 @@ async function runStatus(root, dialect) {
344
354
  if (dialect !== "sqlite") {
345
355
  const databaseUrl = process.env.DATABASE_URL;
346
356
  if (!databaseUrl) throw new Error("DATABASE_URL is not available.");
347
- remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-DCkWPsWS.mjs").then((n) => n.n)).getPgAppliedMigrations(databaseUrl) : await (await import("./runner-mysql-CgRFl3s6.mjs").then((n) => n.n)).getMySqlAppliedMigrations(databaseUrl)).map((name) => ({
357
+ remoteApplied = (dialect === "postgresql" ? await (await import("./runner-pg-BkEza-dX.mjs").then((n) => n.n)).getPgAppliedMigrations(databaseUrl) : await (await import("./runner-mysql-7BPUNGmL.mjs").then((n) => n.n)).getMySqlAppliedMigrations(databaseUrl)).map((name) => ({
348
358
  name,
349
359
  applied_at: ""
350
360
  }));
351
361
  } else {
352
- const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-CPTpRW6d.mjs").then((n) => n.t);
362
+ const { readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BzWnlC1_.mjs").then((n) => n.t);
353
363
  remoteApplied = (await readCloudflareD1Migrations(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"))).map((name) => ({
354
364
  name,
355
365
  applied_at: ""
@@ -425,12 +435,12 @@ async function resetDatabase(root, dialect) {
425
435
  }
426
436
  });
427
437
  if (migrations.length > 0) {
428
- const { applyMySqlMigrations } = await import("./runner-mysql-CgRFl3s6.mjs").then((n) => n.n);
438
+ const { applyMySqlMigrations } = await import("./runner-mysql-7BPUNGmL.mjs").then((n) => n.n);
429
439
  await withMySqlClient(root, (client) => applyMySqlMigrations(client, migrations));
430
440
  }
431
441
  return migrations.length;
432
442
  }
433
- const { runMigrations } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
443
+ const { runMigrations } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
434
444
  const { databasePath: dbPath } = getLocalD1Target(root);
435
445
  rmSync(dbPath, { force: true });
436
446
  rmSync(dbPath + "-wal", { force: true });
@@ -465,7 +475,7 @@ async function runSeed(root, file, dialect) {
465
475
  outro("Done.");
466
476
  return;
467
477
  }
468
- const { openSqliteDatabase } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
478
+ const { openSqliteDatabase } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
469
479
  const { databasePath: dbPath } = getLocalD1Target(root);
470
480
  const db = await openSqliteDatabase(dbPath);
471
481
  try {
@@ -591,7 +601,7 @@ async function runExecute(root, command, file, dialect, remote) {
591
601
  process.exit(0);
592
602
  }
593
603
  if (dialect === "sqlite") {
594
- const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-CPTpRW6d.mjs").then((n) => n.t);
604
+ const { executeCloudflareD1Sql, resolveCloudflareD1Context } = await import("./cloudflare-operations-BzWnlC1_.mjs").then((n) => n.t);
595
605
  const rows = await executeCloudflareD1Sql(resolveCloudflareD1Context(root, resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB"), sql);
596
606
  if (rows.length > 0) printTable(rows);
597
607
  else log.success("Executed successfully.");
@@ -633,21 +643,38 @@ async function runExecute(root, command, file, dialect, remote) {
633
643
  if (d1Resource) binding = d1Resource.binding_name;
634
644
  } catch {}
635
645
  const proxyUrl = getProxyUrl(root);
636
- const res = await fetch(`${proxyUrl}/d1/query`, {
637
- method: "POST",
638
- headers: {
639
- Authorization: `Bearer ${token}`,
640
- "Content-Type": "application/json",
641
- ...cfAccessHeaders(process.env, proxyUrl)
642
- },
643
- body: JSON.stringify({
644
- projectId: projectConfig.projectId,
645
- binding,
646
- sql,
647
- params: [],
648
- method: "all"
649
- })
650
- });
646
+ ensurePlatformProxyAccess(platformClient.apiUrl, proxyUrl);
647
+ const capturedAccessHeaders = cfAccessHeaders(process.env, proxyUrl);
648
+ const requestProxy = () => {
649
+ const currentAccessHeaders = cfAccessHeaders(process.env, proxyUrl);
650
+ const accessHeaders = Object.keys(currentAccessHeaders).length > 0 ? currentAccessHeaders : capturedAccessHeaders;
651
+ return {
652
+ accessHeaders,
653
+ response: fetch(`${proxyUrl}/d1/query`, {
654
+ method: "POST",
655
+ headers: {
656
+ Authorization: `Bearer ${token}`,
657
+ "Content-Type": "application/json",
658
+ ...accessHeaders
659
+ },
660
+ body: JSON.stringify({
661
+ projectId: projectConfig.projectId,
662
+ binding,
663
+ sql,
664
+ params: [],
665
+ method: "all"
666
+ }),
667
+ redirect: "manual"
668
+ })
669
+ };
670
+ };
671
+ const first = requestProxy();
672
+ let res = await first.response;
673
+ if (isCloudflareAccessChallenge(res) && !first.accessHeaders["CF-Access-Client-Id"]) {
674
+ await res.body?.cancel();
675
+ ensurePlatformAccessToken(proxyUrl, true, false, first.accessHeaders["cf-access-token"]);
676
+ res = await requestProxy().response;
677
+ }
651
678
  if (!res.ok) {
652
679
  const text = await res.text().catch(() => res.statusText);
653
680
  log.error(`db: Proxy request failed with ${res.status}: '${text}'.`);
@@ -679,7 +706,7 @@ async function runExecute(root, command, file, dialect, remote) {
679
706
  outro("Done.");
680
707
  return;
681
708
  }
682
- const { openSqliteDatabase } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
709
+ const { openSqliteDatabase } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
683
710
  const { databasePath: dbPath } = getLocalD1Target(root);
684
711
  if (!existsSync(dbPath)) {
685
712
  log.error("No local database found. Run `void dev` first.");
@@ -747,11 +774,11 @@ async function runMigrate(root, dialect, remote) {
747
774
  let appliedNames;
748
775
  let applyMigrations;
749
776
  if (dialect === "postgresql") {
750
- const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-DCkWPsWS.mjs").then((n) => n.n);
777
+ const { getPgAppliedMigrations, runPgMigrations } = await import("./runner-pg-BkEza-dX.mjs").then((n) => n.n);
751
778
  appliedNames = await getPgAppliedMigrations(databaseUrl);
752
779
  applyMigrations = () => runPgMigrations(migrationsDir, databaseUrl);
753
780
  } else {
754
- const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-CgRFl3s6.mjs").then((n) => n.n);
781
+ const { getMySqlAppliedMigrations, runMySqlMigrations } = await import("./runner-mysql-7BPUNGmL.mjs").then((n) => n.n);
755
782
  appliedNames = await getMySqlAppliedMigrations(databaseUrl);
756
783
  applyMigrations = () => runMySqlMigrations(migrationsDir, databaseUrl);
757
784
  }
@@ -779,7 +806,7 @@ async function runMigrate(root, dialect, remote) {
779
806
  outro("Done.");
780
807
  return;
781
808
  }
782
- const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-CPTpRW6d.mjs").then((n) => n.t);
809
+ const { applyCloudflareD1Migrations, readCloudflareD1Migrations, resolveCloudflareD1Context } = await import("./cloudflare-operations-BzWnlC1_.mjs").then((n) => n.t);
783
810
  const binding = resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
784
811
  const context = resolveCloudflareD1Context(root, binding);
785
812
  const remoteBefore = new Set(await readCloudflareD1Migrations(context));
@@ -795,7 +822,7 @@ async function runMigrate(root, dialect, remote) {
795
822
  log.error(getErrorMessage(error));
796
823
  process.exit(1);
797
824
  }
798
- const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-CcDoeBIf.mjs").then((n) => n.n);
825
+ const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-DTaWUS1S.mjs").then((n) => n.n);
799
826
  const applySet = await checkWranglerMigrationApplySet(context.operation.configPath, parseRootWranglerConfig(context.operation.configPath), binding, context.migrationsDir, rawMigrations);
800
827
  if (!applySet.ok) {
801
828
  log.error(applySet.reason);
@@ -864,7 +891,7 @@ async function runMigrate(root, dialect, remote) {
864
891
  return;
865
892
  }
866
893
  if (dialect === "postgresql") {
867
- const { applyPgMigrations } = await import("./runner-pg-DCkWPsWS.mjs").then((n) => n.n);
894
+ const { applyPgMigrations } = await import("./runner-pg-BkEza-dX.mjs").then((n) => n.n);
868
895
  const applied = await withPgClient(root, async (client) => {
869
896
  let existingRows = [];
870
897
  try {
@@ -889,7 +916,7 @@ async function runMigrate(root, dialect, remote) {
889
916
  return;
890
917
  }
891
918
  if (dialect === "mysql") {
892
- const { applyMySqlMigrations } = await import("./runner-mysql-CgRFl3s6.mjs").then((n) => n.n);
919
+ const { applyMySqlMigrations } = await import("./runner-mysql-7BPUNGmL.mjs").then((n) => n.n);
893
920
  const applied = await withMySqlClient(root, async (client) => {
894
921
  let existingRows = [];
895
922
  try {
@@ -913,7 +940,7 @@ async function runMigrate(root, dialect, remote) {
913
940
  outro("Done.");
914
941
  return;
915
942
  }
916
- const { getAppliedMigrations, runMigrations } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
943
+ const { getAppliedMigrations, runMigrations } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
917
944
  const { databasePath: dbPath } = getLocalD1Target(root);
918
945
  try {
919
946
  const existingRows = await getAppliedMigrations(dbPath);
@@ -1223,7 +1250,7 @@ async function runRenameMigrations(root, dialect) {
1223
1250
  process.exit(1);
1224
1251
  }
1225
1252
  else {
1226
- const { openSqliteDatabase } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
1253
+ const { openSqliteDatabase } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
1227
1254
  const { databasePath: dbPath } = getLocalD1Target(root);
1228
1255
  if (existsSync(dbPath)) try {
1229
1256
  const db = await openSqliteDatabase(dbPath);
@@ -1353,7 +1380,7 @@ async function runExport(root, args, dialect) {
1353
1380
  } else process.stdout.write(output);
1354
1381
  return;
1355
1382
  }
1356
- const { openSqliteDatabase } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
1383
+ const { openSqliteDatabase } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
1357
1384
  const { databasePath: dbPath } = getLocalD1Target(root);
1358
1385
  if (!existsSync(dbPath)) {
1359
1386
  log.error("No local database found. Run `void dev` first.", errOut);
@@ -1409,7 +1436,7 @@ async function runExport(root, args, dialect) {
1409
1436
  }
1410
1437
  }
1411
1438
  async function runSetUrl(root) {
1412
- const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-BQFq7QvD.mjs").then((n) => n.n);
1439
+ const { readConfig: readVoidConfig, getDatabaseDialect: getDialect } = await import("./config-uNGuFsI2.mjs").then((n) => n.n);
1413
1440
  const dialect = getDialect(readVoidConfig(root));
1414
1441
  if (dialect === "sqlite") {
1415
1442
  log.error("db: This command is only for PostgreSQL and MySQL projects. Set \"database\" to \"pg\" or \"mysql\" in void.json.");
@@ -1425,7 +1452,7 @@ async function runSetUrl(root) {
1425
1452
  log.error("No project linked. Run `void deploy` first or link a project.");
1426
1453
  process.exit(1);
1427
1454
  }
1428
- const { text: promptText, isCancel: isCancelCheck } = await import("./output-tFQLLj26.mjs").then((n) => n.T);
1455
+ const { text: promptText, isCancel: isCancelCheck } = await import("./output-B0cfNSx5.mjs").then((n) => n.T);
1429
1456
  const connectionString = await promptText({
1430
1457
  message: `Enter your ${dialect === "mysql" ? "MySQL" : "PostgreSQL"} connection string:`,
1431
1458
  placeholder: dialect === "mysql" ? "mysql://user:pass@host:3306/dbname" : "postgresql://user:pass@host:5432/dbname",
@@ -1512,7 +1539,7 @@ async function runSeedModule(root, seedPath, dialect) {
1512
1539
  return;
1513
1540
  }
1514
1541
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
1515
- const { openSqliteDatabase } = await import("./local-d1-BE8KBbMy.mjs").then((n) => n.i);
1542
+ const { openSqliteDatabase } = await import("./local-d1-D2I6Ox5F.mjs").then((n) => n.i);
1516
1543
  const { databasePath: dbPath } = getLocalD1Target(root);
1517
1544
  const sqlite = await openSqliteDatabase(dbPath);
1518
1545
  try {
@@ -1,6 +1,6 @@
1
- import { C as cancel, D as log, E as intro, F as isCancel, N as text, O as note, i as createSpinner, k as outro, r as cliTitle } from "./output-tFQLLj26.mjs";
2
- import { S as removeProjectConfig, c as getToken, x as readProjectConfig } from "./auth-W9WII-mN.mjs";
3
- import { n as PlatformClient } from "./client-CyCHWSO_.mjs";
1
+ import { A as outro, C as cancel, D as log, E as intro, I as isCancel, P as text, i as createSpinner, k as note, r as cliTitle } from "./output-B0cfNSx5.mjs";
2
+ import { C as removeProjectConfig, S as readProjectConfig, l as getToken } from "./auth-DPl6kck4.mjs";
3
+ import { n as PlatformClient } from "./client-dHfSJvAN.mjs";
4
4
  import { r as resolveProjectBySlug } from "./resolve-project--Vxawf7z.mjs";
5
5
  //#region src/cli/delete.ts
6
6
  async function runDeleteCommand(root, slug, options) {