void 0.21.5 → 0.21.7

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 (31) hide show
  1. package/dist/{account-cmd-DGt9cpRe.mjs → account-cmd-CQ2wi4Th.mjs} +2 -2
  2. package/dist/{auth-link-Cl9vOuf7.mjs → auth-link-B_lceSHK.mjs} +2 -2
  3. package/dist/{auth-router-D4ZcMUSf.mjs → auth-router-cZq0HuWe.mjs} +4 -4
  4. package/dist/cli/cf-compat.mjs +30 -18
  5. package/dist/cli/cli.mjs +18 -18
  6. package/dist/{cloudflare-auth-B9jPCkV2.mjs → cloudflare-auth-C4_GPZr0.mjs} +5 -1
  7. package/dist/{cloudflare-cmd-BjNxR1XF.mjs → cloudflare-cmd-bSmZ1d5L.mjs} +1 -1
  8. package/dist/{cloudflare-connect-CCUozPOe.mjs → cloudflare-connect-jAwacxxP.mjs} +1 -1
  9. package/dist/{connect-4Ph5Y0QE.mjs → connect-BY38i-9E.mjs} +3 -3
  10. package/dist/{db-BAJbaEVn.mjs → db-BIo37Y7H.mjs} +1 -1
  11. package/dist/{deploy-CmePjn6m.mjs → deploy-BM_LoBXC.mjs} +1 -1
  12. package/dist/{deploy-BfZyWZIn.mjs → deploy-C0JaQSWS.mjs} +407 -27
  13. package/dist/{email-CYq8VQ96.mjs → email-dMnE_Lat.mjs} +1 -1
  14. package/dist/index.mjs +1 -1
  15. package/dist/{init-CRGDXzVC.mjs → init-CJSnEcuj.mjs} +3 -3
  16. package/dist/{login-BQyISZuW.mjs → login-DZldyb8c.mjs} +1 -1
  17. package/dist/login-t6rndSRW.mjs +2 -0
  18. package/dist/{operator-cmd-Co-PeaeD.mjs → operator-cmd-B9dbG3Od.mjs} +2 -2
  19. package/dist/{platform-auth-config-TSw8edHw.mjs → platform-auth-config-Bex45lQt.mjs} +2 -2
  20. package/dist/{platform-auth-protection-Ba1XqGhn.mjs → platform-auth-protection-Dma02l6-.mjs} +2 -2
  21. package/dist/{platform-auth-recovery-BkT3EsF2.mjs → platform-auth-recovery-COOhMCvx.mjs} +2 -2
  22. package/dist/{platform-cmd-CRSKfu8k.mjs → platform-cmd-BtxZrT6w.mjs} +3 -3
  23. package/dist/{platform-cmd-C8OqhqPt.mjs → platform-cmd-CjNB09OF.mjs} +1 -1
  24. package/dist/{platform-domain-j9YCXRm6.mjs → platform-domain-DppaTARe.mjs} +2 -2
  25. package/dist/{platform-lifecycle-78H0XQUA.mjs → platform-lifecycle-BpDlxT3t.mjs} +7 -7
  26. package/dist/{platform-lifecycle-DDc9zCeJ.mjs → platform-lifecycle-CYll-oKE.mjs} +1 -1
  27. package/dist/{platform-management-6w8-DUjC.mjs → platform-management-BKYenDlE.mjs} +1 -1
  28. package/dist/{platform-management-DzKNsMlt.mjs → platform-management-BS5r6Ao8.mjs} +1 -1
  29. package/dist/{platform-recovery-Do8VOyDE.mjs → platform-recovery-dJ5Me-I0.mjs} +2 -2
  30. package/package.json +7 -7
  31. package/dist/login-r2gL8l7B.mjs +0 -2
@@ -1,13 +1,13 @@
1
1
  import { c as getToken, p as removeToken } from "./auth-DLNN0D3Z.mjs";
2
2
  import { j as log } from "./dist-Dn6nn2IU.mjs";
3
3
  import { n as PlatformClient } from "./client-QTl6ko_D.mjs";
4
- import { n as runLoginCommand } from "./login-BQyISZuW.mjs";
4
+ import { n as runLoginCommand } from "./login-DZldyb8c.mjs";
5
5
  import { execSync } from "node:child_process";
6
6
  //#region src/cli/account-cmd.ts
7
7
  async function runAccountCommand(root, args) {
8
8
  switch (args.subcommand) {
9
9
  case "login": return runLoginCommand(root);
10
- case "link": return import("./auth-link-Cl9vOuf7.mjs").then(({ runAuthLink }) => runAuthLink(root, args.connectionId));
10
+ case "link": return import("./auth-link-B_lceSHK.mjs").then(({ runAuthLink }) => runAuthLink(root, args.connectionId));
11
11
  case "logout":
12
12
  if (removeToken(root)) log.success("Logged out.");
13
13
  else log.info("Not logged in.");
@@ -1,8 +1,8 @@
1
1
  import { a as getApiUrl, c as getToken, d as openBrowser, g as savePlatformToken, h as runPlatformLogin } from "./auth-DLNN0D3Z.mjs";
2
2
  import { j as log } from "./dist-Dn6nn2IU.mjs";
3
3
  import { n as PlatformClient } from "./client-QTl6ko_D.mjs";
4
- import { r as selectPlatformLoginMethod } from "./login-BQyISZuW.mjs";
5
- import { t as discoverPlatform } from "./platform-cmd-CRSKfu8k.mjs";
4
+ import { r as selectPlatformLoginMethod } from "./login-DZldyb8c.mjs";
5
+ import { t as discoverPlatform } from "./platform-cmd-BtxZrT6w.mjs";
6
6
  import { execFile } from "node:child_process";
7
7
  //#region src/cli/auth-link.ts
8
8
  async function runAuthLink(root, connectionId) {
@@ -37,7 +37,7 @@ async function chooseDestination(root, args, interactive) {
37
37
  }
38
38
  async function runAuthRouter(root, args, interactive = Boolean(process.stdin.isTTY)) {
39
39
  if (args.subcommand === "link") {
40
- const { runAccountCommand } = await import("./account-cmd-DGt9cpRe.mjs");
40
+ const { runAccountCommand } = await import("./account-cmd-CQ2wi4Th.mjs");
41
41
  await runAccountCommand(root, {
42
42
  subcommand: "link",
43
43
  ...args.connectionId ? { connectionId: args.connectionId } : {}
@@ -45,17 +45,17 @@ async function runAuthRouter(root, args, interactive = Boolean(process.stdin.isT
45
45
  return;
46
46
  }
47
47
  if (args.subcommand === "token") {
48
- const { runAccountCommand } = await import("./account-cmd-DGt9cpRe.mjs");
48
+ const { runAccountCommand } = await import("./account-cmd-CQ2wi4Th.mjs");
49
49
  await runAccountCommand(root, { subcommand: "token" });
50
50
  return;
51
51
  }
52
52
  const destination = await chooseDestination(root, args, interactive);
53
53
  if (destination.platform === "cloudflare") {
54
- const { runCloudflareCommand } = await import("./cloudflare-cmd-BjNxR1XF.mjs");
54
+ const { runCloudflareCommand } = await import("./cloudflare-cmd-bSmZ1d5L.mjs");
55
55
  await runCloudflareCommand(root, { subcommand: args.subcommand === "whoami" || args.subcommand === "status" ? "status" : args.subcommand });
56
56
  return;
57
57
  }
58
- const { runAccountCommand } = await import("./account-cmd-DGt9cpRe.mjs");
58
+ const { runAccountCommand } = await import("./account-cmd-CQ2wi4Th.mjs");
59
59
  const subcommand = args.subcommand === "status" ? "whoami" : args.subcommand;
60
60
  if (!destination.apiUrl) {
61
61
  await runAccountCommand(root, { subcommand });
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as join, n as dirname, u as resolve } from "../dist-BVqXeR_h.mjs";
3
3
  import { t as prepareCfBuildOutput } from "../cf-build-output-CGT03qCD.mjs";
4
- import { copyFileSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
- import { fileURLToPath } from "node:url";
4
+ import { copyFileSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import { tmpdir } from "node:os";
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { parse } from "jsonc-parser";
@@ -21,7 +21,8 @@ function cfEnvironment() {
21
21
  ...process.env,
22
22
  CF_DELEGATION: "1",
23
23
  CF_SEND_TELEMETRY: "false",
24
- CF_NO_OSC_PROGRESS: "1"
24
+ CF_NO_OSC_PROGRESS: "1",
25
+ CLOUDFLARE_AUTH_USE_KEYRING: "true"
25
26
  };
26
27
  if (env.HTTP_PROXY || env.HTTPS_PROXY || env.http_proxy || env.https_proxy) env.NODE_USE_ENV_PROXY = "1";
27
28
  for (const [canonical, alias] of [
@@ -39,10 +40,9 @@ function result(status, stdout = "", stderr = "") {
39
40
  stderr
40
41
  };
41
42
  }
42
- function runCf(command, cwd = process.cwd(), useLoginProfile = false) {
43
+ function runCf(command, cwd = process.cwd()) {
43
44
  const env = cfEnvironment();
44
45
  env.CF_QUIET = "1";
45
- if (useLoginProfile) delete env.CLOUDFLARE_AUTH_USE_KEYRING;
46
46
  const child = spawnSync(process.execPath, [cf, ...command], {
47
47
  cwd,
48
48
  env,
@@ -169,7 +169,7 @@ async function cloudflareApiGet(path, failure, extraHeaders = {}) {
169
169
  try {
170
170
  const response = await fetch$1(url, {
171
171
  headers: {
172
- ...apiHeaders(),
172
+ ...await apiHeaders(),
173
173
  ...extraHeaders
174
174
  },
175
175
  redirect: "error",
@@ -190,7 +190,7 @@ async function clearWorkerCronSchedules(worker) {
190
190
  const response = await fetch$1(endpoint, {
191
191
  method: "PUT",
192
192
  headers: {
193
- ...apiHeaders(),
193
+ ...await apiHeaders(),
194
194
  "Content-Type": "application/json"
195
195
  },
196
196
  body: "[]",
@@ -245,14 +245,14 @@ async function readVersionResources(worker, versionId) {
245
245
  if (!Array.isArray(resources.bindings) || !resources.script || !resources.script_runtime) throw new Error("Cloudflare Worker version resources were incomplete.");
246
246
  return resources;
247
247
  }
248
- function apiHeaders() {
248
+ async function apiHeaders() {
249
249
  const key = process.env.CLOUDFLARE_API_KEY ?? process.env.CF_API_KEY;
250
250
  const email = process.env.CLOUDFLARE_EMAIL ?? process.env.CF_EMAIL;
251
251
  if (key && email) return {
252
252
  "X-Auth-Key": key,
253
253
  "X-Auth-Email": email
254
254
  };
255
- const credential = sessionCredential();
255
+ const credential = await sessionCredential();
256
256
  if (!credential) throw new Error("Cloudflare session bearer is unavailable.");
257
257
  return { Authorization: `Bearer ${credential.token}` };
258
258
  }
@@ -269,25 +269,37 @@ async function withSecretFile(content, action) {
269
269
  });
270
270
  }
271
271
  }
272
- function sessionCredential() {
272
+ async function sessionCredential() {
273
273
  const token = process.env.CLOUDFLARE_API_TOKEN || process.env.CF_API_TOKEN;
274
274
  if (token) return {
275
275
  type: "api_token",
276
276
  token
277
277
  };
278
- const identity = runCf(["auth", "whoami"], process.cwd(), true);
278
+ const identity = runCf(["auth", "whoami"]);
279
279
  if (identity.status !== 0) return null;
280
280
  const state = object(parsedJson(identity.stdout));
281
281
  if (state.authenticated !== true || state.tokenValid !== true) return null;
282
- const source = state.authSource;
283
- if (typeof source !== "string" || !source.startsWith("OAuth token from ")) return null;
284
- const credential = object(parsedJson(readFileSync(source.slice(17), "utf8")));
285
- return typeof credential.oauth_token === "string" && credential.oauth_token ? {
282
+ if (typeof state.authSource !== "string" || !state.authSource.startsWith("OAuth token")) return null;
283
+ const dist = join(dirname(fileURLToPath(import.meta.resolve("cf/package.json"))), "dist");
284
+ const entry = readdirSync(dist).find((name) => /^cf-[^/]+\.mjs$/.test(name));
285
+ if (!entry) throw new Error("The bundled Cloudflare credential reader is unavailable.");
286
+ const module = await import(pathToFileURL(join(dist, entry)).href);
287
+ if (typeof module.t !== "function") throw new Error("The bundled Cloudflare credential reader is unavailable.");
288
+ const noop = () => {};
289
+ const stored = module.t({ logger: {
290
+ debug: noop,
291
+ info: noop,
292
+ log: noop,
293
+ warn: noop,
294
+ error: noop
295
+ } }).readAuthCredentials();
296
+ const credential = stored && typeof stored === "object" ? stored : null;
297
+ return credential && typeof credential.oauth_token === "string" && credential.oauth_token ? {
286
298
  type: "oauth",
287
299
  token: credential.oauth_token
288
300
  } : null;
289
301
  }
290
- function auth() {
302
+ async function auth() {
291
303
  if (args[0] === "login") return runInteractiveCf([
292
304
  "auth",
293
305
  "login",
@@ -308,7 +320,7 @@ function auth() {
308
320
  }), called.stderr);
309
321
  }
310
322
  if (args[0] === "auth" && args[1] === "token") {
311
- const credential = sessionCredential();
323
+ const credential = await sessionCredential();
312
324
  return credential ? result(0, `${JSON.stringify(credential)}\n`) : result(1, "", "Cloudflare session has no OAuth bearer.");
313
325
  }
314
326
  return result(1, "", "Unsupported Cloudflare authentication operation.");
@@ -843,7 +855,7 @@ async function tail() {
843
855
  ] });
844
856
  const endpoint = `${(process.env.CLOUDFLARE_API_BASE_URL ?? "https://api.cloudflare.com/client/v4").replace(/\/$/, "")}/accounts/${encodeURIComponent(accountId)}/workers/scripts/${encodeURIComponent(worker)}/tails`;
845
857
  const headers = {
846
- ...apiHeaders(),
858
+ ...await apiHeaders(),
847
859
  "Content-Type": "application/json"
848
860
  };
849
861
  const stopped = new AbortController();
package/dist/cli/cli.mjs CHANGED
@@ -2020,7 +2020,7 @@ if (helpPath) {
2020
2020
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
2021
2021
  process.exit(1);
2022
2022
  }
2023
- import("../deploy-CmePjn6m.mjs").then(({ runDeploy }) => {
2023
+ import("../deploy-BM_LoBXC.mjs").then(({ runDeploy }) => {
2024
2024
  runDeploy(root, {
2025
2025
  projectSlug: deployArgs.projectSlug,
2026
2026
  dir: deployArgs.dir,
@@ -2039,21 +2039,21 @@ if (helpPath) {
2039
2039
  });
2040
2040
  } else if (command === "connect") (async () => {
2041
2041
  const parsed = parseConnectArgs(args.slice(1));
2042
- const { runConnectCommand } = await import("../connect-4Ph5Y0QE.mjs");
2042
+ const { runConnectCommand } = await import("../connect-BY38i-9E.mjs");
2043
2043
  await runConnectCommand(process.cwd(), parsed);
2044
2044
  })().catch((err) => {
2045
2045
  log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
2046
2046
  process.exit(1);
2047
2047
  });
2048
- else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-D4ZcMUSf.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed)));
2049
- else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-DGt9cpRe.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed)));
2050
- else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-C8OqhqPt.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed)));
2051
- else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-BjNxR1XF.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed)));
2048
+ else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-cZq0HuWe.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed)));
2049
+ else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-CQ2wi4Th.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed)));
2050
+ else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-CjNB09OF.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed)));
2051
+ else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-bSmZ1d5L.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed)));
2052
2052
  else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-B44I8J_W.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
2053
2053
  else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-DN9sSNiV.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
2054
2054
  else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-Dmhvb2oU.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
2055
- else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-CYq8VQ96.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed)));
2056
- else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-BAJbaEVn.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
2055
+ else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-dMnE_Lat.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed)));
2056
+ else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-BIo37Y7H.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
2057
2057
  else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Csi-tMbT.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
