@burdenoff/cli-sdk 2026.1124.1 → 2026.1202.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 (242) hide show
  1. package/dist/chunk-BGNPGKJM.js +1 -0
  2. package/dist/{chunk-ASSY2L5R.js → chunk-E6F56R4K.js} +3 -3
  3. package/dist/chunk-N7EXKGE2.js +34 -0
  4. package/dist/core/index.cjs +9 -9
  5. package/dist/core/index.d.cts +2 -2
  6. package/dist/core/index.d.ts +2 -2
  7. package/dist/core/index.js +1 -1
  8. package/dist/index.cjs +9 -9
  9. package/dist/index.d.cts +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/{module-BNVKV_pI.d.ts → module-DWSAfs3k.d.cts} +20 -19
  13. package/dist/{module-BNVKV_pI.d.cts → module-DWSAfs3k.d.ts} +20 -19
  14. package/dist/modules/adaptercloud/index.cjs +38 -38
  15. package/dist/modules/adaptercloud/index.d.cts +1 -1
  16. package/dist/modules/adaptercloud/index.d.ts +1 -1
  17. package/dist/modules/adaptercloud/index.js +2 -2
  18. package/dist/modules/artistrybase/index.cjs +50 -50
  19. package/dist/modules/artistrybase/index.d.cts +1 -1
  20. package/dist/modules/artistrybase/index.d.ts +1 -1
  21. package/dist/modules/artistrybase/index.js +2 -2
  22. package/dist/modules/assethandler/index.cjs +32 -32
  23. package/dist/modules/assethandler/index.d.cts +1 -1
  24. package/dist/modules/assethandler/index.d.ts +1 -1
  25. package/dist/modules/assethandler/index.js +2 -2
  26. package/dist/modules/atheletebridge/index.cjs +34 -34
  27. package/dist/modules/atheletebridge/index.d.cts +1 -1
  28. package/dist/modules/atheletebridge/index.d.ts +1 -1
  29. package/dist/modules/atheletebridge/index.js +2 -2
  30. package/dist/modules/auth/index.cjs +34 -34
  31. package/dist/modules/auth/index.d.cts +1 -1
  32. package/dist/modules/auth/index.d.ts +1 -1
  33. package/dist/modules/auth/index.js +4 -4
  34. package/dist/modules/billing/index.cjs +18 -18
  35. package/dist/modules/billing/index.d.cts +1 -1
  36. package/dist/modules/billing/index.d.ts +1 -1
  37. package/dist/modules/billing/index.js +2 -2
  38. package/dist/modules/brainyrich/index.cjs +45 -45
  39. package/dist/modules/brainyrich/index.d.cts +1 -1
  40. package/dist/modules/brainyrich/index.d.ts +1 -1
  41. package/dist/modules/brainyrich/index.js +2 -2
  42. package/dist/modules/buildmyiq/index.cjs +32 -32
  43. package/dist/modules/buildmyiq/index.d.cts +1 -1
  44. package/dist/modules/buildmyiq/index.d.ts +1 -1
  45. package/dist/modules/buildmyiq/index.js +2 -2
  46. package/dist/modules/channels/index.cjs +12 -12
  47. package/dist/modules/channels/index.d.cts +1 -1
  48. package/dist/modules/channels/index.d.ts +1 -1
  49. package/dist/modules/channels/index.js +2 -2
  50. package/dist/modules/collabkin/index.cjs +34 -34
  51. package/dist/modules/collabkin/index.d.cts +1 -1
  52. package/dist/modules/collabkin/index.d.ts +1 -1
  53. package/dist/modules/collabkin/index.js +2 -2
  54. package/dist/modules/comradecircle/index.cjs +41 -41
  55. package/dist/modules/comradecircle/index.d.cts +1 -1
  56. package/dist/modules/comradecircle/index.d.ts +1 -1
  57. package/dist/modules/comradecircle/index.js +2 -2
  58. package/dist/modules/conversations/index.cjs +32 -32
  59. package/dist/modules/conversations/index.d.cts +1 -1
  60. package/dist/modules/conversations/index.d.ts +1 -1
  61. package/dist/modules/conversations/index.js +2 -2
  62. package/dist/modules/coolandlovely/index.cjs +41 -41
  63. package/dist/modules/coolandlovely/index.d.cts +1 -1
  64. package/dist/modules/coolandlovely/index.d.ts +1 -1
  65. package/dist/modules/coolandlovely/index.js +2 -2
  66. package/dist/modules/cosmicintersection/index.cjs +43 -43
  67. package/dist/modules/cosmicintersection/index.d.cts +1 -1
  68. package/dist/modules/cosmicintersection/index.d.ts +1 -1
  69. package/dist/modules/cosmicintersection/index.js +2 -2
  70. package/dist/modules/crewfoundry/index.cjs +70 -70
  71. package/dist/modules/crewfoundry/index.d.cts +1 -1
  72. package/dist/modules/crewfoundry/index.d.ts +1 -1
  73. package/dist/modules/crewfoundry/index.js +2 -2
  74. package/dist/modules/devportal/index.cjs +23 -23
  75. package/dist/modules/devportal/index.d.cts +1 -1
  76. package/dist/modules/devportal/index.d.ts +1 -1
  77. package/dist/modules/devportal/index.js +2 -2
  78. package/dist/modules/ecoimpacthub/index.cjs +41 -41
  79. package/dist/modules/ecoimpacthub/index.d.cts +1 -1
  80. package/dist/modules/ecoimpacthub/index.d.ts +1 -1
  81. package/dist/modules/ecoimpacthub/index.js +2 -2
  82. package/dist/modules/eventfullymanaged/index.cjs +92 -92
  83. package/dist/modules/eventfullymanaged/index.d.cts +1 -1
  84. package/dist/modules/eventfullymanaged/index.d.ts +1 -1
  85. package/dist/modules/eventfullymanaged/index.js +2 -2
  86. package/dist/modules/export/index.cjs +14 -14
  87. package/dist/modules/export/index.d.cts +1 -1
  88. package/dist/modules/export/index.d.ts +1 -1
  89. package/dist/modules/export/index.js +2 -2
  90. package/dist/modules/files/index.cjs +11 -11
  91. package/dist/modules/files/index.d.cts +1 -1
  92. package/dist/modules/files/index.d.ts +1 -1
  93. package/dist/modules/files/index.js +2 -2
  94. package/dist/modules/fluidgrids/index.cjs +29 -29
  95. package/dist/modules/fluidgrids/index.d.cts +1 -1
  96. package/dist/modules/fluidgrids/index.d.ts +1 -1
  97. package/dist/modules/fluidgrids/index.js +3 -3
  98. package/dist/modules/ggnomad/index.cjs +21 -21
  99. package/dist/modules/ggnomad/index.d.cts +1 -1
  100. package/dist/modules/ggnomad/index.d.ts +1 -1
  101. package/dist/modules/ggnomad/index.js +2 -2
  102. package/dist/modules/govcitizenhub/index.cjs +35 -35
  103. package/dist/modules/govcitizenhub/index.d.cts +1 -1
  104. package/dist/modules/govcitizenhub/index.d.ts +1 -1
  105. package/dist/modules/govcitizenhub/index.js +2 -2
  106. package/dist/modules/groups/index.cjs +12 -12
  107. package/dist/modules/groups/index.d.cts +1 -1
  108. package/dist/modules/groups/index.d.ts +1 -1
  109. package/dist/modules/groups/index.js +2 -2
  110. package/dist/modules/headshotmarketing/index.cjs +165 -165
  111. package/dist/modules/headshotmarketing/index.d.cts +1 -1
  112. package/dist/modules/headshotmarketing/index.d.ts +1 -1
  113. package/dist/modules/headshotmarketing/index.js +2 -2
  114. package/dist/modules/health/index.d.cts +1 -1
  115. package/dist/modules/health/index.d.ts +1 -1
  116. package/dist/modules/hookmovies/index.cjs +43 -43
  117. package/dist/modules/hookmovies/index.d.cts +1 -1
  118. package/dist/modules/hookmovies/index.d.ts +1 -1
  119. package/dist/modules/hookmovies/index.js +2 -2
  120. package/dist/modules/housingvista/index.cjs +24 -24
  121. package/dist/modules/housingvista/index.d.cts +1 -1
  122. package/dist/modules/housingvista/index.d.ts +1 -1
  123. package/dist/modules/housingvista/index.js +2 -2
  124. package/dist/modules/integrations/index.cjs +27 -27
  125. package/dist/modules/integrations/index.d.cts +1 -1
  126. package/dist/modules/integrations/index.d.ts +1 -1
  127. package/dist/modules/integrations/index.js +2 -2
  128. package/dist/modules/intelwatchtower/index.cjs +37 -37
  129. package/dist/modules/intelwatchtower/index.d.cts +1 -1
  130. package/dist/modules/intelwatchtower/index.d.ts +1 -1
  131. package/dist/modules/intelwatchtower/index.js +2 -2
  132. package/dist/modules/kadaikodi/index.cjs +26 -26
  133. package/dist/modules/kadaikodi/index.d.cts +1 -1
  134. package/dist/modules/kadaikodi/index.d.ts +1 -1
  135. package/dist/modules/kadaikodi/index.js +2 -2
  136. package/dist/modules/labsofscience/index.cjs +44 -44
  137. package/dist/modules/labsofscience/index.d.cts +1 -1
  138. package/dist/modules/labsofscience/index.d.ts +1 -1
  139. package/dist/modules/labsofscience/index.js +2 -2
  140. package/dist/modules/manufacturedops/index.cjs +36 -36
  141. package/dist/modules/manufacturedops/index.d.cts +1 -1
  142. package/dist/modules/manufacturedops/index.d.ts +1 -1
  143. package/dist/modules/manufacturedops/index.js +2 -2
  144. package/dist/modules/movethewheels/index.cjs +78 -78
  145. package/dist/modules/movethewheels/index.d.cts +1 -1
  146. package/dist/modules/movethewheels/index.d.ts +1 -1
  147. package/dist/modules/movethewheels/index.js +2 -2
  148. package/dist/modules/mybodyshield/index.cjs +36 -36
  149. package/dist/modules/mybodyshield/index.d.cts +1 -1
  150. package/dist/modules/mybodyshield/index.d.ts +1 -1
  151. package/dist/modules/mybodyshield/index.js +2 -2
  152. package/dist/modules/notifications/index.cjs +5 -5
  153. package/dist/modules/notifications/index.d.cts +1 -1
  154. package/dist/modules/notifications/index.d.ts +1 -1
  155. package/dist/modules/notifications/index.js +1 -1
  156. package/dist/modules/organizations/index.cjs +5 -5
  157. package/dist/modules/organizations/index.d.cts +1 -1
  158. package/dist/modules/organizations/index.d.ts +1 -1
  159. package/dist/modules/organizations/index.js +1 -1
  160. package/dist/modules/planmagnet/index.cjs +272 -272
  161. package/dist/modules/planmagnet/index.d.cts +1 -1
  162. package/dist/modules/planmagnet/index.d.ts +1 -1
  163. package/dist/modules/planmagnet/index.js +2 -2
  164. package/dist/modules/products/index.cjs +19 -19
  165. package/dist/modules/products/index.d.cts +1 -1
  166. package/dist/modules/products/index.d.ts +1 -1
  167. package/dist/modules/products/index.js +2 -2
  168. package/dist/modules/proserviceworld/index.cjs +24 -24
  169. package/dist/modules/proserviceworld/index.d.cts +1 -1
  170. package/dist/modules/proserviceworld/index.d.ts +1 -1
  171. package/dist/modules/proserviceworld/index.js +2 -2
  172. package/dist/modules/rbac/index.cjs +8 -8
  173. package/dist/modules/rbac/index.d.cts +1 -1
  174. package/dist/modules/rbac/index.d.ts +1 -1
  175. package/dist/modules/rbac/index.js +2 -2
  176. package/dist/modules/sandbox/index.cjs +39 -39
  177. package/dist/modules/sandbox/index.d.cts +1 -1
  178. package/dist/modules/sandbox/index.d.ts +1 -1
  179. package/dist/modules/sandbox/index.js +1 -1
  180. package/dist/modules/scheduler/index.cjs +25 -25
  181. package/dist/modules/scheduler/index.d.cts +1 -1
  182. package/dist/modules/scheduler/index.d.ts +1 -1
  183. package/dist/modules/scheduler/index.js +2 -2
  184. package/dist/modules/security/index.cjs +14 -14
  185. package/dist/modules/security/index.d.cts +1 -1
  186. package/dist/modules/security/index.d.ts +1 -1
  187. package/dist/modules/security/index.js +2 -2
  188. package/dist/modules/semanticfed/index.cjs +44 -44
  189. package/dist/modules/semanticfed/index.d.cts +1 -1
  190. package/dist/modules/semanticfed/index.d.ts +1 -1
  191. package/dist/modules/semanticfed/index.js +1 -1
  192. package/dist/modules/semanticfed-sql/index.cjs +4 -4
  193. package/dist/modules/semanticfed-sql/index.d.cts +1 -1
  194. package/dist/modules/semanticfed-sql/index.d.ts +1 -1
  195. package/dist/modules/semanticfed-sql/index.js +1 -1
  196. package/dist/modules/store/index.cjs +21 -21
  197. package/dist/modules/store/index.d.cts +1 -1
  198. package/dist/modules/store/index.d.ts +1 -1
  199. package/dist/modules/store/index.js +2 -2
  200. package/dist/modules/subscriberbot/index.cjs +41 -41
  201. package/dist/modules/subscriberbot/index.d.cts +1 -1
  202. package/dist/modules/subscriberbot/index.d.ts +1 -1
  203. package/dist/modules/subscriberbot/index.js +2 -2
  204. package/dist/modules/support/index.cjs +8 -8
  205. package/dist/modules/support/index.d.cts +1 -1
  206. package/dist/modules/support/index.d.ts +1 -1
  207. package/dist/modules/support/index.js +2 -2
  208. package/dist/modules/tags/index.cjs +10 -10
  209. package/dist/modules/tags/index.d.cts +1 -1
  210. package/dist/modules/tags/index.d.ts +1 -1
  211. package/dist/modules/tags/index.js +2 -2
  212. package/dist/modules/technospam/index.cjs +44 -44
  213. package/dist/modules/technospam/index.d.cts +1 -1
  214. package/dist/modules/technospam/index.d.ts +1 -1
  215. package/dist/modules/technospam/index.js +2 -2
  216. package/dist/modules/theculturepost/index.cjs +32 -32
  217. package/dist/modules/theculturepost/index.d.cts +1 -1
  218. package/dist/modules/theculturepost/index.d.ts +1 -1
  219. package/dist/modules/theculturepost/index.js +2 -2
  220. package/dist/modules/theglobalfuel/index.cjs +30 -30
  221. package/dist/modules/theglobalfuel/index.d.cts +1 -1
  222. package/dist/modules/theglobalfuel/index.d.ts +1 -1
  223. package/dist/modules/theglobalfuel/index.js +2 -2
  224. package/dist/modules/timecampus/index.cjs +69 -69
  225. package/dist/modules/timecampus/index.d.cts +1 -1
  226. package/dist/modules/timecampus/index.d.ts +1 -1
  227. package/dist/modules/timecampus/index.js +4 -4
  228. package/dist/modules/tours/index.cjs +4 -4
  229. package/dist/modules/tours/index.d.cts +1 -1
  230. package/dist/modules/tours/index.d.ts +1 -1
  231. package/dist/modules/tours/index.js +2 -2
  232. package/dist/modules/vibecontrols/index.cjs +460 -460
  233. package/dist/modules/vibecontrols/index.d.cts +1 -1
  234. package/dist/modules/vibecontrols/index.d.ts +1 -1
  235. package/dist/modules/vibecontrols/index.js +5 -5
  236. package/dist/modules/workspaces/index.cjs +16 -16
  237. package/dist/modules/workspaces/index.d.cts +1 -1
  238. package/dist/modules/workspaces/index.d.ts +1 -1
  239. package/dist/modules/workspaces/index.js +2 -2
  240. package/package.json +6 -1
  241. package/dist/chunk-3ZVMC2AF.js +0 -1
  242. package/dist/chunk-ZT6KOG7N.js +0 -34
