@agileguy/cf-cli 1.1.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/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/index.js +2599 -0
- package/package.json +35 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2599 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var wS=Object.defineProperty;var z=(s,e)=>{for(var n in e)wS(s,n,{get:e[n],enumerable:!0,configurable:!0,set:(o)=>e[n]=()=>o})};var p=(s,e)=>()=>(s&&(e=s(s=0)),e);import{mkdirSync as hS,readFileSync as yS,writeFileSync as CS,renameSync as gS,existsSync as $S,chmodSync as kS}from"fs";import{join as le}from"path";import{homedir as US}from"os";function De(){return{version:1,default_profile:"default",profiles:{},defaults:{output:"table",no_color:!1,per_page:20}}}function _S(){if(!$S(oe))hS(oe,{recursive:!0,mode:448});else kS(oe,448)}function M(){try{let s=yS(Se,"utf-8"),e=JSON.parse(s);if(typeof e.version!=="number"||typeof e.profiles!=="object"||typeof e.defaults!=="object")return De();return e}catch{return De()}}function K(s){_S();let e=JSON.stringify(s,null,2)+`
|
|
4
|
+
`,n=le(oe,".config.json.tmp");CS(n,e,{mode:384}),gS(n,Se)}function Q(s,e){let n=e??s.default_profile;return s.profiles[n]??null}function qe(s,e,n){return{...s,profiles:{...s.profiles,[e]:n}}}function Ae(s,e){let{[e]:n,...o}=s.profiles;return{...s,profiles:o}}var oe,Se;var H=p(()=>{oe=le(US(),".cf"),Se=le(oe,"config.json")});var zS,ne,i,J;var f=p(()=>{zS={6003:"Invalid or expired API token. Re-authenticate with: cf config set-profile",6100:"Invalid API key format. Check your key with: cf config show",6111:"Invalid or expired API key. Re-authenticate with: cf config set-profile",6112:"Invalid email + API key combination. Verify your credentials.",7000:"No route for the given URI. Check the command syntax.",7003:"Zone not found. Verify the zone ID or domain with: cf zones list",7001:"Method not allowed. This endpoint may not support that operation.",9103:"DNS record not found. Verify the record ID with: cf dns list",9104:"DNS record already exists. Use 'cf dns update' instead.",1e4:"Authentication error. Re-authenticate with: cf config set-profile"};ne=class ne extends Error{statusCode;errorCode;errors;constructor(s,e,n){let o=n.length>0?n.map((t)=>`[${t.code}] ${t.message}`).join("; "):`HTTP ${s}`;super(o);this.name="CloudflareAPIError",this.statusCode=s,this.errorCode=e,this.errors=n}getSuggestion(){for(let s of this.errors){let e=zS[s.code];if(e)return e}return null}format(){let s=[`API Error (HTTP ${this.statusCode})`];for(let n of this.errors)s.push(` [${n.code}] ${n.message}`);let e=this.getSuggestion();if(e)s.push(` Suggestion: ${e}`);return s.join(`
|
|
5
|
+
`)}};i=class i extends Error{constructor(s){super(s);this.name="UsageError"}};J=class J extends Error{constructor(s){super(s);this.name="AuthError"}}});function vS(){if(process.env.NO_COLOR!==void 0)return!0;if(process.env.TERM==="dumb")return!0;if(!process.stdout.isTTY&&!process.stderr.isTTY)return!0;return!1}function DS(){if(Ge!==null)return Ge;return vS()}function Y(s,e){return(n)=>{if(DS())return n;return`\x1B[${s}m${n}\x1B[${e}m`}}function ge(s){return s.replace(/\x1b\[[0-9;]*m/g,"")}var Ge=null,ye,Ce,ie,Me,V,se;var ae=p(()=>{ye=Y("32","39"),Ce=Y("31","39"),ie=Y("33","39"),Me=Y("36","39"),V=Y("2","22"),se=Y("1","22")});function d(s){let e={},n=[],o=0;while(o<s.length){let t=s[o];if(t==="--"){n.push(...s.slice(o+1));break}if(t.startsWith("--")){let r=t.slice(2),m=r.indexOf("=");if(m!==-1){let w=Ie(r.slice(0,m));e[w]=r.slice(m+1),o++;continue}if(r.startsWith("no-")){let w=Ie(r.slice(3));e[w]=!1,o++;continue}let c=Ie(r),l=s[o+1];if(l!==void 0&&!l.startsWith("-")){e[c]=l,o+=2;continue}e[c]=!0,o++;continue}if(t.startsWith("-")&&t.length===2){let r=t.slice(1),m=s[o+1];if(m!==void 0&&!m.startsWith("-")){e[r]=m,o+=2;continue}e[r]=!0,o++;continue}n.push(t),o++}return{flags:e,positional:n}}function Ie(s){return s.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function a(s,e){let n=s[e];if(typeof n==="string")return n;return}function v(s,e){let n=s[e];if(typeof n==="boolean")return n;if(typeof n==="string")return n!==""&&n!=="0"&&n!=="false";return!1}function R(s,e){let n=s[e];if(typeof n==="string"){let o=parseInt(n,10);if(!isNaN(o))return o}return}function D(s,e){let n=s[e];if(typeof n==="string")return n.split(",").map((o)=>o.trim()).filter(Boolean);return}async function Be(s,e){let{flags:n}=d(s),o=a(n,"accountId"),t=a(n,"name"),r=a(n,"status"),m=R(n,"page"),c=R(n,"perPage"),l=v(n,"all"),w={};if(o)w["account.id"]=o;if(t)w.name=t;if(r)w.status=r;if(m)w.page=String(m);if(c)w.per_page=String(c);let $;if(l)$=await e.client.fetchAll("/zones",w);else $=await e.client.get("/zones",w);let k=[{key:"id",header:"ID",width:34},{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:12},{key:"name_servers",header:"NS",width:6,transform:(_)=>String(_.length)},{key:"created_on",header:"Created",width:12,transform:(_)=>String(_).slice(0,10)},{key:"plan",header:"Plan",width:12,transform:(_)=>_.name}];e.output.table($,k)}var He=()=>{};async function y(s,e){let n=s.trim();if(!n)throw new i("Zone reference cannot be empty.");if(ZS.test(n))return n.toLowerCase();let o=await e.get("/zones",{name:n});if(!Array.isArray(o)||o.length===0)throw new i(`Zone not found: "${n}". Use a valid zone ID or domain name.`);return o[0].id}var ZS;var g=p(()=>{f();ZS=/^[a-f0-9]{32}$/i});async function Ve(s,e){let{flags:n}=d(s),o=a(n,"id"),t=a(n,"name");if(!o&&!t)throw new i("Provide --id <zone-id> or --name <domain-name>.");let r;if(o)r=o;else r=await y(t,e.client);let m=await e.client.get(`/zones/${r}`);e.output.detail({ID:m.id,Name:m.name,Status:m.status,Paused:m.paused,Type:m.type,"Development Mode":m.development_mode,"Name Servers":m.name_servers.join(", "),"Original NS":m.original_name_servers.join(", "),"Original Registrar":m.original_registrar??"-","Account ID":m.account.id,"Account Name":m.account.name,Plan:m.plan.name,Created:m.created_on,Modified:m.modified_on,Activated:m.activated_on})}var We=p(()=>{g();f()});async function Ke(s,e){let{flags:n}=d(s),o=a(n,"name"),t=a(n,"accountId"),r=v(n,"jumpStart"),m=a(n,"type");if(!o)throw new i("--name <domain> is required.");if(!t)throw new i("--account-id <id> is required.");let c={name:o,account:{id:t},jump_start:r};if(m)c.type=m;let l=await e.client.post("/zones",c);e.output.success(`Zone created: ${l.id}`),e.output.detail({ID:l.id,Name:l.name,Status:l.status,"Name Servers":l.name_servers.join(", ")})}var Qe=p(()=>{f()});async function C(s,e){if(e.yes)return!0;if(!process.stdin.isTTY)return!1;let n=`${ie(se("?"))} ${s} ${V("[y/N]")} `;return process.stdout.write(n),new Promise((o)=>{let t=(r)=>{let m=r.toString().trim().toLowerCase();process.stdin.removeListener("data",t),process.stdin.setRawMode?.(!1),process.stdin.pause(),o(m==="y"||m==="yes")};process.stdin.setRawMode?.(!1),process.stdin.resume(),process.stdin.setEncoding("utf8"),process.stdin.once("data",t)})}var U=p(()=>{ae()});function Xe(s,e){let n=s.trim();if(!/^[a-f0-9]{32}$/i.test(n))throw new i(`Invalid ${e}: "${n}". Must be a 32-character hex string.`);return n.toLowerCase()}function pe(s){let e=s.trim().toUpperCase();if(!Ye.includes(e))throw new i(`Invalid record type: "${s}". Valid types: ${Ye.join(", ")}`);return e}function F(s){let e=typeof s==="string"?parseInt(s,10):s;if(isNaN(e))throw new i(`Invalid TTL: "${s}". Must be a number.`);if(e===1)return 1;if(e<60||e>86400)throw new i(`Invalid TTL: ${e}. Must be 1 (auto) or between 60-86400.`);return e}function ue(s){let e=typeof s==="string"?parseInt(s,10):s;if(isNaN(e)||e<0||e>65535)throw new i(`Invalid priority: "${s}". Must be between 0-65535.`);return e}function Fe(s){let e=s.trim().toLowerCase();if(!["table","json","csv","yaml"].includes(e))throw new i(`Invalid output format: "${s}". Valid formats: table, json, csv, yaml`);return e}var Ye;var x=p(()=>{f();Ye=["A","AAAA","CAA","CERT","CNAME","DNSKEY","DS","HTTPS","LOC","MX","NAPTR","NS","PTR","SMIMEA","SRV","SSHFP","SVCB","TLSA","TXT","URI"]});async function xe(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <zone-id> is required.");let t=Xe(o,"zone ID");if(!await C(`Delete zone ${t}? This cannot be undone.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${t}`),e.output.success(`Zone ${t} deleted.`)}var eo=p(()=>{f();U();x()});async function oo(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=a(n,"from"),m=a(n,"to"),c={};if(r)c.since=r;if(m)c.until=m;let l=await e.client.get(`/zones/${encodeURIComponent(t)}/analytics/dashboard`,c);e.output.json(l)}var no=p(()=>{g();f()});async function to(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=a(n,"from"),m=a(n,"to"),c={};if(r)c.since=r;if(m)c.until=m;let l=await e.client.get(`/zones/${encodeURIComponent(t)}/analytics/colos`,c);e.output.json(l)}var ro=p(()=>{g();f()});async function io(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=a(n,"from"),m=a(n,"to"),c={};if(r)c.since=r;if(m)c.until=m;let l=await e.client.get(`/zones/${encodeURIComponent(t)}/dns_analytics/report`,c);e.output.json(l)}var so=p(()=>{g();f()});async function mo(s,e){let[n,...o]=s;switch(n){case"dashboard":return oo(o,e);case"colo":case"colos":return to(o,e);case"dns":return io(o,e);case void 0:case"--help":case"-h":e.output.raw(ao);return;default:throw new i(`Unknown analytics command: "${n}"
|
|
6
|
+
|
|
7
|
+
${ao}`)}}var ao=`Usage: cf zones analytics <command>
|
|
8
|
+
|
|
9
|
+
Commands:
|
|
10
|
+
dashboard Zone analytics dashboard
|
|
11
|
+
colo Zone analytics by colo (data center)
|
|
12
|
+
dns Zone DNS analytics
|
|
13
|
+
|
|
14
|
+
Run 'cf zones analytics <command> --help' for more information.`;var co=p(()=>{f();no();ro();so()});async function po(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/settings`),m=[{key:"id",header:"Setting",width:32},{key:"value",header:"Value",width:30,transform:(c)=>{if(typeof c==="object"&&c!==null)return JSON.stringify(c);return String(c)}},{key:"editable",header:"Editable",width:10,transform:(c)=>c===!0?"yes":c===!1?"no":"-"},{key:"modified_on",header:"Modified",width:12,transform:(c)=>typeof c==="string"?c.slice(0,10):"-"}];e.output.table(r,m)}var uo=p(()=>{g();f()});async function fo(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"setting");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--setting <setting-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/settings/${encodeURIComponent(t)}`),c=typeof m.value==="object"&&m.value!==null?JSON.stringify(m.value,null,2):String(m.value);e.output.detail({Setting:m.id,Value:c,Editable:m.editable??"-",Modified:m.modified_on??"-"})}var lo=p(()=>{g();f()});async function wo(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"setting"),r=a(n,"value");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--setting <setting-id> is required.");if(r===void 0)throw new i("--value <value> is required.");let m=await y(o,e.client),c;try{c=JSON.parse(r)}catch{c=r}let l=await e.client.patch(`/zones/${encodeURIComponent(m)}/settings/${encodeURIComponent(t)}`,{value:c});e.output.success(`Setting "${l.id}" updated.`)}var ho=p(()=>{g();f()});async function Co(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return po(o,e);case"get":case"show":return fo(o,e);case"update":case"set":case"edit":return wo(o,e);case void 0:case"--help":case"-h":e.output.raw(yo);return;default:throw new i(`Unknown settings command: "${n}"
|
|
15
|
+
|
|
16
|
+
${yo}`)}}var yo=`Usage: cf zones settings <command>
|
|
17
|
+
|
|
18
|
+
Commands:
|
|
19
|
+
list List all zone settings
|
|
20
|
+
get Get a specific zone setting
|
|
21
|
+
update Update a zone setting
|
|
22
|
+
|
|
23
|
+
Run 'cf zones settings <command> --help' for more information.`;var go=p(()=>{f();uo();lo();ho()});var ko={};z(ko,{run:()=>FS});async function FS(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Be(o,e);case"get":case"show":return Ve(o,e);case"create":case"add":return Ke(o,e);case"delete":case"rm":case"remove":return xe(o,e);case"analytics":return mo(o,e);case"settings":return Co(o,e);case void 0:case"--help":case"-h":e.output.raw($o);return;default:throw new i(`Unknown zones command: "${n}"
|
|
24
|
+
|
|
25
|
+
${$o}`)}}var $o=`Usage: cf zones <command>
|
|
26
|
+
|
|
27
|
+
Commands:
|
|
28
|
+
list List all zones
|
|
29
|
+
get Get zone details
|
|
30
|
+
create Create a new zone
|
|
31
|
+
delete Delete a zone
|
|
32
|
+
analytics Zone analytics (dashboard, colo, dns)
|
|
33
|
+
settings Zone settings management
|
|
34
|
+
|
|
35
|
+
Run 'cf zones <command> --help' for more information.`;var Uo=p(()=>{f();He();We();Qe();eo();co();go()});async function _o(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"type"),r=a(n,"name"),m=a(n,"content"),c=R(n,"page"),l=R(n,"perPage"),w=v(n,"all");if(!o)throw new i("--zone <zone-id-or-name> is required.");let $=await y(o,e.client),k={};if(t)k.type=t.toUpperCase();if(r)k.name=r;if(m)k.content=m;if(c)k.page=String(c);if(l)k.per_page=String(l);let _;if(w)_=await e.client.fetchAll(`/zones/${$}/dns_records`,k);else _=await e.client.get(`/zones/${$}/dns_records`,k);let I=[{key:"id",header:"ID",width:34},{key:"type",header:"Type",width:8},{key:"name",header:"Name",width:30},{key:"content",header:"Content",width:30},{key:"ttl",header:"TTL",width:8,transform:(P)=>P===1?"Auto":String(P)},{key:"proxied",header:"Proxied",width:8,transform:(P)=>P?"Yes":"No"},{key:"modified_on",header:"Modified",width:12,transform:(P)=>String(P).slice(0,10)}];e.output.table(_,I)}var zo=p(()=>{g();f()});async function Ro(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <record-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${r}/dns_records/${t}`);e.output.detail({ID:m.id,"Zone ID":m.zone_id,"Zone Name":m.zone_name,Type:m.type,Name:m.name,Content:m.content,Proxiable:m.proxiable,Proxied:m.proxied,TTL:m.ttl===1?"Auto":m.ttl,Locked:m.locked,Comment:m.comment??"-",Tags:m.tags.length>0?m.tags.join(", "):"-",Priority:m.priority??"-",Created:m.created_on,Modified:m.modified_on})}var bo=p(()=>{g();f()});async function Po(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"type"),r=a(n,"name"),m=a(n,"content"),c=a(n,"ttl")??R(n,"ttl"),l=n.proxied,w=a(n,"priority"),$=a(n,"comment");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--type <record-type> is required.");if(!r)throw new i("--name <record-name> is required.");if(!m)throw new i("--content <value> is required.");let k=pe(t),_=await y(o,e.client),I={type:k,name:r,content:m};if(c!==void 0)I.ttl=F(c);if(l!==void 0)I.proxied=typeof l==="boolean"?l:l==="true";if(w!==void 0)I.priority=ue(w);if($!==void 0)I.comment=$;let P=await e.client.post(`/zones/${_}/dns_records`,I);e.output.success(`DNS record created: ${P.id}`),e.output.detail({ID:P.id,Type:P.type,Name:P.name,Content:P.content,TTL:P.ttl===1?"Auto":P.ttl,Proxied:P.proxied})}var Io=p(()=>{g();f();x()});async function vo(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id"),r=a(n,"type"),m=a(n,"name"),c=a(n,"content"),l=a(n,"ttl")??R(n,"ttl"),w=n.proxied,$=a(n,"priority");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <record-id> is required.");if(!r)throw new i("--type <record-type> is required for full update. Use 'cf dns patch' for partial updates.");if(!m)throw new i("--name <record-name> is required for full update. Use 'cf dns patch' for partial updates.");if(!c)throw new i("--content <value> is required for full update. Use 'cf dns patch' for partial updates.");let k=pe(r),_=await y(o,e.client),I={type:k,name:m,content:c};if(l!==void 0)I.ttl=F(l);if(w!==void 0)I.proxied=typeof w==="boolean"?w:w==="true";if($!==void 0)I.priority=ue($);let P=await e.client.put(`/zones/${_}/dns_records/${t}`,I);e.output.success(`DNS record updated: ${P.id}`),e.output.detail({ID:P.id,Type:P.type,Name:P.name,Content:P.content,TTL:P.ttl===1?"Auto":P.ttl,Proxied:P.proxied})}var Do=p(()=>{g();f();x()});async function So(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id"),r=a(n,"content"),m=a(n,"ttl")??R(n,"ttl"),c=n.proxied,l=a(n,"comment");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <record-id> is required.");let w={};if(r!==void 0)w.content=r;if(m!==void 0)w.ttl=F(m);if(c!==void 0)w.proxied=typeof c==="boolean"?c:c==="true";if(l!==void 0)w.comment=l;if(Object.keys(w).length===0)throw new i("At least one field to patch is required: --content, --ttl, --proxied, --comment");let $=await y(o,e.client),k=await e.client.patch(`/zones/${$}/dns_records/${t}`,w);e.output.success(`DNS record patched: ${k.id}`),e.output.detail({ID:k.id,Type:k.type,Name:k.name,Content:k.content,TTL:k.ttl===1?"Auto":k.ttl,Proxied:k.proxied})}var qo=p(()=>{g();f();x()});async function Ao(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <record-id> is required.");let r=await y(o,e.client);if(!await C(`Delete DNS record ${t} from zone ${r}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${r}/dns_records/${t}`),e.output.success(`DNS record ${t} deleted.`)}var Lo=p(()=>{g();f();U()});import{readFileSync as iq}from"fs";async function No(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"file"),r=v(n,"proxied");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--file <path> is required. Use '-' for stdin.");let m=await y(o,e.client),c;if(t==="-"){let k=[];for await(let _ of process.stdin)k.push(_);c=Buffer.concat(k).toString("utf-8")}else try{c=iq(t,"utf-8")}catch(k){throw new i(`Cannot read file: "${t}".`)}let l=new FormData;if(l.set("file",new Blob([c],{type:"text/plain"}),"records.txt"),r)l.set("proxied","true");let w=await e.client.upload(`/zones/${m}/dns_records/import`,l);if(typeof w!=="object"||w===null||typeof w.recs_added!=="number"||typeof w.total_records_parsed!=="number")throw Error(`DNS import: unexpected API response shape: ${JSON.stringify(w)}`);let $=w;e.output.success(`DNS import complete: ${$.recs_added} records added out of ${$.total_records_parsed} parsed.`)}var Eo=p(()=>{g();f()});async function Go(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${t}/dns_records/export`);if(process.stdout.write(String(r)),!String(r).endsWith(`
|
|
36
|
+
`))process.stdout.write(`
|
|
37
|
+
`)}var Mo=p(()=>{g();f()});var Zo={};z(Zo,{run:()=>mq});async function mq(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _o(o,e);case"get":case"show":return Ro(o,e);case"create":case"add":return Po(o,e);case"update":case"set":return vo(o,e);case"patch":return So(o,e);case"delete":case"rm":case"remove":return Ao(o,e);case"import":return No(o,e);case"export":return Go(o,e);case void 0:case"--help":case"-h":e.output.raw(To);return;default:throw new i(`Unknown dns command: "${n}"
|
|
38
|
+
|
|
39
|
+
${To}`)}}var To=`Usage: cf dns <command>
|
|
40
|
+
|
|
41
|
+
Commands:
|
|
42
|
+
list List DNS records for a zone
|
|
43
|
+
get Get a specific DNS record
|
|
44
|
+
create Create a new DNS record
|
|
45
|
+
update Full update of a DNS record (PUT)
|
|
46
|
+
patch Partial update of a DNS record (PATCH)
|
|
47
|
+
delete Delete a DNS record
|
|
48
|
+
import Import DNS records from BIND file
|
|
49
|
+
export Export DNS records as BIND format
|
|
50
|
+
|
|
51
|
+
Run 'cf dns <command> --help' for more information.`;var Oo=p(()=>{f();zo();bo();Io();Do();qo();Lo();Eo();Mo()});var jo={};z(jo,{resolveAccountId:()=>u});async function u(s,e,n){if(s)return s;let o=n?.default_profile??"default",t=n?.profiles[o];if(t?.account_id)return t.account_id;let r=await e.get("/accounts");if(!Array.isArray(r)||r.length===0)throw new i("No accounts found. Provide --account-id explicitly.");if(r.length>1)throw new i(`Multiple accounts found. Provide --account-id explicitly.
|
|
52
|
+
Accounts: ${r.map((m)=>`${m.id} (${m.name})`).join(", ")}`);return r[0].id}var h=p(()=>{f()});async function Jo(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${o}/workers/scripts`),r=[{key:"id",header:"Name",width:30},{key:"handlers",header:"Handlers",width:20,transform:(m)=>m.join(", ")},{key:"compatibility_date",header:"Compat Date",width:14,transform:(m)=>String(m??"-")},{key:"usage_model",header:"Usage Model",width:14,transform:(m)=>String(m??"-")},{key:"modified_on",header:"Modified",width:12,transform:(m)=>String(m).slice(0,10)}];e.output.table(t,r)}var Bo=p(()=>{h()});async function Ho(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <script-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/workers/scripts/${encodeURIComponent(o)}`);e.output.detail({Name:r.id,ETag:r.etag,Handlers:r.handlers.join(", "),"Compatibility Date":r.compatibility_date??"-","Compatibility Flags":r.compatibility_flags?.join(", ")??"-","Usage Model":r.usage_model??"-",Logpush:r.logpush??!1,"Last Deployed From":r.last_deployed_from??"-",Created:r.created_on,Modified:r.modified_on})}var Vo=p(()=>{h();f()});import{readFileSync as pq}from"fs";async function Wo(s,e){let{flags:n,positional:o}=d(s),t=o[0]??a(n,"file"),r=a(n,"name"),m=a(n,"compatibilityDate"),c=D(n,"compatibilityFlag");if(!t)throw new i("<file> argument or --file is required.");if(!r)throw new i("--name <script-name> is required.");let l=await u(a(n,"accountId"),e.client,e.config),w;try{w=pq(t,"utf-8")}catch{throw new i(`Cannot read file: "${t}".`)}let $={main_module:"worker.js"};if(m)$.compatibility_date=m;if(c&&c.length>0)$.compatibility_flags=c;let k=new FormData;k.append("metadata",new Blob([JSON.stringify($)],{type:"application/json"})),k.append("worker.js",new Blob([w],{type:"application/javascript+module"}),"worker.js");let _=await e.client.uploadPut(`/accounts/${l}/workers/scripts/${encodeURIComponent(r)}`,k);e.output.success(`Worker "${r}" deployed successfully.`),e.output.detail({Name:_.id,ETag:_.etag,Handlers:_.handlers.join(", "),Modified:_.modified_on})}var Ko=p(()=>{h();f()});async function Qo(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <script-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete worker script "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${t}/workers/scripts/${encodeURIComponent(o)}`),e.output.success(`Worker "${o}" deleted.`)}var Yo=p(()=>{h();f();U()});async function Xo(s,e){let{flags:n}=d(s),o=a(n,"name"),t=a(n,"format")??"pretty",r=R(n,"samplingRate");if(!o)throw new i("--name <script-name> is required.");if(t!=="json"&&t!=="pretty")throw new i('--format must be "json" or "pretty".');if(r!==void 0&&(r<0||r>1))throw new i("--sampling-rate must be between 0.0 and 1.0.");let m=await u(a(n,"accountId"),e.client,e.config),c={};if(r!==void 0)c.filters=[{sampling_rate:r}];let l=await e.client.post(`/accounts/${m}/workers/scripts/${encodeURIComponent(o)}/tails`,Object.keys(c).length>0?c:void 0);e.output.info(`Tail session created for "${o}". WebSocket URL: ${l.url}`),e.output.info(`Tail ID: ${l.id} (expires: ${l.expires_at})`);try{let w=new WebSocket(l.url);w.addEventListener("open",()=>{e.output.info(`Connected. Streaming logs (Ctrl+C to stop)...
|
|
53
|
+
`)}),w.addEventListener("message",(k)=>{try{let _=JSON.parse(String(k.data));if(t==="json")process.stdout.write(JSON.stringify(_)+`
|
|
54
|
+
`);else lq(_)}catch{process.stdout.write(String(k.data)+`
|
|
55
|
+
`)}}),w.addEventListener("error",(k)=>{e.output.error(`WebSocket error: ${String(k)}`)}),w.addEventListener("close",()=>{e.output.info("Tail session closed.")});let $=()=>{w.close(),e.client.delete(`/accounts/${m}/workers/scripts/${encodeURIComponent(o)}/tails/${l.id}`).catch(()=>{})};process.once("SIGINT",()=>{$(),process.exit(0)}),process.once("SIGTERM",()=>{$(),process.exit(0)}),await new Promise((k)=>{w.addEventListener("close",()=>k())})}catch(w){e.output.error(`Failed to connect to tail WebSocket: ${w instanceof Error?w.message:String(w)}`)}}function lq(s){let e=s.eventTimestamp?new Date(s.eventTimestamp).toISOString():new Date().toISOString(),n=s.outcome==="ok"?"OK":s.outcome.toUpperCase();if(process.stdout.write(`[${e}] ${n}`),s.scriptName)process.stdout.write(` (${s.scriptName})`);process.stdout.write(`
|
|
56
|
+
`);for(let o of s.logs){let t=new Date(o.timestamp).toISOString();process.stdout.write(` [${t}] ${o.level}: ${o.message.join(" ")}
|
|
57
|
+
`)}for(let o of s.exceptions){let t=new Date(o.timestamp).toISOString();process.stdout.write(` [${t}] EXCEPTION: ${o.name}: ${o.message}
|
|
58
|
+
`)}}var Fo=p(()=>{h();f()});async function xo(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${t}/workers/routes`),m=[{key:"id",header:"ID",width:34},{key:"pattern",header:"Pattern",width:40},{key:"script",header:"Script",width:30}];e.output.table(r,m)}var en=p(()=>{g();f()});async function on(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <route-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${r}/workers/routes/${t}`);e.output.detail({ID:m.id,Pattern:m.pattern,Script:m.script})}var nn=p(()=>{g();f()});async function tn(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"pattern"),r=a(n,"script");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--pattern <route-pattern> is required.");if(!r)throw new i("--script <worker-name> is required.");let m=await y(o,e.client),c=await e.client.post(`/zones/${m}/workers/routes`,{pattern:t,script:r});e.output.success(`Worker route created: ${c.id}`),e.output.detail({ID:c.id,Pattern:c.pattern,Script:c.script})}var rn=p(()=>{g();f()});async function sn(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id"),r=a(n,"pattern"),m=a(n,"script");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <route-id> is required.");if(!r)throw new i("--pattern <route-pattern> is required.");let c=await y(o,e.client),l={pattern:r};if(m)l.script=m;let w=await e.client.put(`/zones/${c}/workers/routes/${t}`,l);e.output.success(`Worker route ${t} updated.`),e.output.detail({ID:w.id,Pattern:w.pattern,Script:w.script})}var an=p(()=>{g();f()});async function mn(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <route-id> is required.");let r=await y(o,e.client);if(!await C(`Delete worker route ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${r}/workers/routes/${t}`),e.output.success(`Worker route ${t} deleted.`)}var dn=p(()=>{g();f();U()});async function pn(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return xo(o,e);case"get":case"show":return on(o,e);case"create":case"add":return tn(o,e);case"update":case"set":return sn(o,e);case"delete":case"rm":case"remove":return mn(o,e);case void 0:case"--help":case"-h":e.output.raw(cn);return;default:throw new i(`Unknown workers routes command: "${n}"
|
|
59
|
+
|
|
60
|
+
${cn}`)}}var cn=`Usage: cf workers routes <command>
|
|
61
|
+
|
|
62
|
+
Commands:
|
|
63
|
+
list List worker routes for a zone
|
|
64
|
+
get Get a specific worker route
|
|
65
|
+
create Create a worker route
|
|
66
|
+
update Update a worker route
|
|
67
|
+
delete Delete a worker route
|
|
68
|
+
|
|
69
|
+
Run 'cf workers routes <command> --help' for more information.`;var un=p(()=>{f();en();nn();rn();an();dn()});async function fn(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <script-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${t}/workers/scripts/${encodeURIComponent(o)}/schedules`)).schedules??[],c=[{key:"cron",header:"Cron Expression",width:30},{key:"created_on",header:"Created",width:12,transform:(l)=>String(l).slice(0,10)},{key:"modified_on",header:"Modified",width:12,transform:(l)=>String(l).slice(0,10)}];e.output.table(m,c)}var ln=p(()=>{h();f()});async function wn(s,e){let{flags:n}=d(s),o=a(n,"name"),t=D(n,"crons");if(!o)throw new i("--name <script-name> is required.");if(!t||t.length===0)throw new i("--crons <expr1,expr2,...> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=t.map(($)=>({cron:$})),l=(await e.client.put(`/accounts/${r}/workers/scripts/${encodeURIComponent(o)}/schedules`,m)).schedules??[];e.output.success(`Cron triggers updated for "${o}".`);let w=[{key:"cron",header:"Cron Expression",width:30},{key:"created_on",header:"Created",width:12,transform:($)=>String($).slice(0,10)},{key:"modified_on",header:"Modified",width:12,transform:($)=>String($).slice(0,10)}];e.output.table(l,w)}var hn=p(()=>{h();f()});async function Cn(s,e){let[n,...o]=s;switch(n){case"get":case"show":case"list":return fn(o,e);case"update":case"set":return wn(o,e);case void 0:case"--help":case"-h":e.output.raw(yn);return;default:throw new i(`Unknown workers cron command: "${n}"
|
|
70
|
+
|
|
71
|
+
${yn}`)}}var yn=`Usage: cf workers cron <command>
|
|
72
|
+
|
|
73
|
+
Commands:
|
|
74
|
+
get Get cron triggers for a worker script
|
|
75
|
+
update Update cron triggers for a worker script
|
|
76
|
+
|
|
77
|
+
Run 'cf workers cron <command> --help' for more information.`;var gn=p(()=>{f();ln();hn()});async function $n(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${o}/workers/domains`),r=[{key:"id",header:"ID",width:34},{key:"hostname",header:"Hostname",width:30},{key:"service",header:"Service",width:20},{key:"environment",header:"Environment",width:14},{key:"zone_name",header:"Zone",width:20}];e.output.table(t,r)}var kn=p(()=>{h()});async function Un(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <domain-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/workers/domains/${o}`);e.output.detail({ID:r.id,Hostname:r.hostname,Service:r.service,Environment:r.environment,"Zone ID":r.zone_id,"Zone Name":r.zone_name})}var _n=p(()=>{h();f()});async function zn(s,e){let{flags:n}=d(s),o=a(n,"hostname"),t=a(n,"zoneId"),r=a(n,"service"),m=a(n,"environment");if(!o)throw new i("--hostname <hostname> is required.");if(!t)throw new i("--zone-id <zone-id> is required.");if(!r)throw new i("--service <worker-name> is required.");if(!m)throw new i("--environment <env-name> is required.");let c=await u(a(n,"accountId"),e.client,e.config),l=await e.client.post(`/accounts/${c}/workers/domains`,{hostname:o,zone_id:t,service:r,environment:m,type:"custom"});e.output.success(`Worker domain created: ${l.id}`),e.output.detail({ID:l.id,Hostname:l.hostname,Service:l.service,Environment:l.environment,"Zone ID":l.zone_id,"Zone Name":l.zone_name})}var Rn=p(()=>{h();f()});async function bn(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <domain-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete worker domain ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${t}/workers/domains/${o}`),e.output.success(`Worker domain ${o} deleted.`)}var Pn=p(()=>{h();f();U()});async function vn(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return $n(o,e);case"get":case"show":return Un(o,e);case"create":case"add":return zn(o,e);case"delete":case"rm":case"remove":return bn(o,e);case void 0:case"--help":case"-h":e.output.raw(In);return;default:throw new i(`Unknown workers domains command: "${n}"
|
|
78
|
+
|
|
79
|
+
${In}`)}}var In=`Usage: cf workers domains <command>
|
|
80
|
+
|
|
81
|
+
Commands:
|
|
82
|
+
list List worker custom domains
|
|
83
|
+
get Get a worker custom domain
|
|
84
|
+
create Attach a custom domain to a worker
|
|
85
|
+
delete Detach a custom domain from a worker
|
|
86
|
+
|
|
87
|
+
Run 'cf workers domains <command> --help' for more information.`;var Dn=p(()=>{f();kn();_n();Rn();Pn()});async function Sn(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <script-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/workers/scripts/${encodeURIComponent(o)}/versions`),m=[{key:"id",header:"Version ID",width:38},{key:"number",header:"#",width:6},{key:"created_on",header:"Created",width:20,transform:(c)=>String(c).slice(0,19).replace("T"," ")}];e.output.table(r,m)}var qn=p(()=>{h();f()});async function An(s,e){let{flags:n}=d(s),o=a(n,"name"),t=a(n,"id");if(!o)throw new i("--name <script-name> is required.");if(!t)throw new i("--id <version-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.get(`/accounts/${r}/workers/scripts/${encodeURIComponent(o)}/versions/${t}`);e.output.detail({"Version ID":m.id,Number:m.number,Created:m.created_on,Metadata:JSON.stringify(m.metadata),Annotations:m.annotations?Object.entries(m.annotations).map(([c,l])=>`${c}=${l}`).join(", "):"-"})}var Ln=p(()=>{h();f()});async function En(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Sn(o,e);case"get":case"show":return An(o,e);case void 0:case"--help":case"-h":e.output.raw(Nn);return;default:throw new i(`Unknown workers versions command: "${n}"
|
|
88
|
+
|
|
89
|
+
${Nn}`)}}var Nn=`Usage: cf workers versions <command>
|
|
90
|
+
|
|
91
|
+
Commands:
|
|
92
|
+
list List versions of a worker script
|
|
93
|
+
get Get a specific version of a worker script
|
|
94
|
+
|
|
95
|
+
Run 'cf workers versions <command> --help' for more information.`;var Gn=p(()=>{f();qn();Ln()});async function Mn(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${o}/workers/dispatch/namespaces`),r=[{key:"namespace_id",header:"ID",width:34},{key:"namespace_name",header:"Name",width:30},{key:"script_count",header:"Scripts",width:10,transform:(m)=>String(m??0)},{key:"created_on",header:"Created",width:12,transform:(m)=>String(m).slice(0,10)}];e.output.table(t,r)}var Tn=p(()=>{h()});async function Zn(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <namespace-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/workers/dispatch/namespaces/${o}`);e.output.detail({"Namespace ID":r.namespace_id,Name:r.namespace_name,"Script Count":r.script_count??0,Class:r.class??"-",Created:r.created_on,Modified:r.modified_on})}var On=p(()=>{h();f()});async function jn(s,e){let{flags:n}=d(s),o=a(n,"namespace");if(!o)throw new i("--namespace <namespace-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/workers/dispatch/namespaces/${encodeURIComponent(o)}/scripts`),m=[{key:"id",header:"Name",width:30},{key:"created_on",header:"Created",width:12,transform:(c)=>String(c).slice(0,10)},{key:"modified_on",header:"Modified",width:12,transform:(c)=>String(c).slice(0,10)}];e.output.table(r,m)}var Jn=p(()=>{h();f()});import{readFileSync as Eq}from"fs";async function Bn(s,e){let{flags:n}=d(s),o=a(n,"namespace"),t=a(n,"name"),r=a(n,"file");if(!o)throw new i("--namespace <namespace-name> is required.");if(!t)throw new i("--name <script-name> is required.");if(!r)throw new i("--file <script-file> is required.");let m=await u(a(n,"accountId"),e.client,e.config),c;try{c=Eq(r,"utf-8")}catch{throw new i(`Cannot read file: "${r}".`)}let l={main_module:"worker.js"},w=new FormData;w.append("metadata",new Blob([JSON.stringify(l)],{type:"application/json"})),w.append("worker.js",new Blob([c],{type:"application/javascript+module"}),"worker.js");let $=await e.client.uploadPut(`/accounts/${m}/workers/dispatch/namespaces/${encodeURIComponent(o)}/scripts/${encodeURIComponent(t)}`,w);e.output.success(`Script "${t}" uploaded to namespace "${o}".`),e.output.detail({Name:$.id,Created:$.created_on,Modified:$.modified_on})}var Hn=p(()=>{h();f()});async function Vn(s,e){let{flags:n}=d(s),o=a(n,"namespace"),t=a(n,"name");if(!o)throw new i("--namespace <namespace-name> is required.");if(!t)throw new i("--name <script-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete script "${t}" from namespace "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${r}/workers/dispatch/namespaces/${encodeURIComponent(o)}/scripts/${encodeURIComponent(t)}`),e.output.success(`Script "${t}" deleted from namespace "${o}".`)}var Wn=p(()=>{h();f();U()});async function Kn(s,e){let[n,o,...t]=s;if(!n||n==="--help"||n==="-h"){e.output.raw(ee);return}if(n==="namespaces"||n==="namespace"||n==="ns")switch(o){case"list":case"ls":return Mn(t,e);case"get":case"show":return Zn(t,e);case void 0:case"--help":case"-h":e.output.raw(ee);return;default:throw new i(`Unknown platforms namespaces command: "${o}"
|
|
96
|
+
|
|
97
|
+
${ee}`)}if(n==="scripts"||n==="script")switch(o){case"list":case"ls":return jn(t,e);case"upload":case"deploy":return Bn(t,e);case"delete":case"rm":case"remove":return Vn(t,e);case void 0:case"--help":case"-h":e.output.raw(ee);return;default:throw new i(`Unknown platforms scripts command: "${o}"
|
|
98
|
+
|
|
99
|
+
${ee}`)}throw new i(`Unknown platforms subresource: "${n}"
|
|
100
|
+
|
|
101
|
+
${ee}`)}var ee=`Usage: cf workers platforms <subresource> <command>
|
|
102
|
+
|
|
103
|
+
Subresources:
|
|
104
|
+
namespaces Manage dispatch namespaces
|
|
105
|
+
list List all dispatch namespaces
|
|
106
|
+
get Get a dispatch namespace by ID
|
|
107
|
+
|
|
108
|
+
scripts Manage namespace scripts
|
|
109
|
+
list List scripts in a namespace
|
|
110
|
+
upload Upload a script to a namespace
|
|
111
|
+
delete Delete a script from a namespace
|
|
112
|
+
|
|
113
|
+
Run 'cf workers platforms <subresource> <command> --help' for more information.`;var Qn=p(()=>{f();Tn();On();Jn();Hn();Wn()});var Xn={};z(Xn,{run:()=>Zq});async function Zq(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Jo(o,e);case"get":case"show":return Ho(o,e);case"deploy":case"upload":case"put":return Wo(o,e);case"delete":case"rm":case"remove":return Qo(o,e);case"tail":case"logs":return Xo(o,e);case"routes":case"route":return pn(o,e);case"cron":case"crons":case"triggers":return Cn(o,e);case"domains":case"domain":return vn(o,e);case"versions":case"version":return En(o,e);case"platforms":case"platform":return Kn(o,e);case void 0:case"--help":case"-h":e.output.raw(Yn);return;default:throw new i(`Unknown workers command: "${n}"
|
|
114
|
+
|
|
115
|
+
${Yn}`)}}var Yn=`Usage: cf workers <command>
|
|
116
|
+
|
|
117
|
+
Commands:
|
|
118
|
+
list List all worker scripts
|
|
119
|
+
get Get worker script details
|
|
120
|
+
deploy Upload/deploy a worker script
|
|
121
|
+
delete Delete a worker script
|
|
122
|
+
tail Tail worker logs in real-time
|
|
123
|
+
routes Manage worker routes
|
|
124
|
+
cron Manage cron triggers
|
|
125
|
+
domains Manage worker custom domains
|
|
126
|
+
versions View worker script versions
|
|
127
|
+
platforms Workers for Platforms (dispatch namespaces)
|
|
128
|
+
|
|
129
|
+
Run 'cf workers <command> --help' for more information.`;var Fn=p(()=>{f();Bo();Vo();Ko();Yo();Fo();un();gn();Dn();Gn();Qn()});async function xn(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${o}/storage/kv/namespaces`),r=[{key:"id",header:"ID",width:36},{key:"title",header:"Title",width:30}];e.output.table(t,r)}var et=p(()=>{h()});async function ot(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <namespace-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${t}/storage/kv/namespaces/${o}`);e.output.detail({ID:r.id,Title:r.title,"Supports URL Encoding":r.supports_url_encoding??"-"})}var nt=p(()=>{h();f()});async function tt(s,e){let{flags:n}=d(s),o=a(n,"title");if(!o)throw new i("--title <namespace-title> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${t}/storage/kv/namespaces`,{title:o});e.output.success(`KV namespace "${r.title}" created (ID: ${r.id}).`)}var rt=p(()=>{h();f()});async function it(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <namespace-id> is required.");let t=a(n,"title");if(!t)throw new i("--title <new-title> is required.");let r=await u(a(n,"accountId"),e.client,e.config);await e.client.put(`/accounts/${r}/storage/kv/namespaces/${o}`,{title:t}),e.output.success(`KV namespace ${o} renamed to "${t}".`)}var st=p(()=>{h();f()});async function at(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <namespace-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete KV namespace "${o}"? This will delete all keys within it.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${t}/storage/kv/namespaces/${o}`),e.output.success(`KV namespace "${o}" deleted.`)}var mt=p(()=>{h();f();U()});async function ct(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return xn(o,e);case"get":case"show":return ot(o,e);case"create":case"new":return tt(o,e);case"rename":case"update":return it(o,e);case"delete":case"rm":case"remove":return at(o,e);case void 0:case"--help":case"-h":e.output.raw(dt);return;default:throw new i(`Unknown kv namespaces command: "${n}"
|
|
130
|
+
|
|
131
|
+
${dt}`)}}var dt=`Usage: cf kv namespaces <command>
|
|
132
|
+
|
|
133
|
+
Commands:
|
|
134
|
+
list List KV namespaces
|
|
135
|
+
get Get KV namespace details
|
|
136
|
+
create Create a KV namespace
|
|
137
|
+
rename Rename a KV namespace
|
|
138
|
+
delete Delete a KV namespace
|
|
139
|
+
|
|
140
|
+
Run 'cf kv namespaces <command> --help' for more information.`;var pt=p(()=>{f();et();nt();rt();st();mt()});async function ut(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"prefix");if(m)r.prefix=m;let c=R(n,"limit");if(c)r.limit=String(c);let l=a(n,"cursor");if(l)r.cursor=l;let w=await e.client.get(`/accounts/${t}/storage/kv/namespaces/${o}/keys`,r),$=[{key:"name",header:"Key Name",width:40},{key:"expiration",header:"Expiration",width:14,transform:(k)=>k?new Date(k*1000).toISOString().slice(0,10):"-"},{key:"metadata",header:"Metadata",width:30,transform:(k)=>k?JSON.stringify(k):"-"}];e.output.table(w,$)}var ft=p(()=>{h();f()});async function lt(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=a(n,"key");if(!t)throw new i("--key <key-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.get(`/accounts/${r}/storage/kv/namespaces/${o}/values/${encodeURIComponent(t)}`);e.output.raw(m)}var wt=p(()=>{h();f()});async function ht(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=a(n,"key");if(!t)throw new i("--key <key-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=a(n,"value"),c=a(n,"file");if(!m&&!c)throw new i("Either --value <value> or --file <path> is required.");let l;if(c){let I=Bun.file(c);if(!await I.exists())throw new i(`Cannot read file: "${c}".`);l=await I.text()}else l=m;let w=[],$=R(n,"ttl");if($)w.push(`expiration_ttl=${$}`);let k=a(n,"metadata");if(k)w.push(`metadata=${encodeURIComponent(k)}`);let _=w.length>0?`?${w.join("&")}`:"";await e.client.put(`/accounts/${r}/storage/kv/namespaces/${o}/values/${encodeURIComponent(t)}${_}`,l),e.output.success(`Key "${t}" written to namespace ${o}.`)}var yt=p(()=>{h();f()});async function Ct(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=a(n,"key");if(!t)throw new i("--key <key-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete key "${t}" from namespace ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${r}/storage/kv/namespaces/${o}/values/${encodeURIComponent(t)}`),e.output.success(`Key "${t}" deleted from namespace ${o}.`)}var gt=p(()=>{h();f();U()});async function $t(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=a(n,"file");if(!t)throw new i("--file <json-file> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=Bun.file(t);if(!await m.exists())throw new i(`Cannot read file: "${t}".`);let l=await m.text(),w;try{w=JSON.parse(l)}catch{throw new i("File must contain valid JSON array of key-value entries.")}if(!Array.isArray(w))throw new i("File must contain a JSON array of key-value entries.");await e.client.put(`/accounts/${r}/storage/kv/namespaces/${o}/bulk`,w),e.output.success(`Bulk write of ${w.length} key(s) to namespace ${o} completed.`)}var kt=p(()=>{h();f()});async function Ut(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=a(n,"file");if(!t)throw new i("--file <json-file> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=Bun.file(t);if(!await m.exists())throw new i(`Cannot read file: "${t}".`);let l=await m.text(),w;try{w=JSON.parse(l)}catch{throw new i("File must contain valid JSON array of key names.")}if(!Array.isArray(w))throw new i("File must contain a JSON array of key names.");if(!await C(`Bulk delete ${w.length} key(s) from namespace ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${r}/storage/kv/namespaces/${o}/bulk`,w),e.output.success(`Bulk delete of ${w.length} key(s) from namespace ${o} completed.`)}var _t=p(()=>{h();f();U()});var Rt={};z(Rt,{run:()=>xq});async function xq(s,e){let[n,...o]=s;switch(n){case"namespaces":case"namespace":case"ns":return ct(o,e);case"list":case"ls":return ut(o,e);case"get":case"show":return lt(o,e);case"put":case"write":case"set":return ht(o,e);case"delete":case"rm":case"remove":return Ct(o,e);case"bulk-write":case"bulk_write":return $t(o,e);case"bulk-delete":case"bulk_delete":return Ut(o,e);case void 0:case"--help":case"-h":e.output.raw(zt);return;default:throw new i(`Unknown kv command: "${n}"
|
|
141
|
+
|
|
142
|
+
${zt}`)}}var zt=`Usage: cf kv <command>
|
|
143
|
+
|
|
144
|
+
Commands:
|
|
145
|
+
namespaces Manage KV namespaces (list, get, create, rename, delete)
|
|
146
|
+
list List keys in a namespace
|
|
147
|
+
get Get a key's value
|
|
148
|
+
put Write a key-value pair
|
|
149
|
+
delete Delete a key
|
|
150
|
+
bulk-write Write multiple key-value pairs from a JSON file
|
|
151
|
+
bulk-delete Delete multiple keys from a JSON file
|
|
152
|
+
|
|
153
|
+
Run 'cf kv <command> --help' for more information.`;var bt=p(()=>{f();pt();ft();wt();yt();gt();kt();_t()});async function Pt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${o}/workers/durable_objects/namespaces`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"script",header:"Script",width:20,transform:(m)=>String(m??"-")},{key:"class",header:"Class",width:20,transform:(m)=>String(m??"-")}];e.output.table(t,r)}var It=p(()=>{h()});async function vt(s,e){let{flags:n}=d(s),o=a(n,"namespaceId");if(!o)throw new i("--namespace-id <id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=R(n,"limit");if(m)r.limit=String(m);let c=a(n,"cursor");if(c)r.cursor=c;let l=await e.client.get(`/accounts/${t}/workers/durable_objects/namespaces/${o}/objects`,r),w=[{key:"id",header:"Object ID",width:40},{key:"hasStoredData",header:"Has Stored Data",width:16,transform:($)=>String($)}];e.output.table(l,w)}var Dt=p(()=>{h();f()});var St={};z(St,{run:()=>nA});async function nA(s,e){let[n,...o]=s;switch(n){case"namespaces":case"namespace":case"ns":{let[t,...r]=o;switch(t){case"list":case"ls":return Pt(r,e);case void 0:case"--help":case"-h":e.output.raw(fe);return;default:throw new i(`Unknown durable-objects namespaces command: "${t}"
|
|
154
|
+
|
|
155
|
+
${fe}`)}}case"list":case"ls":return vt(o,e);case void 0:case"--help":case"-h":e.output.raw(fe);return;default:throw new i(`Unknown durable-objects subresource: "${n}"
|
|
156
|
+
|
|
157
|
+
${fe}`)}}var fe=`Usage: cf durable-objects <subresource> <command>
|
|
158
|
+
|
|
159
|
+
Subresources:
|
|
160
|
+
namespaces Manage Durable Object namespaces
|
|
161
|
+
list List all Durable Object namespaces
|
|
162
|
+
list List objects in a Durable Object namespace
|
|
163
|
+
|
|
164
|
+
Run 'cf durable-objects <subresource> <command> --help' for more information.`;var qt=p(()=>{f();It();Dt()});async function At(s,e){let{flags:n}=d(s),o=R(n,"page"),t=R(n,"perPage"),r=v(n,"all"),m={};if(o)m.page=String(o);if(t)m.per_page=String(t);let c;if(r)c=await e.client.fetchAll("/accounts",m);else c=await e.client.get("/accounts",m);let l=[{key:"id",header:"ID",width:34},{key:"name",header:"Name",width:40},{key:"type",header:"Type",width:12},{key:"created_on",header:"Created",width:12,transform:(w)=>String(w).slice(0,10)}];e.output.table(c,l)}var Lt=()=>{};async function Nt(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <account-id> is required.");let t=await e.client.get(`/accounts/${o}`);e.output.detail({ID:t.id,Name:t.name,Type:t.type,"Enforce 2FA":t.settings.enforce_twofactor,Created:t.created_on})}var Et=p(()=>{f()});async function Gt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/subscriptions`),r=[{key:"id",header:"ID",width:34},{key:"rate_plan",header:"Plan",width:24,transform:(m)=>{let c=m;return c?.public_name??c?.id??"-"}},{key:"price",header:"Price",width:10},{key:"currency",header:"Currency",width:10},{key:"frequency",header:"Frequency",width:12},{key:"state",header:"State",width:12}];e.output.table(t,r)}var Mt=p(()=>{h()});async function Tt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <subscription-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/subscriptions/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Plan:r.rate_plan?.public_name??r.rate_plan?.id??"-",Price:r.price??"-",Currency:r.currency??"-",Frequency:r.frequency??"-",State:r.state??"-","Period Start":r.current_period_start??"-","Period End":r.current_period_end??"-",Created:r.created_on??"-"})}var Zt=p(()=>{h();f()});async function jt(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Gt(o,e);case"get":case"show":return Tt(o,e);case void 0:case"--help":case"-h":e.output.raw(Ot);return;default:throw new i(`Unknown subscriptions command: "${n}"
|
|
165
|
+
|
|
166
|
+
${Ot}`)}}var Ot=`Usage: cf accounts subscriptions <command>
|
|
167
|
+
|
|
168
|
+
Commands:
|
|
169
|
+
list List account subscriptions
|
|
170
|
+
get Get subscription details
|
|
171
|
+
|
|
172
|
+
Run 'cf accounts subscriptions <command> --help' for more information.`;var Jt=p(()=>{f();Mt();Zt()});async function Bt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/members`),r=[{key:"id",header:"ID",width:36},{key:"user",header:"Email",width:30,transform:(m)=>{return m?.email??""}},{key:"status",header:"Status",width:12},{key:"roles",header:"Roles",width:40,transform:(m)=>{let c=m;return Array.isArray(c)?c.map((l)=>l.name).join(", "):""}}];e.output.table(t,r)}var Ht=p(()=>{h()});async function Vt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <member-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/members/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Email:r.user.email,Name:[r.user.first_name,r.user.last_name].filter(Boolean).join(" ")||"",Status:r.status,Roles:r.roles.map((m)=>m.name).join(", "),"2FA Enabled":r.user.two_factor_authentication_enabled??!1})}var Wt=p(()=>{h();f()});async function Kt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"email");if(!t)throw new i("--email <address> is required.");let r=D(n,"roles");if(!r||r.length===0)throw new i("--roles <role-id,...> is required.");let m={email:t,roles:r.map((l)=>({id:l}))},c=await e.client.post(`/accounts/${encodeURIComponent(o)}/members`,m);e.output.success(`Member added: ${t}`),e.output.detail({ID:c.id,Email:c.user.email,Status:c.status,Roles:c.roles.map((l)=>l.name).join(", ")})}var Qt=p(()=>{h();f()});async function Yt(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <member-id> is required.");let r=D(n,"roles");if(!r||r.length===0)throw new i("--roles <role-id,...> is required.");let m={roles:r.map((l)=>({id:l}))},c=await e.client.put(`/accounts/${encodeURIComponent(o)}/members/${encodeURIComponent(t)}`,m);e.output.success(`Member "${t}" updated.`),e.output.detail({ID:c.id,Email:c.user.email,Roles:c.roles.map((l)=>l.name).join(", ")})}var Xt=p(()=>{h();f()});async function Ft(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <member-id> is required.");if(!await C(`Remove member "${t}" from account?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/members/${encodeURIComponent(t)}`),e.output.success(`Member "${t}" removed.`)}var xt=p(()=>{h();f();U()});async function or(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Bt(o,e);case"get":case"show":return Vt(o,e);case"add":case"create":return Kt(o,e);case"update":return Yt(o,e);case"remove":case"rm":case"delete":return Ft(o,e);case void 0:case"--help":case"-h":e.output.raw(er);return;default:throw new i(`Unknown members command: "${n}"
|
|
173
|
+
|
|
174
|
+
${er}`)}}var er=`Usage: cf accounts members <command>
|
|
175
|
+
|
|
176
|
+
Commands:
|
|
177
|
+
list List account members
|
|
178
|
+
get Get a member's details
|
|
179
|
+
add Add a member to the account
|
|
180
|
+
update Update a member's roles
|
|
181
|
+
remove Remove a member from the account
|
|
182
|
+
|
|
183
|
+
Run 'cf accounts members <command> --help' for more information.`;var nr=p(()=>{f();Ht();Wt();Qt();Xt();xt()});async function tr(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/roles`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"description",header:"Description",width:50}];e.output.table(t,r)}var rr=p(()=>{h()});async function ir(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <role-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/roles/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,Description:r.description,Permissions:JSON.stringify(r.permissions)})}var sr=p(()=>{h();f()});async function mr(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return tr(o,e);case"get":case"show":return ir(o,e);case void 0:case"--help":case"-h":e.output.raw(ar);return;default:throw new i(`Unknown roles command: "${n}"
|
|
184
|
+
|
|
185
|
+
${ar}`)}}var ar=`Usage: cf accounts roles <command>
|
|
186
|
+
|
|
187
|
+
Commands:
|
|
188
|
+
list List account roles
|
|
189
|
+
get Get role details
|
|
190
|
+
|
|
191
|
+
Run 'cf accounts roles <command> --help' for more information.`;var dr=p(()=>{f();rr();sr()});var pr={};z(pr,{run:()=>yA});async function yA(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return At(o,e);case"get":case"show":return Nt(o,e);case"subscriptions":case"subs":return jt(o,e);case"members":return or(o,e);case"roles":return mr(o,e);case void 0:case"--help":case"-h":e.output.raw(cr);return;default:throw new i(`Unknown accounts command: "${n}"
|
|
192
|
+
|
|
193
|
+
${cr}`)}}var cr=`Usage: cf accounts <command>
|
|
194
|
+
|
|
195
|
+
Commands:
|
|
196
|
+
list List all accounts
|
|
197
|
+
get Get account details
|
|
198
|
+
subscriptions Manage account subscriptions
|
|
199
|
+
members Manage account members
|
|
200
|
+
roles Manage account roles
|
|
201
|
+
|
|
202
|
+
Run 'cf accounts <command> --help' for more information.`;var ur=p(()=>{f();Lt();Et();Jt();nr();dr()});async function fr(s,e){let n=await e.client.get("/user");e.output.detail({ID:n.id,Email:n.email,Username:n.username,"First Name":n.first_name??"-","Last Name":n.last_name??"-",Telephone:n.telephone??"-",Country:n.country??"-",Zipcode:n.zipcode??"-","2FA Enabled":n.two_factor_authentication_enabled,Suspended:n.suspended,Created:n.created_on,Modified:n.modified_on})}async function lr(s,e){let n=await e.client.get("/user/tokens/verify");if(e.output.detail({"Token ID":n.id,Status:n.status,"Not Before":n.not_before??"-","Expires On":n.expires_on??"-"}),n.status==="active")e.output.success("Token is valid and active.");else e.output.warn(`Token status: ${n.status}`)}async function wr(s,e){let n=await e.client.get("/user/billing/profile");e.output.detail({ID:n.id??"-",Name:[n.first_name,n.last_name].filter(Boolean).join(" ")||"-",Company:n.company??"-",Address:n.address??"-",City:n.city??"-",State:n.state??"-",Zipcode:n.zipcode??"-",Country:n.country??"-",Telephone:n.telephone??"-",Card:n.card_number??"-","Payment Gateway":n.payment_gateway??"-","Payment Email":n.payment_email??"-",Type:n.type??"-",Created:n.created_on??"-"})}async function hr(s,e){let{flags:n}=d(s),o=R(n,"page"),t=R(n,"perPage"),r={};if(o)r.page=String(o);if(t)r.per_page=String(t);let m=await e.client.get("/user/billing/history",r),c=[{key:"id",header:"ID",width:34},{key:"type",header:"Type",width:14},{key:"action",header:"Action",width:14},{key:"description",header:"Description",width:30},{key:"amount",header:"Amount",width:10},{key:"currency",header:"Currency",width:10},{key:"occurred_at",header:"Date",width:12,transform:(l)=>typeof l==="string"?l.slice(0,10):"-"}];e.output.table(m,c)}var yr=()=>{};async function gr(s,e){let[n,...o]=s;switch(n){case"profile":return wr(o,e);case"history":return hr(o,e);case void 0:case"--help":case"-h":e.output.raw(Cr);return;default:throw new i(`Unknown billing command: "${n}"
|
|
203
|
+
|
|
204
|
+
${Cr}`)}}var Cr=`Usage: cf user billing <command>
|
|
205
|
+
|
|
206
|
+
Commands:
|
|
207
|
+
profile Get billing profile
|
|
208
|
+
history List billing history
|
|
209
|
+
|
|
210
|
+
Run 'cf user billing <command> --help' for more information.`;var $r=p(()=>{f();yr()});async function kr(s,e){let n=await e.client.get("/user/tokens"),o=[{key:"id",header:"ID",width:34},{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:12},{key:"issued_on",header:"Issued",width:12,transform:(t)=>typeof t==="string"?t.slice(0,10):"-"},{key:"expires_on",header:"Expires",width:12,transform:(t)=>typeof t==="string"?t.slice(0,10):"never"}];e.output.table(n,o)}async function Ur(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <token-id> is required.");let t=await e.client.get(`/user/tokens/${encodeURIComponent(o)}`);e.output.detail({ID:t.id,Name:t.name,Status:t.status??"-","Issued On":t.issued_on??"-","Modified On":t.modified_on??"-","Not Before":t.not_before??"-","Expires On":t.expires_on??"never",Policies:t.policies?JSON.stringify(t.policies,null,2):"-"})}var _r=p(()=>{f()});async function zr(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <token-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <token-policy-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c={name:o,...m},l=await e.client.post("/user/tokens",c);if(e.output.success(`Token "${l.name}" created (ID: ${l.id}).`),l.value)e.output.info(`Token value: ${l.value}`),e.output.warn("Save this value now - it will not be shown again.")}var Rr=p(()=>{f()});async function br(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <token-id> is required.");let t=a(n,"name"),r=a(n,"status");if(!t&&!r)throw new i("At least one of --name or --status is required.");let m={};if(t)m.name=t;if(r){if(r!=="active"&&r!=="disabled")throw new i('--status must be "active" or "disabled".');m.status=r}let c=await e.client.put(`/user/tokens/${encodeURIComponent(o)}`,m);e.output.success(`Token "${c.name}" updated (ID: ${c.id}).`)}var Pr=p(()=>{f()});async function Ir(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <token-id> is required.");if(!await C(`Delete API token "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/user/tokens/${encodeURIComponent(o)}`),e.output.success(`Token ${o} deleted.`)}var vr=p(()=>{f();U()});async function Dr(s,e){let n=await e.client.get("/user/tokens/verify");e.output.detail({ID:n.id,Status:n.status,"Not Before":n.not_before??"-","Expires On":n.expires_on??"never"})}async function Sr(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <token-id> is required.");let t=await e.client.put(`/user/tokens/${encodeURIComponent(o)}/value`,{});if(e.output.success(`Token ${o} rolled successfully.`),t.value)e.output.info(`New token value: ${t.value}`),e.output.warn("Save this value now - it will not be shown again.")}var qr=p(()=>{f()});async function Lr(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return kr(o,e);case"get":case"show":return Ur(o,e);case"create":case"add":return zr(o,e);case"update":case"edit":return br(o,e);case"delete":case"rm":case"remove":return Ir(o,e);case"verify":case"check":return Dr(o,e);case"roll":case"rotate":return Sr(o,e);case void 0:case"--help":case"-h":e.output.raw(Ar);return;default:throw new i(`Unknown tokens command: "${n}"
|
|
211
|
+
|
|
212
|
+
${Ar}`)}}var Ar=`Usage: cf user tokens <command>
|
|
213
|
+
|
|
214
|
+
Commands:
|
|
215
|
+
list List API tokens
|
|
216
|
+
get Get token details
|
|
217
|
+
create Create a new API token
|
|
218
|
+
update Update an API token
|
|
219
|
+
delete Delete an API token
|
|
220
|
+
verify Verify the current API token
|
|
221
|
+
roll Roll (regenerate) a token value
|
|
222
|
+
|
|
223
|
+
Run 'cf user tokens <command> --help' for more information.`;var Nr=p(()=>{f();_r();Rr();Pr();vr();qr()});var Gr={};z(Gr,{run:()=>SA});async function SA(s,e){let[n,...o]=s;switch(n){case"get":case"show":case"whoami":case"me":return fr(o,e);case"token":{let[t,...r]=o;if(t==="verify"||t==="check")return lr(r,e);throw new i(`Unknown user token command: "${t}". Try: cf user token verify`)}case"billing":return gr(o,e);case"tokens":return Lr(o,e);case void 0:case"--help":case"-h":e.output.raw(Er);return;default:throw new i(`Unknown user command: "${n}"
|
|
224
|
+
|
|
225
|
+
${Er}`)}}var Er=`Usage: cf user <command>
|
|
226
|
+
|
|
227
|
+
Commands:
|
|
228
|
+
get Get current user details
|
|
229
|
+
token verify Verify API token validity
|
|
230
|
+
billing Billing profile and history
|
|
231
|
+
tokens Manage API tokens
|
|
232
|
+
|
|
233
|
+
Run 'cf user <command> --help' for more information.`;var Mr=p(()=>{f();$r();Nr()});async function Zr(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=v(n,"everything"),r=D(n,"urls"),m=D(n,"tags"),c=D(n,"hosts"),l=D(n,"prefixes");if(!o)throw new i("--zone <zone-id-or-name> is required.");let w=[t,r,m,c,l].filter(Boolean).length;if(w===0)throw new i("Specify one of: --everything, --urls, --tags, --hosts, --prefixes");if(w>1)throw new i("--everything, --urls, --tags, --hosts, and --prefixes are mutually exclusive.");if(r&&r.length>Tr)throw new i(`Maximum ${Tr} URLs per purge request. Got ${r.length}.`);let $=await y(o,e.client);if(t){if(!await C(`Purge ALL cached content for zone ${$}? This affects all visitors.`,e.flags)){e.output.info("Aborted.");return}}let k={};if(t)k.purge_everything=!0;if(r)k.files=r;if(m)k.tags=m;if(c)k.hosts=c;if(l)k.prefixes=l;let _=await e.client.post(`/zones/${$}/purge_cache`,k);e.output.success(`Cache purge initiated: ${_.id}`)}var Tr=30;var Or=p(()=>{g();f();U()});var Jr={};z(Jr,{run:()=>AA});async function AA(s,e){let[n,...o]=s;switch(n){case"purge":case"clear":return Zr(o,e);case void 0:case"--help":case"-h":e.output.raw(jr);return;default:throw new i(`Unknown cache command: "${n}"
|
|
234
|
+
|
|
235
|
+
${jr}`)}}var jr=`Usage: cf cache <command>
|
|
236
|
+
|
|
237
|
+
Commands:
|
|
238
|
+
purge Purge cached content
|
|
239
|
+
|
|
240
|
+
Run 'cf cache <command> --help' for more information.`;var Br=p(()=>{f();Or()});async function Hr(s,e){let{flags:n}=d(s),o=a(n,"profile"),t=a(n,"token"),r=a(n,"apiKey"),m=a(n,"email"),c=a(n,"accountId"),l=a(n,"zoneId"),w=a(n,"output");if(!o)throw new i("--profile <name> is required.");if(!/^[a-zA-Z0-9][a-zA-Z0-9-]*$/.test(o))throw new i(`Invalid profile name: "${o}". Profile names must start with a letter or digit and contain only alphanumeric characters and hyphens.`);if(new Set(["__proto__","constructor","prototype"]).has(o))throw new i(`Invalid profile name: "${o}". That name is reserved.`);let k;if(t)k="token";else if(r&&m)k="key";else if(r&&!m)throw new i("--email is required when using --api-key.");else{let B=M().profiles[o];if(B)k=B.auth_method;else throw new i("New profile requires either --token or --api-key + --email.")}if(w)Fe(w);let _=M(),I=_.profiles[o],P={auth_method:k,token:t??I?.token,api_key:r??I?.api_key,email:m??I?.email,account_id:c??I?.account_id,zone_id:l??I?.zone_id};_=qe(_,o,P),K(_),e.output.success(`Profile "${o}" saved.`)}var Vr=p(()=>{f();H();x()});async function Wr(s,e){let{flags:n}=d(s),o=a(n,"profile"),t=M(),r=o??t.default_profile,m=Q(t,r);if(!m)throw new i(`Profile "${r}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);let c=m.token?`***${m.token.slice(-4)}`:"-",l=m.api_key?`***${m.api_key.slice(-4)}`:"-";e.output.detail({Profile:r,"Auth Method":m.auth_method,Token:c,"API Key":l,Email:m.email??"-","Account ID":m.account_id??"-","Zone ID":m.zone_id??"-","Is Default":r===t.default_profile})}var Kr=p(()=>{H();f()});async function Qr(s,e){let n=M(),o=Object.entries(n.profiles).map(([r,m])=>({name:r,auth_method:m.auth_method,email:m.email??"-",account_id:m.account_id??"-",is_default:r===n.default_profile?"Yes":""}));if(o.length===0){e.output.info("No profiles configured. Run: cf config set --profile <name> --token <token>");return}let t=[{key:"name",header:"Profile",width:20},{key:"auth_method",header:"Auth",width:8},{key:"email",header:"Email",width:30},{key:"account_id",header:"Account ID",width:34},{key:"is_default",header:"Default",width:8}];e.output.table(o,t)}var Yr=p(()=>{H()});async function Xr(s,e){let{flags:n}=d(s),o=a(n,"profile");if(!o)throw new i("--profile <name> is required.");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);if(!await C(`Delete profile "${o}"?`,e.flags)){e.output.info("Aborted.");return}let m=Ae(t,o),c=m;if(o===t.default_profile){let l=Object.keys(m.profiles);c={...m,default_profile:l[0]??"default"}}K(c),e.output.success(`Profile "${o}" deleted.`)}var Fr=p(()=>{f();H();U()});async function xr(s,e){let{positional:n}=d(s),o=n[0];if(!o)throw new i("Usage: cf config use <profile-name>");let t=M();if(!t.profiles[o])throw new i(`Profile "${o}" not found. Available profiles: ${Object.keys(t.profiles).join(", ")||"(none)"}`);t.default_profile=o,K(t),e.output.success(`Default profile set to "${o}".`)}var ei=p(()=>{f();H()});var ni={};z(ni,{run:()=>TA});async function TA(s,e){let[n,...o]=s;switch(n){case"set":return Hr(o,e);case"get":case"show":return Wr(o,e);case"list":case"ls":return Qr(o,e);case"delete":case"rm":case"remove":return Xr(o,e);case"use":case"switch":return xr(o,e);case void 0:case"--help":case"-h":e.output.raw(oi);return;default:throw new i(`Unknown config command: "${n}"
|
|
241
|
+
|
|
242
|
+
${oi}`)}}var oi=`Usage: cf config <command>
|
|
243
|
+
|
|
244
|
+
Commands:
|
|
245
|
+
set Set profile configuration
|
|
246
|
+
get Show profile details
|
|
247
|
+
list List all profiles
|
|
248
|
+
delete Delete a profile
|
|
249
|
+
use Set default profile
|
|
250
|
+
|
|
251
|
+
Run 'cf config <command> --help' for more information.`;var ti=p(()=>{f();Vr();Kr();Yr();Fr();ei()});async function ri(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t={},r=a(n,"cursor");if(r)t.cursor=r;let m=await e.client.get(`/accounts/${encodeURIComponent(o)}/r2/buckets`,t),c=[{key:"name",header:"Name",width:40},{key:"location",header:"Location",width:15},{key:"storage_class",header:"Storage Class",width:15},{key:"creation_date",header:"Created",width:25}];e.output.table(m,c)}var ii=p(()=>{h()});async function si(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <bucket-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}`);e.output.detail({Name:r.name,Location:r.location??"(default)","Storage Class":r.storage_class??"Standard",Created:r.creation_date})}var ai=p(()=>{h();f()});async function mi(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <bucket-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={name:o},m=a(n,"location");if(m)r.locationHint=m;let c=a(n,"storageClass");if(c)r.storageClass=c;let l=await e.client.post(`/accounts/${encodeURIComponent(t)}/r2/buckets`,r);e.output.success(`R2 bucket "${l.name}" created.`)}var di=p(()=>{h();f()});async function ci(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <bucket-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"defaultStorageClass");if(m)r.storageClass=m;if(Object.keys(r).length===0)throw new i("Provide at least one update flag (e.g. --default-storage-class).");await e.client.patch(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}`,r),e.output.success(`R2 bucket "${o}" updated.`)}var pi=p(()=>{h();f()});async function ui(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <bucket-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete R2 bucket "${o}"? This will delete all objects within it.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}`),e.output.success(`R2 bucket "${o}" deleted.`)}var fi=p(()=>{h();f();U()});async function wi(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ri(o,e);case"get":case"show":return si(o,e);case"create":case"new":return mi(o,e);case"update":return ci(o,e);case"delete":case"rm":case"remove":return ui(o,e);case void 0:case"--help":case"-h":e.output.raw(li);return;default:throw new i(`Unknown r2 buckets command: "${n}"
|
|
252
|
+
|
|
253
|
+
${li}`)}}var li=`Usage: cf r2 buckets <command>
|
|
254
|
+
|
|
255
|
+
Commands:
|
|
256
|
+
list List R2 buckets
|
|
257
|
+
get Get R2 bucket details
|
|
258
|
+
create Create an R2 bucket
|
|
259
|
+
update Update R2 bucket settings
|
|
260
|
+
delete Delete an R2 bucket
|
|
261
|
+
|
|
262
|
+
Run 'cf r2 buckets <command> --help' for more information.`;var hi=p(()=>{f();ii();ai();di();pi();fi()});async function yi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/cors`),m=[{key:"allowed_origins",header:"Origins",width:30,transform:(c)=>Array.isArray(c)?c.join(", "):String(c??"")},{key:"allowed_methods",header:"Methods",width:25,transform:(c)=>Array.isArray(c)?c.join(", "):String(c??"")},{key:"allowed_headers",header:"Headers",width:25,transform:(c)=>Array.isArray(c)?c.join(", "):String(c??"")},{key:"max_age_seconds",header:"Max Age",width:10}];e.output.table(r,m)}var Ci=p(()=>{h();f()});async function gi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"file");if(!t)throw new i("--file <cors-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}await e.client.put(`/accounts/${encodeURIComponent(r)}/r2/buckets/${encodeURIComponent(o)}/cors`,c),e.output.success(`CORS rules updated for bucket "${o}".`)}var $i=p(()=>{h();f()});async function ki(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete all CORS rules from bucket "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/cors`),e.output.success(`CORS rules deleted from bucket "${o}".`)}var Ui=p(()=>{h();f();U()});async function zi(s,e){let[n,...o]=s;switch(n){case"list":case"ls":case"get":return yi(o,e);case"set":case"put":return gi(o,e);case"delete":case"rm":case"remove":return ki(o,e);case void 0:case"--help":case"-h":e.output.raw(_i);return;default:throw new i(`Unknown r2 cors command: "${n}"
|
|
263
|
+
|
|
264
|
+
${_i}`)}}var _i=`Usage: cf r2 cors <command>
|
|
265
|
+
|
|
266
|
+
Commands:
|
|
267
|
+
list List CORS rules for an R2 bucket
|
|
268
|
+
set Set CORS rules for an R2 bucket (from JSON file)
|
|
269
|
+
delete Delete all CORS rules from an R2 bucket
|
|
270
|
+
|
|
271
|
+
Run 'cf r2 cors <command> --help' for more information.`;var Ri=p(()=>{f();Ci();$i();Ui()});async function bi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/lifecycle`),m=[{key:"id",header:"ID",width:20},{key:"enabled",header:"Enabled",width:10},{key:"action.type",header:"Action",width:20},{key:"conditions.prefix",header:"Prefix",width:20},{key:"conditions.max_age_days",header:"Max Age (days)",width:15}];e.output.table(r,m)}var Pi=p(()=>{h();f()});async function Ii(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"file");if(!t)throw new i("--file <lifecycle-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}await e.client.put(`/accounts/${encodeURIComponent(r)}/r2/buckets/${encodeURIComponent(o)}/lifecycle`,c),e.output.success(`Lifecycle rules updated for bucket "${o}".`)}var vi=p(()=>{h();f()});async function Di(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete all lifecycle rules from bucket "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/lifecycle`),e.output.success(`Lifecycle rules deleted from bucket "${o}".`)}var Si=p(()=>{h();f();U()});async function Ai(s,e){let[n,...o]=s;switch(n){case"get":case"list":case"ls":return bi(o,e);case"set":case"put":return Ii(o,e);case"delete":case"rm":case"remove":return Di(o,e);case void 0:case"--help":case"-h":e.output.raw(qi);return;default:throw new i(`Unknown r2 lifecycle command: "${n}"
|
|
272
|
+
|
|
273
|
+
${qi}`)}}var qi=`Usage: cf r2 lifecycle <command>
|
|
274
|
+
|
|
275
|
+
Commands:
|
|
276
|
+
get Get lifecycle rules for an R2 bucket
|
|
277
|
+
set Set lifecycle rules for an R2 bucket (from JSON file)
|
|
278
|
+
delete Delete all lifecycle rules from an R2 bucket
|
|
279
|
+
|
|
280
|
+
Run 'cf r2 lifecycle <command> --help' for more information.`;var Li=p(()=>{f();Pi();vi();Si()});async function Ni(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/custom_domains`),m=[{key:"domain",header:"Domain",width:40},{key:"status",header:"Status",width:15},{key:"enabled",header:"Enabled",width:10},{key:"zone_name",header:"Zone",width:25}];e.output.table(r,m)}var Ei=p(()=>{h();f()});async function Gi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"domain");if(!t)throw new i("--domain <domain> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m={domain:t},c=a(n,"zoneId");if(c)m.zoneId=c;let l=await e.client.post(`/accounts/${encodeURIComponent(r)}/r2/buckets/${encodeURIComponent(o)}/custom_domains`,m);e.output.success(`Custom domain "${l.domain}" added to bucket "${o}".`)}var Mi=p(()=>{h();f()});async function Ti(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"domain");if(!t)throw new i("--domain <domain> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Remove custom domain "${t}" from bucket "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/r2/buckets/${encodeURIComponent(o)}/custom_domains/${encodeURIComponent(t)}`),e.output.success(`Custom domain "${t}" removed from bucket "${o}".`)}var Zi=p(()=>{h();f();U()});async function ji(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ni(o,e);case"add":case"create":return Gi(o,e);case"remove":case"delete":case"rm":return Ti(o,e);case void 0:case"--help":case"-h":e.output.raw(Oi);return;default:throw new i(`Unknown r2 custom-domains command: "${n}"
|
|
281
|
+
|
|
282
|
+
${Oi}`)}}var Oi=`Usage: cf r2 custom-domains <command>
|
|
283
|
+
|
|
284
|
+
Commands:
|
|
285
|
+
list List custom domains for an R2 bucket
|
|
286
|
+
add Add a custom domain to an R2 bucket
|
|
287
|
+
remove Remove a custom domain from an R2 bucket
|
|
288
|
+
|
|
289
|
+
Run 'cf r2 custom-domains <command> --help' for more information.`;var Ji=p(()=>{f();Ei();Mi();Zi()});async function Bi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/event_notifications/r2/${encodeURIComponent(o)}/configuration`)).rules??[],c=[{key:"queue_id",header:"Queue ID",width:36},{key:"event_types",header:"Event Types",width:30,transform:(l)=>Array.isArray(l)?l.join(", "):String(l??"")},{key:"prefix",header:"Prefix",width:20},{key:"suffix",header:"Suffix",width:20}];e.output.table(m,c)}var Hi=p(()=>{h();f()});async function Vi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"queue");if(!t)throw new i("--queue <queue-id> is required.");let r=D(n,"eventTypes");if(!r||r.length===0)throw new i("--event-types <type,...> is required (comma-separated).");let m=await u(a(n,"accountId"),e.client,e.config),c={actions:r,queue_id:t},l=a(n,"prefix");if(l)c.prefix=l;let w=a(n,"suffix");if(w)c.suffix=w;let $={rules:[c]};await e.client.put(`/accounts/${encodeURIComponent(m)}/event_notifications/r2/${encodeURIComponent(o)}/configuration/queues/${encodeURIComponent(t)}`,$),e.output.success(`Event notification rule created for bucket "${o}" -> queue "${t}".`)}var Wi=p(()=>{h();f()});async function Ki(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=a(n,"queue");if(!t)throw new i("--queue <queue-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete event notification rule for bucket "${o}" -> queue "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/event_notifications/r2/${encodeURIComponent(o)}/configuration/queues/${encodeURIComponent(t)}`),e.output.success(`Event notification rule deleted for bucket "${o}" -> queue "${t}".`)}var Qi=p(()=>{h();f();U()});async function Xi(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Bi(o,e);case"create":case"add":return Vi(o,e);case"delete":case"rm":case"remove":return Ki(o,e);case void 0:case"--help":case"-h":e.output.raw(Yi);return;default:throw new i(`Unknown r2 event-notifications command: "${n}"
|
|
290
|
+
|
|
291
|
+
${Yi}`)}}var Yi=`Usage: cf r2 event-notifications <command>
|
|
292
|
+
|
|
293
|
+
Commands:
|
|
294
|
+
list List event notification rules for an R2 bucket
|
|
295
|
+
create Create an event notification rule for an R2 bucket
|
|
296
|
+
delete Delete an event notification rule from an R2 bucket
|
|
297
|
+
|
|
298
|
+
Run 'cf r2 event-notifications <command> --help' for more information.`;var Fi=p(()=>{f();Hi();Wi();Qi()});function re(s){if(s===0)return"0 B";let e=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(s)/Math.log(1024));return`${(s/Math.pow(1024,n)).toFixed(2)} ${e[n]}`}async function xi(s,e){let{flags:n}=d(s),o=a(n,"bucket");if(!o)throw new i("--bucket <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"from");if(m)r.start=m;let c=a(n,"to");if(c)r.end=c;let l=await e.client.get(`/accounts/${encodeURIComponent(t)}/r2/buckets/${encodeURIComponent(o)}/metrics`,r);e.output.detail({Bucket:o,"Object Count":l.object_count,"Payload Size":re(l.payload_size),"Metadata Size":re(l.metadata_size),"Upload Count":l.upload_count,"Class A Ops":l.operations?.class_a??0,"Class B Ops":l.operations?.class_b??0})}var es=p(()=>{h();f()});var ns={};z(ns,{run:()=>dL});async function dL(s,e){let[n,...o]=s;switch(n){case"buckets":case"bucket":return wi(o,e);case"cors":return zi(o,e);case"lifecycle":return Ai(o,e);case"custom-domains":case"custom-domain":case"domains":return ji(o,e);case"event-notifications":case"event-notification":case"notifications":return Xi(o,e);case"metrics":case"stats":return xi(o,e);case void 0:case"--help":case"-h":e.output.raw(os);return;default:throw new i(`Unknown r2 command: "${n}"
|
|
299
|
+
|
|
300
|
+
${os}`)}}var os=`Usage: cf r2 <command>
|
|
301
|
+
|
|
302
|
+
Commands:
|
|
303
|
+
buckets Manage R2 buckets (list, get, create, update, delete)
|
|
304
|
+
cors Manage bucket CORS configuration
|
|
305
|
+
lifecycle Manage bucket lifecycle rules
|
|
306
|
+
custom-domains Manage bucket custom domains
|
|
307
|
+
event-notifications Manage bucket event notifications
|
|
308
|
+
metrics View bucket metrics
|
|
309
|
+
|
|
310
|
+
Run 'cf r2 <command> --help' for more information.`;var ts=p(()=>{f();hi();Ri();Li();Ji();Fi();es()});async function rs(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/d1/database`),r=[{key:"uuid",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"version",header:"Version",width:10},{key:"num_tables",header:"Tables",width:8},{key:"file_size",header:"Size",width:12,transform:(m)=>typeof m==="number"?re(m):String(m??"")},{key:"created_at",header:"Created",width:25}];e.output.table(t,r)}var is=p(()=>{h()});async function ss(s,e){let{flags:n}=d(s),o=a(n,"database");if(!o)throw new i("--database <name-or-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/d1/database/${encodeURIComponent(o)}`);e.output.detail({ID:r.uuid,Name:r.name,Version:r.version,Tables:r.num_tables??0,"File Size":r.file_size??0,Region:r.running_in_region??"(auto)",Created:r.created_at})}var as=p(()=>{h();f()});async function ms(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <database-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={name:o},m=a(n,"location");if(m)r.primary_location_hint=m;let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/d1/database`,r);e.output.success(`D1 database "${c.name}" created (ID: ${c.uuid}).`)}var ds=p(()=>{h();f()});async function cs(s,e){let{flags:n}=d(s),o=a(n,"database");if(!o)throw new i("--database <id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"name");if(m)r.name=m;if(Object.keys(r).length===0)throw new i("Provide at least one update flag (e.g. --name).");await e.client.patch(`/accounts/${encodeURIComponent(t)}/d1/database/${encodeURIComponent(o)}`,r),e.output.success(`D1 database "${o}" updated.`)}var ps=p(()=>{h();f()});async function us(s,e){let{flags:n}=d(s),o=a(n,"database");if(!o)throw new i("--database <id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete D1 database "${o}"? This will permanently destroy all data.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/d1/database/${encodeURIComponent(o)}`),e.output.success(`D1 database "${o}" deleted.`)}var fs=p(()=>{h();f();U()});async function ls(s,e){let{flags:n,positional:o}=d(s),t=a(n,"database");if(!t)throw new i("--database <name-or-id> is required.");let r=o[0]??a(n,"sql");if(!r)throw new i("SQL query is required as a positional argument or --sql flag.");let m=await u(a(n,"accountId"),e.client,e.config),c={sql:r},l=a(n,"params");if(l)try{c.params=JSON.parse(l)}catch{throw new i("--params must be a valid JSON array.")}let w=await e.client.post(`/accounts/${encodeURIComponent(m)}/d1/database/${encodeURIComponent(t)}/query`,c),$=a(n,"output")??e.flags.output;for(let k of w){if(!k.results||k.results.length===0){e.output.info(`Query OK. ${k.meta?.changes??0} changes, ${k.meta?.duration??0}ms.`);continue}if($==="json"){e.output.json(k.results);continue}if($==="csv"){let j=Object.keys(k.results[0]??{}).map((B)=>({key:B,header:B}));e.output.csv(k.results,j);continue}let I=Object.keys(k.results[0]??{}).map((P)=>({key:P,header:P,width:30}));e.output.table(k.results,I),e.output.info(`${k.results.length} row(s), ${k.meta?.duration??0}ms, ${k.meta?.rows_read??0} read, ${k.meta?.rows_written??0} written.`)}}var ws=p(()=>{h();f()});async function hs(s,e){let{flags:n}=d(s),o=a(n,"database");if(!o)throw new i("--database <id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={output_format:"file"},m=n.schema===!1,c=n.data===!1;if(m)r.no_schema=!0;if(c)r.no_data=!0;let l=await e.client.post(`/accounts/${encodeURIComponent(t)}/d1/database/${encodeURIComponent(o)}/export`,r),w=a(n,"outputFile");if(l.signed_url)if(w){let $=await fetch(l.signed_url);if(!$.ok)throw Error(`Failed to download export: HTTP ${$.status} ${$.statusText}`);let k=await $.text();await Bun.write(w,k),e.output.success(`Database exported to "${w}".`)}else{let $=await fetch(l.signed_url);if(!$.ok)throw Error(`Failed to download export: HTTP ${$.status} ${$.statusText}`);let k=await $.text();e.output.raw(k)}else e.output.success(`Export initiated. Filename: ${l.filename}`)}var ys=p(()=>{h();f()});async function Cs(s,e){let{flags:n}=d(s),o=a(n,"database");if(!o)throw new i("--database <id> is required.");let t=a(n,"file");if(!t)throw new i("--file <sql-file> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}await e.client.post(`/accounts/${encodeURIComponent(r)}/d1/database/${encodeURIComponent(o)}/query`,{sql:m}),e.output.success(`SQL imported into database "${o}" from "${t}".`)}var gs=p(()=>{h();f()});var ks={};z(ks,{run:()=>CL});async function CL(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return rs(o,e);case"get":case"show":return ss(o,e);case"create":case"new":return ms(o,e);case"update":return cs(o,e);case"delete":case"rm":case"remove":return us(o,e);case"query":case"sql":return ls(o,e);case"export":return hs(o,e);case"import":return Cs(o,e);case void 0:case"--help":case"-h":e.output.raw($s);return;default:throw new i(`Unknown d1 command: "${n}"
|
|
311
|
+
|
|
312
|
+
${$s}`)}}var $s=`Usage: cf d1 <command>
|
|
313
|
+
|
|
314
|
+
Commands:
|
|
315
|
+
list List D1 databases
|
|
316
|
+
get Get D1 database details
|
|
317
|
+
create Create a D1 database
|
|
318
|
+
update Update a D1 database
|
|
319
|
+
delete Delete a D1 database
|
|
320
|
+
query Execute a SQL query against a D1 database
|
|
321
|
+
export Export a D1 database
|
|
322
|
+
import Import SQL into a D1 database
|
|
323
|
+
|
|
324
|
+
Run 'cf d1 <command> --help' for more information.`;var Us=p(()=>{f();is();as();ds();ps();fs();ws();ys();gs()});async function _s(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/pages/projects`),r=[{key:"name",header:"Name",width:30},{key:"subdomain",header:"Subdomain",width:40},{key:"production_branch",header:"Branch",width:20},{key:"created_on",header:"Created",width:25}];e.output.table(t,r)}var zs=p(()=>{h()});async function Rs(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/pages/projects/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Subdomain:r.subdomain,Domains:r.domains.join(", ")||"(none)","Production Branch":r.production_branch,Created:r.created_on,"Latest Deployment":r.latest_deployment?.id??"(none)","Latest URL":r.latest_deployment?.url??"(none)"})}var bs=p(()=>{h();f()});async function Ps(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <project-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={name:o},m=a(n,"productionBranch");if(m)r.production_branch=m;let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/pages/projects`,r);e.output.success(`Pages project "${c.name}" created (subdomain: ${c.subdomain}).`)}var Is=p(()=>{h();f()});async function vs(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"productionBranch");if(m)r.production_branch=m;if(Object.keys(r).length===0)throw new i("Provide at least one update flag (e.g. --production-branch).");await e.client.patch(`/accounts/${encodeURIComponent(t)}/pages/projects/${encodeURIComponent(o)}`,r),e.output.success(`Pages project "${o}" updated.`)}var Ds=p(()=>{h();f()});async function Ss(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Pages project "${o}"? This will delete all deployments and custom domains.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/pages/projects/${encodeURIComponent(o)}`),e.output.success(`Pages project "${o}" deleted.`)}var qs=p(()=>{h();f();U()});async function As(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"env");if(m)r.env=m;let c=await e.client.get(`/accounts/${encodeURIComponent(t)}/pages/projects/${encodeURIComponent(o)}/deployments`,r),l=[{key:"id",header:"ID",width:36},{key:"environment",header:"Env",width:12},{key:"url",header:"URL",width:50},{key:"latest_stage.status",header:"Status",width:12},{key:"created_on",header:"Created",width:25}];e.output.table(c,l)}var Ls=p(()=>{h();f()});async function Ns(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"id");if(!t)throw new i("--id <deployment-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.get(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/deployments/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,"Short ID":m.short_id,Project:m.project_name,Environment:m.environment,URL:m.url,Status:m.latest_stage.status,Stage:m.latest_stage.name,Branch:m.deployment_trigger?.metadata?.branch??"(unknown)",Commit:m.deployment_trigger?.metadata?.commit_hash??"(unknown)",Message:m.deployment_trigger?.metadata?.commit_message??"(unknown)",Created:m.created_on})}var Es=p(()=>{h();f()});async function Gs(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"id");if(!t)throw new i("--id <deployment-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete deployment "${t}" from project "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/deployments/${encodeURIComponent(t)}`),e.output.success(`Deployment "${t}" deleted from project "${o}".`)}var Ms=p(()=>{h();f();U()});async function Ts(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"id");if(!t)throw new i("--id <deployment-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.post(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/deployments/${encodeURIComponent(t)}/retry`);e.output.success(`Deployment "${t}" retry initiated (new ID: ${m.id}).`)}var Zs=p(()=>{h();f()});async function Os(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"id");if(!t)throw new i("--id <deployment-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.post(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/deployments/${encodeURIComponent(t)}/rollback`);e.output.success(`Rolled back project "${o}" to deployment "${t}" (new deployment: ${m.id}).`)}var js=p(()=>{h();f()});async function Bs(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return As(o,e);case"get":case"show":return Ns(o,e);case"delete":case"rm":case"remove":return Gs(o,e);case"retry":return Ts(o,e);case"rollback":return Os(o,e);case void 0:case"--help":case"-h":e.output.raw(Js);return;default:throw new i(`Unknown pages deployments command: "${n}"
|
|
325
|
+
|
|
326
|
+
${Js}`)}}var Js=`Usage: cf pages deployments <command>
|
|
327
|
+
|
|
328
|
+
Commands:
|
|
329
|
+
list List deployments for a Pages project
|
|
330
|
+
get Get deployment details
|
|
331
|
+
delete Delete a deployment
|
|
332
|
+
retry Retry a deployment
|
|
333
|
+
rollback Rollback to a deployment
|
|
334
|
+
|
|
335
|
+
Run 'cf pages deployments <command> --help' for more information.`;var Hs=p(()=>{f();Ls();Es();Ms();Zs();js()});async function Vs(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/pages/projects/${encodeURIComponent(o)}/domains`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Domain",width:40},{key:"status",header:"Status",width:15},{key:"created_on",header:"Created",width:25}];e.output.table(r,m)}var Ws=p(()=>{h();f()});async function Ks(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"domain");if(!t)throw new i("--domain <domain> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.post(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/domains`,{name:t});e.output.success(`Domain "${m.name}" added to project "${o}" (status: ${m.status}).`)}var Qs=p(()=>{h();f()});async function Ys(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"domain");if(!t)throw new i("--domain <domain> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.get(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/domains/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Domain:m.name,Status:m.status,Verification:m.verification_data?.status??"(none)",SSL:m.ssl?.status??"(none)",Created:m.created_on})}var Xs=p(()=>{h();f()});async function Fs(s,e){let{flags:n}=d(s),o=a(n,"project");if(!o)throw new i("--project <name> is required.");let t=a(n,"domain");if(!t)throw new i("--domain <domain> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Remove domain "${t}" from project "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/pages/projects/${encodeURIComponent(o)}/domains/${encodeURIComponent(t)}`),e.output.success(`Domain "${t}" removed from project "${o}".`)}var xs=p(()=>{h();f();U()});async function oa(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Vs(o,e);case"add":case"create":return Ks(o,e);case"get":case"show":return Ys(o,e);case"delete":case"rm":case"remove":return Fs(o,e);case void 0:case"--help":case"-h":e.output.raw(ea);return;default:throw new i(`Unknown pages domains command: "${n}"
|
|
336
|
+
|
|
337
|
+
${ea}`)}}var ea=`Usage: cf pages domains <command>
|
|
338
|
+
|
|
339
|
+
Commands:
|
|
340
|
+
list List custom domains for a Pages project
|
|
341
|
+
add Add a custom domain to a Pages project
|
|
342
|
+
get Get custom domain details
|
|
343
|
+
delete Remove a custom domain from a Pages project
|
|
344
|
+
|
|
345
|
+
Run 'cf pages domains <command> --help' for more information.`;var na=p(()=>{f();Ws();Qs();Xs();xs()});var ra={};z(ra,{run:()=>NL});async function NL(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _s(o,e);case"get":case"show":return Rs(o,e);case"create":case"new":return Ps(o,e);case"update":return vs(o,e);case"delete":case"rm":case"remove":return Ss(o,e);case"deployments":case"deployment":case"deploys":return Bs(o,e);case"domains":case"domain":return oa(o,e);case void 0:case"--help":case"-h":e.output.raw(ta);return;default:throw new i(`Unknown pages command: "${n}"
|
|
346
|
+
|
|
347
|
+
${ta}`)}}var ta=`Usage: cf pages <command>
|
|
348
|
+
|
|
349
|
+
Commands:
|
|
350
|
+
list List Pages projects
|
|
351
|
+
get Get Pages project details
|
|
352
|
+
create Create a Pages project
|
|
353
|
+
update Update a Pages project
|
|
354
|
+
delete Delete a Pages project
|
|
355
|
+
deployments Manage project deployments
|
|
356
|
+
domains Manage project custom domains
|
|
357
|
+
|
|
358
|
+
Run 'cf pages <command> --help' for more information.`;var ia=p(()=>{f();zs();bs();Is();Ds();qs();Hs();na()});async function sa(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/queues`),r=[{key:"queue_id",header:"ID",width:36},{key:"queue_name",header:"Name",width:30},{key:"producers_total_count",header:"Producers"},{key:"consumers_total_count",header:"Consumers"},{key:"created_on",header:"Created"}];e.output.table(t,r)}var aa=p(()=>{h()});async function ma(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <name-or-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/queues/${encodeURIComponent(o)}`);e.output.detail({ID:r.queue_id,Name:r.queue_name,Producers:r.producers_total_count,Consumers:r.consumers_total_count,Created:r.created_on,Modified:r.modified_on})}var da=p(()=>{h();f()});async function ca(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <queue-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${encodeURIComponent(t)}/queues`,{queue_name:o});e.output.success(`Queue "${r.queue_name}" created (ID: ${r.queue_id}).`)}var pa=p(()=>{h();f()});async function ua(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=a(n,"name");if(!t)throw new i("--name <new-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.put(`/accounts/${encodeURIComponent(r)}/queues/${encodeURIComponent(o)}`,{queue_name:t});e.output.success(`Queue "${m.queue_name}" updated.`)}var fa=p(()=>{h();f()});async function la(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete queue "${o}"? This will permanently remove the queue and all its messages.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/queues/${encodeURIComponent(o)}`),e.output.success(`Queue "${o}" deleted.`)}var wa=p(()=>{h();f();U()});async function ha(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Purge all messages from queue "${o}"? This cannot be undone.`,e.flags)){e.output.info("Aborted.");return}await e.client.post(`/accounts/${encodeURIComponent(t)}/queues/${encodeURIComponent(o)}/purge`),e.output.success(`Queue "${o}" purged.`)}var ya=p(()=>{h();f();U()});async function Ca(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/queues/${encodeURIComponent(o)}/consumers`),m=[{key:"service",header:"Script",width:30},{key:"queue_name",header:"Queue",width:30},{key:"dead_letter_queue",header:"Dead Letter Queue",width:20},{key:"created_on",header:"Created"}];e.output.table(r,m)}var ga=p(()=>{h();f()});async function $a(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=a(n,"script");if(!t)throw new i("--script <worker-name> is required.");let r=R(n,"batchSize"),m=R(n,"maxRetries"),c=a(n,"deadLetter"),l=await u(a(n,"accountId"),e.client,e.config),w={script_name:t,type:"worker"},$={};if(r!==void 0)$.batch_size=r;if(m!==void 0)$.max_retries=m;if(Object.keys($).length>0)w.settings=$;if(c)w.dead_letter_queue=c;let k=await e.client.post(`/accounts/${encodeURIComponent(l)}/queues/${encodeURIComponent(o)}/consumers`,w);e.output.success(`Consumer "${k.service}" added to queue "${o}".`)}var ka=p(()=>{h();f()});async function Ua(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=a(n,"consumer");if(!t)throw new i("--consumer <consumer-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete consumer "${t}" from queue "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/queues/${encodeURIComponent(o)}/consumers/${encodeURIComponent(t)}`),e.output.success(`Consumer "${t}" removed from queue "${o}".`)}var _a=p(()=>{h();f();U()});async function Ra(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ca(o,e);case"add":case"create":return $a(o,e);case"delete":case"rm":case"remove":return Ua(o,e);case void 0:case"--help":case"-h":e.output.raw(za);return;default:throw new i(`Unknown queues consumers command: "${n}"
|
|
359
|
+
|
|
360
|
+
${za}`)}}var za=`Usage: cf queues consumers <command>
|
|
361
|
+
|
|
362
|
+
Commands:
|
|
363
|
+
list List consumers for a queue
|
|
364
|
+
add Add a consumer to a queue
|
|
365
|
+
delete Remove a consumer from a queue
|
|
366
|
+
|
|
367
|
+
Run 'cf queues consumers <command> --help' for more information.`;var ba=p(()=>{f();ga();ka();_a()});async function ve(s,e){let{flags:n}=d(s),o=a(n,"queue");if(!o)throw new i("--queue <queue-id> is required.");let t=a(n,"body");if(!t)throw new i("--body <text> is required.");let r=R(n,"delay"),m=await u(a(n,"accountId"),e.client,e.config),c={body:t};if(r!==void 0)c.delay_seconds=r;let l=await e.client.post(`/accounts/${encodeURIComponent(m)}/queues/${encodeURIComponent(o)}/messages`,c);e.output.success(`Message sent to queue "${o}" (ID: ${l.message_id}).`)}var Pa=p(()=>{h();f()});var va={};z(va,{run:()=>WL});async function WL(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return sa(o,e);case"get":case"show":return ma(o,e);case"create":case"new":return ca(o,e);case"update":return ua(o,e);case"delete":case"rm":case"remove":return la(o,e);case"purge":return ha(o,e);case"consumers":case"consumer":return Ra(o,e);case"messages":case"message":case"send":{if(n==="send")return ve(o,e);let[t,...r]=o;if(t==="send")return ve(r,e);throw new i(`Unknown queues messages command: "${t??""}"
|
|
368
|
+
|
|
369
|
+
Usage: cf queues messages send --queue <id> --body <text>`)}case void 0:case"--help":case"-h":e.output.raw(Ia);return;default:throw new i(`Unknown queues command: "${n}"
|
|
370
|
+
|
|
371
|
+
${Ia}`)}}var Ia=`Usage: cf queues <command>
|
|
372
|
+
|
|
373
|
+
Commands:
|
|
374
|
+
list List all queues
|
|
375
|
+
get Get queue details
|
|
376
|
+
create Create a queue
|
|
377
|
+
update Update a queue
|
|
378
|
+
delete Delete a queue
|
|
379
|
+
purge Purge all messages from a queue
|
|
380
|
+
consumers Manage queue consumers (list, add, delete)
|
|
381
|
+
messages Send messages to a queue
|
|
382
|
+
|
|
383
|
+
Run 'cf queues <command> --help' for more information.`;var Da=p(()=>{f();aa();da();pa();fa();wa();ya();ba();Pa()});async function Sa(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/hyperdrive/configs`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"origin.host",header:"Host",width:30},{key:"origin.database",header:"Database",width:20}];e.output.table(t,r)}var qa=p(()=>{h()});async function Aa(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <hyperdrive-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/hyperdrive/configs/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Host:r.origin.host,Port:r.origin.port,Database:r.origin.database,Scheme:r.origin.scheme,User:r.origin.user??"(not set)","Caching Disabled":r.caching?.disabled??!1,Created:r.created_on??"(unknown)",Modified:r.modified_on??"(unknown)"})}var La=p(()=>{h();f()});async function Na(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <config-name> is required.");let t=a(n,"connectionString");if(!t)throw new i("--connection-string <conn> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=YL(t),c=await e.client.post(`/accounts/${encodeURIComponent(r)}/hyperdrive/configs`,{name:o,origin:m});e.output.success(`Hyperdrive "${c.name}" created (ID: ${c.id}).`)}function YL(s){try{let e=new URL(s);return{host:e.hostname,port:parseInt(e.port,10)||5432,database:e.pathname.replace(/^\//,""),scheme:e.protocol.replace(/:$/,""),user:e.username||void 0,password:e.password||void 0}}catch{throw new i("Invalid connection string. Expected format: postgres://user:password@host:port/database")}}var Ea=p(()=>{h();f()});async function Ga(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <hyperdrive-id> is required.");let t=a(n,"name"),r=a(n,"connectionString");if(!t&&!r)throw new i("At least one of --name or --connection-string is required.");let m=await u(a(n,"accountId"),e.client,e.config),c={};if(t)c.name=t;if(r)c.origin=FL(r);let l=await e.client.patch(`/accounts/${encodeURIComponent(m)}/hyperdrive/configs/${encodeURIComponent(o)}`,c);e.output.success(`Hyperdrive "${l.name}" updated.`)}function FL(s){try{let e=new URL(s);return{host:e.hostname,port:parseInt(e.port,10)||5432,database:e.pathname.replace(/^\//,""),scheme:e.protocol.replace(/:$/,""),user:e.username||void 0,password:e.password||void 0}}catch{throw new i("Invalid connection string. Expected format: postgres://user:password@host:port/database")}}var Ma=p(()=>{h();f()});async function Ta(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <hyperdrive-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Hyperdrive configuration "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/hyperdrive/configs/${encodeURIComponent(o)}`),e.output.success(`Hyperdrive "${o}" deleted.`)}var Za=p(()=>{h();f();U()});var ja={};z(ja,{run:()=>oN});async function oN(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Sa(o,e);case"get":case"show":return Aa(o,e);case"create":case"new":return Na(o,e);case"update":return Ga(o,e);case"delete":case"rm":case"remove":return Ta(o,e);case void 0:case"--help":case"-h":e.output.raw(Oa);return;default:throw new i(`Unknown hyperdrive command: "${n}"
|
|
384
|
+
|
|
385
|
+
${Oa}`)}}var Oa=`Usage: cf hyperdrive <command>
|
|
386
|
+
|
|
387
|
+
Commands:
|
|
388
|
+
list List Hyperdrive configurations
|
|
389
|
+
get Get Hyperdrive configuration details
|
|
390
|
+
create Create a Hyperdrive configuration
|
|
391
|
+
update Update a Hyperdrive configuration
|
|
392
|
+
delete Delete a Hyperdrive configuration
|
|
393
|
+
|
|
394
|
+
Run 'cf hyperdrive <command> --help' for more information.`;var Ja=p(()=>{f();qa();La();Ea();Ma();Za()});async function Ba(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/pipelines`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"endpoint",header:"Endpoint",width:40},{key:"created_on",header:"Created"}];e.output.table(t,r)}var Ha=p(()=>{h()});async function Va(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pipeline-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/pipelines/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Endpoint:r.endpoint,Created:r.created_on??"(unknown)",Modified:r.modified_on??"(unknown)"})}var Wa=p(()=>{h();f()});async function Ka(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <pipeline-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <config-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m,c;try{c=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}try{m=JSON.parse(c)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l={name:o,...m},w=await e.client.post(`/accounts/${encodeURIComponent(r)}/pipelines`,l);e.output.success(`Pipeline "${w.name}" created (ID: ${w.id}).`)}var Qa=p(()=>{h();f()});async function Ya(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pipeline-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete pipeline "${o}"? This cannot be undone.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/pipelines/${encodeURIComponent(o)}`),e.output.success(`Pipeline "${o}" deleted.`)}var Xa=p(()=>{h();f();U()});var xa={};z(xa,{run:()=>sN});async function sN(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ba(o,e);case"get":case"show":return Va(o,e);case"create":case"new":return Ka(o,e);case"delete":case"rm":case"remove":return Ya(o,e);case void 0:case"--help":case"-h":e.output.raw(Fa);return;default:throw new i(`Unknown pipelines command: "${n}"
|
|
395
|
+
|
|
396
|
+
${Fa}`)}}var Fa=`Usage: cf pipelines <command>
|
|
397
|
+
|
|
398
|
+
Commands:
|
|
399
|
+
list List pipelines
|
|
400
|
+
get Get pipeline details
|
|
401
|
+
create Create a pipeline from a config file
|
|
402
|
+
delete Delete a pipeline
|
|
403
|
+
|
|
404
|
+
Run 'cf pipelines <command> --help' for more information.`;var em=p(()=>{f();Ha();Wa();Qa();Xa()});async function om(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/secrets_store/stores`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:12},{key:"created_on",header:"Created"}];e.output.table(t,r)}var nm=p(()=>{h()});async function tm(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <store-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/secrets_store/stores/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Status:r.status??"(unknown)",Created:r.created_on??"(unknown)",Modified:r.modified_on??"(unknown)"})}var rm=p(()=>{h();f()});async function sm(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return om(o,e);case"get":case"show":return tm(o,e);case void 0:case"--help":case"-h":e.output.raw(im);return;default:throw new i(`Unknown secrets-store stores command: "${n}"
|
|
405
|
+
|
|
406
|
+
${im}`)}}var im=`Usage: cf secrets-store stores <command>
|
|
407
|
+
|
|
408
|
+
Commands:
|
|
409
|
+
list List secrets stores
|
|
410
|
+
get Get secrets store details
|
|
411
|
+
|
|
412
|
+
Run 'cf secrets-store stores <command> --help' for more information.`;var am=p(()=>{f();nm();rm()});async function mm(s,e){let{flags:n}=d(s),o=a(n,"store");if(!o)throw new i("--store <store-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/secrets_store/stores/${encodeURIComponent(o)}/secrets`),m=[{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:12},{key:"comment",header:"Comment",width:30},{key:"created_on",header:"Created"}];e.output.table(r,m)}var dm=p(()=>{h();f()});async function cm(s,e){let{flags:n}=d(s),o=a(n,"store");if(!o)throw new i("--store <store-id> is required.");let t=a(n,"name");if(!t)throw new i("--name <secret-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.get(`/accounts/${encodeURIComponent(r)}/secrets_store/stores/${encodeURIComponent(o)}/secrets/${encodeURIComponent(t)}`);e.output.detail({Name:m.name,Value:m.value??"(hidden)",Comment:m.comment??"(none)",Status:m.status??"(unknown)",Created:m.created_on??"(unknown)",Modified:m.modified_on??"(unknown)"})}var pm=p(()=>{h();f()});async function um(s,e){let{flags:n}=d(s),o=a(n,"store");if(!o)throw new i("--store <store-id> is required.");let t=a(n,"name");if(!t)throw new i("--name <secret-name> is required.");let r=a(n,"value");if(!r)throw new i("--value <secret-value> is required.");let m=a(n,"comment"),c=await u(a(n,"accountId"),e.client,e.config),l={name:t,value:r};if(m)l.comment=m;await e.client.put(`/accounts/${encodeURIComponent(c)}/secrets_store/stores/${encodeURIComponent(o)}/secrets/${encodeURIComponent(t)}`,l),e.output.success(`Secret "${t}" written to store "${o}".`)}var fm=p(()=>{h();f()});async function lm(s,e){let{flags:n}=d(s),o=a(n,"store");if(!o)throw new i("--store <store-id> is required.");let t=a(n,"name");if(!t)throw new i("--name <secret-name> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete secret "${t}" from store "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/secrets_store/stores/${encodeURIComponent(o)}/secrets/${encodeURIComponent(t)}`),e.output.success(`Secret "${t}" deleted from store "${o}".`)}var wm=p(()=>{h();f();U()});async function ym(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return mm(o,e);case"get":case"show":return cm(o,e);case"put":case"set":case"write":return um(o,e);case"delete":case"rm":case"remove":return lm(o,e);case void 0:case"--help":case"-h":e.output.raw(hm);return;default:throw new i(`Unknown secrets-store secrets command: "${n}"
|
|
413
|
+
|
|
414
|
+
${hm}`)}}var hm=`Usage: cf secrets-store secrets <command>
|
|
415
|
+
|
|
416
|
+
Commands:
|
|
417
|
+
list List secrets in a store
|
|
418
|
+
get Get a secret value
|
|
419
|
+
put Create or update a secret
|
|
420
|
+
delete Delete a secret
|
|
421
|
+
|
|
422
|
+
Run 'cf secrets-store secrets <command> --help' for more information.`;var Cm=p(()=>{f();dm();pm();fm();wm()});var $m={};z($m,{run:()=>wN});async function wN(s,e){let[n,...o]=s;switch(n){case"stores":case"store":return sm(o,e);case"secrets":case"secret":return ym(o,e);case void 0:case"--help":case"-h":e.output.raw(gm);return;default:throw new i(`Unknown secrets-store command: "${n}"
|
|
423
|
+
|
|
424
|
+
${gm}`)}}var gm=`Usage: cf secrets-store <command>
|
|
425
|
+
|
|
426
|
+
Commands:
|
|
427
|
+
stores Manage secrets stores (list, get)
|
|
428
|
+
secrets Manage secrets within a store (list, get, put, delete)
|
|
429
|
+
|
|
430
|
+
Run 'cf secrets-store <command> --help' for more information.`;var km=p(()=>{f();am();Cm()});async function q(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"accountId");if(o&&t)throw new i("Specify either --zone or --account-id, not both.");if(!o&&!t)throw new i("--zone <zone> or --account-id <id> is required.");let r;if(o){let m=await y(o,e.client);r=`/zones/${encodeURIComponent(m)}/rulesets`}else r=`/accounts/${encodeURIComponent(t)}/rulesets`;return{basePath:r,flags:n}}var G=p(()=>{g();f()});async function Um(s,e){let{basePath:n}=await q(s,e),o=await e.client.get(n),t=[{key:"id",header:"ID",width:34},{key:"name",header:"Name",width:30},{key:"kind",header:"Kind",width:12},{key:"phase",header:"Phase",width:30},{key:"version",header:"Version",width:8},{key:"last_updated",header:"Updated",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var _m=p(()=>{G()});async function zm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"id");if(!t)throw new i("--id <ruleset-id> is required.");let r=await e.client.get(`${n}/${encodeURIComponent(t)}`);if(e.output.detail({ID:r.id,Name:r.name,Description:r.description??"",Kind:r.kind,Phase:r.phase??"",Version:r.version??"","Last Updated":r.last_updated??"",Rules:r.rules?.length??0}),r.rules&&r.rules.length>0)e.output.json(r.rules)}var Rm=p(()=>{G();f()});async function bm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"file");if(!t)throw new i("--file <ruleset-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(n,m);e.output.success(`Ruleset created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Kind:c.kind,Phase:c.phase??""})}var Pm=p(()=>{G();f()});async function Im(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"id");if(!t)throw new i("--id <ruleset-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <ruleset-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/${encodeURIComponent(t)}`,c);e.output.success(`Ruleset ${t} updated.`),e.output.detail({ID:l.id,Name:l.name,Kind:l.kind,Phase:l.phase??""})}var vm=p(()=>{G();f()});async function Dm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"id");if(!t)throw new i("--id <ruleset-id> is required.");if(!await C(`Delete ruleset ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/${encodeURIComponent(t)}`),e.output.success(`Ruleset ${t} deleted.`)}var Sm=p(()=>{G();f();U()});async function qm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset");if(!t)throw new i("--ruleset <ruleset-id> is required.");let m=(await e.client.get(`${n}/${encodeURIComponent(t)}`)).rules??[],c=[{key:"id",header:"ID",width:34},{key:"action",header:"Action",width:14},{key:"expression",header:"Expression",width:40},{key:"description",header:"Description",width:24},{key:"enabled",header:"Enabled",width:8,transform:(l)=>l===!1?"No":"Yes"}];e.output.table(m,c)}var Am=p(()=>{f();G()});async function Lm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset"),r=a(o,"file");if(!t)throw new i("--ruleset <ruleset-id> is required.");if(!r)throw new i("--file <rule-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let w=(await e.client.post(`${n}/${encodeURIComponent(t)}/rules`,c)).rules?.length??0;e.output.success(`Rule added to ruleset ${t}. Total rules: ${w}`)}var Nm=p(()=>{f();G()});async function Em(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset"),r=a(o,"rule"),m=a(o,"file");if(!t)throw new i("--ruleset <ruleset-id> is required.");if(!r)throw new i("--rule <rule-id> is required.");if(!m)throw new i("--file <rule-json> is required.");let c;try{c=await Bun.file(m).text()}catch{throw new i(`Cannot read file: "${m}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.patch(`${n}/${encodeURIComponent(t)}/rules/${encodeURIComponent(r)}`,l);e.output.success(`Rule ${r} updated in ruleset ${t}. Total rules: ${w.rules?.length??0}`)}var Gm=p(()=>{f();G()});async function Mm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset"),r=a(o,"rule");if(!t)throw new i("--ruleset <ruleset-id> is required.");if(!r)throw new i("--rule <rule-id> is required.");if(!await C(`Delete rule ${r} from ruleset ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/${encodeURIComponent(t)}/rules/${encodeURIComponent(r)}`),e.output.success(`Rule ${r} deleted from ruleset ${t}.`)}var Tm=p(()=>{f();U();G()});async function Om(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return qm(o,e);case"create":case"add":return Lm(o,e);case"update":case"set":return Em(o,e);case"delete":case"rm":case"remove":return Mm(o,e);case void 0:case"--help":case"-h":e.output.raw(Zm);return;default:throw new i(`Unknown rulesets rules command: "${n}"
|
|
431
|
+
|
|
432
|
+
${Zm}`)}}var Zm=`Usage: cf rulesets rules <command>
|
|
433
|
+
|
|
434
|
+
Commands:
|
|
435
|
+
list List rules in a ruleset
|
|
436
|
+
create Add a rule to a ruleset
|
|
437
|
+
update Update a rule in a ruleset
|
|
438
|
+
delete Delete a rule from a ruleset
|
|
439
|
+
|
|
440
|
+
Run 'cf rulesets rules <command> --help' for more information.`;var jm=p(()=>{f();Am();Nm();Gm();Tm()});async function Jm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset");if(!t)throw new i("--ruleset <ruleset-id> is required.");let r=await e.client.get(`${n}/${encodeURIComponent(t)}/versions`),m=[{key:"id",header:"ID",width:34},{key:"version",header:"Version",width:10},{key:"name",header:"Name",width:30},{key:"last_updated",header:"Updated",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var Bm=p(()=>{f();G()});async function Hm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"ruleset"),r=a(o,"version");if(!t)throw new i("--ruleset <ruleset-id> is required.");if(!r)throw new i("--version <version-number> is required.");let m=await e.client.get(`${n}/${encodeURIComponent(t)}/versions/${encodeURIComponent(r)}`);if(e.output.detail({ID:m.id,Name:m.name,Version:m.version??"",Kind:m.kind,Phase:m.phase??"","Last Updated":m.last_updated??"",Rules:m.rules?.length??0}),m.rules&&m.rules.length>0)e.output.json(m.rules)}var Vm=p(()=>{f();G()});async function Km(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Jm(o,e);case"get":case"show":return Hm(o,e);case void 0:case"--help":case"-h":e.output.raw(Wm);return;default:throw new i(`Unknown rulesets versions command: "${n}"
|
|
441
|
+
|
|
442
|
+
${Wm}`)}}var Wm=`Usage: cf rulesets versions <command>
|
|
443
|
+
|
|
444
|
+
Commands:
|
|
445
|
+
list List versions of a ruleset
|
|
446
|
+
get Get a specific version of a ruleset
|
|
447
|
+
|
|
448
|
+
Run 'cf rulesets versions <command> --help' for more information.`;var Qm=p(()=>{f();Bm();Vm()});async function Ym(s,e){let{basePath:n,flags:o}=await q(s,e),r=(await e.client.get(n)).filter((c)=>c.phase),m=[{key:"id",header:"ID",width:34},{key:"phase",header:"Phase",width:40},{key:"name",header:"Name",width:24},{key:"kind",header:"Kind",width:12},{key:"version",header:"Version",width:8}];e.output.table(r,m)}var Xm=p(()=>{G()});async function Fm(s,e){let{basePath:n,flags:o}=await q(s,e),t=a(o,"phase");if(!t)throw new i("--phase <phase-name> is required.");let r=await e.client.get(`${n}/phases/${encodeURIComponent(t)}/entrypoint`);if(e.output.detail({ID:r.id,Name:r.name,Phase:r.phase??t,Kind:r.kind,Version:r.version??"","Last Updated":r.last_updated??"",Rules:r.rules?.length??0}),r.rules&&r.rules.length>0)e.output.json(r.rules)}var xm=p(()=>{f();G()});async function od(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ym(o,e);case"get":case"show":return Fm(o,e);case void 0:case"--help":case"-h":e.output.raw(ed);return;default:throw new i(`Unknown rulesets phases command: "${n}"
|
|
449
|
+
|
|
450
|
+
${ed}`)}}var ed=`Usage: cf rulesets phases <command>
|
|
451
|
+
|
|
452
|
+
Commands:
|
|
453
|
+
list List active phases for a zone or account
|
|
454
|
+
get Get the entrypoint ruleset for a phase
|
|
455
|
+
|
|
456
|
+
Run 'cf rulesets phases <command> --help' for more information.`;var nd=p(()=>{f();Xm();xm()});var rd={};z(rd,{run:()=>qN});async function qN(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Um(o,e);case"get":case"show":return zm(o,e);case"create":case"add":return bm(o,e);case"update":case"set":return Im(o,e);case"delete":case"rm":case"remove":return Dm(o,e);case"rules":case"rule":return Om(o,e);case"versions":case"version":return Km(o,e);case"phases":case"phase":return od(o,e);case void 0:case"--help":case"-h":e.output.raw(td);return;default:throw new i(`Unknown rulesets command: "${n}"
|
|
457
|
+
|
|
458
|
+
${td}`)}}var td=`Usage: cf rulesets <command>
|
|
459
|
+
|
|
460
|
+
Commands:
|
|
461
|
+
list List rulesets for a zone or account
|
|
462
|
+
get Get a specific ruleset
|
|
463
|
+
create Create a new ruleset
|
|
464
|
+
update Update a ruleset
|
|
465
|
+
delete Delete a ruleset
|
|
466
|
+
rules Manage rules within a ruleset
|
|
467
|
+
versions View ruleset versions
|
|
468
|
+
phases View phase entrypoints
|
|
469
|
+
|
|
470
|
+
Run 'cf rulesets <command> --help' for more information.`;var id=p(()=>{f();_m();Rm();Pm();vm();Sm();jm();Qm();nd()});async function sd(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/firewall/access_rules/rules`),m=[{key:"id",header:"ID",width:34},{key:"mode",header:"Mode",width:14},{key:"configuration",header:"Target",width:10,transform:(c)=>c.target},{key:"configuration",header:"Value",width:24,transform:(c)=>c.value},{key:"notes",header:"Notes",width:24},{key:"created_on",header:"Created",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var ad=p(()=>{g();f()});async function dd(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"ip"),r=a(n,"mode"),m=a(n,"notes");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--ip <ip-address-or-cidr> is required.");if(!r)throw new i("--mode <mode> is required.");if(!md.includes(r))throw new i(`Invalid mode "${r}". Valid modes: ${md.join(", ")}`);let c=await y(o,e.client),l={mode:r,configuration:{target:t.includes("/")||t.includes(":")?t.includes("/")?"ip_range":"ip6":"ip",value:t}};if(m)l.notes=m;let w=await e.client.post(`/zones/${encodeURIComponent(c)}/firewall/access_rules/rules`,l);e.output.success(`IP access rule created: ${w.id}`),e.output.detail({ID:w.id,Mode:w.mode,Target:w.configuration.target,Value:w.configuration.value,Notes:w.notes??""})}var md;var cd=p(()=>{g();f();md=["block","challenge","whitelist","js_challenge","managed_challenge"]});async function ud(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id"),r=a(n,"mode"),m=a(n,"notes");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <rule-id> is required.");if(!r)throw new i("--mode <mode> is required.");if(!pd.includes(r))throw new i(`Invalid mode "${r}". Valid modes: ${pd.join(", ")}`);let c=await y(o,e.client),l={mode:r};if(m)l.notes=m;let w=await e.client.patch(`/zones/${encodeURIComponent(c)}/firewall/access_rules/rules/${encodeURIComponent(t)}`,l);e.output.success(`IP access rule ${t} updated.`),e.output.detail({ID:w.id,Mode:w.mode,Target:w.configuration.target,Value:w.configuration.value})}var pd;var fd=p(()=>{g();f();pd=["block","challenge","whitelist","js_challenge","managed_challenge"]});async function ld(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <rule-id> is required.");let r=await y(o,e.client);if(!await C(`Delete IP access rule ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/firewall/access_rules/rules/${encodeURIComponent(t)}`),e.output.success(`IP access rule ${t} deleted.`)}var wd=p(()=>{g();f();U()});async function yd(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return sd(o,e);case"create":case"add":return dd(o,e);case"update":case"set":return ud(o,e);case"delete":case"rm":case"remove":return ld(o,e);case void 0:case"--help":case"-h":e.output.raw(hd);return;default:throw new i(`Unknown firewall ip-rules command: "${n}"
|
|
471
|
+
|
|
472
|
+
${hd}`)}}var hd=`Usage: cf firewall ip-rules <command>
|
|
473
|
+
|
|
474
|
+
Commands:
|
|
475
|
+
list List IP access rules
|
|
476
|
+
create Create an IP access rule
|
|
477
|
+
update Update an IP access rule
|
|
478
|
+
delete Delete an IP access rule
|
|
479
|
+
|
|
480
|
+
Run 'cf firewall ip-rules <command> --help' for more information.`;var Cd=p(()=>{f();ad();cd();fd();wd()});async function gd(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/firewall/ua_rules`),m=[{key:"id",header:"ID",width:34},{key:"mode",header:"Mode",width:14},{key:"configuration",header:"UA Pattern",width:40,transform:(c)=>c.value},{key:"description",header:"Description",width:24},{key:"paused",header:"Paused",width:8,transform:(c)=>c?"Yes":"No"}];e.output.table(r,m)}var $d=p(()=>{g();f()});async function Ud(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"ua"),r=a(n,"mode"),m=a(n,"description");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--ua <user-agent-pattern> is required.");if(!r)throw new i("--mode <mode> is required.");if(!kd.includes(r))throw new i(`Invalid mode "${r}". Valid modes: ${kd.join(", ")}`);let c=await y(o,e.client),l={mode:r,configuration:{target:"ua",value:t}};if(m)l.description=m;let w=await e.client.post(`/zones/${encodeURIComponent(c)}/firewall/ua_rules`,l);e.output.success(`UA rule created: ${w.id}`),e.output.detail({ID:w.id,Mode:w.mode,"UA Pattern":w.configuration.value,Description:w.description??""})}var kd;var _d=p(()=>{g();f();kd=["block","challenge","js_challenge","managed_challenge"]});async function zd(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <rule-id> is required.");let r=await y(o,e.client);if(!await C(`Delete UA rule ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/firewall/ua_rules/${encodeURIComponent(t)}`),e.output.success(`UA rule ${t} deleted.`)}var Rd=p(()=>{g();f();U()});async function Pd(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return gd(o,e);case"create":case"add":return Ud(o,e);case"delete":case"rm":case"remove":return zd(o,e);case void 0:case"--help":case"-h":e.output.raw(bd);return;default:throw new i(`Unknown firewall ua-rules command: "${n}"
|
|
481
|
+
|
|
482
|
+
${bd}`)}}var bd=`Usage: cf firewall ua-rules <command>
|
|
483
|
+
|
|
484
|
+
Commands:
|
|
485
|
+
list List User-Agent rules
|
|
486
|
+
create Create a User-Agent rule
|
|
487
|
+
delete Delete a User-Agent rule
|
|
488
|
+
|
|
489
|
+
Run 'cf firewall ua-rules <command> --help' for more information.`;var Id=p(()=>{f();$d();_d();Rd()});async function vd(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/firewall/lockdowns`),m=[{key:"id",header:"ID",width:34},{key:"urls",header:"URLs",width:30,transform:(c)=>c.join(", ")},{key:"configurations",header:"IPs",width:24,transform:(c)=>c.map((l)=>l.value).join(", ")},{key:"paused",header:"Paused",width:8,transform:(c)=>c?"Yes":"No"},{key:"created_on",header:"Created",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var Dd=p(()=>{g();f()});async function Sd(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"url"),r=D(n,"ips"),m=a(n,"description");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--url <url-pattern> is required.");if(!r||r.length===0)throw new i("--ips <ip1,ip2,...> is required.");let c=await y(o,e.client),l={urls:[t],configurations:r.map(($)=>({target:$.includes("/")||$.includes(":")?$.includes("/")?"ip_range":"ip6":"ip",value:$}))};if(m)l.description=m;let w=await e.client.post(`/zones/${encodeURIComponent(c)}/firewall/lockdowns`,l);e.output.success(`Zone lockdown created: ${w.id}`),e.output.detail({ID:w.id,URLs:w.urls.join(", "),IPs:w.configurations.map(($)=>$.value).join(", "),Description:w.description??""})}var qd=p(()=>{g();f()});async function Ad(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <lockdown-id> is required.");let r=await y(o,e.client);if(!await C(`Delete zone lockdown ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/firewall/lockdowns/${encodeURIComponent(t)}`),e.output.success(`Zone lockdown ${t} deleted.`)}var Ld=p(()=>{g();f();U()});async function Ed(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return vd(o,e);case"create":case"add":return Sd(o,e);case"delete":case"rm":case"remove":return Ad(o,e);case void 0:case"--help":case"-h":e.output.raw(Nd);return;default:throw new i(`Unknown firewall zone-lockdowns command: "${n}"
|
|
490
|
+
|
|
491
|
+
${Nd}`)}}var Nd=`Usage: cf firewall zone-lockdowns <command>
|
|
492
|
+
|
|
493
|
+
Commands:
|
|
494
|
+
list List zone lockdown rules
|
|
495
|
+
create Create a zone lockdown rule
|
|
496
|
+
delete Delete a zone lockdown rule
|
|
497
|
+
|
|
498
|
+
Run 'cf firewall zone-lockdowns <command> --help' for more information.`;var Gd=p(()=>{f();Dd();qd();Ld()});var Td={};z(Td,{run:()=>VN});async function VN(s,e){let[n,...o]=s;switch(n){case"ip-rules":case"ip-rule":case"access-rules":return yd(o,e);case"ua-rules":case"ua-rule":return Pd(o,e);case"zone-lockdowns":case"zone-lockdown":case"lockdowns":case"lockdown":return Ed(o,e);case void 0:case"--help":case"-h":e.output.raw(Md);return;default:throw new i(`Unknown firewall command: "${n}"
|
|
499
|
+
|
|
500
|
+
${Md}`)}}var Md=`Usage: cf firewall <command>
|
|
501
|
+
|
|
502
|
+
Commands:
|
|
503
|
+
ip-rules Manage IP access rules (block, challenge, whitelist)
|
|
504
|
+
ua-rules Manage User-Agent blocking rules
|
|
505
|
+
zone-lockdowns Manage zone lockdown rules
|
|
506
|
+
|
|
507
|
+
Run 'cf firewall <command> --help' for more information.`;var Zd=p(()=>{f();Cd();Id();Gd()});async function Od(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/page_shield`);e.output.detail({Enabled:r.enabled,"Updated At":r.updated_at??"","Use Cloudflare Reporting Endpoint":r.use_cloudflare_reporting_endpoint??!1,"Use Connection URL Path":r.use_connection_url_path??!1})}var jd=p(()=>{g();f()});async function Jd(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r={};if(n.enabled!==void 0)r.enabled=v(n,"enabled");if(n.useCloudflareReportingEndpoint!==void 0)r.use_cloudflare_reporting_endpoint=v(n,"useCloudflareReportingEndpoint");if(n.useConnectionUrlPath!==void 0)r.use_connection_url_path=v(n,"useConnectionUrlPath");if(Object.keys(r).length===0)throw new i("At least one setting flag is required (--enabled, --use-cloudflare-reporting-endpoint, --use-connection-url-path).");let m=await e.client.put(`/zones/${encodeURIComponent(t)}/page_shield`,r);e.output.success("Page Shield settings updated."),e.output.detail({Enabled:m.enabled,"Use Cloudflare Reporting Endpoint":m.use_cloudflare_reporting_endpoint??!1,"Use Connection URL Path":m.use_connection_url_path??!1})}var Bd=p(()=>{g();f()});async function Vd(s,e){let[n,...o]=s;switch(n){case"get":case"show":return Od(o,e);case"update":case"set":return Jd(o,e);case void 0:case"--help":case"-h":e.output.raw(Hd);return;default:throw new i(`Unknown page-shield settings command: "${n}"
|
|
508
|
+
|
|
509
|
+
${Hd}`)}}var Hd=`Usage: cf page-shield settings <command>
|
|
510
|
+
|
|
511
|
+
Commands:
|
|
512
|
+
get Get Page Shield settings
|
|
513
|
+
update Update Page Shield settings
|
|
514
|
+
|
|
515
|
+
Run 'cf page-shield settings <command> --help' for more information.`;var Wd=p(()=>{f();jd();Bd()});async function Kd(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/page_shield/scripts`),m=[{key:"id",header:"ID",width:34},{key:"url",header:"URL",width:50},{key:"host",header:"Host",width:24},{key:"domain_reported_malicious",header:"Malicious",width:10,transform:(c)=>c?"Yes":"No"},{key:"last_seen_at",header:"Last Seen",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var Qd=p(()=>{g();f()});async function Yd(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <script-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/page_shield/scripts/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,URL:m.url,Host:m.host??"",Hash:m.hash??"","JS Integrity Score":m.js_integrity_score??"","Domain Reported Malicious":m.domain_reported_malicious??!1,"Added At":m.added_at??"","First Seen At":m.first_seen_at??"","Last Seen At":m.last_seen_at??"","Page URLs":m.page_urls?.join(", ")??""})}var Xd=p(()=>{g();f()});async function xd(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Kd(o,e);case"get":case"show":return Yd(o,e);case void 0:case"--help":case"-h":e.output.raw(Fd);return;default:throw new i(`Unknown page-shield scripts command: "${n}"
|
|
516
|
+
|
|
517
|
+
${Fd}`)}}var Fd=`Usage: cf page-shield scripts <command>
|
|
518
|
+
|
|
519
|
+
Commands:
|
|
520
|
+
list List Page Shield scripts
|
|
521
|
+
get Get details for a specific script
|
|
522
|
+
|
|
523
|
+
Run 'cf page-shield scripts <command> --help' for more information.`;var ec=p(()=>{f();Qd();Xd()});async function oc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/page_shield/connections`),m=[{key:"id",header:"ID",width:34},{key:"url",header:"URL",width:50},{key:"host",header:"Host",width:24},{key:"domain_reported_malicious",header:"Malicious",width:10,transform:(c)=>c?"Yes":"No"},{key:"last_seen_at",header:"Last Seen",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var nc=p(()=>{g();f()});async function tc(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <connection-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/page_shield/connections/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,URL:m.url,Host:m.host??"","Domain Reported Malicious":m.domain_reported_malicious??!1,"Added At":m.added_at??"","First Seen At":m.first_seen_at??"","Last Seen At":m.last_seen_at??"","Page URLs":m.page_urls?.join(", ")??""})}var rc=p(()=>{g();f()});async function sc(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return oc(o,e);case"get":case"show":return tc(o,e);case void 0:case"--help":case"-h":e.output.raw(ic);return;default:throw new i(`Unknown page-shield connections command: "${n}"
|
|
524
|
+
|
|
525
|
+
${ic}`)}}var ic=`Usage: cf page-shield connections <command>
|
|
526
|
+
|
|
527
|
+
Commands:
|
|
528
|
+
list List Page Shield connections
|
|
529
|
+
get Get details for a specific connection
|
|
530
|
+
|
|
531
|
+
Run 'cf page-shield connections <command> --help' for more information.`;var ac=p(()=>{f();nc();rc()});async function mc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/page_shield/policies`),m=[{key:"id",header:"ID",width:34},{key:"action",header:"Action",width:14},{key:"value",header:"Value",width:40},{key:"description",header:"Description",width:24},{key:"enabled",header:"Enabled",width:8,transform:(c)=>c===!1?"No":"Yes"}];e.output.table(r,m)}var dc=p(()=>{g();f()});async function cc(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"file");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--file <policy-json> is required.");let r=await y(o,e.client),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.post(`/zones/${encodeURIComponent(r)}/page_shield/policies`,c);e.output.success(`Page Shield policy created: ${l.id}`),e.output.detail({ID:l.id,Action:l.action,Value:l.value,Description:l.description??"",Enabled:l.enabled??!0})}var pc=p(()=>{g();f()});async function uc(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id"),r=a(n,"file");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <policy-id> is required.");if(!r)throw new i("--file <policy-json> is required.");let m=await y(o,e.client),c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.put(`/zones/${encodeURIComponent(m)}/page_shield/policies/${encodeURIComponent(t)}`,l);e.output.success(`Page Shield policy ${t} updated.`),e.output.detail({ID:w.id,Action:w.action,Value:w.value,Description:w.description??"",Enabled:w.enabled??!0})}var fc=p(()=>{g();f()});async function lc(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone> is required.");if(!t)throw new i("--id <policy-id> is required.");let r=await y(o,e.client);if(!await C(`Delete Page Shield policy ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/page_shield/policies/${encodeURIComponent(t)}`),e.output.success(`Page Shield policy ${t} deleted.`)}var wc=p(()=>{g();f();U()});async function yc(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return mc(o,e);case"create":case"add":return cc(o,e);case"update":case"set":return uc(o,e);case"delete":case"rm":case"remove":return lc(o,e);case void 0:case"--help":case"-h":e.output.raw(hc);return;default:throw new i(`Unknown page-shield policies command: "${n}"
|
|
532
|
+
|
|
533
|
+
${hc}`)}}var hc=`Usage: cf page-shield policies <command>
|
|
534
|
+
|
|
535
|
+
Commands:
|
|
536
|
+
list List Page Shield policies
|
|
537
|
+
create Create a Page Shield policy
|
|
538
|
+
update Update a Page Shield policy
|
|
539
|
+
delete Delete a Page Shield policy
|
|
540
|
+
|
|
541
|
+
Run 'cf page-shield policies <command> --help' for more information.`;var Cc=p(()=>{f();dc();pc();fc();wc()});var $c={};z($c,{run:()=>aE});async function aE(s,e){let[n,...o]=s;switch(n){case"settings":case"setting":return Vd(o,e);case"scripts":case"script":return xd(o,e);case"connections":case"connection":return sc(o,e);case"policies":case"policy":return yc(o,e);case void 0:case"--help":case"-h":e.output.raw(gc);return;default:throw new i(`Unknown page-shield command: "${n}"
|
|
542
|
+
|
|
543
|
+
${gc}`)}}var gc=`Usage: cf page-shield <command>
|
|
544
|
+
|
|
545
|
+
Commands:
|
|
546
|
+
settings Manage Page Shield settings
|
|
547
|
+
scripts View detected scripts
|
|
548
|
+
connections View detected connections
|
|
549
|
+
policies Manage Page Shield policies
|
|
550
|
+
|
|
551
|
+
Run 'cf page-shield <command> --help' for more information.`;var kc=p(()=>{f();Wd();ec();ac();Cc()});async function Uc(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/challenges/widgets`),r=[{key:"sitekey",header:"Sitekey",width:36},{key:"name",header:"Name",width:25},{key:"mode",header:"Mode",width:12},{key:"domains",header:"Domains",transform:(m)=>Array.isArray(m)?m.join(", "):String(m??"")},{key:"created_on",header:"Created"}];e.output.table(t,r)}var _c=p(()=>{h()});async function zc(s,e){let{flags:n}=d(s),o=a(n,"sitekey");if(!o)throw new i("--sitekey <key> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/challenges/widgets/${encodeURIComponent(o)}`);e.output.detail({Sitekey:r.sitekey,Name:r.name,Mode:r.mode,Domains:r.domains.join(", "),"Bot Fight Mode":r.bot_fight_mode,Region:r.region??"(default)",Created:r.created_on,Modified:r.modified_on})}var Rc=p(()=>{h();f()});async function bc(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=a(n,"domain"),m=D(n,"domains")??(t?[t]:[]);if(m.length===0)throw new i("--domain <domain> or --domains <d1,d2> is required.");let c=a(n,"mode");if(!c)throw new i("--mode <mode> is required (managed, non-interactive, invisible).");let l=await u(a(n,"accountId"),e.client,e.config),w={name:o,domains:m,mode:c},$=await e.client.post(`/accounts/${encodeURIComponent(l)}/challenges/widgets`,w);e.output.success(`Widget "${$.name}" created (sitekey: ${$.sitekey}).`)}var Pc=p(()=>{h();f()});async function Ic(s,e){let{flags:n}=d(s),o=a(n,"sitekey");if(!o)throw new i("--sitekey <key> is required.");let t=a(n,"name"),r=a(n,"mode"),m=a(n,"domain"),c=D(n,"domains"),l=await u(a(n,"accountId"),e.client,e.config),w={};if(t)w.name=t;if(r)w.mode=r;if(c)w.domains=c;else if(m)w.domains=[m];let $=await e.client.put(`/accounts/${encodeURIComponent(l)}/challenges/widgets/${encodeURIComponent(o)}`,w);e.output.success(`Widget "${$.name}" updated (sitekey: ${$.sitekey}).`)}var vc=p(()=>{h();f()});async function Dc(s,e){let{flags:n}=d(s),o=a(n,"sitekey");if(!o)throw new i("--sitekey <key> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Turnstile widget "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/challenges/widgets/${encodeURIComponent(o)}`),e.output.success(`Widget "${o}" deleted.`)}var Sc=p(()=>{h();f();U()});async function qc(s,e){let{flags:n}=d(s),o=a(n,"sitekey");if(!o)throw new i("--sitekey <key> is required.");let t=v(n,"invalidateImmediately"),r=await u(a(n,"accountId"),e.client,e.config),m={};if(t)m.invalidate_immediately=!0;let c=await e.client.post(`/accounts/${encodeURIComponent(r)}/challenges/widgets/${encodeURIComponent(o)}/rotate_secret`,m);e.output.success(`Secret rotated for widget "${o}".`),e.output.detail({Sitekey:c.sitekey,"New Secret":c.secret})}var Ac=p(()=>{h();f()});async function Nc(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Uc(o,e);case"get":case"show":return zc(o,e);case"create":case"new":return bc(o,e);case"update":return Ic(o,e);case"delete":case"rm":case"remove":return Dc(o,e);case"rotate-secret":case"rotate":return qc(o,e);case void 0:case"--help":case"-h":e.output.raw(Lc);return;default:throw new i(`Unknown turnstile widgets command: "${n}"
|
|
552
|
+
|
|
553
|
+
${Lc}`)}}var Lc=`Usage: cf turnstile widgets <command>
|
|
554
|
+
|
|
555
|
+
Commands:
|
|
556
|
+
list List Turnstile widgets
|
|
557
|
+
get Get widget details
|
|
558
|
+
create Create a new widget
|
|
559
|
+
update Update an existing widget
|
|
560
|
+
delete Delete a widget
|
|
561
|
+
rotate-secret Rotate the widget secret key
|
|
562
|
+
|
|
563
|
+
Run 'cf turnstile widgets <command> --help' for more information.`;var Ec=p(()=>{f();_c();Rc();Pc();vc();Sc();Ac()});var Mc={};z(Mc,{run:()=>wE});async function wE(s,e){let[n,...o]=s;switch(n){case"widgets":case"widget":return Nc(o,e);case void 0:case"--help":case"-h":e.output.raw(Gc);return;default:throw new i(`Unknown turnstile command: "${n}"
|
|
564
|
+
|
|
565
|
+
${Gc}`)}}var Gc=`Usage: cf turnstile <command>
|
|
566
|
+
|
|
567
|
+
Commands:
|
|
568
|
+
widgets Manage Turnstile widgets (list, get, create, update, delete, rotate-secret)
|
|
569
|
+
|
|
570
|
+
Run 'cf turnstile <command> --help' for more information.`;var Tc=p(()=>{f();Ec()});async function Zc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/api_gateway/settings`);e.output.detail({Zone:o,"API Gateway Enabled":r.enabled})}var Oc=p(()=>{g();f()});async function jc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r={};if(n.enabled!==void 0)r.enabled=v(n,"enabled");if(Object.keys(r).length===0)throw new i("At least one setting flag is required (--enabled).");await e.client.put(`/zones/${encodeURIComponent(t)}/api_gateway/settings`,r);let m=r.enabled;e.output.success(`API Gateway ${m?"enabled":"disabled"} for zone "${o}".`)}var Jc=p(()=>{g();f()});async function Hc(s,e){let[n,...o]=s;switch(n){case"get":case"show":return Zc(o,e);case"update":case"set":return jc(o,e);case void 0:case"--help":case"-h":e.output.raw(Bc);return;default:throw new i(`Unknown api-gateway settings command: "${n}"
|
|
571
|
+
|
|
572
|
+
${Bc}`)}}var Bc=`Usage: cf api-gateway settings <command>
|
|
573
|
+
|
|
574
|
+
Commands:
|
|
575
|
+
get Get API Gateway settings
|
|
576
|
+
update Update API Gateway settings
|
|
577
|
+
|
|
578
|
+
Run 'cf api-gateway settings <command> --help' for more information.`;var Vc=p(()=>{f();Oc();Jc()});async function Wc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/api_gateway/user_schemas`),m=[{key:"schema_id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"kind",header:"Kind",width:12},{key:"validation_enabled",header:"Validation",width:12,transform:(c)=>c?"enabled":"disabled"},{key:"created_at",header:"Created"}];e.output.table(r,m)}var Kc=p(()=>{g();f()});async function Qc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"file");if(!t)throw new i("--file <openapi.json> is required.");let r=await y(o,e.client),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l=await e.client.post(`/zones/${encodeURIComponent(r)}/api_gateway/user_schemas`,c);e.output.success(`Schema "${l.name}" uploaded (ID: ${l.schema_id}).`)}var Yc=p(()=>{g();f()});async function Xc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"id");if(!t)throw new i("--id <schema-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/api_gateway/user_schemas/${encodeURIComponent(t)}`);e.output.detail({ID:m.schema_id,Name:m.name,Kind:m.kind??"(unknown)",Source:m.source??"(unknown)",Validation:m.validation_enabled?"enabled":"disabled",Created:m.created_at??"(unknown)"})}var Fc=p(()=>{g();f()});async function xc(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"id");if(!t)throw new i("--id <schema-id> is required.");let r=await y(o,e.client);if(!await C(`Delete API Gateway schema "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/api_gateway/user_schemas/${encodeURIComponent(t)}`),e.output.success(`Schema "${t}" deleted.`)}var ep=p(()=>{g();f();U()});async function np(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Wc(o,e);case"upload":case"add":return Qc(o,e);case"get":case"show":return Xc(o,e);case"delete":case"rm":case"remove":return xc(o,e);case void 0:case"--help":case"-h":e.output.raw(op);return;default:throw new i(`Unknown api-gateway schemas command: "${n}"
|
|
579
|
+
|
|
580
|
+
${op}`)}}var op=`Usage: cf api-gateway schemas <command>
|
|
581
|
+
|
|
582
|
+
Commands:
|
|
583
|
+
list List API Gateway schemas
|
|
584
|
+
upload Upload an OpenAPI schema
|
|
585
|
+
get Get a schema by ID
|
|
586
|
+
delete Delete a schema
|
|
587
|
+
|
|
588
|
+
Run 'cf api-gateway schemas <command> --help' for more information.`;var tp=p(()=>{f();Kc();Yc();Fc();ep()});var ip={};z(ip,{run:()=>zE});async function zE(s,e){let[n,...o]=s;switch(n){case"settings":case"setting":return Hc(o,e);case"schemas":case"schema":return np(o,e);case void 0:case"--help":case"-h":e.output.raw(rp);return;default:throw new i(`Unknown api-gateway command: "${n}"
|
|
589
|
+
|
|
590
|
+
${rp}`)}}var rp=`Usage: cf api-gateway <command>
|
|
591
|
+
|
|
592
|
+
Commands:
|
|
593
|
+
settings Manage API Gateway settings
|
|
594
|
+
schemas Manage API Gateway schemas
|
|
595
|
+
|
|
596
|
+
Run 'cf api-gateway <command> --help' for more information.`;var sp=p(()=>{f();Vc();tp()});async function ap(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/rate_limits`),m=[{key:"id",header:"ID",width:36},{key:"description",header:"Description",width:30},{key:"match.request.url",header:"URL Pattern",width:30},{key:"threshold",header:"Threshold",width:10},{key:"period",header:"Period (s)",width:10},{key:"action.mode",header:"Action",width:12},{key:"disabled",header:"Disabled",width:8,transform:(c)=>c?"yes":"no"}];e.output.table(r,m)}var mp=p(()=>{g();f()});async function dp(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/rate_limits/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Description:m.description??"(none)","URL Pattern":m.match.request.url,Methods:m.match.request.methods?.join(", ")??"(all)",Threshold:m.threshold,Period:`${m.period}s`,Action:m.action.mode,"Action Timeout":m.action.timeout!=null?`${m.action.timeout}s`:"(none)",Disabled:m.disabled??!1})}var cp=p(()=>{g();f()});async function pp(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"file");if(!t)throw new i("--file <ratelimit-json> is required.");let r=await y(o,e.client),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l=await e.client.post(`/zones/${encodeURIComponent(r)}/rate_limits`,c);e.output.success(`Rate limit rule created (ID: ${l.id}).`)}var up=p(()=>{g();f()});async function fp(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <ratelimit-json> is required.");let m=await y(o,e.client),c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l;try{l=JSON.parse(c)}catch{throw new i(`File "${r}" does not contain valid JSON.`)}let w=await e.client.put(`/zones/${encodeURIComponent(m)}/rate_limits/${encodeURIComponent(t)}`,l);e.output.success(`Rate limit rule "${w.id}" updated.`)}var lp=p(()=>{g();f()});async function wp(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=await y(o,e.client);if(!await C(`Delete rate limit rule "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/rate_limits/${encodeURIComponent(t)}`),e.output.success(`Rate limit rule "${t}" deleted.`)}var hp=p(()=>{g();f();U()});var Cp={};z(Cp,{run:()=>DE});async function DE(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ap(o,e);case"get":case"show":return dp(o,e);case"create":case"new":return pp(o,e);case"update":return fp(o,e);case"delete":case"rm":case"remove":return wp(o,e);case void 0:case"--help":case"-h":e.output.raw(yp);return;default:throw new i(`Unknown rate-limits command: "${n}"
|
|
597
|
+
|
|
598
|
+
${yp}`)}}var yp=`Usage: cf rate-limits <command>
|
|
599
|
+
|
|
600
|
+
Commands:
|
|
601
|
+
list List rate limit rules
|
|
602
|
+
get Get rate limit rule details
|
|
603
|
+
create Create a rate limit rule
|
|
604
|
+
update Update a rate limit rule
|
|
605
|
+
delete Delete a rate limit rule
|
|
606
|
+
|
|
607
|
+
Run 'cf rate-limits <command> --help' for more information.`;var gp=p(()=>{f();mp();cp();up();lp();hp()});async function $p(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t={},r=a(n,"name");if(r)t.name=r;if(v(n,"isDeleted"))t.is_deleted="true";let m=await e.client.get(`/accounts/${encodeURIComponent(o)}/cfd_tunnel`,t),c=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:12},{key:"created_at",header:"Created"}];e.output.table(m,c)}var kp=p(()=>{h()});async function Up(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Status:r.status,Type:r.tun_type??"","Remote Config":r.remote_config??!1,Created:r.created_at,Connections:r.connections?.length??0})}var _p=p(()=>{h();f()});async function zp(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <tunnel-name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${encodeURIComponent(t)}/cfd_tunnel`,{name:o,tunnel_secret:btoa(String.fromCharCode(...crypto.getRandomValues(new Uint8Array(32))))});e.output.success(`Tunnel "${r.name}" created.`),e.output.detail({ID:r.id,Name:r.name,Status:r.status,Created:r.created_at})}var Rp=p(()=>{h();f()});async function bp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"name");if(m)r.name=m;let c=await e.client.patch(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}`,r);e.output.success(`Tunnel "${c.name}" updated.`),e.output.detail({ID:c.id,Name:c.name,Status:c.status})}var Pp=p(()=>{h();f()});async function Ip(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete tunnel "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}`),e.output.success(`Tunnel "${o}" deleted.`)}var vp=p(()=>{h();f();U()});async function Dp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}/token`);e.output.raw(r)}var Sp=p(()=>{h();f()});async function qp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}/configurations`);e.output.json(r)}var Ap=p(()=>{h();f()});async function Lp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <config-yaml> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`/accounts/${encodeURIComponent(r)}/cfd_tunnel/${encodeURIComponent(o)}/configurations`,c);e.output.success(`Tunnel "${o}" configuration updated.`),e.output.json(l)}var Np=p(()=>{h();f()});async function Gp(s,e){let[n,...o]=s;switch(n){case"get":case"show":return qp(o,e);case"update":case"set":return Lp(o,e);case void 0:case"--help":case"-h":e.output.raw(Ep);return;default:throw new i(`Unknown tunnels config command: "${n}"
|
|
608
|
+
|
|
609
|
+
${Ep}`)}}var Ep=`Usage: cf tunnels config <command>
|
|
610
|
+
|
|
611
|
+
Commands:
|
|
612
|
+
get Get tunnel configuration
|
|
613
|
+
update Update tunnel configuration from YAML/JSON file
|
|
614
|
+
|
|
615
|
+
Run 'cf tunnels config <command> --help' for more information.`;var Mp=p(()=>{f();Ap();Np()});async function Tp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/cfd_tunnel/${encodeURIComponent(o)}/connections`),m=[{key:"id",header:"ID",width:36},{key:"colo_name",header:"Colo",width:10},{key:"client_version",header:"Version",width:12},{key:"origin_ip",header:"Origin IP",width:18},{key:"opened_at",header:"Opened"}];e.output.table(r,m)}var Zp=p(()=>{h();f()});async function Op(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=a(n,"connectionId");if(!t)throw new i("--connection-id <connection-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete connection "${t}" from tunnel "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/cfd_tunnel/${encodeURIComponent(o)}/connections/${encodeURIComponent(t)}`),e.output.success(`Connection "${t}" deleted from tunnel "${o}".`)}var jp=p(()=>{h();f();U()});async function Bp(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Tp(o,e);case"delete":case"rm":return Op(o,e);case void 0:case"--help":case"-h":e.output.raw(Jp);return;default:throw new i(`Unknown tunnels connections command: "${n}"
|
|
616
|
+
|
|
617
|
+
${Jp}`)}}var Jp=`Usage: cf tunnels connections <command>
|
|
618
|
+
|
|
619
|
+
Commands:
|
|
620
|
+
list List tunnel connections
|
|
621
|
+
delete Delete a tunnel connection
|
|
622
|
+
|
|
623
|
+
Run 'cf tunnels connections <command> --help' for more information.`;var Hp=p(()=>{f();Zp();jp()});var Wp={};z(Wp,{run:()=>JE});async function JE(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return $p(o,e);case"get":case"show":return Up(o,e);case"create":return zp(o,e);case"update":return bp(o,e);case"delete":case"rm":return Ip(o,e);case"token":return Dp(o,e);case"config":case"cfg":return Gp(o,e);case"connections":case"conns":return Bp(o,e);case void 0:case"--help":case"-h":e.output.raw(Vp);return;default:throw new i(`Unknown tunnels command: "${n}"
|
|
624
|
+
|
|
625
|
+
${Vp}`)}}var Vp=`Usage: cf tunnels <command>
|
|
626
|
+
|
|
627
|
+
Commands:
|
|
628
|
+
list List Cloudflare Tunnels
|
|
629
|
+
get Get tunnel details
|
|
630
|
+
create Create a new tunnel
|
|
631
|
+
update Update a tunnel
|
|
632
|
+
delete Delete a tunnel
|
|
633
|
+
token Get a tunnel's token
|
|
634
|
+
config Manage tunnel configuration (get, update)
|
|
635
|
+
connections Manage tunnel connections (list, delete)
|
|
636
|
+
|
|
637
|
+
Run 'cf tunnels <command> --help' for more information.`;var Kp=p(()=>{f();kp();_p();Rp();Pp();vp();Sp();Mp();Hp()});async function Qp(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:24},{key:"device_type",header:"Type",width:12},{key:"user.email",header:"User",width:24},{key:"last_seen",header:"Last Seen"}];e.output.table(t,r)}var Yp=p(()=>{h()});async function Xp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <device-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/devices/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name??"",Type:r.device_type??"",Version:r.version??"",IP:r.ip??"",MAC:r.mac_address??"",OS:r.os_version??"",Serial:r.serial_number??"",User:r.user?.email??"","Last Seen":r.last_seen??"",Created:r.created??""})}var Fp=p(()=>{h();f()});async function xp(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <device-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Revoke device "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.post(`/accounts/${encodeURIComponent(t)}/devices/${encodeURIComponent(o)}/revoke`),e.output.success(`Device "${o}" revoked.`)}var eu=p(()=>{h();f();U()});async function ou(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices/registrations`),r=[{key:"id",header:"ID",width:36},{key:"device_id",header:"Device ID",width:36},{key:"user.email",header:"User",width:24},{key:"status",header:"Status",width:12},{key:"created_at",header:"Created"}];e.output.table(t,r)}var nu=p(()=>{h()});async function ru(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ou(o,e);case void 0:case"--help":case"-h":e.output.raw(tu);return;default:throw new i(`Unknown devices registrations command: "${n}"
|
|
638
|
+
|
|
639
|
+
${tu}`)}}var tu=`Usage: cf devices registrations <command>
|
|
640
|
+
|
|
641
|
+
Commands:
|
|
642
|
+
list List device registrations
|
|
643
|
+
|
|
644
|
+
Run 'cf devices registrations <command> --help' for more information.`;var iu=p(()=>{f();nu()});async function su(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices/posture`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"type",header:"Type",width:16},{key:"description",header:"Description"}];e.output.table(t,r)}var au=p(()=>{h()});async function mu(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <rule-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/devices/posture`,m);e.output.success(`Posture rule "${c.name}" created.`),e.output.detail({ID:c.id,Name:c.name,Type:c.type})}var du=p(()=>{h();f()});async function cu(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <rule-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <rule-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`/accounts/${encodeURIComponent(r)}/devices/posture/${encodeURIComponent(o)}`,c);e.output.success(`Posture rule "${l.name}" updated.`),e.output.detail({ID:l.id,Name:l.name,Type:l.type})}var pu=p(()=>{h();f()});async function uu(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <rule-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete posture rule "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/devices/posture/${encodeURIComponent(o)}`),e.output.success(`Posture rule "${o}" deleted.`)}var fu=p(()=>{h();f();U()});async function wu(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return su(o,e);case"create":return mu(o,e);case"update":return cu(o,e);case"delete":case"rm":return uu(o,e);case void 0:case"--help":case"-h":e.output.raw(lu);return;default:throw new i(`Unknown devices posture rules command: "${n}"
|
|
645
|
+
|
|
646
|
+
${lu}`)}}var lu=`Usage: cf devices posture rules <command>
|
|
647
|
+
|
|
648
|
+
Commands:
|
|
649
|
+
list List device posture rules
|
|
650
|
+
create Create a device posture rule
|
|
651
|
+
update Update a device posture rule
|
|
652
|
+
delete Delete a device posture rule
|
|
653
|
+
|
|
654
|
+
Run 'cf devices posture rules <command> --help' for more information.`;var hu=p(()=>{f();au();du();pu();fu()});async function Cu(s,e){let[n,...o]=s;switch(n){case"rules":case"rule":return wu(o,e);case void 0:case"--help":case"-h":e.output.raw(yu);return;default:throw new i(`Unknown devices posture command: "${n}"
|
|
655
|
+
|
|
656
|
+
${yu}`)}}var yu=`Usage: cf devices posture <command>
|
|
657
|
+
|
|
658
|
+
Commands:
|
|
659
|
+
rules Manage device posture rules (list, create, update, delete)
|
|
660
|
+
|
|
661
|
+
Run 'cf devices posture <command> --help' for more information.`;var gu=p(()=>{f();hu()});var ku={};z(ku,{run:()=>oG});async function oG(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Qp(o,e);case"get":case"show":return Xp(o,e);case"revoke":return xp(o,e);case"registrations":case"regs":return ru(o,e);case"posture":return Cu(o,e);case void 0:case"--help":case"-h":e.output.raw($u);return;default:throw new i(`Unknown devices command: "${n}"
|
|
662
|
+
|
|
663
|
+
${$u}`)}}var $u=`Usage: cf devices <command>
|
|
664
|
+
|
|
665
|
+
Commands:
|
|
666
|
+
list List devices
|
|
667
|
+
get Get device details
|
|
668
|
+
revoke Revoke a device
|
|
669
|
+
registrations Manage device registrations (list)
|
|
670
|
+
posture Manage device posture (rules)
|
|
671
|
+
|
|
672
|
+
Run 'cf devices <command> --help' for more information.`;var Uu=p(()=>{f();Yp();Fp();eu();iu();gu()});async function _u(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices/settings`);e.output.json(t)}var zu=p(()=>{h()});async function Ru(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <settings-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.put(`/accounts/${encodeURIComponent(t)}/devices/settings`,m);e.output.success("WARP settings updated."),e.output.json(c)}var bu=p(()=>{h();f()});async function Iu(s,e){let[n,...o]=s;switch(n){case"get":case"show":return _u(o,e);case"update":case"set":return Ru(o,e);case void 0:case"--help":case"-h":e.output.raw(Pu);return;default:throw new i(`Unknown warp settings command: "${n}"
|
|
673
|
+
|
|
674
|
+
${Pu}`)}}var Pu=`Usage: cf warp settings <command>
|
|
675
|
+
|
|
676
|
+
Commands:
|
|
677
|
+
get Get WARP device settings
|
|
678
|
+
update Update WARP device settings from JSON file
|
|
679
|
+
|
|
680
|
+
Run 'cf warp settings <command> --help' for more information.`;var vu=p(()=>{f();zu();bu()});async function Du(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices/policy/exclude`),r=[{key:"address",header:"Address",width:24},{key:"description",header:"Description",width:40},{key:"host",header:"Host"}];e.output.table(t,r)}var Su=p(()=>{h()});async function qu(s,e){let{flags:n}=d(s),o=a(n,"address");if(!o)throw new i("--address <cidr> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=a(n,"description"),m=await e.client.get(`/accounts/${encodeURIComponent(t)}/devices/policy/exclude`),c=Array.isArray(m)?m:[];if(c.some(($)=>$.address===o)){e.output.warn(`Split tunnel entry "${o}" already exists.`);return}let l={address:o};if(r)l.description=r;let w=[...c,l];await e.client.put(`/accounts/${encodeURIComponent(t)}/devices/policy/exclude`,w),e.output.success(`Split tunnel entry "${o}" added.`)}var Au=p(()=>{h();f()});async function Lu(s,e){let{flags:n}=d(s),o=a(n,"address");if(!o)throw new i("--address <cidr> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/devices/policy/exclude`),m=Array.isArray(r)?r:[],c=m.filter((l)=>l.address!==o);if(c.length===m.length)throw new i(`Split tunnel entry "${o}" not found.`);await e.client.put(`/accounts/${encodeURIComponent(t)}/devices/policy/exclude`,c),e.output.success(`Split tunnel entry "${o}" removed.`)}var Nu=p(()=>{h();f()});async function Gu(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Du(o,e);case"add":return qu(o,e);case"remove":case"rm":return Lu(o,e);case void 0:case"--help":case"-h":e.output.raw(Eu);return;default:throw new i(`Unknown warp split-tunnels command: "${n}"
|
|
681
|
+
|
|
682
|
+
${Eu}`)}}var Eu=`Usage: cf warp split-tunnels <command>
|
|
683
|
+
|
|
684
|
+
Commands:
|
|
685
|
+
list List split tunnel entries
|
|
686
|
+
add Add a split tunnel entry
|
|
687
|
+
remove Remove a split tunnel entry
|
|
688
|
+
|
|
689
|
+
Run 'cf warp split-tunnels <command> --help' for more information.`;var Mu=p(()=>{f();Su();Au();Nu()});async function Tu(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/devices/fleet_status`),r=[{key:"device_id",header:"Device ID",width:36},{key:"device_name",header:"Name",width:20},{key:"status",header:"Status",width:12},{key:"platform",header:"Platform",width:12},{key:"version",header:"Version",width:12},{key:"colo",header:"Colo",width:8},{key:"last_seen",header:"Last Seen"}];e.output.table(t,r)}var Zu=p(()=>{h()});var ju={};z(ju,{run:()=>cG});async function cG(s,e){let[n,...o]=s;switch(n){case"settings":return Iu(o,e);case"split-tunnels":case"split":return Gu(o,e);case"fleet-status":case"fleet":return Tu(o,e);case void 0:case"--help":case"-h":e.output.raw(Ou);return;default:throw new i(`Unknown warp command: "${n}"
|
|
690
|
+
|
|
691
|
+
${Ou}`)}}var Ou=`Usage: cf warp <command>
|
|
692
|
+
|
|
693
|
+
Commands:
|
|
694
|
+
settings Manage WARP device settings (get, update)
|
|
695
|
+
split-tunnels Manage WARP split tunnel rules (list, add, remove)
|
|
696
|
+
fleet-status Show WARP fleet status
|
|
697
|
+
|
|
698
|
+
Run 'cf warp <command> --help' for more information.`;var Ju=p(()=>{f();vu();Mu();Zu()});async function O(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"accountId");if(o&&t)throw new i("Specify either --zone or --account-id, not both.");if(!o&&!t)throw new i("--zone <zone> or --account-id <id> is required.");let r;if(o){let m=await y(o,e.client);return r=`/zones/${encodeURIComponent(m)}/access`,{basePath:r,flags:n}}else{let m=t;return r=`/accounts/${encodeURIComponent(m)}/access`,{basePath:r,accountId:m,flags:n}}}async function b(s,e){let{flags:n}=d(s),o=a(n,"accountId");if(!o){let r=await Promise.resolve().then(() => (h(),jo)).then((c)=>c.resolveAccountId(void 0,e.client,e.config));return{basePath:`/accounts/${encodeURIComponent(r)}/access`,accountId:r,flags:n}}return{basePath:`/accounts/${encodeURIComponent(o)}/access`,accountId:o,flags:n}}var S=p(()=>{g();f()});async function Bu(s,e){let{basePath:n}=await O(s,e),o=await e.client.get(`${n}/apps`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"domain",header:"Domain",width:30},{key:"type",header:"Type",width:16},{key:"created_at",header:"Created",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var Hu=p(()=>{S()});async function Vu(s,e){let{basePath:n,flags:o}=await O(s,e),t=a(o,"id");if(!t)throw new i("--id <app-id> is required.");let r=await e.client.get(`${n}/apps/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,Domain:r.domain,Type:r.type??"","Session Duration":r.session_duration??"",AUD:r.aud??"",Created:r.created_at??"",Updated:r.updated_at??""})}var Wu=p(()=>{S();f()});async function Ku(s,e){let{basePath:n,flags:o}=await O(s,e),t=a(o,"file");if(!t)throw new i("--file <app-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/apps`,m);e.output.success(`Access application created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Domain:c.domain,Type:c.type??""})}var Qu=p(()=>{S();f()});async function Yu(s,e){let{basePath:n,flags:o}=await O(s,e),t=a(o,"id");if(!t)throw new i("--id <app-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <app-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/apps/${encodeURIComponent(t)}`,c);e.output.success(`Access application ${t} updated.`),e.output.detail({ID:l.id,Name:l.name,Domain:l.domain,Type:l.type??""})}var Xu=p(()=>{S();f()});async function Fu(s,e){let{basePath:n,flags:o}=await O(s,e),t=a(o,"id");if(!t)throw new i("--id <app-id> is required.");if(!await C(`Delete access application ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/apps/${encodeURIComponent(t)}`),e.output.success(`Access application ${t} deleted.`)}var xu=p(()=>{S();f();U()});async function of(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Bu(o,e);case"get":case"show":return Vu(o,e);case"create":case"add":return Ku(o,e);case"update":case"set":return Yu(o,e);case"delete":case"rm":case"remove":return Fu(o,e);case void 0:case"--help":case"-h":e.output.raw(ef);return;default:throw new i(`Unknown access apps command: "${n}"
|
|
699
|
+
|
|
700
|
+
${ef}`)}}var ef=`Usage: cf access apps <command>
|
|
701
|
+
|
|
702
|
+
Commands:
|
|
703
|
+
list List access applications
|
|
704
|
+
get Get an access application
|
|
705
|
+
create Create an access application
|
|
706
|
+
update Update an access application
|
|
707
|
+
delete Delete an access application
|
|
708
|
+
|
|
709
|
+
Run 'cf access apps <command> --help' for more information.`;var nf=p(()=>{f();Hu();Wu();Qu();Xu();xu()});async function tf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"app");if(!t)throw new i("--app <app-id> is required.");let r=await e.client.get(`${n}/apps/${encodeURIComponent(t)}/policies`),m=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"decision",header:"Decision",width:12},{key:"precedence",header:"Precedence",width:10},{key:"created_at",header:"Created",width:12,transform:(c)=>c?String(c).slice(0,10):""}];e.output.table(r,m)}var rf=p(()=>{S();f()});async function sf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"app");if(!t)throw new i("--app <app-id> is required.");let r=a(o,"id");if(!r)throw new i("--id <policy-id> is required.");let m=await e.client.get(`${n}/apps/${encodeURIComponent(t)}/policies/${encodeURIComponent(r)}`);e.output.detail({ID:m.id,Name:m.name,Decision:m.decision,Precedence:m.precedence,"Include Rules":m.include?.length??0,"Exclude Rules":m.exclude?.length??0,"Require Rules":m.require?.length??0,Created:m.created_at??"",Updated:m.updated_at??""})}var af=p(()=>{S();f()});async function mf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"app");if(!t)throw new i("--app <app-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <policy-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.post(`${n}/apps/${encodeURIComponent(t)}/policies`,c);e.output.success(`Access policy created: ${l.id}`),e.output.detail({ID:l.id,Name:l.name,Decision:l.decision,Precedence:l.precedence})}var df=p(()=>{S();f()});async function cf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"app");if(!t)throw new i("--app <app-id> is required.");let r=a(o,"id");if(!r)throw new i("--id <policy-id> is required.");let m=a(o,"file");if(!m)throw new i("--file <policy-json> is required.");let c;try{c=await Bun.file(m).text()}catch{throw new i(`Cannot read file: "${m}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.put(`${n}/apps/${encodeURIComponent(t)}/policies/${encodeURIComponent(r)}`,l);e.output.success(`Access policy ${r} updated.`),e.output.detail({ID:w.id,Name:w.name,Decision:w.decision,Precedence:w.precedence})}var pf=p(()=>{S();f()});async function uf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"app");if(!t)throw new i("--app <app-id> is required.");let r=a(o,"id");if(!r)throw new i("--id <policy-id> is required.");if(!await C(`Delete access policy ${r}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/apps/${encodeURIComponent(t)}/policies/${encodeURIComponent(r)}`),e.output.success(`Access policy ${r} deleted.`)}var ff=p(()=>{S();f();U()});async function wf(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return tf(o,e);case"get":case"show":return sf(o,e);case"create":case"add":return mf(o,e);case"update":case"set":return cf(o,e);case"delete":case"rm":case"remove":return uf(o,e);case void 0:case"--help":case"-h":e.output.raw(lf);return;default:throw new i(`Unknown access policies command: "${n}"
|
|
710
|
+
|
|
711
|
+
${lf}`)}}var lf=`Usage: cf access policies <command>
|
|
712
|
+
|
|
713
|
+
Commands:
|
|
714
|
+
list List access policies for an application
|
|
715
|
+
get Get an access policy
|
|
716
|
+
create Create an access policy
|
|
717
|
+
update Update an access policy
|
|
718
|
+
delete Delete an access policy
|
|
719
|
+
|
|
720
|
+
Run 'cf access policies <command> --help' for more information.`;var hf=p(()=>{f();rf();af();df();pf();ff()});async function yf(s,e){let{basePath:n}=await b(s,e),o=await e.client.get(`${n}/service_tokens`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:24},{key:"client_id",header:"Client ID",width:34},{key:"expires_at",header:"Expires",width:12,transform:(r)=>r?String(r).slice(0,10):"never"},{key:"created_at",header:"Created",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var Cf=p(()=>{S()});async function gf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"name");if(!t)throw new i("--name <token-name> is required.");let r=await e.client.post(`${n}/service_tokens`,{name:t});e.output.success(`Service token created: ${r.id}`),e.output.warn("Save this secret now - it cannot be retrieved later."),e.output.detail({ID:r.id,Name:r.name,"Client ID":r.client_id,"Client Secret":r.client_secret??"(hidden)",Expires:r.expires_at??"never"})}var $f=p(()=>{S();f()});async function kf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <token-id> is required.");let r=a(o,"name"),m={};if(r)m.name=r;let c=await e.client.put(`${n}/service_tokens/${encodeURIComponent(t)}`,m);e.output.success(`Service token ${t} updated.`),e.output.detail({ID:c.id,Name:c.name,"Client ID":c.client_id})}var Uf=p(()=>{S();f()});async function _f(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <token-id> is required.");if(!await C(`Delete service token ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/service_tokens/${encodeURIComponent(t)}`),e.output.success(`Service token ${t} deleted.`)}var zf=p(()=>{S();f();U()});async function Rf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <token-id> is required.");let r=await e.client.post(`${n}/service_tokens/${encodeURIComponent(t)}/rotate`,{});e.output.success(`Service token ${t} rotated.`),e.output.warn("Save this secret now - it cannot be retrieved later."),e.output.detail({ID:r.id,Name:r.name,"Client ID":r.client_id,"Client Secret":r.client_secret??"(hidden)",Expires:r.expires_at??"never"})}var bf=p(()=>{S();f()});async function If(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return yf(o,e);case"create":case"add":return gf(o,e);case"update":case"set":return kf(o,e);case"delete":case"rm":case"remove":return _f(o,e);case"rotate":return Rf(o,e);case void 0:case"--help":case"-h":e.output.raw(Pf);return;default:throw new i(`Unknown access service-tokens command: "${n}"
|
|
721
|
+
|
|
722
|
+
${Pf}`)}}var Pf=`Usage: cf access service-tokens <command>
|
|
723
|
+
|
|
724
|
+
Commands:
|
|
725
|
+
list List access service tokens
|
|
726
|
+
create Create a service token
|
|
727
|
+
update Update a service token
|
|
728
|
+
delete Delete a service token
|
|
729
|
+
rotate Rotate a service token secret
|
|
730
|
+
|
|
731
|
+
Run 'cf access service-tokens <command> --help' for more information.`;var vf=p(()=>{f();Cf();$f();Uf();zf();bf()});async function Df(s,e){let{basePath:n}=await b(s,e),o=await e.client.get(`${n}/groups`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"include",header:"Include Rules",width:14,transform:(r)=>Array.isArray(r)?String(r.length):"0"},{key:"created_at",header:"Created",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var Sf=p(()=>{S()});async function qf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <group-id> is required.");let r=await e.client.get(`${n}/groups/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,"Include Rules":r.include?.length??0,"Exclude Rules":r.exclude?.length??0,"Require Rules":r.require?.length??0,Created:r.created_at??"",Updated:r.updated_at??""})}var Af=p(()=>{S();f()});async function Lf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"file");if(!t)throw new i("--file <group-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/groups`,m);e.output.success(`Access group created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name})}var Nf=p(()=>{S();f()});async function Ef(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <group-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <group-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/groups/${encodeURIComponent(t)}`,c);e.output.success(`Access group ${t} updated.`),e.output.detail({ID:l.id,Name:l.name})}var Gf=p(()=>{S();f()});async function Mf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <group-id> is required.");if(!await C(`Delete access group ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/groups/${encodeURIComponent(t)}`),e.output.success(`Access group ${t} deleted.`)}var Tf=p(()=>{S();f();U()});async function Of(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Df(o,e);case"get":case"show":return qf(o,e);case"create":case"add":return Lf(o,e);case"update":case"set":return Ef(o,e);case"delete":case"rm":case"remove":return Mf(o,e);case void 0:case"--help":case"-h":e.output.raw(Zf);return;default:throw new i(`Unknown access groups command: "${n}"
|
|
732
|
+
|
|
733
|
+
${Zf}`)}}var Zf=`Usage: cf access groups <command>
|
|
734
|
+
|
|
735
|
+
Commands:
|
|
736
|
+
list List access groups
|
|
737
|
+
get Get an access group
|
|
738
|
+
create Create an access group
|
|
739
|
+
update Update an access group
|
|
740
|
+
delete Delete an access group
|
|
741
|
+
|
|
742
|
+
Run 'cf access groups <command> --help' for more information.`;var jf=p(()=>{f();Sf();Af();Nf();Gf();Tf()});async function Jf(s,e){let{basePath:n}=await b(s,e),o=await e.client.get(`${n}/users`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:24},{key:"email",header:"Email",width:30},{key:"access_seat",header:"Access Seat",width:12,transform:(r)=>r?"yes":"no"},{key:"last_successful_login",header:"Last Login",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var Bf=p(()=>{S()});async function Hf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"userId");if(!t)throw new i("--user-id <user-id> is required.");let r=await e.client.get(`${n}/users/${encodeURIComponent(t)}/failed_logins`);e.output.json(r)}var Vf=p(()=>{S();f()});async function Wf(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"userId");if(!t)throw new i("--user-id <user-id> is required.");let r=await e.client.get(`${n}/users/${encodeURIComponent(t)}/active_sessions`);e.output.json(r)}var Kf=p(()=>{S();f()});async function Yf(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Jf(o,e);case"sessions":return Hf(o,e);case"active-sessions":return Wf(o,e);case void 0:case"--help":case"-h":e.output.raw(Qf);return;default:throw new i(`Unknown access users command: "${n}"
|
|
743
|
+
|
|
744
|
+
${Qf}`)}}var Qf=`Usage: cf access users <command>
|
|
745
|
+
|
|
746
|
+
Commands:
|
|
747
|
+
list List access users
|
|
748
|
+
sessions List user failed login sessions
|
|
749
|
+
active-sessions List user active sessions
|
|
750
|
+
|
|
751
|
+
Run 'cf access users <command> --help' for more information.`;var Xf=p(()=>{f();Bf();Vf();Kf()});async function Ff(s,e){let{basePath:n}=await b(s,e),o=await e.client.get(`${n}/certificates`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"fingerprint",header:"Fingerprint",width:20},{key:"associated_hostnames",header:"Hostnames",width:30,transform:(r)=>Array.isArray(r)?r.join(", "):""},{key:"expires_on",header:"Expires",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var xf=p(()=>{S()});async function el(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"file");if(!t)throw new i("--file <cert-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/certificates`,m);e.output.success(`Access certificate created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Fingerprint:c.fingerprint??"",Hostnames:c.associated_hostnames?.join(", ")??""})}var ol=p(()=>{S();f()});async function nl(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <cert-id> is required.");if(!await C(`Delete access certificate ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/certificates/${encodeURIComponent(t)}`),e.output.success(`Access certificate ${t} deleted.`)}var tl=p(()=>{S();f();U()});async function il(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ff(o,e);case"create":case"add":return el(o,e);case"delete":case"rm":case"remove":return nl(o,e);case void 0:case"--help":case"-h":e.output.raw(rl);return;default:throw new i(`Unknown access certificates command: "${n}"
|
|
752
|
+
|
|
753
|
+
${rl}`)}}var rl=`Usage: cf access certificates <command>
|
|
754
|
+
|
|
755
|
+
Commands:
|
|
756
|
+
list List access certificates (mTLS)
|
|
757
|
+
create Create an access certificate
|
|
758
|
+
delete Delete an access certificate
|
|
759
|
+
|
|
760
|
+
Run 'cf access certificates <command> --help' for more information.`;var sl=p(()=>{f();xf();ol();tl()});async function al(s,e){let{basePath:n}=await b(s,e),o=await e.client.get(`${n}/identity_providers`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"type",header:"Type",width:20},{key:"created_at",header:"Created",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var ml=p(()=>{S()});async function dl(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <idp-id> is required.");let r=await e.client.get(`${n}/identity_providers/${encodeURIComponent(t)}`);if(e.output.detail({ID:r.id,Name:r.name,Type:r.type,Created:r.created_at??"",Updated:r.updated_at??""}),r.config)e.output.json(r.config)}var cl=p(()=>{S();f()});async function pl(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"file");if(!t)throw new i("--file <idp-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/identity_providers`,m);e.output.success(`Identity provider created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Type:c.type})}var ul=p(()=>{S();f()});async function fl(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <idp-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <idp-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/identity_providers/${encodeURIComponent(t)}`,c);e.output.success(`Identity provider ${t} updated.`),e.output.detail({ID:l.id,Name:l.name,Type:l.type})}var ll=p(()=>{S();f()});async function wl(s,e){let{basePath:n,flags:o}=await b(s,e),t=a(o,"id");if(!t)throw new i("--id <idp-id> is required.");if(!await C(`Delete identity provider ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/identity_providers/${encodeURIComponent(t)}`),e.output.success(`Identity provider ${t} deleted.`)}var hl=p(()=>{S();f();U()});async function Cl(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return al(o,e);case"get":case"show":return dl(o,e);case"create":case"add":return pl(o,e);case"update":case"set":return fl(o,e);case"delete":case"rm":case"remove":return wl(o,e);case void 0:case"--help":case"-h":e.output.raw(yl);return;default:throw new i(`Unknown access idps command: "${n}"
|
|
761
|
+
|
|
762
|
+
${yl}`)}}var yl=`Usage: cf access idps <command>
|
|
763
|
+
|
|
764
|
+
Commands:
|
|
765
|
+
list List identity providers
|
|
766
|
+
get Get an identity provider
|
|
767
|
+
create Create an identity provider
|
|
768
|
+
update Update an identity provider
|
|
769
|
+
delete Delete an identity provider
|
|
770
|
+
|
|
771
|
+
Run 'cf access idps <command> --help' for more information.`;var gl=p(()=>{f();ml();cl();ul();ll();hl()});var kl={};z(kl,{run:()=>QG});async function QG(s,e){let[n,...o]=s;switch(n){case"apps":case"app":case"applications":return of(o,e);case"policies":case"policy":return wf(o,e);case"service-tokens":case"service-token":case"tokens":return If(o,e);case"groups":case"group":return Of(o,e);case"users":case"user":return Yf(o,e);case"certificates":case"certificate":case"certs":case"cert":return il(o,e);case"idps":case"idp":case"identity-providers":return Cl(o,e);case void 0:case"--help":case"-h":e.output.raw($l);return;default:throw new i(`Unknown access command: "${n}"
|
|
772
|
+
|
|
773
|
+
${$l}`)}}var $l=`Usage: cf access <command>
|
|
774
|
+
|
|
775
|
+
Commands:
|
|
776
|
+
apps Manage Access applications
|
|
777
|
+
policies Manage Access policies
|
|
778
|
+
service-tokens Manage Access service tokens
|
|
779
|
+
groups Manage Access groups
|
|
780
|
+
users View Access users and sessions
|
|
781
|
+
certificates Manage Access mTLS certificates
|
|
782
|
+
idps Manage Access identity providers
|
|
783
|
+
|
|
784
|
+
Run 'cf access <command> --help' for more information.`;var Ul=p(()=>{f();nf();hf();vf();jf();Xf();sl();gl()});async function A(s,e){let{flags:n}=d(s),o=a(n,"accountId"),t=await u(o,e.client,e.config);return{basePath:`/accounts/${encodeURIComponent(t)}/gateway`,accountId:t,flags:n}}var T=p(()=>{h()});async function _l(s,e){let{basePath:n}=await A(s,e),t=(await e.client.get(`${n}/rules`)).filter((m)=>m.filters?.includes("dns")??!1),r=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"action",header:"Action",width:12},{key:"precedence",header:"Precedence",width:10},{key:"enabled",header:"Enabled",width:8,transform:(m)=>m?"yes":"no"},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):""}];e.output.table(t,r)}var zl=p(()=>{T()});async function Rl(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"file");if(!t)throw new i("--file <policy-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/rules`,m);e.output.success(`Gateway DNS policy created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Action:c.action,Precedence:c.precedence??""})}var bl=p(()=>{T();f()});async function Pl(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"id");if(!t)throw new i("--id <policy-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <policy-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/rules/${encodeURIComponent(t)}`,c);e.output.success(`Gateway DNS policy ${t} updated.`),e.output.detail({ID:l.id,Name:l.name,Action:l.action})}var Il=p(()=>{T();f()});async function vl(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"id");if(!t)throw new i("--id <policy-id> is required.");if(!await C(`Delete gateway DNS policy ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/rules/${encodeURIComponent(t)}`),e.output.success(`Gateway DNS policy ${t} deleted.`)}var Dl=p(()=>{T();f();U()});async function ql(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _l(o,e);case"create":case"add":return Rl(o,e);case"update":case"set":return Pl(o,e);case"delete":case"rm":case"remove":return vl(o,e);case void 0:case"--help":case"-h":e.output.raw(Sl);return;default:throw new i(`Unknown gateway dns policies command: "${n}"
|
|
785
|
+
|
|
786
|
+
${Sl}`)}}var Sl=`Usage: cf gateway dns policies <command>
|
|
787
|
+
|
|
788
|
+
Commands:
|
|
789
|
+
list List gateway DNS policies
|
|
790
|
+
create Create a gateway DNS policy
|
|
791
|
+
update Update a gateway DNS policy
|
|
792
|
+
delete Delete a gateway DNS policy
|
|
793
|
+
|
|
794
|
+
Run 'cf gateway dns policies <command> --help' for more information.`;var Al=p(()=>{f();zl();bl();Il();Dl()});async function Nl(s,e){let[n,...o]=s;switch(n){case"policies":case"policy":return ql(o,e);case void 0:case"--help":case"-h":e.output.raw(Ll);return;default:throw new i(`Unknown gateway dns command: "${n}"
|
|
795
|
+
|
|
796
|
+
${Ll}`)}}var Ll=`Usage: cf gateway dns <command>
|
|
797
|
+
|
|
798
|
+
Commands:
|
|
799
|
+
policies Manage gateway DNS policies
|
|
800
|
+
|
|
801
|
+
Run 'cf gateway dns <command> --help' for more information.`;var El=p(()=>{f();Al()});async function Gl(s,e){let{basePath:n}=await A(s,e),t=(await e.client.get(`${n}/rules`)).filter((m)=>m.filters?.includes("http")??!1),r=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"action",header:"Action",width:12},{key:"precedence",header:"Precedence",width:10},{key:"enabled",header:"Enabled",width:8,transform:(m)=>m?"yes":"no"},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):""}];e.output.table(t,r)}var Ml=p(()=>{T()});async function Tl(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"file");if(!t)throw new i("--file <policy-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/rules`,m);e.output.success(`Gateway HTTP policy created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Action:c.action,Precedence:c.precedence??""})}var Zl=p(()=>{T();f()});async function Ol(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"id");if(!t)throw new i("--id <policy-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <policy-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/rules/${encodeURIComponent(t)}`,c);e.output.success(`Gateway HTTP policy ${t} updated.`),e.output.detail({ID:l.id,Name:l.name,Action:l.action})}var jl=p(()=>{T();f()});async function Jl(s,e){let{basePath:n,flags:o}=await A(s,e),t=a(o,"id");if(!t)throw new i("--id <policy-id> is required.");if(!await C(`Delete gateway HTTP policy ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/rules/${encodeURIComponent(t)}`),e.output.success(`Gateway HTTP policy ${t} deleted.`)}var Bl=p(()=>{T();f();U()});async function Vl(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Gl(o,e);case"create":case"add":return Tl(o,e);case"update":case"set":return Ol(o,e);case"delete":case"rm":case"remove":return Jl(o,e);case void 0:case"--help":case"-h":e.output.raw(Hl);return;default:throw new i(`Unknown gateway http policies command: "${n}"
|
|
802
|
+
|
|
803
|
+
${Hl}`)}}var Hl=`Usage: cf gateway http policies <command>
|
|
804
|
+
|
|
805
|
+
Commands:
|
|
806
|
+
list List gateway HTTP policies
|
|
807
|
+
create Create a gateway HTTP policy
|
|
808
|
+
update Update a gateway HTTP policy
|
|
809
|
+
delete Delete a gateway HTTP policy
|
|
810
|
+
|
|
811
|
+
Run 'cf gateway http policies <command> --help' for more information.`;var Wl=p(()=>{f();Ml();Zl();jl();Bl()});async function Ql(s,e){let[n,...o]=s;switch(n){case"policies":case"policy":return Vl(o,e);case void 0:case"--help":case"-h":e.output.raw(Kl);return;default:throw new i(`Unknown gateway http command: "${n}"
|
|
812
|
+
|
|
813
|
+
${Kl}`)}}var Kl=`Usage: cf gateway http <command>
|
|
814
|
+
|
|
815
|
+
Commands:
|
|
816
|
+
policies Manage gateway HTTP policies
|
|
817
|
+
|
|
818
|
+
Run 'cf gateway http <command> --help' for more information.`;var Yl=p(()=>{f();Wl()});async function Xl(s,e){let{basePath:n}=await A(s,e),t=(await e.client.get(`${n}/rules`)).filter((m)=>m.filters?.includes("l4")??!1),r=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"action",header:"Action",width:12},{key:"precedence",header:"Precedence",width:10},{key:"enabled",header:"Enabled",width:8,transform:(m)=>m?"yes":"no"},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):""}];e.output.table(t,r)}var Fl=p(()=>{T()});async function ew(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Xl(o,e);case void 0:case"--help":case"-h":e.output.raw(xl);return;default:throw new i(`Unknown gateway network policies command: "${n}"
|
|
819
|
+
|
|
820
|
+
${xl}`)}}var xl=`Usage: cf gateway network policies <command>
|
|
821
|
+
|
|
822
|
+
Commands:
|
|
823
|
+
list List gateway network policies
|
|
824
|
+
|
|
825
|
+
Run 'cf gateway network policies <command> --help' for more information.`;var ow=p(()=>{f();Fl()});async function tw(s,e){let[n,...o]=s;switch(n){case"policies":case"policy":return ew(o,e);case void 0:case"--help":case"-h":e.output.raw(nw);return;default:throw new i(`Unknown gateway network command: "${n}"
|
|
826
|
+
|
|
827
|
+
${nw}`)}}var nw=`Usage: cf gateway network <command>
|
|
828
|
+
|
|
829
|
+
Commands:
|
|
830
|
+
policies List gateway network policies
|
|
831
|
+
|
|
832
|
+
Run 'cf gateway network <command> --help' for more information.`;var rw=p(()=>{f();ow()});async function iw(s,e){let{accountId:n}=await A(s,e),o=await e.client.get(`/accounts/${encodeURIComponent(n)}/dlp/profiles`),t=[{key:"id",header:"ID",width:38},{key:"name",header:"Name",width:30},{key:"type",header:"Type",width:12},{key:"entries",header:"Entries",width:8,transform:(r)=>Array.isArray(r)?String(r.length):"0"},{key:"created_at",header:"Created",width:12,transform:(r)=>r?String(r).slice(0,10):""}];e.output.table(o,t)}var sw=p(()=>{T()});async function aw(s,e){let{accountId:n,flags:o}=await A(s,e),t=a(o,"file");if(!t)throw new i("--file <dlp-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`/accounts/${encodeURIComponent(n)}/dlp/profiles/custom`,m);e.output.success(`DLP profile created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,Type:c.type??""})}var mw=p(()=>{T();f()});async function dw(s,e){let{accountId:n,flags:o}=await A(s,e),t=a(o,"id");if(!t)throw new i("--id <profile-id> is required.");if(!await C(`Delete DLP profile ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(n)}/dlp/profiles/custom/${encodeURIComponent(t)}`),e.output.success(`DLP profile ${t} deleted.`)}var cw=p(()=>{T();f();U()});async function uw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return iw(o,e);case"create":case"add":return aw(o,e);case"delete":case"rm":case"remove":return dw(o,e);case void 0:case"--help":case"-h":e.output.raw(pw);return;default:throw new i(`Unknown gateway dlp profiles command: "${n}"
|
|
833
|
+
|
|
834
|
+
${pw}`)}}var pw=`Usage: cf gateway dlp profiles <command>
|
|
835
|
+
|
|
836
|
+
Commands:
|
|
837
|
+
list List DLP profiles
|
|
838
|
+
create Create a custom DLP profile
|
|
839
|
+
delete Delete a custom DLP profile
|
|
840
|
+
|
|
841
|
+
Run 'cf gateway dlp profiles <command> --help' for more information.`;var fw=p(()=>{f();sw();mw();cw()});async function ww(s,e){let[n,...o]=s;switch(n){case"profiles":case"profile":return uw(o,e);case void 0:case"--help":case"-h":e.output.raw(lw);return;default:throw new i(`Unknown gateway dlp command: "${n}"
|
|
842
|
+
|
|
843
|
+
${lw}`)}}var lw=`Usage: cf gateway dlp <command>
|
|
844
|
+
|
|
845
|
+
Commands:
|
|
846
|
+
profiles Manage DLP profiles
|
|
847
|
+
|
|
848
|
+
Run 'cf gateway dlp <command> --help' for more information.`;var hw=p(()=>{f();fw()});var Cw={};z(Cw,{run:()=>hM});async function hM(s,e){let[n,...o]=s;switch(n){case"dns":return Nl(o,e);case"http":return Ql(o,e);case"network":return tw(o,e);case"dlp":return ww(o,e);case void 0:case"--help":case"-h":e.output.raw(yw);return;default:throw new i(`Unknown gateway command: "${n}"
|
|
849
|
+
|
|
850
|
+
${yw}`)}}var yw=`Usage: cf gateway <command>
|
|
851
|
+
|
|
852
|
+
Commands:
|
|
853
|
+
dns Manage Gateway DNS policies
|
|
854
|
+
http Manage Gateway HTTP policies
|
|
855
|
+
network Manage Gateway network policies
|
|
856
|
+
dlp Manage Gateway DLP profiles
|
|
857
|
+
|
|
858
|
+
Run 'cf gateway <command> --help' for more information.`;var gw=p(()=>{f();El();Yl();rw();hw()});function $w(){return`#!/usr/bin/env bash
|
|
859
|
+
# cf CLI bash completion
|
|
860
|
+
# Install: cf completion bash >> ~/.bashrc && source ~/.bashrc
|
|
861
|
+
|
|
862
|
+
_cf_completions() {
|
|
863
|
+
local cur prev words cword
|
|
864
|
+
_init_completion -n = || return
|
|
865
|
+
|
|
866
|
+
local commands="zones dns accounts user cache config completion"
|
|
867
|
+
local global_flags="--profile --output --raw --verbose --quiet --no-color --yes --help"
|
|
868
|
+
|
|
869
|
+
# Zone subcommands
|
|
870
|
+
local zones_cmds="list get create delete"
|
|
871
|
+
local zones_list_flags="--account-id --name --status --page --per-page --all"
|
|
872
|
+
local zones_get_flags="--id --name"
|
|
873
|
+
local zones_create_flags="--name --account-id --jump-start --type"
|
|
874
|
+
local zones_delete_flags="--id --yes"
|
|
875
|
+
|
|
876
|
+
# DNS subcommands
|
|
877
|
+
local dns_cmds="list get create update patch delete import export"
|
|
878
|
+
local dns_list_flags="--zone --type --name --content --page --per-page --all"
|
|
879
|
+
local dns_get_flags="--zone --id"
|
|
880
|
+
local dns_create_flags="--zone --type --name --content --ttl --proxied --priority --comment"
|
|
881
|
+
local dns_update_flags="--zone --id --type --name --content --ttl --proxied --priority"
|
|
882
|
+
local dns_patch_flags="--zone --id --content --ttl --proxied --comment"
|
|
883
|
+
local dns_delete_flags="--zone --id --yes"
|
|
884
|
+
local dns_import_flags="--zone --file --proxied"
|
|
885
|
+
local dns_export_flags="--zone"
|
|
886
|
+
|
|
887
|
+
# Accounts subcommands
|
|
888
|
+
local accounts_cmds="list get"
|
|
889
|
+
local accounts_list_flags="--page --per-page"
|
|
890
|
+
local accounts_get_flags="--id"
|
|
891
|
+
|
|
892
|
+
# User subcommands
|
|
893
|
+
local user_cmds="get token"
|
|
894
|
+
local user_token_cmds="verify"
|
|
895
|
+
|
|
896
|
+
# Cache subcommands
|
|
897
|
+
local cache_cmds="purge"
|
|
898
|
+
local cache_purge_flags="--zone --everything --urls --tags --hosts --prefixes --yes"
|
|
899
|
+
|
|
900
|
+
# Config subcommands
|
|
901
|
+
local config_cmds="set get list delete use"
|
|
902
|
+
local config_set_flags="--profile --token --api-key --email --account-id --zone-id --output"
|
|
903
|
+
local config_get_flags="--profile"
|
|
904
|
+
local config_delete_flags="--profile --yes"
|
|
905
|
+
|
|
906
|
+
# Completion subcommands
|
|
907
|
+
local completion_cmds="bash zsh fish"
|
|
908
|
+
|
|
909
|
+
# Determine context based on word position
|
|
910
|
+
case "\${cword}" in
|
|
911
|
+
1)
|
|
912
|
+
COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
|
|
913
|
+
return
|
|
914
|
+
;;
|
|
915
|
+
2)
|
|
916
|
+
case "\${words[1]}" in
|
|
917
|
+
zones) COMPREPLY=( $(compgen -W "\${zones_cmds}" -- "\${cur}") ) ;;
|
|
918
|
+
dns) COMPREPLY=( $(compgen -W "\${dns_cmds}" -- "\${cur}") ) ;;
|
|
919
|
+
accounts) COMPREPLY=( $(compgen -W "\${accounts_cmds}" -- "\${cur}") ) ;;
|
|
920
|
+
user) COMPREPLY=( $(compgen -W "\${user_cmds}" -- "\${cur}") ) ;;
|
|
921
|
+
cache) COMPREPLY=( $(compgen -W "\${cache_cmds}" -- "\${cur}") ) ;;
|
|
922
|
+
config) COMPREPLY=( $(compgen -W "\${config_cmds}" -- "\${cur}") ) ;;
|
|
923
|
+
completion) COMPREPLY=( $(compgen -W "\${completion_cmds}" -- "\${cur}") ) ;;
|
|
924
|
+
esac
|
|
925
|
+
return
|
|
926
|
+
;;
|
|
927
|
+
*)
|
|
928
|
+
# Provide flag completions based on command context
|
|
929
|
+
local cmd1="\${words[1]}"
|
|
930
|
+
local cmd2="\${words[2]}"
|
|
931
|
+
local flags=""
|
|
932
|
+
|
|
933
|
+
case "\${cmd1}" in
|
|
934
|
+
zones)
|
|
935
|
+
case "\${cmd2}" in
|
|
936
|
+
list) flags="\${zones_list_flags}" ;;
|
|
937
|
+
get) flags="\${zones_get_flags}" ;;
|
|
938
|
+
create) flags="\${zones_create_flags}" ;;
|
|
939
|
+
delete) flags="\${zones_delete_flags}" ;;
|
|
940
|
+
esac
|
|
941
|
+
;;
|
|
942
|
+
dns)
|
|
943
|
+
case "\${cmd2}" in
|
|
944
|
+
list) flags="\${dns_list_flags}" ;;
|
|
945
|
+
get) flags="\${dns_get_flags}" ;;
|
|
946
|
+
create) flags="\${dns_create_flags}" ;;
|
|
947
|
+
update) flags="\${dns_update_flags}" ;;
|
|
948
|
+
patch) flags="\${dns_patch_flags}" ;;
|
|
949
|
+
delete) flags="\${dns_delete_flags}" ;;
|
|
950
|
+
import) flags="\${dns_import_flags}" ;;
|
|
951
|
+
export) flags="\${dns_export_flags}" ;;
|
|
952
|
+
esac
|
|
953
|
+
;;
|
|
954
|
+
accounts)
|
|
955
|
+
case "\${cmd2}" in
|
|
956
|
+
list) flags="\${accounts_list_flags}" ;;
|
|
957
|
+
get) flags="\${accounts_get_flags}" ;;
|
|
958
|
+
esac
|
|
959
|
+
;;
|
|
960
|
+
user)
|
|
961
|
+
if [[ "\${cmd2}" == "token" ]] && [[ "\${cword}" -eq 3 ]]; then
|
|
962
|
+
COMPREPLY=( $(compgen -W "\${user_token_cmds}" -- "\${cur}") )
|
|
963
|
+
return
|
|
964
|
+
fi
|
|
965
|
+
;;
|
|
966
|
+
cache)
|
|
967
|
+
case "\${cmd2}" in
|
|
968
|
+
purge) flags="\${cache_purge_flags}" ;;
|
|
969
|
+
esac
|
|
970
|
+
;;
|
|
971
|
+
config)
|
|
972
|
+
case "\${cmd2}" in
|
|
973
|
+
set) flags="\${config_set_flags}" ;;
|
|
974
|
+
get) flags="\${config_get_flags}" ;;
|
|
975
|
+
delete) flags="\${config_delete_flags}" ;;
|
|
976
|
+
esac
|
|
977
|
+
;;
|
|
978
|
+
esac
|
|
979
|
+
|
|
980
|
+
COMPREPLY=( $(compgen -W "\${flags} \${global_flags}" -- "\${cur}") )
|
|
981
|
+
return
|
|
982
|
+
;;
|
|
983
|
+
esac
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
complete -F _cf_completions cf
|
|
987
|
+
`}function kw(){return`#compdef cf
|
|
988
|
+
# cf CLI zsh completion
|
|
989
|
+
# Install: cf completion zsh >> ~/.zshrc && source ~/.zshrc
|
|
990
|
+
|
|
991
|
+
_cf() {
|
|
992
|
+
local -a commands
|
|
993
|
+
commands=(
|
|
994
|
+
'zones:Manage Cloudflare zones'
|
|
995
|
+
'dns:Manage DNS records'
|
|
996
|
+
'accounts:Manage accounts'
|
|
997
|
+
'user:User and token operations'
|
|
998
|
+
'cache:Cache management'
|
|
999
|
+
'config:CLI configuration'
|
|
1000
|
+
'completion:Generate shell completions'
|
|
1001
|
+
)
|
|
1002
|
+
|
|
1003
|
+
local -a global_flags
|
|
1004
|
+
global_flags=(
|
|
1005
|
+
'--profile[Profile name]:profile:'
|
|
1006
|
+
'--output[Output format]:format:(table json csv yaml)'
|
|
1007
|
+
'--raw[Show raw API response]'
|
|
1008
|
+
'--verbose[Verbose output]'
|
|
1009
|
+
'--quiet[Suppress output]'
|
|
1010
|
+
'--no-color[Disable color output]'
|
|
1011
|
+
'--yes[Skip confirmations]'
|
|
1012
|
+
'--help[Show help]'
|
|
1013
|
+
)
|
|
1014
|
+
|
|
1015
|
+
_arguments -C \\
|
|
1016
|
+
'1:command:->command' \\
|
|
1017
|
+
'*::arg:->args' \\
|
|
1018
|
+
\${global_flags[@]}
|
|
1019
|
+
|
|
1020
|
+
case $state in
|
|
1021
|
+
command)
|
|
1022
|
+
_describe -t commands 'cf commands' commands
|
|
1023
|
+
;;
|
|
1024
|
+
args)
|
|
1025
|
+
case $words[1] in
|
|
1026
|
+
zones) _cf_zones ;;
|
|
1027
|
+
dns) _cf_dns ;;
|
|
1028
|
+
accounts) _cf_accounts ;;
|
|
1029
|
+
user) _cf_user ;;
|
|
1030
|
+
cache) _cf_cache ;;
|
|
1031
|
+
config) _cf_config ;;
|
|
1032
|
+
completion) _cf_completion ;;
|
|
1033
|
+
esac
|
|
1034
|
+
;;
|
|
1035
|
+
esac
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
_cf_zones() {
|
|
1039
|
+
local -a subcmds
|
|
1040
|
+
subcmds=(
|
|
1041
|
+
'list:List all zones'
|
|
1042
|
+
'get:Get zone details'
|
|
1043
|
+
'create:Create a new zone'
|
|
1044
|
+
'delete:Delete a zone'
|
|
1045
|
+
)
|
|
1046
|
+
|
|
1047
|
+
_arguments -C \\
|
|
1048
|
+
'1:subcommand:->subcmd' \\
|
|
1049
|
+
'*::arg:->args'
|
|
1050
|
+
|
|
1051
|
+
case $state in
|
|
1052
|
+
subcmd)
|
|
1053
|
+
_describe -t subcmds 'zones commands' subcmds
|
|
1054
|
+
;;
|
|
1055
|
+
args)
|
|
1056
|
+
case $words[1] in
|
|
1057
|
+
list)
|
|
1058
|
+
_arguments \\
|
|
1059
|
+
'--account-id[Filter by account ID]:id:' \\
|
|
1060
|
+
'--name[Filter by zone name]:name:' \\
|
|
1061
|
+
'--status[Filter by status]:status:(active pending initializing moved deleted deactivated read_only)' \\
|
|
1062
|
+
'--page[Page number]:page:' \\
|
|
1063
|
+
'--per-page[Results per page]:count:' \\
|
|
1064
|
+
'--all[Fetch all pages]'
|
|
1065
|
+
;;
|
|
1066
|
+
get)
|
|
1067
|
+
_arguments \\
|
|
1068
|
+
'--id[Zone ID]:id:' \\
|
|
1069
|
+
'--name[Zone domain name]:name:'
|
|
1070
|
+
;;
|
|
1071
|
+
create)
|
|
1072
|
+
_arguments \\
|
|
1073
|
+
'--name[Domain name]:name:' \\
|
|
1074
|
+
'--account-id[Account ID]:id:' \\
|
|
1075
|
+
'--jump-start[Enable jump start]' \\
|
|
1076
|
+
'--type[Zone type]:type:(full partial secondary)'
|
|
1077
|
+
;;
|
|
1078
|
+
delete)
|
|
1079
|
+
_arguments \\
|
|
1080
|
+
'--id[Zone ID]:id:' \\
|
|
1081
|
+
'--yes[Skip confirmation]'
|
|
1082
|
+
;;
|
|
1083
|
+
esac
|
|
1084
|
+
;;
|
|
1085
|
+
esac
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
_cf_dns() {
|
|
1089
|
+
local -a subcmds
|
|
1090
|
+
subcmds=(
|
|
1091
|
+
'list:List DNS records'
|
|
1092
|
+
'get:Get a DNS record'
|
|
1093
|
+
'create:Create a DNS record'
|
|
1094
|
+
'update:Full update a DNS record'
|
|
1095
|
+
'patch:Partial update a DNS record'
|
|
1096
|
+
'delete:Delete a DNS record'
|
|
1097
|
+
'import:Import DNS records from BIND file'
|
|
1098
|
+
'export:Export DNS records as BIND format'
|
|
1099
|
+
)
|
|
1100
|
+
|
|
1101
|
+
_arguments -C \\
|
|
1102
|
+
'1:subcommand:->subcmd' \\
|
|
1103
|
+
'*::arg:->args'
|
|
1104
|
+
|
|
1105
|
+
case $state in
|
|
1106
|
+
subcmd)
|
|
1107
|
+
_describe -t subcmds 'dns commands' subcmds
|
|
1108
|
+
;;
|
|
1109
|
+
args)
|
|
1110
|
+
case $words[1] in
|
|
1111
|
+
list)
|
|
1112
|
+
_arguments \\
|
|
1113
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1114
|
+
'--type[Record type]:type:(A AAAA CAA CERT CNAME DNSKEY DS HTTPS LOC MX NAPTR NS PTR SMIMEA SRV SSHFP SVCB TLSA TXT URI)' \\
|
|
1115
|
+
'--name[Record name]:name:' \\
|
|
1116
|
+
'--content[Record content]:content:' \\
|
|
1117
|
+
'--page[Page number]:page:' \\
|
|
1118
|
+
'--per-page[Results per page]:count:' \\
|
|
1119
|
+
'--all[Fetch all pages]'
|
|
1120
|
+
;;
|
|
1121
|
+
get)
|
|
1122
|
+
_arguments \\
|
|
1123
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1124
|
+
'--id[Record ID]:id:'
|
|
1125
|
+
;;
|
|
1126
|
+
create)
|
|
1127
|
+
_arguments \\
|
|
1128
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1129
|
+
'--type[Record type]:type:(A AAAA CAA CERT CNAME DNSKEY DS HTTPS LOC MX NAPTR NS PTR SMIMEA SRV SSHFP SVCB TLSA TXT URI)' \\
|
|
1130
|
+
'--name[Record name]:name:' \\
|
|
1131
|
+
'--content[Record content]:content:' \\
|
|
1132
|
+
'--ttl[TTL (1=auto, 60-86400)]:ttl:' \\
|
|
1133
|
+
'--proxied[Enable Cloudflare proxy]' \\
|
|
1134
|
+
'--priority[MX/SRV priority]:priority:' \\
|
|
1135
|
+
'--comment[Record comment]:comment:'
|
|
1136
|
+
;;
|
|
1137
|
+
update)
|
|
1138
|
+
_arguments \\
|
|
1139
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1140
|
+
'--id[Record ID]:id:' \\
|
|
1141
|
+
'--type[Record type]:type:(A AAAA CAA CERT CNAME DNSKEY DS HTTPS LOC MX NAPTR NS PTR SMIMEA SRV SSHFP SVCB TLSA TXT URI)' \\
|
|
1142
|
+
'--name[Record name]:name:' \\
|
|
1143
|
+
'--content[Record content]:content:' \\
|
|
1144
|
+
'--ttl[TTL]:ttl:' \\
|
|
1145
|
+
'--proxied[Enable Cloudflare proxy]' \\
|
|
1146
|
+
'--priority[MX/SRV priority]:priority:'
|
|
1147
|
+
;;
|
|
1148
|
+
patch)
|
|
1149
|
+
_arguments \\
|
|
1150
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1151
|
+
'--id[Record ID]:id:' \\
|
|
1152
|
+
'--content[Record content]:content:' \\
|
|
1153
|
+
'--ttl[TTL]:ttl:' \\
|
|
1154
|
+
'--proxied[Enable Cloudflare proxy]' \\
|
|
1155
|
+
'--comment[Record comment]:comment:'
|
|
1156
|
+
;;
|
|
1157
|
+
delete)
|
|
1158
|
+
_arguments \\
|
|
1159
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1160
|
+
'--id[Record ID]:id:' \\
|
|
1161
|
+
'--yes[Skip confirmation]'
|
|
1162
|
+
;;
|
|
1163
|
+
import)
|
|
1164
|
+
_arguments \\
|
|
1165
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1166
|
+
'--file[BIND file path]:file:_files' \\
|
|
1167
|
+
'--proxied[Proxy imported records]'
|
|
1168
|
+
;;
|
|
1169
|
+
export)
|
|
1170
|
+
_arguments \\
|
|
1171
|
+
'--zone[Zone ID or name]:zone:'
|
|
1172
|
+
;;
|
|
1173
|
+
esac
|
|
1174
|
+
;;
|
|
1175
|
+
esac
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
_cf_accounts() {
|
|
1179
|
+
local -a subcmds
|
|
1180
|
+
subcmds=(
|
|
1181
|
+
'list:List all accounts'
|
|
1182
|
+
'get:Get account details'
|
|
1183
|
+
)
|
|
1184
|
+
|
|
1185
|
+
_arguments -C \\
|
|
1186
|
+
'1:subcommand:->subcmd' \\
|
|
1187
|
+
'*::arg:->args'
|
|
1188
|
+
|
|
1189
|
+
case $state in
|
|
1190
|
+
subcmd)
|
|
1191
|
+
_describe -t subcmds 'accounts commands' subcmds
|
|
1192
|
+
;;
|
|
1193
|
+
args)
|
|
1194
|
+
case $words[1] in
|
|
1195
|
+
list)
|
|
1196
|
+
_arguments \\
|
|
1197
|
+
'--page[Page number]:page:' \\
|
|
1198
|
+
'--per-page[Results per page]:count:'
|
|
1199
|
+
;;
|
|
1200
|
+
get)
|
|
1201
|
+
_arguments \\
|
|
1202
|
+
'--id[Account ID]:id:'
|
|
1203
|
+
;;
|
|
1204
|
+
esac
|
|
1205
|
+
;;
|
|
1206
|
+
esac
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
_cf_user() {
|
|
1210
|
+
local -a subcmds
|
|
1211
|
+
subcmds=(
|
|
1212
|
+
'get:Get current user details'
|
|
1213
|
+
'token:Token operations'
|
|
1214
|
+
)
|
|
1215
|
+
|
|
1216
|
+
_arguments -C \\
|
|
1217
|
+
'1:subcommand:->subcmd' \\
|
|
1218
|
+
'*::arg:->args'
|
|
1219
|
+
|
|
1220
|
+
case $state in
|
|
1221
|
+
subcmd)
|
|
1222
|
+
_describe -t subcmds 'user commands' subcmds
|
|
1223
|
+
;;
|
|
1224
|
+
args)
|
|
1225
|
+
case $words[1] in
|
|
1226
|
+
token)
|
|
1227
|
+
local -a token_subcmds
|
|
1228
|
+
token_subcmds=('verify:Verify token validity')
|
|
1229
|
+
_describe -t token_subcmds 'token commands' token_subcmds
|
|
1230
|
+
;;
|
|
1231
|
+
esac
|
|
1232
|
+
;;
|
|
1233
|
+
esac
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
_cf_cache() {
|
|
1237
|
+
local -a subcmds
|
|
1238
|
+
subcmds=(
|
|
1239
|
+
'purge:Purge cached content'
|
|
1240
|
+
)
|
|
1241
|
+
|
|
1242
|
+
_arguments -C \\
|
|
1243
|
+
'1:subcommand:->subcmd' \\
|
|
1244
|
+
'*::arg:->args'
|
|
1245
|
+
|
|
1246
|
+
case $state in
|
|
1247
|
+
subcmd)
|
|
1248
|
+
_describe -t subcmds 'cache commands' subcmds
|
|
1249
|
+
;;
|
|
1250
|
+
args)
|
|
1251
|
+
case $words[1] in
|
|
1252
|
+
purge)
|
|
1253
|
+
_arguments \\
|
|
1254
|
+
'--zone[Zone ID or name]:zone:' \\
|
|
1255
|
+
'--everything[Purge everything]' \\
|
|
1256
|
+
'--urls[URLs to purge (comma-separated)]:urls:' \\
|
|
1257
|
+
'--tags[Cache tags to purge]:tags:' \\
|
|
1258
|
+
'--hosts[Hosts to purge]:hosts:' \\
|
|
1259
|
+
'--prefixes[URL prefixes to purge]:prefixes:' \\
|
|
1260
|
+
'--yes[Skip confirmation]'
|
|
1261
|
+
;;
|
|
1262
|
+
esac
|
|
1263
|
+
;;
|
|
1264
|
+
esac
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
_cf_config() {
|
|
1268
|
+
local -a subcmds
|
|
1269
|
+
subcmds=(
|
|
1270
|
+
'set:Set profile configuration'
|
|
1271
|
+
'get:Show profile details'
|
|
1272
|
+
'list:List all profiles'
|
|
1273
|
+
'delete:Delete a profile'
|
|
1274
|
+
'use:Set default profile'
|
|
1275
|
+
)
|
|
1276
|
+
|
|
1277
|
+
_arguments -C \\
|
|
1278
|
+
'1:subcommand:->subcmd' \\
|
|
1279
|
+
'*::arg:->args'
|
|
1280
|
+
|
|
1281
|
+
case $state in
|
|
1282
|
+
subcmd)
|
|
1283
|
+
_describe -t subcmds 'config commands' subcmds
|
|
1284
|
+
;;
|
|
1285
|
+
args)
|
|
1286
|
+
case $words[1] in
|
|
1287
|
+
set)
|
|
1288
|
+
_arguments \\
|
|
1289
|
+
'--profile[Profile name]:name:' \\
|
|
1290
|
+
'--token[API token]:token:' \\
|
|
1291
|
+
'--api-key[API key]:key:' \\
|
|
1292
|
+
'--email[API email]:email:' \\
|
|
1293
|
+
'--account-id[Default account ID]:id:' \\
|
|
1294
|
+
'--zone-id[Default zone ID]:id:' \\
|
|
1295
|
+
'--output[Default output format]:format:(table json csv yaml)'
|
|
1296
|
+
;;
|
|
1297
|
+
get)
|
|
1298
|
+
_arguments \\
|
|
1299
|
+
'--profile[Profile name]:name:'
|
|
1300
|
+
;;
|
|
1301
|
+
delete)
|
|
1302
|
+
_arguments \\
|
|
1303
|
+
'--profile[Profile name]:name:' \\
|
|
1304
|
+
'--yes[Skip confirmation]'
|
|
1305
|
+
;;
|
|
1306
|
+
use)
|
|
1307
|
+
_arguments \\
|
|
1308
|
+
'1:profile name:'
|
|
1309
|
+
;;
|
|
1310
|
+
esac
|
|
1311
|
+
;;
|
|
1312
|
+
esac
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
_cf_completion() {
|
|
1316
|
+
local -a shells
|
|
1317
|
+
shells=(bash zsh fish)
|
|
1318
|
+
_describe -t shells 'shell' shells
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
compdef _cf cf
|
|
1322
|
+
`}function Uw(){return`# cf CLI fish completion
|
|
1323
|
+
# Install: cf completion fish > ~/.config/fish/completions/cf.fish
|
|
1324
|
+
|
|
1325
|
+
# Disable file completions by default
|
|
1326
|
+
complete -c cf -f
|
|
1327
|
+
|
|
1328
|
+
# Helper: no subcommand yet
|
|
1329
|
+
function __cf_no_subcommand
|
|
1330
|
+
set -l cmd (commandline -opc)
|
|
1331
|
+
test (count $cmd) -eq 1
|
|
1332
|
+
end
|
|
1333
|
+
|
|
1334
|
+
# Helper: check if specific subcommand is active
|
|
1335
|
+
function __cf_using_command
|
|
1336
|
+
set -l cmd (commandline -opc)
|
|
1337
|
+
if test (count $cmd) -ge 2
|
|
1338
|
+
if test "$cmd[2]" = "$argv[1]"
|
|
1339
|
+
return 0
|
|
1340
|
+
end
|
|
1341
|
+
end
|
|
1342
|
+
return 1
|
|
1343
|
+
end
|
|
1344
|
+
|
|
1345
|
+
# Helper: check two-level subcommand
|
|
1346
|
+
function __cf_using_subcommand
|
|
1347
|
+
set -l cmd (commandline -opc)
|
|
1348
|
+
if test (count $cmd) -ge 3
|
|
1349
|
+
if test "$cmd[2]" = "$argv[1]" -a "$cmd[3]" = "$argv[2]"
|
|
1350
|
+
return 0
|
|
1351
|
+
end
|
|
1352
|
+
end
|
|
1353
|
+
return 1
|
|
1354
|
+
end
|
|
1355
|
+
|
|
1356
|
+
# Global flags
|
|
1357
|
+
complete -c cf -l profile -d 'Profile name' -r
|
|
1358
|
+
complete -c cf -l output -d 'Output format' -r -a 'table json csv yaml'
|
|
1359
|
+
complete -c cf -l raw -d 'Show raw API response'
|
|
1360
|
+
complete -c cf -l verbose -d 'Verbose output'
|
|
1361
|
+
complete -c cf -l quiet -d 'Suppress output'
|
|
1362
|
+
complete -c cf -l no-color -d 'Disable color output'
|
|
1363
|
+
complete -c cf -l yes -d 'Skip confirmations'
|
|
1364
|
+
complete -c cf -l help -d 'Show help'
|
|
1365
|
+
|
|
1366
|
+
# Top-level commands
|
|
1367
|
+
complete -c cf -n __cf_no_subcommand -a zones -d 'Manage Cloudflare zones'
|
|
1368
|
+
complete -c cf -n __cf_no_subcommand -a dns -d 'Manage DNS records'
|
|
1369
|
+
complete -c cf -n __cf_no_subcommand -a accounts -d 'Manage accounts'
|
|
1370
|
+
complete -c cf -n __cf_no_subcommand -a user -d 'User and token operations'
|
|
1371
|
+
complete -c cf -n __cf_no_subcommand -a cache -d 'Cache management'
|
|
1372
|
+
complete -c cf -n __cf_no_subcommand -a config -d 'CLI configuration'
|
|
1373
|
+
complete -c cf -n __cf_no_subcommand -a completion -d 'Generate shell completions'
|
|
1374
|
+
|
|
1375
|
+
# --- Zones ---
|
|
1376
|
+
complete -c cf -n '__cf_using_command zones' -a list -d 'List all zones'
|
|
1377
|
+
complete -c cf -n '__cf_using_command zones' -a get -d 'Get zone details'
|
|
1378
|
+
complete -c cf -n '__cf_using_command zones' -a create -d 'Create a new zone'
|
|
1379
|
+
complete -c cf -n '__cf_using_command zones' -a delete -d 'Delete a zone'
|
|
1380
|
+
|
|
1381
|
+
# zones list
|
|
1382
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l account-id -d 'Filter by account ID' -r
|
|
1383
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l name -d 'Filter by zone name' -r
|
|
1384
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l status -d 'Filter by status' -r -a 'active pending initializing moved deleted deactivated read_only'
|
|
1385
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l page -d 'Page number' -r
|
|
1386
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l per-page -d 'Results per page' -r
|
|
1387
|
+
complete -c cf -n '__cf_using_subcommand zones list' -l all -d 'Fetch all pages'
|
|
1388
|
+
|
|
1389
|
+
# zones get
|
|
1390
|
+
complete -c cf -n '__cf_using_subcommand zones get' -l id -d 'Zone ID' -r
|
|
1391
|
+
complete -c cf -n '__cf_using_subcommand zones get' -l name -d 'Zone domain name' -r
|
|
1392
|
+
|
|
1393
|
+
# zones create
|
|
1394
|
+
complete -c cf -n '__cf_using_subcommand zones create' -l name -d 'Domain name' -r
|
|
1395
|
+
complete -c cf -n '__cf_using_subcommand zones create' -l account-id -d 'Account ID' -r
|
|
1396
|
+
complete -c cf -n '__cf_using_subcommand zones create' -l jump-start -d 'Enable jump start'
|
|
1397
|
+
complete -c cf -n '__cf_using_subcommand zones create' -l type -d 'Zone type' -r -a 'full partial secondary'
|
|
1398
|
+
|
|
1399
|
+
# zones delete
|
|
1400
|
+
complete -c cf -n '__cf_using_subcommand zones delete' -l id -d 'Zone ID' -r
|
|
1401
|
+
complete -c cf -n '__cf_using_subcommand zones delete' -l yes -d 'Skip confirmation'
|
|
1402
|
+
|
|
1403
|
+
# --- DNS ---
|
|
1404
|
+
complete -c cf -n '__cf_using_command dns' -a list -d 'List DNS records'
|
|
1405
|
+
complete -c cf -n '__cf_using_command dns' -a get -d 'Get a DNS record'
|
|
1406
|
+
complete -c cf -n '__cf_using_command dns' -a create -d 'Create a DNS record'
|
|
1407
|
+
complete -c cf -n '__cf_using_command dns' -a update -d 'Full update a DNS record'
|
|
1408
|
+
complete -c cf -n '__cf_using_command dns' -a patch -d 'Partial update a DNS record'
|
|
1409
|
+
complete -c cf -n '__cf_using_command dns' -a delete -d 'Delete a DNS record'
|
|
1410
|
+
complete -c cf -n '__cf_using_command dns' -a import -d 'Import DNS records'
|
|
1411
|
+
complete -c cf -n '__cf_using_command dns' -a export -d 'Export DNS records'
|
|
1412
|
+
|
|
1413
|
+
set -l dns_types 'A AAAA CAA CERT CNAME DNSKEY DS HTTPS LOC MX NAPTR NS PTR SMIMEA SRV SSHFP SVCB TLSA TXT URI'
|
|
1414
|
+
|
|
1415
|
+
# dns list
|
|
1416
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l zone -d 'Zone ID or name' -r
|
|
1417
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l type -d 'Record type' -r -a "$dns_types"
|
|
1418
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l name -d 'Record name' -r
|
|
1419
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l content -d 'Record content' -r
|
|
1420
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l page -d 'Page number' -r
|
|
1421
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l per-page -d 'Results per page' -r
|
|
1422
|
+
complete -c cf -n '__cf_using_subcommand dns list' -l all -d 'Fetch all pages'
|
|
1423
|
+
|
|
1424
|
+
# dns get
|
|
1425
|
+
complete -c cf -n '__cf_using_subcommand dns get' -l zone -d 'Zone ID or name' -r
|
|
1426
|
+
complete -c cf -n '__cf_using_subcommand dns get' -l id -d 'Record ID' -r
|
|
1427
|
+
|
|
1428
|
+
# dns create
|
|
1429
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l zone -d 'Zone ID or name' -r
|
|
1430
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l type -d 'Record type' -r -a "$dns_types"
|
|
1431
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l name -d 'Record name' -r
|
|
1432
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l content -d 'Record content' -r
|
|
1433
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l ttl -d 'TTL (1=auto)' -r
|
|
1434
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l proxied -d 'Enable proxy'
|
|
1435
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l priority -d 'Priority' -r
|
|
1436
|
+
complete -c cf -n '__cf_using_subcommand dns create' -l comment -d 'Comment' -r
|
|
1437
|
+
|
|
1438
|
+
# dns update
|
|
1439
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l zone -d 'Zone ID or name' -r
|
|
1440
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l id -d 'Record ID' -r
|
|
1441
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l type -d 'Record type' -r -a "$dns_types"
|
|
1442
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l name -d 'Record name' -r
|
|
1443
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l content -d 'Record content' -r
|
|
1444
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l ttl -d 'TTL' -r
|
|
1445
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l proxied -d 'Enable proxy'
|
|
1446
|
+
complete -c cf -n '__cf_using_subcommand dns update' -l priority -d 'Priority' -r
|
|
1447
|
+
|
|
1448
|
+
# dns patch
|
|
1449
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l zone -d 'Zone ID or name' -r
|
|
1450
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l id -d 'Record ID' -r
|
|
1451
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l content -d 'Record content' -r
|
|
1452
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l ttl -d 'TTL' -r
|
|
1453
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l proxied -d 'Enable proxy'
|
|
1454
|
+
complete -c cf -n '__cf_using_subcommand dns patch' -l comment -d 'Comment' -r
|
|
1455
|
+
|
|
1456
|
+
# dns delete
|
|
1457
|
+
complete -c cf -n '__cf_using_subcommand dns delete' -l zone -d 'Zone ID or name' -r
|
|
1458
|
+
complete -c cf -n '__cf_using_subcommand dns delete' -l id -d 'Record ID' -r
|
|
1459
|
+
complete -c cf -n '__cf_using_subcommand dns delete' -l yes -d 'Skip confirmation'
|
|
1460
|
+
|
|
1461
|
+
# dns import
|
|
1462
|
+
complete -c cf -n '__cf_using_subcommand dns import' -l zone -d 'Zone ID or name' -r
|
|
1463
|
+
complete -c cf -n '__cf_using_subcommand dns import' -l file -d 'BIND file path' -r -F
|
|
1464
|
+
complete -c cf -n '__cf_using_subcommand dns import' -l proxied -d 'Proxy imported records'
|
|
1465
|
+
|
|
1466
|
+
# dns export
|
|
1467
|
+
complete -c cf -n '__cf_using_subcommand dns export' -l zone -d 'Zone ID or name' -r
|
|
1468
|
+
|
|
1469
|
+
# --- Accounts ---
|
|
1470
|
+
complete -c cf -n '__cf_using_command accounts' -a list -d 'List all accounts'
|
|
1471
|
+
complete -c cf -n '__cf_using_command accounts' -a get -d 'Get account details'
|
|
1472
|
+
|
|
1473
|
+
complete -c cf -n '__cf_using_subcommand accounts list' -l page -d 'Page number' -r
|
|
1474
|
+
complete -c cf -n '__cf_using_subcommand accounts list' -l per-page -d 'Results per page' -r
|
|
1475
|
+
complete -c cf -n '__cf_using_subcommand accounts get' -l id -d 'Account ID' -r
|
|
1476
|
+
|
|
1477
|
+
# --- User ---
|
|
1478
|
+
complete -c cf -n '__cf_using_command user' -a get -d 'Get current user'
|
|
1479
|
+
complete -c cf -n '__cf_using_command user' -a token -d 'Token operations'
|
|
1480
|
+
complete -c cf -n '__cf_using_subcommand user token' -a verify -d 'Verify token'
|
|
1481
|
+
|
|
1482
|
+
# --- Cache ---
|
|
1483
|
+
complete -c cf -n '__cf_using_command cache' -a purge -d 'Purge cached content'
|
|
1484
|
+
|
|
1485
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l zone -d 'Zone ID or name' -r
|
|
1486
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l everything -d 'Purge everything'
|
|
1487
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l urls -d 'URLs to purge' -r
|
|
1488
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l tags -d 'Cache tags' -r
|
|
1489
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l hosts -d 'Hosts to purge' -r
|
|
1490
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l prefixes -d 'URL prefixes' -r
|
|
1491
|
+
complete -c cf -n '__cf_using_subcommand cache purge' -l yes -d 'Skip confirmation'
|
|
1492
|
+
|
|
1493
|
+
# --- Config ---
|
|
1494
|
+
complete -c cf -n '__cf_using_command config' -a set -d 'Set profile configuration'
|
|
1495
|
+
complete -c cf -n '__cf_using_command config' -a get -d 'Show profile details'
|
|
1496
|
+
complete -c cf -n '__cf_using_command config' -a list -d 'List all profiles'
|
|
1497
|
+
complete -c cf -n '__cf_using_command config' -a delete -d 'Delete a profile'
|
|
1498
|
+
complete -c cf -n '__cf_using_command config' -a use -d 'Set default profile'
|
|
1499
|
+
|
|
1500
|
+
complete -c cf -n '__cf_using_subcommand config set' -l profile -d 'Profile name' -r
|
|
1501
|
+
complete -c cf -n '__cf_using_subcommand config set' -l token -d 'API token' -r
|
|
1502
|
+
complete -c cf -n '__cf_using_subcommand config set' -l api-key -d 'API key' -r
|
|
1503
|
+
complete -c cf -n '__cf_using_subcommand config set' -l email -d 'API email' -r
|
|
1504
|
+
complete -c cf -n '__cf_using_subcommand config set' -l account-id -d 'Account ID' -r
|
|
1505
|
+
complete -c cf -n '__cf_using_subcommand config set' -l zone-id -d 'Zone ID' -r
|
|
1506
|
+
complete -c cf -n '__cf_using_subcommand config set' -l output -d 'Output format' -r -a 'table json csv yaml'
|
|
1507
|
+
|
|
1508
|
+
complete -c cf -n '__cf_using_subcommand config get' -l profile -d 'Profile name' -r
|
|
1509
|
+
complete -c cf -n '__cf_using_subcommand config delete' -l profile -d 'Profile name' -r
|
|
1510
|
+
complete -c cf -n '__cf_using_subcommand config delete' -l yes -d 'Skip confirmation'
|
|
1511
|
+
|
|
1512
|
+
# --- Completion ---
|
|
1513
|
+
complete -c cf -n '__cf_using_command completion' -a 'bash zsh fish' -d 'Shell type'
|
|
1514
|
+
`}var _w={};z(_w,{run:()=>CM});async function CM(s,e){let[n]=s;switch(n){case"bash":process.stdout.write($w());return;case"zsh":process.stdout.write(kw());return;case"fish":process.stdout.write(Uw());return;case void 0:case"--help":case"-h":e.output.raw(yM);return;default:throw new i(`Unknown shell: "${n}". Supported: bash, zsh, fish`)}}var yM=`Usage: cf completion <shell>
|
|
1515
|
+
|
|
1516
|
+
Shells:
|
|
1517
|
+
bash Generate bash completion script
|
|
1518
|
+
zsh Generate zsh completion script
|
|
1519
|
+
fish Generate fish completion script
|
|
1520
|
+
|
|
1521
|
+
Installation:
|
|
1522
|
+
bash: cf completion bash >> ~/.bashrc
|
|
1523
|
+
zsh: cf completion zsh >> ~/.zshrc
|
|
1524
|
+
fish: cf completion fish > ~/.config/fish/completions/cf.fish`;var zw=p(()=>{f()});async function Rw(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"hostname");if(!t)throw new i("--hostname <hostname> is required.");let r=await y(o,e.client),m=await e.client.post(`/zones/${encodeURIComponent(r)}/ssl/analyze`,{hostname:t});e.output.detail({Hostname:m.hostname,Status:m.certificate_status??"",CA:m.certificate_authority??"","Valid From":m.valid_from??"","Valid To":m.valid_to??"",Signature:m.signature_algorithm??"",Issuer:m.issuer??"",SANs:m.sans?.join(", ")??""})}var bw=p(()=>{g();f()});async function Iw(s,e){let[n,...o]=s;switch(n){case"get":return $M(o,e);case"update":return kM(o,e);case void 0:case"--help":case"-h":e.output.raw(Pw);return;default:throw new i(`Unknown ssl universal action: "${n}"
|
|
1525
|
+
|
|
1526
|
+
${Pw}`)}}async function $M(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/ssl/universal/settings`);e.output.detail({Enabled:r.enabled})}async function kM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=v(n,"enabled"),r=await y(o,e.client),m=await e.client.patch(`/zones/${encodeURIComponent(r)}/ssl/universal/settings`,{enabled:t});e.output.success(`Universal SSL ${m.enabled?"enabled":"disabled"}.`)}var Pw=`Usage: cf ssl universal <action>
|
|
1527
|
+
|
|
1528
|
+
Actions:
|
|
1529
|
+
get Get Universal SSL settings
|
|
1530
|
+
update Update Universal SSL settings (--enabled / --no-enabled)`;var vw=p(()=>{g();f()});async function Sw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _M(o,e);case"order":return zM(o,e);case void 0:case"--help":case"-h":e.output.raw(Dw);return;default:throw new i(`Unknown ssl advanced action: "${n}"
|
|
1531
|
+
|
|
1532
|
+
${Dw}`)}}async function _M(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/ssl/certificate_packs`,{status:"all"}),m=[{key:"id",header:"ID",width:36},{key:"type",header:"Type",width:16},{key:"status",header:"Status",width:14},{key:"hosts",header:"Hosts",transform:(c)=>Array.isArray(c)?c.join(", "):String(c??"")}];e.output.table(r,m)}async function zM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=D(n,"hosts");if(!t||t.length===0)throw new i("--hosts <host1,host2,...> is required.");let r=a(n,"validationMethod")??"txt",m=R(n,"validityDays")??365,c=a(n,"ca")??"lets_encrypt",l=v(n,"cloudflareBranding"),w=await y(o,e.client),$=await e.client.post(`/zones/${encodeURIComponent(w)}/ssl/certificate_packs/order`,{type:"advanced",hosts:t,validation_method:r,validity_days:m,certificate_authority:c,cloudflare_branding:l});e.output.success(`Advanced certificate pack ordered: ${$.id}`),e.output.detail({ID:$.id,Status:$.status,Hosts:$.hosts.join(", "),CA:$.certificate_authority??c,Validity:`${$.validity_days??m} days`})}var Dw=`Usage: cf ssl advanced <action>
|
|
1533
|
+
|
|
1534
|
+
Actions:
|
|
1535
|
+
list List advanced certificate packs
|
|
1536
|
+
order Order an advanced certificate pack`;var qw=p(()=>{g();f()});async function Lw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return bM(o,e);case"get":case"show":return PM(o,e);case"upload":return IM(o,e);case"update":return vM(o,e);case"delete":case"rm":return DM(o,e);case void 0:case"--help":case"-h":e.output.raw(Aw);return;default:throw new i(`Unknown ssl custom action: "${n}"
|
|
1537
|
+
|
|
1538
|
+
${Aw}`)}}async function bM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/custom_certificates`),m=[{key:"id",header:"ID",width:36},{key:"status",header:"Status",width:12},{key:"issuer",header:"Issuer",width:24},{key:"hosts",header:"Hosts",transform:(c)=>Array.isArray(c)?c.join(", "):String(c??"")},{key:"expires_on",header:"Expires"}];e.output.table(r,m)}async function PM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <certificate-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/custom_certificates/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Status:m.status,Issuer:m.issuer,Signature:m.signature,Hosts:m.hosts.join(", "),"Bundle Method":m.bundle_method,Uploaded:m.uploaded_on,Expires:m.expires_on})}async function IM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"cert");if(!t)throw new i("--cert <certificate-file> is required.");let r=a(n,"key");if(!r)throw new i("--key <private-key-file> is required.");let m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l=await y(o,e.client),w=await e.client.post(`/zones/${encodeURIComponent(l)}/custom_certificates`,{certificate:m,private_key:c});e.output.success(`Custom certificate uploaded: ${w.id}`),e.output.detail({ID:w.id,Status:w.status,Hosts:w.hosts.join(", "),Expires:w.expires_on})}async function vM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <certificate-id> is required.");let r=a(n,"cert"),m=a(n,"key");if(!r&&!m)throw new i("At least --cert or --key must be provided.");let c={};if(r)try{c.certificate=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}if(m)try{c.private_key=await Bun.file(m).text()}catch{throw new i(`Cannot read file: "${m}".`)}let l=await y(o,e.client),w=await e.client.patch(`/zones/${encodeURIComponent(l)}/custom_certificates/${encodeURIComponent(t)}`,c);e.output.success(`Custom certificate "${t}" updated.`),e.output.detail({ID:w.id,Status:w.status,Hosts:w.hosts.join(", "),Expires:w.expires_on})}async function DM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <certificate-id> is required.");if(!await C(`Delete custom certificate "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/custom_certificates/${encodeURIComponent(t)}`),e.output.success(`Custom certificate "${t}" deleted.`)}var Aw=`Usage: cf ssl custom <action>
|
|
1539
|
+
|
|
1540
|
+
Actions:
|
|
1541
|
+
list List custom SSL certificates
|
|
1542
|
+
get Get a custom SSL certificate
|
|
1543
|
+
upload Upload a custom SSL certificate
|
|
1544
|
+
update Update a custom SSL certificate
|
|
1545
|
+
delete Delete a custom SSL certificate`;var Nw=p(()=>{g();f();U()});async function Gw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return qM(o,e);case"create":return AM(o,e);case"delete":case"rm":return LM(o,e);case void 0:case"--help":case"-h":e.output.raw(Ew);return;default:throw new i(`Unknown ssl client-certs action: "${n}"
|
|
1546
|
+
|
|
1547
|
+
${Ew}`)}}async function qM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/client_certificates`),m=[{key:"id",header:"ID",width:36},{key:"status",header:"Status",width:12},{key:"fingerprint_sha256",header:"Fingerprint",width:24},{key:"expires_on",header:"Expires"}];e.output.table(r,m)}async function AM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"csr");if(!t)throw new i("--csr <csr-file> is required.");let r=R(n,"validity")??3650,m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/client_certificates`,{csr:m,validity_days:r});e.output.success(`Client certificate created: ${l.id}`),e.output.detail({ID:l.id,Status:l.status,Expires:l.expires_on??""})}async function LM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <certificate-id> is required.");if(!await C(`Delete client certificate "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/client_certificates/${encodeURIComponent(t)}`),e.output.success(`Client certificate "${t}" deleted.`)}var Ew=`Usage: cf ssl client-certs <action>
|
|
1548
|
+
|
|
1549
|
+
Actions:
|
|
1550
|
+
list List client certificates
|
|
1551
|
+
create Create a client certificate
|
|
1552
|
+
delete Delete a client certificate`;var Mw=p(()=>{g();f();U()});async function Zw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return EM(o,e);case"create":return GM(o,e);case"delete":case"rm":return MM(o,e);case void 0:case"--help":case"-h":e.output.raw(Tw);return;default:throw new i(`Unknown ssl keyless action: "${n}"
|
|
1553
|
+
|
|
1554
|
+
${Tw}`)}}async function EM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/keyless_certificates`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:20},{key:"host",header:"Host",width:24},{key:"port",header:"Port",width:8},{key:"status",header:"Status",width:12},{key:"enabled",header:"Enabled",width:8,transform:(c)=>c?"Yes":"No"}];e.output.table(r,m)}async function GM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"host");if(!t)throw new i("--host <hostname> is required.");let r=R(n,"port");if(!r)throw new i("--port <port> is required.");let m=a(n,"certificate");if(!m)throw new i("--certificate <cert-file> is required.");let c;try{c=await Bun.file(m).text()}catch{throw new i(`Cannot read file: "${m}".`)}let l=await y(o,e.client),w=await e.client.post(`/zones/${encodeURIComponent(l)}/keyless_certificates`,{host:t,port:r,certificate:c});e.output.success(`Keyless SSL server created: ${w.id}`),e.output.detail({ID:w.id,Name:w.name,Host:w.host,Port:w.port,Status:w.status})}async function MM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <server-id> is required.");if(!await C(`Delete Keyless SSL server "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/keyless_certificates/${encodeURIComponent(t)}`),e.output.success(`Keyless SSL server "${t}" deleted.`)}var Tw=`Usage: cf ssl keyless <action>
|
|
1555
|
+
|
|
1556
|
+
Actions:
|
|
1557
|
+
list List Keyless SSL servers
|
|
1558
|
+
create Create a Keyless SSL server
|
|
1559
|
+
delete Delete a Keyless SSL server`;var Ow=p(()=>{g();f();U()});async function Jw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ZM(o,e);case"create":return OM(o,e);case"get":case"show":return jM(o,e);case"revoke":return JM(o,e);case void 0:case"--help":case"-h":e.output.raw(jw);return;default:throw new i(`Unknown ssl origin-ca action: "${n}"
|
|
1560
|
+
|
|
1561
|
+
${jw}`)}}async function ZM(s,e){let{flags:n}=d(s),o=await e.client.get("/certificates"),t=[{key:"id",header:"ID",width:36},{key:"hostnames",header:"Hostnames",transform:(r)=>Array.isArray(r)?r.join(", "):String(r??"")},{key:"request_type",header:"Type",width:16},{key:"expires_on",header:"Expires"}];e.output.table(o,t)}async function OM(s,e){let{flags:n}=d(s),o=a(n,"csr");if(!o)throw new i("--csr <csr-file> is required.");let t=D(n,"hostnames");if(!t||t.length===0)throw new i("--hostnames <host1,host2,...> is required.");let r=R(n,"days")??5475,m;try{m=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let c=await e.client.post("/certificates",{csr:m,hostnames:t,requested_validity:r,request_type:"origin-rsa"});e.output.success(`Origin CA certificate created: ${c.id}`),e.output.detail({ID:c.id,Hostnames:c.hostnames.join(", "),Expires:c.expires_on,Validity:`${c.requested_validity} days`})}async function jM(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <certificate-id> is required.");let t=await e.client.get(`/certificates/${encodeURIComponent(o)}`);e.output.detail({ID:t.id,Hostnames:t.hostnames.join(", "),Type:t.request_type,Validity:`${t.requested_validity} days`,Expires:t.expires_on})}async function JM(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <certificate-id> is required.");if(!await C(`Revoke Origin CA certificate "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/certificates/${encodeURIComponent(o)}`),e.output.success(`Origin CA certificate "${o}" revoked.`)}var jw=`Usage: cf ssl origin-ca <action>
|
|
1562
|
+
|
|
1563
|
+
Actions:
|
|
1564
|
+
list List Origin CA certificates
|
|
1565
|
+
create Create an Origin CA certificate
|
|
1566
|
+
get Get an Origin CA certificate
|
|
1567
|
+
revoke Revoke an Origin CA certificate`;var Bw=p(()=>{f();U()});async function Vw(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return HM(o,e);case"upload":return VM(o,e);case"delete":case"rm":return WM(o,e);case void 0:case"--help":case"-h":e.output.raw(Hw);return;default:throw new i(`Unknown ssl mtls action: "${n}"
|
|
1568
|
+
|
|
1569
|
+
${Hw}`)}}async function HM(s,e){let{flags:n}=d(s),o=a(n,"accountId");if(!o)throw new i("--account-id <account-id> is required.");let t=await e.client.get(`/accounts/${encodeURIComponent(o)}/mtls_certificates`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:20},{key:"issuer",header:"Issuer",width:20},{key:"expires_on",header:"Expires"}];e.output.table(t,r)}async function VM(s,e){let{flags:n}=d(s),o=a(n,"accountId");if(!o)throw new i("--account-id <account-id> is required.");let t=a(n,"cert");if(!t)throw new i("--cert <certificate-file> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m={ca:r},c=a(n,"privateKey");if(c)try{m.private_key=await Bun.file(c).text()}catch{throw new i(`Cannot read file: "${c}".`)}let l=await e.client.post(`/accounts/${encodeURIComponent(o)}/mtls_certificates`,m);e.output.success(`mTLS certificate uploaded: ${l.id}`),e.output.detail({ID:l.id,Name:l.name??"",Issuer:l.issuer??"",Expires:l.expires_on??""})}async function WM(s,e){let{flags:n}=d(s),o=a(n,"accountId");if(!o)throw new i("--account-id <account-id> is required.");let t=a(n,"id");if(!t)throw new i("--id <certificate-id> is required.");if(!await C(`Delete mTLS certificate "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/mtls_certificates/${encodeURIComponent(t)}`),e.output.success(`mTLS certificate "${t}" deleted.`)}var Hw=`Usage: cf ssl mtls <action>
|
|
1570
|
+
|
|
1571
|
+
Actions:
|
|
1572
|
+
list List mTLS certificate associations
|
|
1573
|
+
upload Upload an mTLS certificate
|
|
1574
|
+
delete Delete an mTLS certificate`;var Ww=p(()=>{f();U()});async function Kw(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/ssl/verification`),m=[{key:"hostname",header:"Hostname",width:30},{key:"certificate_status",header:"Cert Status",width:16},{key:"validation_method",header:"Method",width:10},{key:"verification_type",header:"Type",width:12},{key:"cert_pack_uuid",header:"Pack UUID",width:36}];e.output.table(r,m)}var Qw=p(()=>{g();f()});async function Yw(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/dcv_delegation`);if(!Array.isArray(r)||r.length===0){e.output.info("No DCV delegation UUIDs found.");return}for(let m of r)e.output.detail({UUID:m.uuid})}var Xw=p(()=>{g();f()});async function Fw(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/ssl/recommendation`);e.output.detail({ID:r.id??"","Recommended Mode":r.value??"",Modified:r.modified_on??""})}var xw=p(()=>{g();f()});async function oh(s,e){let[n,...o]=s;switch(n){case"get":return FM(o,e);case"update":return xM(o,e);case void 0:case"--help":case"-h":e.output.raw(eh);return;default:throw new i(`Unknown ssl post-quantum action: "${n}"
|
|
1575
|
+
|
|
1576
|
+
${eh}`)}}async function FM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/cache/post_quantum_encryption`);e.output.detail({Value:r.value,Modified:r.modified_on??""})}async function xM(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"value");if(!t||t!=="default"&&t!=="preferred")throw new i("--value <default|preferred> is required.");let r=await y(o,e.client),m=await e.client.patch(`/zones/${encodeURIComponent(r)}/cache/post_quantum_encryption`,{value:t});e.output.success(`Post-Quantum encryption set to "${m.value}".`)}var eh=`Usage: cf ssl post-quantum <action>
|
|
1577
|
+
|
|
1578
|
+
Actions:
|
|
1579
|
+
get Get Post-Quantum encryption setting
|
|
1580
|
+
update Update Post-Quantum encryption (--value default|preferred)`;var nh=p(()=>{g();f()});var rh={};z(rh,{run:()=>o0});async function o0(s,e){let[n,...o]=s;switch(n){case"analyze":return Rw(o,e);case"universal":return Iw(o,e);case"advanced":return Sw(o,e);case"custom":return Lw(o,e);case"client-certs":return Gw(o,e);case"keyless":return Zw(o,e);case"origin-ca":return Jw(o,e);case"mtls":return Vw(o,e);case"verification":return Kw(o,e);case"dcv-delegation":return Yw(o,e);case"recommendations":return Fw(o,e);case"post-quantum":return oh(o,e);case void 0:case"--help":case"-h":e.output.raw(th);return;default:throw new i(`Unknown ssl command: "${n}"
|
|
1581
|
+
|
|
1582
|
+
${th}`)}}var th=`Usage: cf ssl <command>
|
|
1583
|
+
|
|
1584
|
+
Commands:
|
|
1585
|
+
analyze Analyze SSL certificate for a hostname
|
|
1586
|
+
universal Manage Universal SSL settings (get, update)
|
|
1587
|
+
advanced Manage Advanced Certificate Manager (list, order)
|
|
1588
|
+
custom Manage Custom SSL certificates (list, get, upload, update, delete)
|
|
1589
|
+
client-certs Manage Client Certificates (list, create, delete)
|
|
1590
|
+
keyless Manage Keyless SSL servers (list, create, delete)
|
|
1591
|
+
origin-ca Manage Origin CA certificates (list, create, get, revoke)
|
|
1592
|
+
mtls Manage mTLS certificates (list, upload, delete)
|
|
1593
|
+
verification Get SSL verification status
|
|
1594
|
+
dcv-delegation List DCV delegation UUIDs
|
|
1595
|
+
recommendations Get SSL/TLS recommendations
|
|
1596
|
+
post-quantum Manage Post-Quantum encryption (get, update)
|
|
1597
|
+
|
|
1598
|
+
Run 'cf ssl <command> --help' for more information.`;var ih=p(()=>{f();bw();vw();qw();Nw();Mw();Ow();Bw();Ww();Qw();Xw();xw();nh()});async function sh(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/load_balancers`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"enabled",header:"Enabled",width:8,transform:(c)=>c?"Yes":"No"},{key:"proxied",header:"Proxied",width:8,transform:(c)=>c?"Yes":"No"},{key:"steering_policy",header:"Steering",width:14},{key:"created_on",header:"Created"}];e.output.table(r,m)}var ah=p(()=>{g();f()});async function mh(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <load-balancer-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/load_balancers/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Name:m.name,Enabled:m.enabled??!1,Proxied:m.proxied??!1,TTL:m.ttl??"",Steering:m.steering_policy??"","Fallback Pool":m.fallback_pool,"Default Pools":m.default_pools.join(", "),"Session Affinity":m.session_affinity??"",Created:m.created_on??"",Modified:m.modified_on??""})}var dh=p(()=>{g();f()});async function ch(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <lb-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/load_balancers`,m);e.output.success(`Load balancer created: ${l.id}`),e.output.detail({ID:l.id,Name:l.name,Enabled:l.enabled??!1})}var ph=p(()=>{g();f()});async function uh(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <load-balancer-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <lb-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.put(`/zones/${encodeURIComponent(l)}/load_balancers/${encodeURIComponent(t)}`,c);e.output.success(`Load balancer "${t}" updated.`),e.output.detail({ID:w.id,Name:w.name,Enabled:w.enabled??!1})}var fh=p(()=>{g();f()});async function lh(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <load-balancer-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <lb-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.patch(`/zones/${encodeURIComponent(l)}/load_balancers/${encodeURIComponent(t)}`,c);e.output.success(`Load balancer "${t}" patched.`),e.output.detail({ID:w.id,Name:w.name,Enabled:w.enabled??!1})}var wh=p(()=>{g();f()});async function hh(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <load-balancer-id> is required.");if(!await C(`Delete load balancer "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/load_balancers/${encodeURIComponent(t)}`),e.output.success(`Load balancer "${t}" deleted.`)}var yh=p(()=>{g();f();U()});async function Ch(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/load_balancers/pools`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:24},{key:"enabled",header:"Enabled",width:8,transform:(m)=>m?"Yes":"No"},{key:"healthy",header:"Healthy",width:8,transform:(m)=>m===!0?"Yes":m===!1?"No":"?"},{key:"origins",header:"Origins",width:8,transform:(m)=>Array.isArray(m)?String(m.length):"0"}];e.output.table(t,r)}var gh=p(()=>{h()});async function $h(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pool-id> is required.");let t=await e.client.get(`/user/load_balancers/pools/${encodeURIComponent(o)}`);e.output.detail({ID:t.id,Name:t.name,Enabled:t.enabled,Healthy:t.healthy??"unknown",Monitor:t.monitor??"",Origins:t.origins.map((r)=>`${r.name}=${r.address}`).join(", "),"Check Regions":t.check_regions?.join(", ")??"",Created:t.created_on??"",Modified:t.modified_on??""})}var kh=p(()=>{f()});async function Uh(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <pool-json> is required.");let t;try{t=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let r;try{r=JSON.parse(t)}catch{throw new i("File must contain valid JSON.")}let m=await e.client.post("/user/load_balancers/pools",r);e.output.success(`Pool created: ${m.id}`),e.output.detail({ID:m.id,Name:m.name,Enabled:m.enabled})}var _h=p(()=>{f()});async function zh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pool-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <pool-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.put(`/user/load_balancers/pools/${encodeURIComponent(o)}`,m);e.output.success(`Pool "${o}" updated.`),e.output.detail({ID:c.id,Name:c.name,Enabled:c.enabled})}var Rh=p(()=>{f()});async function bh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pool-id> is required.");if(!await C(`Delete pool "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/user/load_balancers/pools/${encodeURIComponent(o)}`),e.output.success(`Pool "${o}" deleted.`)}var Ph=p(()=>{f();U()});async function Ih(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pool-id> is required.");let t=await e.client.get(`/user/load_balancers/pools/${encodeURIComponent(o)}/preview`);e.output.json(t)}var vh=p(()=>{f()});async function Dh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pool-id> is required.");let t=await e.client.get(`/user/load_balancers/pools/${encodeURIComponent(o)}/health`);e.output.json(t)}var Sh=p(()=>{f()});async function Ah(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ch(o,e);case"get":case"show":return $h(o,e);case"create":return Uh(o,e);case"update":return zh(o,e);case"delete":case"rm":return bh(o,e);case"preview":return Ih(o,e);case"health":return Dh(o,e);case void 0:case"--help":case"-h":e.output.raw(qh);return;default:throw new i(`Unknown lb pools action: "${n}"
|
|
1599
|
+
|
|
1600
|
+
${qh}`)}}var qh=`Usage: cf lb pools <action>
|
|
1601
|
+
|
|
1602
|
+
Actions:
|
|
1603
|
+
list List load balancer pools
|
|
1604
|
+
get Get pool details
|
|
1605
|
+
create Create a pool from JSON file
|
|
1606
|
+
update Update a pool (full replace)
|
|
1607
|
+
delete Delete a pool
|
|
1608
|
+
preview Preview pool status
|
|
1609
|
+
health Get pool health`;var Lh=p(()=>{f();gh();kh();_h();Rh();Ph();vh();Sh()});async function Nh(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/load_balancers/monitors`),r=[{key:"id",header:"ID",width:36},{key:"type",header:"Type",width:8},{key:"description",header:"Description",width:30},{key:"path",header:"Path",width:20},{key:"interval",header:"Interval",width:10}];e.output.table(t,r)}var Eh=p(()=>{h()});async function Gh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <monitor-id> is required.");let t=await e.client.get(`/user/load_balancers/monitors/${encodeURIComponent(o)}`);e.output.detail({ID:t.id,Type:t.type,Description:t.description??"",Method:t.method??"",Path:t.path??"",Port:t.port??"",Interval:t.interval??"",Timeout:t.timeout??"",Retries:t.retries??"","Expected Codes":t.expected_codes??"",Created:t.created_on??"",Modified:t.modified_on??""})}var Mh=p(()=>{f()});async function Th(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <monitor-json> is required.");let t;try{t=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let r;try{r=JSON.parse(t)}catch{throw new i("File must contain valid JSON.")}let m=await e.client.post("/user/load_balancers/monitors",r);e.output.success(`Monitor created: ${m.id}`),e.output.detail({ID:m.id,Type:m.type,Description:m.description??""})}var Zh=p(()=>{f()});async function Oh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <monitor-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <monitor-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.put(`/user/load_balancers/monitors/${encodeURIComponent(o)}`,m);e.output.success(`Monitor "${o}" updated.`),e.output.detail({ID:c.id,Type:c.type,Description:c.description??""})}var jh=p(()=>{f()});async function Jh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <monitor-id> is required.");if(!await C(`Delete monitor "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/user/load_balancers/monitors/${encodeURIComponent(o)}`),e.output.success(`Monitor "${o}" deleted.`)}var Bh=p(()=>{f();U()});async function Hh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <monitor-id> is required.");let t=await e.client.get(`/user/load_balancers/monitors/${encodeURIComponent(o)}/preview`);e.output.json(t)}var Vh=p(()=>{f()});async function Wh(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <monitor-id> is required.");let t=await e.client.get(`/user/load_balancers/monitors/${encodeURIComponent(o)}/references`);e.output.json(t)}var Kh=p(()=>{f()});async function Yh(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Nh(o,e);case"get":case"show":return Gh(o,e);case"create":return Th(o,e);case"update":return Oh(o,e);case"delete":case"rm":return Jh(o,e);case"preview":return Hh(o,e);case"references":case"refs":return Wh(o,e);case void 0:case"--help":case"-h":e.output.raw(Qh);return;default:throw new i(`Unknown lb monitors action: "${n}"
|
|
1610
|
+
|
|
1611
|
+
${Qh}`)}}var Qh=`Usage: cf lb monitors <action>
|
|
1612
|
+
|
|
1613
|
+
Actions:
|
|
1614
|
+
list List load balancer monitors
|
|
1615
|
+
get Get monitor details
|
|
1616
|
+
create Create a monitor from JSON file
|
|
1617
|
+
update Update a monitor (full replace)
|
|
1618
|
+
delete Delete a monitor
|
|
1619
|
+
preview Preview a monitor
|
|
1620
|
+
references List monitor references (pools using this monitor)`;var Xh=p(()=>{f();Eh();Mh();Zh();jh();Bh();Vh();Kh()});async function Fh(s,e){d(s);let n=await e.client.get("/user/load_balancers/analytics/regions"),o=[];if(n&&typeof n==="object")for(let[r,m]of Object.entries(n))o.push({region_code:r,countries:Array.isArray(m.countries)?m.countries.join(", "):""});let t=[{key:"region_code",header:"Region",width:12},{key:"countries",header:"Countries"}];e.output.table(o,t)}var xh=()=>{};var oy={};z(oy,{run:()=>R0});async function R0(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return sh(o,e);case"get":case"show":return mh(o,e);case"create":return ch(o,e);case"update":return uh(o,e);case"patch":return lh(o,e);case"delete":case"rm":return hh(o,e);case"pools":case"pool":return Ah(o,e);case"monitors":case"monitor":return Yh(o,e);case"regions":return Fh(o,e);case void 0:case"--help":case"-h":e.output.raw(ey);return;default:throw new i(`Unknown lb command: "${n}"
|
|
1621
|
+
|
|
1622
|
+
${ey}`)}}var ey=`Usage: cf lb <command>
|
|
1623
|
+
|
|
1624
|
+
Commands:
|
|
1625
|
+
list List load balancers
|
|
1626
|
+
get Get load balancer details
|
|
1627
|
+
create Create a load balancer from JSON file
|
|
1628
|
+
update Update a load balancer (full replace)
|
|
1629
|
+
patch Patch a load balancer (partial update)
|
|
1630
|
+
delete Delete a load balancer
|
|
1631
|
+
pools Manage load balancer pools (list, get, create, update, delete, preview, health)
|
|
1632
|
+
monitors Manage load balancer monitors (list, get, create, update, delete, preview, references)
|
|
1633
|
+
regions List available load balancer regions
|
|
1634
|
+
|
|
1635
|
+
Run 'cf lb <command> --help' for more information.`;var ny=p(()=>{f();ah();dh();ph();fh();wh();yh();Lh();Xh();xh()});async function ty(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/healthchecks`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:24},{key:"address",header:"Address",width:30},{key:"type",header:"Type",width:8},{key:"status",header:"Status",width:12},{key:"suspended",header:"Suspended",width:10,transform:(c)=>c?"Yes":"No"}];e.output.table(r,m)}var ry=p(()=>{g();f()});async function iy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <healthcheck-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/healthchecks/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Name:m.name,Address:m.address,Type:m.type??"",Status:m.status??"",Suspended:m.suspended??!1,Interval:m.interval??"",Timeout:m.timeout??"",Retries:m.retries??"","Check Regions":m.check_regions?.join(", ")??"",Created:m.created_on??"",Modified:m.modified_on??""})}var sy=p(()=>{g();f()});async function ay(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <hc-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/healthchecks`,m);e.output.success(`Healthcheck created: ${l.id}`),e.output.detail({ID:l.id,Name:l.name,Address:l.address,Status:l.status??""})}var my=p(()=>{g();f()});async function dy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <healthcheck-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <hc-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.put(`/zones/${encodeURIComponent(l)}/healthchecks/${encodeURIComponent(t)}`,c);e.output.success(`Healthcheck "${t}" updated.`),e.output.detail({ID:w.id,Name:w.name,Address:w.address,Status:w.status??""})}var cy=p(()=>{g();f()});async function py(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <healthcheck-id> is required.");if(!await C(`Delete healthcheck "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/healthchecks/${encodeURIComponent(t)}`),e.output.success(`Healthcheck "${t}" deleted.`)}var uy=p(()=>{g();f();U()});async function fy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <hc-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/healthchecks/preview`,m);e.output.detail({ID:l.id,Name:l.name??"",Address:l.address??"",Status:l.status??""})}var ly=p(()=>{g();f()});var hy={};z(hy,{run:()=>q0});async function q0(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ty(o,e);case"get":case"show":return iy(o,e);case"create":return ay(o,e);case"update":return dy(o,e);case"delete":case"rm":return py(o,e);case"preview":return fy(o,e);case void 0:case"--help":case"-h":e.output.raw(wy);return;default:throw new i(`Unknown healthchecks command: "${n}"
|
|
1636
|
+
|
|
1637
|
+
${wy}`)}}var wy=`Usage: cf healthchecks <command>
|
|
1638
|
+
|
|
1639
|
+
Commands:
|
|
1640
|
+
list List healthchecks
|
|
1641
|
+
get Get healthcheck details
|
|
1642
|
+
create Create a healthcheck from JSON file
|
|
1643
|
+
update Update a healthcheck
|
|
1644
|
+
delete Delete a healthcheck
|
|
1645
|
+
preview Preview a healthcheck from JSON file
|
|
1646
|
+
|
|
1647
|
+
Run 'cf healthchecks <command> --help' for more information.`;var yy=p(()=>{f();ry();sy();my();cy();uy();ly()});async function Cy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/cache/cache_reserve`);e.output.detail({ID:r.id,Value:r.value,Modified:r.modified_on??"—"})}var gy=p(()=>{g();f()});async function $y(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"value");if(!t||t!=="on"&&t!=="off")throw new i("--value <on|off> is required.");let r=await y(o,e.client),m=await e.client.patch(`/zones/${encodeURIComponent(r)}/cache/cache_reserve`,{value:t});e.output.success(`Cache Reserve set to "${m.value}".`)}var ky=p(()=>{g();f()});var _y={};z(_y,{run:()=>N0});async function N0(s,e){let[n,...o]=s;switch(n){case"get":case"show":return Cy(o,e);case"update":case"set":return $y(o,e);case void 0:case"--help":case"-h":e.output.raw(Uy);return;default:throw new i(`Unknown cache-reserve command: "${n}"
|
|
1648
|
+
|
|
1649
|
+
${Uy}`)}}var Uy=`Usage: cf cache-reserve <command>
|
|
1650
|
+
|
|
1651
|
+
Commands:
|
|
1652
|
+
get Get Cache Reserve status
|
|
1653
|
+
update Enable or disable Cache Reserve
|
|
1654
|
+
|
|
1655
|
+
Run 'cf cache-reserve <command> --help' for more information.`;var zy=p(()=>{f();gy();ky()});async function Ry(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/argo/tiered_caching`);e.output.detail({ID:r.id,Value:r.value,Modified:r.modified_on??"—"})}var by=p(()=>{g();f()});async function Py(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"value");if(!t||t!=="on"&&t!=="off")throw new i("--value <on|off> is required.");let r=a(n,"topology"),m=await y(o,e.client),c={value:t};if(r)c.topology=r;let l=await e.client.patch(`/zones/${encodeURIComponent(m)}/argo/tiered_caching`,c);e.output.success(`Tiered Cache set to "${l.value}".`)}var Iy=p(()=>{g();f()});var Dy={};z(Dy,{run:()=>M0});async function M0(s,e){let[n,...o]=s;switch(n){case"get":case"show":return Ry(o,e);case"update":case"set":return Py(o,e);case void 0:case"--help":case"-h":e.output.raw(vy);return;default:throw new i(`Unknown tiered-cache command: "${n}"
|
|
1656
|
+
|
|
1657
|
+
${vy}`)}}var vy=`Usage: cf tiered-cache <command>
|
|
1658
|
+
|
|
1659
|
+
Commands:
|
|
1660
|
+
get Get Tiered Cache status
|
|
1661
|
+
update Enable or disable Tiered Cache
|
|
1662
|
+
|
|
1663
|
+
Run 'cf tiered-cache <command> --help' for more information.`;var Sy=p(()=>{f();by();Iy()});async function qy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/argo/smart_routing`);e.output.detail({ID:r.id,Value:r.value,Modified:r.modified_on??"—"})}var Ay=p(()=>{g();f()});async function Ly(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"value");if(!t||t!=="on"&&t!=="off")throw new i("--value <on|off> is required.");let r=await y(o,e.client),m=await e.client.patch(`/zones/${encodeURIComponent(r)}/argo/smart_routing`,{value:t});e.output.success(`Argo Smart Routing set to "${m.value}".`)}var Ny=p(()=>{g();f()});var Gy={};z(Gy,{run:()=>O0});async function O0(s,e){let[n,...o]=s;switch(n){case"get":case"show":return qy(o,e);case"update":case"set":return Ly(o,e);case void 0:case"--help":case"-h":e.output.raw(Ey);return;default:throw new i(`Unknown argo command: "${n}"
|
|
1664
|
+
|
|
1665
|
+
${Ey}`)}}var Ey=`Usage: cf argo <command>
|
|
1666
|
+
|
|
1667
|
+
Commands:
|
|
1668
|
+
get Get Argo Smart Routing status
|
|
1669
|
+
update Enable or disable Argo Smart Routing
|
|
1670
|
+
|
|
1671
|
+
Run 'cf argo <command> --help' for more information.`;var My=p(()=>{f();Ay();Ny()});async function Ty(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/waiting_rooms`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"host",header:"Host",width:30},{key:"path",header:"Path",width:15},{key:"new_users_per_minute",header:"New/min",width:10},{key:"total_active_users",header:"Max Active",width:12}];e.output.table(r,m)}var Zy=p(()=>{g();f()});async function Oy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <waiting-room-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/waiting_rooms/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Name:m.name,Description:m.description??"—",Host:m.host,Path:m.path??"/","New Users/Min":m.new_users_per_minute,"Max Active Users":m.total_active_users,"Session Duration":m.session_duration??"—","Queueing Method":m.queueing_method??"—",Suspended:m.suspended??!1,Created:m.created_on??"—",Modified:m.modified_on??"—"})}var jy=p(()=>{g();f()});async function Jy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <waiting-room-json> is required.");let r=await y(o,e.client),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.post(`/zones/${encodeURIComponent(r)}/waiting_rooms`,c);e.output.success(`Waiting room "${l.name}" created (ID: ${l.id}).`)}var By=p(()=>{g();f()});async function Hy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <waiting-room-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <waiting-room-json> is required.");let m=await y(o,e.client),c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.put(`/zones/${encodeURIComponent(m)}/waiting_rooms/${encodeURIComponent(t)}`,l);e.output.success(`Waiting room "${w.name}" updated.`)}var Vy=p(()=>{g();f()});async function Wy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <waiting-room-id> is required.");let r=await y(o,e.client);if(!await C(`Delete waiting room "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/waiting_rooms/${encodeURIComponent(t)}`),e.output.success(`Waiting room "${t}" deleted.`)}var Ky=p(()=>{g();f();U()});async function Qy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <waiting-room-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/waiting_rooms/${encodeURIComponent(t)}/status`);e.output.detail({Status:m.status,"Event ID":m.event_id??"—","Queued Users":m.estimated_queued_users??"—","Active Users":m.estimated_total_active_users??"—","Est. Wait (min)":m.max_estimated_time_minutes??"—"})}var Yy=p(()=>{g();f()});async function Xy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/waiting_rooms/${encodeURIComponent(t)}/events`),c=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"event_start_time",header:"Start",width:22},{key:"event_end_time",header:"End",width:22},{key:"suspended",header:"Suspended",width:10}];e.output.table(m,c)}var Fy=p(()=>{g();f()});async function xy(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <event-json> is required.");let m=await y(o,e.client),c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.post(`/zones/${encodeURIComponent(m)}/waiting_rooms/${encodeURIComponent(t)}/events`,l);e.output.success(`Event "${w.name}" created (ID: ${w.id}).`)}var eC=p(()=>{g();f()});async function oC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=a(n,"id");if(!r)throw new i("--id <event-id> is required.");let m=a(n,"file");if(!m)throw new i("--file <event-json> is required.");let c=await y(o,e.client),l;try{l=await Bun.file(m).text()}catch{throw new i(`Cannot read file: "${m}".`)}let w;try{w=JSON.parse(l)}catch{throw new i("File must contain valid JSON.")}let $=await e.client.put(`/zones/${encodeURIComponent(c)}/waiting_rooms/${encodeURIComponent(t)}/events/${encodeURIComponent(r)}`,w);e.output.success(`Event "${$.name}" updated.`)}var nC=p(()=>{g();f()});async function tC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=a(n,"id");if(!r)throw new i("--id <event-id> is required.");let m=await y(o,e.client);if(!await C(`Delete event "${r}" from waiting room "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(m)}/waiting_rooms/${encodeURIComponent(t)}/events/${encodeURIComponent(r)}`),e.output.success(`Event "${r}" deleted.`)}var rC=p(()=>{g();f();U()});async function sC(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Xy(o,e);case"create":return xy(o,e);case"update":return oC(o,e);case"delete":case"rm":return tC(o,e);case void 0:case"--help":case"-h":e.output.raw(iC);return;default:throw new i(`Unknown waiting-rooms events command: "${n}"
|
|
1672
|
+
|
|
1673
|
+
${iC}`)}}var iC=`Usage: cf waiting-rooms events <command>
|
|
1674
|
+
|
|
1675
|
+
Commands:
|
|
1676
|
+
list List waiting room events
|
|
1677
|
+
create Create a waiting room event
|
|
1678
|
+
update Update a waiting room event
|
|
1679
|
+
delete Delete a waiting room event
|
|
1680
|
+
|
|
1681
|
+
Run 'cf waiting-rooms events <command> --help' for more information.`;var aC=p(()=>{f();Fy();eC();nC();rC()});async function mC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/waiting_rooms/${encodeURIComponent(t)}/rules`),c=[{key:"id",header:"ID",width:36},{key:"action",header:"Action",width:20},{key:"expression",header:"Expression",width:40},{key:"description",header:"Description",width:25},{key:"enabled",header:"Enabled",width:8}];e.output.table(m,c)}var dC=p(()=>{g();f()});async function cC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"room");if(!t)throw new i("--room <waiting-room-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <rules-json> is required.");let m=await y(o,e.client),c;try{c=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let l;try{l=JSON.parse(c)}catch{throw new i("File must contain valid JSON.")}let w=await e.client.put(`/zones/${encodeURIComponent(m)}/waiting_rooms/${encodeURIComponent(t)}/rules`,l),$=Array.isArray(w)?w.length:0;e.output.success(`Waiting room rules updated (${$} rule${$===1?"":"s"}).`)}var pC=p(()=>{g();f()});async function fC(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return mC(o,e);case"upsert":case"set":return cC(o,e);case void 0:case"--help":case"-h":e.output.raw(uC);return;default:throw new i(`Unknown waiting-rooms rules command: "${n}"
|
|
1682
|
+
|
|
1683
|
+
${uC}`)}}var uC=`Usage: cf waiting-rooms rules <command>
|
|
1684
|
+
|
|
1685
|
+
Commands:
|
|
1686
|
+
list List waiting room rules
|
|
1687
|
+
upsert Create or replace waiting room rules
|
|
1688
|
+
|
|
1689
|
+
Run 'cf waiting-rooms rules <command> --help' for more information.`;var lC=p(()=>{f();dC();pC()});var hC={};z(hC,{run:()=>nT});async function nT(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Ty(o,e);case"get":case"show":return Oy(o,e);case"create":return Jy(o,e);case"update":return Hy(o,e);case"delete":case"rm":return Wy(o,e);case"status":return Qy(o,e);case"events":case"event":return sC(o,e);case"rules":case"rule":return fC(o,e);case void 0:case"--help":case"-h":e.output.raw(wC);return;default:throw new i(`Unknown waiting-rooms command: "${n}"
|
|
1690
|
+
|
|
1691
|
+
${wC}`)}}var wC=`Usage: cf waiting-rooms <command>
|
|
1692
|
+
|
|
1693
|
+
Commands:
|
|
1694
|
+
list List waiting rooms
|
|
1695
|
+
get Get waiting room details
|
|
1696
|
+
create Create a waiting room
|
|
1697
|
+
update Update a waiting room
|
|
1698
|
+
delete Delete a waiting room
|
|
1699
|
+
status Get waiting room status
|
|
1700
|
+
events Manage waiting room events
|
|
1701
|
+
rules Manage waiting room rules
|
|
1702
|
+
|
|
1703
|
+
Run 'cf waiting-rooms <command> --help' for more information.`;var yC=p(()=>{f();Zy();jy();By();Vy();Ky();Yy();aC();lC()});async function CC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/speed_api/pages`),m=[{key:"url",header:"URL",width:50},{key:"region",header:"Region",width:15}];e.output.table(r,m)}var gC=p(()=>{g();f()});async function kC(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return CC(o,e);case void 0:case"--help":case"-h":e.output.raw($C);return;default:throw new i(`Unknown observatory pages command: "${n}"
|
|
1704
|
+
|
|
1705
|
+
${$C}`)}}var $C=`Usage: cf observatory pages <command>
|
|
1706
|
+
|
|
1707
|
+
Commands:
|
|
1708
|
+
list List tested pages
|
|
1709
|
+
|
|
1710
|
+
Run 'cf observatory pages <command> --help' for more information.`;var UC=p(()=>{f();gC()});async function _C(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"url");if(!t)throw new i("--url <page-url> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/speed_api/pages/${encodeURIComponent(t)}/tests`),c=[{key:"id",header:"ID",width:36},{key:"url",header:"URL",width:40},{key:"region",header:"Region",width:12},{key:"date",header:"Date",width:22}];e.output.table(m,c)}var zC=p(()=>{g();f()});async function RC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"url");if(!t)throw new i("--url <page-url> is required.");let r=a(n,"region"),m=await y(o,e.client),c={url:t};if(r)c.region=r;let l=await e.client.post(`/zones/${encodeURIComponent(m)}/speed_api/pages/${encodeURIComponent(t)}/tests`,c);e.output.success(`Speed test created (ID: ${l.id}).`),e.output.detail({ID:l.id,URL:l.url,Region:l.region??"—",Date:l.date??"—"})}var bC=p(()=>{g();f()});async function PC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <test-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/speed_api/tests/${encodeURIComponent(t)}`),c={ID:m.id,URL:m.url,Region:m.region??"—",Date:m.date??"—",Schedule:m.schedule_frequency??"—"};if(m.mobile_report)c["Mobile Performance"]=m.mobile_report.performance_score??"—",c["Mobile FCP"]=m.mobile_report.fcp??"—",c["Mobile LCP"]=m.mobile_report.lcp??"—",c["Mobile CLS"]=m.mobile_report.cls??"—",c["Mobile TBT"]=m.mobile_report.tbt??"—";if(m.desktop_report)c["Desktop Performance"]=m.desktop_report.performance_score??"—",c["Desktop FCP"]=m.desktop_report.fcp??"—",c["Desktop LCP"]=m.desktop_report.lcp??"—",c["Desktop CLS"]=m.desktop_report.cls??"—",c["Desktop TBT"]=m.desktop_report.tbt??"—";e.output.detail(c)}var IC=p(()=>{g();f()});async function vC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"url");if(!t)throw new i("--url <page-url> is required.");let r=a(n,"region"),m=await y(o,e.client);if(!await C(`Delete all tests for "${t}"${r?` in region "${r}"`:""}?`,e.flags)){e.output.info("Aborted.");return}let l={};if(r)l.region=r;await e.client.delete(`/zones/${encodeURIComponent(m)}/speed_api/pages/${encodeURIComponent(t)}/tests`,l),e.output.success(`Tests for "${t}" deleted.`)}var DC=p(()=>{g();f();U()});async function qC(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _C(o,e);case"create":return RC(o,e);case"get":case"show":return PC(o,e);case"delete":case"rm":return vC(o,e);case void 0:case"--help":case"-h":e.output.raw(SC);return;default:throw new i(`Unknown observatory tests command: "${n}"
|
|
1711
|
+
|
|
1712
|
+
${SC}`)}}var SC=`Usage: cf observatory tests <command>
|
|
1713
|
+
|
|
1714
|
+
Commands:
|
|
1715
|
+
list List tests for a URL
|
|
1716
|
+
create Create a new speed test
|
|
1717
|
+
get Get test details
|
|
1718
|
+
delete Delete tests for a URL
|
|
1719
|
+
|
|
1720
|
+
Run 'cf observatory tests <command> --help' for more information.`;var AC=p(()=>{f();zC();bC();IC();DC()});async function LC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/speed_api/schedule`),m=[{key:"url",header:"URL",width:50},{key:"region",header:"Region",width:15},{key:"frequency",header:"Frequency",width:15}];e.output.table(r,m)}var NC=p(()=>{g();f()});async function EC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"url");if(!t)throw new i("--url <page-url> is required.");let r=a(n,"region"),m=a(n,"frequency"),c=await y(o,e.client),l={url:t};if(r)l.region=r;if(m)l.frequency=m;let w=await e.client.post(`/zones/${encodeURIComponent(c)}/speed_api/schedule/${encodeURIComponent(t)}`,l);e.output.success(`Schedule created for "${w.url}".`),e.output.detail({URL:w.url,Region:w.region??"—",Frequency:w.frequency??"—"})}var GC=p(()=>{g();f()});async function MC(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"url");if(!t)throw new i("--url <page-url> is required.");let r=await y(o,e.client);if(!await C(`Delete schedule for "${t}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/zones/${encodeURIComponent(r)}/speed_api/schedule/${encodeURIComponent(t)}`),e.output.success(`Schedule for "${t}" deleted.`)}var TC=p(()=>{g();f();U()});async function OC(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return LC(o,e);case"create":return EC(o,e);case"delete":case"rm":return MC(o,e);case void 0:case"--help":case"-h":e.output.raw(ZC);return;default:throw new i(`Unknown observatory schedule command: "${n}"
|
|
1721
|
+
|
|
1722
|
+
${ZC}`)}}var ZC=`Usage: cf observatory schedule <command>
|
|
1723
|
+
|
|
1724
|
+
Commands:
|
|
1725
|
+
list List test schedules
|
|
1726
|
+
create Create a test schedule
|
|
1727
|
+
delete Delete a test schedule
|
|
1728
|
+
|
|
1729
|
+
Run 'cf observatory schedule <command> --help' for more information.`;var jC=p(()=>{f();NC();GC();TC()});var BC={};z(BC,{run:()=>lT});async function lT(s,e){let[n,...o]=s;switch(n){case"pages":case"page":return kC(o,e);case"tests":case"test":return qC(o,e);case"schedule":case"schedules":return OC(o,e);case void 0:case"--help":case"-h":e.output.raw(JC);return;default:throw new i(`Unknown observatory command: "${n}"
|
|
1730
|
+
|
|
1731
|
+
${JC}`)}}var JC=`Usage: cf observatory <command>
|
|
1732
|
+
|
|
1733
|
+
Commands:
|
|
1734
|
+
pages List tested pages
|
|
1735
|
+
tests Manage speed tests
|
|
1736
|
+
schedule Manage test schedules
|
|
1737
|
+
|
|
1738
|
+
Run 'cf observatory <command> --help' for more information.`;var HC=p(()=>{f();UC();AC();jC()});async function VC(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/calls/apps`),r=[{key:"uid",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"created",header:"Created",width:24}];e.output.table(t,r)}var WC=p(()=>{h()});async function KC(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${encodeURIComponent(t)}/calls/apps`,{name:o});e.output.success(`Calls app "${o}" created (ID: ${r.uid}).`)}var QC=p(()=>{h();f()});async function YC(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <app-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/calls/apps/${encodeURIComponent(o)}`);e.output.detail({ID:r.uid,Name:r.name,Created:r.created??"-",Modified:r.modified??"-"})}var XC=p(()=>{h();f()});async function FC(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <app-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Calls app "${o}"? This action is permanent.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/calls/apps/${encodeURIComponent(o)}`),e.output.success(`Calls app "${o}" deleted.`)}var xC=p(()=>{h();f();U()});async function og(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return VC(o,e);case"create":return KC(o,e);case"get":case"show":return YC(o,e);case"delete":case"rm":case"remove":return FC(o,e);case void 0:case"--help":case"-h":e.output.raw(eg);return;default:throw new i(`Unknown calls apps command: "${n}"
|
|
1739
|
+
|
|
1740
|
+
${eg}`)}}var eg=`Usage: cf calls apps <command>
|
|
1741
|
+
|
|
1742
|
+
Commands:
|
|
1743
|
+
list List Calls apps
|
|
1744
|
+
create Create a new Calls app
|
|
1745
|
+
get Get Calls app details
|
|
1746
|
+
delete Delete a Calls app
|
|
1747
|
+
|
|
1748
|
+
Run 'cf calls apps <command> --help' for more information.`;var ng=p(()=>{f();WC();QC();XC();xC()});async function tg(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/calls/turn_keys`),r=[{key:"key_id",header:"Key ID",width:36},{key:"name",header:"Name",width:30},{key:"created",header:"Created",width:24}];e.output.table(t,r)}var rg=p(()=>{h()});async function ig(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${encodeURIComponent(t)}/calls/turn_keys`,{name:o});e.output.success(`TURN key "${o}" created (ID: ${r.key_id}).`)}var sg=p(()=>{h();f()});async function ag(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <key-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete TURN key "${o}"? This action is permanent.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/calls/turn_keys/${encodeURIComponent(o)}`),e.output.success(`TURN key "${o}" deleted.`)}var mg=p(()=>{h();f();U()});async function cg(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return tg(o,e);case"create":return ig(o,e);case"delete":case"rm":case"remove":return ag(o,e);case void 0:case"--help":case"-h":e.output.raw(dg);return;default:throw new i(`Unknown calls turn-keys command: "${n}"
|
|
1749
|
+
|
|
1750
|
+
${dg}`)}}var dg=`Usage: cf calls turn-keys <command>
|
|
1751
|
+
|
|
1752
|
+
Commands:
|
|
1753
|
+
list List TURN keys
|
|
1754
|
+
create Create a TURN key
|
|
1755
|
+
delete Delete a TURN key
|
|
1756
|
+
|
|
1757
|
+
Run 'cf calls turn-keys <command> --help' for more information.`;var pg=p(()=>{f();rg();sg();mg()});var fg={};z(fg,{run:()=>zT});async function zT(s,e){let[n,...o]=s;switch(n){case"apps":case"app":return og(o,e);case"turn-keys":case"turn-key":case"turnkeys":return cg(o,e);case void 0:case"--help":case"-h":e.output.raw(ug);return;default:throw new i(`Unknown calls command: "${n}"
|
|
1758
|
+
|
|
1759
|
+
${ug}`)}}var ug=`Usage: cf calls <command>
|
|
1760
|
+
|
|
1761
|
+
Commands:
|
|
1762
|
+
apps Manage Calls/WebRTC applications
|
|
1763
|
+
turn-keys Manage TURN keys
|
|
1764
|
+
|
|
1765
|
+
Run 'cf calls <command> --help' for more information.`;var lg=p(()=>{f();ng();pg()});async function wg(s,e){let{flags:n,positional:o}=d(s),t=o[0];if(!t)throw new i(`Model name is required as positional argument.
|
|
1766
|
+
|
|
1767
|
+
Usage: cf ai run <model> [--prompt <text>] [--file <file>] [--output-file <path>] [--options <json>]`);let r=a(n,"prompt"),m=a(n,"file"),c=a(n,"outputFile"),l=a(n,"options");if(!r&&!m)throw new i("Either --prompt <text> or --file <file> is required.");let w=await u(a(n,"accountId"),e.client,e.config),$;if(m){let _;try{_=await Bun.file(m).arrayBuffer()}catch{throw new i(`Cannot read file: "${m}".`)}$=Array.from(new Uint8Array(_))}else if(r)$={messages:[{role:"user",content:r}]};if(l){let _;try{_=JSON.parse(l)}catch{throw new i(`Invalid JSON for --options: "${l}".`)}if(Array.isArray($))throw new i("--options cannot be used with --file.");if(typeof $==="object"&&$!==null)$={...$,..._}}let k=await e.client.post(`/accounts/${encodeURIComponent(w)}/ai/run/${t}`,$);if(c&&k){try{let _=typeof k==="string"?k:JSON.stringify(k);await Bun.write(c,_),e.output.success(`Output written to "${c}".`)}catch{throw new i(`Cannot write to file: "${c}".`)}return}if(k&&typeof k==="object"&&"response"in k){e.output.raw(k.response);return}if(typeof k==="string")e.output.raw(k);else e.output.json(k)}var hg=p(()=>{h();f()});async function yg(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t={},r=a(n,"task");if(r)t.task=r;let m=a(n,"search");if(m)t.search=m;let c=await e.client.get(`/accounts/${encodeURIComponent(o)}/ai/models/search`,t),l=[{key:"name",header:"Model",width:50},{key:"task",header:"Task",width:25,transform:(w)=>{if(w&&typeof w==="object"&&"name"in w)return w.name;return"-"}},{key:"description",header:"Description",width:40}];e.output.table(c,l)}var Cg=p(()=>{h()});async function gg(s,e){let{flags:n}=d(s),o=a(n,"model");if(!o)throw new i("--model <model-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai/models/search`,{search:o}),m=Array.isArray(r)?r.find((c)=>c.name===o||c.id===o):void 0;if(!m)throw new i(`Model "${o}" not found.`);e.output.detail({ID:m.id,Name:m.name,Description:m.description??"-",Task:m.task?.name??"-",Properties:m.properties?m.properties.map((c)=>`${c.property_id}=${c.value}`).join(", "):"-"})}var $g=p(()=>{h();f()});async function Ug(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return yg(o,e);case"get":case"show":return gg(o,e);case void 0:case"--help":case"-h":e.output.raw(kg);return;default:throw new i(`Unknown ai models command: "${n}"
|
|
1768
|
+
|
|
1769
|
+
${kg}`)}}var kg=`Usage: cf ai models <command>
|
|
1770
|
+
|
|
1771
|
+
Commands:
|
|
1772
|
+
list List/search AI models
|
|
1773
|
+
get Get model details
|
|
1774
|
+
|
|
1775
|
+
Run 'cf ai models <command> --help' for more information.`;var _g=p(()=>{f();Cg();$g()});async function zg(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/ai/finetunes`),r=[{key:"id",header:"ID",width:36},{key:"model",header:"Model",width:40},{key:"status",header:"Status",width:15},{key:"created_at",header:"Created",width:24}];e.output.table(t,r)}var Rg=p(()=>{h()});async function bg(s,e){let{flags:n}=d(s),o=a(n,"model");if(!o)throw new i("--model <model-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <training-jsonl> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c=await e.client.post(`/accounts/${encodeURIComponent(r)}/ai/finetunes`,{model:o,training_data:m});e.output.success(`Fine-tuning job created (ID: ${c.id}).`)}var Pg=p(()=>{h();f()});async function Ig(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <job-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai/finetunes/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Model:r.model,Name:r.name??"-",Description:r.description??"-",Status:r.status??"-",Created:r.created_at??"-",Modified:r.modified_at??"-"})}var vg=p(()=>{h();f()});async function Dg(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <job-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete fine-tuning job "${o}"? This action is permanent.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/ai/finetunes/${encodeURIComponent(o)}`),e.output.success(`Fine-tuning job "${o}" deleted.`)}var Sg=p(()=>{h();f();U()});async function Ag(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return zg(o,e);case"create":return bg(o,e);case"get":case"show":return Ig(o,e);case"delete":case"rm":case"remove":return Dg(o,e);case void 0:case"--help":case"-h":e.output.raw(qg);return;default:throw new i(`Unknown ai fine-tuning command: "${n}"
|
|
1776
|
+
|
|
1777
|
+
${qg}`)}}var qg=`Usage: cf ai fine-tuning <command>
|
|
1778
|
+
|
|
1779
|
+
Commands:
|
|
1780
|
+
list List fine-tuning jobs
|
|
1781
|
+
create Create a fine-tuning job
|
|
1782
|
+
get Get fine-tuning job details
|
|
1783
|
+
delete Delete a fine-tuning job
|
|
1784
|
+
|
|
1785
|
+
Run 'cf ai fine-tuning <command> --help' for more information.`;var Lg=p(()=>{f();Rg();Pg();vg();Sg()});var Eg={};z(Eg,{run:()=>LT});async function LT(s,e){let[n,...o]=s;switch(n){case"run":return wg(o,e);case"models":case"model":return Ug(o,e);case"fine-tuning":case"finetune":case"fine-tune":case"ft":return Ag(o,e);case void 0:case"--help":case"-h":e.output.raw(Ng);return;default:throw new i(`Unknown ai command: "${n}"
|
|
1786
|
+
|
|
1787
|
+
${Ng}`)}}var Ng=`Usage: cf ai <command>
|
|
1788
|
+
|
|
1789
|
+
Commands:
|
|
1790
|
+
run Run inference on a Workers AI model
|
|
1791
|
+
models Browse and search AI models
|
|
1792
|
+
fine-tuning Manage fine-tuning jobs
|
|
1793
|
+
|
|
1794
|
+
Run 'cf ai <command> --help' for more information.
|
|
1795
|
+
|
|
1796
|
+
Examples:
|
|
1797
|
+
cf ai run @cf/meta/llama-3-8b-instruct --prompt "What is DNS?"
|
|
1798
|
+
cf ai run @cf/openai/whisper --file audio.mp3
|
|
1799
|
+
cf ai run @cf/stabilityai/stable-diffusion-xl-base-1.0 --prompt "a sunset" --output-file sunset.png
|
|
1800
|
+
cf ai models list --task Text Generation`;var Gg=p(()=>{f();hg();_g();Lg()});async function Mg(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/ai-gateway/gateways`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"rate_limiting_limit",header:"Rate Limit",width:12},{key:"created_at",header:"Created",width:24}];e.output.table(t,r)}var Tg=p(()=>{h()});async function Zg(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Slug:r.slug??"-","Rate Limit":r.rate_limiting_limit??"-","Rate Limit Interval":r.rate_limiting_interval??"-","Rate Limit Technique":r.rate_limiting_technique??"-",Created:r.created_at??"-",Modified:r.modified_at??"-"})}var Og=p(()=>{h();f()});async function jg(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={name:o},m=R(n,"rateLimit");if(m!==void 0)r.rate_limiting_limit=m;let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways`,r);e.output.success(`AI Gateway "${o}" created (ID: ${c.id}).`)}var Jg=p(()=>{h();f()});async function Bg(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"name");if(m)r.name=m;let c=R(n,"rateLimit");if(c!==void 0)r.rate_limiting_limit=c;if(Object.keys(r).length===0)throw new i("At least one of --name or --rate-limit must be provided.");let l=await e.client.put(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}`,r);e.output.success(`AI Gateway "${l.name}" updated.`)}var Hg=p(()=>{h();f()});async function Vg(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete AI Gateway "${o}"? This action is permanent.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}`),e.output.success(`AI Gateway "${o}" deleted.`)}var Wg=p(()=>{h();f();U()});async function Kg(s,e){let{flags:n}=d(s),o=a(n,"gateway");if(!o)throw new i("--gateway <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={},m=a(n,"from");if(m)r.from=m;let c=a(n,"to");if(c)r.to=c;let l=a(n,"model");if(l)r.model=l;let w=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}/logs`,r),$=[{key:"id",header:"ID",width:20},{key:"model",header:"Model",width:30},{key:"provider",header:"Provider",width:15},{key:"status_code",header:"Status",width:8},{key:"tokens_in",header:"Tokens In",width:10},{key:"tokens_out",header:"Tokens Out",width:10},{key:"cached",header:"Cached",width:8},{key:"created_at",header:"Created",width:24}];e.output.table(w,$)}var Qg=p(()=>{h();f()});async function Xg(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Kg(o,e);case void 0:case"--help":case"-h":e.output.raw(Yg);return;default:throw new i(`Unknown ai-gateway logs command: "${n}"
|
|
1801
|
+
|
|
1802
|
+
${Yg}`)}}var Yg=`Usage: cf ai-gateway logs <command>
|
|
1803
|
+
|
|
1804
|
+
Commands:
|
|
1805
|
+
list List gateway logs
|
|
1806
|
+
|
|
1807
|
+
Run 'cf ai-gateway logs <command> --help' for more information.`;var Fg=p(()=>{f();Qg()});async function xg(s,e){let{flags:n}=d(s),o=a(n,"gateway");if(!o)throw new i("--gateway <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}/datasets`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"description",header:"Description",width:40},{key:"created_at",header:"Created",width:24}];e.output.table(r,m)}var e$=p(()=>{h();f()});async function n$(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return xg(o,e);case void 0:case"--help":case"-h":e.output.raw(o$);return;default:throw new i(`Unknown ai-gateway datasets command: "${n}"
|
|
1808
|
+
|
|
1809
|
+
${o$}`)}}var o$=`Usage: cf ai-gateway datasets <command>
|
|
1810
|
+
|
|
1811
|
+
Commands:
|
|
1812
|
+
list List gateway datasets
|
|
1813
|
+
|
|
1814
|
+
Run 'cf ai-gateway datasets <command> --help' for more information.`;var t$=p(()=>{f();e$()});async function r$(s,e){let{flags:n}=d(s),o=a(n,"gateway");if(!o)throw new i("--gateway <gateway-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/ai-gateway/gateways/${encodeURIComponent(o)}/evaluations`),m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"status",header:"Status",width:15},{key:"total_count",header:"Total",width:10},{key:"processed_count",header:"Processed",width:10},{key:"created_at",header:"Created",width:24}];e.output.table(r,m)}var i$=p(()=>{h();f()});async function a$(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return r$(o,e);case void 0:case"--help":case"-h":e.output.raw(s$);return;default:throw new i(`Unknown ai-gateway evaluations command: "${n}"
|
|
1815
|
+
|
|
1816
|
+
${s$}`)}}var s$=`Usage: cf ai-gateway evaluations <command>
|
|
1817
|
+
|
|
1818
|
+
Commands:
|
|
1819
|
+
list List gateway evaluations
|
|
1820
|
+
|
|
1821
|
+
Run 'cf ai-gateway evaluations <command> --help' for more information.`;var m$=p(()=>{f();i$()});var c$={};z(c$,{run:()=>VT});async function VT(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Mg(o,e);case"get":case"show":return Zg(o,e);case"create":return jg(o,e);case"update":return Bg(o,e);case"delete":case"rm":case"remove":return Vg(o,e);case"logs":case"log":return Xg(o,e);case"datasets":case"dataset":return n$(o,e);case"evaluations":case"evaluation":case"evals":case"eval":return a$(o,e);case void 0:case"--help":case"-h":e.output.raw(d$);return;default:throw new i(`Unknown ai-gateway command: "${n}"
|
|
1822
|
+
|
|
1823
|
+
${d$}`)}}var d$=`Usage: cf ai-gateway <command>
|
|
1824
|
+
|
|
1825
|
+
Commands:
|
|
1826
|
+
list List AI gateways
|
|
1827
|
+
get Get gateway details
|
|
1828
|
+
create Create a gateway
|
|
1829
|
+
update Update a gateway
|
|
1830
|
+
delete Delete a gateway
|
|
1831
|
+
logs View gateway logs
|
|
1832
|
+
datasets View gateway datasets
|
|
1833
|
+
evaluations View gateway evaluations
|
|
1834
|
+
|
|
1835
|
+
Run 'cf ai-gateway <command> --help' for more information.`;var p$=p(()=>{f();Tg();Og();Jg();Hg();Wg();Fg();t$();m$()});async function u$(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/vectorize/v2/indexes`),r=[{key:"name",header:"Name",width:30},{key:"description",header:"Description",width:40},{key:"config",header:"Dimensions",width:12,transform:(m)=>{if(m&&typeof m==="object"&&"dimensions"in m)return String(m.dimensions);return"-"}},{key:"config",header:"Metric",width:14,transform:(m)=>{if(m&&typeof m==="object"&&"metric"in m)return String(m.metric);return"-"}},{key:"created_on",header:"Created",width:24}];e.output.table(t,r)}var f$=p(()=>{h()});async function l$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/vectorize/v2/indexes/${encodeURIComponent(o)}`);e.output.detail({Name:r.name,Description:r.description??"-",Dimensions:r.config.dimensions,Metric:r.config.metric,Created:r.created_on??"-",Modified:r.modified_on??"-"})}var w$=p(()=>{h();f()});async function h$(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=R(n,"dimensions");if(t===void 0)throw new i("--dimensions <n> is required.");let r=a(n,"metric");if(!r)throw new i("--metric <cosine|euclidean|dot-product> is required.");let m=["cosine","euclidean","dot-product"];if(!m.includes(r))throw new i(`Invalid metric "${r}". Must be one of: ${m.join(", ")}`);let c=await u(a(n,"accountId"),e.client,e.config),l=a(n,"description"),w={name:o,config:{dimensions:t,metric:r}};if(l)w.description=l;let $=await e.client.post(`/accounts/${encodeURIComponent(c)}/vectorize/v2/indexes`,w);e.output.success(`Vectorize index "${$.name}" created.`)}var y$=p(()=>{h();f()});async function C$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"description");if(t===void 0)throw new i("--description <text> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.put(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}`,{description:t});e.output.success(`Vectorize index "${m.name}" updated.`)}var g$=p(()=>{h();f()});async function $$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Vectorize index "${o}"? This will permanently remove the index and all its vectors.`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/vectorize/v2/indexes/${encodeURIComponent(o)}`),e.output.success(`Vectorize index "${o}" deleted.`)}var k$=p(()=>{h();f();U()});async function U$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"file");if(!t)throw new i("--file <ndjson-file> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c=m.split(`
|
|
1836
|
+
`).filter((w)=>w.trim().length>0).map((w)=>JSON.parse(w)),l=await e.client.post(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}/insert`,{vectors:c});e.output.success(`Inserted ${l.count} vectors into "${o}".`)}var _$=p(()=>{h();f()});async function z$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"file");if(!t)throw new i("--file <ndjson-file> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c=m.split(`
|
|
1837
|
+
`).filter((w)=>w.trim().length>0).map((w)=>JSON.parse(w)),l=await e.client.post(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}/upsert`,{vectors:c});e.output.success(`Upserted ${l.count} vectors into "${o}".`)}var R$=p(()=>{h();f()});async function b$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"vector");if(!t)throw new i("--vector <json-array> is required.");let r;try{if(r=JSON.parse(t),!Array.isArray(r))throw Error("Not an array")}catch{throw new i(`Invalid vector JSON: "${t}". Must be a JSON array of numbers.`)}let m=await u(a(n,"accountId"),e.client,e.config),c={vector:r},l=R(n,"topK");if(l!==void 0)c.topK=l;let w=a(n,"filter");if(w)try{c.filter=JSON.parse(w)}catch{throw new i(`Invalid filter JSON: "${w}".`)}if(v(n,"returnMetadata"))c.returnMetadata=!0;if(v(n,"returnValues"))c.returnValues=!0;let _=await e.client.post(`/accounts/${encodeURIComponent(m)}/vectorize/v2/indexes/${encodeURIComponent(o)}/query`,c),I=[{key:"id",header:"ID",width:30},{key:"score",header:"Score",width:12},{key:"metadata",header:"Metadata",width:40,transform:(P)=>P?JSON.stringify(P):"-"}];e.output.table(_.matches??[],I)}var P$=p(()=>{h();f()});async function I$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=D(n,"ids");if(!t||t.length===0)throw new i("--ids <id,...> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=await e.client.post(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}/get_by_ids`,{ids:t}),c=[{key:"id",header:"ID",width:30},{key:"values",header:"Values",width:50,transform:(l)=>{if(Array.isArray(l)){let w=l;if(w.length>5)return`[${w.slice(0,5).join(", ")}, ... (${w.length} dims)]`;return JSON.stringify(w)}return"-"}},{key:"metadata",header:"Metadata",width:30,transform:(l)=>l?JSON.stringify(l):"-"}];e.output.table(m,c)}var v$=p(()=>{h();f()});async function D$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=D(n,"ids");if(!t||t.length===0)throw new i("--ids <id,...> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete ${t.length} vector(s) from index "${o}"?`,e.flags)){e.output.info("Aborted.");return}let c=await e.client.post(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}/delete_by_ids`,{ids:t});e.output.success(`Deleted ${c.count} vector(s) from "${o}".`)}var S$=p(()=>{h();f();U()});async function A$(s,e){let[n,...o]=s;switch(n){case"get":case"show":return I$(o,e);case"delete":case"rm":case"remove":return D$(o,e);case void 0:case"--help":case"-h":e.output.raw(q$);return;default:throw new i(`Unknown vectorize vectors command: "${n}"
|
|
1838
|
+
|
|
1839
|
+
${q$}`)}}var q$=`Usage: cf vectorize vectors <command>
|
|
1840
|
+
|
|
1841
|
+
Commands:
|
|
1842
|
+
get Get vectors by IDs
|
|
1843
|
+
delete Delete vectors by IDs
|
|
1844
|
+
|
|
1845
|
+
Run 'cf vectorize vectors <command> --help' for more information.`;var L$=p(()=>{f();v$();S$()});async function N$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/vectorize/v2/indexes/${encodeURIComponent(o)}/metadata_index`),m=[{key:"property_name",header:"Property",width:30},{key:"index_type",header:"Type",width:20}];e.output.table(r,m)}var E$=p(()=>{h();f()});async function G$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"property");if(!t)throw new i("--property <name> is required.");let r=a(n,"type");if(!r)throw new i("--type <type> is required.");let m=await u(a(n,"accountId"),e.client,e.config);await e.client.post(`/accounts/${encodeURIComponent(m)}/vectorize/v2/indexes/${encodeURIComponent(o)}/metadata_index`,{property_name:t,index_type:r}),e.output.success(`Metadata index on "${t}" (type: ${r}) created for "${o}".`)}var M$=p(()=>{h();f()});async function T$(s,e){let{flags:n}=d(s),o=a(n,"index");if(!o)throw new i("--index <name> is required.");let t=a(n,"property");if(!t)throw new i("--property <name> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete metadata index on "${t}" from index "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/vectorize/v2/indexes/${encodeURIComponent(o)}/metadata_index`,{property_name:t}),e.output.success(`Metadata index on "${t}" deleted from "${o}".`)}var Z$=p(()=>{h();f();U()});async function j$(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return N$(o,e);case"create":return G$(o,e);case"delete":case"rm":case"remove":return T$(o,e);case void 0:case"--help":case"-h":e.output.raw(O$);return;default:throw new i(`Unknown vectorize metadata-index command: "${n}"
|
|
1846
|
+
|
|
1847
|
+
${O$}`)}}var O$=`Usage: cf vectorize metadata-index <command>
|
|
1848
|
+
|
|
1849
|
+
Commands:
|
|
1850
|
+
list List metadata indexes
|
|
1851
|
+
create Create a metadata index
|
|
1852
|
+
delete Delete a metadata index
|
|
1853
|
+
|
|
1854
|
+
Run 'cf vectorize metadata-index <command> --help' for more information.`;var J$=p(()=>{f();E$();M$();Z$()});var H$={};z(H$,{run:()=>m1});async function m1(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return u$(o,e);case"get":case"show":return l$(o,e);case"create":return h$(o,e);case"update":return C$(o,e);case"delete":case"rm":case"remove":return $$(o,e);case"insert":return U$(o,e);case"upsert":return z$(o,e);case"query":case"search":return b$(o,e);case"vectors":case"vector":return A$(o,e);case"metadata-index":case"metadata-indexes":case"meta-index":return j$(o,e);case void 0:case"--help":case"-h":e.output.raw(B$);return;default:throw new i(`Unknown vectorize command: "${n}"
|
|
1855
|
+
|
|
1856
|
+
${B$}`)}}var B$=`Usage: cf vectorize <command>
|
|
1857
|
+
|
|
1858
|
+
Commands:
|
|
1859
|
+
list List Vectorize indexes
|
|
1860
|
+
get Get index details
|
|
1861
|
+
create Create an index
|
|
1862
|
+
update Update an index
|
|
1863
|
+
delete Delete an index
|
|
1864
|
+
insert Insert vectors from an NDJSON file
|
|
1865
|
+
upsert Upsert vectors from an NDJSON file
|
|
1866
|
+
query Query vectors by similarity
|
|
1867
|
+
vectors Manage individual vectors
|
|
1868
|
+
metadata-index Manage metadata indexes
|
|
1869
|
+
|
|
1870
|
+
Run 'cf vectorize <command> --help' for more information.`;var V$=p(()=>{f();f$();w$();y$();g$();k$();_$();R$();P$();L$();J$()});async function W$(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"start"),r=a(n,"end"),m={};if(t)m.start=t;if(r)m.end=r;let c=await e.client.get(`/accounts/${encodeURIComponent(o)}/stream`,m),l=[{key:"uid",header:"ID",width:34},{key:"status",header:"Status",width:12,transform:(w)=>{return w?.state??"unknown"}},{key:"duration",header:"Duration",width:10,transform:(w)=>w!=null?`${w}s`:"-"},{key:"size",header:"Size",width:12,transform:(w)=>w!=null?String(w):"-"},{key:"created",header:"Created",width:12,transform:(w)=>w?String(w).slice(0,10):"-"}];e.output.table(c,l)}var K$=p(()=>{h()});async function Q$(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <video-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/stream/${encodeURIComponent(o)}`);e.output.detail({ID:r.uid,Status:r.status?.state??"unknown",Duration:r.duration!=null?`${r.duration}s`:"-",Size:r.size??"-",Ready:r.readyToStream??!1,Created:r.created??"-",Modified:r.modified??"-",Preview:r.preview??"-",HLS:r.playback?.hls??"-",DASH:r.playback?.dash??"-","Signed URLs":r.requireSignedURLs??!1})}var Y$=p(()=>{h();f()});async function X$(s,e){let{flags:n}=d(s),o=a(n,"file"),t=a(n,"url"),r=a(n,"name"),m=a(n,"expiry");if(!o&&!t)throw new i("Either --file <path> or --url <url> is required.");if(o&&t)throw new i("Provide either --file or --url, not both.");let c=await u(a(n,"accountId"),e.client,e.config);if(t){let _={url:t};if(r)_.meta={name:r};if(m)_.scheduledDeletion=m;let I=await e.client.post(`/accounts/${encodeURIComponent(c)}/stream/copy`,_);e.output.success(`Video queued for download: ${I.uid}`);return}let l;try{let I=await Bun.file(o).arrayBuffer();l=new Blob([I])}catch{throw new i(`Cannot read file: "${o}".`)}let w=new FormData;if(w.set("file",l,o),r)w.set("meta",JSON.stringify({name:r}));if(m)w.set("scheduledDeletion",m);let k=await e.client.upload(`/accounts/${encodeURIComponent(c)}/stream`,w);e.output.success(`Video uploaded: ${k.uid}`)}var F$=p(()=>{h();f()});async function x$(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <video-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete video ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/stream/${encodeURIComponent(o)}`),e.output.success(`Deleted video: ${o}`)}var ek=p(()=>{h();f();U()});async function ok(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <video-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/stream/${encodeURIComponent(o)}/downloads`);e.output.detail({"Video ID":o,"Download URL":r.default?.url??"-",Status:r.default?.status??"-",Progress:r.default?.percentComplete!=null?`${r.default.percentComplete}%`:"-"})}var nk=p(()=>{h();f()});async function tk(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/stream/live_inputs`),r=[{key:"uid",header:"ID",width:34},{key:"meta",header:"Name",width:20,transform:(m)=>{let c=m;return c?.name?String(c.name):"-"}},{key:"status",header:"Status",width:12,transform:(m)=>{return m?.current?.state??"-"}},{key:"created",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var rk=p(()=>{h()});async function ik(s,e){let{flags:n}=d(s),o=a(n,"name");if(!o)throw new i("--name <name> is required.");let t=a(n,"mode"),r=await u(a(n,"accountId"),e.client,e.config),m={meta:{name:o}};if(t)m.recording={mode:t};let c=await e.client.post(`/accounts/${encodeURIComponent(r)}/stream/live_inputs`,m);e.output.detail({ID:c.uid,"RTMPS URL":c.rtmps?.url??"-","RTMPS Key":c.rtmps?.streamKey??"-","SRT URL":c.srt?.url??"-",Created:c.created??"-"}),e.output.success(`Live input created: ${c.uid}`)}var sk=p(()=>{h();f()});async function ak(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <live-input-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/stream/live_inputs/${encodeURIComponent(o)}`);e.output.detail({ID:r.uid,Status:r.status?.current?.state??"-","RTMPS URL":r.rtmps?.url??"-","RTMPS Key":r.rtmps?.streamKey??"-","SRT URL":r.srt?.url??"-","WebRTC URL":r.webRTC?.url??"-","Recording Mode":r.recording?.mode??"-",Created:r.created??"-",Modified:r.modified??"-"})}var mk=p(()=>{h();f()});async function dk(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <live-input-id> is required.");let t=a(n,"name"),r=a(n,"mode"),m=await u(a(n,"accountId"),e.client,e.config),c={};if(t)c.meta={name:t};if(r)c.recording={mode:r};let l=await e.client.put(`/accounts/${encodeURIComponent(m)}/stream/live_inputs/${encodeURIComponent(o)}`,c);e.output.success(`Live input updated: ${l.uid}`)}var ck=p(()=>{h();f()});async function pk(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <live-input-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete live input ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/stream/live_inputs/${encodeURIComponent(o)}`),e.output.success(`Deleted live input: ${o}`)}var uk=p(()=>{h();f();U()});async function lk(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return tk(o,e);case"create":case"add":return ik(o,e);case"get":case"show":return ak(o,e);case"update":case"set":return dk(o,e);case"delete":case"rm":case"remove":return pk(o,e);case void 0:case"--help":case"-h":e.output.raw(fk);return;default:throw new i(`Unknown stream live command: "${n}"
|
|
1871
|
+
|
|
1872
|
+
${fk}`)}}var fk=`Usage: cf stream live <command>
|
|
1873
|
+
|
|
1874
|
+
Commands:
|
|
1875
|
+
list List live inputs
|
|
1876
|
+
create Create a new live input
|
|
1877
|
+
get Get a live input
|
|
1878
|
+
update Update a live input
|
|
1879
|
+
delete Delete a live input
|
|
1880
|
+
|
|
1881
|
+
Run 'cf stream live <command> --help' for more information.`;var wk=p(()=>{f();rk();sk();mk();ck();uk()});async function hk(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/stream/${encodeURIComponent(o)}/captions`),m=[{key:"language",header:"Language",width:12},{key:"label",header:"Label",width:30},{key:"generated",header:"Auto-Generated",width:16,transform:(c)=>c?"Yes":"No"}];e.output.table(r,m)}var yk=p(()=>{h();f()});async function Ck(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=a(n,"language");if(!t)throw new i("--language <lang> is required (e.g., en, es, fr).");let r=a(n,"file");if(!r)throw new i("--file <vtt-file> is required.");let m=await u(a(n,"accountId"),e.client,e.config),c;try{c=await Bun.file(r).arrayBuffer()}catch{throw new i(`Cannot read file: "${r}".`)}let l=new FormData;l.set("file",new Blob([c]),r.split("/").pop()??"captions.vtt");let w=await e.client.uploadPut(`/accounts/${encodeURIComponent(m)}/stream/${encodeURIComponent(o)}/captions/${encodeURIComponent(t)}`,l);e.output.success(`Captions uploaded for language: ${w.language??t}`)}var gk=p(()=>{h();f()});async function $k(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=a(n,"language");if(!t)throw new i("--language <lang> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete captions for language "${t}" on video ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/stream/${encodeURIComponent(o)}/captions/${encodeURIComponent(t)}`),e.output.success(`Deleted captions: ${t} on video ${o}`)}var kk=p(()=>{h();f();U()});async function _k(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return hk(o,e);case"upload":case"add":return Ck(o,e);case"delete":case"rm":case"remove":return $k(o,e);case void 0:case"--help":case"-h":e.output.raw(Uk);return;default:throw new i(`Unknown stream captions command: "${n}"
|
|
1882
|
+
|
|
1883
|
+
${Uk}`)}}var Uk=`Usage: cf stream captions <command>
|
|
1884
|
+
|
|
1885
|
+
Commands:
|
|
1886
|
+
list List captions for a video
|
|
1887
|
+
upload Upload captions (VTT file)
|
|
1888
|
+
delete Delete captions for a language
|
|
1889
|
+
|
|
1890
|
+
Run 'cf stream captions <command> --help' for more information.`;var zk=p(()=>{f();yk();gk();kk()});async function Rk(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/stream/${encodeURIComponent(o)}/audio`),m=[{key:"uid",header:"ID",width:34},{key:"label",header:"Label",width:20},{key:"language",header:"Language",width:10},{key:"default",header:"Default",width:8,transform:(c)=>c?"Yes":"No"},{key:"status",header:"Status",width:10}];e.output.table(r,m)}var bk=p(()=>{h();f()});async function Pk(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=a(n,"label");if(!t)throw new i("--label <label> is required.");let r=a(n,"language");if(!r)throw new i("--language <lang> is required.");let m=await u(a(n,"accountId"),e.client,e.config),c=await e.client.post(`/accounts/${encodeURIComponent(m)}/stream/${encodeURIComponent(o)}/audio`,{label:t,language:r});e.output.success(`Audio track added: ${c.uid??"created"}`)}var Ik=p(()=>{h();f()});async function vk(s,e){let{flags:n}=d(s),o=a(n,"video");if(!o)throw new i("--video <video-id> is required.");let t=a(n,"id");if(!t)throw new i("--id <track-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete audio track ${t} from video ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/stream/${encodeURIComponent(o)}/audio/${encodeURIComponent(t)}`),e.output.success(`Deleted audio track: ${t}`)}var Dk=p(()=>{h();f();U()});async function qk(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Rk(o,e);case"add":case"create":return Pk(o,e);case"delete":case"rm":case"remove":return vk(o,e);case void 0:case"--help":case"-h":e.output.raw(Sk);return;default:throw new i(`Unknown stream audio command: "${n}"
|
|
1891
|
+
|
|
1892
|
+
${Sk}`)}}var Sk=`Usage: cf stream audio <command>
|
|
1893
|
+
|
|
1894
|
+
Commands:
|
|
1895
|
+
list List audio tracks for a video
|
|
1896
|
+
add Add an audio track
|
|
1897
|
+
delete Delete an audio track
|
|
1898
|
+
|
|
1899
|
+
Run 'cf stream audio <command> --help' for more information.`;var Ak=p(()=>{f();bk();Ik();Dk()});async function Lk(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/stream/keys`),r=[{key:"id",header:"ID",width:34},{key:"created",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var Nk=p(()=>{h()});async function Ek(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.post(`/accounts/${encodeURIComponent(o)}/stream/keys`);e.output.detail({ID:t.id,PEM:t.pem??"-",JWK:t.jwk??"-",Created:t.created??"-"}),e.output.success(`Signing key created: ${t.id}`)}var Gk=p(()=>{h()});async function Mk(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <key-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete signing key ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/stream/keys/${encodeURIComponent(o)}`),e.output.success(`Deleted signing key: ${o}`)}var Tk=p(()=>{h();f();U()});async function Ok(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Lk(o,e);case"create":case"add":return Ek(o,e);case"delete":case"rm":case"remove":return Mk(o,e);case void 0:case"--help":case"-h":e.output.raw(Zk);return;default:throw new i(`Unknown stream signing-keys command: "${n}"
|
|
1900
|
+
|
|
1901
|
+
${Zk}`)}}var Zk=`Usage: cf stream signing-keys <command>
|
|
1902
|
+
|
|
1903
|
+
Commands:
|
|
1904
|
+
list List signing keys
|
|
1905
|
+
create Create a new signing key
|
|
1906
|
+
delete Delete a signing key
|
|
1907
|
+
|
|
1908
|
+
Run 'cf stream signing-keys <command> --help' for more information.`;var jk=p(()=>{f();Nk();Gk();Tk()});async function Jk(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/stream/watermarks`),r=[{key:"uid",header:"ID",width:34},{key:"name",header:"Name",width:20},{key:"size",header:"Size",width:10,transform:(m)=>m!=null?String(m):"-"},{key:"position",header:"Position",width:12},{key:"created",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var Bk=p(()=>{h()});async function Hk(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <image-file> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{let $=await Bun.file(o).arrayBuffer();r=new Blob([$])}catch{throw new i(`Cannot read file: "${o}".`)}let m=new FormData;m.set("file",r,o);let l=await e.client.upload(`/accounts/${encodeURIComponent(t)}/stream/watermarks`,m);e.output.success(`Watermark uploaded: ${l.uid}`)}var Vk=p(()=>{h();f()});async function Wk(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <watermark-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete watermark ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/stream/watermarks/${encodeURIComponent(o)}`),e.output.success(`Deleted watermark: ${o}`)}var Kk=p(()=>{h();f();U()});async function Yk(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Jk(o,e);case"upload":case"add":case"create":return Hk(o,e);case"delete":case"rm":case"remove":return Wk(o,e);case void 0:case"--help":case"-h":e.output.raw(Qk);return;default:throw new i(`Unknown stream watermarks command: "${n}"
|
|
1909
|
+
|
|
1910
|
+
${Qk}`)}}var Qk=`Usage: cf stream watermarks <command>
|
|
1911
|
+
|
|
1912
|
+
Commands:
|
|
1913
|
+
list List watermark profiles
|
|
1914
|
+
upload Upload a new watermark image
|
|
1915
|
+
delete Delete a watermark profile
|
|
1916
|
+
|
|
1917
|
+
Run 'cf stream watermarks <command> --help' for more information.`;var Xk=p(()=>{f();Bk();Vk();Kk()});async function Fk(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/stream/webhook`);e.output.detail({"Notification URL":t.notificationUrl??"Not configured",Modified:t.modified??"-"})}var xk=p(()=>{h()});async function eU(s,e){let{flags:n}=d(s),o=a(n,"url");if(!o)throw new i("--url <webhook-url> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.put(`/accounts/${encodeURIComponent(t)}/stream/webhook`,{notificationUrl:o});e.output.success(`Webhook set: ${r.notificationUrl??o}`)}var oU=p(()=>{h();f()});async function nU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config);if(!await C("Delete stream webhook?",e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/stream/webhook`),e.output.success("Stream webhook deleted.")}var tU=p(()=>{h();U()});async function iU(s,e){let[n,...o]=s;switch(n){case"get":case"show":return Fk(o,e);case"set":case"update":return eU(o,e);case"delete":case"rm":case"remove":return nU(o,e);case void 0:case"--help":case"-h":e.output.raw(rU);return;default:throw new i(`Unknown stream webhooks command: "${n}"
|
|
1918
|
+
|
|
1919
|
+
${rU}`)}}var rU=`Usage: cf stream webhooks <command>
|
|
1920
|
+
|
|
1921
|
+
Commands:
|
|
1922
|
+
get Get the current webhook configuration
|
|
1923
|
+
set Set the webhook notification URL
|
|
1924
|
+
delete Delete the webhook
|
|
1925
|
+
|
|
1926
|
+
Run 'cf stream webhooks <command> --help' for more information.`;var sU=p(()=>{f();xk();oU();tU()});var mU={};z(mU,{run:()=>Z1});async function Z1(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return W$(o,e);case"get":case"show":return Q$(o,e);case"upload":return X$(o,e);case"delete":case"rm":case"remove":return x$(o,e);case"download":case"dl":return ok(o,e);case"live":return lk(o,e);case"captions":case"caption":case"subtitles":return _k(o,e);case"audio":return qk(o,e);case"signing-keys":case"keys":return Ok(o,e);case"watermarks":case"watermark":return Yk(o,e);case"webhooks":case"webhook":return iU(o,e);case void 0:case"--help":case"-h":e.output.raw(aU);return;default:throw new i(`Unknown stream command: "${n}"
|
|
1927
|
+
|
|
1928
|
+
${aU}`)}}var aU=`Usage: cf stream <command>
|
|
1929
|
+
|
|
1930
|
+
Commands:
|
|
1931
|
+
list List all videos
|
|
1932
|
+
get Get video details
|
|
1933
|
+
upload Upload a video (file or URL)
|
|
1934
|
+
delete Delete a video
|
|
1935
|
+
download Get download URL for a video
|
|
1936
|
+
|
|
1937
|
+
Sub-resources:
|
|
1938
|
+
live Manage live inputs
|
|
1939
|
+
captions Manage video captions/subtitles
|
|
1940
|
+
audio Manage audio tracks
|
|
1941
|
+
signing-keys Manage signing keys
|
|
1942
|
+
watermarks Manage watermark profiles
|
|
1943
|
+
webhooks Manage webhook notifications
|
|
1944
|
+
|
|
1945
|
+
Run 'cf stream <command> --help' for more information.`;var dU=p(()=>{f();K$();Y$();F$();ek();nk();wk();zk();Ak();jk();Xk();sU()});async function cU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=R(n,"page"),r=R(n,"perPage"),m={};if(t)m.page=String(t);if(r)m.per_page=String(r);let c=await e.client.get(`/accounts/${encodeURIComponent(o)}/images/v1`,m),l=[{key:"id",header:"ID",width:38},{key:"filename",header:"Filename",width:24},{key:"requireSignedURLs",header:"Signed URLs",width:12,transform:(w)=>w?"Yes":"No"},{key:"uploaded",header:"Uploaded",width:12,transform:(w)=>w?String(w).slice(0,10):"-"}];e.output.table(c,l)}var pU=p(()=>{h()});async function uU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <image-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/images/v1/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Filename:r.filename??"-",Uploaded:r.uploaded??"-","Signed URLs":r.requireSignedURLs??!1,Variants:(r.variants??[]).join(", ")||"-",Meta:r.meta?JSON.stringify(r.meta):"-"})}var fU=p(()=>{h();f()});async function lU(s,e){let{flags:n}=d(s),o=a(n,"file"),t=a(n,"url"),r=a(n,"name");if(!o&&!t)throw new i("Either --file <path> or --url <url> is required.");if(o&&t)throw new i("Provide either --file or --url, not both.");let m=await u(a(n,"accountId"),e.client,e.config);if(t){let k=new FormData;if(k.set("url",t),r)k.set("metadata",JSON.stringify({name:r}));let I=await e.client.upload(`/accounts/${encodeURIComponent(m)}/images/v1`,k);e.output.success(`Image uploaded from URL: ${I.id}`);return}let c;try{let _=await Bun.file(o).arrayBuffer();c=new Blob([_])}catch{throw new i(`Cannot read file: "${o}".`)}let l=new FormData;if(l.set("file",c,o),r)l.set("metadata",JSON.stringify({name:r}));let $=await e.client.upload(`/accounts/${encodeURIComponent(m)}/images/v1`,l);e.output.success(`Image uploaded: ${$.id}`)}var wU=p(()=>{h();f()});async function hU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <image-id> is required.");let t=a(n,"name"),r=a(n,"metadata"),m=await u(a(n,"accountId"),e.client,e.config);if(!t&&!r)throw new i("At least one of --name or --metadata is required.");let c={};if(r){let w;try{w=JSON.parse(r)}catch{throw new i("--metadata must be valid JSON.")}c.metadata=w}else if(t)c.metadata={name:t};let l=await e.client.patch(`/accounts/${encodeURIComponent(m)}/images/v1/${encodeURIComponent(o)}`,c);e.output.success(`Image updated: ${l.id}`)}var yU=p(()=>{h();f()});async function CU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <image-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete image ${o}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/images/v1/${encodeURIComponent(o)}`),e.output.success(`Deleted image: ${o}`)}var gU=p(()=>{h();f();U()});async function $U(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/images/v1/stats`);e.output.detail({"Current Count":t.count?.current??"-","Allowed Count":t.count?.allowed??"-"})}var kU=p(()=>{h()});async function UU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"expiry"),r=new FormData;if(t)r.set("expiry",t);let m=await e.client.upload(`/accounts/${encodeURIComponent(o)}/images/v2/direct_upload`,r);e.output.detail({ID:m.id,"Upload URL":m.uploadURL})}var _U=p(()=>{h()});async function zU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/images/v1/variants`),r=Object.entries(t).map(([c,l])=>({...l,id:c})),m=[{key:"id",header:"ID",width:20},{key:"options",header:"Fit",width:12,transform:(c)=>{return c?.fit??"-"}},{key:"options",header:"Width",width:8,transform:(c)=>{let l=c;return l?.width!=null?String(l.width):"-"}},{key:"options",header:"Height",width:8,transform:(c)=>{let l=c;return l?.height!=null?String(l.height):"-"}},{key:"neverRequireSignedURLs",header:"Public",width:8,transform:(c)=>c?"Yes":"No"}];e.output.table(r,m)}var RU=p(()=>{h()});async function bU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <variant-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/images/v1/variants/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Fit:r.options?.fit??"-",Width:r.options?.width??"-",Height:r.options?.height??"-",Metadata:r.options?.metadata??"-",Public:r.neverRequireSignedURLs??!1})}var PU=p(()=>{h();f()});async function IU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <variant-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <variant-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l={id:o,options:c},w=await e.client.post(`/accounts/${encodeURIComponent(r)}/images/v1/variants`,l);e.output.success(`Variant created: ${w.id}`)}var vU=p(()=>{h();f()});async function DU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <variant-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <variant-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l={options:c},w=await e.client.patch(`/accounts/${encodeURIComponent(r)}/images/v1/variants/${encodeURIComponent(o)}`,l);e.output.success(`Variant updated: ${w.id}`)}var SU=p(()=>{h();f()});async function qU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <variant-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete image variant "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/images/v1/variants/${encodeURIComponent(o)}`),e.output.success(`Deleted variant: ${o}`)}var AU=p(()=>{h();f();U()});async function NU(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return zU(o,e);case"get":case"show":return bU(o,e);case"create":case"add":return IU(o,e);case"update":case"set":return DU(o,e);case"delete":case"rm":case"remove":return qU(o,e);case void 0:case"--help":case"-h":e.output.raw(LU);return;default:throw new i(`Unknown images variants command: "${n}"
|
|
1946
|
+
|
|
1947
|
+
${LU}`)}}var LU=`Usage: cf images variants <command>
|
|
1948
|
+
|
|
1949
|
+
Commands:
|
|
1950
|
+
list List image variants
|
|
1951
|
+
get Get a variant's details
|
|
1952
|
+
create Create a new variant
|
|
1953
|
+
update Update a variant
|
|
1954
|
+
delete Delete a variant
|
|
1955
|
+
|
|
1956
|
+
Run 'cf images variants <command> --help' for more information.`;var EU=p(()=>{f();RU();PU();vU();SU();AU()});async function GU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/images/v1/keys`),r=[{key:"name",header:"Name",width:40}];e.output.table(t,r)}var MU=p(()=>{h()});async function TU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.post(`/accounts/${encodeURIComponent(o)}/images/v1/keys`);e.output.detail({Name:t.name,Value:t.value??"-"}),e.output.success(`Signing key created: ${t.name}`)}var ZU=p(()=>{h()});async function jU(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return GU(o,e);case"create":case"add":return TU(o,e);case void 0:case"--help":case"-h":e.output.raw(OU);return;default:throw new i(`Unknown images signing-keys command: "${n}"
|
|
1957
|
+
|
|
1958
|
+
${OU}`)}}var OU=`Usage: cf images signing-keys <command>
|
|
1959
|
+
|
|
1960
|
+
Commands:
|
|
1961
|
+
list List signing keys
|
|
1962
|
+
create Create a new signing key
|
|
1963
|
+
|
|
1964
|
+
Run 'cf images signing-keys <command> --help' for more information.`;var JU=p(()=>{f();MU();ZU()});var HU={};z(HU,{run:()=>tZ});async function tZ(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return cU(o,e);case"get":case"show":return uU(o,e);case"upload":return lU(o,e);case"update":case"set":return hU(o,e);case"delete":case"rm":case"remove":return CU(o,e);case"stats":case"usage":return $U(o,e);case"direct-upload":return UU(o,e);case"variants":case"variant":return NU(o,e);case"signing-keys":case"keys":return jU(o,e);case void 0:case"--help":case"-h":e.output.raw(BU);return;default:throw new i(`Unknown images command: "${n}"
|
|
1965
|
+
|
|
1966
|
+
${BU}`)}}var BU=`Usage: cf images <command>
|
|
1967
|
+
|
|
1968
|
+
Commands:
|
|
1969
|
+
list List all images
|
|
1970
|
+
get Get image details
|
|
1971
|
+
upload Upload an image (file or URL)
|
|
1972
|
+
update Update image metadata
|
|
1973
|
+
delete Delete an image
|
|
1974
|
+
stats View image usage statistics
|
|
1975
|
+
direct-upload Get a direct upload URL
|
|
1976
|
+
|
|
1977
|
+
Sub-resources:
|
|
1978
|
+
variants Manage image variants
|
|
1979
|
+
signing-keys Manage signing keys
|
|
1980
|
+
|
|
1981
|
+
Run 'cf images <command> --help' for more information.`;var VU=p(()=>{f();pU();fU();wU();yU();gU();kU();_U();EU();JU()});async function WU(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/addressing/address_maps`),r=[{key:"id",header:"ID",width:36},{key:"description",header:"Description",width:30},{key:"enabled",header:"Enabled",width:8,transform:(m)=>m?"Yes":"No"},{key:"can_delete",header:"Deletable",width:10,transform:(m)=>m?"Yes":"No"},{key:"created_at",header:"Created",width:24}];e.output.table(t,r)}var KU=p(()=>{h()});async function QU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <address-map-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/addressing/address_maps/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Description:r.description??"","Default SNI":r.default_sni??"",Enabled:r.enabled??!1,"Can Delete":r.can_delete??!1,"Can Modify IPs":r.can_modify_ips??!1,IPs:r.ips?.map((m)=>`${m.type}:${m.ip}`).join(", ")??"",Created:r.created_at??"",Modified:r.modified_at??""})}var YU=p(()=>{h();f()});async function XU(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <map-json> is required.");let t;try{t=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let r;try{r=JSON.parse(t)}catch{throw new i("File must contain valid JSON.")}let m=await u(a(n,"accountId"),e.client,e.config),c=await e.client.post(`/accounts/${encodeURIComponent(m)}/addressing/address_maps`,r);e.output.success(`Address map created: ${c.id}`),e.output.detail({ID:c.id,Description:c.description??"",Enabled:c.enabled??!1})}var FU=p(()=>{h();f()});async function xU(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <address-map-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <map-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await u(a(n,"accountId"),e.client,e.config),l=await e.client.patch(`/accounts/${encodeURIComponent(c)}/addressing/address_maps/${encodeURIComponent(o)}`,m);e.output.success(`Address map "${o}" updated.`),e.output.detail({ID:l.id,Description:l.description??"",Enabled:l.enabled??!1})}var e_=p(()=>{h();f()});async function o_(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <address-map-id> is required.");if(!await C(`Delete address map "${o}"?`,e.flags)){e.output.info("Aborted.");return}let r=await u(a(n,"accountId"),e.client,e.config);await e.client.delete(`/accounts/${encodeURIComponent(r)}/addressing/address_maps/${encodeURIComponent(o)}`),e.output.success(`Address map "${o}" deleted.`)}var n_=p(()=>{h();f();U()});async function r_(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return WU(o,e);case"get":case"show":return QU(o,e);case"create":return XU(o,e);case"update":return xU(o,e);case"delete":case"rm":case"remove":return o_(o,e);case void 0:case"--help":case"-h":e.output.raw(t_);return;default:throw new i(`Unknown address-maps command: "${n}"
|
|
1982
|
+
|
|
1983
|
+
${t_}`)}}var t_=`Usage: cf addressing address-maps <command>
|
|
1984
|
+
|
|
1985
|
+
Commands:
|
|
1986
|
+
list List address maps
|
|
1987
|
+
get Get address map details
|
|
1988
|
+
create Create a new address map
|
|
1989
|
+
update Update an address map
|
|
1990
|
+
delete Delete an address map
|
|
1991
|
+
|
|
1992
|
+
Run 'cf addressing address-maps <command> --help' for more information.`;var i_=p(()=>{f();KU();YU();FU();e_();n_()});async function s_(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/addressing/prefixes`),r=[{key:"id",header:"ID",width:36},{key:"cidr",header:"CIDR",width:20},{key:"asn",header:"ASN",width:10},{key:"description",header:"Description",width:24},{key:"advertised",header:"Advertised",width:12,transform:(m)=>m?"Yes":"No"},{key:"approved",header:"Approved",width:12}];e.output.table(t,r)}var a_=p(()=>{h()});async function m_(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <prefix-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/addressing/prefixes/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,CIDR:r.cidr,ASN:r.asn??"",Description:r.description??"","Account ID":r.account_id??"",Approved:r.approved??"",Advertised:r.advertised??!1,"On-Demand Enabled":r.on_demand_enabled??!1,"On-Demand Locked":r.on_demand_locked??!1,"LOA Document ID":r.loa_document_id??"",Created:r.created_at??"",Modified:r.modified_at??""})}var d_=p(()=>{h();f()});async function c_(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <prefix-json> is required.");let t;try{t=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let r;try{r=JSON.parse(t)}catch{throw new i("File must contain valid JSON.")}let m=await u(a(n,"accountId"),e.client,e.config),c=await e.client.post(`/accounts/${encodeURIComponent(m)}/addressing/prefixes`,r);e.output.success(`Prefix created: ${c.id}`),e.output.detail({ID:c.id,CIDR:c.cidr,Description:c.description??""})}var p_=p(()=>{h();f()});async function u_(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <prefix-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <prefix-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await u(a(n,"accountId"),e.client,e.config),l=await e.client.patch(`/accounts/${encodeURIComponent(c)}/addressing/prefixes/${encodeURIComponent(o)}`,m);e.output.success(`Prefix "${o}" updated.`),e.output.detail({ID:l.id,CIDR:l.cidr,Description:l.description??""})}var f_=p(()=>{h();f()});async function l_(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <prefix-id> is required.");if(!await C(`Delete prefix "${o}"?`,e.flags)){e.output.info("Aborted.");return}let r=await u(a(n,"accountId"),e.client,e.config);await e.client.delete(`/accounts/${encodeURIComponent(r)}/addressing/prefixes/${encodeURIComponent(o)}`),e.output.success(`Prefix "${o}" deleted.`)}var w_=p(()=>{h();f();U()});async function h_(s,e){let{flags:n}=d(s),o=a(n,"prefix");if(!o)throw new i("--prefix <prefix-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/addressing/prefixes/${encodeURIComponent(o)}/bgp/prefixes`),m=[{key:"id",header:"ID",width:36},{key:"cidr",header:"CIDR",width:20},{key:"created_at",header:"Created",width:24},{key:"modified_at",header:"Modified",width:24}];e.output.table(r,m)}var y_=p(()=>{h();f()});async function C_(s,e){let{flags:n}=d(s),o=a(n,"prefix");if(!o)throw new i("--prefix <prefix-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/addressing/prefixes/${encodeURIComponent(o)}/delegations`),m=[{key:"id",header:"ID",width:36},{key:"cidr",header:"CIDR",width:20},{key:"delegated_account_id",header:"Delegated Account",width:36},{key:"description",header:"Description",width:24},{key:"created_at",header:"Created",width:24}];e.output.table(r,m)}var g_=p(()=>{h();f()});async function k_(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return s_(o,e);case"get":case"show":return m_(o,e);case"create":return c_(o,e);case"update":return u_(o,e);case"delete":case"rm":case"remove":return l_(o,e);case"bgp-prefixes":case"bgp":return h_(o,e);case"delegations":case"delegation":return C_(o,e);case void 0:case"--help":case"-h":e.output.raw($_);return;default:throw new i(`Unknown prefixes command: "${n}"
|
|
1993
|
+
|
|
1994
|
+
${$_}`)}}var $_=`Usage: cf addressing prefixes <command>
|
|
1995
|
+
|
|
1996
|
+
Commands:
|
|
1997
|
+
list List IP prefixes
|
|
1998
|
+
get Get prefix details
|
|
1999
|
+
create Create a new prefix
|
|
2000
|
+
update Update a prefix
|
|
2001
|
+
delete Delete a prefix
|
|
2002
|
+
bgp-prefixes List BGP prefixes for a prefix
|
|
2003
|
+
delegations List delegations for a prefix
|
|
2004
|
+
|
|
2005
|
+
Run 'cf addressing prefixes <command> --help' for more information.`;var U_=p(()=>{f();a_();d_();p_();f_();w_();y_();g_()});async function __(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/addressing/regional_hostnames`),m=[{key:"hostname",header:"Hostname",width:40},{key:"region_key",header:"Region",width:16},{key:"created_on",header:"Created",width:24},{key:"modified_on",header:"Modified",width:24}];e.output.table(r,m)}var z_=p(()=>{g();f()});async function R_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"hostname");if(!t)throw new i("--hostname <hostname> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/addressing/regional_hostnames/${encodeURIComponent(t)}`);e.output.detail({Hostname:m.hostname,Region:m.region_key??"",Created:m.created_on??"",Modified:m.modified_on??""})}var b_=p(()=>{g();f()});async function P_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"hostname");if(!t)throw new i("--hostname <hostname> is required.");let r=a(n,"region");if(!r)throw new i("--region <region-key> is required.");let m=await y(o,e.client),c=await e.client.post(`/zones/${encodeURIComponent(m)}/addressing/regional_hostnames`,{hostname:t,region_key:r});e.output.success(`Regional hostname "${c.hostname}" created.`),e.output.detail({Hostname:c.hostname,Region:c.region_key,Created:c.created_on??""})}var I_=p(()=>{g();f()});async function v_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"hostname");if(!t)throw new i("--hostname <hostname> is required.");let r=a(n,"region");if(!r)throw new i("--region <region-key> is required.");let m=await y(o,e.client),c=await e.client.patch(`/zones/${encodeURIComponent(m)}/addressing/regional_hostnames/${encodeURIComponent(t)}`,{region_key:r});e.output.success(`Regional hostname "${t}" updated.`),e.output.detail({Hostname:c.hostname,Region:c.region_key,Modified:c.modified_on??""})}var D_=p(()=>{g();f()});async function S_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"hostname");if(!t)throw new i("--hostname <hostname> is required.");if(!await C(`Delete regional hostname "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/addressing/regional_hostnames/${encodeURIComponent(t)}`),e.output.success(`Regional hostname "${t}" deleted.`)}var q_=p(()=>{g();f();U()});async function L_(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return __(o,e);case"get":case"show":return R_(o,e);case"create":return P_(o,e);case"update":return v_(o,e);case"delete":case"rm":case"remove":return S_(o,e);case void 0:case"--help":case"-h":e.output.raw(A_);return;default:throw new i(`Unknown regional-hostnames command: "${n}"
|
|
2006
|
+
|
|
2007
|
+
${A_}`)}}var A_=`Usage: cf addressing regional-hostnames <command>
|
|
2008
|
+
|
|
2009
|
+
Commands:
|
|
2010
|
+
list List regional hostnames (zone-scoped)
|
|
2011
|
+
get Get a regional hostname by hostname
|
|
2012
|
+
create Create a regional hostname
|
|
2013
|
+
update Update a regional hostname
|
|
2014
|
+
delete Delete a regional hostname
|
|
2015
|
+
|
|
2016
|
+
Run 'cf addressing regional-hostnames <command> --help' for more information.`;var N_=p(()=>{f();z_();b_();I_();D_();q_()});var G_={};z(G_,{run:()=>zZ});async function zZ(s,e){let[n,...o]=s;switch(n){case"address-maps":case"address-map":return r_(o,e);case"prefixes":case"prefix":return k_(o,e);case"regional-hostnames":case"regional-hostname":return L_(o,e);case void 0:case"--help":case"-h":e.output.raw(E_);return;default:throw new i(`Unknown addressing command: "${n}"
|
|
2017
|
+
|
|
2018
|
+
${E_}`)}}var E_=`Usage: cf addressing <command>
|
|
2019
|
+
|
|
2020
|
+
Commands:
|
|
2021
|
+
address-maps Manage address maps
|
|
2022
|
+
prefixes Manage IP prefixes (BGP, delegations)
|
|
2023
|
+
regional-hostnames Manage regional hostnames (zone-scoped)
|
|
2024
|
+
|
|
2025
|
+
Run 'cf addressing <command> --help' for more information.`;var M_=p(()=>{f();i_();U_();N_()});async function T_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/spectrum/apps`),m=[{key:"id",header:"ID",width:36},{key:"protocol",header:"Protocol",width:12},{key:"dns",header:"DNS Name",width:30,transform:(c)=>{return c?.name??""}},{key:"tls",header:"TLS",width:8},{key:"created_on",header:"Created",width:24}];e.output.table(r,m)}var Z_=p(()=>{g();f()});async function O_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <app-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/spectrum/apps/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Protocol:m.protocol,"DNS Type":m.dns?.type??"","DNS Name":m.dns?.name??"","Origin Direct":m.origin_direct?.join(", ")??"","Origin Port":m.origin_port??"","Origin DNS":m.origin_dns?.name??"","IP Firewall":m.ip_firewall??!1,"Proxy Protocol":m.proxy_protocol??"",TLS:m.tls??"","Argo Smart Routing":m.argo_smart_routing??!1,Created:m.created_on??"",Modified:m.modified_on??""})}var j_=p(()=>{g();f()});async function J_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <app-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/spectrum/apps`,m);e.output.success(`Spectrum app created: ${l.id}`),e.output.detail({ID:l.id,Protocol:l.protocol,"DNS Name":l.dns?.name??""})}var B_=p(()=>{g();f()});async function H_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <app-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <app-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.put(`/zones/${encodeURIComponent(l)}/spectrum/apps/${encodeURIComponent(t)}`,c);e.output.success(`Spectrum app "${t}" updated.`),e.output.detail({ID:w.id,Protocol:w.protocol,"DNS Name":w.dns?.name??""})}var V_=p(()=>{g();f()});async function W_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <app-id> is required.");if(!await C(`Delete Spectrum app "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/spectrum/apps/${encodeURIComponent(t)}`),e.output.success(`Spectrum app "${t}" deleted.`)}var K_=p(()=>{g();f();U()});async function Y_(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return T_(o,e);case"get":case"show":return O_(o,e);case"create":return J_(o,e);case"update":return H_(o,e);case"delete":case"rm":case"remove":return W_(o,e);case void 0:case"--help":case"-h":e.output.raw(Q_);return;default:throw new i(`Unknown spectrum apps command: "${n}"
|
|
2026
|
+
|
|
2027
|
+
${Q_}`)}}var Q_=`Usage: cf spectrum apps <command>
|
|
2028
|
+
|
|
2029
|
+
Commands:
|
|
2030
|
+
list List Spectrum apps
|
|
2031
|
+
get Get Spectrum app details
|
|
2032
|
+
create Create a Spectrum app
|
|
2033
|
+
update Update a Spectrum app
|
|
2034
|
+
delete Delete a Spectrum app
|
|
2035
|
+
|
|
2036
|
+
Run 'cf spectrum apps <command> --help' for more information.`;var X_=p(()=>{f();Z_();j_();B_();V_();K_()});async function F_(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r={},m=a(n,"from");if(m)r.since=m;let c=a(n,"to");if(c)r.until=c;let l=await e.client.get(`/zones/${encodeURIComponent(t)}/spectrum/analytics/aggregate/current`,r);e.output.json(l)}var x_=p(()=>{g();f()});async function ez(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r={},m=a(n,"from");if(m)r.since=m;let c=a(n,"to");if(c)r.until=c;let l=await e.client.get(`/zones/${encodeURIComponent(t)}/spectrum/analytics/events/bytime`,r);e.output.json(l)}var oz=p(()=>{g();f()});async function tz(s,e){let[n,...o]=s;switch(n){case"summary":return F_(o,e);case"bytes":return ez(o,e);case void 0:case"--help":case"-h":e.output.raw(nz);return;default:throw new i(`Unknown spectrum analytics command: "${n}"
|
|
2037
|
+
|
|
2038
|
+
${nz}`)}}var nz=`Usage: cf spectrum analytics <command>
|
|
2039
|
+
|
|
2040
|
+
Commands:
|
|
2041
|
+
summary View aggregate analytics summary
|
|
2042
|
+
bytes View byte-level analytics over time
|
|
2043
|
+
|
|
2044
|
+
Run 'cf spectrum analytics <command> --help' for more information.`;var rz=p(()=>{f();x_();oz()});var sz={};z(sz,{run:()=>LZ});async function LZ(s,e){let[n,...o]=s;switch(n){case"apps":case"app":return Y_(o,e);case"analytics":return tz(o,e);case void 0:case"--help":case"-h":e.output.raw(iz);return;default:throw new i(`Unknown spectrum command: "${n}"
|
|
2045
|
+
|
|
2046
|
+
${iz}`)}}var iz=`Usage: cf spectrum <command>
|
|
2047
|
+
|
|
2048
|
+
Commands:
|
|
2049
|
+
apps Manage Spectrum applications (zone-scoped)
|
|
2050
|
+
analytics View Spectrum analytics (zone-scoped)
|
|
2051
|
+
|
|
2052
|
+
Run 'cf spectrum <command> --help' for more information.`;var az=p(()=>{f();X_();rz()});async function mz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/http/summary",o);e.output.json(l)}var dz=()=>{};async function cz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/dns/summary",o);e.output.json(l)}var pz=()=>{};async function uz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/bgp/summary",o);e.output.json(l)}var fz=()=>{};async function lz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/attacks/summary",o);e.output.json(l)}var wz=()=>{};async function hz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/verified_bots/top/bots",o);e.output.json(l)}var yz=()=>{};async function Cz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to"),m=a(n,"asn"),c=a(n,"location");if(t)o.dateStart=t;if(r)o.dateEnd=r;if(m)o.asn=m;if(c)o.location=c;let l=await e.client.get("/radar/email/security/summary",o);e.output.json(l)}var gz=()=>{};async function $z(s,e){let{flags:n}=d(s),o=a(n,"asn");if(!o)throw new i("--asn <number> is required.");let t=await e.client.get(`/radar/entities/asns/${encodeURIComponent(o)}`);e.output.json(t)}var kz=p(()=>{f()});async function Uz(s,e){let n=await e.client.get("/radar/entities/locations"),o=[{key:"code",header:"Code",width:6},{key:"name",header:"Name",width:30},{key:"region",header:"Region",width:20},{key:"subregion",header:"Subregion",width:24}];e.output.table(n,o)}async function _z(s,e){let n=await e.client.get("/radar/datasets"),o=[{key:"id",header:"ID",width:12},{key:"title",header:"Title",width:30},{key:"description",header:"Description",width:40},{key:"type",header:"Type",width:12}];e.output.table(n,o)}async function zz(s,e){let{flags:n}=d(s),o={},t=a(n,"from"),r=a(n,"to");if(t)o.dateStart=t;if(r)o.dateEnd=r;let m=await e.client.get("/radar/annotations",o),c=[{key:"id",header:"ID",width:12},{key:"description",header:"Description",width:40},{key:"event_type",header:"Type",width:16},{key:"data_source",header:"Source",width:16},{key:"start_date",header:"Start",width:12,transform:(l)=>l?String(l).slice(0,10):"-"},{key:"end_date",header:"End",width:12,transform:(l)=>l?String(l).slice(0,10):"-"}];e.output.table(m,c)}var Rz=()=>{};var Pz={};z(Pz,{run:()=>HZ});async function HZ(s,e){let[n,...o]=s;switch(n){case"http":return mz(o,e);case"dns":return cz(o,e);case"bgp":return uz(o,e);case"attacks":return lz(o,e);case"bots":return hz(o,e);case"email":return Cz(o,e);case"as":return $z(o,e);case"locations":return Uz(o,e);case"datasets":return _z(o,e);case"annotations":return zz(o,e);case void 0:case"--help":case"-h":e.output.raw(bz);return;default:throw new i(`Unknown radar command: "${n}"
|
|
2053
|
+
|
|
2054
|
+
${bz}`)}}var bz=`Usage: cf radar <command>
|
|
2055
|
+
|
|
2056
|
+
Commands:
|
|
2057
|
+
http HTTP traffic summary
|
|
2058
|
+
dns DNS traffic summary
|
|
2059
|
+
bgp BGP routing summary
|
|
2060
|
+
attacks Attack traffic summary
|
|
2061
|
+
bots Verified bots summary
|
|
2062
|
+
email Email security summary
|
|
2063
|
+
as Get ASN details
|
|
2064
|
+
locations List locations
|
|
2065
|
+
datasets List datasets
|
|
2066
|
+
annotations List annotations
|
|
2067
|
+
|
|
2068
|
+
Run 'cf radar <command> --help' for more information.`;var Iz=p(()=>{f();dz();pz();fz();wz();yz();gz();kz();Rz()});async function vz(s,e){let{flags:n}=d(s),o=a(n,"domain");if(!o)throw new i("--domain <example.com> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/intel/domain`,{domain:o});e.output.json(r)}var Dz=p(()=>{h();f()});async function Sz(s,e){let{flags:n}=d(s),o=a(n,"ip");if(!o)throw new i("--ip <address> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=o.includes(":")?"ipv6":"ipv4",m=await e.client.get(`/accounts/${encodeURIComponent(t)}/intel/ip`,{[r]:o});e.output.json(m)}var qz=p(()=>{h();f()});async function Az(s,e){let{flags:n}=d(s),o=a(n,"asn");if(!o)throw new i("--asn <number> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/intel/asn/${encodeURIComponent(o)}`);e.output.json(r)}var Lz=p(()=>{h();f()});async function Nz(s,e){let{flags:n}=d(s),o=a(n,"ip");if(!o)throw new i("--ip <address> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=o.includes(":")?"ipv6":"ipv4",m=await e.client.get(`/accounts/${encodeURIComponent(t)}/intel/dns`,{[r]:o});e.output.json(m)}var Ez=p(()=>{h();f()});async function Gz(s,e){let{flags:n}=d(s),o=a(n,"domain");if(!o)throw new i("--domain <example.com> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/intel/whois`,{domain:o});e.output.json(r)}var Mz=p(()=>{h();f()});async function Tz(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/intel/ip-list`),r=[{key:"id",header:"ID",width:8},{key:"name",header:"Name",width:30},{key:"description",header:"Description",width:40}];e.output.table(t,r)}var Zz=p(()=>{h()});async function Oz(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t={},r=a(n,"type");if(r)t.type=r;let m=await e.client.get(`/accounts/${encodeURIComponent(o)}/intel/attack-surface-report`,t);e.output.json(m)}var jz=p(()=>{h()});var Bz={};z(Bz,{run:()=>xZ});async function xZ(s,e){let[n,...o]=s;switch(n){case"domain":return vz(o,e);case"ip":return Sz(o,e);case"asn":return Az(o,e);case"dns":return Nz(o,e);case"whois":return Gz(o,e);case"ip-lists":return Tz(o,e);case"attack-surface":return Oz(o,e);case void 0:case"--help":case"-h":e.output.raw(Jz);return;default:throw new i(`Unknown intel command: "${n}"
|
|
2069
|
+
|
|
2070
|
+
${Jz}`)}}var Jz=`Usage: cf intel <command>
|
|
2071
|
+
|
|
2072
|
+
Commands:
|
|
2073
|
+
domain Lookup domain intelligence
|
|
2074
|
+
ip Lookup IP intelligence
|
|
2075
|
+
asn Lookup ASN intelligence
|
|
2076
|
+
dns Passive DNS lookup
|
|
2077
|
+
whois WHOIS lookup
|
|
2078
|
+
ip-lists List known IP lists
|
|
2079
|
+
attack-surface View attack surface report
|
|
2080
|
+
|
|
2081
|
+
Run 'cf intel <command> --help' for more information.`;var Hz=p(()=>{f();Dz();qz();Lz();Ez();Mz();Zz();jz()});async function Vz(s,e){let{flags:n}=d(s),o=a(n,"url");if(!o)throw new i("--url <url> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=v(n,"public"),m=a(n,"country"),c={url:o,visibility:r?"Public":"Private"};if(m)c.customHeaders={"CF-IPCountry":m};let l=await e.client.post(`/accounts/${encodeURIComponent(t)}/urlscanner/scan`,c);e.output.json(l)}var Wz=p(()=>{h();f()});async function Kz(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <urls-file> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let c=v(n,"public")?"Public":"Private",l=r.split(`
|
|
2082
|
+
`).map(($)=>$.trim()).filter(($)=>$.length>0&&!$.startsWith("#"));if(l.length===0)throw new i("File contains no URLs.");let w=[];for(let $ of l){let k=await e.client.post(`/accounts/${encodeURIComponent(t)}/urlscanner/scan`,{url:$,visibility:c});w.push(k)}e.output.json(w)}var Qz=p(()=>{h();f()});async function Yz(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <uuid> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/urlscanner/scan/${encodeURIComponent(o)}`);e.output.json(r)}var Xz=p(()=>{h();f()});async function Fz(s,e){let{flags:n}=d(s),o=a(n,"query");if(!o)throw new i("--query <q> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={q:o},m=a(n,"dateStart"),c=a(n,"dateEnd");if(m)r.date_start=m;if(c)r.date_end=c;let l=await e.client.get(`/accounts/${encodeURIComponent(t)}/urlscanner/scan`,r);e.output.json(l)}var xz=p(()=>{h();f()});async function eR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <uuid> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/urlscanner/scan/${encodeURIComponent(o)}/har`);e.output.json(r)}var oR=p(()=>{h();f()});async function nR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <uuid> is required.");let t=a(n,"outputFile");if(!t)throw new i("--output-file <path> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=`/accounts/${encodeURIComponent(r)}/urlscanner/scan/${encodeURIComponent(o)}/screenshot`,c=await e.client.get(m);if(typeof c==="string")await Bun.write(t,Buffer.from(c,"base64"));else if(c instanceof ArrayBuffer||c instanceof Uint8Array)await Bun.write(t,c);else{let l=c;if(typeof l.data==="string")await Bun.write(t,Buffer.from(l.data,"base64"));else throw new i("Unexpected response format from screenshot endpoint.")}e.output.success(`Screenshot saved to "${t}".`)}var tR=p(()=>{h();f()});async function rR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <uuid> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/urlscanner/scan/${encodeURIComponent(o)}/dom`);e.output.json(r)}var iR=p(()=>{h();f()});var aR={};z(aR,{run:()=>a2});async function a2(s,e){let[n,...o]=s;switch(n){case"scan":return Vz(o,e);case"bulk":return Kz(o,e);case"get":case"show":return Yz(o,e);case"search":return Fz(o,e);case"har":return eR(o,e);case"screenshot":return nR(o,e);case"dom":return rR(o,e);case void 0:case"--help":case"-h":e.output.raw(sR);return;default:throw new i(`Unknown url-scanner command: "${n}"
|
|
2083
|
+
|
|
2084
|
+
${sR}`)}}var sR=`Usage: cf url-scanner <command>
|
|
2085
|
+
|
|
2086
|
+
Commands:
|
|
2087
|
+
scan Submit a URL for scanning
|
|
2088
|
+
bulk Submit multiple URLs from a file
|
|
2089
|
+
get Get scan result by ID
|
|
2090
|
+
search Search scan results
|
|
2091
|
+
har Get HAR archive for a scan
|
|
2092
|
+
screenshot Download screenshot for a scan
|
|
2093
|
+
dom Get DOM snapshot for a scan
|
|
2094
|
+
|
|
2095
|
+
Run 'cf url-scanner <command> --help' for more information.`;var mR=p(()=>{f();Wz();Qz();Xz();xz();oR();tR();iR()});async function dR(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.post(`/accounts/${encodeURIComponent(o)}/cloudforce-one/requests/list`,{}),r=[{key:"id",header:"ID",width:12},{key:"title",header:"Title",width:30},{key:"status",header:"Status",width:14},{key:"priority",header:"Priority",width:10},{key:"tlp",header:"TLP",width:8},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var cR=p(()=>{h()});async function pR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <request-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/cloudforce-one/requests/${encodeURIComponent(o)}`);e.output.json(r)}var uR=p(()=>{h();f()});async function fR(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <req-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/cloudforce-one/requests/new`,m);e.output.json(c)}var lR=p(()=>{h();f()});async function hR(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return dR(o,e);case"get":case"show":return pR(o,e);case"create":return fR(o,e);case void 0:case"--help":case"-h":e.output.raw(wR);return;default:throw new i(`Unknown cf1 requests command: "${n}"
|
|
2096
|
+
|
|
2097
|
+
${wR}`)}}var wR=`Usage: cf cf1 requests <command>
|
|
2098
|
+
|
|
2099
|
+
Commands:
|
|
2100
|
+
list List Cloudforce One requests
|
|
2101
|
+
get Get a request by ID
|
|
2102
|
+
create Create a new request
|
|
2103
|
+
|
|
2104
|
+
Run 'cf cf1 requests <command> --help' for more information.`;var yR=p(()=>{f();cR();uR();lR()});async function CR(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/cloudforce-one/threat-events`),r=[{key:"id",header:"ID",width:12},{key:"title",header:"Title",width:30},{key:"event_type",header:"Type",width:16},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var gR=p(()=>{h()});async function $R(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/cloudforce-one/pirs`),r=[{key:"id",header:"ID",width:12},{key:"title",header:"Title",width:30},{key:"priority",header:"Priority",width:10},{key:"status",header:"Status",width:14},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var kR=p(()=>{h()});async function UR(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/cloudforce-one/scans`),r=[{key:"id",header:"ID",width:12},{key:"target",header:"Target",width:30},{key:"scan_type",header:"Type",width:14},{key:"status",header:"Status",width:14},{key:"created_at",header:"Created",width:12,transform:(m)=>m?String(m).slice(0,10):"-"}];e.output.table(t,r)}var _R=p(()=>{h()});var RR={};z(RR,{run:()=>w2});async function w2(s,e){let[n,...o]=s;switch(n){case"requests":case"request":return hR(o,e);case"threat-events":return CR(o,e);case"pirs":return $R(o,e);case"scans":return UR(o,e);case void 0:case"--help":case"-h":e.output.raw(zR);return;default:throw new i(`Unknown cf1 command: "${n}"
|
|
2105
|
+
|
|
2106
|
+
${zR}`)}}var zR=`Usage: cf cf1 <command>
|
|
2107
|
+
|
|
2108
|
+
Commands:
|
|
2109
|
+
requests Manage Cloudforce One requests
|
|
2110
|
+
threat-events List threat events
|
|
2111
|
+
pirs List Priority Intelligence Requirements
|
|
2112
|
+
scans List scans
|
|
2113
|
+
|
|
2114
|
+
Run 'cf cf1 <command> --help' for more information.`;var bR=p(()=>{f();yR();gR();kR();_R()});async function PR(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),r=(await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/gre_tunnels`)).gre_tunnels??[],m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"customer_gre_endpoint",header:"Customer Endpoint",width:18},{key:"cloudflare_gre_endpoint",header:"CF Endpoint",width:18},{key:"interface_address",header:"Interface",width:18}];e.output.table(r,m)}var IR=p(()=>{h()});async function vR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/gre_tunnels/${encodeURIComponent(o)}`)).gre_tunnel;e.output.detail({ID:m.id,Name:m.name,"Customer Endpoint":m.customer_gre_endpoint,"Cloudflare Endpoint":m.cloudflare_gre_endpoint,"Interface Address":m.interface_address,Description:m.description??"",TTL:m.ttl??"",MTU:m.mtu??"",Created:m.created_on??"",Modified:m.modified_on??""})}var DR=p(()=>{h();f()});async function SR(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <tunnel-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let l=(await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/gre_tunnels`,m)).gre_tunnels??[];if(l.length>0){let w=l[0];e.output.success(`GRE tunnel created: ${w.name}`),e.output.detail({ID:w.id,Name:w.name,"Customer Endpoint":w.customer_gre_endpoint,"Cloudflare Endpoint":w.cloudflare_gre_endpoint})}else e.output.success("GRE tunnel created.")}var qR=p(()=>{h();f()});async function AR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <tunnel-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let w=(await e.client.put(`/accounts/${encodeURIComponent(r)}/magic/gre_tunnels/${encodeURIComponent(o)}`,c)).modified_gre_tunnel;e.output.success(`GRE tunnel "${w.name}" updated.`),e.output.detail({ID:w.id,Name:w.name})}var LR=p(()=>{h();f()});async function NR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete GRE tunnel "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/magic/gre_tunnels/${encodeURIComponent(o)}`),e.output.success(`GRE tunnel "${o}" deleted.`)}var ER=p(()=>{h();f();U()});async function MR(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return PR(o,e);case"get":case"show":return vR(o,e);case"create":return SR(o,e);case"update":return AR(o,e);case"delete":case"rm":return NR(o,e);case void 0:case"--help":case"-h":e.output.raw(GR);return;default:throw new i(`Unknown gre-tunnels command: "${n}"
|
|
2115
|
+
|
|
2116
|
+
${GR}`)}}var GR=`Usage: cf magic-transit gre-tunnels <command>
|
|
2117
|
+
|
|
2118
|
+
Commands:
|
|
2119
|
+
list List GRE tunnels
|
|
2120
|
+
get Get GRE tunnel details
|
|
2121
|
+
create Create a GRE tunnel from JSON file
|
|
2122
|
+
update Update a GRE tunnel from JSON file
|
|
2123
|
+
delete Delete a GRE tunnel
|
|
2124
|
+
|
|
2125
|
+
Run 'cf magic-transit gre-tunnels <command> --help' for more information.`;var TR=p(()=>{f();IR();DR();qR();LR();ER()});async function ZR(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),r=(await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/ipsec_tunnels`)).ipsec_tunnels??[],m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"customer_endpoint",header:"Customer Endpoint",width:18},{key:"cloudflare_endpoint",header:"CF Endpoint",width:18},{key:"interface_address",header:"Interface",width:18}];e.output.table(r,m)}var OR=p(()=>{h()});async function jR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/ipsec_tunnels/${encodeURIComponent(o)}`)).ipsec_tunnel;e.output.detail({ID:m.id,Name:m.name,"Customer Endpoint":m.customer_endpoint,"Cloudflare Endpoint":m.cloudflare_endpoint,"Interface Address":m.interface_address,Description:m.description??"","Allow Null Cipher":m.allow_null_cipher??!1,"Replay Protection":m.replay_protection??!1,Created:m.created_on??"",Modified:m.modified_on??""})}var JR=p(()=>{h();f()});async function BR(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <tunnel-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let l=(await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/ipsec_tunnels`,m)).ipsec_tunnels??[];if(l.length>0){let w=l[0];e.output.success(`IPsec tunnel created: ${w.name}`),e.output.detail({ID:w.id,Name:w.name,"Customer Endpoint":w.customer_endpoint,"Cloudflare Endpoint":w.cloudflare_endpoint})}else e.output.success("IPsec tunnel created.")}var HR=p(()=>{h();f()});async function VR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <tunnel-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let w=(await e.client.put(`/accounts/${encodeURIComponent(r)}/magic/ipsec_tunnels/${encodeURIComponent(o)}`,c)).modified_ipsec_tunnel;e.output.success(`IPsec tunnel "${w.name}" updated.`),e.output.detail({ID:w.id,Name:w.name})}var WR=p(()=>{h();f()});async function KR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete IPsec tunnel "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/magic/ipsec_tunnels/${encodeURIComponent(o)}`),e.output.success(`IPsec tunnel "${o}" deleted.`)}var QR=p(()=>{h();f();U()});async function YR(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <tunnel-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/ipsec_tunnels/${encodeURIComponent(o)}/psk_generate`);e.output.success("Pre-shared key generated."),e.output.detail({PSK:r.psk,"Generated On":r.psk_metadata?.last_generated_on??""})}var XR=p(()=>{h();f()});async function xR(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ZR(o,e);case"get":case"show":return jR(o,e);case"create":return BR(o,e);case"update":return VR(o,e);case"delete":case"rm":return KR(o,e);case"generate-psk":case"psk":return YR(o,e);case void 0:case"--help":case"-h":e.output.raw(FR);return;default:throw new i(`Unknown ipsec-tunnels command: "${n}"
|
|
2126
|
+
|
|
2127
|
+
${FR}`)}}var FR=`Usage: cf magic-transit ipsec-tunnels <command>
|
|
2128
|
+
|
|
2129
|
+
Commands:
|
|
2130
|
+
list List IPsec tunnels
|
|
2131
|
+
get Get IPsec tunnel details
|
|
2132
|
+
create Create an IPsec tunnel from JSON file
|
|
2133
|
+
update Update an IPsec tunnel from JSON file
|
|
2134
|
+
delete Delete an IPsec tunnel
|
|
2135
|
+
generate-psk Generate a pre-shared key for an IPsec tunnel
|
|
2136
|
+
|
|
2137
|
+
Run 'cf magic-transit ipsec-tunnels <command> --help' for more information.`;var eb=p(()=>{f();OR();JR();HR();WR();QR();XR()});async function ob(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),r=(await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/sites`)).sites??[],m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"description",header:"Description",width:40},{key:"connector_id",header:"Connector",width:36}];e.output.table(r,m)}var nb=p(()=>{h()});async function tb(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/sites/${encodeURIComponent(o)}`)).site;e.output.detail({ID:m.id,Name:m.name,Description:m.description??"","Connector ID":m.connector_id??"","HA Mode":m.ha_mode??!1,Created:m.created_on??"",Modified:m.modified_on??""})}var rb=p(()=>{h();f()});async function ib(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <site-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/sites`,m);e.output.success(`Site created: ${c.name}`),e.output.detail({ID:c.id,Name:c.name})}var sb=p(()=>{h();f()});async function ab(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <site-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l=await e.client.put(`/accounts/${encodeURIComponent(r)}/magic/sites/${encodeURIComponent(o)}`,c);e.output.success(`Site "${l.name}" updated.`),e.output.detail({ID:l.id,Name:l.name})}var mb=p(()=>{h();f()});async function db(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete site "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/magic/sites/${encodeURIComponent(o)}`),e.output.success(`Site "${o}" deleted.`)}var cb=p(()=>{h();f();U()});async function pb(s,e){let{flags:n}=d(s),o=a(n,"site");if(!o)throw new i("--site <site-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/sites/${encodeURIComponent(o)}/lans`)).lans??[],c=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"physport",header:"Physical Port",width:14},{key:"vlan_tag",header:"VLAN Tag",width:10}];e.output.table(m,c)}var ub=p(()=>{h();f()});async function fb(s,e){let{flags:n}=d(s),o=a(n,"site");if(!o)throw new i("--site <site-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),m=(await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/sites/${encodeURIComponent(o)}/wans`)).wans??[],c=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"physport",header:"Physical Port",width:14},{key:"vlan_tag",header:"VLAN Tag",width:10}];e.output.table(m,c)}var lb=p(()=>{h();f()});async function hb(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return ob(o,e);case"get":case"show":return tb(o,e);case"create":return ib(o,e);case"update":return ab(o,e);case"delete":case"rm":return db(o,e);case"lans":return pb(o,e);case"wans":return fb(o,e);case void 0:case"--help":case"-h":e.output.raw(wb);return;default:throw new i(`Unknown sites command: "${n}"
|
|
2138
|
+
|
|
2139
|
+
${wb}`)}}var wb=`Usage: cf magic-transit sites <command>
|
|
2140
|
+
|
|
2141
|
+
Commands:
|
|
2142
|
+
list List Magic WAN sites
|
|
2143
|
+
get Get site details
|
|
2144
|
+
create Create a site from JSON file
|
|
2145
|
+
update Update a site from JSON file
|
|
2146
|
+
delete Delete a site
|
|
2147
|
+
lans List LANs for a site
|
|
2148
|
+
wans List WANs for a site
|
|
2149
|
+
|
|
2150
|
+
Run 'cf magic-transit sites <command> --help' for more information.`;var yb=p(()=>{f();nb();rb();sb();mb();cb();ub();lb()});async function Cb(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),r=(await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/routes`)).routes??[],m=[{key:"id",header:"ID",width:36},{key:"prefix",header:"Prefix",width:20},{key:"nexthop",header:"Next Hop",width:18},{key:"priority",header:"Priority",width:10},{key:"description",header:"Description",width:30}];e.output.table(r,m)}var gb=p(()=>{h()});async function $b(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <route-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let l=(await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/routes`,m)).routes??[];if(l.length>0){let w=l[0];e.output.success(`Route created: ${w.prefix}`),e.output.detail({ID:w.id,Prefix:w.prefix,Priority:w.priority})}else e.output.success("Route created.")}var kb=p(()=>{h();f()});async function Ub(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <route-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <route-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let w=(await e.client.put(`/accounts/${encodeURIComponent(r)}/magic/routes/${encodeURIComponent(o)}`,c)).modified_route;e.output.success(`Route "${w.prefix}" updated.`),e.output.detail({ID:w.id,Prefix:w.prefix,Priority:w.priority})}var _b=p(()=>{h();f()});async function zb(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <route-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete route "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/magic/routes/${encodeURIComponent(o)}`),e.output.success(`Route "${o}" deleted.`)}var Rb=p(()=>{h();f();U()});async function Pb(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Cb(o,e);case"create":return $b(o,e);case"update":return Ub(o,e);case"delete":case"rm":return zb(o,e);case void 0:case"--help":case"-h":e.output.raw(bb);return;default:throw new i(`Unknown routes command: "${n}"
|
|
2151
|
+
|
|
2152
|
+
${bb}`)}}var bb=`Usage: cf magic-transit routes <command>
|
|
2153
|
+
|
|
2154
|
+
Commands:
|
|
2155
|
+
list List static routes
|
|
2156
|
+
create Create a route from JSON file
|
|
2157
|
+
update Update a route from JSON file
|
|
2158
|
+
delete Delete a route
|
|
2159
|
+
|
|
2160
|
+
Run 'cf magic-transit routes <command> --help' for more information.`;var Ib=p(()=>{f();gb();kb();_b();Rb()});async function vb(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),r=(await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/cf_interconnects/acls`)).acls??[],m=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"description",header:"Description",width:40},{key:"forward_locally",header:"Forward Locally",width:16}];e.output.table(r,m)}var Db=p(()=>{h()});async function Sb(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <acl-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/cf_interconnects/acls`,m);e.output.success(`ACL created: ${c.name}`),e.output.detail({ID:c.id,Name:c.name})}var qb=p(()=>{h();f()});async function Ab(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <acl-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <acl-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l=await e.client.put(`/accounts/${encodeURIComponent(r)}/magic/cf_interconnects/acls/${encodeURIComponent(o)}`,c);e.output.success(`ACL "${l.name}" updated.`),e.output.detail({ID:l.id,Name:l.name})}var Lb=p(()=>{h();f()});async function Nb(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <acl-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete ACL "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/magic/cf_interconnects/acls/${encodeURIComponent(o)}`),e.output.success(`ACL "${o}" deleted.`)}var Eb=p(()=>{h();f();U()});async function Mb(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return vb(o,e);case"create":return Sb(o,e);case"update":return Ab(o,e);case"delete":case"rm":return Nb(o,e);case void 0:case"--help":case"-h":e.output.raw(Gb);return;default:throw new i(`Unknown acls command: "${n}"
|
|
2161
|
+
|
|
2162
|
+
${Gb}`)}}var Gb=`Usage: cf magic-transit acls <command>
|
|
2163
|
+
|
|
2164
|
+
Commands:
|
|
2165
|
+
list List ACLs
|
|
2166
|
+
create Create an ACL from JSON file
|
|
2167
|
+
update Update an ACL from JSON file
|
|
2168
|
+
delete Delete an ACL
|
|
2169
|
+
|
|
2170
|
+
Run 'cf magic-transit acls <command> --help' for more information.`;var Tb=p(()=>{f();Db();qb();Lb();Eb()});async function Zb(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/magic/pcaps`),r=[{key:"id",header:"ID",width:36},{key:"type",header:"Type",width:10},{key:"system",header:"System",width:12},{key:"status",header:"Status",width:12},{key:"colo_name",header:"Colo",width:8}];e.output.table(t,r)}var Ob=p(()=>{h()});async function jb(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pcap-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/magic/pcaps/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Type:r.type,System:r.system,Status:r.status,Colo:r.colo_name??"","Time Limit":r.time_limit??"","Byte Limit":r.byte_limit??"","Packet Limit":r.packet_limit??"",Error:r.error_message??"",Created:r.created_on??"",Modified:r.modified_on??""})}var Jb=p(()=>{h();f()});async function Bb(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <pcap-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/magic/pcaps`,m);e.output.success(`Packet capture created (ID: ${c.id}).`),e.output.detail({ID:c.id,Type:c.type,System:c.system,Status:c.status})}var Hb=p(()=>{h();f()});async function Vb(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <pcap-id> is required.");let t=a(n,"outputFile");if(!t)throw new i("--output-file <path> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m=`/accounts/${encodeURIComponent(r)}/magic/pcaps/${encodeURIComponent(o)}/download`,c=await e.client.get(m);if(typeof c==="string")await Bun.write(t,c);else if(c instanceof ArrayBuffer||c instanceof Uint8Array)await Bun.write(t,c);else await Bun.write(t,JSON.stringify(c));e.output.success(`Packet capture downloaded to "${t}".`)}var Wb=p(()=>{h();f()});async function Qb(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Zb(o,e);case"get":case"show":return jb(o,e);case"create":return Bb(o,e);case"download":case"dl":return Vb(o,e);case void 0:case"--help":case"-h":e.output.raw(Kb);return;default:throw new i(`Unknown pcaps command: "${n}"
|
|
2171
|
+
|
|
2172
|
+
${Kb}`)}}var Kb=`Usage: cf magic-transit pcaps <command>
|
|
2173
|
+
|
|
2174
|
+
Commands:
|
|
2175
|
+
list List packet captures
|
|
2176
|
+
get Get packet capture details
|
|
2177
|
+
create Create a packet capture from JSON file
|
|
2178
|
+
download Download a packet capture to file
|
|
2179
|
+
|
|
2180
|
+
Run 'cf magic-transit pcaps <command> --help' for more information.`;var Yb=p(()=>{f();Ob();Jb();Hb();Wb()});var Fb={};z(Fb,{run:()=>F2});async function F2(s,e){let[n,...o]=s;switch(n){case"gre-tunnels":case"gre":return MR(o,e);case"ipsec-tunnels":case"ipsec":return xR(o,e);case"sites":case"site":return hb(o,e);case"routes":case"route":return Pb(o,e);case"acls":case"acl":return Mb(o,e);case"pcaps":case"pcap":return Qb(o,e);case void 0:case"--help":case"-h":e.output.raw(Xb);return;default:throw new i(`Unknown magic-transit command: "${n}"
|
|
2181
|
+
|
|
2182
|
+
${Xb}`)}}var Xb=`Usage: cf magic-transit <command>
|
|
2183
|
+
|
|
2184
|
+
Commands:
|
|
2185
|
+
gre-tunnels Manage GRE tunnels (list, get, create, update, delete)
|
|
2186
|
+
ipsec-tunnels Manage IPsec tunnels (list, get, create, update, delete, generate-psk)
|
|
2187
|
+
sites Manage Magic WAN sites (list, get, create, update, delete, lans, wans)
|
|
2188
|
+
routes Manage static routes (list, create, update, delete)
|
|
2189
|
+
acls Manage ACLs (list, create, update, delete)
|
|
2190
|
+
pcaps Manage packet captures (list, get, create, download)
|
|
2191
|
+
|
|
2192
|
+
Run 'cf magic-transit <command> --help' for more information.`;var xb=p(()=>{f();TR();eb();yb();Ib();Tb();Yb()});async function eP(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/mnm/config`);e.output.json(t)}var oP=p(()=>{h()});async function nP(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <config-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let c=await e.client.patch(`/accounts/${encodeURIComponent(t)}/mnm/config`,m);e.output.success("MNM configuration updated."),e.output.json(c)}var tP=p(()=>{h();f()});async function iP(s,e){let[n,...o]=s;switch(n){case"get":case"show":return eP(o,e);case"update":return nP(o,e);case void 0:case"--help":case"-h":e.output.raw(rP);return;default:throw new i(`Unknown mnm config command: "${n}"
|
|
2193
|
+
|
|
2194
|
+
${rP}`)}}var rP=`Usage: cf mnm config <command>
|
|
2195
|
+
|
|
2196
|
+
Commands:
|
|
2197
|
+
get Get MNM configuration
|
|
2198
|
+
update Update MNM configuration from JSON file
|
|
2199
|
+
|
|
2200
|
+
Run 'cf mnm config <command> --help' for more information.`;var sP=p(()=>{f();oP();tP()});async function aP(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/mnm/rules`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:25},{key:"automatic_advertisement",header:"Auto Advertise",width:16},{key:"duration",header:"Duration",width:12},{key:"bandwidth_threshold",header:"BW Threshold",width:14}];e.output.table(t,r)}var mP=p(()=>{h()});async function dP(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <rule-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/mnm/rules/${encodeURIComponent(o)}`);e.output.detail({ID:r.id,Name:r.name,Description:r.description??"",Prefixes:(r.prefixes??[]).join(", "),"Auto Advertisement":r.automatic_advertisement??!1,Duration:r.duration??"","Bandwidth Threshold":r.bandwidth_threshold??"","Packet Threshold":r.packet_threshold??"",Created:r.created_on??"",Modified:r.modified_on??""})}var cP=p(()=>{h();f()});async function pP(s,e){let{flags:n}=d(s),o=a(n,"file");if(!o)throw new i("--file <rule-json> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r;try{r=await Bun.file(o).text()}catch{throw new i(`Cannot read file: "${o}".`)}let m;try{m=JSON.parse(r)}catch{throw new i(`File "${o}" does not contain valid JSON.`)}let c=await e.client.post(`/accounts/${encodeURIComponent(t)}/mnm/rules`,m);e.output.success(`MNM rule created: ${c.name}`),e.output.detail({ID:c.id,Name:c.name})}var uP=p(()=>{h();f()});async function fP(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <rule-id> is required.");let t=a(n,"file");if(!t)throw new i("--file <rule-json> is required.");let r=await u(a(n,"accountId"),e.client,e.config),m;try{m=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let c;try{c=JSON.parse(m)}catch{throw new i(`File "${t}" does not contain valid JSON.`)}let l=await e.client.patch(`/accounts/${encodeURIComponent(r)}/mnm/rules/${encodeURIComponent(o)}`,c);e.output.success(`MNM rule "${l.name}" updated.`),e.output.detail({ID:l.id,Name:l.name})}var lP=p(()=>{h();f()});async function wP(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <rule-id> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete MNM rule "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/mnm/rules/${encodeURIComponent(o)}`),e.output.success(`MNM rule "${o}" deleted.`)}var hP=p(()=>{h();f();U()});async function CP(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return aP(o,e);case"get":case"show":return dP(o,e);case"create":return pP(o,e);case"update":return fP(o,e);case"delete":case"rm":return wP(o,e);case void 0:case"--help":case"-h":e.output.raw(yP);return;default:throw new i(`Unknown mnm rules command: "${n}"
|
|
2201
|
+
|
|
2202
|
+
${yP}`)}}var yP=`Usage: cf mnm rules <command>
|
|
2203
|
+
|
|
2204
|
+
Commands:
|
|
2205
|
+
list List MNM rules
|
|
2206
|
+
get Get MNM rule details
|
|
2207
|
+
create Create an MNM rule from JSON file
|
|
2208
|
+
update Update an MNM rule from JSON file
|
|
2209
|
+
delete Delete an MNM rule
|
|
2210
|
+
|
|
2211
|
+
Run 'cf mnm rules <command> --help' for more information.`;var gP=p(()=>{f();mP();cP();uP();lP();hP()});var kP={};z(kP,{run:()=>mO});async function mO(s,e){let[n,...o]=s;switch(n){case"config":case"cfg":return iP(o,e);case"rules":case"rule":return CP(o,e);case void 0:case"--help":case"-h":e.output.raw($P);return;default:throw new i(`Unknown mnm command: "${n}"
|
|
2212
|
+
|
|
2213
|
+
${$P}`)}}var $P=`Usage: cf mnm <command>
|
|
2214
|
+
|
|
2215
|
+
Commands:
|
|
2216
|
+
config Manage MNM configuration (get, update)
|
|
2217
|
+
rules Manage MNM rules (list, get, create, update, delete)
|
|
2218
|
+
|
|
2219
|
+
Run 'cf mnm <command> --help' for more information.`;var UP=p(()=>{f();sP();gP()});async function N(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"accountId");if(o){let r=await y(o,e.client);return{basePath:`/zones/${encodeURIComponent(r)}/logpush`,flags:n}}if(t)return{basePath:`/accounts/${encodeURIComponent(t)}/logpush`,flags:n};try{let r=await u(void 0,e.client,e.config);return{basePath:`/accounts/${encodeURIComponent(r)}/logpush`,flags:n}}catch{throw new i("--zone <zone> or --account-id <id> is required.")}}var Z=p(()=>{g();h();f()});async function _P(s,e){let{basePath:n}=await N(s,e),o=await e.client.get(`${n}/jobs`),t=Array.isArray(o)?o:[];e.output.table(t,[{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"dataset",header:"Dataset"},{key:"enabled",header:"Enabled"},{key:"destination_conf",header:"Destination"},{key:"last_complete",header:"Last Complete"}])}var zP=p(()=>{Z()});async function RP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"id");if(!t)throw new i("--id <job-id> is required.");let r=await e.client.get(`${n}/jobs/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name??"",Dataset:r.dataset,Enabled:r.enabled,Destination:r.destination_conf,Frequency:r.frequency??"","Last Complete":r.last_complete??"","Last Error":r.last_error??""})}var bP=p(()=>{Z();f()});async function PP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"file");if(!t)throw new i("--file <job-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`${n}/jobs`,m);e.output.success(`Logpush job created (ID: ${c.id}).`),e.output.detail({ID:c.id,Name:c.name??"",Dataset:c.dataset,Enabled:c.enabled,Destination:c.destination_conf})}var IP=p(()=>{Z();f()});async function vP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"id");if(!t)throw new i("--id <job-id> is required.");let r=a(o,"file");if(!r)throw new i("--file <job-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`${n}/jobs/${encodeURIComponent(t)}`,c);e.output.success(`Logpush job ${t} updated.`),e.output.detail({ID:l.id,Name:l.name??"",Dataset:l.dataset,Enabled:l.enabled,Destination:l.destination_conf})}var DP=p(()=>{Z();f()});async function SP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"id");if(!t)throw new i("--id <job-id> is required.");if(!await C(`Delete logpush job ${t}?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`${n}/jobs/${encodeURIComponent(t)}`),e.output.success(`Logpush job ${t} deleted.`)}var qP=p(()=>{Z();f();U()});async function AP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"id");if(!t)throw new i("--id <job-id> is required.");await e.client.put(`${n}/jobs/${encodeURIComponent(t)}`,{enabled:!0}),e.output.success(`Logpush job ${t} enabled.`)}var LP=p(()=>{Z();f()});async function NP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"id");if(!t)throw new i("--id <job-id> is required.");await e.client.put(`${n}/jobs/${encodeURIComponent(t)}`,{enabled:!1}),e.output.success(`Logpush job ${t} disabled.`)}var EP=p(()=>{Z();f()});async function MP(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _P(o,e);case"get":case"show":return RP(o,e);case"create":case"add":return PP(o,e);case"update":case"set":return vP(o,e);case"delete":case"rm":case"remove":return SP(o,e);case"enable":return AP(o,e);case"disable":return NP(o,e);case void 0:case"--help":case"-h":e.output.raw(GP);return;default:throw new i(`Unknown logpush jobs action: "${n}"
|
|
2220
|
+
|
|
2221
|
+
${GP}`)}}var GP=`Usage: cf logpush jobs <action>
|
|
2222
|
+
|
|
2223
|
+
Actions:
|
|
2224
|
+
list List all logpush jobs
|
|
2225
|
+
get Get a logpush job by ID
|
|
2226
|
+
create Create a logpush job from JSON file
|
|
2227
|
+
update Update a logpush job from JSON file
|
|
2228
|
+
delete Delete a logpush job
|
|
2229
|
+
enable Enable a logpush job
|
|
2230
|
+
disable Disable a logpush job
|
|
2231
|
+
|
|
2232
|
+
Flags:
|
|
2233
|
+
--zone <zone> Zone scope (ID or domain)
|
|
2234
|
+
--account-id <id> Account scope
|
|
2235
|
+
--id <id> Job ID (for get, update, delete, enable, disable)
|
|
2236
|
+
--file <path> JSON file (for create, update)
|
|
2237
|
+
|
|
2238
|
+
Run 'cf logpush jobs <action> --help' for more information.`;var TP=p(()=>{f();zP();bP();IP();DP();qP();LP();EP()});async function ZP(s,e){let{basePath:n}=await N(s,e),o=await e.client.get(`${n}/datasets`),t=Array.isArray(o)?o:[];e.output.table(t,[{key:"id",header:"ID"},{key:"name",header:"Name"},{key:"description",header:"Description"}])}var OP=p(()=>{Z()});async function jP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"destinationConf");if(!t)throw new i("--destination-conf <dest> is required.");let r=await e.client.post(`${n}/ownership/validate`,{destination_conf:t});e.output.detail({Valid:r.valid,Filename:r.filename??"",Message:r.message??""})}var JP=p(()=>{Z();f()});async function BP(s,e){let{basePath:n,flags:o}=await N(s,e),t=a(o,"dataset");if(!t)throw new i("--dataset <dataset> is required.");let r={dataset:t},m=D(o,"fields");if(m)r.fields=m.join(",");let c=a(o,"from");if(c)r.start_time=c;let l=a(o,"to");if(l)r.end_time=l;let w=await e.client.post(`${n}/edge`,r);e.output.detail({"Session ID":w.session_id??"",Destination:w.destination_conf??"",Fields:w.fields??""})}var HP=p(()=>{Z();f()});var WP={};z(WP,{run:()=>$O});async function $O(s,e){let[n,...o]=s;switch(n){case"jobs":case"job":return MP(o,e);case"datasets":case"dataset":return ZP(o,e);case"ownership":return jP(o,e);case"instant":return BP(o,e);case void 0:case"--help":case"-h":e.output.raw(VP);return;default:throw new i(`Unknown logpush command: "${n}"
|
|
2239
|
+
|
|
2240
|
+
${VP}`)}}var VP=`Usage: cf logpush <command>
|
|
2241
|
+
|
|
2242
|
+
Commands:
|
|
2243
|
+
jobs Manage logpush jobs (list, get, create, update, delete, enable, disable)
|
|
2244
|
+
datasets List available log datasets
|
|
2245
|
+
ownership Verify destination ownership
|
|
2246
|
+
instant Start an instant logs session
|
|
2247
|
+
|
|
2248
|
+
Scope:
|
|
2249
|
+
--zone <zone> Zone-scoped operations (ID or domain)
|
|
2250
|
+
--account-id <id> Account-scoped operations
|
|
2251
|
+
|
|
2252
|
+
Run 'cf logpush <command> --help' for more information.`;var KP=p(()=>{f();TP();OP();JP();HP()});async function QP(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/rum/site_info/list`),r=Array.isArray(t)?t:[];e.output.table(r,[{key:"site_tag",header:"Site Tag"},{key:"host",header:"Host"},{key:"auto_install",header:"Auto Install"},{key:"created",header:"Created"}])}var YP=p(()=>{h()});async function XP(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-tag> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/rum/site_info/${encodeURIComponent(o)}`);e.output.detail({"Site Tag":r.site_tag,Host:r.host??"","Auto Install":r.auto_install??!1,"Site Token":r.site_token??"",Created:r.created??""})}var FP=p(()=>{h();f()});async function xP(s,e){let{flags:n}=d(s),o=a(n,"host");if(!o)throw new i("--host <hostname> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r={host:o,auto_install:!0},m=await e.client.post(`/accounts/${encodeURIComponent(t)}/rum/site_info`,r);e.output.success(`Web Analytics site created (tag: ${m.site_tag}).`),e.output.detail({"Site Tag":m.site_tag,Host:m.host??"",Snippet:m.snippet??""})}var eI=p(()=>{h();f()});async function oI(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-tag> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=a(n,"host");if(!r)throw new i("At least --host is required for update.");let m={};m.host=r;let c=await e.client.put(`/accounts/${encodeURIComponent(t)}/rum/site_info/${encodeURIComponent(o)}`,m);e.output.success(`Web Analytics site "${o}" updated.`),e.output.detail({"Site Tag":c.site_tag,Host:c.host??""})}var nI=p(()=>{h();f()});async function tI(s,e){let{flags:n}=d(s),o=a(n,"id");if(!o)throw new i("--id <site-tag> is required.");let t=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Web Analytics site "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(t)}/rum/site_info/${encodeURIComponent(o)}`),e.output.success(`Web Analytics site "${o}" deleted.`)}var rI=p(()=>{h();f();U()});async function sI(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return QP(o,e);case"get":case"show":return XP(o,e);case"create":case"add":return xP(o,e);case"update":case"set":return oI(o,e);case"delete":case"rm":case"remove":return tI(o,e);case void 0:case"--help":case"-h":e.output.raw(iI);return;default:throw new i(`Unknown web-analytics sites action: "${n}"
|
|
2253
|
+
|
|
2254
|
+
${iI}`)}}var iI=`Usage: cf web-analytics sites <action>
|
|
2255
|
+
|
|
2256
|
+
Actions:
|
|
2257
|
+
list List all Web Analytics sites
|
|
2258
|
+
get Get a site by ID
|
|
2259
|
+
create Create a new site
|
|
2260
|
+
update Update a site
|
|
2261
|
+
delete Delete a site
|
|
2262
|
+
|
|
2263
|
+
Flags:
|
|
2264
|
+
--account-id <id> Account ID
|
|
2265
|
+
--id <id> Site tag/ID (for get, update, delete)
|
|
2266
|
+
--host <host> Hostname (for create, update)
|
|
2267
|
+
|
|
2268
|
+
Run 'cf web-analytics sites <action> --help' for more information.`;var aI=p(()=>{f();YP();FP();eI();nI();rI()});async function mI(s,e){let{flags:n}=d(s),o=a(n,"site");if(!o)throw new i("--site <site-tag> is required.");let t=await u(a(n,"accountId"),e.client,e.config),r=await e.client.get(`/accounts/${encodeURIComponent(t)}/rum/v2/${encodeURIComponent(o)}/rules`),m=Array.isArray(r)?r:[];e.output.table(m,[{key:"id",header:"ID"},{key:"host",header:"Host"},{key:"paths",header:"Paths"},{key:"inclusive",header:"Inclusive"},{key:"is_paused",header:"Paused"},{key:"created",header:"Created"}])}var dI=p(()=>{h();f()});async function cI(s,e){let{flags:n}=d(s),o=a(n,"site");if(!o)throw new i("--site <site-tag> is required.");let t=a(n,"file");if(!t)throw new i("--file <rule-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await u(a(n,"accountId"),e.client,e.config),l=await e.client.post(`/accounts/${encodeURIComponent(c)}/rum/v2/${encodeURIComponent(o)}/rule`,m);e.output.success(`Web Analytics rule created (ID: ${l.id}).`),e.output.detail({ID:l.id,Host:l.host??"",Paths:(l.paths??[]).join(", "),Inclusive:l.inclusive??!1})}var pI=p(()=>{h();f()});async function uI(s,e){let{flags:n}=d(s),o=a(n,"site");if(!o)throw new i("--site <site-tag> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=await u(a(n,"accountId"),e.client,e.config);if(!await C(`Delete Web Analytics rule "${t}" from site "${o}"?`,e.flags)){e.output.info("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(r)}/rum/v2/${encodeURIComponent(o)}/rule/${encodeURIComponent(t)}`),e.output.success(`Web Analytics rule "${t}" deleted.`)}var fI=p(()=>{h();f();U()});async function wI(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return mI(o,e);case"create":case"add":return cI(o,e);case"delete":case"rm":case"remove":return uI(o,e);case void 0:case"--help":case"-h":e.output.raw(lI);return;default:throw new i(`Unknown web-analytics rules action: "${n}"
|
|
2269
|
+
|
|
2270
|
+
${lI}`)}}var lI=`Usage: cf web-analytics rules <action>
|
|
2271
|
+
|
|
2272
|
+
Actions:
|
|
2273
|
+
list List rules for a site
|
|
2274
|
+
create Create a rule from JSON file
|
|
2275
|
+
delete Delete a rule
|
|
2276
|
+
|
|
2277
|
+
Flags:
|
|
2278
|
+
--account-id <id> Account ID
|
|
2279
|
+
--site <id> Site tag (required)
|
|
2280
|
+
--id <id> Rule ID (for delete)
|
|
2281
|
+
--file <path> JSON file (for create)
|
|
2282
|
+
|
|
2283
|
+
Run 'cf web-analytics rules <action> --help' for more information.`;var hI=p(()=>{f();dI();pI();fI()});var CI={};z(CI,{run:()=>SO});async function SO(s,e){let[n,...o]=s;switch(n){case"sites":case"site":return sI(o,e);case"rules":case"rule":return wI(o,e);case void 0:case"--help":case"-h":e.output.raw(yI);return;default:throw new i(`Unknown web-analytics command: "${n}"
|
|
2284
|
+
|
|
2285
|
+
${yI}`)}}var yI=`Usage: cf web-analytics <command>
|
|
2286
|
+
|
|
2287
|
+
Commands:
|
|
2288
|
+
sites Manage Web Analytics sites (list, get, create, update, delete)
|
|
2289
|
+
rules Manage Web Analytics rules (list, create, delete)
|
|
2290
|
+
|
|
2291
|
+
Run 'cf web-analytics <command> --help' for more information.`;var gI=p(()=>{f();aI();hI()});async function $I(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/settings/zaraz/v2/config`);e.output.json(r)}var kI=p(()=>{g();f()});async function UI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"file");if(!t)throw new i("--file <config-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client);await e.client.put(`/zones/${encodeURIComponent(c)}/settings/zaraz/v2/config`,m),e.output.success("Zaraz configuration updated.")}var _I=p(()=>{g();f()});async function zI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.post(`/zones/${encodeURIComponent(t)}/settings/zaraz/v2/publish`,{});e.output.success(r.message??"Zaraz configuration published.")}var RI=p(()=>{g();f()});async function bI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/settings/zaraz/v2/workflow`);e.output.json(r)}var PI=p(()=>{g();f()});async function II(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/settings/zaraz/v2/history`),m=Array.isArray(r)?r:[];e.output.table(m,[{key:"id",header:"ID"},{key:"description",header:"Description"},{key:"created_at",header:"Created"},{key:"user_id",header:"User"}])}var vI=p(()=>{g();f()});async function DI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"version");if(!t)throw new i("--version <version-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/settings/zaraz/v2/history/${encodeURIComponent(t)}`);e.output.json(m)}var SI=p(()=>{g();f()});async function qI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone> is required.");let t=a(n,"outputFile");if(!t)throw new i("--output-file <path> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/settings/zaraz/v2/export`);await Bun.write(t,JSON.stringify(m,null,2)),e.output.success(`Zaraz configuration exported to "${t}".`)}var AI=p(()=>{g();f()});var NI={};z(NI,{run:()=>TO});async function TO(s,e){let[n,...o]=s;switch(n){case"config":{let[t,...r]=o;switch(t){case"get":case"show":return $I(r,e);case"update":case"set":return UI(r,e);default:throw new i(`Unknown zaraz config action: "${t??""}". Use "get" or "update".`)}}case"publish":return zI(o,e);case"workflow":{let[t,...r]=o;switch(t){case"get":case"show":return bI(r,e);default:throw new i(`Unknown zaraz workflow action: "${t??""}". Use "get".`)}}case"history":{let[t,...r]=o;switch(t){case"list":case"ls":return II(r,e);case"get":case"show":return DI(r,e);default:throw new i(`Unknown zaraz history action: "${t??""}". Use "list" or "get".`)}}case"export":return qI(o,e);case void 0:case"--help":case"-h":e.output.raw(LI);return;default:throw new i(`Unknown zaraz command: "${n}"
|
|
2292
|
+
|
|
2293
|
+
${LI}`)}}var LI=`Usage: cf zaraz <command>
|
|
2294
|
+
|
|
2295
|
+
Commands:
|
|
2296
|
+
config get Get Zaraz configuration
|
|
2297
|
+
config update Update Zaraz configuration from JSON file
|
|
2298
|
+
publish Publish Zaraz configuration
|
|
2299
|
+
workflow get Get Zaraz workflow status
|
|
2300
|
+
history list List Zaraz configuration history
|
|
2301
|
+
history get Get a specific history version
|
|
2302
|
+
export Export Zaraz configuration to a file
|
|
2303
|
+
|
|
2304
|
+
Flags:
|
|
2305
|
+
--zone <zone> Zone (ID or domain, required)
|
|
2306
|
+
|
|
2307
|
+
Run 'cf zaraz <command> --help' for more information.`;var EI=p(()=>{f();kI();_I();RI();PI();vI();SI();AI()});async function GI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/email/routing`);e.output.detail({Tag:r.tag,Name:r.name,Enabled:r.enabled,Status:r.status,"Skip Wizard":r.skip_wizard,Created:r.created,Modified:r.modified})}var MI=p(()=>{g();f()});async function TI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.post(`/zones/${encodeURIComponent(t)}/email/routing/enable`);e.output.success("Email routing enabled."),e.output.detail({Tag:r.tag,Name:r.name,Enabled:r.enabled,Status:r.status})}var ZI=p(()=>{g();f()});async function OI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!await C("Disable email routing?",e.flags)){e.output.warn("Aborted.");return}let r=await y(o,e.client),m=await e.client.post(`/zones/${encodeURIComponent(r)}/email/routing/disable`);e.output.success("Email routing disabled."),e.output.detail({Tag:m.tag,Name:m.name,Enabled:m.enabled,Status:m.status})}var jI=p(()=>{g();f();U()});async function BI(s,e){let[n,...o]=s;switch(n){case"get":case"show":return GI(o,e);case"enable":return TI(o,e);case"disable":return OI(o,e);case void 0:case"--help":case"-h":e.output.raw(JI);return;default:throw new i(`Unknown settings command: "${n}"
|
|
2308
|
+
|
|
2309
|
+
${JI}`)}}var JI=`Usage: cf email-routing settings <command>
|
|
2310
|
+
|
|
2311
|
+
Commands:
|
|
2312
|
+
get Get email routing settings
|
|
2313
|
+
enable Enable email routing
|
|
2314
|
+
disable Disable email routing
|
|
2315
|
+
|
|
2316
|
+
Run 'cf email-routing settings <command> --help' for more information.`;var HI=p(()=>{f();MI();ZI();jI()});async function VI(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/email/routing/dns`),m=[{key:"type",header:"Type",width:10},{key:"name",header:"Name",width:40},{key:"content",header:"Content",width:50},{key:"ttl",header:"TTL",width:8},{key:"priority",header:"Priority",width:10}];e.output.table(r,m)}var WI=p(()=>{g();f()});async function KI(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/email/routing/addresses`),r=[{key:"tag",header:"Tag",width:36},{key:"email",header:"Email",width:40},{key:"verified",header:"Verified",width:24},{key:"created",header:"Created",width:12,transform:(m)=>String(m).slice(0,10)}];e.output.table(t,r)}var QI=p(()=>{h()});async function YI(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"email");if(!t)throw new i("--email <address> is required.");let r=await e.client.post(`/accounts/${encodeURIComponent(o)}/email/routing/addresses`,{email:t});e.output.success(`Destination address created: ${r.email}`),e.output.detail({Tag:r.tag,Email:r.email,Verified:r.verified??"pending",Created:r.created})}var XI=p(()=>{h();f()});async function FI(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <address-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/email/routing/addresses/${encodeURIComponent(t)}`);e.output.detail({Tag:r.tag,Email:r.email,Verified:r.verified??"pending",Created:r.created,Modified:r.modified})}var xI=p(()=>{h();f()});async function ev(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <address-id> is required.");if(!await C(`Delete destination address "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/email/routing/addresses/${encodeURIComponent(t)}`),e.output.success(`Destination address "${t}" deleted.`)}var ov=p(()=>{h();f();U()});async function tv(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return KI(o,e);case"create":case"add":return YI(o,e);case"get":case"show":return FI(o,e);case"delete":case"rm":return ev(o,e);case void 0:case"--help":case"-h":e.output.raw(nv);return;default:throw new i(`Unknown addresses command: "${n}"
|
|
2317
|
+
|
|
2318
|
+
${nv}`)}}var nv=`Usage: cf email-routing addresses <command>
|
|
2319
|
+
|
|
2320
|
+
Commands:
|
|
2321
|
+
list List destination addresses
|
|
2322
|
+
create Create a destination address
|
|
2323
|
+
get Get a destination address
|
|
2324
|
+
delete Delete a destination address
|
|
2325
|
+
|
|
2326
|
+
Run 'cf email-routing addresses <command> --help' for more information.`;var rv=p(()=>{f();QI();XI();xI();ov()});async function iv(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/email/routing/rules`),m=[{key:"tag",header:"Tag",width:36},{key:"name",header:"Name",width:30},{key:"enabled",header:"Enabled",width:10},{key:"priority",header:"Priority",width:10}];e.output.table(r,m)}var sv=p(()=>{g();f()});async function av(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <rule-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/email/routing/rules`,m);e.output.success(`Email routing rule created: ${l.tag}`),e.output.detail({Tag:l.tag,Name:l.name??"",Enabled:l.enabled??!0,Priority:l.priority??0})}var mv=p(()=>{g();f()});async function dv(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/email/routing/rules/${encodeURIComponent(t)}`);e.output.detail({Tag:m.tag,Name:m.name??"",Enabled:m.enabled??!0,Priority:m.priority??0,Matchers:JSON.stringify(m.matchers),Actions:JSON.stringify(m.actions)})}var cv=p(()=>{g();f()});async function pv(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <rule-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.put(`/zones/${encodeURIComponent(l)}/email/routing/rules/${encodeURIComponent(t)}`,c);e.output.success(`Email routing rule "${t}" updated.`),e.output.detail({Tag:w.tag,Name:w.name??"",Enabled:w.enabled??!0,Priority:w.priority??0})}var uv=p(()=>{g();f()});async function fv(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"id");if(!t)throw new i("--id <rule-id> is required.");if(!await C(`Delete email routing rule "${t}"?`,e.flags)){e.output.warn("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/email/routing/rules/${encodeURIComponent(t)}`),e.output.success(`Email routing rule "${t}" deleted.`)}var lv=p(()=>{g();f();U()});async function hv(s,e){let[n,...o]=s;switch(n){case"get":case"show":return oj(o,e);case"update":return nj(o,e);case void 0:case"--help":case"-h":e.output.raw(wv);return;default:throw new i(`Unknown catch-all command: "${n}"
|
|
2327
|
+
|
|
2328
|
+
${wv}`)}}async function oj(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/email/routing/rules/catch_all`);e.output.detail({Tag:r.tag,Name:r.name??"",Enabled:r.enabled,Matchers:JSON.stringify(r.matchers),Actions:JSON.stringify(r.actions)})}async function nj(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <catchall-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.put(`/zones/${encodeURIComponent(c)}/email/routing/rules/catch_all`,m);e.output.success("Catch-all rule updated."),e.output.detail({Tag:l.tag,Name:l.name??"",Enabled:l.enabled})}var wv=`Usage: cf email-routing rules catch-all <command>
|
|
2329
|
+
|
|
2330
|
+
Commands:
|
|
2331
|
+
get Get the catch-all rule
|
|
2332
|
+
update Update the catch-all rule
|
|
2333
|
+
|
|
2334
|
+
Run 'cf email-routing rules catch-all <command> --help' for more information.`;var yv=p(()=>{g();f()});async function gv(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return iv(o,e);case"create":case"add":return av(o,e);case"get":case"show":return dv(o,e);case"update":return pv(o,e);case"delete":case"rm":return fv(o,e);case"catch-all":return hv(o,e);case void 0:case"--help":case"-h":e.output.raw(Cv);return;default:throw new i(`Unknown rules command: "${n}"
|
|
2335
|
+
|
|
2336
|
+
${Cv}`)}}var Cv=`Usage: cf email-routing rules <command>
|
|
2337
|
+
|
|
2338
|
+
Commands:
|
|
2339
|
+
list List email routing rules
|
|
2340
|
+
create Create an email routing rule
|
|
2341
|
+
get Get an email routing rule
|
|
2342
|
+
update Update an email routing rule
|
|
2343
|
+
delete Delete an email routing rule
|
|
2344
|
+
catch-all Manage catch-all rule (get, update)
|
|
2345
|
+
|
|
2346
|
+
Run 'cf email-routing rules <command> --help' for more information.`;var $v=p(()=>{f();sv();mv();cv();uv();lv();yv()});var Uv={};z(Uv,{run:()=>ij});async function ij(s,e){let[n,...o]=s;switch(n){case"settings":return BI(o,e);case"dns":return VI(o,e);case"addresses":return tv(o,e);case"rules":return gv(o,e);case void 0:case"--help":case"-h":e.output.raw(kv);return;default:throw new i(`Unknown email-routing command: "${n}"
|
|
2347
|
+
|
|
2348
|
+
${kv}`)}}var kv=`Usage: cf email-routing <command>
|
|
2349
|
+
|
|
2350
|
+
Commands:
|
|
2351
|
+
settings Manage email routing settings
|
|
2352
|
+
dns Show required DNS records
|
|
2353
|
+
addresses Manage destination addresses
|
|
2354
|
+
rules Manage email routing rules
|
|
2355
|
+
|
|
2356
|
+
Run 'cf email-routing <command> --help' for more information.`;var _v=p(()=>{f();HI();WI();rv();$v()});async function zv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/policies`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"alert_type",header:"Type",width:30},{key:"enabled",header:"Enabled",width:10}];e.output.table(t,r)}var Rv=p(()=>{h()});async function bv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <policy-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/policies/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,Description:r.description??"","Alert Type":r.alert_type,Enabled:r.enabled??!0,Created:r.created??"",Modified:r.modified??""})}var Pv=p(()=>{h();f()});async function Iv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"file");if(!t)throw new i("--file <alert-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`/accounts/${encodeURIComponent(o)}/alerting/v3/policies`,m);e.output.success(`Alert policy created: ${c.id}`),e.output.detail({ID:c.id,Name:c.name,"Alert Type":c.alert_type,Enabled:c.enabled??!0})}var vv=p(()=>{h();f()});async function Dv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <policy-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <alert-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`/accounts/${encodeURIComponent(o)}/alerting/v3/policies/${encodeURIComponent(t)}`,c);e.output.success(`Alert policy "${t}" updated.`),e.output.detail({ID:l.id,Name:l.name,"Alert Type":l.alert_type,Enabled:l.enabled??!0})}var Sv=p(()=>{h();f()});async function qv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <policy-id> is required.");if(!await C(`Delete alert policy "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/alerting/v3/policies/${encodeURIComponent(t)}`),e.output.success(`Alert policy "${t}" deleted.`)}var Av=p(()=>{h();f();U()});async function Nv(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return pj(o,e);case"create":case"add":return uj(o,e);case"update":return fj(o,e);case"delete":case"rm":return lj(o,e);case void 0:case"--help":case"-h":e.output.raw(Lv);return;default:throw new i(`Unknown webhooks command: "${n}"
|
|
2357
|
+
|
|
2358
|
+
${Lv}`)}}async function pj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/webhooks`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"url",header:"URL",width:50}];e.output.table(t,r)}async function uj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"name");if(!t)throw new i("--name <name> is required.");let r=a(n,"url");if(!r)throw new i("--url <url> is required.");let m=await e.client.post(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/webhooks`,{name:t,url:r});e.output.success(`Webhook created: ${m.id}`),e.output.detail({ID:m.id,Name:m.name,URL:m.url})}async function fj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <webhook-id> is required.");let r={},m=a(n,"name"),c=a(n,"url");if(m)r.name=m;if(c)r.url=c;if(Object.keys(r).length===0)throw new i("At least one of --name or --url is required.");let l=await e.client.put(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/webhooks/${encodeURIComponent(t)}`,r);e.output.success(`Webhook "${t}" updated.`),e.output.detail({ID:l.id,Name:l.name,URL:l.url})}async function lj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <webhook-id> is required.");if(!await C(`Delete webhook "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/webhooks/${encodeURIComponent(t)}`),e.output.success(`Webhook "${t}" deleted.`)}var Lv=`Usage: cf alerts destinations webhooks <command>
|
|
2359
|
+
|
|
2360
|
+
Commands:
|
|
2361
|
+
list List webhook destinations
|
|
2362
|
+
create Create a webhook destination
|
|
2363
|
+
update Update a webhook destination
|
|
2364
|
+
delete Delete a webhook destination
|
|
2365
|
+
|
|
2366
|
+
Run 'cf alerts destinations webhooks <command> --help' for more information.`;var Ev=p(()=>{h();f();U()});async function Mv(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return hj(o,e);case"connect":return yj(o,e);case"delete":case"rm":return Cj(o,e);case void 0:case"--help":case"-h":e.output.raw(Gv);return;default:throw new i(`Unknown pagerduty command: "${n}"
|
|
2367
|
+
|
|
2368
|
+
${Gv}`)}}async function hj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/pagerduty`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"service_id",header:"Service ID",width:30},{key:"service_name",header:"Service Name",width:30}];e.output.table(t,r)}async function yj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.post(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/pagerduty/connect`);e.output.success("PagerDuty connected."),e.output.detail({ID:t.id,Name:t.name??""})}async function Cj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <pagerduty-id> is required.");if(!await C(`Delete PagerDuty destination "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/alerting/v3/destinations/pagerduty/${encodeURIComponent(t)}`),e.output.success(`PagerDuty destination "${t}" deleted.`)}var Gv=`Usage: cf alerts destinations pagerduty <command>
|
|
2369
|
+
|
|
2370
|
+
Commands:
|
|
2371
|
+
list List PagerDuty destinations
|
|
2372
|
+
connect Connect PagerDuty
|
|
2373
|
+
delete Delete a PagerDuty destination
|
|
2374
|
+
|
|
2375
|
+
Run 'cf alerts destinations pagerduty <command> --help' for more information.`;var Tv=p(()=>{h();f();U()});async function Ov(s,e){let[n,...o]=s;switch(n){case"webhooks":return Nv(o,e);case"pagerduty":return Mv(o,e);case void 0:case"--help":case"-h":e.output.raw(Zv);return;default:throw new i(`Unknown destinations command: "${n}"
|
|
2376
|
+
|
|
2377
|
+
${Zv}`)}}var Zv=`Usage: cf alerts destinations <command>
|
|
2378
|
+
|
|
2379
|
+
Commands:
|
|
2380
|
+
webhooks Manage webhook destinations
|
|
2381
|
+
pagerduty Manage PagerDuty destinations
|
|
2382
|
+
|
|
2383
|
+
Run 'cf alerts destinations <command> --help' for more information.`;var jv=p(()=>{f();Ev();Tv()});async function Bv(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return kj(o,e);case"create":case"add":return Uj(o,e);case"delete":case"rm":return _j(o,e);case void 0:case"--help":case"-h":e.output.raw(Jv);return;default:throw new i(`Unknown silences command: "${n}"
|
|
2384
|
+
|
|
2385
|
+
${Jv}`)}}async function kj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/silences`),r=[{key:"id",header:"ID",width:36},{key:"description",header:"Description",width:40},{key:"starts_on",header:"Starts",width:20},{key:"ends_on",header:"Ends",width:20}];e.output.table(t,r)}async function Uj(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"file");if(!t)throw new i("--file <silence-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await e.client.post(`/accounts/${encodeURIComponent(o)}/alerting/v3/silences`,m);e.output.success(`Alert silence created: ${c.id}`),e.output.detail({ID:c.id,Description:c.description??"","Starts On":c.starts_on??"","Ends On":c.ends_on??""})}async function _j(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <silence-id> is required.");if(!await C(`Delete alert silence "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/alerting/v3/silences/${encodeURIComponent(t)}`),e.output.success(`Alert silence "${t}" deleted.`)}var Jv=`Usage: cf alerts silences <command>
|
|
2386
|
+
|
|
2387
|
+
Commands:
|
|
2388
|
+
list List alert silences
|
|
2389
|
+
create Create an alert silence
|
|
2390
|
+
delete Delete an alert silence
|
|
2391
|
+
|
|
2392
|
+
Run 'cf alerts silences <command> --help' for more information.`;var Hv=p(()=>{h();f();U()});async function Vv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t={},r=a(n,"from"),m=a(n,"to");if(r)t.since=r;if(m)t.until=m;let c=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/history`,t),l=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"alert_type",header:"Type",width:30},{key:"mechanism_type",header:"Mechanism",width:15},{key:"sent",header:"Sent",width:20}];e.output.table(c,l)}var Wv=p(()=>{h()});async function Kv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/alerting/v3/available_alerts`),r=[];for(let c of Object.values(t))if(Array.isArray(c))r.push(...c);let m=[{key:"type",header:"Type",width:40},{key:"display_name",header:"Display Name",width:40},{key:"description",header:"Description",width:50}];e.output.table(r,m)}var Qv=p(()=>{h()});var Xv={};z(Xv,{run:()=>Pj});async function Pj(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return zv(o,e);case"get":case"show":return bv(o,e);case"create":case"add":return Iv(o,e);case"update":return Dv(o,e);case"delete":case"rm":return qv(o,e);case"destinations":case"dest":return Ov(o,e);case"silences":return Bv(o,e);case"history":return Vv(o,e);case"available":return Kv(o,e);case void 0:case"--help":case"-h":e.output.raw(Yv);return;default:throw new i(`Unknown alerts command: "${n}"
|
|
2393
|
+
|
|
2394
|
+
${Yv}`)}}var Yv=`Usage: cf alerts <command>
|
|
2395
|
+
|
|
2396
|
+
Commands:
|
|
2397
|
+
list List alert policies
|
|
2398
|
+
get Get an alert policy
|
|
2399
|
+
create Create an alert policy
|
|
2400
|
+
update Update an alert policy
|
|
2401
|
+
delete Delete an alert policy
|
|
2402
|
+
destinations Manage alert destinations (webhooks, pagerduty)
|
|
2403
|
+
silences Manage alert silences
|
|
2404
|
+
history View alert history
|
|
2405
|
+
available List available alert types
|
|
2406
|
+
|
|
2407
|
+
Run 'cf alerts <command> --help' for more information.`;var Fv=p(()=>{f();Rv();Pv();vv();Sv();Av();jv();Hv();Wv();Qv()});async function xv(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/rules/lists`),r=[{key:"id",header:"ID",width:36},{key:"name",header:"Name",width:30},{key:"kind",header:"Kind",width:12},{key:"num_items",header:"Items",width:8},{key:"created_on",header:"Created",width:12,transform:(m)=>String(m).slice(0,10)}];e.output.table(t,r)}var eD=p(()=>{h()});async function oD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <list-id> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,Kind:r.kind,Description:r.description??"","Num Items":r.num_items??0,"Num Referencing Filters":r.num_referencing_filters??0,Created:r.created_on??"",Modified:r.modified_on??""})}var nD=p(()=>{h();f()});async function tD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"name");if(!t)throw new i("--name <name> is required.");let r=a(n,"kind");if(!r)throw new i("--kind <ip|asn|country|hostname> is required.");let m={name:t,kind:r},c=a(n,"description");if(c)m.description=c;let l=await e.client.post(`/accounts/${encodeURIComponent(o)}/rules/lists`,m);e.output.success(`Rules list created: ${l.id}`),e.output.detail({ID:l.id,Name:l.name,Kind:l.kind,Description:l.description??""})}var rD=p(()=>{h();f()});async function iD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <list-id> is required.");let r={},m=a(n,"description");if(m)r.description=m;let c=await e.client.put(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}`,r);e.output.success(`Rules list "${t}" updated.`),e.output.detail({ID:c.id,Name:c.name,Kind:c.kind,Description:c.description??""})}var sD=p(()=>{h();f()});async function aD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"id");if(!t)throw new i("--id <list-id> is required.");if(!await C(`Delete rules list "${t}"?`,e.flags)){e.output.warn("Aborted.");return}await e.client.delete(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}`),e.output.success(`Rules list "${t}" deleted.`)}var mD=p(()=>{h();f();U()});async function dD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"list");if(!t)throw new i("--list <list-id> is required.");let r={},m=a(n,"cursor");if(m)r.cursor=m;let c=await e.client.get(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}/items`,r),l=[{key:"id",header:"ID",width:36},{key:"ip",header:"IP",width:20},{key:"asn",header:"ASN",width:12},{key:"comment",header:"Comment",width:30},{key:"created_on",header:"Created",width:12,transform:(w)=>String(w).slice(0,10)}];e.output.table(c,l)}var cD=p(()=>{h();f()});async function pD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"list");if(!t)throw new i("--list <list-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <items-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.post(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}/items`,c);if(e.output.success(`Items added to list "${t}".`),l.operation_id)e.output.detail({"Operation ID":l.operation_id})}var uD=p(()=>{h();f()});async function fD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"list");if(!t)throw new i("--list <list-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <items-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await e.client.put(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}/items`,c);if(e.output.success(`Items replaced in list "${t}".`),l.operation_id)e.output.detail({"Operation ID":l.operation_id})}var lD=p(()=>{h();f()});async function wD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"list");if(!t)throw new i("--list <list-id> is required.");let r=D(n,"ids");if(!r||r.length===0)throw new i("--ids <id,...> is required.");if(!await C(`Delete ${r.length} item(s) from list "${t}"?`,e.flags)){e.output.warn("Aborted.");return}let c={items:r.map((l)=>({id:l}))};await e.client.delete(`/accounts/${encodeURIComponent(o)}/rules/lists/${encodeURIComponent(t)}/items`,c),e.output.success(`${r.length} item(s) deleted from list "${t}".`)}var hD=p(()=>{h();f();U()});async function CD(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return dD(o,e);case"add":case"create":return pD(o,e);case"replace":return fD(o,e);case"delete":case"rm":return wD(o,e);case void 0:case"--help":case"-h":e.output.raw(yD);return;default:throw new i(`Unknown items command: "${n}"
|
|
2408
|
+
|
|
2409
|
+
${yD}`)}}var yD=`Usage: cf rules-lists items <command>
|
|
2410
|
+
|
|
2411
|
+
Commands:
|
|
2412
|
+
list List items in a rules list
|
|
2413
|
+
add Add items to a rules list
|
|
2414
|
+
replace Replace all items in a rules list
|
|
2415
|
+
delete Delete items from a rules list
|
|
2416
|
+
|
|
2417
|
+
Run 'cf rules-lists items <command> --help' for more information.`;var gD=p(()=>{f();cD();uD();lD();hD()});var kD={};z(kD,{run:()=>Mj});async function Mj(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return xv(o,e);case"get":case"show":return oD(o,e);case"create":case"add":return tD(o,e);case"update":return iD(o,e);case"delete":case"rm":return aD(o,e);case"items":return CD(o,e);case void 0:case"--help":case"-h":e.output.raw($D);return;default:throw new i(`Unknown rules-lists command: "${n}"
|
|
2418
|
+
|
|
2419
|
+
${$D}`)}}var $D=`Usage: cf rules-lists <command>
|
|
2420
|
+
|
|
2421
|
+
Commands:
|
|
2422
|
+
list List all rules lists
|
|
2423
|
+
get Get a rules list
|
|
2424
|
+
create Create a rules list
|
|
2425
|
+
update Update a rules list
|
|
2426
|
+
delete Delete a rules list
|
|
2427
|
+
items Manage list items
|
|
2428
|
+
|
|
2429
|
+
Run 'cf rules-lists <command> --help' for more information.`;var UD=p(()=>{f();eD();nD();rD();sD();mD();gD()});async function _D(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/snippets`),m=[{key:"snippet_name",header:"Name",width:30},{key:"main_module",header:"Main Module",width:30},{key:"created_on",header:"Created",width:12,transform:(c)=>String(c).slice(0,10)},{key:"modified_on",header:"Modified",width:12,transform:(c)=>String(c).slice(0,10)}];e.output.table(r,m)}var zD=p(()=>{g();f()});async function RD(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"name");if(!t)throw new i("--name <snippet-name> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/snippets/${encodeURIComponent(t)}`);e.output.detail({Name:m.snippet_name,"Main Module":m.main_module,Created:m.created_on??"",Modified:m.modified_on??""})}var bD=p(()=>{g();f()});async function PD(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"name");if(!t)throw new i("--name <snippet-name> is required.");let r=a(n,"file");if(!r)throw new i("--file <js-file> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c=await y(o,e.client),l=new FormData;l.append("metadata",JSON.stringify({main_module:t})),l.append("module",new Blob([m],{type:"application/javascript"}),t);let w=await e.client.uploadPut(`/zones/${encodeURIComponent(c)}/snippets/${encodeURIComponent(t)}`,l);e.output.success(`Snippet "${t}" created.`),e.output.detail({Name:w.snippet_name,"Main Module":w.main_module})}var ID=p(()=>{g();f()});async function vD(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"name");if(!t)throw new i("--name <snippet-name> is required.");let r=a(n,"file");if(!r)throw new i("--file <js-file> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c=await y(o,e.client),l=new FormData;l.append("metadata",JSON.stringify({main_module:t})),l.append("module",new Blob([m],{type:"application/javascript"}),t);let w=await e.client.uploadPut(`/zones/${encodeURIComponent(c)}/snippets/${encodeURIComponent(t)}`,l);e.output.success(`Snippet "${t}" updated.`),e.output.detail({Name:w.snippet_name,"Main Module":w.main_module})}var DD=p(()=>{g();f()});async function SD(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"name");if(!t)throw new i("--name <snippet-name> is required.");if(!await C(`Delete snippet "${t}"?`,e.flags)){e.output.warn("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/snippets/${encodeURIComponent(t)}`),e.output.success(`Snippet "${t}" deleted.`)}var qD=p(()=>{g();f();U()});async function LD(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return Bj(o,e);case"upsert":case"update":return Hj(o,e);case void 0:case"--help":case"-h":e.output.raw(AD);return;default:throw new i(`Unknown rules command: "${n}"
|
|
2430
|
+
|
|
2431
|
+
${AD}`)}}async function Bj(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/snippets/snippet_rules`),m=[{key:"snippet_name",header:"Snippet Name",width:30},{key:"expression",header:"Expression",width:50},{key:"description",header:"Description",width:30},{key:"enabled",header:"Enabled",width:10}];e.output.table(r,m)}async function Hj(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <rules-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client);await e.client.put(`/zones/${encodeURIComponent(c)}/snippets/snippet_rules`,m),e.output.success("Snippet rules updated.")}var AD=`Usage: cf snippets rules <command>
|
|
2432
|
+
|
|
2433
|
+
Commands:
|
|
2434
|
+
list List snippet rules
|
|
2435
|
+
upsert Create or update snippet rules
|
|
2436
|
+
|
|
2437
|
+
Run 'cf snippets rules <command> --help' for more information.`;var ND=p(()=>{g();f()});var GD={};z(GD,{run:()=>Wj});async function Wj(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return _D(o,e);case"get":case"show":return RD(o,e);case"create":case"add":return PD(o,e);case"update":return vD(o,e);case"delete":case"rm":return SD(o,e);case"rules":return LD(o,e);case void 0:case"--help":case"-h":e.output.raw(ED);return;default:throw new i(`Unknown snippets command: "${n}"
|
|
2438
|
+
|
|
2439
|
+
${ED}`)}}var ED=`Usage: cf snippets <command>
|
|
2440
|
+
|
|
2441
|
+
Commands:
|
|
2442
|
+
list List snippets
|
|
2443
|
+
get Get a snippet
|
|
2444
|
+
create Create a snippet
|
|
2445
|
+
update Update a snippet
|
|
2446
|
+
delete Delete a snippet
|
|
2447
|
+
rules Manage snippet rules
|
|
2448
|
+
|
|
2449
|
+
Run 'cf snippets <command> --help' for more information.`;var MD=p(()=>{f();zD();bD();ID();DD();qD();ND()});async function TD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=await e.client.get(`/accounts/${encodeURIComponent(o)}/registrar/domains`),r=[{key:"name",header:"Domain",width:30},{key:"status",header:"Status",width:15},{key:"auto_renew",header:"Auto-Renew",width:12},{key:"locked",header:"Locked",width:10},{key:"expires_at",header:"Expires",width:12,transform:(m)=>String(m??"").slice(0,10)}];e.output.table(t,r)}var ZD=p(()=>{h()});async function OD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"domain");if(!t)throw new i("--domain <domain-name> is required.");let r=await e.client.get(`/accounts/${encodeURIComponent(o)}/registrar/domains/${encodeURIComponent(t)}`);e.output.detail({ID:r.id,Name:r.name,Status:r.status,"Auto-Renew":r.auto_renew??!1,Locked:r.locked??!1,Privacy:r.privacy??!1,"Name Servers":(r.name_servers??[]).join(", "),"Current Registrar":r.current_registrar??"",Expires:r.expires_at??"",Created:r.created_at??"",Updated:r.updated_at??""})}var jD=p(()=>{h();f()});async function JD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"domain");if(!t)throw new i("--domain <domain-name> is required.");let r={};if(n.autoRenew!==void 0)r.auto_renew=v(n,"autoRenew");if(n.locked!==void 0)r.locked=v(n,"locked");if(n.privacy!==void 0)r.privacy=v(n,"privacy");if(Object.keys(r).length===0)throw new i("At least one of --auto-renew, --locked, or --privacy is required.");let m=await e.client.put(`/accounts/${encodeURIComponent(o)}/registrar/domains/${encodeURIComponent(t)}`,r);e.output.success(`Domain "${t}" updated.`),e.output.detail({Name:m.name,Status:m.status,"Auto-Renew":m.auto_renew??!1,Locked:m.locked??!1,Privacy:m.privacy??!1})}var BD=p(()=>{h();f()});async function HD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"domain");if(!t)throw new i("--domain <domain-name> is required.");let r=await e.client.post(`/accounts/${encodeURIComponent(o)}/registrar/domains/${encodeURIComponent(t)}/transfer-in`);e.output.success(`Transfer initiated for "${t}".`),e.output.detail({Name:r.name,Status:r.status})}var VD=p(()=>{h();f()});var KD={};z(KD,{run:()=>Fj});async function Fj(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return TD(o,e);case"get":case"show":return OD(o,e);case"update":return JD(o,e);case"transfer-in":case"transfer":return HD(o,e);case void 0:case"--help":case"-h":e.output.raw(WD);return;default:throw new i(`Unknown registrar command: "${n}"
|
|
2450
|
+
|
|
2451
|
+
${WD}`)}}var WD=`Usage: cf registrar <command>
|
|
2452
|
+
|
|
2453
|
+
Commands:
|
|
2454
|
+
list List registered domains
|
|
2455
|
+
get Get domain registration details
|
|
2456
|
+
update Update domain registration settings
|
|
2457
|
+
transfer-in Initiate domain transfer
|
|
2458
|
+
|
|
2459
|
+
Run 'cf registrar <command> --help' for more information.`;var QD=p(()=>{f();ZD();jD();BD();VD()});async function YD(s,e){let{flags:n}=d(s),o=await u(a(n,"accountId"),e.client,e.config),t=a(n,"userEmail"),r=a(n,"actionType"),m=a(n,"resourceType"),c=a(n,"from"),l=a(n,"to"),w=a(n,"direction"),$=R(n,"perPage"),k={};if(t)k["actor.email"]=t;if(r)k["action.type"]=r;if(m)k["resource.type"]=m;if(c)k.since=c;if(l)k.before=l;if(w)k.direction=w;if($)k.per_page=String($);let _=await e.client.get(`/accounts/${encodeURIComponent(o)}/audit_logs`,k),I=[{key:"id",header:"ID",width:34},{key:"actor",header:"Actor",width:28,transform:(P)=>{let j=P;return j?.email??j?.ip??"-"}},{key:"action",header:"Action",width:24,transform:(P)=>{return P?.type??"-"}},{key:"resource",header:"Resource",width:24,transform:(P)=>{return P?.type??"-"}},{key:"when",header:"When",width:20,transform:(P)=>typeof P==="string"?P.slice(0,19).replace("T"," "):"-"}];e.output.table(_,I)}var XD=p(()=>{h()});var xD={};z(xD,{run:()=>eJ});async function eJ(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return YD(o,e);case void 0:case"--help":case"-h":e.output.raw(FD);return;default:throw new i(`Unknown audit-logs command: "${n}"
|
|
2460
|
+
|
|
2461
|
+
${FD}`)}}var FD=`Usage: cf audit-logs <command>
|
|
2462
|
+
|
|
2463
|
+
Commands:
|
|
2464
|
+
list List audit logs for an account
|
|
2465
|
+
|
|
2466
|
+
Run 'cf audit-logs <command> --help' for more information.`;var eS=p(()=>{f();XD()});async function oS(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=await y(o,e.client),r=await e.client.get(`/zones/${encodeURIComponent(t)}/pagerules`),m=[{key:"id",header:"ID",width:34},{key:"targets",header:"Target",width:40,transform:(c)=>{return c?.[0]?.constraint?.value??"-"}},{key:"actions",header:"Actions",width:30,transform:(c)=>{return c?.map((w)=>w.id).join(", ")??"-"}},{key:"status",header:"Status",width:10},{key:"priority",header:"Priority",width:10}];e.output.table(r,m)}var nS=p(()=>{g();f()});async function tS(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <pagerule-id> is required.");let r=await y(o,e.client),m=await e.client.get(`/zones/${encodeURIComponent(r)}/pagerules/${encodeURIComponent(t)}`);e.output.detail({ID:m.id,Target:m.targets?.[0]?.constraint?.value??"-",Actions:JSON.stringify(m.actions,null,2),Status:m.status??"-",Priority:m.priority??"-",Created:m.created_on??"-",Modified:m.modified_on??"-"})}var rS=p(()=>{g();f()});async function iS(s,e){let{flags:n}=d(s),o=a(n,"zone");if(!o)throw new i("--zone <zone-id-or-name> is required.");let t=a(n,"file");if(!t)throw new i("--file <pagerule-json> is required.");let r;try{r=await Bun.file(t).text()}catch{throw new i(`Cannot read file: "${t}".`)}let m;try{m=JSON.parse(r)}catch{throw new i("File must contain valid JSON.")}let c=await y(o,e.client),l=await e.client.post(`/zones/${encodeURIComponent(c)}/pagerules`,m);e.output.success(`Page rule created (ID: ${l.id}).`)}var sS=p(()=>{g();f()});async function aS(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <pagerule-id> is required.");let r=a(n,"file");if(!r)throw new i("--file <pagerule-json> is required.");let m;try{m=await Bun.file(r).text()}catch{throw new i(`Cannot read file: "${r}".`)}let c;try{c=JSON.parse(m)}catch{throw new i("File must contain valid JSON.")}let l=await y(o,e.client),w=await e.client.put(`/zones/${encodeURIComponent(l)}/pagerules/${encodeURIComponent(t)}`,c);e.output.success(`Page rule ${w.id} updated.`)}var mS=p(()=>{g();f()});async function dS(s,e){let{flags:n}=d(s),o=a(n,"zone"),t=a(n,"id");if(!o)throw new i("--zone <zone-id-or-name> is required.");if(!t)throw new i("--id <pagerule-id> is required.");if(!await C(`Delete page rule "${t}"?`,e.flags)){e.output.info("Aborted.");return}let m=await y(o,e.client);await e.client.delete(`/zones/${encodeURIComponent(m)}/pagerules/${encodeURIComponent(t)}`),e.output.success(`Page rule ${t} deleted.`)}var cS=p(()=>{g();f();U()});var uS={};z(uS,{run:()=>sJ});async function sJ(s,e){let[n,...o]=s;switch(n){case"list":case"ls":return oS(o,e);case"get":case"show":return tS(o,e);case"create":case"add":return iS(o,e);case"update":case"edit":return aS(o,e);case"delete":case"rm":case"remove":return dS(o,e);case void 0:case"--help":case"-h":e.output.raw(pS);return;default:throw new i(`Unknown page-rules command: "${n}"
|
|
2467
|
+
|
|
2468
|
+
${pS}`)}}var pS=`Usage: cf page-rules <command>
|
|
2469
|
+
|
|
2470
|
+
Commands:
|
|
2471
|
+
list List page rules for a zone
|
|
2472
|
+
get Get page rule details
|
|
2473
|
+
create Create a new page rule
|
|
2474
|
+
update Update a page rule
|
|
2475
|
+
delete Delete a page rule
|
|
2476
|
+
|
|
2477
|
+
Run 'cf page-rules <command> --help' for more information.`;var fS=p(()=>{f();nS();rS();sS();mS();cS()});H();f();function Le(s,e){let n=e??M();if(s){let l=Q(n,s);if(!l)throw new J(`Profile "${s}" not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,s)}let o=process.env.CF_PROFILE;if(o){let l=Q(n,o);if(!l)throw new J(`Profile "${o}" (from CF_PROFILE) not found. Available profiles: ${Object.keys(n.profiles).join(", ")||"(none)"}`);return we(l,o)}let t=process.env.CF_API_TOKEN;if(t)return{method:"token",token:t};let r=process.env.CF_API_KEY,m=process.env.CF_API_EMAIL;if(r&&m)return{method:"key",apiKey:r,email:m};if(r&&!m)throw new J("CF_API_KEY is set but CF_API_EMAIL is missing. Both are required for API key auth.");let c=Q(n);if(c)return we(c,n.default_profile);throw new J(`No authentication credentials found.
|
|
2478
|
+
Set up credentials using one of:
|
|
2479
|
+
- cf config set-profile (interactive)
|
|
2480
|
+
- CF_API_TOKEN environment variable
|
|
2481
|
+
- CF_API_KEY + CF_API_EMAIL environment variables`)}function we(s,e){if(s.auth_method==="token"){if(!s.token)throw new J(`Profile "${e}" is configured for token auth but has no token.`);return{method:"token",token:s.token}}if(s.auth_method==="key"){if(!s.api_key||!s.email)throw new J(`Profile "${e}" is configured for key auth but is missing api_key or email.`);return{method:"key",apiKey:s.api_key,email:s.email}}throw new J(`Profile "${e}" has invalid auth_method: "${s.auth_method}"`)}import{mkdirSync as UJ,readFileSync as RS,writeFileSync as _J,renameSync as zJ,existsSync as RJ,chmodSync as bJ}from"fs";import{join as Ee}from"path";import{homedir as bS}from"os";var PS=Ee(bS(),".cf"),IS=Ee(PS,"config.json");function Ne(){return{version:1,default_profile:"default",profiles:{},defaults:{output:"table",no_color:!1,per_page:20}}}function he(){try{let s=RS(IS,"utf-8"),e=JSON.parse(s);if(typeof e.version!=="number"||typeof e.profiles!=="object"||typeof e.defaults!=="object")return Ne();return e}catch{return Ne()}}f();ae();var SS="https://api.cloudflare.com/client/v4",Te=30000,me=3,qS=[1000,2000,4000];function Ze(s){if(s.length<=4)return"****";return`***${s.slice(-4)}`}class $e{credentials;flags;constructor(s,e){this.credentials=s,this.flags=e}getAuthHeaders(){if(this.credentials.method==="token"&&this.credentials.token)return{Authorization:`Bearer ${this.credentials.token}`};if(this.credentials.method==="key"&&this.credentials.apiKey&&this.credentials.email)return{"X-Auth-Key":this.credentials.apiKey,"X-Auth-Email":this.credentials.email};return{}}logVerbose(s){if(this.flags.verbose)process.stderr.write(`${V(`[cf] ${s}`)}
|
|
2482
|
+
`)}logAuthHeaders(){if(this.credentials.method==="token"&&this.credentials.token)return`Authorization: Bearer ${Ze(this.credentials.token)}`;if(this.credentials.method==="key"&&this.credentials.apiKey)return`X-Auth-Key: ${Ze(this.credentials.apiKey)}`;return"(no auth)"}async request(s,e,n){let o=`${SS}${e}`;if(n?.params){let l=new URLSearchParams;for(let[$,k]of Object.entries(n.params))if(k!==void 0&&k!=="")l.set($,k);let w=l.toString();if(w)o+=`?${w}`}let t={...this.getAuthHeaders()},r=null;if(n?.formData)r=n.formData;else if(n?.body!==void 0)t["Content-Type"]="application/json",r=JSON.stringify(n.body);let m=null,c="network error";for(let l=0;l<=me;l++){if(l>0){let k=qS[l-1]??4000;this.logVerbose(`Retrying after ${c} in ${k}ms (attempt ${l+1}/${me+1})`),await AS(k)}let w=new AbortController,$=setTimeout(()=>w.abort(),Te);try{this.logVerbose(`${s} ${o} [${this.logAuthHeaders()}]`);let k=await fetch(o,{method:s,headers:t,body:r,signal:w.signal});if(clearTimeout($),this.logVerbose(`${k.status} ${k.statusText}`),k.status===429&&l<me){m=Error("Rate limited (429)"),c="rate limit (429)";continue}let _=await k.json();if(this.flags.raw)process.stdout.write(JSON.stringify(_,null,2)+`
|
|
2483
|
+
`);if(!k.ok||!_.success){let I=_.errors??[],P=I.length>0?I[0]?.code??0:0;throw new ne(k.status,P,I)}return _}catch(k){if(clearTimeout($),k instanceof ne)throw k;if(k instanceof DOMException&&k.name==="AbortError")throw new ne(408,0,[{code:0,message:`Request timed out after ${Te}ms`}]);if(m=k instanceof Error?k:Error(String(k)),c=`network error (${m.message})`,l>=me)throw m}}throw m??Error("Request failed after all retries")}async get(s,e){return(await this.request("GET",s,e?{params:e}:void 0)).result}async post(s,e){return(await this.request("POST",s,{body:e})).result}async put(s,e){return(await this.request("PUT",s,{body:e})).result}async patch(s,e){return(await this.request("PATCH",s,{body:e})).result}async delete(s,e){return(await this.request("DELETE",s,e!==void 0?{body:e}:void 0)).result}async upload(s,e){return(await this.request("POST",s,{formData:e})).result}async uploadPut(s,e){return(await this.request("PUT",s,{formData:e})).result}async fetchAll(s,e){let n=[],o={...e},t=1;while(!0){if(o.page=String(t),!o.per_page)o.per_page="50";let r=await this.request("GET",s,{params:o}),m=r.result;if(!Array.isArray(m))throw Error(`fetchAll: expected API to return an array for ${s}, got ${typeof m}. Use get() for single-result endpoints.`);n.push(...m);let c=r.result_info;if(!c)break;if(c.cursors?.after){o.cursor=c.cursors.after,delete o.page,t++;continue}if(t>=c.total_pages)break;t++}return n}}function AS(s){return new Promise((e)=>setTimeout(e,s))}ae();var E={topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:"─",vertical:"│",teeDown:"┬",teeUp:"┴",teeRight:"├",teeLeft:"┤",cross:"┼"};class te{flags;constructor(s){this.flags=s}table(s,e){if(this.flags.quiet)return;if(s.length===0){this.info("No results found.");return}let n=e.map((w)=>{let $=w.header.length,k=0;for(let I of s){let P=ke(I,w.key),j=w.transform?w.transform(P):String(P??""),B=ge(j);if(B.length>k)k=B.length}let _=Math.max($,k);return w.width?Math.min(w.width,Math.max($,_)):_}),o=E.topLeft+n.map((w)=>E.horizontal.repeat(w+2)).join(E.teeDown)+E.topRight,t=E.vertical+e.map((w,$)=>` ${se(Oe(w.header,n[$]??0))} `).join(E.vertical)+E.vertical,r=E.teeRight+n.map((w)=>E.horizontal.repeat(w+2)).join(E.cross)+E.teeLeft,m=s.map((w)=>{return E.vertical+e.map(($,k)=>{let _=ke(w,$.key),I=$.transform?$.transform(_):String(_??"");if($.color)I=$.color(_);return` ${LS(I,n[k]??0)} `}).join(E.vertical)+E.vertical}),c=E.bottomLeft+n.map((w)=>E.horizontal.repeat(w+2)).join(E.teeUp)+E.bottomRight,l=[o,t,r,...m,c].join(`
|
|
2484
|
+
`);process.stdout.write(l+`
|
|
2485
|
+
`)}json(s){if(this.flags.quiet)return;process.stdout.write(JSON.stringify(s,null,2)+`
|
|
2486
|
+
`)}csv(s,e){if(this.flags.quiet)return;let n=e.map((o)=>je(o.header)).join(",");process.stdout.write(n+`
|
|
2487
|
+
`);for(let o of s){let t=e.map((r)=>{let m=ke(o,r.key),c=r.transform?r.transform(m):String(m??"");return je(c)}).join(",");process.stdout.write(t+`
|
|
2488
|
+
`)}}yaml(s){if(this.flags.quiet)return;process.stdout.write(de(s,0)+`
|
|
2489
|
+
`)}raw(s){if(this.flags.quiet)return;process.stdout.write(JSON.stringify(s,null,2)+`
|
|
2490
|
+
`)}success(s){if(this.flags.quiet)return;process.stdout.write(`${ye("✓")} ${s}
|
|
2491
|
+
`)}error(s){process.stderr.write(`${Ce("✗")} ${s}
|
|
2492
|
+
`)}warn(s){if(this.flags.quiet)return;process.stderr.write(`${ie("!")} ${s}
|
|
2493
|
+
`)}info(s){if(this.flags.quiet)return;process.stderr.write(`${Me("ℹ")} ${s}
|
|
2494
|
+
`)}detail(s){if(this.flags.quiet)return;let e=Math.max(...Object.keys(s).map((n)=>n.length));for(let[n,o]of Object.entries(s)){let t=Oe(n,e);process.stdout.write(`${V(t)} ${NS(o)}
|
|
2495
|
+
`)}}}function ke(s,e){let n=e.split("."),o=s;for(let t of n){if(o===null||o===void 0)return;if(typeof o!=="object")return;o=o[t]}return o}function Oe(s,e){if(s.length>=e)return s;return s+" ".repeat(e-s.length)}function LS(s,e){let n=ge(s);if(n.length>=e)return s;return s+" ".repeat(e-n.length)}function je(s){if(s.includes(",")||s.includes('"')||s.includes(`
|
|
2496
|
+
`))return`"${s.replace(/"/g,'""')}"`;return s}function de(s,e){let n=" ".repeat(e);if(s===null||s===void 0)return`${n}null`;if(typeof s==="string"){if(s.includes(`
|
|
2497
|
+
`)||s.includes(":")||s.includes("#"))return`${n}"${s.replace(/"/g,"\\\"")}"`;return`${n}${s}`}if(typeof s==="number"||typeof s==="boolean")return`${n}${s}`;if(Array.isArray(s)){if(s.length===0)return`${n}[]`;return s.map((o)=>{let t=de(o,0).trimStart();return`${n}- ${t}`}).join(`
|
|
2498
|
+
`)}if(typeof s==="object"){let o=Object.entries(s);if(o.length===0)return`${n}{}`;return o.map(([t,r])=>{if(r===null||r===void 0||typeof r==="string"||typeof r==="number"||typeof r==="boolean"){let c=de(r,0).trimStart();return`${n}${t}: ${c}`}let m=de(r,e+1);return`${n}${t}:
|
|
2499
|
+
${m}`}).join(`
|
|
2500
|
+
`)}return`${n}${String(s)}`}function NS(s){if(s===null||s===void 0)return V("(none)");if(typeof s==="boolean")return s?ye("true"):Ce("false");if(Array.isArray(s))return s.join(", ");return String(s)}function ES(){if(process.env.NO_COLOR!==void 0)return!0;if(process.env.TERM==="dumb")return!0;if(!process.stdout.isTTY&&!process.stderr.isTTY)return!0;return!1}var Ue=null;function _e(s){Ue=s}function GS(){if(Ue!==null)return Ue;return ES()}function X(s,e){return(n)=>{if(GS())return n;return`\x1B[${s}m${n}\x1B[${e}m`}}var EJ=X("32","39"),GJ=X("31","39"),MJ=X("33","39"),TJ=X("36","39"),ZJ=X("2","22"),OJ=X("1","22");var MS={6003:"Invalid or expired API token. Re-authenticate with: cf config set-profile",6100:"Invalid API key format. Check your key with: cf config show",6111:"Invalid or expired API key. Re-authenticate with: cf config set-profile",6112:"Invalid email + API key combination. Verify your credentials.",7000:"No route for the given URI. Check the command syntax.",7003:"Zone not found. Verify the zone ID or domain with: cf zones list",7001:"Method not allowed. This endpoint may not support that operation.",9103:"DNS record not found. Verify the record ID with: cf dns list",9104:"DNS record already exists. Use 'cf dns update' instead.",1e4:"Authentication error. Re-authenticate with: cf config set-profile"};class ze extends Error{statusCode;errorCode;errors;constructor(s,e,n){let o=n.length>0?n.map((t)=>`[${t.code}] ${t.message}`).join("; "):`HTTP ${s}`;super(o);this.name="CloudflareAPIError",this.statusCode=s,this.errorCode=e,this.errors=n}getSuggestion(){for(let s of this.errors){let e=MS[s.code];if(e)return e}return null}format(){let s=[`API Error (HTTP ${this.statusCode})`];for(let n of this.errors)s.push(` [${n.code}] ${n.message}`);let e=this.getSuggestion();if(e)s.push(` Suggestion: ${e}`);return s.join(`
|
|
2501
|
+
`)}}class Re extends Error{constructor(s){super(s);this.name="UsageError"}}class ce extends Error{constructor(s){super(s);this.name="AuthError"}}function Je(s){let e={},n=[],o=0;while(o<s.length){let t=s[o];if(t==="--"){n.push(...s.slice(o+1));break}if(t.startsWith("--")){let r=t.slice(2),m=r.indexOf("=");if(m!==-1){let w=be(r.slice(0,m));e[w]=r.slice(m+1),o++;continue}if(r.startsWith("no-")){let w=be(r.slice(3));e[w]=!1,o++;continue}let c=be(r),l=s[o+1];if(l!==void 0&&!l.startsWith("-")){e[c]=l,o+=2;continue}e[c]=!0,o++;continue}if(t.startsWith("-")&&t.length===2){let r=t.slice(1),m=s[o+1];if(m!==void 0&&!m.startsWith("-")){e[r]=m,o+=2;continue}e[r]=!0,o++;continue}n.push(t),o++}return{flags:e,positional:n}}function be(s){return s.replace(/-([a-z])/g,(e,n)=>n.toUpperCase())}function Pe(s,e){let n=s[e];if(typeof n==="string")return n;return}function W(s,e){let n=s[e];if(typeof n==="boolean")return n;if(typeof n==="string")return n!==""&&n!=="0"&&n!=="false";return!1}var lS="0.1.0",aJ=`
|
|
2502
|
+
cf-cli v${lS} \u2014 Cloudflare CLI
|
|
2503
|
+
|
|
2504
|
+
USAGE:
|
|
2505
|
+
cf <resource> <action> [options]
|
|
2506
|
+
|
|
2507
|
+
RESOURCES:
|
|
2508
|
+
zones Manage zones (CRUD, analytics, settings)
|
|
2509
|
+
dns Manage DNS records (list, create, update, delete, import, export)
|
|
2510
|
+
workers Manage Workers (scripts, routes, cron, domains, versions, platforms, tail)
|
|
2511
|
+
kv Manage Workers KV (namespaces, keys, bulk operations)
|
|
2512
|
+
durable-objects Manage Durable Objects (namespaces, objects)
|
|
2513
|
+
r2 Manage R2 storage (buckets, CORS, lifecycle, custom domains, events, metrics)
|
|
2514
|
+
d1 Manage D1 databases (CRUD, query, import, export)
|
|
2515
|
+
pages Manage Pages projects (deployments, domains)
|
|
2516
|
+
queues Manage Queues (CRUD, consumers, messages)
|
|
2517
|
+
hyperdrive Manage Hyperdrive configurations (database connection pooling)
|
|
2518
|
+
pipelines Manage Pipelines (data ingestion)
|
|
2519
|
+
secrets-store Manage Secrets Store (stores, secrets)
|
|
2520
|
+
rulesets Manage Rulesets (rules, versions, phases)
|
|
2521
|
+
firewall Manage Firewall legacy rules (IP, UA, zone lockdowns)
|
|
2522
|
+
page-shield Manage Page Shield (settings, scripts, connections, policies)
|
|
2523
|
+
turnstile Manage Turnstile widgets (CAPTCHA)
|
|
2524
|
+
api-gateway Manage API Gateway (settings, schemas)
|
|
2525
|
+
rate-limits Manage Rate Limiting rules (legacy)
|
|
2526
|
+
tunnels Manage Cloudflare Tunnels (CRUD, config, connections, token)
|
|
2527
|
+
devices Manage Zero Trust devices (list, get, revoke, registrations, posture)
|
|
2528
|
+
warp Manage WARP client (settings, split-tunnels, fleet-status)
|
|
2529
|
+
access Manage Zero Trust Access (apps, policies, groups, IdPs, certs)
|
|
2530
|
+
gateway Manage Zero Trust Gateway (DNS/HTTP/network policies, DLP)
|
|
2531
|
+
accounts Manage accounts (list, members, roles, subscriptions)
|
|
2532
|
+
user User info, billing, and API tokens
|
|
2533
|
+
ssl Manage SSL/TLS certificates and settings
|
|
2534
|
+
lb Manage Load Balancers (pools, monitors, regions)
|
|
2535
|
+
healthchecks Manage standalone Healthchecks
|
|
2536
|
+
cache-reserve Manage Cache Reserve settings
|
|
2537
|
+
tiered-cache Manage Tiered Cache settings
|
|
2538
|
+
argo Manage Argo Smart Routing
|
|
2539
|
+
waiting-rooms Manage Waiting Rooms (events, rules, status)
|
|
2540
|
+
observatory Speed / Observatory (pages, tests, schedules)
|
|
2541
|
+
stream Manage Stream (videos, live, captions, audio, keys, watermarks, webhooks)
|
|
2542
|
+
images Manage Images (CRUD, variants, signing-keys, direct-upload)
|
|
2543
|
+
calls Manage Calls / WebRTC (apps, TURN keys)
|
|
2544
|
+
ai Workers AI (run inference, models, fine-tuning)
|
|
2545
|
+
ai-gateway Manage AI Gateway (CRUD, logs, datasets, evaluations)
|
|
2546
|
+
vectorize Manage Vectorize indexes (CRUD, insert, query, metadata)
|
|
2547
|
+
magic-transit Manage Magic Transit (GRE/IPsec tunnels, sites, routes, ACLs, PCAPs)
|
|
2548
|
+
mnm Manage Magic Network Monitoring (config, rules)
|
|
2549
|
+
addressing Manage IP addressing (address-maps, prefixes, regional-hostnames)
|
|
2550
|
+
spectrum Manage Spectrum apps and analytics
|
|
2551
|
+
radar Cloudflare Radar (HTTP, DNS, BGP, attacks, bots, email)
|
|
2552
|
+
intel Threat intelligence (domain, IP, ASN, DNS, WHOIS)
|
|
2553
|
+
url-scanner URL Scanner (scan, search, HAR, screenshot, DOM)
|
|
2554
|
+
cf1 Cloudforce One (requests, threat-events, PIRs, scans)
|
|
2555
|
+
logpush Manage Logpush jobs (zone or account scoped)
|
|
2556
|
+
web-analytics Manage Web Analytics (RUM sites, rules)
|
|
2557
|
+
zaraz Manage Zaraz (config, publish, history, export)
|
|
2558
|
+
email-routing Manage Email Routing (settings, addresses, rules)
|
|
2559
|
+
alerts Manage Alerts and Notifications (policies, webhooks, PagerDuty, silences)
|
|
2560
|
+
rules-lists Manage Rules Lists (CRUD, items)
|
|
2561
|
+
snippets Manage Snippets (CRUD, rules)
|
|
2562
|
+
registrar Manage Registrar domains (list, get, update, transfer-in)
|
|
2563
|
+
audit-logs View Audit Logs
|
|
2564
|
+
page-rules Manage Page Rules (legacy)
|
|
2565
|
+
cache Purge cached content
|
|
2566
|
+
config Manage CLI configuration and profiles
|
|
2567
|
+
completion Generate shell completions (bash, zsh, fish)
|
|
2568
|
+
|
|
2569
|
+
GLOBAL FLAGS:
|
|
2570
|
+
--profile <name> Use a specific auth profile
|
|
2571
|
+
--output <format> Output format: table, json, csv, yaml (default: table)
|
|
2572
|
+
--raw Show raw API response JSON
|
|
2573
|
+
--verbose Show debug output (HTTP requests, timing)
|
|
2574
|
+
--quiet Suppress non-essential output
|
|
2575
|
+
--no-color Disable colored output
|
|
2576
|
+
--yes Auto-confirm destructive operations
|
|
2577
|
+
--help Show this help message
|
|
2578
|
+
--version Show version
|
|
2579
|
+
|
|
2580
|
+
AUTHENTICATION:
|
|
2581
|
+
Set up credentials using environment variables or config profiles:
|
|
2582
|
+
CF_API_TOKEN Cloudflare API token (recommended)
|
|
2583
|
+
CF_API_KEY Cloudflare global API key
|
|
2584
|
+
CF_API_EMAIL Cloudflare account email (required with API key)
|
|
2585
|
+
CF_PROFILE Config profile name to use
|
|
2586
|
+
|
|
2587
|
+
Or configure a profile:
|
|
2588
|
+
cf config set-profile --name default --token <your-token>
|
|
2589
|
+
|
|
2590
|
+
EXAMPLES:
|
|
2591
|
+
cf zones list
|
|
2592
|
+
cf dns list --zone example.com
|
|
2593
|
+
cf dns create --zone example.com --type A --name www --content 1.2.3.4
|
|
2594
|
+
cf user info
|
|
2595
|
+
cf accounts list
|
|
2596
|
+
`.trim();function mJ(){let s=process.argv.slice(2),e=Je(s),n={profile:Pe(e.flags,"profile"),output:Pe(e.flags,"output"),raw:W(e.flags,"raw")||void 0,verbose:W(e.flags,"verbose")||void 0,quiet:W(e.flags,"quiet")||void 0,noColor:W(e.flags,"noColor")||W(e.flags,"color")===!1||void 0,yes:W(e.flags,"yes")||void 0};if(n.raw===void 0)delete n.raw;if(n.verbose===void 0)delete n.verbose;if(n.quiet===void 0)delete n.quiet;if(n.noColor===void 0)delete n.noColor;if(n.yes===void 0)delete n.yes;let o=e.positional[0]??"",t=e.positional[1]??"",r=e.positional.slice(2);return{flags:n,resource:o,action:t,rest:r}}function dJ(s){let e=he();if(!s.output&&e.defaults.output)s.output=e.defaults.output;if(s.noColor===void 0&&e.defaults.no_color)s.noColor=!0;if(s.noColor)_e(!0);let n=Le(s.profile,e),o=new $e(n,s),t=new te(s);return{client:o,output:t,flags:s,config:e}}async function cJ(){let{flags:s,resource:e,action:n,rest:o}=mJ();if(e===""||e==="help"||process.argv.includes("--help")){process.stdout.write(aJ+`
|
|
2597
|
+
`);return}if(e==="version"||e==="--version"){process.stdout.write(`cf-cli v${lS}
|
|
2598
|
+
`);return}let t;try{t=dJ(s)}catch(r){if(e==="config"){let m=he(),c=new te(s);if(s.noColor)_e(!0);t={client:null,output:c,flags:s,config:m}}else{if(r instanceof ce)new te(s).error(r.message),process.exit(1);throw r}}try{await pJ(e,n,t)}catch(r){if(r instanceof ze)t.output.error(r.format()),process.exit(1);if(r instanceof Re)t.output.error(r.message),process.exit(1);if(r instanceof ce)t.output.error(r.message),process.exit(1);throw r}}async function pJ(s,e,n){let o=process.argv.slice(2),t=o.indexOf(s),r=t>=0?o.slice(t+1):[];switch(s){case"zones":case"zone":{let{run:m}=await Promise.resolve().then(() => (Uo(),ko));return m(r,n)}case"dns":{let{run:m}=await Promise.resolve().then(() => (Oo(),Zo));return m(r,n)}case"workers":case"worker":{let{run:m}=await Promise.resolve().then(() => (Fn(),Xn));return m(r,n)}case"kv":{let{run:m}=await Promise.resolve().then(() => (bt(),Rt));return m(r,n)}case"durable-objects":case"do":{let{run:m}=await Promise.resolve().then(() => (qt(),St));return m(r,n)}case"accounts":case"account":{let{run:m}=await Promise.resolve().then(() => (ur(),pr));return m(r,n)}case"user":case"whoami":{let{run:m}=await Promise.resolve().then(() => (Mr(),Gr));return m(r,n)}case"cache":{let{run:m}=await Promise.resolve().then(() => (Br(),Jr));return m(r,n)}case"config":{let{run:m}=await Promise.resolve().then(() => (ti(),ni));return m(r,n)}case"r2":{let{run:m}=await Promise.resolve().then(() => (ts(),ns));return m(r,n)}case"d1":{let{run:m}=await Promise.resolve().then(() => (Us(),ks));return m(r,n)}case"pages":case"page":{let{run:m}=await Promise.resolve().then(() => (ia(),ra));return m(r,n)}case"queues":case"queue":{let{run:m}=await Promise.resolve().then(() => (Da(),va));return m(r,n)}case"hyperdrive":{let{run:m}=await Promise.resolve().then(() => (Ja(),ja));return m(r,n)}case"pipelines":case"pipeline":{let{run:m}=await Promise.resolve().then(() => (em(),xa));return m(r,n)}case"secrets-store":{let{run:m}=await Promise.resolve().then(() => (km(),$m));return m(r,n)}case"rulesets":case"ruleset":{let{run:m}=await Promise.resolve().then(() => (id(),rd));return m(r,n)}case"firewall":case"fw":{let{run:m}=await Promise.resolve().then(() => (Zd(),Td));return m(r,n)}case"page-shield":{let{run:m}=await Promise.resolve().then(() => (kc(),$c));return m(r,n)}case"turnstile":{let{run:m}=await Promise.resolve().then(() => (Tc(),Mc));return m(r,n)}case"api-gateway":{let{run:m}=await Promise.resolve().then(() => (sp(),ip));return m(r,n)}case"rate-limits":case"rate-limit":{let{run:m}=await Promise.resolve().then(() => (gp(),Cp));return m(r,n)}case"tunnels":case"tunnel":{let{run:m}=await Promise.resolve().then(() => (Kp(),Wp));return m(r,n)}case"devices":case"device":{let{run:m}=await Promise.resolve().then(() => (Uu(),ku));return m(r,n)}case"warp":{let{run:m}=await Promise.resolve().then(() => (Ju(),ju));return m(r,n)}case"access":{let{run:m}=await Promise.resolve().then(() => (Ul(),kl));return m(r,n)}case"gateway":case"gw":{let{run:m}=await Promise.resolve().then(() => (gw(),Cw));return m(r,n)}case"completion":case"completions":{let{run:m}=await Promise.resolve().then(() => (zw(),_w));return m(r,n)}case"ssl":case"tls":{let{run:m}=await Promise.resolve().then(() => (ih(),rh));return m(r,n)}case"lb":case"load-balancer":case"load-balancers":{let{run:m}=await Promise.resolve().then(() => (ny(),oy));return m(r,n)}case"healthchecks":case"healthcheck":{let{run:m}=await Promise.resolve().then(() => (yy(),hy));return m(r,n)}case"cache-reserve":{let{run:m}=await Promise.resolve().then(() => (zy(),_y));return m(r,n)}case"tiered-cache":{let{run:m}=await Promise.resolve().then(() => (Sy(),Dy));return m(r,n)}case"argo":{let{run:m}=await Promise.resolve().then(() => (My(),Gy));return m(r,n)}case"waiting-rooms":case"waiting-room":{let{run:m}=await Promise.resolve().then(() => (yC(),hC));return m(r,n)}case"observatory":case"speed":{let{run:m}=await Promise.resolve().then(() => (HC(),BC));return m(r,n)}case"calls":case"webrtc":{let{run:m}=await Promise.resolve().then(() => (lg(),fg));return m(r,n)}case"ai":{let{run:m}=await Promise.resolve().then(() => (Gg(),Eg));return m(r,n)}case"ai-gateway":{let{run:m}=await Promise.resolve().then(() => (p$(),c$));return m(r,n)}case"vectorize":{let{run:m}=await Promise.resolve().then(() => (V$(),H$));return m(r,n)}case"stream":{let{run:m}=await Promise.resolve().then(() => (dU(),mU));return m(r,n)}case"images":case"image":{let{run:m}=await Promise.resolve().then(() => (VU(),HU));return m(r,n)}case"addressing":{let{run:m}=await Promise.resolve().then(() => (M_(),G_));return m(r,n)}case"spectrum":{let{run:m}=await Promise.resolve().then(() => (az(),sz));return m(r,n)}case"radar":{let{run:m}=await Promise.resolve().then(() => (Iz(),Pz));return m(r,n)}case"intel":{let{run:m}=await Promise.resolve().then(() => (Hz(),Bz));return m(r,n)}case"url-scanner":{let{run:m}=await Promise.resolve().then(() => (mR(),aR));return m(r,n)}case"cf1":case"cloudforce-one":{let{run:m}=await Promise.resolve().then(() => (bR(),RR));return m(r,n)}case"magic-transit":{let{run:m}=await Promise.resolve().then(() => (xb(),Fb));return m(r,n)}case"mnm":{let{run:m}=await Promise.resolve().then(() => (UP(),kP));return m(r,n)}case"logpush":{let{run:m}=await Promise.resolve().then(() => (KP(),WP));return m(r,n)}case"web-analytics":case"rum":{let{run:m}=await Promise.resolve().then(() => (gI(),CI));return m(r,n)}case"zaraz":{let{run:m}=await Promise.resolve().then(() => (EI(),NI));return m(r,n)}case"email-routing":{let{run:m}=await Promise.resolve().then(() => (_v(),Uv));return m(r,n)}case"alerts":case"alert":{let{run:m}=await Promise.resolve().then(() => (Fv(),Xv));return m(r,n)}case"rules-lists":case"rules-list":{let{run:m}=await Promise.resolve().then(() => (UD(),kD));return m(r,n)}case"snippets":case"snippet":{let{run:m}=await Promise.resolve().then(() => (MD(),GD));return m(r,n)}case"registrar":{let{run:m}=await Promise.resolve().then(() => (QD(),KD));return m(r,n)}case"audit-logs":{let{run:m}=await Promise.resolve().then(() => (eS(),xD));return m(r,n)}case"page-rules":case"page-rule":{let{run:m}=await Promise.resolve().then(() => (fS(),uS));return m(r,n)}default:n.output.error(`Unknown resource: "${s}". Run "cf help" for available commands.`),process.exit(1)}}cJ().catch((s)=>{process.stderr.write(`Fatal error: ${s instanceof Error?s.message:String(s)}
|
|
2599
|
+
`),process.exit(1)});
|