@burdenoff/cli-sdk 2026.1031.2 → 2026.1102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/{chunk-REBBLQFS.js → chunk-AYNNSLCL.js} +360 -379
  2. package/dist/{chunk-SQSFZFQZ.js → chunk-W4JZR7RJ.js} +1 -1
  3. package/dist/{chunk-UAFYTYK6.js → chunk-YIY5IDXQ.js} +5 -5
  4. package/dist/core/index.cjs +4 -4
  5. package/dist/core/index.js +1 -1
  6. package/dist/index.cjs +4 -4
  7. package/dist/index.js +1 -1
  8. package/dist/modules/adaptercloud/index.js +1 -1
  9. package/dist/modules/artistrybase/index.js +1 -1
  10. package/dist/modules/assethandler/index.js +1 -1
  11. package/dist/modules/atheletebridge/index.js +1 -1
  12. package/dist/modules/auth/index.cjs +31 -31
  13. package/dist/modules/auth/index.js +1 -1
  14. package/dist/modules/billing/index.cjs +18 -18
  15. package/dist/modules/billing/index.js +22 -22
  16. package/dist/modules/brainyrich/index.js +1 -1
  17. package/dist/modules/buildmyiq/index.cjs +3 -3
  18. package/dist/modules/buildmyiq/index.js +1 -1
  19. package/dist/modules/channels/index.js +1 -1
  20. package/dist/modules/collabkin/index.js +1 -1
  21. package/dist/modules/comradecircle/index.js +1 -1
  22. package/dist/modules/conversations/index.js +1 -1
  23. package/dist/modules/coolandlovely/index.js +1 -1
  24. package/dist/modules/cosmicintersection/index.js +1 -1
  25. package/dist/modules/crewfoundry/index.js +1 -1
  26. package/dist/modules/devportal/index.cjs +41 -35
  27. package/dist/modules/devportal/index.js +49 -43
  28. package/dist/modules/ecoimpacthub/index.js +1 -1
  29. package/dist/modules/eventfullymanaged/index.cjs +4 -4
  30. package/dist/modules/eventfullymanaged/index.js +1 -1
  31. package/dist/modules/export/index.js +1 -1
  32. package/dist/modules/files/index.js +1 -1
  33. package/dist/modules/fluidgrids/index.js +1 -1
  34. package/dist/modules/ggnomad/index.cjs +16 -16
  35. package/dist/modules/ggnomad/index.js +21 -21
  36. package/dist/modules/govcitizenhub/index.js +1 -1
  37. package/dist/modules/groups/index.js +1 -1
  38. package/dist/modules/headshotmarketing/index.js +1 -1
  39. package/dist/modules/hookmovies/index.js +1 -1
  40. package/dist/modules/housingvista/index.js +1 -1
  41. package/dist/modules/integrations/index.js +1 -1
  42. package/dist/modules/intelwatchtower/index.js +1 -1
  43. package/dist/modules/kadaikodi/index.js +1 -1
  44. package/dist/modules/labsofscience/index.js +1 -1
  45. package/dist/modules/manufacturedops/index.js +1 -1
  46. package/dist/modules/movethewheels/index.js +1 -1
  47. package/dist/modules/mybodyshield/index.cjs +52 -28
  48. package/dist/modules/mybodyshield/index.js +71 -47
  49. package/dist/modules/notifications/index.js +1 -1
  50. package/dist/modules/organizations/index.js +1 -1
  51. package/dist/modules/planmagnet/index.js +1 -1
  52. package/dist/modules/products/index.js +1 -1
  53. package/dist/modules/proserviceworld/index.js +1 -1
  54. package/dist/modules/rbac/index.js +1 -1
  55. package/dist/modules/sandbox/index.cjs +27 -46
  56. package/dist/modules/sandbox/index.js +1 -1
  57. package/dist/modules/scheduler/index.js +1 -1
  58. package/dist/modules/security/index.cjs +3 -3
  59. package/dist/modules/security/index.js +1 -1
  60. package/dist/modules/semanticfed/index.js +1 -1
  61. package/dist/modules/store/index.cjs +46 -40
  62. package/dist/modules/store/index.js +45 -39
  63. package/dist/modules/subscriberbot/index.js +1 -1
  64. package/dist/modules/support/index.js +1 -1
  65. package/dist/modules/tags/index.cjs +2 -2
  66. package/dist/modules/tags/index.js +1 -1
  67. package/dist/modules/technospam/index.js +1 -1
  68. package/dist/modules/theculturepost/index.js +1 -1
  69. package/dist/modules/theglobalfuel/index.js +1 -1
  70. package/dist/modules/timecampus/index.cjs +3 -3
  71. package/dist/modules/timecampus/index.js +1 -1
  72. package/dist/modules/tours/index.js +1 -1
  73. package/dist/modules/vibecontrols/index.cjs +332 -332
  74. package/dist/modules/vibecontrols/index.js +4 -4
  75. package/dist/modules/workspaces/index.js +1 -1
  76. package/package.json +1 -1
@@ -17,26 +17,26 @@
17
17
  items { id name slug tenantId organizationId }
18
18
  }
19
19
  }
20
- `,variables:{limit:50}})});if(!r.ok){let c=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${r.status}): ${c}`)}let a=await r.json();if(a.errors?.length)throw new Error(`Failed to fetch workspaces: ${a.errors[0]?.message??"unknown error"}`);return a.data?.myWorkspaces?.items??[]}function Ae(n){try{let s=new URL(n);return s.protocol==="http:"||s.protocol==="https:"}catch{return false}}async function rt(n){try{if(!Ae(n))return !1;let{execFile:s}=await import('child_process'),i=process.platform,r,a;return i==="darwin"?(r="open",a=[n]):i==="win32"?(r="cmd",a=["/c","start","",n]):(r="xdg-open",a=[n]),new Promise(c=>{s(r,a,p=>{c(!p);});})}catch{return false}}var S=class extends Error{exitCode;hint;constructor(s,i){super(s),this.name="CliUserError",this.exitCode=i?.exitCode??1,this.hint=i?.hint;}};var k=class extends Error{cause;constructor(s,i){super(s),this.name="CliInternalError",this.cause=i;}};var $t=null;function yt(n){$t=n;}function f(){if(!$t)throw new k("vibecontrols module helpers used before setHelpersContext was called");return $t}async function l(n,s){return f().gql.global.request(n,s)}async function St(n,s){return f().gql.global.request(n,s)}function b(){f().gql.reset();}function d(n){let s=n instanceof Error?n.message:String(n);throw new S(s)}function m(n,s,i){f().output.formatAndOutput(n,s,i);}function I(n){f().output.printSuccess(n);}function x(n){f().output.printInfo(n);}function v(n){f().output.printWarning(n);}function X(n){f().output.printJson(n);}function J(n){return f().output.formatStatus(n)}function h(n){return f().output.formatDate(n)}function q(n,s){return f().output.truncate(n,s)}function R(){return f()}function F(){return f().auth.read()}function O(n){f().auth.write(n);}function Ct(){f().auth.clear();}function B(){return f().config.read()}function _t(){return f().config.resolveOIDC()}function kt(n){return n?n.expiresAt?Date.now()>=n.expiresAt:false:f().auth.isTokenExpired()}var vt="mutation { signOut }",Rt=`
20
+ `,variables:{limit:50}})});if(!r.ok){let c=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${r.status}): ${c}`)}let a=await r.json();if(a.errors?.length)throw new Error(`Failed to fetch workspaces: ${a.errors[0]?.message??"unknown error"}`);return a.data?.myWorkspaces?.items??[]}function Te(n){try{let s=new URL(n);return s.protocol==="http:"||s.protocol==="https:"}catch{return false}}async function rt(n){try{if(!Te(n))return !1;let{execFile:s}=await import('child_process'),i=process.platform,r,a;return i==="darwin"?(r="open",a=[n]):i==="win32"?(r="cmd",a=["/c","start","",n]):(r="xdg-open",a=[n]),new Promise(c=>{s(r,a,p=>{c(!p);});})}catch{return false}}var S=class extends Error{exitCode;hint;constructor(s,i){super(s),this.name="CliUserError",this.exitCode=i?.exitCode??1,this.hint=i?.hint;}};var k=class extends Error{cause;constructor(s,i){super(s),this.name="CliInternalError",this.cause=i;}};var $t=null;function yt(n){$t=n;}function f(){if(!$t)throw new k("vibecontrols module helpers used before setHelpersContext was called");return $t}async function l(n,s){return f().gql.global.request(n,s)}async function St(n,s){return f().gql.global.request(n,s)}function b(){f().gql.reset();}function d(n){let s=n instanceof Error?n.message:String(n);throw new S(s)}function m(n,s,i){f().output.formatAndOutput(n,s,i);}function I(n){f().output.printSuccess(n);}function x(n){f().output.printInfo(n);}function v(n){f().output.printWarning(n);}function X(n){f().output.printJson(n);}function J(n){return f().output.formatStatus(n)}function h(n){return f().output.formatDate(n)}function q(n,s){return f().output.truncate(n,s)}function R(){return f()}function F(){return f().auth.read()}function O(n){f().auth.write(n);}function Dt(){f().auth.clear();}function B(){return f().config.read()}function Ct(){return f().config.resolveOIDC()}function _t(n){return n?n.expiresAt?Date.now()>=n.expiresAt:false:f().auth.isTokenExpired()}var wt="mutation { signOut }",vt=`
21
21
  mutation RefreshToken($token: String!) {
22
22
  refreshToken(token: $token) { accessToken refreshToken expiresIn }
23
23
  }