@@ -1,4 +1,4 @@
1
- import {a,u,h,v,e,n,x,f,k,y,E,q,i,w,c,r,p,o,m,D}from'../../chunk-3ZVMC2AF.js';import {s,q as q$1,f as f$1,h as h$1,g,d,i as i$1,e as e$1}from'../../chunk-ZT6KOG7N.js';var B=`
1
+ import {a,u,h,v,e,n,x,f,k,y,E,q,i,w,c,r,p,o,m,D}from'../../chunk-BGNPGKJM.js';import {l,j as j$1,f as f$1,h as h$1,g,d,i as i$1,e as e$1}from'../../chunk-N7EXKGE2.js';var B=`
2
2
  query currentUser {
3
3
  currentUser {
4
4
  id email firstName lastName username phoneNumber name
@@ -181,6 +181,6 @@ import {a,u,h,v,e,n,x,f,k,y,E,q,i,w,c,r,p,o,m,D}from'../../chunk-3ZVMC2AF.js';im
181
181
  mutation RefreshToken($token: String!) {
182
182
  refreshToken(token: $token) { accessToken refreshToken expiresIn }
183
183
  }
184
- `;async function ye(s,p){if(s.length===0)throw new q$1("No workspaces to choose from");if(p.preferredId){let g=s.find(f=>f.id===p.preferredId);if(!g)throw new q$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(`
185
- 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 Ee(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 Te(s){let p=s.command("auth").description("Authentication commands");p.command("login").description(`Authenticate with ${u().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 Re(i.workspaceId):await Pe(i.workspaceId);}catch(o){h(o);}}),p.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(v()?.accessToken)try{await e(Ie);}catch{n("Server-side logout failed, clearing local tokens");}x(),f(),k("Logged out successfully");}catch(i){h(i);}}),p.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i$1=>{let o=v(),c=y(),u=!!o?.accessToken,g=o?.accessToken?E(o):false,f=o?.expiresAt?q(new Date(o.expiresAt).toISOString()):"-",h=o?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=o?.workspaceTokenExpiresAt?q(new Date(o.workspaceTokenExpiresAt).toISOString()):"-";i(i$1,{authenticated:u,method:h,expired:g,expiresAt:f,workspaceId:o?.workspaceId??"-",organizationId:o?.organizationId??"-",workspaceTokenExpiresAt:e,workspaceEndpoint:c.workspaceEndpoint,globalEndpoint:c.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(u)],["Method",h],["Expired",String(g)],["Expires At",f],["Workspace ID",o?.workspaceId??"-"],["Organization ID",o?.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=v();if(i.workspace){if(!o?.workspaceToken)throw new q$1(`No workspace token. Set a workspace: ${u().productName} workspace set <id>`);process.stdout.write(o.workspaceToken);return}if(!o?.accessToken)throw new q$1(`Not authenticated. Run: ${u().productName} auth login`);process.stdout.write(o.accessToken);}),p.command("refresh").description("Force token refresh").action(async()=>{try{let i=v();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new q$1(`No refresh token available. Run: ${u().productName} auth login`);if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let u=y(),g=await f$1(u.globalEndpoint,i.clientId,i.clientSecret);w({...i,accessToken:g.accessToken,expiresAt:Date.now()+g.expiresIn*1e3}),f(),k("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await Se();return}let c=(await e(we,{token:i.refreshToken})).refreshToken;w({...i,accessToken:c.accessToken,refreshToken:c.refreshToken,expiresAt:Date.now()+c.expiresIn*1e3}),f(),k("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await Se();}catch(i){h(i);}});}async function Se(){let s=v();if(!s?.accessToken||!s.workspaceId||!s.organizationId)return;let p=y();try{let i=await g(p.workspaceEndpoint,s.accessToken,s.workspaceId,s.organizationId);w({...s,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),f(),k("Workspace token refreshed");}catch{n("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Pe(s){let p=y(),{oidcIssuer:i,clientId:o}=D(),c={...p,oidcIssuer:i,clientId:o};m("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)?m("Browser opened"):n("Could not open browser \u2014 open the URL manually"),m("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;w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),m("Fetching workspaces...");try{let t=await h$1(p.globalEndpoint,h);if(t.length===0){k("Authentication successful (no workspaces found)");return}let n=!!process.stdin.isTTY;t.length>1&&n&&!s&&(console.log(`
186
- Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.slug})`)));let{workspace:m$1}=await ye(t,{preferredId:s,interactive:n,ask:Ee});t.length>1&&!n&&!s&&m(`${t.length} workspaces available; pass --workspace-id or run \`${u().productName} workspace set <id>\` to switch`),m(`Using workspace: ${m$1.name} (${m$1.id})`);let k$1=await g(p.workspaceEndpoint,h,m$1.id,m$1.organizationId);w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,workspaceToken:k$1.token,workspaceTokenExpiresAt:new Date(k$1.expiresAt).getTime(),workspaceId:m$1.id,organizationId:m$1.organizationId,authMethod:"device_code"}),f(),k("Authentication successful");}catch(t){w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),k("Authentication successful"),n(`Workspace token not obtained: ${t instanceof Error?t.message:String(t)}`),m(`Set workspace manually: ${u().productName} workspace set <id>`);}}async function Re(s){let p=y(),o=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(k=>{o.question("Client ID: ",A=>k(A.trim()));}),u=await new Promise(k=>{o.question("Client Secret: ",A=>{o.close(),k(A.trim());});});if(!c||!u)throw new q$1("Client ID and secret cannot be empty");m("Authenticating app...");let g$1=await f$1(p.globalEndpoint,c,u),f$2=g$1.accessToken,h=Date.now()+g$1.expiresIn*1e3,e,t,n$1=s,m$1;if(n$1)try{let A=(await h$1(p.globalEndpoint,f$2)).find(C=>C.id===n$1);if(A){m$1=A.organizationId;let C=await g(p.workspaceEndpoint,f$2,n$1,m$1);e=C.token,t=new Date(C.expiresAt).getTime(),m(`Workspace token issued for: ${A.name}`);}else n(`Workspace ${n$1} not found \u2014 skipping workspace token`),n$1=void 0;}catch(k){n(`Workspace token failed: ${k instanceof Error?k.message:String(k)}`);}w({accessToken:f$2,refreshToken:"",expiresAt:h,workspaceToken:e,workspaceTokenExpiresAt:t,workspaceId:n$1,organizationId:m$1,authMethod:"client_credentials",clientId:c,clientSecret:u}),f(),k("App authentication successful");}function Ue(s){let p$1=s.command("profile").description("Current user profile");p$1.command("show").description("Show current user").option("-f, --format <format>").action(async e=>{try{let t=await c(B);i(e,t.currentUser);}catch(t){h(t);}}),p$1.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 e=>{try{let t={};if(e.firstName&&(t.firstName=e.firstName),e.lastName&&(t.lastName=e.lastName),e.name&&(t.name=e.name),e.username&&(t.username=e.username),e.phone&&(t.phoneNumber=e.phone),e.timezone&&(t.timezone=e.timezone),e.language&&(t.language=e.language),!Object.keys(t).length)throw new q$1("No updates specified");let n=await c(H,{input:t});k("Profile updated"),i(e,n.updateCurrentUserProfile);}catch(t){h(t);}});let i$1=s.command("security").description("Account security overview");i$1.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(F,{pagination:{limit:e.limit,offset:0}});i(e,t.authAuditLogs.auditLogs,{headers:["When","Action","Resource","IP"],rows:t.authAuditLogs.auditLogs.map(n=>[q(n.createdAt),n.action,n.resource??"-",n.ipAddress??"-"])});}catch(t){h(t);}}),i$1.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(j,{pagination:{limit:e.limit,offset:0}});i(e,t.activeSessions.sessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:t.activeSessions.sessions.map(n=>[r(n.id,12),p(n.status),n.ipAddress??"-",q(n.lastActivityAt),String(!!n.isCurrent)])});}catch(t){h(t);}});let o$1=s.command("mfa").description("Multi-factor authentication");o$1.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(J,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserMFAMethods.methods,{headers:["Method","Status","Created"],rows:t.currentUserMFAMethods.methods.map(n=>[n.method,p(n.status),q(n.createdAt)])});}catch(t){h(t);}}),o$1.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async e=>{try{let t=await c(X,{method:e.method.toUpperCase()});e.format?i(e,t.setupMFA):(k("MFA enrollment started"),o(t.setupMFA),m("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){h(t);}}),o$1.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async e=>{try{await c(Q,{code:e.code}),k("MFA enabled");}catch(t){h(t);}}),o$1.command("disable").description("Disable MFA for the current user").action(async()=>{try{await c(Z),k("MFA disabled");}catch(e){h(e);}});let c$1=s.command("api-keys").description("API key management");c$1.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=e.app?te:ee,n=e.app?{appId:e.app,pagination:{limit:e.limit,offset:0}}:{pagination:{limit:e.limit,offset:0}},m=await c(t,n),k=(m.myApiKeys??m.appApiKeys)?.apiKeys??[];i(e,k,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:k.map(A=>[r(A.id,12),A.name??"-",A.prefix??"-",A.appName??"-",Array.isArray(A.scopes)?A.scopes.join(","):"-",q(A.lastUsedAt)])});}catch(t){h(t);}}),c$1.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 e=>{try{let t={name:e.name,appId:e.app,scope:e.scope?e.scope.split(","):void 0,expiresAt:e.expires},n=await c(ne,{input:t});k("API key generated. Store the secret \u2014 it is only shown once."),o(n.generateAPIKey);}catch(t){h(t);}}),c$1.command("revoke").description("Revoke an API key").argument("<keyId>").action(async e=>{try{await c(ie,{keyId:e}),k("API key revoked");}catch(t){h(t);}}),c$1.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async e=>{try{let t=await c(oe,{keyId:e});k("API key rotated"),o(t.rotateAPIKey);}catch(t){h(t);}}),s.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(F,{pagination:{limit:e.limit,offset:0}});i(e,t.authAuditLogs.auditLogs);}catch(t){h(t);}});let u=s.command("delegations").description("Delegation management");u.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(se,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserDelegations.delegations);}catch(t){h(t);}}),u.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 e=>{try{let t={appId:e.app,userId:e.user,scopes:e.scope?e.scope.split(","):void 0,workspaceIds:e.workspace?e.workspace.split(","):void 0,expiresAt:e.expires},n=await c(re,{input:t});k("Delegation granted"),i(e,n.grantDelegation);}catch(t){h(t);}}),u.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(e,t)=>{try{await c(ae,{id:e,reason:t.reason}),k("Delegation revoked");}catch(n){h(n);}});let g=s.command("apps").description("OAuth/system app management");g.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(pe,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserApps.apps,{headers:["ID","ClientID","Name","Type","Status"],rows:t.currentUserApps.apps.map(n=>[r(n.id,12),r(n.clientId,24),n.name??"-",n.type??"-",p(n.status)])});}catch(t){h(t);}}),g.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(ce,{id:e});if(!n.app)throw new q$1(`App ${e} not found`);i(t,n.app);}catch(n){h(n);}}),g.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 e=>{try{let t={name:e.name,description:e.description,type:(e.type??"OAUTH").toUpperCase(),actorType:(e.actorType??"APP").toUpperCase(),redirectUris:e.redirect?e.redirect.split(","):void 0,scopes:e.scopes?e.scopes.split(","):void 0},n=await c(de,{input:t});k("App created. Client secret only shown once."),o(n.createApp);}catch(t){h(t);}}),g.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(e,t)=>{try{let n={};if(t.name&&(n.name=t.name),t.description!==void 0&&(n.description=t.description),t.redirect&&(n.redirectUris=t.redirect.split(",")),t.scopes&&(n.scopes=t.scopes.split(",")),t.status&&(n.status=t.status.toUpperCase()),!Object.keys(n).length)throw new q$1("No updates specified");let m=await c(me,{id:e,input:n});k("App updated"),i(t,m.updateApp);}catch(n){h(n);}}),g.command("deactivate").description("Deactivate an app").argument("<id>").action(async e=>{try{await c(ue,{id:e}),k("App deactivated");}catch(t){h(t);}});let f=s.command("sso").description("SSO (SAML/OIDC) configuration");f.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async e=>{try{let t=await c(le,{tenantId:e.tenant});i(e,t.getSSOConfig);}catch(t){h(t);}}),f.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 e=>{try{let t={entityId:e.entity,ssoUrl:e.ssoUrl,sloUrl:e.sloUrl,certificate:e.certificate,enabled:!!e.enabled},n=await c(ge,{tenantId:e.tenant,input:t});k("SSO config saved"),i(e,n.saveSSOConfig);}catch(t){h(t);}}),f.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async e=>{try{await c(fe,{tenantId:e.tenant}),k("SSO config deleted");}catch(t){h(t);}});let h$1=s.command("users").description("User admin (requires admin permissions)");h$1.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",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.email&&(t.email=e.email),e.username&&(t.username=e.username),e.role&&(t.role=e.role.toUpperCase()),e.status&&(t.status=e.status.toUpperCase()),e.search&&(t.search=e.search);let n=await c(Ae,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});i(e,n.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:n.users.users.map(m=>[r(m.id,12),m.email,m.username??"-",m.role??"-",p(m.status),q(m.createdAt)])});}catch(t){h(t);}}),h$1.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(he,{id:e});if(!n.user)throw new q$1(`User ${e} not found`);i(t,n.user);}catch(n){h(n);}}),h$1.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(e,t)=>{try{let n={};if(t.firstName&&(n.firstName=t.firstName),t.lastName&&(n.lastName=t.lastName),t.username&&(n.username=t.username),t.phone&&(n.phoneNumber=t.phone),t.role&&(n.role=t.role.toUpperCase()),t.status&&(n.status=t.status.toUpperCase()),t.emailVerified!==void 0&&(n.emailVerified=t.emailVerified==="true"),!Object.keys(n).length)throw new q$1("No updates specified");let m=await c(ke,{id:e,input:n});k("User updated"),i(t,m.updateUser);}catch(n){h(n);}});}var _e={id:"auth",version:"1.0.0",displayName:"Authentication",register(s$1,p){a(p),Te(s$1);let i=s$1.commands.find(o=>o.name()==="auth");if(!i)throw new s("auth command group missing after registerAuthCommands");Ue(i);}},Qe=_e;export{Qe as default};
184
+ `;async function ye(s,p){if(s.length===0)throw new j$1("No workspaces to choose from");if(p.preferredId){let g=s.find(f=>f.id===p.preferredId);if(!g)throw new j$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(`
185
+ 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 Ee(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 Te(s){let p=s.command("auth").description("Authentication commands");p.command("login").description(`Authenticate with ${u().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 Re(i.workspaceId):await Pe(i.workspaceId);}catch(o){h(o);}}),p.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(v()?.accessToken)try{await e(Ie);}catch{n("Server-side logout failed, clearing local tokens");}x(),f(),k("Logged out successfully");}catch(i){h(i);}}),p.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i$1=>{let o=v(),c=y(),u=!!o?.accessToken,g=o?.accessToken?E(o):false,f=o?.expiresAt?q(new Date(o.expiresAt).toISOString()):"-",h=o?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=o?.workspaceTokenExpiresAt?q(new Date(o.workspaceTokenExpiresAt).toISOString()):"-";i(i$1,{authenticated:u,method:h,expired:g,expiresAt:f,workspaceId:o?.workspaceId??"-",organizationId:o?.organizationId??"-",workspaceTokenExpiresAt:e,workspaceEndpoint:c.workspaceEndpoint,globalEndpoint:c.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(u)],["Method",h],["Expired",String(g)],["Expires At",f],["Workspace ID",o?.workspaceId??"-"],["Organization ID",o?.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=v();if(i.workspace){if(!o?.workspaceToken)throw new j$1(`No workspace token. Set a workspace: ${u().productName} workspace set <id>`);process.stdout.write(o.workspaceToken);return}if(!o?.accessToken)throw new j$1(`Not authenticated. Run: ${u().productName} auth login`);process.stdout.write(o.accessToken);}),p.command("refresh").description("Force token refresh").action(async()=>{try{let i=v();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new j$1(`No refresh token available. Run: ${u().productName} auth login`);if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let u=y(),g=await f$1(u.globalEndpoint,i.clientId,i.clientSecret);w({...i,accessToken:g.accessToken,expiresAt:Date.now()+g.expiresIn*1e3}),f(),k("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await Se();return}let c=(await e(we,{token:i.refreshToken})).refreshToken;w({...i,accessToken:c.accessToken,refreshToken:c.refreshToken,expiresAt:Date.now()+c.expiresIn*1e3}),f(),k("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await Se();}catch(i){h(i);}});}async function Se(){let s=v();if(!s?.accessToken||!s.workspaceId||!s.organizationId)return;let p=y();try{let i=await g(p.workspaceEndpoint,s.accessToken,s.workspaceId,s.organizationId);w({...s,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),f(),k("Workspace token refreshed");}catch{n("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Pe(s){let p=y(),{oidcIssuer:i,clientId:o}=D(),c={...p,oidcIssuer:i,clientId:o};m("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)?m("Browser opened"):n("Could not open browser \u2014 open the URL manually"),m("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;w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),m("Fetching workspaces...");try{let t=await h$1(p.globalEndpoint,h);if(t.length===0){k("Authentication successful (no workspaces found)");return}let n=!!process.stdin.isTTY;t.length>1&&n&&!s&&(console.log(`
186
+ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.slug})`)));let{workspace:m$1}=await ye(t,{preferredId:s,interactive:n,ask:Ee});t.length>1&&!n&&!s&&m(`${t.length} workspaces available; pass --workspace-id or run \`${u().productName} workspace set <id>\` to switch`),m(`Using workspace: ${m$1.name} (${m$1.id})`);let k$1=await g(p.workspaceEndpoint,h,m$1.id,m$1.organizationId);w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,workspaceToken:k$1.token,workspaceTokenExpiresAt:new Date(k$1.expiresAt).getTime(),workspaceId:m$1.id,organizationId:m$1.organizationId,authMethod:"device_code"}),f(),k("Authentication successful");}catch(t){w({accessToken:h,refreshToken:f$1.refreshToken,expiresAt:e,authMethod:"device_code"}),f(),k("Authentication successful"),n(`Workspace token not obtained: ${t instanceof Error?t.message:String(t)}`),m(`Set workspace manually: ${u().productName} workspace set <id>`);}}async function Re(s){let p=y(),o=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(k=>{o.question("Client ID: ",A=>k(A.trim()));}),u=await new Promise(k=>{o.question("Client Secret: ",A=>{o.close(),k(A.trim());});});if(!c||!u)throw new j$1("Client ID and secret cannot be empty");m("Authenticating app...");let g$1=await f$1(p.globalEndpoint,c,u),f$2=g$1.accessToken,h=Date.now()+g$1.expiresIn*1e3,e,t,n$1=s,m$1;if(n$1)try{let A=(await h$1(p.globalEndpoint,f$2)).find(C=>C.id===n$1);if(A){m$1=A.organizationId;let C=await g(p.workspaceEndpoint,f$2,n$1,m$1);e=C.token,t=new Date(C.expiresAt).getTime(),m(`Workspace token issued for: ${A.name}`);}else n(`Workspace ${n$1} not found \u2014 skipping workspace token`),n$1=void 0;}catch(k){n(`Workspace token failed: ${k instanceof Error?k.message:String(k)}`);}w({accessToken:f$2,refreshToken:"",expiresAt:h,workspaceToken:e,workspaceTokenExpiresAt:t,workspaceId:n$1,organizationId:m$1,authMethod:"client_credentials",clientId:c,clientSecret:u}),f(),k("App authentication successful");}function Ue(s){let p$1=s.command("profile").description("Current user profile");p$1.command("show").description("Show current user").option("-f, --format <format>").action(async e=>{try{let t=await c(B);i(e,t.currentUser);}catch(t){h(t);}}),p$1.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 e=>{try{let t={};if(e.firstName&&(t.firstName=e.firstName),e.lastName&&(t.lastName=e.lastName),e.name&&(t.name=e.name),e.username&&(t.username=e.username),e.phone&&(t.phoneNumber=e.phone),e.timezone&&(t.timezone=e.timezone),e.language&&(t.language=e.language),!Object.keys(t).length)throw new j$1("No updates specified");let n=await c(H,{input:t});k("Profile updated"),i(e,n.updateCurrentUserProfile);}catch(t){h(t);}});let i$1=s.command("security").description("Account security overview");i$1.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(F,{pagination:{limit:e.limit,offset:0}});i(e,t.authAuditLogs.auditLogs,{headers:["When","Action","Resource","IP"],rows:t.authAuditLogs.auditLogs.map(n=>[q(n.createdAt),n.action,n.resource??"-",n.ipAddress??"-"])});}catch(t){h(t);}}),i$1.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(j,{pagination:{limit:e.limit,offset:0}});i(e,t.activeSessions.sessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:t.activeSessions.sessions.map(n=>[r(n.id,12),p(n.status),n.ipAddress??"-",q(n.lastActivityAt),String(!!n.isCurrent)])});}catch(t){h(t);}});let o$1=s.command("mfa").description("Multi-factor authentication");o$1.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(J,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserMFAMethods.methods,{headers:["Method","Status","Created"],rows:t.currentUserMFAMethods.methods.map(n=>[n.method,p(n.status),q(n.createdAt)])});}catch(t){h(t);}}),o$1.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async e=>{try{let t=await c(X,{method:e.method.toUpperCase()});e.format?i(e,t.setupMFA):(k("MFA enrollment started"),o(t.setupMFA),m("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){h(t);}}),o$1.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async e=>{try{await c(Q,{code:e.code}),k("MFA enabled");}catch(t){h(t);}}),o$1.command("disable").description("Disable MFA for the current user").action(async()=>{try{await c(Z),k("MFA disabled");}catch(e){h(e);}});let c$1=s.command("api-keys").description("API key management");c$1.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=e.app?te:ee,n=e.app?{appId:e.app,pagination:{limit:e.limit,offset:0}}:{pagination:{limit:e.limit,offset:0}},m=await c(t,n),k=(m.myApiKeys??m.appApiKeys)?.apiKeys??[];i(e,k,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:k.map(A=>[r(A.id,12),A.name??"-",A.prefix??"-",A.appName??"-",Array.isArray(A.scopes)?A.scopes.join(","):"-",q(A.lastUsedAt)])});}catch(t){h(t);}}),c$1.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 e=>{try{let t={name:e.name,appId:e.app,scope:e.scope?e.scope.split(","):void 0,expiresAt:e.expires},n=await c(ne,{input:t});k("API key generated. Store the secret \u2014 it is only shown once."),o(n.generateAPIKey);}catch(t){h(t);}}),c$1.command("revoke").description("Revoke an API key").argument("<keyId>").action(async e=>{try{await c(ie,{keyId:e}),k("API key revoked");}catch(t){h(t);}}),c$1.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async e=>{try{let t=await c(oe,{keyId:e});k("API key rotated"),o(t.rotateAPIKey);}catch(t){h(t);}}),s.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(F,{pagination:{limit:e.limit,offset:0}});i(e,t.authAuditLogs.auditLogs);}catch(t){h(t);}});let u=s.command("delegations").description("Delegation management");u.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(se,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserDelegations.delegations);}catch(t){h(t);}}),u.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 e=>{try{let t={appId:e.app,userId:e.user,scopes:e.scope?e.scope.split(","):void 0,workspaceIds:e.workspace?e.workspace.split(","):void 0,expiresAt:e.expires},n=await c(re,{input:t});k("Delegation granted"),i(e,n.grantDelegation);}catch(t){h(t);}}),u.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(e,t)=>{try{await c(ae,{id:e,reason:t.reason}),k("Delegation revoked");}catch(n){h(n);}});let g=s.command("apps").description("OAuth/system app management");g.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t=await c(pe,{pagination:{limit:e.limit,offset:0}});i(e,t.currentUserApps.apps,{headers:["ID","ClientID","Name","Type","Status"],rows:t.currentUserApps.apps.map(n=>[r(n.id,12),r(n.clientId,24),n.name??"-",n.type??"-",p(n.status)])});}catch(t){h(t);}}),g.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(ce,{id:e});if(!n.app)throw new j$1(`App ${e} not found`);i(t,n.app);}catch(n){h(n);}}),g.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 e=>{try{let t={name:e.name,description:e.description,type:(e.type??"OAUTH").toUpperCase(),actorType:(e.actorType??"APP").toUpperCase(),redirectUris:e.redirect?e.redirect.split(","):void 0,scopes:e.scopes?e.scopes.split(","):void 0},n=await c(de,{input:t});k("App created. Client secret only shown once."),o(n.createApp);}catch(t){h(t);}}),g.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(e,t)=>{try{let n={};if(t.name&&(n.name=t.name),t.description!==void 0&&(n.description=t.description),t.redirect&&(n.redirectUris=t.redirect.split(",")),t.scopes&&(n.scopes=t.scopes.split(",")),t.status&&(n.status=t.status.toUpperCase()),!Object.keys(n).length)throw new j$1("No updates specified");let m=await c(me,{id:e,input:n});k("App updated"),i(t,m.updateApp);}catch(n){h(n);}}),g.command("deactivate").description("Deactivate an app").argument("<id>").action(async e=>{try{await c(ue,{id:e}),k("App deactivated");}catch(t){h(t);}});let f=s.command("sso").description("SSO (SAML/OIDC) configuration");f.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async e=>{try{let t=await c(le,{tenantId:e.tenant});i(e,t.getSSOConfig);}catch(t){h(t);}}),f.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 e=>{try{let t={entityId:e.entity,ssoUrl:e.ssoUrl,sloUrl:e.sloUrl,certificate:e.certificate,enabled:!!e.enabled},n=await c(ge,{tenantId:e.tenant,input:t});k("SSO config saved"),i(e,n.saveSSOConfig);}catch(t){h(t);}}),f.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async e=>{try{await c(fe,{tenantId:e.tenant}),k("SSO config deleted");}catch(t){h(t);}});let h$1=s.command("users").description("User admin (requires admin permissions)");h$1.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",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.email&&(t.email=e.email),e.username&&(t.username=e.username),e.role&&(t.role=e.role.toUpperCase()),e.status&&(t.status=e.status.toUpperCase()),e.search&&(t.search=e.search);let n=await c(Ae,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});i(e,n.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:n.users.users.map(m=>[r(m.id,12),m.email,m.username??"-",m.role??"-",p(m.status),q(m.createdAt)])});}catch(t){h(t);}}),h$1.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(he,{id:e});if(!n.user)throw new j$1(`User ${e} not found`);i(t,n.user);}catch(n){h(n);}}),h$1.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(e,t)=>{try{let n={};if(t.firstName&&(n.firstName=t.firstName),t.lastName&&(n.lastName=t.lastName),t.username&&(n.username=t.username),t.phone&&(n.phoneNumber=t.phone),t.role&&(n.role=t.role.toUpperCase()),t.status&&(n.status=t.status.toUpperCase()),t.emailVerified!==void 0&&(n.emailVerified=t.emailVerified==="true"),!Object.keys(n).length)throw new j$1("No updates specified");let m=await c(ke,{id:e,input:n});k("User updated"),i(t,m.updateUser);}catch(n){h(n);}});}var _e={id:"auth",version:"1.0.0",displayName:"Authentication",register(s,p){a(p),Te(s);let i=s.commands.find(o=>o.name()==="auth");if(!i)throw new l("auth command group missing after registerAuthCommands");Ue(i);}},Qe=_e;export{Qe as default};
@@ -1,105 +1,105 @@
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(o){C=o;}function f(){if(!C)throw new g("vibecontrols module helpers used before setHelpersContext was called");return C}async function s(o,i){return f().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,l){f().output.formatAndOutput(o,i,l);}function m(o){f().output.printSuccess(o);}function O(o){f().output.printInfo(o);}function I(o){return f().output.formatStatus(o)}function x(o){return f().output.formatDate(o)}function w(o,i){return f().output.truncate(o,i)}var k=`
1
+ 'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var a=class extends Error{exitCode;hint;constructor(i,u){super(i),this.name="CliUserError",this.exitCode=u?.exitCode??1,this.hint=u?.hint;}},m=class extends a{constructor(i,u){super(i,{exitCode:2,hint:u?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},g=class extends Error{cause;constructor(i,u){super(i),this.name="CliInternalError",this.cause=u;}};function k(r){if(r instanceof m||r instanceof a)return r;let i=x(r)&&x(r.response)?r.response:void 0,u=i?.errors,b=Array.isArray(u)?u[0]:void 0,p=(x(b)&&x(b.extensions)?b.extensions:void 0)?.code,f=i?.status;return p==="UNAUTHENTICATED"||f===401?new m("Authentication required."):p==="FORBIDDEN"||f===403?new a("Permission denied."):p==="BAD_USER_INPUT"||p==="GRAPHQL_VALIDATION_FAILED"||f===400?new a("Invalid request. Check the command arguments."):p==="NOT_FOUND"||f===404?new a("Requested resource was not found."):p==="RATE_LIMITED"||p==="TOO_MANY_REQUESTS"||f===429?new a("Request limit reached. Try again later."):new g("The request could not be completed. Try again later.")}var C=class extends Error{response;constructor(i,u){super(i),this.name="GqlRequestError",this.response=u;}};function x(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}var T=null;function R(r){T=r;}function y(){if(!T)throw new g("vibecontrols module helpers used before setHelpersContext was called");return T}async function s(r,i){return y().gql.global.request(r,i)}function c(r){throw r instanceof m||r instanceof a||r instanceof g?r:r instanceof C||r!==null&&typeof r=="object"&&"response"in r?k(r):new g("The command could not be completed. Try again later.")}function d(r,i,u){y().output.formatAndOutput(r,i,u);}function h(r){y().output.printSuccess(r);}function q(r){y().output.printInfo(r);}function E(r){return y().output.formatStatus(r)}function S(r){return y().output.formatDate(r)}function I(r,i){return y().output.truncate(r,i)}var v=`
2
2
  query GetDefaultBillingAccount {
3
3
  getDefaultBillingAccount {
4
4
  id creditAmount currency
5
5
  }
6
6
  }
