void 0.21.9 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-cmd-DZZGK80W.mjs → account-cmd-CjyxcGkM.mjs} +4 -4
- package/dist/{auth-link-B_CeugBw.mjs → auth-link-BLO4ptzo.mjs} +4 -4
- package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-ZUg9MF_U.mjs} +5 -5
- package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-BxR5FROK.mjs} +3 -3
- package/dist/{cache-7_UeZdTk.mjs → cache-D0sWhgKI.mjs} +3 -3
- package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-D4NUqFbi.mjs} +3 -3
- package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BJ6yGEIS.mjs} +139 -62
- package/dist/cli/cf-compat.mjs +164 -50
- package/dist/cli/cli.mjs +73 -44
- package/dist/cli/env-schema-probe.d.mts +1 -1
- package/dist/{client-QTl6ko_D.mjs → client-BTZ3XkrB.mjs} +25 -0
- package/dist/client-Czz8o5jP.mjs +2 -0
- package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-DQkqoMYa.mjs} +1 -6
- package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BKlfGHAy.mjs} +6 -7
- package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-Ctmrw579.mjs} +3 -3
- package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-B9tzgjmf.mjs} +10 -39
- package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-BT6OWFBk.mjs} +1 -1
- package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
- package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
- package/dist/{config-CF69HgXc.d.mts → config-VavjpDnp.d.mts} +1 -2
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
- package/dist/{connect-BsUSRzln.mjs → connect-Dg-WkW-C.mjs} +5 -5
- package/dist/{create-project-BniEV0OW.mjs → create-project-DdoqwFLF.mjs} +1 -1
- package/dist/{create-project-DBfFSZKY.mjs → create-project-l9J7pbtm.mjs} +8 -4
- package/dist/{db-hRrvZaq_.mjs → db-gp2sCXyN.mjs} +14 -14
- package/dist/{delete-D6dZ9B6B.mjs → delete-TTedbH6B.mjs} +3 -3
- package/dist/{deploy-DDz7c8LK.mjs → deploy-B19L2Bra.mjs} +1 -1
- package/dist/{deploy-WaAQez1O.mjs → deploy-CH-o2CaZ.mjs} +47 -36
- package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
- package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
- package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
- package/dist/{domain-Dmhvb2oU.mjs → domain-JRF59P_r.mjs} +4 -4
- package/dist/{email-DFi-s2t4.mjs → email-Bo6G9LOZ.mjs} +6 -6
- package/dist/{env-Csi-tMbT.mjs → env-BYOrWQnv.mjs} +4 -4
- package/dist/{env-public-D_6u46fX.d.mts → env-public-BxU_0yTL.d.mts} +2 -1
- package/dist/gen-CNJ62MM7.mjs +2 -0
- package/dist/{gen-Dz3X1Qab.mjs → gen-sCtlCOdA.mjs} +3 -3
- package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-0-7PexDq.mjs} +5 -7
- package/dist/{handler-BXJTXd02.d.mts → handler-HEcZsaij.d.mts} +2 -1
- package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
- package/dist/help-CmZzxUba.mjs +2 -0
- package/dist/{help-DC7gdz7L.mjs → help-GKtwl07I.mjs} +124 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +53 -24
- package/dist/{init-WO0JlPx8.mjs → init-FZx3Elvz.mjs} +13 -13
- package/dist/{link-CsHOinF7.mjs → link-BrQfb_CU.mjs} +4 -4
- package/dist/{list-CDb-4bZ1.mjs → list-D44jmIAM.mjs} +4 -4
- package/dist/{live-CKiJilLr.d.mts → live-CKJlvlNp.d.mts} +1 -1
- package/dist/{local-d1-CC8sKFGu.mjs → local-d1-Bg9OzEEO.mjs} +1 -1
- package/dist/{login-DvqXsfGs.mjs → login-CAsAsQ-_.mjs} +4 -4
- package/dist/login-CGcRKEoi.mjs +2 -0
- package/dist/{logs-BdfiOezj.mjs → logs-BjKvFnVM.mjs} +4 -4
- package/dist/{migrate-B8KuoYsO.mjs → migrate-BPITvDJN.mjs} +4 -4
- package/dist/migrate-CYfbKkXh.mjs +2 -0
- package/dist/{node-BM43oz4G.mjs → node-Dt7z256D.mjs} +1 -1
- package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-BK5CCiT9.mjs} +4 -4
- package/dist/output-Dm_A4Tbv.mjs +81 -0
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +2 -2
- package/dist/pages/islands-plugin.d.mts +16 -6
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
- package/dist/{platform-auth-config-z92h63q5.mjs → platform-auth-config-BlN8xTdD.mjs} +3 -3
- package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-7d5aV2Jg.mjs} +3 -3
- package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-Dxij8ZbR.mjs} +3 -3
- package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-B3hwKrFK.mjs} +5 -5
- package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-E0FuL212.mjs} +1 -1
- package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-D6Xcy9ZX.mjs} +36 -9
- package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-DMh_qrry.mjs} +1 -1
- package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-k0E0xoxx.mjs} +548 -86
- package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-Brz_BDiT.mjs} +54 -9
- package/dist/{platform-management-C8tt6D8h.mjs → platform-management-DOtss0BN.mjs} +1 -1
- package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-BvtcXON5.mjs} +2 -2
- package/dist/prepare-Bm3iq-u4.mjs +2 -0
- package/dist/{prepare-DyZ-Yok5.mjs → prepare-C-6YZyyg.mjs} +3 -3
- package/dist/{prepare-C3kt3Rst.mjs → prepare-CRhJbVrG.mjs} +1 -1
- package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-BZLCqOqw.mjs} +29 -15
- package/dist/{project-team-BkbYIsXN.mjs → project-team-BvgM0WoX.mjs} +3 -3
- package/dist/{project-token-C8xEEQnB.mjs → project-token-l5DqK6Az.mjs} +3 -3
- package/dist/project-zero-trust-v6Mvpp8y.mjs +63 -0
- package/dist/{protocol-ZH3jP4a7.d.mts → protocol-BBa6cstI.d.mts} +1 -1
- package/dist/{provision-BhreDAOS.mjs → provision-C4IGqkBf.mjs} +24 -19
- package/dist/{provision-DNtrtaVD.mjs → provision-Fr9pRqce.mjs} +1 -1
- package/dist/{requests-DFyhBMaf.mjs → requests-DN-BbNiM.mjs} +3 -3
- package/dist/{rollback-DHHxXZiS.mjs → rollback-D7rzSaZM.mjs} +4 -4
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +2 -0
- package/dist/runtime/sandbox.d.mts +4 -32
- package/dist/runtime/sandbox.mjs +118 -72
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/sandbox-container-4fdqLnyb.mjs +279 -0
- package/dist/sandbox-container-DdNEBfCc.d.mts +72 -0
- package/dist/sandbox-qpNBT8a3.d.mts +49 -0
- package/dist/{secret-DN9sSNiV.mjs → secret-BOtOl_cb.mjs} +4 -4
- package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
- package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
- package/dist/{wrangler-BymcxrRa.mjs → wrangler-DQF1vKyf.mjs} +37 -27
- package/dist/{ws-BwcqizuH.d.mts → ws-BoY7vQML.d.mts} +1 -1
- package/package.json +40 -32
- package/sandbox.Dockerfile +4 -0
- package/schema.json +10 -22
- package/skills/void/SKILL.md +2 -0
- package/skills/void/docs/guide/deployment.md +1 -1
- package/skills/void/docs/guide/edge/revalidation.md +1 -1
- package/skills/void/docs/guide/edge/static-assets.md +1 -0
- package/skills/void/docs/guide/platform/administration/zero-trust.md +318 -0
- package/skills/void/docs/guide/platform/development/local.md +2 -2
- package/skills/void/docs/guide/platform/installation/domains.md +1 -1
- package/skills/void/docs/guide/platform/installation/first-deployment.md +4 -0
- package/skills/void/docs/guide/platform/installation/prerequisites.md +1 -1
- package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
- package/skills/void/docs/guide/platform-administration.md +1 -0
- package/skills/void/docs/guide/sandboxes.md +70 -41
- package/skills/void/docs/integrations/cloudflare.md +1 -1
- package/skills/void/docs/reference/api.md +35 -35
- package/skills/void/docs/reference/cli.md +68 -6
- package/skills/void/docs/reference/config.md +16 -16
- package/dist/client-4cDVv7BO.mjs +0 -2
- package/dist/gen-Vnv2f65C.mjs +0 -2
- package/dist/help-DQMfeKMz.mjs +0 -2
- package/dist/login-DFQk7rbW.mjs +0 -2
- package/dist/migrate-TsHGBnDA.mjs +0 -2
- package/dist/prepare-BZXkjdNe.mjs +0 -2
package/dist/cli/cf-compat.mjs
CHANGED
|
@@ -1,13 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { n as __toESM } from "../rolldown-runtime-DXIUcv95.mjs";
|
|
2
3
|
import { a as join, n as dirname, u as resolve } from "../dist-BVqXeR_h.mjs";
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { t as require_picocolors } from "../picocolors-BTps1_gs.mjs";
|
|
5
|
+
import { t as prepareCfBuildOutput } from "../cf-build-output-BJ6yGEIS.mjs";
|
|
6
|
+
import { copyFileSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
6
8
|
import { tmpdir } from "node:os";
|
|
7
|
-
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
8
10
|
import { parse } from "jsonc-parser";
|
|
11
|
+
import { stripVTControlCharacters } from "node:util";
|
|
9
12
|
import { readBuildOutput } from "@cloudflare/build-output-utils";
|
|
10
13
|
import { EnvHttpProxyAgent, fetch as fetch$1 } from "undici";
|
|
14
|
+
import { getCloudflareAuthUseKeyringFromEnv } from "@cloudflare/workers-auth";
|
|
15
|
+
import { createCfAuth, createCfProfileStore, readUserPreferences, setKeyringPreference } from "@cloudflare/workers-auth/cf";
|
|
16
|
+
//#region src/cli/cf-session.ts
|
|
17
|
+
const logger = {
|
|
18
|
+
debug() {},
|
|
19
|
+
info() {},
|
|
20
|
+
log() {},
|
|
21
|
+
warn() {},
|
|
22
|
+
error() {}
|
|
23
|
+
};
|
|
24
|
+
function session(root) {
|
|
25
|
+
const auth = createCfAuth({
|
|
26
|
+
logger,
|
|
27
|
+
userAgent: "void",
|
|
28
|
+
prompt: async () => {
|
|
29
|
+
throw new Error("Cloudflare session reads cannot prompt.");
|
|
30
|
+
},
|
|
31
|
+
select: async () => {
|
|
32
|
+
throw new Error("Cloudflare session reads cannot prompt.");
|
|
33
|
+
},
|
|
34
|
+
isNoDefaultValueProvidedError: () => false
|
|
35
|
+
});
|
|
36
|
+
auth.setProfile(createCfProfileStore({ logger }).resolve({ cwd: root }));
|
|
37
|
+
return auth;
|
|
38
|
+
}
|
|
39
|
+
/** Borrow only the profile just verified by cf, including its encrypted store. */
|
|
40
|
+
function readCfSessionCredential(root, identity) {
|
|
41
|
+
if (identity.authenticated !== true || identity.tokenValid !== true) return null;
|
|
42
|
+
const auth = session(root);
|
|
43
|
+
if (identity.authSource !== `OAuth token from ${auth.getCredentialStore().path()}`) return null;
|
|
44
|
+
const token = auth.readAuthCredentials()?.oauth_token;
|
|
45
|
+
if (typeof token === "string" && token.length > 0) persistCfKeyringPreference(root);
|
|
46
|
+
return typeof token === "string" && token.length > 0 ? token : null;
|
|
47
|
+
}
|
|
48
|
+
/** Keep subsequent cf logins on the encrypted profile adopted by Void. */
|
|
49
|
+
function persistCfKeyringPreference(root) {
|
|
50
|
+
if (getCloudflareAuthUseKeyringFromEnv() === false || readUserPreferences().keyring_enabled === true) return;
|
|
51
|
+
const auth = session(root);
|
|
52
|
+
if (!setKeyringPreference(true, {
|
|
53
|
+
logger,
|
|
54
|
+
getCredentialStore: auth.getCredentialStore
|
|
55
|
+
}).enabled) throw new Error("Cloudflare encrypted credential storage is unavailable.");
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/cli/cloudflare-login-output.ts
|
|
59
|
+
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
60
|
+
/** The bundled cf login prints the device code before opening the browser. */
|
|
61
|
+
function cloudflareDeviceCode(output) {
|
|
62
|
+
const plain = stripVTControlCharacters(output);
|
|
63
|
+
return /and enter the code:\s*([A-Za-z0-9-]+)\s/i.exec(plain)?.[1] ?? /[?&]user_code=([A-Za-z0-9-]+)\s/i.exec(plain)?.[1] ?? null;
|
|
64
|
+
}
|
|
65
|
+
function printCloudflareLoginPrompt(code) {
|
|
66
|
+
console.log(code ? `Opening Cloudflare login in your browser. Confirm the code ${import_picocolors.default.blue(code)} in your browser. Press Ctrl+C to cancel.` : "Opening Cloudflare login in your browser. Confirm the code shown in your browser. Press Ctrl+C to cancel.");
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
11
69
|
//#region src/cli/cf-compat.ts
|
|
12
70
|
/**
|
|
13
71
|
* Private transport for the existing Void Cloudflare command seams. The
|
|
@@ -16,13 +74,14 @@ import { EnvHttpProxyAgent, fetch as fetch$1 } from "undici";
|
|
|
16
74
|
*/
|
|
17
75
|
const cf = join(dirname(fileURLToPath(import.meta.resolve("cf/package.json"))), "bin", "cf");
|
|
18
76
|
const args = process.argv.slice(2);
|
|
77
|
+
process.env.CLOUDFLARE_AUTH_USE_KEYRING ??= "true";
|
|
19
78
|
function cfEnvironment() {
|
|
20
79
|
const env = {
|
|
21
80
|
...process.env,
|
|
22
81
|
CF_DELEGATION: "1",
|
|
23
82
|
CF_SEND_TELEMETRY: "false",
|
|
24
83
|
CF_NO_OSC_PROGRESS: "1",
|
|
25
|
-
CLOUDFLARE_AUTH_USE_KEYRING: process.env.CLOUDFLARE_AUTH_USE_KEYRING
|
|
84
|
+
CLOUDFLARE_AUTH_USE_KEYRING: process.env.CLOUDFLARE_AUTH_USE_KEYRING
|
|
26
85
|
};
|
|
27
86
|
if (env.HTTP_PROXY || env.HTTPS_PROXY || env.http_proxy || env.https_proxy) env.NODE_USE_ENV_PROXY = "1";
|
|
28
87
|
for (const [canonical, alias] of [
|
|
@@ -64,21 +123,54 @@ function runCf(command, cwd = process.cwd()) {
|
|
|
64
123
|
return result(child.status ?? 1, child.stdout ?? "", stderr);
|
|
65
124
|
}
|
|
66
125
|
function runInteractiveCf(command) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
126
|
+
return new Promise((resolve) => {
|
|
127
|
+
const child = spawn(process.execPath, [
|
|
128
|
+
cf,
|
|
129
|
+
...command,
|
|
130
|
+
"--quiet"
|
|
131
|
+
], {
|
|
132
|
+
cwd: process.cwd(),
|
|
133
|
+
env: {
|
|
134
|
+
...cfEnvironment(),
|
|
135
|
+
CF_QUIET: "1"
|
|
136
|
+
},
|
|
137
|
+
shell: false,
|
|
138
|
+
stdio: [
|
|
139
|
+
"inherit",
|
|
140
|
+
"pipe",
|
|
141
|
+
"pipe"
|
|
142
|
+
],
|
|
143
|
+
windowsHide: true
|
|
144
|
+
});
|
|
145
|
+
let output = "";
|
|
146
|
+
let announced = false;
|
|
147
|
+
let settled = false;
|
|
148
|
+
const finish = (value) => {
|
|
149
|
+
if (!settled) {
|
|
150
|
+
settled = true;
|
|
151
|
+
resolve(value);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const collect = (chunk) => {
|
|
155
|
+
output = (output + chunk.toString()).slice(-32768);
|
|
156
|
+
if (!announced) {
|
|
157
|
+
const code = cloudflareDeviceCode(output);
|
|
158
|
+
if (code) {
|
|
159
|
+
announced = true;
|
|
160
|
+
printCloudflareLoginPrompt(code);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
child.stdout.on("data", collect);
|
|
165
|
+
child.stderr.on("data", collect);
|
|
166
|
+
child.once("error", (error) => finish(result(1, "", error.message)));
|
|
167
|
+
child.once("close", (status, signal) => {
|
|
168
|
+
if (status === 0) {
|
|
169
|
+
if (!announced) printCloudflareLoginPrompt(null);
|
|
170
|
+
finish(result(0));
|
|
171
|
+
} else finish(result(status ?? 1, "", output.trim() || `Cloudflare login ended${signal ? ` (${signal})` : ""}.`));
|
|
172
|
+
});
|
|
80
173
|
});
|
|
81
|
-
return result(child.status ?? 1, "", child.error?.message ?? "");
|
|
82
174
|
}
|
|
83
175
|
async function withBuildOutput(raw, sourceMain, action) {
|
|
84
176
|
const scratch = mkdtempSync(join(tmpdir(), "void-cf-command-"));
|
|
@@ -99,7 +191,7 @@ async function withBuildOutput(raw, sourceMain, action) {
|
|
|
99
191
|
await assertExistingProvisionableResources(output.directory, accountId);
|
|
100
192
|
return action(output.directory);
|
|
101
193
|
} finally {
|
|
102
|
-
output.dispose();
|
|
194
|
+
await output.dispose();
|
|
103
195
|
}
|
|
104
196
|
} finally {
|
|
105
197
|
rmSync(scratch, {
|
|
@@ -210,6 +302,39 @@ async function clearWorkerCronSchedules(worker) {
|
|
|
210
302
|
await proxy?.close();
|
|
211
303
|
}
|
|
212
304
|
}
|
|
305
|
+
async function clearWorkerCustomDomains(worker) {
|
|
306
|
+
const endpoint = `${(process.env.CLOUDFLARE_API_BASE_URL ?? "https://api.cloudflare.com/client/v4").replace(/\/$/, "")}/accounts/${encodeURIComponent(accountId())}/workers/scripts/${encodeURIComponent(worker)}/domains/records`;
|
|
307
|
+
const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.https_proxy ? new EnvHttpProxyAgent() : null;
|
|
308
|
+
try {
|
|
309
|
+
const response = await fetch$1(endpoint, {
|
|
310
|
+
method: "PUT",
|
|
311
|
+
headers: {
|
|
312
|
+
...await apiHeaders(),
|
|
313
|
+
"Content-Type": "application/json"
|
|
314
|
+
},
|
|
315
|
+
body: JSON.stringify({
|
|
316
|
+
override_scope: true,
|
|
317
|
+
override_existing_origin: false,
|
|
318
|
+
override_existing_dns_record: false,
|
|
319
|
+
origins: []
|
|
320
|
+
}),
|
|
321
|
+
redirect: "error",
|
|
322
|
+
signal: AbortSignal.timeout(3e4),
|
|
323
|
+
...proxy ? { dispatcher: proxy } : {}
|
|
324
|
+
});
|
|
325
|
+
if (!response.ok) throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`);
|
|
326
|
+
let body;
|
|
327
|
+
try {
|
|
328
|
+
body = await response.json();
|
|
329
|
+
} catch {
|
|
330
|
+
throw new Error(`Cloudflare returned HTTP ${response.status} with a non-JSON custom-domain response.`);
|
|
331
|
+
}
|
|
332
|
+
if (object(body).success !== true) throw new Error(`Cloudflare rejected the empty custom-domain set (HTTP ${response.status}).`);
|
|
333
|
+
return result(0);
|
|
334
|
+
} finally {
|
|
335
|
+
await proxy?.close();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
213
338
|
async function assertExistingProvisionableResources(directory, account) {
|
|
214
339
|
const bindings = (await readBuildOutput(directory)).workers.default.config.env ?? {};
|
|
215
340
|
const queueNames = /* @__PURE__ */ new Set();
|
|
@@ -283,46 +408,29 @@ async function sessionCredential() {
|
|
|
283
408
|
if (identity.status !== 0) return null;
|
|
284
409
|
const state = object(parsedJson(identity.stdout));
|
|
285
410
|
if (state.authenticated !== true || state.tokenValid !== true) return null;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const entry = readdirSync(dist).find((name) => /^cf-[^/]+\.mjs$/.test(name));
|
|
289
|
-
if (!entry) throw new Error("The bundled Cloudflare credential reader is unavailable.");
|
|
290
|
-
const previousKeyringSetting = process.env.CLOUDFLARE_AUTH_USE_KEYRING;
|
|
291
|
-
process.env.CLOUDFLARE_AUTH_USE_KEYRING = previousKeyringSetting ?? "true";
|
|
292
|
-
let stored;
|
|
293
|
-
try {
|
|
294
|
-
const module = await import(pathToFileURL(join(dist, entry)).href);
|
|
295
|
-
if (typeof module.t !== "function") throw new Error("The bundled Cloudflare credential reader is unavailable.");
|
|
296
|
-
const noop = () => {};
|
|
297
|
-
stored = module.t({ logger: {
|
|
298
|
-
debug: noop,
|
|
299
|
-
info: noop,
|
|
300
|
-
log: noop,
|
|
301
|
-
warn: noop,
|
|
302
|
-
error: noop
|
|
303
|
-
} }).readAuthCredentials();
|
|
304
|
-
} finally {
|
|
305
|
-
if (previousKeyringSetting === void 0) delete process.env.CLOUDFLARE_AUTH_USE_KEYRING;
|
|
306
|
-
else process.env.CLOUDFLARE_AUTH_USE_KEYRING = previousKeyringSetting;
|
|
307
|
-
}
|
|
308
|
-
const credential = stored && typeof stored === "object" ? stored : null;
|
|
309
|
-
return credential && typeof credential.oauth_token === "string" && credential.oauth_token ? {
|
|
411
|
+
const credential = readCfSessionCredential(process.cwd(), state);
|
|
412
|
+
return credential ? {
|
|
310
413
|
type: "oauth",
|
|
311
|
-
token: credential
|
|
414
|
+
token: credential
|
|
312
415
|
} : null;
|
|
313
416
|
}
|
|
314
417
|
async function auth() {
|
|
315
|
-
if (args[0] === "login")
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
418
|
+
if (args[0] === "login") {
|
|
419
|
+
const loggedIn = await runInteractiveCf([
|
|
420
|
+
"auth",
|
|
421
|
+
"login",
|
|
422
|
+
"--force"
|
|
423
|
+
]);
|
|
424
|
+
if (loggedIn.status === 0) persistCfKeyringPreference(process.cwd());
|
|
425
|
+
return loggedIn;
|
|
426
|
+
}
|
|
320
427
|
if (args[0] === "logout") return runCf(["auth", "logout"]);
|
|
321
428
|
if (args[0] === "whoami") {
|
|
322
429
|
const called = runCf(["auth", "whoami"]);
|
|
323
430
|
if (called.status !== 0) return called;
|
|
324
431
|
const identity = object(parsedJson(called.stdout));
|
|
325
432
|
if (identity.authenticated !== true || identity.tokenValid !== true) return result(1, JSON.stringify({ loggedIn: false }), "Cloudflare authentication is required.");
|
|
433
|
+
if (String(identity.authSource).startsWith("OAuth token from ")) persistCfKeyringPreference(process.cwd());
|
|
326
434
|
return result(0, JSON.stringify({
|
|
327
435
|
loggedIn: true,
|
|
328
436
|
accounts: identity.accounts,
|
|
@@ -831,6 +939,12 @@ async function workerChanges() {
|
|
|
831
939
|
if (raw.name !== name || raw.account_id !== void 0 && raw.account_id !== accountId()) throw new Error("Cloudflare trigger target changed.");
|
|
832
940
|
return await clearWorkerCronSchedules(name);
|
|
833
941
|
}
|
|
942
|
+
if (args[0] === "triggers" && args[1] === "clear-domains") {
|
|
943
|
+
const raw = config();
|
|
944
|
+
const name = workerName();
|
|
945
|
+
if (raw.name !== name || raw.account_id !== void 0 && raw.account_id !== accountId()) throw new Error("Cloudflare trigger target changed.");
|
|
946
|
+
return await clearWorkerCustomDomains(name);
|
|
947
|
+
}
|
|
834
948
|
if (args[0] === "versions" && args[1] === "upload" || args[0] === "deploy") {
|
|
835
949
|
const raw = config();
|
|
836
950
|
const path = configPath();
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as join } from "../dist-BVqXeR_h.mjs";
|
|
3
|
-
import { j as log } from "../dist-
|
|
3
|
+
import { j as log } from "../dist-CTBk70IR.mjs";
|
|
4
4
|
import { n as getPackageDir } from "../agents-B_pX_HmQ.mjs";
|
|
5
5
|
import { t as formatCloudflareUserMessage } from "../cloudflare-user-output-Q-k0QoNQ.mjs";
|
|
6
|
-
import { a as operatorGroups, i as printVoidHeader, n as printGlobalHelp, o as parseOperatorArgs, r as printHelpPage, t as getHelpPath } from "../help-
|
|
6
|
+
import { a as operatorGroups, i as printVoidHeader, n as printGlobalHelp, o as parseOperatorArgs, r as printHelpPage, t as getHelpPath } from "../help-GKtwl07I.mjs";
|
|
7
7
|
import { r as OperatorClientError } from "../operator-client-DUwumHpQ.mjs";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { PLATFORM_LOGIN_KINDS, parsePlatformLoginId } from "@void/platform";
|
|
@@ -1278,7 +1278,7 @@ const platformSubcommands = [
|
|
|
1278
1278
|
},
|
|
1279
1279
|
...operatorGroups.map((name) => ({
|
|
1280
1280
|
name,
|
|
1281
|
-
hint: name === "email" ? "Domains, policy, limits, outcomes, and recovery" : "Operator commands",
|
|
1281
|
+
hint: name === "email" ? "Domains, policy, limits, outcomes, and recovery" : name === "zero-trust" ? "Configure Access protection and project overrides" : "Operator commands",
|
|
1282
1282
|
description: `Administer platform ${name}`
|
|
1283
1283
|
})),
|
|
1284
1284
|
{
|
|
@@ -1610,6 +1610,11 @@ const projectSubcommands = [
|
|
|
1610
1610
|
hint: "list | invite | invitations | role | remove | revoke | leave | pending | accept | decline",
|
|
1611
1611
|
description: "Manage project members and invitations"
|
|
1612
1612
|
},
|
|
1613
|
+
{
|
|
1614
|
+
name: "zero-trust",
|
|
1615
|
+
hint: "status | protect | public | reconcile",
|
|
1616
|
+
description: "Inspect or override Cloudflare Zero Trust protection"
|
|
1617
|
+
},
|
|
1613
1618
|
{
|
|
1614
1619
|
name: "logs",
|
|
1615
1620
|
description: "Show runtime logs from the deployed project"
|
|
@@ -1702,6 +1707,30 @@ function parseProjectArgs(args) {
|
|
|
1702
1707
|
};
|
|
1703
1708
|
}
|
|
1704
1709
|
if (subcommand === "team") return parseTeamArgs(rest);
|
|
1710
|
+
if (subcommand === "zero-trust") {
|
|
1711
|
+
const [action = "", ...args] = rest;
|
|
1712
|
+
if (action && ![
|
|
1713
|
+
"status",
|
|
1714
|
+
"protect",
|
|
1715
|
+
"public",
|
|
1716
|
+
"reconcile"
|
|
1717
|
+
].includes(action)) throw new Error("project: Usage: void project zero-trust <status|protect|public|reconcile> [--project <slug>].");
|
|
1718
|
+
let projectSlug = "";
|
|
1719
|
+
for (let index = 0; index < args.length; index++) {
|
|
1720
|
+
const arg = args[index];
|
|
1721
|
+
if (arg === "--project") {
|
|
1722
|
+
const value = args[++index];
|
|
1723
|
+
if (!value || value.startsWith("-")) throw new Error("project: --project requires a value.");
|
|
1724
|
+
if (projectSlug) throw new Error("project: Duplicate flag '--project'.");
|
|
1725
|
+
projectSlug = value;
|
|
1726
|
+
} else throw new Error(`project: Unexpected argument '${arg}'.`);
|
|
1727
|
+
}
|
|
1728
|
+
return {
|
|
1729
|
+
subcommand,
|
|
1730
|
+
action,
|
|
1731
|
+
projectSlug
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1705
1734
|
if (subcommand === "logs") {
|
|
1706
1735
|
let filter = "";
|
|
1707
1736
|
let range = "1h";
|
|
@@ -1778,7 +1807,7 @@ function parseProjectArgs(args) {
|
|
|
1778
1807
|
projectSlug
|
|
1779
1808
|
};
|
|
1780
1809
|
}
|
|
1781
|
-
throw new Error("project: Usage: void project <status|link|list|team|token|logs|requests|rollback|cancel|delete|purge-cache>.");
|
|
1810
|
+
throw new Error("project: Usage: void project <status|link|list|team|token|zero-trust|logs|requests|rollback|cancel|delete|purge-cache>.");
|
|
1782
1811
|
}
|
|
1783
1812
|
function parseTeamArgs(rest) {
|
|
1784
1813
|
const [action, ...args] = rest;
|
|
@@ -1980,7 +2009,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
|
1980
2009
|
const hasNamedSubcommand = args.slice(1).some((arg) => subcommands.some(({ name }) => name === arg));
|
|
1981
2010
|
try {
|
|
1982
2011
|
if ((!sub || sub.startsWith("-") && !hasNamedSubcommand) && process.stdin.isTTY) {
|
|
1983
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
2012
|
+
const { promptSubcommand } = await import("../subcommand-prompt-CY1C4fvl.mjs");
|
|
1984
2013
|
if (command === "platform" && !sub) log.info("A Void platform lets a team deploy Void apps to a shared Cloudflare account.\nThis command sets up and manages platforms. Join with `void connect <url>`.\nDocs: https://void.cloud/guide/self-hosted-platform");
|
|
1985
2014
|
const result = await promptSubcommand(command, subcommands);
|
|
1986
2015
|
if (!result) process.exit(0);
|
|
@@ -2020,7 +2049,7 @@ if (helpPath) {
|
|
|
2020
2049
|
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
2021
2050
|
process.exit(1);
|
|
2022
2051
|
}
|
|
2023
|
-
import("../deploy-
|
|
2052
|
+
import("../deploy-B19L2Bra.mjs").then(({ runDeploy }) => {
|
|
2024
2053
|
runDeploy(root, {
|
|
2025
2054
|
projectSlug: deployArgs.projectSlug,
|
|
2026
2055
|
dir: deployArgs.dir,
|
|
@@ -2039,25 +2068,25 @@ if (helpPath) {
|
|
|
2039
2068
|
});
|
|
2040
2069
|
} else if (command === "connect") (async () => {
|
|
2041
2070
|
const parsed = parseConnectArgs(args.slice(1));
|
|
2042
|
-
const { runConnectCommand } = await import("../connect-
|
|
2071
|
+
const { runConnectCommand } = await import("../connect-Dg-WkW-C.mjs");
|
|
2043
2072
|
await runConnectCommand(process.cwd(), parsed);
|
|
2044
2073
|
})().catch((err) => {
|
|
2045
2074
|
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
2046
2075
|
process.exit(1);
|
|
2047
2076
|
});
|
|
2048
|
-
else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-
|
|
2049
|
-
else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-
|
|
2050
|
-
else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-
|
|
2051
|
-
else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-
|
|
2052
|
-
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-
|
|
2053
|
-
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-
|
|
2054
|
-
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-
|
|
2055
|
-
else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-
|
|
2056
|
-
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-
|
|
2057
|
-
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-
|
|
2058
|
-
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-
|
|
2059
|
-
else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-
|
|
2060
|
-
else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-
|
|
2077
|
+
else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-router-ZUg9MF_U.mjs").then(({ runAuthRouter }) => runAuthRouter(root, parsed)));
|
|
2078
|
+
else if (command === "account") runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (root, parsed) => import("../account-cmd-CjyxcGkM.mjs").then(({ runAccountCommand }) => runAccountCommand(root, parsed)));
|
|
2079
|
+
else if (command === "platform") runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (root, parsed) => import("../platform-cmd-E0FuL212.mjs").then(({ runPlatformCommand }) => runPlatformCommand(root, parsed)));
|
|
2080
|
+
else if (command === "cloudflare") runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (root, parsed) => import("../cloudflare-cmd-BKlfGHAy.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(root, parsed)));
|
|
2081
|
+
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-BZLCqOqw.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
2082
|
+
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-BOtOl_cb.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
2083
|
+
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-JRF59P_r.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
2084
|
+
else if (command === "email") runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (root, parsed) => import("../email-Bo6G9LOZ.mjs").then(({ runEmailCommand }) => runEmailCommand(root, parsed)));
|
|
2085
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-gp2sCXyN.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
2086
|
+
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-BYOrWQnv.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
2087
|
+
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-CNJ62MM7.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
2088
|
+
else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-0-7PexDq.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed)));
|
|
2089
|
+
else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-BxR5FROK.mjs").then(({ runBuildCommand }) => runBuildCommand(root, parsed)));
|
|
2061
2090
|
else if (command === "prepare") {
|
|
2062
2091
|
const root = process.cwd();
|
|
2063
2092
|
let prepareArgs;
|
|
@@ -2067,7 +2096,7 @@ else if (command === "prepare") {
|
|
|
2067
2096
|
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
2068
2097
|
process.exit(1);
|
|
2069
2098
|
}
|
|
2070
|
-
import("../prepare-
|
|
2099
|
+
import("../prepare-C-6YZyyg.mjs").then(({ runPrepareCommand }) => {
|
|
2071
2100
|
runPrepareCommand(root, prepareArgs).catch((err) => {
|
|
2072
2101
|
log.error(formatCloudflareUserMessage(err.message ?? String(err)));
|
|
2073
2102
|
process.exit(1);
|
|
@@ -2075,7 +2104,7 @@ else if (command === "prepare") {
|
|
|
2075
2104
|
});
|
|
2076
2105
|
} else if (command === "init") {
|
|
2077
2106
|
const root = process.cwd();
|
|
2078
|
-
import("../init-
|
|
2107
|
+
import("../init-FZx3Elvz.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
2079
2108
|
let initArgs;
|
|
2080
2109
|
try {
|
|
2081
2110
|
initArgs = parseInitArgs(args.slice(1));
|
|
@@ -2093,7 +2122,7 @@ else if (command === "prepare") {
|
|
|
2093
2122
|
log.error("migrate: This command takes no arguments.");
|
|
2094
2123
|
process.exit(1);
|
|
2095
2124
|
}
|
|
2096
|
-
import("../migrate-
|
|
2125
|
+
import("../migrate-CYfbKkXh.mjs").then(({ runMigrateCommand }) => {
|
|
2097
2126
|
runMigrateCommand(process.cwd()).catch((err) => {
|
|
2098
2127
|
log.error(formatCloudflareUserMessage(err instanceof Error ? err.message : String(err)));
|
|
2099
2128
|
process.exit(1);
|
|
@@ -2136,7 +2165,7 @@ else if (command === "prepare") {
|
|
|
2136
2165
|
},
|
|
2137
2166
|
{
|
|
2138
2167
|
name: "platform",
|
|
2139
|
-
hint: "auth | user | project | deployment | signup | email | system | install",
|
|
2168
|
+
hint: "auth | user | project | deployment | signup | email | zero-trust | system | install",
|
|
2140
2169
|
description: "Install platforms and administer users, projects, access, and operations"
|
|
2141
2170
|
},
|
|
2142
2171
|
{
|
|
@@ -2146,7 +2175,7 @@ else if (command === "prepare") {
|
|
|
2146
2175
|
},
|
|
2147
2176
|
{
|
|
2148
2177
|
name: "project",
|
|
2149
|
-
hint: "status | link | list | team | token | logs | requests | rollback | cancel | delete | purge-cache",
|
|
2178
|
+
hint: "status | link | list | team | token | zero-trust | logs | requests | rollback | cancel | delete | purge-cache",
|
|
2150
2179
|
description: "Manage projects, teams, deployments, and scoped CI credentials"
|
|
2151
2180
|
},
|
|
2152
2181
|
{
|
|
@@ -2200,47 +2229,47 @@ else if (command === "prepare") {
|
|
|
2200
2229
|
];
|
|
2201
2230
|
(async () => {
|
|
2202
2231
|
printVoidHeader();
|
|
2203
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
2232
|
+
const { promptSubcommand } = await import("../subcommand-prompt-CY1C4fvl.mjs");
|
|
2204
2233
|
const result = await promptSubcommand("", topLevelCommands);
|
|
2205
2234
|
if (!result) process.exit(0);
|
|
2206
2235
|
const cmd = result.subcommand;
|
|
2207
2236
|
const root = process.cwd();
|
|
2208
2237
|
switch (cmd) {
|
|
2209
2238
|
case "connect": {
|
|
2210
|
-
const { runConnectCommand } = await import("../connect-
|
|
2239
|
+
const { runConnectCommand } = await import("../connect-Dg-WkW-C.mjs");
|
|
2211
2240
|
await runConnectCommand(root, parseConnectArgs([]));
|
|
2212
2241
|
return;
|
|
2213
2242
|
}
|
|
2214
2243
|
case "init": {
|
|
2215
|
-
const { runInitCommand, parseInitArgs } = await import("../init-
|
|
2244
|
+
const { runInitCommand, parseInitArgs } = await import("../init-FZx3Elvz.mjs");
|
|
2216
2245
|
await runInitCommand(root, parseInitArgs([]));
|
|
2217
2246
|
return;
|
|
2218
2247
|
}
|
|
2219
2248
|
case "migrate": {
|
|
2220
|
-
const { runMigrateCommand } = await import("../migrate-
|
|
2249
|
+
const { runMigrateCommand } = await import("../migrate-CYfbKkXh.mjs");
|
|
2221
2250
|
await runMigrateCommand(root);
|
|
2222
2251
|
return;
|
|
2223
2252
|
}
|
|
2224
2253
|
case "deploy": {
|
|
2225
|
-
const { runDeploy } = await import("../deploy-
|
|
2254
|
+
const { runDeploy } = await import("../deploy-B19L2Bra.mjs");
|
|
2226
2255
|
await runDeploy(root);
|
|
2227
2256
|
return;
|
|
2228
2257
|
}
|
|
2229
|
-
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-
|
|
2230
|
-
case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-
|
|
2231
|
-
case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-
|
|
2232
|
-
case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-
|
|
2233
|
-
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-
|
|
2234
|
-
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-
|
|
2235
|
-
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-
|
|
2236
|
-
case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-
|
|
2237
|
-
case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-
|
|
2238
|
-
case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-
|
|
2239
|
-
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-
|
|
2240
|
-
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-
|
|
2241
|
-
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-
|
|
2258
|
+
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-router-ZUg9MF_U.mjs").then(({ runAuthRouter }) => runAuthRouter(r, p)));
|
|
2259
|
+
case "account": return runSubcommandGroup("account", accountSubcommands, parseAccountArgs, (r, p) => import("../account-cmd-CjyxcGkM.mjs").then(({ runAccountCommand }) => runAccountCommand(r, p)));
|
|
2260
|
+
case "platform": return runSubcommandGroup("platform", platformSubcommands, parsePlatformArgs, (r, p) => import("../platform-cmd-E0FuL212.mjs").then(({ runPlatformCommand }) => runPlatformCommand(r, p)));
|
|
2261
|
+
case "cloudflare": return runSubcommandGroup("cloudflare", cloudflareSubcommands, parseCloudflareArgs, (r, p) => import("../cloudflare-cmd-BKlfGHAy.mjs").then(({ runCloudflareCommand }) => runCloudflareCommand(r, p)));
|
|
2262
|
+
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-BZLCqOqw.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
2263
|
+
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-BOtOl_cb.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
2264
|
+
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-JRF59P_r.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
2265
|
+
case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-0-7PexDq.mjs").then(({ runGithubCommand }) => runGithubCommand(r, p)));
|
|
2266
|
+
case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-BxR5FROK.mjs").then(({ runBuildCommand }) => runBuildCommand(r, p)));
|
|
2267
|
+
case "email": return runSubcommandGroup("email", emailSubcommands, parseEmailArgs, (r, p) => import("../email-Bo6G9LOZ.mjs").then(({ runEmailCommand }) => runEmailCommand(r, p)));
|
|
2268
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-gp2sCXyN.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
2269
|
+
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-BYOrWQnv.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
2270
|
+
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-CNJ62MM7.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
2242
2271
|
case "prepare": {
|
|
2243
|
-
const { runPrepareCommand } = await import("../prepare-
|
|
2272
|
+
const { runPrepareCommand } = await import("../prepare-C-6YZyyg.mjs");
|
|
2244
2273
|
await runPrepareCommand(root, parsePrepareArgs([]));
|
|
2245
2274
|
return;
|
|
2246
2275
|
}
|
|
@@ -265,6 +265,31 @@ var PlatformClient = class {
|
|
|
265
265
|
if (!res.ok) await throwPlatformApiError("Failed to list project tokens", res, "owner");
|
|
266
266
|
return res.json();
|
|
267
267
|
}
|
|
268
|
+
async getProjectZeroTrust(projectId) {
|
|
269
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust`, { headers: { ...this.authHeaders } });
|
|
270
|
+
if (!res.ok) await throwPlatformApiError("Failed to inspect project Zero Trust", res, "read");
|
|
271
|
+
return res.json();
|
|
272
|
+
}
|
|
273
|
+
async setProjectZeroTrust(projectId, protectedProject) {
|
|
274
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust`, {
|
|
275
|
+
method: "PUT",
|
|
276
|
+
headers: {
|
|
277
|
+
"Content-Type": "application/json",
|
|
278
|
+
...this.authHeaders
|
|
279
|
+
},
|
|
280
|
+
body: JSON.stringify({ protected: protectedProject })
|
|
281
|
+
});
|
|
282
|
+
if (!res.ok) await throwPlatformApiError("Failed to update project Zero Trust", res, "settings");
|
|
283
|
+
return res.json();
|
|
284
|
+
}
|
|
285
|
+
async reconcileProjectZeroTrust(projectId) {
|
|
286
|
+
const res = await this.request(`${this.baseUrl}/projects/${projectId}/zero-trust/reconcile`, {
|
|
287
|
+
method: "POST",
|
|
288
|
+
headers: { ...this.authHeaders }
|
|
289
|
+
});
|
|
290
|
+
if (!res.ok) await throwPlatformApiError("Failed to reconcile project Zero Trust", res, "settings");
|
|
291
|
+
return res.json();
|
|
292
|
+
}
|
|
268
293
|
async createProjectToken(projectId, input) {
|
|
269
294
|
const res = await this.request(`${this.baseUrl}/projects/${projectId}/tokens`, {
|
|
270
295
|
method: "POST",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { j as log } from "./dist-Dn6nn2IU.mjs";
|
|
2
1
|
import { o as resolveWranglerArgv } from "./preset-UHj9ARyP.mjs";
|
|
3
2
|
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
4
3
|
//#region src/cli/cloudflare-auth.ts
|
|
@@ -42,7 +41,6 @@ async function ensureCloudflareAuthentication(options) {
|
|
|
42
41
|
const existing = options.forceLogin ? null : await readSession();
|
|
43
42
|
if (existing) return existing;
|
|
44
43
|
if (!(options.interactive ?? (process.stdin.isTTY && process.stdout.isTTY))) throw new CloudflareAuthenticationError("Cloudflare authentication is required. Set CLOUDFLARE_API_TOKEN in CI, or run `void cloudflare login` in an interactive terminal.", "not-authenticated");
|
|
45
|
-
announceCloudflareLogin();
|
|
46
44
|
if (!isCleanExit(await run(["login"], false))) throw new CloudflareAuthenticationError("Cloudflare browser sign-in did not complete. Run `void cloudflare login` to try again.", "login");
|
|
47
45
|
const authenticated = await readSession();
|
|
48
46
|
if (!authenticated) throw new CloudflareAuthenticationError("Cloudflare sign-in completed without a usable session. Run `void cloudflare login` to try again.", "not-authenticated");
|
|
@@ -183,8 +181,5 @@ function cloudflareAuthEnvironment(source = process.env) {
|
|
|
183
181
|
function isCleanExit(result) {
|
|
184
182
|
return result.status === 0 && result.signal == null && (result.error == null || result.error === "");
|
|
185
183
|
}
|
|
186
|
-
function announceCloudflareLogin() {
|
|
187
|
-
log.info("Opening Cloudflare login in your browser. Compare the code below with the browser prompt. Press Ctrl+C to cancel.");
|
|
188
|
-
}
|
|
189
184
|
//#endregion
|
|
190
|
-
export {
|
|
185
|
+
export { ensureCloudflareAuthentication as a, createBundledCloudflareAuthRunner as i, cloudflareAuthNeedsTerminal as n, parseCloudflareAuthSession as o, cloudflareCredentialOverrides as r, runCloudflareAuthCommand as s, CloudflareAuthenticationError as t };
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
-
import { v as readRootWranglerConfig } from "./wrangler-
|
|
3
|
-
import { j as log } from "./dist-
|
|
4
|
-
import { a as
|
|
2
|
+
import { v as readRootWranglerConfig } from "./wrangler-DQF1vKyf.mjs";
|
|
3
|
+
import { j as log } from "./dist-CTBk70IR.mjs";
|
|
4
|
+
import { a as ensureCloudflareAuthentication, i as createBundledCloudflareAuthRunner, o as parseCloudflareAuthSession, r as cloudflareCredentialOverrides } from "./cloudflare-auth-DQkqoMYa.mjs";
|
|
5
5
|
//#region src/cli/cloudflare-cmd.ts
|
|
6
6
|
async function runCloudflareCommand(root, args) {
|
|
7
7
|
const runWrangler = createBundledCloudflareAuthRunner(root);
|
|
8
8
|
switch (args.subcommand) {
|
|
9
|
-
case "login":
|
|
10
|
-
|
|
9
|
+
case "login":
|
|
10
|
+
await ensureCloudflareAuthentication({
|
|
11
11
|
runWrangler,
|
|
12
12
|
forceLogin: true
|
|
13
13
|
});
|
|
14
|
-
log
|
|
14
|
+
console.log("Successfully logged in.");
|
|
15
15
|
return;
|
|
16
|
-
}
|
|
17
16
|
case "status": {
|
|
18
17
|
const result = await runWrangler(["whoami", "--json"], true);
|
|
19
18
|
const session = result.status === 0 && !result.signal && !result.error ? parseCloudflareAuthSession(result.stdout) : null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as join, t as basename } from "./dist-BVqXeR_h.mjs";
|
|
2
|
-
import { i as LATEST_KNOWN_COMPAT_DATE, k as writeProvisionedWranglerConfig, v as readRootWranglerConfig } from "./wrangler-
|
|
3
|
-
import { I as select, W as isCancel, j as log } from "./dist-
|
|
4
|
-
import { a as
|
|
2
|
+
import { i as LATEST_KNOWN_COMPAT_DATE, k as writeProvisionedWranglerConfig, v as readRootWranglerConfig } from "./wrangler-DQF1vKyf.mjs";
|
|
3
|
+
import { I as select, W as isCancel, j as log } from "./dist-CTBk70IR.mjs";
|
|
4
|
+
import { a as ensureCloudflareAuthentication, i as createBundledCloudflareAuthRunner } from "./cloudflare-auth-DQkqoMYa.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)) {
|