2058
2058
  else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-Vnv2f65C.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
2059
2059
  else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-BED3_9JD.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed)));
@@ -2075,7 +2075,7 @@ else if (command === "prepare") {
2075
2075
  });
2076
2076
  } else if (command === "init") {
2077
2077
  const root = process.cwd();
2078
- import("../init-CRGDXzVC.mjs").then(({ runInitCommand, parseInitArgs }) => {
2078
+ import("../init-CJSnEcuj.mjs").then(({ runInitCommand, parseInitArgs }) => {
2079
2079
  let initArgs;
2080
2080
  try {
2081
2081
  initArgs = parseInitArgs(args.slice(1));
@@ -2207,12 +2207,12 @@ else if (command === "prepare") {
2207
2207
  const root = process.cwd();
2208
2208
  switch (cmd) {
2209
2209
  case "connect": {
2210
- const { runConnectCommand } = await import("../connect-4Ph5Y0QE.mjs");
2210
+ const { runConnectCommand } = await import("../connect-BY38i-9E.mjs");
2211
2211
  await runConnectCommand(root, parseConnectArgs([]));
2212
2212
  return;
2213
2213
  }
2214
2214
  case "init": {
2215
- const { runInitCommand, parseInitArgs } = await import("../init-CRGDXzVC.mjs");
2215
+ const { runInitCommand, parseInitArgs } = await import("../init-CJSnEcuj.mjs");
2216
2216
  await runInitCommand(root, parseInitArgs([]));
2217
2217
  return;
2218
2218
  }
@@ -2222,21 +2222,21 @@ else if (command === "prepare") {
2222
2222
  return;
2223
2223
  }
2224
2224
  case "deploy": {
2225
- const { runDeploy } = await import("../deploy-CmePjn6m.mjs");
2225
+ const { runDeploy } = await import("../deploy-BM_LoBXC.mjs");
2226
2226
  await runDeploy(root);
2227
2227
  return;
2228
2228
  }
2229
- case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-D4ZcMUSf.mjs").then(({ runAuthRouter }) => runAuthRouter(r, p)));
2230
- case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-DGt9cpRe.mjs").then(({ runAccountCommand }) => runAccountCommand(r, p)));
2231
- case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-C8OqhqPt.mjs").then(({ runPlatformCommand }) => runPlatformCommand(r, p)));
2232
- case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-BjNxR1XF.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(r, p)));
2229
+ case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-cZq0HuWe.mjs").then(({ runAuthRouter }) => runAuthRouter(r, p)));
2230
+ case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-CQ2wi4Th.mjs").then(({ runAccountCommand }) => runAccountCommand(r, p)));
2231
+ case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-CjNB09OF.mjs").then(({ runPlatformCommand }) => runPlatformCommand(r, p)));
2232
+ case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-bSmZ1d5L.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(r, p)));
2233
2233
  case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-B44I8J_W.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
2234
2234
  case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-DN9sSNiV.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
2235
2235
  case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-Dmhvb2oU.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
2236
2236
  case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-BED3_9JD.mjs").then(({ runGithubCommand }) => runGithubCommand(r, p)));
2237
2237
  case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-Dpt0jd-x.mjs").then(({ runBuildCommand }) => runBuildCommand(r, p)));
2238
- case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-CYq8VQ96.mjs").then(({ runEmailCommand }) => runEmailCommand(r, p)));
2239
- case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-BAJbaEVn.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
2238
+ case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-dMnE_Lat.mjs").then(({ runEmailCommand }) => runEmailCommand(r, p)));
2239
+ case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-BIo37Y7H.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
2240
2240
  case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Csi-tMbT.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
2241
2241
  case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-Vnv2f65C.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
2242
2242
  case "prepare": {
@@ -173,7 +173,11 @@ function cloudflareAuthEnvironment(source = process.env) {
173
173
  "WRANGLER_OUTPUT_FILE_PATH",
174
174
  "WRANGLER_LOG_SANITIZE"
175
175
  ]);
176
- 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];
176
+ for (const key of Object.keys(env)) {
177
+ 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];
178
+ if (key.toUpperCase() === "CLOUDFLARE_AUTH_USE_KEYRING") delete env[key];
179
+ }
180
+ env.CLOUDFLARE_AUTH_USE_KEYRING = "true";
177
181
  return env;
178
182
  }
179
183
  function isCleanExit(result) {
@@ -1,7 +1,7 @@
1
1
  import { t as basename } from "./dist-BVqXeR_h.mjs";
2
2
  import { v as readRootWranglerConfig } from "./wrangler-BymcxrRa.mjs";
3
3
  import { j as log } from "./dist-Dn6nn2IU.mjs";
4
- import { a as createBundledCloudflareAuthRunner, i as cloudflareCredentialOverrides, o as ensureCloudflareAuthentication, s as parseCloudflareAuthSession } from "./cloudflare-auth-B9jPCkV2.mjs";
4
+ import { a as createBundledCloudflareAuthRunner, i as cloudflareCredentialOverrides, o as ensureCloudflareAuthentication, s as parseCloudflareAuthSession } from "./cloudflare-auth-C4_GPZr0.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 { a as join, t as basename } from "./dist-BVqXeR_h.mjs";
2
2
  import { i as LATEST_KNOWN_COMPAT_DATE, k as writeProvisionedWranglerConfig, v as readRootWranglerConfig } from "./wrangler-BymcxrRa.mjs";
3
3
  import { I as select, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
4
- import { a as createBundledCloudflareAuthRunner, o as ensureCloudflareAuthentication } from "./cloudflare-auth-B9jPCkV2.mjs";
4
+ import { a as createBundledCloudflareAuthRunner, o as ensureCloudflareAuthentication } from "./cloudflare-auth-C4_GPZr0.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,9 +3,9 @@ import { o as listPlatformConnections, s as normalizePlatformApiUrl } from "./pl
3
3
  import { i as readDeploymentPlatform, l as writeDeploymentPlatform, u as writePlatformSelection } from "./project-C0Fqu05O.mjs";
4
4
  import { I as select, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
5
5
  import { i as isExpiredTokenError, n as PlatformClient } from "./client-QTl6ko_D.mjs";
6
- import { t as promptForLoginToken } from "./login-BQyISZuW.mjs";
7
- import { i as saveDiscoveredPlatform, n as promptPlatformUrl, t as discoverPlatform } from "./platform-cmd-CRSKfu8k.mjs";
8
- import { t as connectCloudflare } from "./cloudflare-connect-CCUozPOe.mjs";
6
+ import { t as promptForLoginToken } from "./login-DZldyb8c.mjs";
7
+ import { i as saveDiscoveredPlatform, n as promptPlatformUrl, t as discoverPlatform } from "./platform-cmd-BtxZrT6w.mjs";
8
+ import { t as connectCloudflare } from "./cloudflare-connect-jAwacxxP.mjs";
9
9
  //#region src/cli/connect.ts
10
10
  async function selectVoidPlatform(interactive) {
11
11
  if (!interactive) throw new Error("connect: Supply a Void platform URL in non-interactive mode.");
@@ -862,7 +862,7 @@ async function runMigrate(root, dialect, remote) {
862
862
  log.error(getErrorMessage(error));
863
863
  process.exit(1);
864
864
  }
865
- const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-CmePjn6m.mjs");
865
+ const { checkWranglerMigrationApplySet, parseRootWranglerConfig } = await import("./deploy-BM_LoBXC.mjs");
866
866
  const applySet = await checkWranglerMigrationApplySet(context.operation.configPath, parseRootWranglerConfig(context.operation.configPath), binding, context.migrationsDir, rawMigrations);
867
867
  if (!applySet.ok) {
868
868
  log.error(applySet.reason);
@@ -1,2 +1,2 @@
1
- import { A as parseRootWranglerConfig, J as runDeploy, f as checkWranglerMigrationApplySet } from "./deploy-BfZyWZIn.mjs";
1
+ import { A as parseRootWranglerConfig, J as runDeploy, f as checkWranglerMigrationApplySet } from "./deploy-C0JaQSWS.mjs";
2
2
  export { checkWranglerMigrationApplySet, parseRootWranglerConfig, runDeploy };
@@ -36,7 +36,7 @@ import { i as migrateBuiltWranglerConfig, n as prepareCfFrameworkBuildOutput, r
36
36
  import { n as getPackageDir } from "./agents-B_pX_HmQ.mjs";
37
37
  import { i as isExpiredTokenError, n as PlatformClient, o as parsePlatformErrorBody, r as isCliOutdatedError, s as platformErrorMessage, t as PlatformApiError } from "./client-QTl6ko_D.mjs";
38
38
  import { a as resolveProjectCommand, i as hasBackendFiles, n as detectPreset, o as resolveWranglerArgv, r as formatProjectCommand, t as FRAMEWORK_PRESETS } from "./preset-UHj9ARyP.mjs";
39
- import { o as ensureCloudflareAuthentication, r as cloudflareAuthNeedsTerminal, t as CloudflareAuthenticationError } from "./cloudflare-auth-B9jPCkV2.mjs";
39
+ import { i as cloudflareCredentialOverrides, o as ensureCloudflareAuthentication, r as cloudflareAuthNeedsTerminal, s as parseCloudflareAuthSession, t as CloudflareAuthenticationError } from "./cloudflare-auth-C4_GPZr0.mjs";
40
40
  import { n as writeVoidProjectConfig } from "./config-write-BSduPMY8.mjs";
41
41
  import { r as discoverFrameworkWranglerFiles, t as migrateLegacyVoidConfig } from "./migrate-B8KuoYsO.mjs";
42
42
  import { a as createCloudflareEmptyDomainPublisher, i as createCloudflareEmptyCronPublisher } from "./cloudflare-operations-sMZXpk_S.mjs";
@@ -44,7 +44,7 @@ import { t as formatCloudflareUserMessage } from "./cloudflare-user-output-Q-k0Q
44
44
  import { a as promptProjectSetupAction, i as promptProjectSelection, r as promptAndCreateProject } from "./create-project-DBfFSZKY.mjs";
45
45
  import { t as getRequestedProjectSlug } from "./resolve-project-BG5ORGID.mjs";
46
46
  import { t as collectGitDeployMetadata } from "./git-metadata-D-gurjzG.mjs";
47
- import { t as promptForLoginToken } from "./login-BQyISZuW.mjs";
47
+ import { t as promptForLoginToken } from "./login-DZldyb8c.mjs";
48
48
  import { createRequire } from "node:module";
49
49
  import { copyFileSync, cpSync, createWriteStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
50
50
  import { fileURLToPath } from "node:url";
@@ -56,8 +56,8 @@ import { execFile, execSync, spawn, spawnSync } from "node:child_process";
56
56
  import { applyEdits, modify, parse } from "jsonc-parser";
57
57
  import { isDeepStrictEqual } from "node:util";
58
58
  import { Minimatch } from "minimatch";
59
- import { activateCloudflareVersion, assertCloudflareBindingsPreserved, assertCloudflareDurableObjectLifecycleSupported, assertExistingCloudflareConfig, encodeCloudflareVersionMessage, extractWorkersDevSubdomain, normalizeWorkersDevSubdomain, parseRootWranglerConfig, parseRootWranglerConfig as parseRootWranglerConfig$1, readBindingFieldPresence, readCloudflareTriggerConfig, readConfigEntryString, readExistingCloudflareWorker, readStoredResourceName, readWranglerTopLevelString, renderCloudflareStaticEntry, resolveD1MigrateTarget, stageCloudflareStaticAssets, writeCloudflareFrameworkDeployConfig, writeCloudflareStaticDeployConfig } from "@void/deploy-cloudflare";
60
- import { getWorkerConfigPath, readBuildOutput } from "@cloudflare/build-output-utils";
59
+ import { CloudflareWorkerInspectionError, activateCloudflareVersion, assertCloudflareBindingsPreserved, assertCloudflareDurableObjectLifecycleSupported, assertExistingCloudflareConfig, encodeCloudflareVersionMessage, extractWorkersDevSubdomain, normalizeWorkersDevSubdomain, parseRootWranglerConfig, parseRootWranglerConfig as parseRootWranglerConfig$1, readBindingFieldPresence, readCloudflareTriggerConfig, readConfigEntryString, readExistingCloudflareWorker, readStoredResourceName, readWranglerTopLevelString, renderCloudflareStaticEntry, resolveD1MigrateTarget, stageCloudflareStaticAssets, writeCloudflareFrameworkDeployConfig, writeCloudflareStaticDeployConfig } from "@void/deploy-cloudflare";
60
+ import { getWorkerAssetsDir, getWorkerBundleDir, getWorkerConfigPath, readBuildOutput } from "@cloudflare/build-output-utils";
61
61
  import ignore from "ignore";
62
62
  import { hash } from "blake3-jit";
63
63
  //#region src/asset-routing.ts
@@ -1857,6 +1857,324 @@ async function prerenderPagesNode(options) {
1857
1857
  return result;
1858
1858
  }
1859
1859
  //#endregion
1860
+ //#region src/cli/cf-version-api.ts
1861
+ function object(value) {
1862
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
1863
+ }
1864
+ function requiredString(value, label) {
1865
+ if (typeof value !== "string" || !value) throw new Error(`The Cloudflare ${label} is missing from the verified Worker output.`);
1866
+ return value;
1867
+ }
1868
+ function textValue(value, label) {
1869
+ if (typeof value !== "string") throw new Error(`The Cloudflare ${label} is missing from the verified Worker output.`);
1870
+ return value;
1871
+ }
1872
+ const moduleContentTypes = {
1873
+ esm: "application/javascript+module",
1874
+ cjs: "application/javascript",
1875
+ wasm: "application/wasm",
1876
+ text: "text/plain",
1877
+ data: "application/octet-stream",
1878
+ json: "text/plain",
1879
+ sourcemap: "application/source-map"
1880
+ };
1881
+ function bindingsFromOutput(env, workerName, activeSecrets, explicitSecrets) {
1882
+ const inherited = new Map(activeSecrets.bindings.map((binding) => [binding.name, binding.type]));
1883
+ const names = /* @__PURE__ */ new Set([
1884
+ ...Object.keys(env),
1885
+ ...inherited.keys(),
1886
+ ...Object.keys(explicitSecrets)
1887
+ ]);
1888
+ const bindings = [];
1889
+ for (const name of names) {
1890
+ const value = object(env[name]);
1891
+ const explicit = explicitSecrets[name];
1892
+ if (explicit !== void 0) {
1893
+ if (typeof explicit !== "string" || inherited.get(name) === "secret_key" || value && value.type !== "secret") throw new Error(`Cloudflare secret ${name} has an invalid explicit value or binding.`);
1894
+ bindings.push({
1895
+ name,
1896
+ type: "secret_text",
1897
+ text: explicit
1898
+ });
1899
+ continue;
1900
+ }
1901
+ if (inherited.has(name)) {
1902
+ if (value && ![
1903
+ "secret",
1904
+ "inherit",
1905
+ "unsafe:inherit"
1906
+ ].includes(String(value.type))) throw new Error(`Cloudflare secret ${name} conflicts with a Worker binding.`);
1907
+ bindings.push({
1908
+ name,
1909
+ type: "inherit",
1910
+ version_id: activeSecrets.versionId
1911
+ });
1912
+ continue;
1913
+ }
1914
+ if (!value) throw new Error(`Cloudflare binding ${name} is missing from the Worker output.`);
1915
+ switch (value.type) {
1916
+ case "text":
1917
+ bindings.push({
1918
+ name,
1919
+ type: "plain_text",
1920
+ text: textValue(value.value, name)
1921
+ });
1922
+ break;
1923
+ case "json":
1924
+ bindings.push({
1925
+ name,
1926
+ type: "json",
1927
+ json: value.value
1928
+ });
1929
+ break;
1930
+ case "kv":
1931
+ bindings.push({
1932
+ name,
1933
+ type: "kv_namespace",
1934
+ namespace_id: requiredString(value.id, name)
1935
+ });
1936
+ break;
1937
+ case "d1":
1938
+ bindings.push({
1939
+ name,
1940
+ type: "d1",
1941
+ database_id: requiredString(value.id, name)
1942
+ });
1943
+ break;
1944
+ case "r2":
1945
+ bindings.push({
1946
+ name,
1947
+ type: "r2_bucket",
1948
+ bucket_name: requiredString(value.name, name),
1949
+ ...value.jurisdiction ? { jurisdiction: value.jurisdiction } : {}
1950
+ });
1951
+ break;
1952
+ case "durable-object":
1953
+ bindings.push({
1954
+ name,
1955
+ type: "durable_object_namespace",
1956
+ class_name: requiredString(value.exportName, name),
1957
+ ...value.worker !== workerName ? { script_name: requiredString(value.worker, name) } : {}
1958
+ });
1959
+ break;
1960
+ case "assets":
1961
+ bindings.push({
1962
+ name,
1963
+ type: "assets"
1964
+ });
1965
+ break;
1966
+ default: throw new Error(`Cloudflare binding ${name} cannot be uploaded with pinned secrets.`);
1967
+ }
1968
+ }
1969
+ return bindings;
1970
+ }
1971
+ function exportsFromOutput(exports) {
1972
+ if (exports === void 0) return;
1973
+ const entries = object(exports);
1974
+ if (!entries) throw new Error("Cloudflare Durable Object exports were not readable.");
1975
+ const result = {};
1976
+ for (const [name, raw] of Object.entries(entries)) {
1977
+ const value = object(raw);
1978
+ if (!value || value.type !== "durable-object") throw new Error(`Cloudflare export ${name} cannot be uploaded with pinned secrets.`);
1979
+ if (value.state === "deleted") result[name] = {
1980
+ type: "durable-object",
1981
+ state: "deleted"
1982
+ };
1983
+ else if (value.storage === "sqlite" || value.storage === "legacy-kv") result[name] = {
1984
+ type: "durable-object",
1985
+ storage: value.storage,
1986
+ state: "created"
1987
+ };
1988
+ else throw new Error(`Cloudflare Durable Object export ${name} has no storage type.`);
1989
+ }
1990
+ return result;
1991
+ }
1992
+ function assetConfigFromOutput(value) {
1993
+ if (value === void 0) return;
1994
+ const config = object(value);
1995
+ if (!config) throw new Error("Cloudflare asset configuration was not readable.");
1996
+ const supported = /* @__PURE__ */ new Set([
1997
+ "basePath",
1998
+ "htmlHandling",
1999
+ "notFoundHandling",
2000
+ "runWorkerFirst"
2001
+ ]);
2002
+ if (Object.keys(config).some((key) => !supported.has(key))) throw new Error("Cloudflare asset configuration has an unsupported setting.");
2003
+ return {
2004
+ ...config.basePath === void 0 ? {} : { base_path: config.basePath },
2005
+ ...config.htmlHandling === void 0 ? {} : { html_handling: config.htmlHandling },
2006
+ ...config.notFoundHandling === void 0 ? {} : { not_found_handling: config.notFoundHandling },
2007
+ ...config.runWorkerFirst === void 0 ? {} : { run_worker_first: config.runWorkerFirst }
2008
+ };
2009
+ }
2010
+ async function apiResult(url, token, method, body, verifyUploader, timeout = 12e4) {
2011
+ if (!verifyUploader()) throw new Error("The Cloudflare uploader changed during deployment.");
2012
+ const form = body instanceof FormData;
2013
+ const response = await fetch(url, {
2014
+ method,
2015
+ headers: {
2016
+ Authorization: `Bearer ${token}`,
2017
+ ...body && !form ? { "Content-Type": "application/json" } : {}
2018
+ },
2019
+ ...body ? { body: form ? body : JSON.stringify(body) } : {},
2020
+ redirect: "manual",
2021
+ signal: AbortSignal.timeout(timeout)
2022
+ });
2023
+ const parsed = object(await response.json());
2024
+ const result = object(parsed?.result);
2025
+ if (!response.ok || parsed?.success !== true || !result) {
2026
+ const error = Array.isArray(parsed?.errors) ? object(parsed.errors[0]) : null;
2027
+ const code = Number.isSafeInteger(error?.code) ? ` [code: ${error.code}]` : "";
2028
+ const message = typeof error?.message === "string" ? ` ${error.message}` : "";
2029
+ throw new Error(`Cloudflare version upload failed (${response.status})${code}.${message}`);
2030
+ }
2031
+ return result;
2032
+ }
2033
+ async function uploadAssets(options) {
2034
+ if (!options.output.assetsDirectory) return;
2035
+ const directory = getWorkerAssetsDir(options.output.directory);
2036
+ const manifest = {};
2037
+ const byHash = /* @__PURE__ */ new Map();
2038
+ const ignored = ignore().add([
2039
+ "/.assetsignore",
2040
+ "/_headers",
2041
+ "/_redirects",
2042
+ ".DS_Store",
2043
+ ".env",
2044
+ ".env.*",
2045
+ ".dev.vars",
2046
+ ".dev.vars.*"
2047
+ ]);
2048
+ const ignorePath = join(directory, ".assetsignore");
2049
+ try {
2050
+ ignored.add(readFileSync(ignorePath, "utf8"));
2051
+ } catch (cause) {
2052
+ if (!(cause instanceof Error && "code" in cause && cause.code === "ENOENT")) throw cause;
2053
+ }
2054
+ for (const entry of readdirSync(directory, {
2055
+ recursive: true,
2056
+ withFileTypes: true
2057
+ })) {
2058
+ if (entry.isDirectory()) continue;
2059
+ if (!entry.isFile()) throw new Error("The Cloudflare asset output contains an unsupported entry.");
2060
+ const path = join(entry.parentPath, entry.name);
2061
+ const relativeName = relative(directory, path).replaceAll("\\", "/");
2062
+ if (ignored.ignores(relativeName)) continue;
2063
+ const name = `/${relativeName}`;
2064
+ const content = readFileSync(path);
2065
+ const extension = extname(entry.name).slice(1);
2066
+ const hash = createHash("sha256").update(content.toString("base64") + extension).digest("hex").slice(0, 32);
2067
+ manifest[name] = {
2068
+ hash,
2069
+ size: content.length
2070
+ };
2071
+ byHash.set(hash, path);
2072
+ }
2073
+ const session = await apiResult(`${options.accountUrl}/workers/scripts/${encodeURIComponent(options.workerName)}/assets-upload-session`, options.token, "POST", { manifest }, options.verifyUploader);
2074
+ const uploadJwt = requiredString(session.jwt, "asset upload token");
2075
+ if (!Array.isArray(session.buckets)) throw new Error("Cloudflare did not provide asset upload batches.");
2076
+ if (session.buckets.length === 0) return uploadJwt;
2077
+ let completionJwt;
2078
+ for (const bucket of session.buckets) {
2079
+ if (!Array.isArray(bucket) || !bucket.every((hash) => typeof hash === "string")) throw new Error("Cloudflare returned an invalid asset upload batch.");
2080
+ const form = new FormData();
2081
+ for (const hash of bucket) {
2082
+ const path = byHash.get(hash);
2083
+ if (!path) throw new Error("Cloudflare requested an asset outside the verified Worker output.");
2084
+ form.append(hash, readFileSync(path).toString("base64"));
2085
+ }
2086
+ const uploaded = await apiResult(`${options.accountUrl}/workers/assets/upload?base64=true`, uploadJwt, "POST", form, options.verifyUploader);
2087
+ if (uploaded.jwt !== void 0) completionJwt = requiredString(uploaded.jwt, "asset completion token");
2088
+ }
2089
+ return requiredString(completionJwt, "asset completion token");
2090
+ }
2091
+ /** The Workers beta API is the only upload endpoint that accepts a version UUID as an inheritance source. */
2092
+ async function uploadPinnedCloudflareVersion(options) {
2093
+ const activeSecrets = options.output.activeSecrets;
2094
+ if (!activeSecrets) throw new Error("The active Worker secret source was not verified.");
2095
+ const config = (await readBuildOutput(options.output.directory)).workers.default.config;
2096
+ if (config.name !== options.workerName || !config.manifest || config.manifest.type !== "complete") throw new Error("The verified Cloudflare Worker output changed before upload.");
2097
+ const unsupported = Object.keys(config).filter((key) => !(/* @__PURE__ */ new Set([
2098
+ "name",
2099
+ "compatibilityDate",
2100
+ "compatibilityFlags",
2101
+ "assets",
2102
+ "domains",
2103
+ "observability",
2104
+ "workersDev",
2105
+ "previewUrls",
2106
+ "unsafe",
2107
+ "env",
2108
+ "exports",
2109
+ "manifest",
2110
+ "triggers"
2111
+ ])).has(key));
2112
+ if (unsupported.length) throw new Error(`Cloudflare Worker setting ${unsupported[0]} cannot be uploaded with pinned secrets.`);
2113
+ const unsafe = object(config.unsafe);
2114
+ const metadata = object(unsafe?.metadata);
2115
+ if (unsafe && Object.keys(unsafe).some((key) => key !== "metadata") || metadata && Object.keys(metadata).some((key) => key !== "keep_bindings") || metadata?.keep_bindings !== void 0 && (!Array.isArray(metadata.keep_bindings) || !metadata.keep_bindings.every((type) => typeof type === "string"))) throw new Error("Cloudflare Worker upload metadata has an unsupported setting.");
2116
+ const explicitSecrets = options.secretsFilePath ? object(JSON.parse(readFileSync(options.secretsFilePath, "utf8"))) : {};
2117
+ if (!explicitSecrets) throw new Error("The explicit Cloudflare secrets file was not readable.");
2118
+ const bindings = bindingsFromOutput(config.env ?? {}, options.workerName, activeSecrets, explicitSecrets);
2119
+ const active = await apiResult(`${options.apiBaseUrl.replace(/\/$/, "")}/accounts/${encodeURIComponent(options.accountId)}/workers/workers/${encodeURIComponent(options.workerName)}/versions/${encodeURIComponent(activeSecrets.versionId)}`, options.token, "GET", void 0, options.verifyUploader);
2120
+ if (active.id !== activeSecrets.versionId || !Array.isArray(active.bindings)) throw new Error("The active Cloudflare Worker bindings could not be verified.");
2121
+ const activeBindingNames = /* @__PURE__ */ new Set();
2122
+ const candidateNames = new Set(bindings.map((binding) => String(binding.name)));
2123
+ const keptTypes = new Set(metadata?.keep_bindings ?? []);
2124
+ for (const entry of active.bindings) {
2125
+ const binding = object(entry);
2126
+ if (!binding || typeof binding.name !== "string" || typeof binding.type !== "string") throw new Error("The active Cloudflare Worker bindings could not be verified.");
2127
+ activeBindingNames.add(binding.name);
2128
+ if (!candidateNames.has(binding.name) && keptTypes.has(binding.type) && ["plain_text", "json"].includes(binding.type)) {
2129
+ bindings.push({
2130
+ name: binding.name,
2131
+ type: "inherit",
2132
+ version_id: activeSecrets.versionId
2133
+ });
2134
+ candidateNames.add(binding.name);
2135
+ }
2136
+ }
2137
+ if (activeSecrets.bindings.some(({ name }) => !activeBindingNames.has(name))) throw new Error("The active Cloudflare Worker secrets changed before upload.");
2138
+ const exports = exportsFromOutput(config.exports);
2139
+ const assetConfig = assetConfigFromOutput(config.assets);
2140
+ if (bindings.some((binding) => binding.type === "assets") && !options.output.assetsDirectory) throw new Error("The Cloudflare Worker has an assets binding without verified assets.");
2141
+ const modules = [];
2142
+ for (const [name, entry] of Object.entries(config.manifest.modules)) {
2143
+ const type = moduleContentTypes[entry.type];
2144
+ if (!type || name.startsWith("/") || name.split("/").includes("..")) throw new Error(`Cloudflare Worker module ${name} cannot be uploaded with pinned secrets.`);
2145
+ modules.push({
2146
+ name,
2147
+ content_type: type,
2148
+ content_base64: readFileSync(join(getWorkerBundleDir(options.output.directory), name)).toString("base64")
2149
+ });
2150
+ }
2151
+ const accountUrl = `${options.apiBaseUrl.replace(/\/$/, "")}/accounts/${encodeURIComponent(options.accountId)}`;
2152
+ const jwt = await uploadAssets({
2153
+ output: options.output,
2154
+ accountUrl,
2155
+ workerName: options.workerName,
2156
+ token: options.token,
2157
+ verifyUploader: options.verifyUploader
2158
+ });
2159
+ const uploaded = await apiResult(`${accountUrl}/workers/workers/${encodeURIComponent(options.workerName)}/versions${options.atomic ? "?deploy=true" : ""}`, options.token, "POST", {
2160
+ main_module: config.manifest.mainModule,
2161
+ modules,
2162
+ compatibility_date: config.compatibilityDate,
2163
+ compatibility_flags: config.compatibilityFlags,
2164
+ bindings,
2165
+ ...exports ? { exports } : {},
2166
+ ...jwt ? { assets: {
2167
+ jwt,
2168
+ ...assetConfig ? { config: assetConfig } : {}
2169
+ } } : {},
2170
+ annotations: { "workers/message": options.message ?? "" }
2171
+ }, options.verifyUploader);
2172
+ return {
2173
+ id: requiredString(uploaded.id, "Worker Version ID"),
2174
+ urls: Array.isArray(uploaded.urls) ? uploaded.urls.filter((url) => typeof url === "string") : []
2175
+ };
2176
+ }
2177
+ //#endregion
1860
2178
  //#region src/cli/cf-version-runner.ts
1861
2179
  function failed(message) {
1862
2180
  return {
@@ -1897,7 +2215,7 @@ function createActiveSecretPinner(options) {
1897
2215
  explicitNames: options.explicitNames
1898
2216
  });
1899
2217
  }
1900
- /** Pin opaque secrets to the live version in the private, disposable Build Output. */
2218
+ /** Record the live secret source for the version-aware API uploader. */
1901
2219
  async function pinActiveWorkerSecrets(options) {
1902
2220
  const { activeVersionId, bindings, requiredNames, explicitNames = [] } = options;
1903
2221
  if (!/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(activeVersionId)) return false;
@@ -1908,31 +2226,17 @@ async function pinActiveWorkerSecrets(options) {
1908
2226
  const path = getWorkerConfigPath(options.output.directory);
1909
2227
  const worker = parseJson(readFileSync(path, "utf8"));
1910
2228
  if (!record(worker) || worker.env !== void 0 && !record(worker.env)) return false;
1911
- const env = { ...worker.env ?? {} };
1912
- for (const name of explicit) delete env[name];
2229
+ const env = worker.env ?? {};
1913
2230
  for (const [name, value] of Object.entries(env)) if (record(value) && (value.type === "secret" || value.type === "inherit" || value.type === "unsafe:inherit") && !secretNames.has(name) && !explicit.has(name)) return false;
1914
2231
  for (const { name } of bindings) {
1915
2232
  if (explicit.has(name)) continue;
1916
2233
  const current = env[name];
1917
2234
  if (current !== void 0 && (!record(current) || current.type !== "secret" && current.type !== "inherit" && current.type !== "unsafe:inherit")) return false;
1918
- env[name] = {
1919
- type: "unsafe:inherit",
1920
- version_id: activeVersionId
1921
- };
1922
2235
  }
1923
- const unsafe = record(worker.unsafe) ? { ...worker.unsafe } : {};
1924
- const metadata = record(unsafe.metadata) ? { ...unsafe.metadata } : {};
1925
- if (metadata.bindings !== void 0) return false;
1926
- if (metadata.keep_bindings !== void 0 && (!Array.isArray(metadata.keep_bindings) || !metadata.keep_bindings.every((type) => typeof type === "string"))) return false;
1927
- metadata.keep_bindings = (metadata.keep_bindings ?? []).filter((type) => type !== "secret_text" && type !== "secret_key");
1928
- unsafe.metadata = metadata;
1929
- const next = {
1930
- ...worker,
1931
- env,
1932
- unsafe
2236
+ options.output.activeSecrets = {
2237
+ versionId: activeVersionId,
2238
+ bindings: [...bindings]
1933
2239
  };
1934
- writeFileSync(path, JSON.stringify(next), { mode: 384 });
1935
- await readBuildOutput(options.output.directory);
1936
2240
  return true;
1937
2241
  }
1938
2242
  /** Prevent cf's prebuilt uploader from creating a resource as a side effect. */
@@ -2089,6 +2393,32 @@ function createCfVersionRunner(options) {
2089
2393
  return failed("Cloudflare resources could not be verified before upload.");
2090
2394
  }
2091
2395
  };
2396
+ const uploadPinnedVersion = async (args, atomic) => {
2397
+ if (!options.pinnedUpload || !options.pinnedUpload.verifyUploader()) return failed("The version-aware Cloudflare uploader is unavailable.");
2398
+ const token = await options.pinnedUpload.getToken();
2399
+ if (!token) return failed("Cloudflare session has no bearer for version-aware upload.");
2400
+ try {
2401
+ const version = await uploadPinnedCloudflareVersion({
2402
+ output,
2403
+ accountId: options.pinnedUpload.accountId,
2404
+ apiBaseUrl: options.pinnedUpload.apiBaseUrl,
2405
+ workerName,
2406
+ token,
2407
+ ...flag(args, "--message") ? { message: flag(args, "--message") } : {},
2408
+ ...flag(args, "--secrets-file") ? { secretsFilePath: flag(args, "--secrets-file") } : {},
2409
+ atomic,
2410
+ verifyUploader: options.pinnedUpload.verifyUploader
2411
+ });
2412
+ const preview = version.urls.find((url) => /^https:\/\//.test(url));
2413
+ return {
2414
+ status: 0,
2415
+ stdout: `Worker Version ID: ${version.id}\n${preview ? `Version Preview URL: ${preview}\n` : ""}`,
2416
+ stderr: ""
2417
+ };
2418
+ } catch (cause) {
2419
+ return failed(cause instanceof Error ? cause.message : "Cloudflare version upload failed.");
2420
+ }
2421
+ };
2092
2422
  return async (args, command) => {
2093
2423
  if (args[0] === "deployments" && args[1] === "status") {
2094
2424
  const result = await run([
@@ -2184,6 +2514,7 @@ function createCfVersionRunner(options) {
2184
2514
  if (flag(args, "--name") !== workerName || args.includes("--assets") && flag(args, "--assets") !== output.assetsDirectory) return failed("The Cloudflare version upload target changed.");
2185
2515
  const verified = await verifyResources(output.directory);
2186
2516
  if (verified.status !== 0 || verified.signal || verified.error) return verified;
2517
+ if (output.activeSecrets) return uploadPinnedVersion(args, false);
2187
2518
  return run([
2188
2519
  "workers",
2189
2520
  "versions",
@@ -2228,6 +2559,7 @@ function createCfVersionRunner(options) {
2228
2559
  if (flag(args, "--name") !== workerName || args.includes("--assets") && flag(args, "--assets") !== output.assetsDirectory) return failed("The Cloudflare bootstrap target changed.");
2229
2560
  const verified = await verifyResources(output.directory);
2230
2561
  if (verified.status !== 0 || verified.signal || verified.error) return verified;
2562
+ if (output.activeSecrets) return uploadPinnedVersion(args, true);
2231
2563
  return run([
2232
2564
  "deploy",
2233
2565
  "--prebuilt",
@@ -6419,6 +6751,42 @@ function createDeployWranglerRunner(root, accountId, apiBaseUrl) {
6419
6751
  };
6420
6752
  };
6421
6753
  }
6754
+ /** Retry an existing-Worker read only when a fresh identity check proves the session is gone. */
6755
+ async function prepareExistingCloudflareDeployWithAuth(options, beforeRun) {
6756
+ try {
6757
+ return await prepareExistingCloudflareDeploy(options);
6758
+ } catch (error) {
6759
+ if (!(error instanceof CloudflareWorkerInspectionError)) throw error;
6760
+ if (!beforeRun()) throw new CloudflareAuthenticationError("The Cloudflare uploader changed during Worker verification.", "uploader-changed");
6761
+ const whoamiArgs = [...existingWranglerConfigArgs(options.configPath), "--env="];
6762
+ const identity = await options.runWrangler([
6763
+ "whoami",
6764
+ "--json",
6765
+ ...whoamiArgs
6766
+ ], { capture: true });
6767
+ const session = isCleanWranglerExit(identity) ? parseCloudflareAuthSession(identity.stdout) : null;
6768
+ const wrongAccount = session !== null && session.accounts.length > 0 && !session.accounts.some((account) => account.id === options.accountId);
6769
+ if (session && !wrongAccount) throw error;
6770
+ let loggedOut = false;
6771
+ try {
6772
+ loggedOut = JSON.parse(identity.stdout).loggedIn === false;
6773
+ } catch {}
6774
+ if (!(loggedOut || wrongAccount || /authentication is required|not authenticated|no api token|invalid.*token|expired.*token|unauthorized/i.test(identity.stderr)) || identity.signal || identity.error) throw new Error("Could not verify the Cloudflare session after the Worker check failed. Run `void cloudflare status` and retry.");
6775
+ const overrides = cloudflareCredentialOverrides();
6776
+ if (overrides.length > 0) throw new Error(`Cloudflare credentials from ${overrides.join(", ")} were rejected or cannot access account ${options.accountId}. Correct or unset them, then retry the deploy.`);
6777
+ if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error(wrongAccount ? `The Cloudflare session cannot access account ${options.accountId}. Run \`void cloudflare login\` with the correct user, or set a token for that account in CI, then retry.` : "Cloudflare authentication expired or is unavailable. Run `void cloudflare login` in a terminal, or set CLOUDFLARE_API_TOKEN in CI, then retry.");
6778
+ log.warn(wrongAccount ? "The current Cloudflare session cannot access the deployment account. Signing in before retrying the Worker check." : "Cloudflare session is unavailable. Signing in before retrying the Worker check.");
6779
+ if (!(await ensureCloudflareAuthentication({
6780
+ forceLogin: true,
6781
+ requireAccounts: true,
6782
+ beforeRun,
6783
+ runWrangler: (args, capture) => options.runWrangler([...args], { capture }),
6784
+ whoamiArgs
6785
+ })).accounts.some((account) => account.id === options.accountId)) throw new Error(`The signed-in Cloudflare user cannot access account ${options.accountId}. Sign in with a user who can access it, then retry.`);
6786
+ if (!beforeRun()) throw new CloudflareAuthenticationError("The Cloudflare uploader changed during sign-in.", "uploader-changed");
6787
+ return await prepareExistingCloudflareDeploy(options);
6788
+ }
6789
+ }
6422
6790
  async function chooseCloudflareDeployAccount(options) {
6423
6791
  const accounts = (await ensureCloudflareAuthentication({
6424
6792
  beforeRun: options.beforeWranglerRun,
@@ -7085,7 +7453,7 @@ async function runCloudflareDeploy(root, options, cliLog, deps = {}) {
7085
7453
  if (options.reuseExistingWorker || initialCloudflareLink) {
7086
7454
  if (authEnabled || needsSandbox || needsAI || expectedCrons.length || desired.queues.length || preBuildMigrations.length) throw new Error("Link the existing site without adding runtime features, auth setup, or database migrations. Make those changes in a later deployment.");
7087
7455
  approvedHandoffKv = approvedCloudflareIsrBinding(voidConfig, rootConfig);
7088
- existingWorker = await prepareExistingCloudflareDeploy({
7456
+ existingWorker = await prepareExistingCloudflareDeployWithAuth({
7089
7457
  root,
7090
7458
  configPath,
7091
7459
  accountId,
@@ -7094,7 +7462,7 @@ async function runCloudflareDeploy(root, options, cliLog, deps = {}) {
7094
7462
  runWrangler,
7095
7463
  readExistingWorker: deps.readExistingWorker,
7096
7464
  approvedKv: approvedHandoffKv
7097
- });
7465
+ }, assertUploaderStillPinned);
7098
7466
  pinnedHandoffLink = readCloudflareLink(root);
7099
7467
  if (!pinnedHandoffLink) throw new Error("The pending Cloudflare handoff was not saved before deployment.");
7100
7468
  rootConfig = parseRootWranglerConfig(configPath);
@@ -7504,6 +7872,12 @@ async function runCloudflareDeploy(root, options, cliLog, deps = {}) {
7504
7872
  output: cfOutput,
7505
7873
  workerName,
7506
7874
  runCf: cfCommand,
7875
+ pinnedUpload: {
7876
+ accountId,
7877
+ apiBaseUrl,
7878
+ getToken: () => runWranglerAuthToken(runWrangler, generatedConfigPath),
7879
+ verifyUploader: cfUploaderIsPinned
7880
+ },
7507
7881
  verifyResources: createCfResourceVerifier({
7508
7882
  configPath: generatedConfigPath,
7509
7883
  runCf: cfCommand,
@@ -7871,7 +8245,7 @@ async function runCloudflareStaticDeploy(root, options, voidConfig, preset, cliL
7871
8245
  log.error(`deploy: ${getErrorMessage(error)}`);
7872
8246
  return exit(1);
7873
8247
  }
7874
- const existingWorker = await prepareExistingCloudflareDeploy({
8248
+ const existingWorker = await prepareExistingCloudflareDeployWithAuth({
7875
8249
  root,
7876
8250
  configPath,
7877
8251
  accountId,
@@ -7879,7 +8253,7 @@ async function runCloudflareStaticDeploy(root, options, voidConfig, preset, cliL
7879
8253
  pinnedLink: initialCloudflareLink,
7880
8254
  runWrangler,
7881
8255
  readExistingWorker: deps.readExistingWorker
7882
- });
8256
+ }, uploaderIsPinned);
7883
8257
  const pinnedHandoffLink = existingWorker ? readCloudflareLink(root) : null;
7884
8258
  if (existingWorker && !pinnedHandoffLink) throw new Error("The pending Cloudflare handoff was not saved before deployment.");
7885
8259
  rootConfig = parseRootWranglerConfig(configPath);
@@ -7983,6 +8357,12 @@ async function runCloudflareStaticDeploy(root, options, voidConfig, preset, cliL
7983
8357
  output: cfOutput,
7984
8358
  workerName,
7985
8359
  runCf: cfCommand,
8360
+ pinnedUpload: {
8361
+ accountId,
8362
+ apiBaseUrl,
8363
+ getToken: () => runWranglerAuthToken(runWrangler, staticConfigPath),
8364
+ verifyUploader: cfUploaderIsPinned
8365
+ },
7986
8366
  verifyResources: createCfResourceVerifier({
7987
8367
  configPath: staticConfigPath,
7988
8368
  runCf: cfCommand,
@@ -1,6 +1,6 @@
1
1
  import { a as join } from "./dist-BVqXeR_h.mjs";
2
2
  import { c as import_picocolors, i as createSpinner } from "./output-CCH48AMM.mjs";
3
- import { L as resolveDeployTransport, O as isWranglerNonInteractiveOrCI, X as runWranglerAuthToken, _ as deriveWorkerName, _t as findEmailConfigConflicts, bt as renderEmailChecklist, gt as createNodeEmailDns, h as createDeployWranglerRunner, ht as applyEmailSetup, k as loadProvisionModule, v as discoverRootWranglerConfig, vt as preflightEmail, yt as renderAddressMap } from "./deploy-BfZyWZIn.mjs";
3
+ import { L as resolveDeployTransport, O as isWranglerNonInteractiveOrCI, X as runWranglerAuthToken, _ as deriveWorkerName, _t as findEmailConfigConflicts, bt as renderEmailChecklist, gt as createNodeEmailDns, h as createDeployWranglerRunner, ht as applyEmailSetup, k as loadProvisionModule, v as discoverRootWranglerConfig, vt as preflightEmail, yt as renderAddressMap } from "./deploy-C0JaQSWS.mjs";
4
4
  import { n as readProjectPaths } from "./project-paths-GgcMozYz.mjs";
5
5
  import { c as getToken, d as openBrowser } from "./auth-DLNN0D3Z.mjs";
6
6
  import { o as readProjectConfig } from "./project-C0Fqu05O.mjs";
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as __toESM } from "./rolldown-runtime-DXIUcv95.mjs";
2
2
  import { a as join, l as relative, n as dirname, u as resolve } from "./dist-BVqXeR_h.mjs";
3
3
  import { d as require_picocolors } from "./output-CCH48AMM.mjs";
4
- import { G as resolveWorkerDirName, St as hasDocumentRoutes, V as resolveDistDir, ct as prerenderPagesNode, dt as collectRevalidate, ft as hasRevalidate, mt as SEND_EMAIL_BINDING, ot as generateQueueResolverSource, pt as scanDurableObjectModules, st as prerenderPages, ut as collectPages, wt as resolveAssetRoutingPolicy, xt as hasApiRoutes } from "./deploy-BfZyWZIn.mjs";
4
+ import { G as resolveWorkerDirName, St as hasDocumentRoutes, V as resolveDistDir, ct as prerenderPagesNode, dt as collectRevalidate, ft as hasRevalidate, mt as SEND_EMAIL_BINDING, ot as generateQueueResolverSource, pt as scanDurableObjectModules, st as prerenderPages, ut as collectPages, wt as resolveAssetRoutingPolicy, xt as hasApiRoutes } from "./deploy-C0JaQSWS.mjs";
5
5
  import { i as resolveProjectPaths, n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-GgcMozYz.mjs";
6
6
  import { n as loadVoidAuthConfig, t as findVoidAuthConfig } from "./config-DPByhVck.mjs";
7
7
  import { r as scopedAccessCredentials } from "./cf-access-DRsQRe6k.mjs";
@@ -17,9 +17,9 @@ import { r as formatProjectCommand } from "./preset-UHj9ARyP.mjs";
17
17
  import { n as writeVoidProjectConfig, t as canRewriteVoidProjectConfig } from "./config-write-BSduPMY8.mjs";
18
18
  import { i as migrateFrameworkAdapterPaths, t as migrateLegacyVoidConfig } from "./migrate-B8KuoYsO.mjs";
19
19
  import { i as promptProjectSelection, r as promptAndCreateProject } from "./create-project-DBfFSZKY.mjs";
20
- import { t as promptForLoginToken } from "./login-BQyISZuW.mjs";
21
- import { i as saveDiscoveredPlatform, t as discoverPlatform } from "./platform-cmd-CRSKfu8k.mjs";
22
- import { t as connectCloudflare } from "./cloudflare-connect-CCUozPOe.mjs";
20
+ import { t as promptForLoginToken } from "./login-DZldyb8c.mjs";
21
+ import { i as saveDiscoveredPlatform, t as discoverPlatform } from "./platform-cmd-BtxZrT6w.mjs";
22
+ import { t as connectCloudflare } from "./cloudflare-connect-jAwacxxP.mjs";
23
23
  import { n as findInstalledYarnPnpRuntime, r as hasLocalLockfile, t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-BV4AzNul.mjs";
24
24
  import { createRequire } from "node:module";
25
25
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
@@ -29,7 +29,7 @@ async function selectPlatformLoginMethod(platform, requestedId) {
29
29
  return methods.find((method) => method.id === provider);
30
30
  }
31
31
  async function promptForLoginToken(root = process.cwd(), platform) {
32
- const { id: provider, label: providerName } = await selectPlatformLoginMethod(platform ?? await import("./platform-cmd-C8OqhqPt.mjs").then(({ discoverPlatform }) => discoverPlatform(getApiUrl(root))));
32
+ const { id: provider, label: providerName } = await selectPlatformLoginMethod(platform ?? await import("./platform-cmd-CjNB09OF.mjs").then(({ discoverPlatform }) => discoverPlatform(getApiUrl(root))));
33
33
  const s = createSpinner();
34
34
  s.start(`Opening browser for ${providerName} login...`);
35
35
  try {
@@ -0,0 +1,2 @@
1
+ import { r as selectPlatformLoginMethod } from "./login-DZldyb8c.mjs";
2
+ export { selectPlatformLoginMethod };
@@ -137,8 +137,8 @@ async function runAuth(origin, args) {
137
137
  if (args.action === "login" || args.action === "token" && args.tokenStdin) {
138
138
  if (!args.tokenStdin && !process.stdin.isTTY) throw new OperatorClientError("Browser login requires an interactive terminal. Use --token-stdin to exchange an API session.", "interactive_login_required");
139
139
  const apiToken = args.tokenStdin ? await readOperatorApiTokenStdin() : await (async () => {
140
- const { discoverPlatform } = await import("./platform-cmd-C8OqhqPt.mjs");
141
- const { selectPlatformLoginMethod } = await import("./login-r2gL8l7B.mjs");
140
+ const { discoverPlatform } = await import("./platform-cmd-CjNB09OF.mjs");
141
+ const { selectPlatformLoginMethod } = await import("./login-t6rndSRW.mjs");
142
142
  const { runPlatformLogin } = await import("./auth-CZuiVsFh.mjs");
143
143
  return runPlatformLogin(origin, (await selectPlatformLoginMethod(await discoverPlatform(origin), args.providerExplicit ? args.provider : void 0)).id, (url) => process.stderr.write(`Sign in at ${url}\n`));
144
144
  })();
@@ -140,11 +140,11 @@ async function configurationInput(args, existing) {
140
140
  }
141
141
  async function runPlatformAuthConfig(args) {
142
142
  if (args.action === "recover") {
143
- const { runPlatformAuthRecovery } = await import("./platform-auth-recovery-BkT3EsF2.mjs");
143
+ const { runPlatformAuthRecovery } = await import("./platform-auth-recovery-COOhMCvx.mjs");
144
144
  return runPlatformAuthRecovery(args);
145
145
  }
146
146
  if (args.action === "protection") {
147
- const { runPlatformProtectionConfig } = await import("./platform-auth-protection-Ba1XqGhn.mjs");
147
+ const { runPlatformProtectionConfig } = await import("./platform-auth-protection-Dma02l6-.mjs");
148
148
  return runPlatformProtectionConfig(args);
149
149
  }
150
150
  const origin = resolveOperatorOrigin(args.connection);
@@ -4,8 +4,8 @@ import { n as ensurePlatformAccessToken } from "./cf-access-P0iZnu0q.mjs";
4
4
  import { E as confirm, W as isCancel } from "./dist-Dn6nn2IU.mjs";
5
5
  import { n as OperatorClient } from "./operator-client-DUwumHpQ.mjs";
6
6
  import { a as resolveOperatorOrigin, r as readOperatorToken } from "./operator-auth-8KnOVXVd.mjs";
7
- import { D as preparePlatformAccessSetup, E as parsePlatformAccessSetupSpec, O as PlatformCloudflareClient, T as checkpointPlatformAccessResources, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-78H0XQUA.mjs";
8
- import { c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-6w8-DUjC.mjs";
7
+ import { D as preparePlatformAccessSetup, E as parsePlatformAccessSetupSpec, O as PlatformCloudflareClient, T as checkpointPlatformAccessResources, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-BpDlxT3t.mjs";
8
+ import { c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-BKYenDlE.mjs";
9
9
  import { createHmac } from "node:crypto";
10
10
  import { parsePlatformAccessProtection, platformProtectionProofMessage } from "@void/platform";
11
11
  import { readFile } from "node:fs/promises";
@@ -2,8 +2,8 @@ import { d as openBrowser } from "./auth-DLNN0D3Z.mjs";
2
2
  import { d as readInstallationRecoverySecrets, h as resolveInstallationManifest, t as acquirePlatformLifecycleLock } from "./platform-registry-QBa4DK32.mjs";
3
3
  import { E as confirm, W as isCancel } from "./dist-Dn6nn2IU.mjs";
4
4
  import { a as resolveOperatorOrigin } from "./operator-auth-8KnOVXVd.mjs";
5
- import { O as PlatformCloudflareClient, f as platformDatabaseClientUrl, n as resolvePlatformInstallDatabaseUrl, s as acquirePlatformDatabaseLifecycleLockConnection, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-78H0XQUA.mjs";
6
- import { c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-6w8-DUjC.mjs";
5
+ import { O as PlatformCloudflareClient, f as platformDatabaseClientUrl, n as resolvePlatformInstallDatabaseUrl, s as acquirePlatformDatabaseLifecycleLockConnection, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-BpDlxT3t.mjs";
6
+ import { c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-BKYenDlE.mjs";
7
7
  import { createCipheriv, createDecipheriv, createHash, createHmac, hkdfSync, randomBytes, randomUUID } from "node:crypto";
8
8
  import { execFile } from "node:child_process";
9
9
  import { parsePlatformAccessProtection, parsePlatformAdmissionPolicy, parsePlatformLoginConfiguration, platformAuthenticationRecoveryMessage, validatePlatformAdmissionPolicy } from "@void/platform";
@@ -92,12 +92,12 @@ function saveDiscoveredPlatform(discovery) {
92
92
  }
93
93
  async function runPlatformCommand(_root, args) {
94
94
  if (args.subcommand === "config") {
95
- const { runPlatformAuthConfig } = await import("./platform-auth-config-TSw8edHw.mjs");
95
+ const { runPlatformAuthConfig } = await import("./platform-auth-config-Bex45lQt.mjs");
96
96
  await runPlatformAuthConfig(args);
97
97
  return;
98
98
  }
99
99
  if (args.subcommand === "operator") {
100
- const { runOperatorCommand } = await import("./operator-cmd-Co-PeaeD.mjs");
100
+ const { runOperatorCommand } = await import("./operator-cmd-B9dbG3Od.mjs");
101
101
  await runOperatorCommand(args);
102
102
  return;
103
103
  }
@@ -129,7 +129,7 @@ async function runPlatformCommand(_root, args) {
129
129
  console.log(`Capabilities: ${Object.entries(discovery.capabilities).filter(([, enabled]) => enabled).map(([name]) => name).join(", ")}`);
130
130
  return;
131
131
  }
132
- const { runPlatformLifecycleCommand } = await import("./platform-lifecycle-DDc9zCeJ.mjs");
132
+ const { runPlatformLifecycleCommand } = await import("./platform-lifecycle-CYll-oKE.mjs");
133
133
  await runPlatformLifecycleCommand(args);
134
134
  }
135
135
  //#endregion
@@ -1,2 +1,2 @@
1
- import { r as runPlatformCommand, t as discoverPlatform } from "./platform-cmd-CRSKfu8k.mjs";
1
+ import { r as runPlatformCommand, t as discoverPlatform } from "./platform-cmd-BtxZrT6w.mjs";
2
2
  export { discoverPlatform, runPlatformCommand };
@@ -1,8 +1,8 @@
1
1
  import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
2
2
  import { d as readInstallationRecoverySecrets, g as savePlatformConnection, t as acquirePlatformLifecycleLock, v as writeInstallationManifest } from "./platform-registry-QBa4DK32.mjs";
3
3
  import { B as text, E as confirm, N as note, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
4
- import { C as assertPlatformOperatorCredentialCanApplyPlan, O as PlatformCloudflareClient, _ as createPlatformInstallPlan, c as createPlatformHealthProbeToken, h as recordPlatformWorkerTraffic, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, p as recordResource, t as assertNoninteractivePlatformMutationAcknowledged, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-78H0XQUA.mjs";
5
- import { a as resolveInstalledPlatformManifest, c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-6w8-DUjC.mjs";
4
+ import { C as assertPlatformOperatorCredentialCanApplyPlan, O as PlatformCloudflareClient, _ as createPlatformInstallPlan, c as createPlatformHealthProbeToken, h as recordPlatformWorkerTraffic, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, p as recordResource, t as assertNoninteractivePlatformMutationAcknowledged, w as resolvePlatformCloudflareCredential } from "./platform-lifecycle-BpDlxT3t.mjs";
5
+ import { a as resolveInstalledPlatformManifest, c as selectAuthoritativePlatformManifest, u as verifyPlatformInstallationOwnership } from "./platform-management-BKYenDlE.mjs";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { PLATFORM_APPLICATION_KEY, PLATFORM_REMOTE_INSTALLATION_MANIFEST_KEY, createApplicationRoutes, createPlatformDeploymentManifest, normalizeApplicationDomain } from "@void/platform";
8
8
  //#region src/cli/platform-domain.ts
@@ -7,7 +7,7 @@ import { a as listInstallationManifests, d as readInstallationRecoverySecrets, f
7
7
  import { n as ensurePlatformAccessToken } from "./cf-access-P0iZnu0q.mjs";
8
8
  import { B as text$1, E as confirm, F as password, G as settings, I as select, K as u$1, M as multiselect, N as note, O as intro, P as outro, R as symbol, U as CANCEL_SYMBOL, W as isCancel, g as S_PASSWORD_MASK, i as S_BAR_END, j as log, r as S_BAR } from "./dist-Dn6nn2IU.mjs";
9
9
  import { o as resolveWranglerArgv } from "./preset-UHj9ARyP.mjs";
10
- import { c as runCloudflareAuthCommand, n as announceCloudflareLogin } from "./cloudflare-auth-B9jPCkV2.mjs";
10
+ import { c as runCloudflareAuthCommand, n as announceCloudflareLogin } from "./cloudflare-auth-C4_GPZr0.mjs";
11
11
  import { _ as resolvePinnedApiBaseUrl, o as createDefaultRunWrangler } from "./provision-BhreDAOS.mjs";
12
12
  import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
13
13
  import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
@@ -1499,7 +1499,7 @@ async function verifyInstalledPlatformAccessProtection(input) {
1499
1499
  }
1500
1500
  const existingWorkers = input.plan.actions.filter((action) => action.kind === "worker" && action.action === "update").map((action) => action.name);
1501
1501
  if (existingWorkers.length) {
1502
- const { verifyProtectionWorkerOrigins } = await import("./platform-auth-protection-Ba1XqGhn.mjs");
1502
+ const { verifyProtectionWorkerOrigins } = await import("./platform-auth-protection-Dma02l6-.mjs");
1503
1503
  await verifyProtectionWorkerOrigins({
1504
1504
  request: input.client.request.bind(input.client),
1505
1505
  listWorkerDomains: input.client.listWorkerDomains.bind(input.client),
@@ -5568,14 +5568,14 @@ function resolvePlatformInstallDatabaseUrl(checkpoint, manifest = null) {
5568
5568
  }
5569
5569
  async function runPlatformLifecycleCommand(args) {
5570
5570
  if (args.subcommand === "domain") {
5571
- const { runPlatformDomainCommand } = await import("./platform-domain-j9YCXRm6.mjs");
5571
+ const { runPlatformDomainCommand } = await import("./platform-domain-DppaTARe.mjs");
5572
5572
  await runPlatformDomainCommand(args);
5573
5573
  return;
5574
5574
  }
5575
5575
  if (args.subcommand === "discover") {
5576
5576
  const client = new PlatformCloudflareClient((await resolvePlatformCloudflareCredential()).token);
5577
5577
  const accountId = await selectAccount(await readAccounts(client), args.account);
5578
- const { recoverPlatformInstallations } = await import("./platform-recovery-Do8VOyDE.mjs");
5578
+ const { recoverPlatformInstallations } = await import("./platform-recovery-dJ5Me-I0.mjs");
5579
5579
  const recovered = await recoverPlatformInstallations(client, accountId, void 0, args.selector);
5580
5580
  if (recovered.length === 0) {
5581
5581
  log.info(`No recoverable Void platform installations were found in ${accountId}.`);
@@ -5585,7 +5585,7 @@ async function runPlatformLifecycleCommand(args) {
5585
5585
  return;
5586
5586
  }
5587
5587
  if (args.subcommand !== "install") {
5588
- const { runInstalledPlatformCommand } = await import("./platform-management-DzKNsMlt.mjs");
5588
+ const { runInstalledPlatformCommand } = await import("./platform-management-BS5r6Ao8.mjs");
5589
5589
  await runInstalledPlatformCommand(args);
5590
5590
  return;
5591
5591
  }
@@ -5809,7 +5809,7 @@ async function runPlatformLifecycleCommand(args) {
5809
5809
  progress?.stop("Read the saved installation.");
5810
5810
  progress = void 0;
5811
5811
  if (authoritative) {
5812
- const { selectAuthoritativePlatformManifest } = await import("./platform-management-DzKNsMlt.mjs");
5812
+ const { selectAuthoritativePlatformManifest } = await import("./platform-management-BS5r6Ao8.mjs");
5813
5813
  const selected = selectAuthoritativePlatformManifest(existing, authoritative);
5814
5814
  authoritativeProvisionIntents = true;
5815
5815
  if (!args.plan && JSON.stringify(selected) !== JSON.stringify(existing)) writeInstallationManifest(selected);
@@ -6038,7 +6038,7 @@ async function runPlatformLifecycleCommand(args) {
6038
6038
  })).actions.filter((action) => action.kind === "worker"),
6039
6039
  revalidateBeforeWorkerDeploy: (manifest, action) => revalidatePlatformInstallAction(client, plan, manifest, action),
6040
6040
  verifyExistingOwnership: async (manifest, databaseCheckpointExists) => {
6041
- const { verifyPlatformInstallationOwnership } = await import("./platform-management-DzKNsMlt.mjs");
6041
+ const { verifyPlatformInstallationOwnership } = await import("./platform-management-BS5r6Ao8.mjs");
6042
6042
  const retainedReplacementKeys = new Set(plan.actions.filter((action) => {
6043
6043
  const previous = manifest.resources.find((resource) => resource.key === action.key);
6044
6044
  return action.action === "create" && previous && previous.name !== action.name;
@@ -1,2 +1,2 @@
1
- import { r as runPlatformLifecycleCommand } from "./platform-lifecycle-78H0XQUA.mjs";
1
+ import { r as runPlatformLifecycleCommand } from "./platform-lifecycle-BpDlxT3t.mjs";
2
2
  export { runPlatformLifecycleCommand };
@@ -1,7 +1,7 @@
1
1
  import { i as createSpinner } from "./output-CCH48AMM.mjs";
2
2
  import { a as listInstallationManifests, d as readInstallationRecoverySecrets, h as resolveInstallationManifest, m as removePlatformConnectionForInstallation, p as removeInstallationRecoverySecrets, t as acquirePlatformLifecycleLock, v as writeInstallationManifest } from "./platform-registry-QBa4DK32.mjs";
3
3
  import { E as confirm, I as select, N as note, P as outro, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
4
- import { A as hyperdriveOriginFromConnectionString, C as assertPlatformOperatorCredentialCanApplyPlan, M as verifyPlatformRuntimeTokenPermissions, O as PlatformCloudflareClient, S as platformDatabaseNameFromOwnerUrl, _ as createPlatformInstallPlan, a as REMOTE_INSTALLATION_MANIFEST_KEY, b as platformProvisionIntentHash, d as loadPlatformRuntime, g as trackedPlatformWorkerTraffic, j as hyperdriveOriginMatches, k as hyperdriveOriginConfigHash, l as createPlatformInstallationSecrets, m as resolveBootstrapGitHubId, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, t as assertNoninteractivePlatformMutationAcknowledged, u as installPlatform, v as formatPlatformInstallPlan, w as resolvePlatformCloudflareCredential, x as revalidatePlatformInstallAction, y as platformAdoptionIntentHash } from "./platform-lifecycle-78H0XQUA.mjs";
4
+ import { A as hyperdriveOriginFromConnectionString, C as assertPlatformOperatorCredentialCanApplyPlan, M as verifyPlatformRuntimeTokenPermissions, O as PlatformCloudflareClient, S as platformDatabaseNameFromOwnerUrl, _ as createPlatformInstallPlan, a as REMOTE_INSTALLATION_MANIFEST_KEY, b as platformProvisionIntentHash, d as loadPlatformRuntime, g as trackedPlatformWorkerTraffic, j as hyperdriveOriginMatches, k as hyperdriveOriginConfigHash, l as createPlatformInstallationSecrets, m as resolveBootstrapGitHubId, n as resolvePlatformInstallDatabaseUrl, o as acquirePlatformDatabaseLifecycleLock, t as assertNoninteractivePlatformMutationAcknowledged, u as installPlatform, v as formatPlatformInstallPlan, w as resolvePlatformCloudflareCredential, x as revalidatePlatformInstallAction, y as platformAdoptionIntentHash } from "./platform-lifecycle-BpDlxT3t.mjs";
5
5
  import { createHash } from "node:crypto";
6
6
  import { PLATFORM_DISABLED_KEY, PLATFORM_DISABLED_VALUE, PLATFORM_R2_OWNERSHIP_MARKER_KEY, createPlatformResourceOwnershipMarker, parsePlatformInstallationManifest, parsePlatformResourceOwnershipMarker, recordInstallationResource, recordInstallationStep, setInstallationDesiredState, transitionInstallation } from "@void/platform";
7
7
  //#region src/cli/platform-management.ts
@@ -1,2 +1,2 @@
1
- import { c as selectAuthoritativePlatformManifest, s as runInstalledPlatformCommand, u as verifyPlatformInstallationOwnership } from "./platform-management-6w8-DUjC.mjs";
1
+ import { c as selectAuthoritativePlatformManifest, s as runInstalledPlatformCommand, u as verifyPlatformInstallationOwnership } from "./platform-management-BKYenDlE.mjs";
2
2
  export { runInstalledPlatformCommand, selectAuthoritativePlatformManifest, verifyPlatformInstallationOwnership };
@@ -1,7 +1,7 @@
1
1
  import { t as cfAccessHeaders } from "./cf-access-DRsQRe6k.mjs";
2
2
  import { a as listInstallationManifests, g as savePlatformConnection, t as acquirePlatformLifecycleLock, v as writeInstallationManifest } from "./platform-registry-QBa4DK32.mjs";
3
- import { _ as createPlatformInstallPlan, a as REMOTE_INSTALLATION_MANIFEST_KEY } from "./platform-lifecycle-78H0XQUA.mjs";
4
- import { i as recoverDurablyMarkedProvisionIntents, r as isPlatformManifestMonotonicExtension, u as verifyPlatformInstallationOwnership } from "./platform-management-6w8-DUjC.mjs";
3
+ import { _ as createPlatformInstallPlan, a as REMOTE_INSTALLATION_MANIFEST_KEY } from "./platform-lifecycle-BpDlxT3t.mjs";
4
+ import { i as recoverDurablyMarkedProvisionIntents, r as isPlatformManifestMonotonicExtension, u as verifyPlatformInstallationOwnership } from "./platform-management-BKYenDlE.mjs";
5
5
  import { parsePlatformInstallationManifest, setInstallationEndpoints } from "@void/platform";
6
6
  //#region src/cli/platform-recovery.ts
7
7
  async function recoverPlatformInstallations(client, accountId, verifyEndpoint = verifyInstallationEndpoint, selector = "") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "void",
3
- "version": "0.21.5",
3
+ "version": "0.21.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -325,11 +325,11 @@
325
325
  "@cloudflare/vite-plugin": "1.54.7",
326
326
  "@cloudflare/workers-types": "^4.20260702.1",
327
327
  "@napi-rs/keyring": "2.0.0",
328
- "@void/deploy-cloudflare": "0.21.5",
329
- "@void/deploy-core": "0.21.5",
330
- "@void/edge": "0.21.5",
331
- "@void/isr": "0.21.5",
332
- "@void/platform": "0.21.5",
328
+ "@void/deploy-cloudflare": "0.21.7",
329
+ "@void/deploy-core": "0.21.7",
330
+ "@void/edge": "0.21.7",
331
+ "@void/isr": "0.21.7",
332
+ "@void/platform": "0.21.7",
333
333
  "acorn": "^8.15.0",
334
334
  "better-auth": "^1.7.3",
335
335
  "better-sqlite3": "^13.0.3",
@@ -379,7 +379,7 @@
379
379
  "zod": "^4.6.1"
380
380
  },
381
381
  "peerDependencies": {
382
- "@void/md": "0.21.5",
382
+ "@void/md": "0.21.7",
383
383
  "arktype": ">=2.0.0",
384
384
  "valibot": ">=1.0.0-beta.7",
385
385
  "vite": "^8.0.0",
@@ -1,2 +0,0 @@
1
- import { r as selectPlatformLoginMethod } from "./login-BQyISZuW.mjs";
2
- export { selectPlatformLoginMethod };