7
- `,D=`
7
+ `,_=`
8
8
  query GetActiveSubscriptions($billingAccountId: ID!) {
9
9
  getActiveSubscriptions(billingAccountId: $billingAccountId) {
10
10
  id status seatCount nextBillingDate
11
11
  plan { name price currency }
12
12
  }
13
13
  }
14
- `,R=`
14
+ `,$=`
15
15
  query GetSubscription($id: ID!, $billingAccountId: ID!) {
16
16
  getSubscription(id: $id, billingAccountId: $billingAccountId) {
17
17
  id status startDate endDate seatCount billingAccountId
18
18
  }
19
19
  }
20
- `,$=`
20
+ `,N=`
21
21
  mutation UpdateSubscriptionSeats($input: UpdateSubscriptionSeatsInput!) {
22
22
  updateSubscriptionSeats(input: $input) {
23
23
  id seatCount lastSeatChangeAt
24
24
  }
25
25
  }
26
- `,q=`
26
+ `,L=`
27
27
  mutation CancelSubscription($input: CancelSubscriptionInput!) {
28
28
  cancelSubscription(input: $input) {
29
29
  id status canceledAt cancellationReason
30
30
  }
31
31
  }
32
- `,_=`
32
+ `,G=`
33
33
  query GetAllPlans($filter: PlansFilter) {
34
34
  getAllPlans(filter: $filter) {
35
35
  id name price currency duration pricingModel
36
36
  }
37
37
  }