24
- `;async function Kt(n,s){if(n.length===0)throw new S("No workspaces to choose from");if(s.preferredId){let p=n.find(u=>u.id===s.preferredId);if(!p)throw new S(`Workspace ${s.preferredId} is not one of your workspaces`);return {workspace:p,prompted:false}}let[i]=n;if(n.length===1||!s.interactive)return {workspace:i,prompted:false};let r=await s.ask(`
25
- Select workspace [1-${n.length}]: `),a=r===null?-1:parseInt(r.trim(),10)-1;return {workspace:(a>=0&&a<n.length?n[a]:void 0)??i,prompted:true}}async function Ht(n){let i=(await import('readline')).createInterface({input:process.stdin,output:process.stdout});return new Promise(r=>{let a=false;i.on("close",()=>{a||r(null);}),i.question(n,c=>{a=true,i.close(),r(c);});})}function Yt(n){let s=n.command("auth").description("Authentication commands");s.command("login").description(`Authenticate with ${R().productName}`).option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace to bind the session to").action(async i=>{try{i.clientCredentials?await Ne(i.workspaceId):await Oe(i.workspaceId);}catch(r){d(r);}}),s.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(F()?.accessToken)try{await St(vt);}catch{v("Server-side logout failed, clearing local tokens");}Ct(),b(),I("Logged out successfully");}catch(i){d(i);}}),s.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let r=F(),a=B(),c=!!r?.accessToken,p=r?.accessToken?kt(r):false,u=r?.expiresAt?h(new Date(r.expiresAt).toISOString()):"-",$=r?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",t=r?.workspaceTokenExpiresAt?h(new Date(r.workspaceTokenExpiresAt).toISOString()):"-";m(i,{authenticated:c,method:$,expired:p,expiresAt:u,workspaceId:r?.workspaceId??"-",organizationId:r?.organizationId??"-",workspaceTokenExpiresAt:t,workspaceEndpoint:a.workspaceEndpoint,globalEndpoint:a.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(c)],["Method",$],["Expired",String(p)],["Expires At",u],["Workspace ID",r?.workspaceId??"-"],["Organization ID",r?.organizationId??"-"],["Workspace Token Expires",t],["Workspace Endpoint",a.workspaceEndpoint],["Global Endpoint",a.globalEndpoint]]});}),s.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let r=F();if(i.workspace){if(!r?.workspaceToken)throw new S(`No workspace token. Set a workspace: ${R().productName} workspace set <id>`);process.stdout.write(r.workspaceToken);return}if(!r?.accessToken)throw new S(`Not authenticated. Run: ${R().productName} auth login`);process.stdout.write(r.accessToken);}),s.command("refresh").description("Force token refresh").action(async()=>{try{let i=F();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new S(`No refresh token available. Run: ${R().productName} auth login`);if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let c=B(),p=await M(c.globalEndpoint,i.clientId,i.clientSecret);O({...i,accessToken:p.accessToken,expiresAt:Date.now()+p.expiresIn*1e3}),b(),I("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await Wt();return}let a=(await St(Rt,{token:i.refreshToken})).refreshToken;O({...i,accessToken:a.accessToken,refreshToken:a.refreshToken,expiresAt:Date.now()+a.expiresIn*1e3}),b(),I("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await Wt();}catch(i){d(i);}});}async function Wt(){let n=F();if(!n?.accessToken||!n.workspaceId||!n.organizationId)return;let s=B();try{let i=await w(s.workspaceEndpoint,n.accessToken,n.workspaceId,n.organizationId);O({...n,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),b(),I("Workspace token refreshed");}catch{v("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Oe(n){let s=B(),{oidcIssuer:i,clientId:r}=_t(),a={...s,oidcIssuer:i,clientId:r};x("Starting device code authentication...");let c=await ot(a);console.log(""),console.log(` Open: ${c.verificationUri}`),console.log(` Code: ${c.userCode}`),console.log(""),await rt(c.verificationUriComplete??c.verificationUri)?x("Browser opened"):v("Could not open browser \u2014 open the URL manually"),x("Waiting for authorization...");let u=await it(c.deviceCode,c.interval,a),$=u.accessToken,t=Date.now()+u.expiresIn*1e3;O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,authMethod:"device_code"}),b(),x("Fetching workspaces...");try{let e=await j(s.globalEndpoint,$);if(e.length===0){I("Authentication successful (no workspaces found)");return}let o=!!process.stdin.isTTY;e.length>1&&o&&!n&&(console.log(`
26
- Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.slug})`)));let{workspace:g}=await Kt(e,{preferredId:n,interactive:o,ask:Ht});e.length>1&&!o&&!n&&x(`${e.length} workspaces available; pass --workspace-id or run \`${R().productName} workspace set <id>\` to switch`),x(`Using workspace: ${g.name} (${g.id})`);let A=await w(s.workspaceEndpoint,$,g.id,g.organizationId);O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,workspaceToken:A.token,workspaceTokenExpiresAt:new Date(A.expiresAt).getTime(),workspaceId:g.id,organizationId:g.organizationId,authMethod:"device_code"}),b(),I("Authentication successful");}catch(e){O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,authMethod:"device_code"}),b(),I("Authentication successful"),v(`Workspace token not obtained: ${e instanceof Error?e.message:String(e)}`),x(`Set workspace manually: ${R().productName} workspace set <id>`);}}async function Ne(n){let s=B(),r=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),a=await new Promise(A=>{r.question("Client ID: ",E=>A(E.trim()));}),c=await new Promise(A=>{r.question("Client Secret: ",E=>{r.close(),A(E.trim());});});if(!a||!c)throw new S("Client ID and secret cannot be empty");x("Authenticating app...");let p=await M(s.globalEndpoint,a,c),u=p.accessToken,$=Date.now()+p.expiresIn*1e3,t,e,o=n,g;if(o)try{let E=(await j(s.globalEndpoint,u)).find(G=>G.id===o);if(E){g=E.organizationId;let G=await w(s.workspaceEndpoint,u,o,g);t=G.token,e=new Date(G.expiresAt).getTime(),x(`Workspace token issued for: ${E.name}`);}else v(`Workspace ${o} not found \u2014 skipping workspace token`),o=void 0;}catch(A){v(`Workspace token failed: ${A instanceof Error?A.message:String(A)}`);}O({accessToken:u,refreshToken:"",expiresAt:$,workspaceToken:t,workspaceTokenExpiresAt:e,workspaceId:o,organizationId:g,authMethod:"client_credentials",clientId:a,clientSecret:c}),b(),I("App authentication successful");}var zt=`
24
+ `;async function Bt(n,s){if(n.length===0)throw new S("No workspaces to choose from");if(s.preferredId){let p=n.find(u=>u.id===s.preferredId);if(!p)throw new S(`Workspace ${s.preferredId} is not one of your workspaces`);return {workspace:p,prompted:false}}let[i]=n;if(n.length===1||!s.interactive)return {workspace:i,prompted:false};let r=await s.ask(`
25
+ Select workspace [1-${n.length}]: `),a=r===null?-1:parseInt(r.trim(),10)-1;return {workspace:(a>=0&&a<n.length?n[a]:void 0)??i,prompted:true}}async function Kt(n){let i=(await import('readline')).createInterface({input:process.stdin,output:process.stdout});return new Promise(r=>{let a=false;i.on("close",()=>{a||r(null);}),i.question(n,c=>{a=true,i.close(),r(c);});})}function Wt(n){let s=n.command("auth").description("Authentication commands");s.command("login").description(`Authenticate with ${R().productName}`).option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace to bind the session to").action(async i=>{try{i.clientCredentials?await Oe(i.workspaceId):await he(i.workspaceId);}catch(r){d(r);}}),s.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(F()?.accessToken)try{await St(wt);}catch{v("Server-side logout failed, clearing local tokens");}Dt(),b(),I("Logged out successfully");}catch(i){d(i);}}),s.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let r=F(),a=B(),c=!!r?.accessToken,p=r?.accessToken?_t(r):false,u=r?.expiresAt?h(new Date(r.expiresAt).toISOString()):"-",$=r?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",t=r?.workspaceTokenExpiresAt?h(new Date(r.workspaceTokenExpiresAt).toISOString()):"-";m(i,{authenticated:c,method:$,expired:p,expiresAt:u,workspaceId:r?.workspaceId??"-",organizationId:r?.organizationId??"-",workspaceTokenExpiresAt:t,workspaceEndpoint:a.workspaceEndpoint,globalEndpoint:a.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(c)],["Method",$],["Expired",String(p)],["Expires At",u],["Workspace ID",r?.workspaceId??"-"],["Organization ID",r?.organizationId??"-"],["Workspace Token Expires",t],["Workspace Endpoint",a.workspaceEndpoint],["Global Endpoint",a.globalEndpoint]]});}),s.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let r=F();if(i.workspace){if(!r?.workspaceToken)throw new S(`No workspace token. Set a workspace: ${R().productName} workspace set <id>`);process.stdout.write(r.workspaceToken);return}if(!r?.accessToken)throw new S(`Not authenticated. Run: ${R().productName} auth login`);process.stdout.write(r.accessToken);}),s.command("refresh").description("Force token refresh").action(async()=>{try{let i=F();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new S(`No refresh token available. Run: ${R().productName} auth login`);if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let c=B(),p=await M(c.globalEndpoint,i.clientId,i.clientSecret);O({...i,accessToken:p.accessToken,expiresAt:Date.now()+p.expiresIn*1e3}),b(),I("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await Ht();return}let a=(await St(vt,{token:i.refreshToken})).refreshToken;O({...i,accessToken:a.accessToken,refreshToken:a.refreshToken,expiresAt:Date.now()+a.expiresIn*1e3}),b(),I("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await Ht();}catch(i){d(i);}});}async function Ht(){let n=F();if(!n?.accessToken||!n.workspaceId||!n.organizationId)return;let s=B();try{let i=await w(s.workspaceEndpoint,n.accessToken,n.workspaceId,n.organizationId);O({...n,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),b(),I("Workspace token refreshed");}catch{v("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function he(n){let s=B(),{oidcIssuer:i,clientId:r}=Ct(),a={...s,oidcIssuer:i,clientId:r};x("Starting device code authentication...");let c=await ot(a);console.log(""),console.log(` Open: ${c.verificationUri}`),console.log(` Code: ${c.userCode}`),console.log(""),await rt(c.verificationUriComplete??c.verificationUri)?x("Browser opened"):v("Could not open browser \u2014 open the URL manually"),x("Waiting for authorization...");let u=await it(c.deviceCode,c.interval,a),$=u.accessToken,t=Date.now()+u.expiresIn*1e3;O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,authMethod:"device_code"}),b(),x("Fetching workspaces...");try{let e=await j(s.globalEndpoint,$);if(e.length===0){I("Authentication successful (no workspaces found)");return}let o=!!process.stdin.isTTY;e.length>1&&o&&!n&&(console.log(`
26
+ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.slug})`)));let{workspace:g}=await Bt(e,{preferredId:n,interactive:o,ask:Kt});e.length>1&&!o&&!n&&x(`${e.length} workspaces available; pass --workspace-id or run \`${R().productName} workspace set <id>\` to switch`),x(`Using workspace: ${g.name} (${g.id})`);let A=await w(s.workspaceEndpoint,$,g.id,g.organizationId);O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,workspaceToken:A.token,workspaceTokenExpiresAt:new Date(A.expiresAt).getTime(),workspaceId:g.id,organizationId:g.organizationId,authMethod:"device_code"}),b(),I("Authentication successful");}catch(e){O({accessToken:$,refreshToken:u.refreshToken,expiresAt:t,authMethod:"device_code"}),b(),I("Authentication successful"),v(`Workspace token not obtained: ${e instanceof Error?e.message:String(e)}`),x(`Set workspace manually: ${R().productName} workspace set <id>`);}}async function Oe(n){let s=B(),r=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),a=await new Promise(A=>{r.question("Client ID: ",E=>A(E.trim()));}),c=await new Promise(A=>{r.question("Client Secret: ",E=>{r.close(),A(E.trim());});});if(!a||!c)throw new S("Client ID and secret cannot be empty");x("Authenticating app...");let p=await M(s.globalEndpoint,a,c),u=p.accessToken,$=Date.now()+p.expiresIn*1e3,t,e,o=n,g;if(o)try{let E=(await j(s.globalEndpoint,u)).find(G=>G.id===o);if(E){g=E.organizationId;let G=await w(s.workspaceEndpoint,u,o,g);t=G.token,e=new Date(G.expiresAt).getTime(),x(`Workspace token issued for: ${E.name}`);}else v(`Workspace ${o} not found \u2014 skipping workspace token`),o=void 0;}catch(A){v(`Workspace token failed: ${A instanceof Error?A.message:String(A)}`);}O({accessToken:u,refreshToken:"",expiresAt:$,workspaceToken:t,workspaceTokenExpiresAt:e,workspaceId:o,organizationId:g,authMethod:"client_credentials",clientId:a,clientSecret:c}),b(),I("App authentication successful");}var Yt=`
27
27
  query currentUser {
28
28
  currentUser {
29
29
  id email firstName lastName username phoneNumber name
30
30
  emailVerified mfaEnabled isAdmin role status createdAt lastLoginAt
31
31
  }
32
32
  }
33
- `,jt=`
33
+ `,zt=`
34
34
  mutation updateCurrentUserProfile($input: UpdateUserInput!) {
35
35
  updateCurrentUserProfile(input: $input) {
36
36
  id name firstName lastName username phoneNumber
37
37
  }
38
38
  }
39
- `,xt=`
39
+ `,At=`
40
40
  query authAuditLogs($pagination: PaginationInput) {
41
41
  authAuditLogs(pagination: $pagination) {
42
42
  auditLogs {
@@ -47,7 +47,7 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
47
47
  hasMore
48
48
  }
49
49
  }
50
- `,Xt=`
50
+ `,jt=`
51
51
  query activeSessions($pagination: PaginationInput) {
52
52
  activeSessions(pagination: $pagination) {
53
53
  sessions {
@@ -57,7 +57,7 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
57
57
  hasMore
58
58
  }
59
59
  }
60
- `,Jt=`
60
+ `,Xt=`
61
61
  query currentUserMFAMethods($pagination: PaginationInput) {
62
62
  currentUserMFAMethods(pagination: $pagination) {
63
63
  methods { id method status createdAt updatedAt }
@@ -65,21 +65,21 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
65
65
  hasMore
66
66
  }
67
67
  }
68
- `,Qt=`
68
+ `,Jt=`
69
69
  mutation setupMFA($method: MFAMethod!) {
70
70
  setupMFA(method: $method) {
71
71
  method backupCodes qrCode secret
72
72
  }
73
73
  }
74
- `;var Zt=`
74
+ `;var Qt=`
75
75
  mutation enableMFA($code: String!) {
76
76
  enableMFA(code: $code)
77
77
  }
78
- `,te=`
78
+ `,Zt=`
79
79
  mutation disableMFA {
80
80
  disableMFA
81
81
  }
82
- `,ee=`
82
+ `,te=`
83
83
  query myApiKeys($pagination: PaginationInput) {
84
84
  myApiKeys(pagination: $pagination) {
85
85
  apiKeys { id name prefix appId appName scopes expiresAt lastUsedAt createdAt }
@@ -87,7 +87,7 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
87
87
  hasMore
88
88
  }
89
89
  }
90
- `,ne=`
90
+ `,ee=`
91
91
  query appApiKeys($appId: ID!, $pagination: PaginationInput) {
92
92
  appApiKeys(appId: $appId, pagination: $pagination) {
93
93
  apiKeys { id name prefix appId appName scopes expiresAt lastUsedAt createdAt }
@@ -95,23 +95,23 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
95
95
  hasMore
96
96
  }
97
97
  }
98
- `,oe=`
98
+ `,ne=`
99
99
  mutation generateAPIKey($input: GenerateAPIKeyInput!) {
100
100
  generateAPIKey(input: $input) {
101
101
  keyId apiKey apiSecret
102
102
  }
103
103
  }
104
- `;var ie=`
104
+ `;var oe=`
105
105
  mutation revokeAPIKey($keyId: String!) {
106
106
  revokeAPIKey(keyId: $keyId)
107
107
  }
108
- `,re=`
108
+ `,ie=`
109
109
  mutation rotateAPIKey($keyId: String!) {
110
110
  rotateAPIKey(keyId: $keyId) {
111
111
  apiSecret
112
112
  }
113
113
  }
114
- `,se=`
114
+ `,re=`
115
115
  query currentUserDelegations($pagination: PaginationInput) {
116
116
  currentUserDelegations(pagination: $pagination) {
117
117
  delegations {
@@ -123,17 +123,17 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
123
123
  hasMore
124
124
  }
125
125
  }
126
- `,ae=`
126
+ `,se=`
127
127
  mutation grantDelegation($input: GrantDelegationInput!) {
128
128
  grantDelegation(input: $input) {
129
129
  id appId userId grantedBy grantedAt expiresAt scopes workspaceIds status
130
130
  }
131
131
  }
132
- `,ce=`
132
+ `,ae=`
133
133
  mutation revokeDelegation($id: ID!, $reason: String) {
134
134
  revokeDelegation(id: $id, reason: $reason)
135
135
  }
136
- `,pe=`
136
+ `,ce=`
137
137
  query currentUserApps($pagination: PaginationInput) {
138
138
  currentUserApps(pagination: $pagination) {
139
139
  apps {
@@ -144,62 +144,62 @@ Available workspaces:`),e.forEach((E,G)=>console.log(` ${G+1}. ${E.name} (${E.s
144
144
  hasMore
145
145
  }
146
146
  }
147
- `,de=`
147
+ `,pe=`
148
148
  query app($id: ID!) {
149
149
  app(id: $id) {
150
150
  id clientId name description type actorType status ownerUserId redirectUris scopes
151
151
  }
152
152
  }
153
- `,ue=`
153
+ `,de=`
154
154
  mutation createApp($input: CreateAppInput!) {
155
155
  createApp(input: $input) {
156
156
  app { id clientId name type status }
157
157
  clientSecret
158
158
  }
159
159
  }
160
- `,le=`
160
+ `,ue=`
161
161
  mutation updateApp($id: ID!, $input: UpdateAppInput!) {
162
162
  updateApp(id: $id, input: $input) {
163
163
  id name description redirectUris scopes status
164
164
  }
165
165
  }
166
- `,Ie=`
166
+ `,le=`
167
167
  mutation deactivateApp($id: ID!) {
168
168
  deactivateApp(id: $id)
169
169
  }
170
- `,ge=`
170
+ `,Ie=`
171
171
  query getSSOConfig($tenantId: String!) {
172
172
  getSSOConfig(tenantId: $tenantId) {
173
173
  id identifier tenantId entityId ssoUrl sloUrl certificate enabled metadata
174
174
  }
175
175
  }
176
- `,me=`
176
+ `,ge=`
177
177
  mutation saveSSOConfig($tenantId: String!, $input: SSOConfigInput!) {
178
178
  saveSSOConfig(tenantId: $tenantId, input: $input) {
179
179
  id identifier entityId ssoUrl sloUrl certificate enabled
180
180
  }
181
181
  }
182
- `,$e=`
182
+ `,me=`
183
183
  mutation deleteSSOConfig($tenantId: String!) {
184
184
  deleteSSOConfig(tenantId: $tenantId)
185
185
  }
186
- `,Se=`
186
+ `,$e=`
187
187
  query users($filter: UserFilterInput, $pagination: PaginationInput) {
188
188
  users(filter: $filter, pagination: $pagination) {
189
189
  users { id email firstName lastName username role status createdAt }
190
190
  totalCount hasMore
191
191
  }
192
192
  }
193
- `,Ee=`
193
+ `,Se=`
194
194
  query user($id: ID!) {
195
195
  user(id: $id) {
196
196
  id email firstName lastName username role status emailVerified lastLoginAt
197
197
  }
198
198
  }
199
- `,fe=`
199
+ `,Ee=`
200
200
  mutation updateUser($id: ID!, $input: AdminUpdateUserInput!) {
201
201
  updateUser(id: $id, input: $input) {
202
202
  id email firstName lastName username role status
203
203
  }
204
204
  }
205
- `;function Te(n){let s=n.command("profile").description("Current user profile");s.command("show").description("Show current user").option("-f, --format <format>").action(async t=>{try{let e=await l(zt);m(t,e.currentUser);}catch(e){d(e);}}),s.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async t=>{try{let e={};if(t.firstName&&(e.firstName=t.firstName),t.lastName&&(e.lastName=t.lastName),t.name&&(e.name=t.name),t.username&&(e.username=t.username),t.phone&&(e.phoneNumber=t.phone),t.timezone&&(e.timezone=t.timezone),t.language&&(e.language=t.language),!Object.keys(e).length)throw new S("No updates specified");let o=await l(jt,{input:e});I("Profile updated"),m(t,o.updateCurrentUserProfile);}catch(e){d(e);}});let i=n.command("security").description("Account security overview");i.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(xt,{pagination:{limit:t.limit,offset:0}});m(t,e.authAuditLogs.auditLogs,{headers:["When","Action","Resource","IP"],rows:e.authAuditLogs.auditLogs.map(o=>[h(o.createdAt),o.action,o.resource??"-",o.ipAddress??"-"])});}catch(e){d(e);}}),i.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Xt,{pagination:{limit:t.limit,offset:0}});m(t,e.activeSessions.sessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:e.activeSessions.sessions.map(o=>[q(o.id,12),J(o.status),o.ipAddress??"-",h(o.lastActivityAt),String(!!o.isCurrent)])});}catch(e){d(e);}});let r=n.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Jt,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserMFAMethods.methods,{headers:["Method","Status","Created"],rows:e.currentUserMFAMethods.methods.map(o=>[o.method,J(o.status),h(o.createdAt)])});}catch(e){d(e);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async t=>{try{let e=await l(Qt,{method:t.method.toUpperCase()});t.format?m(t,e.setupMFA):(I("MFA enrollment started"),X(e.setupMFA),x("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(e){d(e);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async t=>{try{await l(Zt,{code:t.code}),I("MFA enabled");}catch(e){d(e);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await l(te),I("MFA disabled");}catch(t){d(t);}});let a=n.command("api-keys").description("API key management");a.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=t.app?ne:ee,o=t.app?{appId:t.app,pagination:{limit:t.limit,offset:0}}:{pagination:{limit:t.limit,offset:0}},g=await l(e,o),A=(g.myApiKeys??g.appApiKeys)?.apiKeys??[];m(t,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(E=>[q(E.id,12),E.name??"-",E.prefix??"-",E.appName??"-",Array.isArray(E.scopes)?E.scopes.join(","):"-",h(E.lastUsedAt)])});}catch(e){d(e);}}),a.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,appId:t.app,scope:t.scope?t.scope.split(","):void 0,expiresAt:t.expires},o=await l(oe,{input:e});I("API key generated. Store the secret \u2014 it is only shown once."),X(o.generateAPIKey);}catch(e){d(e);}}),a.command("revoke").description("Revoke an API key").argument("<keyId>").action(async t=>{try{await l(ie,{keyId:t}),I("API key revoked");}catch(e){d(e);}}),a.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async t=>{try{let e=await l(re,{keyId:t});I("API key rotated"),X(e.rotateAPIKey);}catch(e){d(e);}}),n.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(xt,{pagination:{limit:t.limit,offset:0}});m(t,e.authAuditLogs.auditLogs);}catch(e){d(e);}});let c=n.command("delegations").description("Delegation management");c.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(se,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserDelegations.delegations);}catch(e){d(e);}}),c.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async t=>{try{let e={appId:t.app,userId:t.user,scopes:t.scope?t.scope.split(","):void 0,workspaceIds:t.workspace?t.workspace.split(","):void 0,expiresAt:t.expires},o=await l(ae,{input:e});I("Delegation granted"),m(t,o.grantDelegation);}catch(e){d(e);}}),c.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(t,e)=>{try{await l(ce,{id:t,reason:e.reason}),I("Delegation revoked");}catch(o){d(o);}});let p=n.command("apps").description("OAuth/system app management");p.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(pe,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserApps.apps,{headers:["ID","ClientID","Name","Type","Status"],rows:e.currentUserApps.apps.map(o=>[q(o.id,12),q(o.clientId,24),o.name??"-",o.type??"-",J(o.status)])});}catch(e){d(e);}}),p.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(de,{id:t});if(!o.app)throw new S(`App ${t} not found`);m(e,o.app);}catch(o){d(o);}}),p.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,type:(t.type??"OAUTH").toUpperCase(),actorType:(t.actorType??"APP").toUpperCase(),redirectUris:t.redirect?t.redirect.split(","):void 0,scopes:t.scopes?t.scopes.split(","):void 0},o=await l(ue,{input:e});I("App created. Client secret only shown once."),X(o.createApp);}catch(e){d(e);}}),p.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.description!==void 0&&(o.description=e.description),e.redirect&&(o.redirectUris=e.redirect.split(",")),e.scopes&&(o.scopes=e.scopes.split(",")),e.status&&(o.status=e.status.toUpperCase()),!Object.keys(o).length)throw new S("No updates specified");let g=await l(le,{id:t,input:o});I("App updated"),m(e,g.updateApp);}catch(o){d(o);}}),p.command("deactivate").description("Deactivate an app").argument("<id>").action(async t=>{try{await l(Ie,{id:t}),I("App deactivated");}catch(e){d(e);}});let u=n.command("sso").description("SSO (SAML/OIDC) configuration");u.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async t=>{try{let e=await l(ge,{tenantId:t.tenant});m(t,e.getSSOConfig);}catch(e){d(e);}}),u.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,ssoUrl:t.ssoUrl,sloUrl:t.sloUrl,certificate:t.certificate,enabled:!!t.enabled},o=await l(me,{tenantId:t.tenant,input:e});I("SSO config saved"),m(t,o.saveSSOConfig);}catch(e){d(e);}}),u.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async t=>{try{await l($e,{tenantId:t.tenant}),I("SSO config deleted");}catch(e){d(e);}});let $=n.command("users").description("User admin (requires admin permissions)");$.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.email&&(e.email=t.email),t.username&&(e.username=t.username),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.search&&(e.search=t.search);let o=await l(Se,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});m(t,o.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:o.users.users.map(g=>[q(g.id,12),g.email,g.username??"-",g.role??"-",J(g.status),h(g.createdAt)])});}catch(e){d(e);}}),$.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(Ee,{id:t});if(!o.user)throw new S(`User ${t} not found`);m(e,o.user);}catch(o){d(o);}}),$.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.firstName&&(o.firstName=e.firstName),e.lastName&&(o.lastName=e.lastName),e.username&&(o.username=e.username),e.phone&&(o.phoneNumber=e.phone),e.role&&(o.role=e.role.toUpperCase()),e.status&&(o.status=e.status.toUpperCase()),e.emailVerified!==void 0&&(o.emailVerified=e.emailVerified==="true"),!Object.keys(o).length)throw new S("No updates specified");let g=await l(fe,{id:t,input:o});I("User updated"),m(e,g.updateUser);}catch(o){d(o);}});}var ve={id:"auth",version:"1.0.0",displayName:"Authentication",register(n,s){yt(s),Yt(n);let i=n.commands.find(r=>r.name()==="auth");if(!i)throw new k("auth command group missing after registerAuthCommands");Te(i);}},Ys=ve;module.exports=Ys;
205
+ `;function fe(n){let s=n.command("profile").description("Current user profile");s.command("show").description("Show current user").option("-f, --format <format>").action(async t=>{try{let e=await l(Yt);m(t,e.currentUser);}catch(e){d(e);}}),s.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async t=>{try{let e={};if(t.firstName&&(e.firstName=t.firstName),t.lastName&&(e.lastName=t.lastName),t.name&&(e.name=t.name),t.username&&(e.username=t.username),t.phone&&(e.phoneNumber=t.phone),t.timezone&&(e.timezone=t.timezone),t.language&&(e.language=t.language),!Object.keys(e).length)throw new S("No updates specified");let o=await l(zt,{input:e});I("Profile updated"),m(t,o.updateCurrentUserProfile);}catch(e){d(e);}});let i=n.command("security").description("Account security overview");i.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(At,{pagination:{limit:t.limit,offset:0}});m(t,e.authAuditLogs.auditLogs,{headers:["When","Action","Resource","IP"],rows:e.authAuditLogs.auditLogs.map(o=>[h(o.createdAt),o.action,o.resource??"-",o.ipAddress??"-"])});}catch(e){d(e);}}),i.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(jt,{pagination:{limit:t.limit,offset:0}});m(t,e.activeSessions.sessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:e.activeSessions.sessions.map(o=>[q(o.id,12),J(o.status),o.ipAddress??"-",h(o.lastActivityAt),String(!!o.isCurrent)])});}catch(e){d(e);}});let r=n.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Xt,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserMFAMethods.methods,{headers:["Method","Status","Created"],rows:e.currentUserMFAMethods.methods.map(o=>[o.method,J(o.status),h(o.createdAt)])});}catch(e){d(e);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async t=>{try{let e=await l(Jt,{method:t.method.toUpperCase()});t.format?m(t,e.setupMFA):(I("MFA enrollment started"),X(e.setupMFA),x("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(e){d(e);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async t=>{try{await l(Qt,{code:t.code}),I("MFA enabled");}catch(e){d(e);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await l(Zt),I("MFA disabled");}catch(t){d(t);}});let a=n.command("api-keys").description("API key management");a.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=t.app?ee:te,o=t.app?{appId:t.app,pagination:{limit:t.limit,offset:0}}:{pagination:{limit:t.limit,offset:0}},g=await l(e,o),A=(g.myApiKeys??g.appApiKeys)?.apiKeys??[];m(t,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(E=>[q(E.id,12),E.name??"-",E.prefix??"-",E.appName??"-",Array.isArray(E.scopes)?E.scopes.join(","):"-",h(E.lastUsedAt)])});}catch(e){d(e);}}),a.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,appId:t.app,scope:t.scope?t.scope.split(","):void 0,expiresAt:t.expires},o=await l(ne,{input:e});I("API key generated. Store the secret \u2014 it is only shown once."),X(o.generateAPIKey);}catch(e){d(e);}}),a.command("revoke").description("Revoke an API key").argument("<keyId>").action(async t=>{try{await l(oe,{keyId:t}),I("API key revoked");}catch(e){d(e);}}),a.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async t=>{try{let e=await l(ie,{keyId:t});I("API key rotated"),X(e.rotateAPIKey);}catch(e){d(e);}}),n.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(At,{pagination:{limit:t.limit,offset:0}});m(t,e.authAuditLogs.auditLogs);}catch(e){d(e);}});let c=n.command("delegations").description("Delegation management");c.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(re,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserDelegations.delegations);}catch(e){d(e);}}),c.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async t=>{try{let e={appId:t.app,userId:t.user,scopes:t.scope?t.scope.split(","):void 0,workspaceIds:t.workspace?t.workspace.split(","):void 0,expiresAt:t.expires},o=await l(se,{input:e});I("Delegation granted"),m(t,o.grantDelegation);}catch(e){d(e);}}),c.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(t,e)=>{try{await l(ae,{id:t,reason:e.reason}),I("Delegation revoked");}catch(o){d(o);}});let p=n.command("apps").description("OAuth/system app management");p.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(ce,{pagination:{limit:t.limit,offset:0}});m(t,e.currentUserApps.apps,{headers:["ID","ClientID","Name","Type","Status"],rows:e.currentUserApps.apps.map(o=>[q(o.id,12),q(o.clientId,24),o.name??"-",o.type??"-",J(o.status)])});}catch(e){d(e);}}),p.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(pe,{id:t});if(!o.app)throw new S(`App ${t} not found`);m(e,o.app);}catch(o){d(o);}}),p.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,type:(t.type??"OAUTH").toUpperCase(),actorType:(t.actorType??"APP").toUpperCase(),redirectUris:t.redirect?t.redirect.split(","):void 0,scopes:t.scopes?t.scopes.split(","):void 0},o=await l(de,{input:e});I("App created. Client secret only shown once."),X(o.createApp);}catch(e){d(e);}}),p.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.description!==void 0&&(o.description=e.description),e.redirect&&(o.redirectUris=e.redirect.split(",")),e.scopes&&(o.scopes=e.scopes.split(",")),e.status&&(o.status=e.status.toUpperCase()),!Object.keys(o).length)throw new S("No updates specified");let g=await l(ue,{id:t,input:o});I("App updated"),m(e,g.updateApp);}catch(o){d(o);}}),p.command("deactivate").description("Deactivate an app").argument("<id>").action(async t=>{try{await l(le,{id:t}),I("App deactivated");}catch(e){d(e);}});let u=n.command("sso").description("SSO (SAML/OIDC) configuration");u.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async t=>{try{let e=await l(Ie,{tenantId:t.tenant});m(t,e.getSSOConfig);}catch(e){d(e);}}),u.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,ssoUrl:t.ssoUrl,sloUrl:t.sloUrl,certificate:t.certificate,enabled:!!t.enabled},o=await l(ge,{tenantId:t.tenant,input:e});I("SSO config saved"),m(t,o.saveSSOConfig);}catch(e){d(e);}}),u.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async t=>{try{await l(me,{tenantId:t.tenant}),I("SSO config deleted");}catch(e){d(e);}});let $=n.command("users").description("User admin (requires admin permissions)");$.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.email&&(e.email=t.email),t.username&&(e.username=t.username),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.search&&(e.search=t.search);let o=await l($e,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});m(t,o.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:o.users.users.map(g=>[q(g.id,12),g.email,g.username??"-",g.role??"-",J(g.status),h(g.createdAt)])});}catch(e){d(e);}}),$.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(Se,{id:t});if(!o.user)throw new S(`User ${t} not found`);m(e,o.user);}catch(o){d(o);}}),$.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.firstName&&(o.firstName=e.firstName),e.lastName&&(o.lastName=e.lastName),e.username&&(o.username=e.username),e.phone&&(o.phoneNumber=e.phone),e.role&&(o.role=e.role.toUpperCase()),e.status&&(o.status=e.status.toUpperCase()),e.emailVerified!==void 0&&(o.emailVerified=e.emailVerified==="true"),!Object.keys(o).length)throw new S("No updates specified");let g=await l(Ee,{id:t,input:o});I("User updated"),m(e,g.updateUser);}catch(o){d(o);}});}var we={id:"auth",version:"1.0.0",displayName:"Authentication",register(n,s){yt(s),Wt(n);let i=n.commands.find(r=>r.name()==="auth");if(!i)throw new k("auth command group missing after registerAuthCommands");fe(i);}},Bs=we;module.exports=Bs;
@@ -1,4 +1,4 @@
1
- import {Lc,Mc}from'../../chunk-REBBLQFS.js';import {a,s,g,t,e,l,v,f,i,w,C,o,h,u,c,p,n,m,k,B}from'../../chunk-SQSFZFQZ.js';import {q,o as o$1,f as f$1,h as h$1,g as g$1,d,i as i$1,e as e$1}from'../../chunk-UAFYTYK6.js';async function j(s,p){if(s.length===0)throw new o$1("No workspaces to choose from");if(p.preferredId){let g=s.find(f=>f.id===p.preferredId);if(!g)throw new o$1(`Workspace ${p.preferredId} is not one of your workspaces`);return {workspace:g,prompted:false}}let[i]=s;if(s.length===1||!p.interactive)return {workspace:i,prompted:false};let o=await p.ask(`
1
+ import {Lc,Mc}from'../../chunk-AYNNSLCL.js';import {a,s,g,t,e,l,v,f,i,w,C,o,h,u,c,p,n,m,k,B}from'../../chunk-W4JZR7RJ.js';import {q,o as o$1,f as f$1,h as h$1,g as g$1,d,i as i$1,e as e$1}from'../../chunk-YIY5IDXQ.js';async function j(s,p){if(s.length===0)throw new o$1("No workspaces to choose from");if(p.preferredId){let g=s.find(f=>f.id===p.preferredId);if(!g)throw new o$1(`Workspace ${p.preferredId} is not one of your workspaces`);return {workspace:g,prompted:false}}let[i]=s;if(s.length===1||!p.interactive)return {workspace:i,prompted:false};let o=await p.ask(`
2
2
  Select workspace [1-${s.length}]: `),c=o===null?-1:parseInt(o.trim(),10)-1;return {workspace:(c>=0&&c<s.length?s[c]:void 0)??i,prompted:true}}async function J(s){let i=(await import('readline')).createInterface({input:process.stdin,output:process.stdout});return new Promise(o=>{let c=false;i.on("close",()=>{c||o(null);}),i.question(s,u=>{c=true,i.close(),o(u);});})}function Q(s$1){let p=s$1.command("auth").description("Authentication commands");p.command("login").description(`Authenticate with ${s().productName}`).option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace to bind the session to").action(async i=>{try{i.clientCredentials?await Pe(i.workspaceId):await Ce(i.workspaceId);}catch(o){g(o);}}),p.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(t()?.accessToken)try{await e(Lc);}catch{l("Server-side logout failed, clearing local tokens");}v(),f(),i("Logged out successfully");}catch(i){g(i);}}),p.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let o$1=t(),c=w(),u=!!o$1?.accessToken,g=o$1?.accessToken?C(o$1):false,f=o$1?.expiresAt?o(new Date(o$1.expiresAt).toISOString()):"-",h$1=o$1?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=o$1?.workspaceTokenExpiresAt?o(new Date(o$1.workspaceTokenExpiresAt).toISOString()):"-";h(i,{authenticated:u,method:h$1,expired:g,expiresAt:f,workspaceId:o$1?.workspaceId??"-",organizationId:o$1?.organizationId??"-",workspaceTokenExpiresAt:e,workspaceEndpoint:c.workspaceEndpoint,globalEndpoint:c.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(u)],["Method",h$1],["Expired",String(g)],["Expires At",f],["Workspace ID",o$1?.workspaceId??"-"],["Organization ID",o$1?.organizationId??"-"],["Workspace Token Expires",e],["Workspace Endpoint",c.workspaceEndpoint],["Global Endpoint",c.globalEndpoint]]});}),p.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let o=t();if(i.workspace){if(!o?.workspaceToken)throw new o$1(`No workspace token. Set a workspace: ${s().productName} workspace set <id>`);process.stdout.write(o.workspaceToken);return}if(!o?.accessToken)throw new o$1(`Not authenticated. Run: ${s().productName} auth login`);process.stdout.write(o.accessToken);}),p.command("refresh").description("Force token refresh").action(async()=>{try{let i$1=t();if(!i$1?.refreshToken&&i$1?.authMethod!=="client_credentials")throw new o$1(`No refresh token available. Run: ${s().productName} auth login`);if(i$1?.authMethod==="client_credentials"&&i$1.clientId&&i$1.clientSecret){let u$1=w(),g=await f$1(u$1.globalEndpoint,i$1.clientId,i$1.clientSecret);u({...i$1,accessToken:g.accessToken,expiresAt:Date.now()+g.expiresIn*1e3}),f(),i("App token refreshed successfully"),i$1.workspaceId&&i$1.organizationId&&await X();return}let c=(await e(Mc,{token:i$1.refreshToken})).refreshToken;u({...i$1,accessToken:c.accessToken,refreshToken:c.refreshToken,expiresAt:Date.now()+c.expiresIn*1e3}),f(),i("Token refreshed successfully"),i$1.workspaceId&&i$1.organizationId&&await X();}catch(i){g(i);}});}async function X(){let s=t();if(!s?.accessToken||!s.workspaceId||!s.organizationId)return;let p=w();try{let i$1=await g$1(p.workspaceEndpoint,s.accessToken,s.workspaceId,s.organizationId);u({...s,workspaceToken:i$1.token,workspaceTokenExpiresAt:new Date(i$1.expiresAt).getTime()}),f(),i("Workspace token refreshed");}catch{l("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Ce(s$1){let p=w(),{oidcIssuer:i$2,clientId:o}=B(),c={...p,oidcIssuer:i$2,clientId:o};k("Starting device code authentication...");let u$1=await d(c);console.log(""),console.log(` Open: ${u$1.verificationUri}`),console.log(` Code: ${u$1.userCode}`),console.log(""),await i$1(u$1.verificationUriComplete??u$1.verificationUri)?k("Browser opened"):l("Could not open browser \u2014 open the URL manually"),k("Waiting for authorization...");let f$1=await e$1(u$1.deviceCode,u$1.interval,c),h=f$1.accessToken,e=Date.now()+f$1.expiresIn*1e3;u({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),k("Fetching workspaces...");try{let t=await h$1(p.globalEndpoint,h);if(t.length===0){i("Authentication successful (no workspaces found)");return}let n=!!process.stdin.isTTY;t.length>1&&n&&!s$1&&(console.log(`
3
3
  Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.slug})`)));let{workspace:m}=await j(t,{preferredId:s$1,interactive:n,ask:J});t.length>1&&!n&&!s$1&&k(`${t.length} workspaces available; pass --workspace-id or run \`${s().productName} workspace set <id>\` to switch`),k(`Using workspace: ${m.name} (${m.id})`);let I=await g$1(p.workspaceEndpoint,h,m.id,m.organizationId);u({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,workspaceToken:I.token,workspaceTokenExpiresAt:new Date(I.expiresAt).getTime(),workspaceId:m.id,organizationId:m.organizationId,authMethod:"device_code"}),f(),i("Authentication successful");}catch(t){u({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),i("Authentication successful"),l(`Workspace token not obtained: ${t instanceof Error?t.message:String(t)}`),k(`Set workspace manually: ${s().productName} workspace set <id>`);}}async function Pe(s){let p=w(),o=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(I=>{o.question("Client ID: ",A=>I(A.trim()));}),u$1=await new Promise(I=>{o.question("Client Secret: ",A=>{o.close(),I(A.trim());});});if(!c||!u$1)throw new o$1("Client ID and secret cannot be empty");k("Authenticating app...");let g=await f$1(p.globalEndpoint,c,u$1),f$2=g.accessToken,h=Date.now()+g.expiresIn*1e3,e,t,n=s,m;if(n)try{let A=(await h$1(p.globalEndpoint,f$2)).find(C=>C.id===n);if(A){m=A.organizationId;let C=await g$1(p.workspaceEndpoint,f$2,n,m);e=C.token,t=new Date(C.expiresAt).getTime(),k(`Workspace token issued for: ${A.name}`);}else l(`Workspace ${n} not found \u2014 skipping workspace token`),n=void 0;}catch(I){l(`Workspace token failed: ${I instanceof Error?I.message:String(I)}`);}u({accessToken:f$2,refreshToken:"",expiresAt:h,workspaceToken:e,workspaceTokenExpiresAt:t,workspaceId:n,organizationId:m,authMethod:"client_credentials",clientId:c,clientSecret:u$1}),f(),i("App authentication successful");}var Z=`
4
4
  query currentUser {
@@ -1,4 +1,4 @@
1
- 'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var d=class extends Error{exitCode;hint;constructor(i,p){super(i),this.name="CliUserError",this.exitCode=p?.exitCode??1,this.hint=p?.hint;}};var l=class extends Error{cause;constructor(i,p){super(i),this.name="CliInternalError",this.cause=p;}};var b=null;function P(o){b=o;}function g(){if(!b)throw new l("vibecontrols module helpers used before setHelpersContext was called");return b}async function s(o,i){return g().gql.global.request(o,i)}function a(o){let i=o instanceof Error?o.message:String(o);throw new d(i)}function c(o,i,p){g().output.formatAndOutput(o,i,p);}function f(o){g().output.printSuccess(o);}function O(o){g().output.printInfo(o);}function I(o){return g().output.formatStatus(o)}function x(o){return g().output.formatDate(o)}function m(o,i){return g().output.truncate(o,i)}var k=`
1
+ 'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var d=class extends Error{exitCode;hint;constructor(i,l){super(i),this.name="CliUserError",this.exitCode=l?.exitCode??1,this.hint=l?.hint;}};var g=class extends Error{cause;constructor(i,l){super(i),this.name="CliInternalError",this.cause=l;}};var C=null;function P(r){C=r;}function f(){if(!C)throw new g("vibecontrols module helpers used before setHelpersContext was called");return C}async function s(r,i){return f().gql.global.request(r,i)}function a(r){let i=r instanceof Error?r.message:String(r);throw new d(i)}function c(r,i,l){f().output.formatAndOutput(r,i,l);}function m(r){f().output.printSuccess(r);}function O(r){f().output.printInfo(r);}function I(r){return f().output.formatStatus(r)}function x(r){return f().output.formatDate(r)}function w(r,i){return f().output.truncate(r,i)}var A=`
2
2
  query GetDefaultBillingAccount {
3
3
  getDefaultBillingAccount {
4
4
  id creditAmount currency
@@ -12,18 +12,18 @@
12
12
  }
13
13
  }
14
14
  `,R=`
15
- query GetSubscription($id: ID!) {
16
- getSubscription(id: $id) {
15
+ query GetSubscription($id: ID!, $billingAccountId: ID!) {
16
+ getSubscription(id: $id, billingAccountId: $billingAccountId) {
17
17
  id status startDate endDate seatCount billingAccountId
18
18
  }
19
19
  }
20
- `,_=`
20
+ `,$=`
21
21
  mutation UpdateSubscriptionSeats($input: UpdateSubscriptionSeatsInput!) {
22
22
  updateSubscriptionSeats(input: $input) {
23
23
  id seatCount lastSeatChangeAt
24
24
  }
25
25
  }
26
- `,$=`
26
+ `,_=`
27
27
  mutation CancelSubscription($input: CancelSubscriptionInput!) {
28
28
  cancelSubscription(input: $input) {
29
29
  id status canceledAt cancellationReason
@@ -54,11 +54,11 @@
54
54
  totalCount hasMore
55
55
  }
56
56
  }
57
- `,A=`
58
- query GetInvoice($id: ID!) {
59
- getInvoice(id: $id) {
60
- id invoiceNumber status subtotal tax total
61
- items { description amount }
57
+ `,k=`
58
+ query GetInvoice($id: ID!, $billingAccountId: ID!) {
59
+ getInvoice(id: $id, billingAccountId: $billingAccountId) {
60
+ id invoiceNumber status currency subtotal tax total amountPaid pdfUrl
61
+ items { description quantity unitPrice amount }
62
62
  }
63
63
  }
64
64
  `,M=`
@@ -73,11 +73,11 @@
73
73
  id type isDefault isVerified
74
74
  }
75
75
  }
76
- `,F=`
77
- mutation DeletePaymentMethod($id: ID!) {
78
- deletePaymentMethod(id: $id) { success }
79
- }
80
76
  `,B=`
77
+ mutation DeletePaymentMethod($id: ID!, $billingAccountId: ID!) {
78
+ deletePaymentMethod(id: $id, billingAccountId: $billingAccountId)
79
+ }
80
+ `,F=`
81
81
  mutation GrantCredits($input: GrantCreditsInput!) {
82
82
  grantCredits(input: $input) {
83
83
  id amount status type
@@ -86,7 +86,7 @@
86
86
  `,W=`
87
87
  mutation RequestCreditWithdrawal($input: RequestCreditWithdrawalInput!) {
88
88
  requestCreditWithdrawal(input: $input) {
89
- id status amount
89
+ id status requestedAmount currency
90
90
  }
91
91
  }
92
92
  `,j=`
@@ -97,9 +97,9 @@
97
97
  }
98
98
  }
99
99
  `,V=`
100
- query GetQuotas($subscriptionId: ID!) {
101
- getAllQuotasOfSub(subscriptionId: $subscriptionId) {
100
+ query GetQuotas($subscriptionId: ID!, $billingAccountId: ID!) {
101
+ getAllQuotasOfSub(subscriptionId: $subscriptionId, billingAccountId: $billingAccountId) {
102
102
  id name limits currentUsageSum reusable
103
103
  }
104
104
  }
105
- `;async function w(){let o=await s(k);if(!o.getDefaultBillingAccount?.id)throw new d("No default billing account on file. Pass --account <id> explicitly.");return o.getDefaultBillingAccount.id}function z(o){let i=o.command("billing").description("Billing: subscriptions, invoices, credits"),p=i.command("subscriptions").description("Subscriptions");p.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let e=t.account??await w(),n=await s(D,{billingAccountId:e});c(t,n.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:n.getActiveSubscriptions.map(r=>[m(r.id,12),I(r.status),r.plan?.name??"-",String(r.seatCount??"-"),x(r.nextBillingDate)])});}catch(e){a(e);}}),p.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(R,{id:t});if(!n.getSubscription)throw new d(`Subscription ${t} not found`);c(e,n.getSubscription);}catch(n){a(n);}}),p.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let n={subscriptionId:t,seatCount:e.seats},r=await s(_,{input:n});f(`Seat count updated to ${r.updateSubscriptionSeats.seatCount}`),c(e,r.updateSubscriptionSeats);}catch(n){a(n);}}),p.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,e)=>{try{let n={subscriptionId:t,reason:e.reason},r=await s($,{input:n});f("Subscription canceled"),c({},r.cancelSubscription);}catch(n){a(n);}});let T=i.command("plans").description("Plans");T.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let e={};t.product&&(e.productId=t.product);let n=await s(L,{filter:Object.keys(e).length?e:void 0});c(t,n.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:n.getAllPlans.map(r=>[m(r.id,12),r.name,String(r.price??"-"),r.currency??"-",r.duration??"-"])});}catch(e){a(e);}}),T.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(N,{id:t});if(!n.getPlan)throw new d(`Plan ${t} not found`);c(e,n.getPlan);}catch(n){a(n);}}),i.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.product&&(e.productId=t.product);let n=await s(q,{filter:Object.keys(e).length?e:void 0,limit:t.limit});c(t,n.getAllAddOns);}catch(e){a(e);}});let h=i.command("invoices").description("Invoices");h.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=t.account??await w(),n=await s(G,{billingAccountId:e,page:t.page,pageSize:t.pageSize});c(t,n.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:n.getPaginatedInvoices.invoices.map(r=>[m(r.id,12),r.invoiceNumber??"-",I(r.status),String(r.total??"-"),r.currency??"-",x(r.paidAt)])});}catch(e){a(e);}}),h.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(A,{id:t});if(!n.getInvoice)throw new d(`Invoice ${t} not found`);c(e,n.getInvoice);}catch(n){a(n);}}),h.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let e=await s(A,{id:t});if(!e.getInvoice?.pdfUrl)throw new d(`Invoice ${t} has no pdfUrl`);O("PDF URL:"),console.log(e.getInvoice.pdfUrl);}catch(e){a(e);}});let y=i.command("payment-methods").description("Payment methods");y.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let e=t.account??await w(),n=await s(M,{billingAccountId:e});c(t,n.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:n.getPaymentMethods.map(r=>[m(r.id,12),r.type,r.brand??"-",r.last4??"-",String(!!r.isDefault),String(!!r.isVerified)])});}catch(e){a(e);}}),y.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let n={billingAccountId:t.account??await w(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},r=await s(U,{input:n});f("Payment method added"),c(t,r.addPaymentMethod);}catch(e){a(e);}}),y.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await s(F,{id:t}),f("Payment method removed");}catch(e){a(e);}});let C=i.command("credits").description("Credits & withdrawal");C.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let e=await s(k);c(t,e.getDefaultBillingAccount);}catch(e){a(e);}}),C.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let e={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await s(B,{input:e}),f("Credits granted");}catch(e){a(e);}}),C.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let e={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await s(W,{input:e}),f("Withdrawal requested");}catch(e){a(e);}}),i.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=await s(j,{page:t.page,pageSize:t.pageSize});c(t,e.getPendingRefunds.records);}catch(e){a(e);}}),i.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(V,{subscriptionId:t});c(e,n.getAllQuotasOfSub);}catch(n){a(n);}});}var it={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(o,i){P(i),z(o);}},we=it;module.exports=we;
105
+ `;async function p(){let r=await s(A);if(!r.getDefaultBillingAccount?.id)throw new d("No default billing account on file. Pass --account <id> explicitly.");return r.getDefaultBillingAccount.id}function z(r){let i=r.command("billing").description("Billing: subscriptions, invoices, credits"),l=i.command("subscriptions").description("Subscriptions");l.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let e=t.account??await p(),n=await s(D,{billingAccountId:e});c(t,n.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:n.getActiveSubscriptions.map(o=>[w(o.id,12),I(o.status),o.plan?.name??"-",String(o.seatCount??"-"),x(o.nextBillingDate)])});}catch(e){a(e);}}),l.command("get").description("Get a subscription").argument("<id>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,e)=>{try{let n=e.account??await p(),o=await s(R,{id:t,billingAccountId:n});if(!o.getSubscription)throw new d(`Subscription ${t} not found`);c(e,o.getSubscription);}catch(n){a(n);}}),l.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,e)=>{try{let n={subscriptionId:t,seatCount:e.seats},o=await s($,{input:n});m(`Seat count updated to ${o.updateSubscriptionSeats.seatCount}`),c(e,o.updateSubscriptionSeats);}catch(n){a(n);}}),l.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,e)=>{try{let n={subscriptionId:t,reason:e.reason},o=await s(_,{input:n});m("Subscription canceled"),c({},o.cancelSubscription);}catch(n){a(n);}});let T=i.command("plans").description("Plans");T.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let e={};t.product&&(e.productId=t.product);let n=await s(L,{filter:Object.keys(e).length?e:void 0});c(t,n.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:n.getAllPlans.map(o=>[w(o.id,12),o.name,String(o.price??"-"),o.currency??"-",o.duration??"-"])});}catch(e){a(e);}}),T.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(N,{id:t});if(!n.getPlan)throw new d(`Plan ${t} not found`);c(e,n.getPlan);}catch(n){a(n);}}),i.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.product&&(e.productId=t.product);let n=await s(q,{filter:Object.keys(e).length?e:void 0,limit:t.limit});c(t,n.getAllAddOns);}catch(e){a(e);}});let y=i.command("invoices").description("Invoices");y.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=t.account??await p(),n=await s(G,{billingAccountId:e,page:t.page,pageSize:t.pageSize});c(t,n.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:n.getPaginatedInvoices.invoices.map(o=>[w(o.id,12),o.invoiceNumber??"-",I(o.status),String(o.total??"-"),o.currency??"-",x(o.paidAt)])});}catch(e){a(e);}}),y.command("get").description("Get an invoice").argument("<id>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,e)=>{try{let n=e.account??await p(),o=await s(k,{id:t,billingAccountId:n});if(!o.getInvoice)throw new d(`Invoice ${t} not found`);c(e,o.getInvoice);}catch(n){a(n);}}),y.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").option("--account <id>","Billing account id (default: your default account)").action(async(t,e)=>{try{let n=e.account??await p(),o=await s(k,{id:t,billingAccountId:n});if(!o.getInvoice?.pdfUrl)throw new d(`Invoice ${t} has no pdfUrl`);O("PDF URL:"),console.log(o.getInvoice.pdfUrl);}catch(n){a(n);}});let h=i.command("payment-methods").description("Payment methods");h.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let e=t.account??await p(),n=await s(M,{billingAccountId:e});c(t,n.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:n.getPaymentMethods.map(o=>[w(o.id,12),o.type,o.brand??"-",o.last4??"-",String(!!o.isDefault),String(!!o.isVerified)])});}catch(e){a(e);}}),h.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let n={billingAccountId:t.account??await p(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},o=await s(U,{input:n});m("Payment method added"),c(t,o.addPaymentMethod);}catch(e){a(e);}}),h.command("remove").description("Remove a payment method").argument("<id>").option("--account <id>","Billing account id (default: your default account)").action(async(t,e)=>{try{let n=e.account??await p();await s(B,{id:t,billingAccountId:n}),m("Payment method removed");}catch(n){a(n);}});let b=i.command("credits").description("Credits & withdrawal");b.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let e=await s(A);c(t,e.getDefaultBillingAccount);}catch(e){a(e);}}),b.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let e={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await s(F,{input:e}),m("Credits granted");}catch(e){a(e);}}),b.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let e={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await s(W,{input:e}),m("Withdrawal requested");}catch(e){a(e);}}),i.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=await s(j,{page:t.page,pageSize:t.pageSize});c(t,e.getPendingRefunds.records);}catch(e){a(e);}}),i.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,e)=>{try{let n=e.account??await p(),o=await s(V,{subscriptionId:t,billingAccountId:n});c(e,o.getAllQuotasOfSub);}catch(n){a(n);}});}var it={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(r,i){P(i),z(r);}},we=it;module.exports=we;
@@ -1,10 +1,10 @@
1
- import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}from'../../chunk-UAFYTYK6.js';var A=`
1
+ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-W4JZR7RJ.js';import {o as o$1}from'../../chunk-YIY5IDXQ.js';var y=`
2
2
  query GetDefaultBillingAccount {
3
3
  getDefaultBillingAccount {
4
4
  id creditAmount currency
5
5
  }
6
6
  }
7
- `,D=`
7
+ `,E=`
8
8
  query GetActiveSubscriptions($billingAccountId: ID!) {
9
9
  getActiveSubscriptions(billingAccountId: $billingAccountId) {
10
10
  id status seatCount nextBillingDate
@@ -12,8 +12,8 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
12
12
  }
13
13
  }
14
14
  `,h=`
15
- query GetSubscription($id: ID!) {
16
- getSubscription(id: $id) {
15
+ query GetSubscription($id: ID!, $billingAccountId: ID!) {
16
+ getSubscription(id: $id, billingAccountId: $billingAccountId) {
17
17
  id status startDate endDate seatCount billingAccountId
18
18
  }
19
19
  }
@@ -29,25 +29,25 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
29
29
  id status canceledAt cancellationReason
30
30
  }
31
31
  }
32
- `,N=`
32
+ `,$=`
33
33
  query GetAllPlans($filter: PlansFilter) {
34
34
  getAllPlans(filter: $filter) {
35
35
  id name price currency duration pricingModel
36
36
  }
37
37
  }
38
- `,v=`
38
+ `,N=`
39
39
  query GetPlan($id: ID!) {
40
40
  getPlan(id: $id) {
41
41
  id name price pricePerSeat minSeats maxSeats isActive
42
42
  }
43
43
  }
44
- `,G=`
44
+ `,v=`
45
45
  query GetAllAddOns($filter: AddonsFilter, $limit: Int) {
46
46
  getAllAddOns(filter: $filter, limit: $limit) {
47
47
  id name price currency duration isActive
48
48
  }
49
49
  }
50
- `,O=`
50
+ `,G=`
51
51
  query GetPaginatedInvoices($billingAccountId: ID!, $page: Int, $pageSize: Int) {
52
52
  getPaginatedInvoices(billingAccountId: $billingAccountId, page: $page, pageSize: $pageSize) {
53
53
  invoices { id invoiceNumber status total currency paidAt pdfUrl }
@@ -55,13 +55,13 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
55
55
  }
56
56
  }
57
57
  `,S=`
58
- query GetInvoice($id: ID!) {
59
- getInvoice(id: $id) {
60
- id invoiceNumber status subtotal tax total
61
- items { description amount }
58
+ query GetInvoice($id: ID!, $billingAccountId: ID!) {
59
+ getInvoice(id: $id, billingAccountId: $billingAccountId) {
60
+ id invoiceNumber status currency subtotal tax total amountPaid pdfUrl
61
+ items { description quantity unitPrice amount }
62
62
  }
63
63
  }
64
- `,$=`
64
+ `,O=`
65
65
  query GetPaymentMethods($billingAccountId: ID!) {
66
66
  getPaymentMethods(billingAccountId: $billingAccountId) {
67
67
  id type last4 expiryYear brand isDefault isVerified
@@ -73,11 +73,11 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
73
73
  id type isDefault isVerified
74
74
  }
75
75
  }
76
- `,M=`
77
- mutation DeletePaymentMethod($id: ID!) {
78
- deletePaymentMethod(id: $id) { success }
76
+ `,B=`
77
+ mutation DeletePaymentMethod($id: ID!, $billingAccountId: ID!) {
78
+ deletePaymentMethod(id: $id, billingAccountId: $billingAccountId)
79
79
  }
80
- `,L=`
80
+ `,M=`
81
81
  mutation GrantCredits($input: GrantCreditsInput!) {
82
82
  grantCredits(input: $input) {
83
83
  id amount status type
@@ -86,10 +86,10 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
86
86
  `,U=`
87
87
  mutation RequestCreditWithdrawal($input: RequestCreditWithdrawalInput!) {
88
88
  requestCreditWithdrawal(input: $input) {
89
- id status amount
89
+ id status requestedAmount currency
90
90
  }
91
91
  }
92
- `,B=`
92
+ `,L=`
93
93
  query GetPendingRefunds($page: Int, $pageSize: Int) {
94
94
  getPendingRefunds(page: $page, pageSize: $pageSize) {
95
95
  records { id amount status source createdAt }
@@ -97,9 +97,9 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-SQSFZFQZ.js';import {o as o$1}
97
97
  }
98
98
  }
99
99
  `,q=`
100
- query GetQuotas($subscriptionId: ID!) {
101
- getAllQuotasOfSub(subscriptionId: $subscriptionId) {
100
+ query GetQuotas($subscriptionId: ID!, $billingAccountId: ID!) {
101
+ getAllQuotasOfSub(subscriptionId: $subscriptionId, billingAccountId: $billingAccountId) {
102
102
  id name limits currentUsageSum reusable
103
103
  }
104
104
  }
105
- `;async function m(){let d=await c(A);if(!d.getDefaultBillingAccount?.id)throw new o$1("No default billing account on file. Pass --account <id> explicitly.");return d.getDefaultBillingAccount.id}function z(d){let s=d.command("billing").description("Billing: subscriptions, invoices, credits"),l=s.command("subscriptions").description("Subscriptions");l.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(D,{billingAccountId:n$1});h$1(t,i.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i.getActiveSubscriptions.map(e=>[p(e.id,12),n(e.status),e.plan?.name??"-",String(e.seatCount??"-"),o(e.nextBillingDate)])});}catch(n){g(n);}}),l.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(h,{id:t});if(!i.getSubscription)throw new o$1(`Subscription ${t} not found`);h$1(n,i.getSubscription);}catch(i){g(i);}}),l.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,n)=>{try{let i$1={subscriptionId:t,seatCount:n.seats},e=await c(_,{input:i$1});i(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),h$1(n,e.updateSubscriptionSeats);}catch(i){g(i);}}),l.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,n)=>{try{let i$1={subscriptionId:t,reason:n.reason},e=await c(R,{input:i$1});i("Subscription canceled"),h$1({},e.cancelSubscription);}catch(i){g(i);}});let P=s.command("plans").description("Plans");P.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(N,{filter:Object.keys(n).length?n:void 0});h$1(t,i.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i.getAllPlans.map(e=>[p(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){g(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(v,{id:t});if(!i.getPlan)throw new o$1(`Plan ${t} not found`);h$1(n,i.getPlan);}catch(i){g(i);}}),s.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(G,{filter:Object.keys(n).length?n:void 0,limit:t.limit});h$1(t,i.getAllAddOns);}catch(n){g(n);}});let g$1=s.command("invoices").description("Invoices");g$1.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(O,{billingAccountId:n$1,page:t.page,pageSize:t.pageSize});h$1(t,i.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i.getPaginatedInvoices.invoices.map(e=>[p(e.id,12),e.invoiceNumber??"-",n(e.status),String(e.total??"-"),e.currency??"-",o(e.paidAt)])});}catch(n){g(n);}}),g$1.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(S,{id:t});if(!i.getInvoice)throw new o$1(`Invoice ${t} not found`);h$1(n,i.getInvoice);}catch(i){g(i);}}),g$1.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let n=await c(S,{id:t});if(!n.getInvoice?.pdfUrl)throw new o$1(`Invoice ${t} has no pdfUrl`);k("PDF URL:"),console.log(n.getInvoice.pdfUrl);}catch(n){g(n);}});let f=s.command("payment-methods").description("Payment methods");f.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let n=t.account??await m(),i=await c($,{billingAccountId:n});h$1(t,i.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i.getPaymentMethods.map(e=>[p(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){g(n);}}),f.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let i$1={billingAccountId:t.account??await m(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},e=await c(x,{input:i$1});i("Payment method added"),h$1(t,e.addPaymentMethod);}catch(n){g(n);}}),f.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await c(M,{id:t}),i("Payment method removed");}catch(n){g(n);}});let I=s.command("credits").description("Credits & withdrawal");I.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let n=await c(A);h$1(t,n.getDefaultBillingAccount);}catch(n){g(n);}}),I.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let n={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await c(L,{input:n}),i("Credits granted");}catch(n){g(n);}}),I.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let n={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await c(U,{input:n}),i("Withdrawal requested");}catch(n){g(n);}}),s.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n=await c(B,{page:t.page,pageSize:t.pageSize});h$1(t,n.getPendingRefunds.records);}catch(n){g(n);}}),s.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(q,{subscriptionId:t});h$1(n,i.getAllQuotasOfSub);}catch(i){g(i);}});}var V={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(d,s){a(s),z(d);}},J=V;export{J as default};
105
+ `;async function s(){let u=await c(y);if(!u.getDefaultBillingAccount?.id)throw new o$1("No default billing account on file. Pass --account <id> explicitly.");return u.getDefaultBillingAccount.id}function z(u){let r=u.command("billing").description("Billing: subscriptions, invoices, credits"),g$1=r.command("subscriptions").description("Subscriptions");g$1.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await s(),i=await c(E,{billingAccountId:n$1});h$1(t,i.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i.getActiveSubscriptions.map(e=>[p(e.id,12),n(e.status),e.plan?.name??"-",String(e.seatCount??"-"),o(e.nextBillingDate)])});}catch(n){g(n);}}),g$1.command("get").description("Get a subscription").argument("<id>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,n)=>{try{let i=n.account??await s(),e=await c(h,{id:t,billingAccountId:i});if(!e.getSubscription)throw new o$1(`Subscription ${t} not found`);h$1(n,e.getSubscription);}catch(i){g(i);}}),g$1.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,n)=>{try{let i$1={subscriptionId:t,seatCount:n.seats},e=await c(_,{input:i$1});i(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),h$1(n,e.updateSubscriptionSeats);}catch(i){g(i);}}),g$1.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,n)=>{try{let i$1={subscriptionId:t,reason:n.reason},e=await c(R,{input:i$1});i("Subscription canceled"),h$1({},e.cancelSubscription);}catch(i){g(i);}});let P=r.command("plans").description("Plans");P.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c($,{filter:Object.keys(n).length?n:void 0});h$1(t,i.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i.getAllPlans.map(e=>[p(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){g(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(N,{id:t});if(!i.getPlan)throw new o$1(`Plan ${t} not found`);h$1(n,i.getPlan);}catch(i){g(i);}}),r.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(v,{filter:Object.keys(n).length?n:void 0,limit:t.limit});h$1(t,i.getAllAddOns);}catch(n){g(n);}});let m=r.command("invoices").description("Invoices");m.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await s(),i=await c(G,{billingAccountId:n$1,page:t.page,pageSize:t.pageSize});h$1(t,i.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i.getPaginatedInvoices.invoices.map(e=>[p(e.id,12),e.invoiceNumber??"-",n(e.status),String(e.total??"-"),e.currency??"-",o(e.paidAt)])});}catch(n){g(n);}}),m.command("get").description("Get an invoice").argument("<id>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,n)=>{try{let i=n.account??await s(),e=await c(S,{id:t,billingAccountId:i});if(!e.getInvoice)throw new o$1(`Invoice ${t} not found`);h$1(n,e.getInvoice);}catch(i){g(i);}}),m.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").option("--account <id>","Billing account id (default: your default account)").action(async(t,n)=>{try{let i=n.account??await s(),e=await c(S,{id:t,billingAccountId:i});if(!e.getInvoice?.pdfUrl)throw new o$1(`Invoice ${t} has no pdfUrl`);k("PDF URL:"),console.log(e.getInvoice.pdfUrl);}catch(i){g(i);}});let I=r.command("payment-methods").description("Payment methods");I.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let n=t.account??await s(),i=await c(O,{billingAccountId:n});h$1(t,i.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i.getPaymentMethods.map(e=>[p(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){g(n);}}),I.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let i$1={billingAccountId:t.account??await s(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},e=await c(x,{input:i$1});i("Payment method added"),h$1(t,e.addPaymentMethod);}catch(n){g(n);}}),I.command("remove").description("Remove a payment method").argument("<id>").option("--account <id>","Billing account id (default: your default account)").action(async(t,n)=>{try{let i$1=n.account??await s();await c(B,{id:t,billingAccountId:i$1}),i("Payment method removed");}catch(i){g(i);}});let f=r.command("credits").description("Credits & withdrawal");f.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let n=await c(y);h$1(t,n.getDefaultBillingAccount);}catch(n){g(n);}}),f.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let n={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await c(M,{input:n}),i("Credits granted");}catch(n){g(n);}}),f.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let n={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await c(U,{input:n}),i("Withdrawal requested");}catch(n){g(n);}}),r.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n=await c(L,{page:t.page,pageSize:t.pageSize});h$1(t,n.getPendingRefunds.records);}catch(n){g(n);}}),r.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("--account <id>","Billing account id (default: your default account)").option("-f, --format <format>").action(async(t,n)=>{try{let i=n.account??await s(),e=await c(q,{subscriptionId:t,billingAccountId:i});h$1(n,e.getAllQuotasOfSub);}catch(i){g(i);}});}var V={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(u,r){a(r),z(u);}},J=V;export{J as default};
@@ -1,4 +1,4 @@
1
- import {a,b,h as h$1,p as p$1,g,i,d as d$1}from'../../chunk-SQSFZFQZ.js';import {o}from'../../chunk-UAFYTYK6.js';var C=`
1
+ import {a,b,h as h$1,p as p$1,g,i,d as d$1}from'../../chunk-W4JZR7RJ.js';import {o}from'../../chunk-YIY5IDXQ.js';var C=`
2
2
  query BrainyrichGetHousehold($id: ID!) {
3
3
  braHousehold(id: $id) {
4
4
  id name advisorId aum currency riskProfile status notes