38
- `,L=`
38
+ `,U=`
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
- `,N=`
44
+ `,M=`
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
- `,G=`
50
+ `,B=`
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 }
54
54
  totalCount hasMore
55
55
  }
56
56
  }
57
- `,A=`
57
+ `,O=`
58
58
  query GetInvoice($id: ID!, $billingAccountId: ID!) {
59
59
  getInvoice(id: $id, billingAccountId: $billingAccountId) {
60
60
  id invoiceNumber status currency subtotal tax total amountPaid pdfUrl
61
61
  items { description quantity unitPrice amount }
62
62
  }
63
63
  }
64
- `,M=`
64
+ `,F=`
65
65
  query GetPaymentMethods($billingAccountId: ID!) {
66
66
  getPaymentMethods(billingAccountId: $billingAccountId) {
67
67
  id type last4 expiryYear brand isDefault isVerified
68
68
  }
69
69
  }
70
- `,U=`
70
+ `,W=`
71
71
  mutation AddPaymentMethod($input: CreatePaymentMethodInput!) {
72
72
  addPaymentMethod(input: $input) {
73
73
  id type isDefault isVerified
74
74
  }
75
75
  }
76
- `,W=`
76
+ `,j=`
77
77
  mutation DeletePaymentMethod($id: ID!, $billingAccountId: ID!) {
78
78
  deletePaymentMethod(id: $id, billingAccountId: $billingAccountId)
79
79
  }
80
- `,B=`
80
+ `,V=`
81
81
  mutation GrantCredits($input: GrantCreditsInput!) {
82
82
  grantCredits(input: $input) {
83
83
  id amount status type
84
84
  }
85
85
  }
86
- `,F=`
86
+ `,z=`
87
87
  mutation RequestCreditWithdrawal($input: RequestCreditWithdrawalInput!) {
88
88
  requestCreditWithdrawal(input: $input) {
89
89
  id status requestedAmount currency
90
90
  }
91
91
  }
92
- `,j=`
92
+ `,H=`
93
93
  query GetPendingRefunds($page: Int, $pageSize: Int) {
94
94
  getPendingRefunds(page: $page, pageSize: $pageSize) {
95
95
  records { id amount status source createdAt }
96
96
  totalCount
97
97
  }
98
98
  }
99
- `,V=`
99
+ `,Y=`
100
100
  query GetQuotas($subscriptionId: ID!, $billingAccountId: ID!) {
101
101
  getAllQuotasOfSub(subscriptionId: $subscriptionId, billingAccountId: $billingAccountId) {
102
102
  id name limits currentUsageSum reusable
103
103
  }
104
104
  }
105
- `;async function p(){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"),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(r=>[w(r.id,12),I(r.status),r.plan?.name??"-",String(r.seatCount??"-"),x(r.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(),r=await s(R,{id:t,billingAccountId:n});if(!r.getSubscription)throw new d(`Subscription ${t} not found`);c(e,r.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},r=await s($,{input:n});m(`Seat count updated to ${r.updateSubscriptionSeats.seatCount}`),c(e,r.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},r=await s(q,{input:n});m("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(_,{filter:Object.keys(e).length?e:void 0});c(t,n.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:n.getAllPlans.map(r=>[w(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(L,{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(N,{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(r=>[w(r.id,12),r.invoiceNumber??"-",I(r.status),String(r.total??"-"),r.currency??"-",x(r.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(),r=await s(A,{id:t,billingAccountId:n});if(!r.getInvoice)throw new d(`Invoice ${t} not found`);c(e,r.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(),r=await s(A,{id:t,billingAccountId:n});if(!r.getInvoice?.pdfUrl)throw new d(`Invoice ${t} has no pdfUrl`);O("PDF URL:"),console.log(r.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(r=>[w(r.id,12),r.type,r.brand??"-",r.last4??"-",String(!!r.isDefault),String(!!r.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},r=await s(U,{input:n});m("Payment method added"),c(t,r.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(W,{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(k);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(B,{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(F,{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(),r=await s(V,{subscriptionId:t,billingAccountId:n});c(e,r.getAllQuotasOfSub);}catch(n){a(n);}});}var it={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(o,i){P(i),z(o);}},he=it;module.exports=he;
105
+ `;async function w(){let r=await s(v);if(!r.getDefaultBillingAccount?.id)throw new a("No default billing account on file. Pass --account <id> explicitly.");return r.getDefaultBillingAccount.id}function Q(r){let i=r.command("billing").description("Billing: subscriptions, invoices, credits"),u=i.command("subscriptions").description("Subscriptions");u.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(_,{billingAccountId:e});d(t,n.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:n.getActiveSubscriptions.map(o=>[I(o.id,12),E(o.status),o.plan?.name??"-",String(o.seatCount??"-"),S(o.nextBillingDate)])});}catch(e){c(e);}}),u.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 w(),o=await s($,{id:t,billingAccountId:n});if(!o.getSubscription)throw new a(`Subscription ${t} not found`);d(e,o.getSubscription);}catch(n){c(n);}}),u.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(N,{input:n});h(`Seat count updated to ${o.updateSubscriptionSeats.seatCount}`),d(e,o.updateSubscriptionSeats);}catch(n){c(n);}}),u.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(L,{input:n});h("Subscription canceled"),d({},o.cancelSubscription);}catch(n){c(n);}});let b=i.command("plans").description("Plans");b.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(G,{filter:Object.keys(e).length?e:void 0});d(t,n.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:n.getAllPlans.map(o=>[I(o.id,12),o.name,String(o.price??"-"),o.currency??"-",o.duration??"-"])});}catch(e){c(e);}}),b.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(U,{id:t});if(!n.getPlan)throw new a(`Plan ${t} not found`);d(e,n.getPlan);}catch(n){c(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(M,{filter:Object.keys(e).length?e:void 0,limit:t.limit});d(t,n.getAllAddOns);}catch(e){c(e);}});let p=i.command("invoices").description("Invoices");p.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(B,{billingAccountId:e,page:t.page,pageSize:t.pageSize});d(t,n.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:n.getPaginatedInvoices.invoices.map(o=>[I(o.id,12),o.invoiceNumber??"-",E(o.status),String(o.total??"-"),o.currency??"-",S(o.paidAt)])});}catch(e){c(e);}}),p.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 w(),o=await s(O,{id:t,billingAccountId:n});if(!o.getInvoice)throw new a(`Invoice ${t} not found`);d(e,o.getInvoice);}catch(n){c(n);}}),p.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 w(),o=await s(O,{id:t,billingAccountId:n});if(!o.getInvoice?.pdfUrl)throw new a(`Invoice ${t} has no pdfUrl`);q("PDF URL:"),console.log(o.getInvoice.pdfUrl);}catch(n){c(n);}});let f=i.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 e=t.account??await w(),n=await s(F,{billingAccountId:e});d(t,n.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:n.getPaymentMethods.map(o=>[I(o.id,12),o.type,o.brand??"-",o.last4??"-",String(!!o.isDefault),String(!!o.isVerified)])});}catch(e){c(e);}}),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 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},o=await s(W,{input:n});h("Payment method added"),d(t,o.addPaymentMethod);}catch(e){c(e);}}),f.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 w();await s(j,{id:t,billingAccountId:n}),h("Payment method removed");}catch(n){c(n);}});let A=i.command("credits").description("Credits & withdrawal");A.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let e=await s(v);d(t,e.getDefaultBillingAccount);}catch(e){c(e);}}),A.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(V,{input:e}),h("Credits granted");}catch(e){c(e);}}),A.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(z,{input:e}),h("Withdrawal requested");}catch(e){c(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(H,{page:t.page,pageSize:t.pageSize});d(t,e.getPendingRefunds.records);}catch(e){c(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 w(),o=await s(Y,{subscriptionId:t,billingAccountId:n});d(e,o.getAllQuotasOfSub);}catch(n){c(n);}});}var ut={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(r,i){R(i),Q(r);}},Ie=ut;module.exports=Ie;
@@ -1,4 +1,4 @@
1
- import { C as CliModule } from '../../module-BNVKV_pI.cjs';
1
+ import { C as CliModule } from '../../module-DWSAfs3k.cjs';
2
2
  import 'commander';
3
3
  import 'graphql-request';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as CliModule } from '../../module-BNVKV_pI.js';
1
+ import { C as CliModule } from '../../module-DWSAfs3k.js';
2
2
  import 'commander';
3
3
  import 'graphql-request';
4
4
 
@@ -1,4 +1,4 @@
1
- import {a,c,i,r,p,q as q$1,h as h$1,k,m}from'../../chunk-3ZVMC2AF.js';import {q as q$2}from'../../chunk-ZT6KOG7N.js';var y=`
1
+ import {a,c,i,r,p,q as q$1,h as h$1,k,m}from'../../chunk-BGNPGKJM.js';import {j}from'../../chunk-N7EXKGE2.js';var y=`
2
2
  query GetDefaultBillingAccount {
3
3
  getDefaultBillingAccount {
4
4
  id creditAmount currency
@@ -102,4 +102,4 @@ import {a,c,i,r,p,q as q$1,h as h$1,k,m}from'../../chunk-3ZVMC2AF.js';import {q
102
102
  id name limits currentUsageSum reusable
103
103
  }
104
104
  }
105
- `;async function s(){let u=await c(y);if(!u.getDefaultBillingAccount?.id)throw new q$2("No default billing account on file. Pass --account <id> explicitly.");return u.getDefaultBillingAccount.id}function z(u){let r$1=u.command("billing").description("Billing: subscriptions, invoices, credits"),g=r$1.command("subscriptions").description("Subscriptions");g.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=t.account??await s(),i$1=await c(E,{billingAccountId:n});i(t,i$1.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i$1.getActiveSubscriptions.map(e=>[r(e.id,12),p(e.status),e.plan?.name??"-",String(e.seatCount??"-"),q$1(e.nextBillingDate)])});}catch(n){h$1(n);}}),g.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$1=n.account??await s(),e=await c(h,{id:t,billingAccountId:i$1});if(!e.getSubscription)throw new q$2(`Subscription ${t} not found`);i(n,e.getSubscription);}catch(i){h$1(i);}}),g.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});k(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),i(n,e.updateSubscriptionSeats);}catch(i){h$1(i);}}),g.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});k("Subscription canceled"),i({},e.cancelSubscription);}catch(i){h$1(i);}});let P=r$1.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$1=await c($,{filter:Object.keys(n).length?n:void 0});i(t,i$1.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i$1.getAllPlans.map(e=>[r(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){h$1(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i$1=await c(N,{id:t});if(!i$1.getPlan)throw new q$2(`Plan ${t} not found`);i(n,i$1.getPlan);}catch(i){h$1(i);}}),r$1.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$1=await c(v,{filter:Object.keys(n).length?n:void 0,limit:t.limit});i(t,i$1.getAllAddOns);}catch(n){h$1(n);}});let m$1=r$1.command("invoices").description("Invoices");m$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=t.account??await s(),i$1=await c(G,{billingAccountId:n,page:t.page,pageSize:t.pageSize});i(t,i$1.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i$1.getPaginatedInvoices.invoices.map(e=>[r(e.id,12),e.invoiceNumber??"-",p(e.status),String(e.total??"-"),e.currency??"-",q$1(e.paidAt)])});}catch(n){h$1(n);}}),m$1.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$1=n.account??await s(),e=await c(S,{id:t,billingAccountId:i$1});if(!e.getInvoice)throw new q$2(`Invoice ${t} not found`);i(n,e.getInvoice);}catch(i){h$1(i);}}),m$1.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 q$2(`Invoice ${t} has no pdfUrl`);m("PDF URL:"),console.log(e.getInvoice.pdfUrl);}catch(i){h$1(i);}});let I=r$1.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$1=await c(O,{billingAccountId:n});i(t,i$1.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i$1.getPaymentMethods.map(e=>[r(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){h$1(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});k("Payment method added"),i(t,e.addPaymentMethod);}catch(n){h$1(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=n.account??await s();await c(B,{id:t,billingAccountId:i}),k("Payment method removed");}catch(i){h$1(i);}});let f=r$1.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);i(t,n.getDefaultBillingAccount);}catch(n){h$1(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}),k("Credits granted");}catch(n){h$1(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}),k("Withdrawal requested");}catch(n){h$1(n);}}),r$1.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});i(t,n.getPendingRefunds.records);}catch(n){h$1(n);}}),r$1.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$1=n.account??await s(),e=await c(q,{subscriptionId:t,billingAccountId:i$1});i(n,e.getAllQuotasOfSub);}catch(i){h$1(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};
105
+ `;async function s(){let u=await c(y);if(!u.getDefaultBillingAccount?.id)throw new j("No default billing account on file. Pass --account <id> explicitly.");return u.getDefaultBillingAccount.id}function z(u){let r$1=u.command("billing").description("Billing: subscriptions, invoices, credits"),g=r$1.command("subscriptions").description("Subscriptions");g.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=t.account??await s(),i$1=await c(E,{billingAccountId:n});i(t,i$1.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i$1.getActiveSubscriptions.map(e=>[r(e.id,12),p(e.status),e.plan?.name??"-",String(e.seatCount??"-"),q$1(e.nextBillingDate)])});}catch(n){h$1(n);}}),g.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$1=n.account??await s(),e=await c(h,{id:t,billingAccountId:i$1});if(!e.getSubscription)throw new j(`Subscription ${t} not found`);i(n,e.getSubscription);}catch(i){h$1(i);}}),g.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});k(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),i(n,e.updateSubscriptionSeats);}catch(i){h$1(i);}}),g.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});k("Subscription canceled"),i({},e.cancelSubscription);}catch(i){h$1(i);}});let P=r$1.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$1=await c($,{filter:Object.keys(n).length?n:void 0});i(t,i$1.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i$1.getAllPlans.map(e=>[r(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){h$1(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i$1=await c(N,{id:t});if(!i$1.getPlan)throw new j(`Plan ${t} not found`);i(n,i$1.getPlan);}catch(i){h$1(i);}}),r$1.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$1=await c(v,{filter:Object.keys(n).length?n:void 0,limit:t.limit});i(t,i$1.getAllAddOns);}catch(n){h$1(n);}});let m$1=r$1.command("invoices").description("Invoices");m$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=t.account??await s(),i$1=await c(G,{billingAccountId:n,page:t.page,pageSize:t.pageSize});i(t,i$1.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i$1.getPaginatedInvoices.invoices.map(e=>[r(e.id,12),e.invoiceNumber??"-",p(e.status),String(e.total??"-"),e.currency??"-",q$1(e.paidAt)])});}catch(n){h$1(n);}}),m$1.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$1=n.account??await s(),e=await c(S,{id:t,billingAccountId:i$1});if(!e.getInvoice)throw new j(`Invoice ${t} not found`);i(n,e.getInvoice);}catch(i){h$1(i);}}),m$1.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 j(`Invoice ${t} has no pdfUrl`);m("PDF URL:"),console.log(e.getInvoice.pdfUrl);}catch(i){h$1(i);}});let I=r$1.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$1=await c(O,{billingAccountId:n});i(t,i$1.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i$1.getPaymentMethods.map(e=>[r(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){h$1(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});k("Payment method added"),i(t,e.addPaymentMethod);}catch(n){h$1(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=n.account??await s();await c(B,{id:t,billingAccountId:i}),k("Payment method removed");}catch(i){h$1(i);}});let f=r$1.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);i(t,n.getDefaultBillingAccount);}catch(n){h$1(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}),k("Credits granted");}catch(n){h$1(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}),k("Withdrawal requested");}catch(n){h$1(n);}}),r$1.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});i(t,n.getPendingRefunds.records);}catch(n){h$1(n);}}),r$1.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$1=n.account??await s(),e=await c(q,{subscriptionId:t,billingAccountId:i$1});i(n,e.getAllQuotasOfSub);}catch(i){h$1(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};