@burdenoff/cli-sdk 2026.1102.1 → 2026.1102.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-O6UCQ5IT.js +1 -0
- package/dist/{chunk-AYNNSLCL.js → chunk-ZGT7IIOP.js} +409 -418
- package/dist/modules/adaptercloud/index.cjs +4 -4
- package/dist/modules/adaptercloud/index.js +2 -2
- package/dist/modules/artistrybase/index.js +2 -2
- package/dist/modules/assethandler/index.cjs +2 -2
- package/dist/modules/assethandler/index.js +2 -2
- package/dist/modules/atheletebridge/index.cjs +8 -8
- package/dist/modules/atheletebridge/index.js +2 -2
- package/dist/modules/auth/index.cjs +37 -37
- package/dist/modules/auth/index.js +33 -29
- package/dist/modules/billing/index.cjs +1 -1
- package/dist/modules/billing/index.js +2 -2
- package/dist/modules/brainyrich/index.cjs +44 -28
- package/dist/modules/brainyrich/index.js +47 -31
- package/dist/modules/buildmyiq/index.js +2 -2
- package/dist/modules/channels/index.cjs +3 -3
- package/dist/modules/channels/index.js +2 -2
- package/dist/modules/collabkin/index.cjs +4 -4
- package/dist/modules/collabkin/index.js +2 -2
- package/dist/modules/comradecircle/index.cjs +6 -6
- package/dist/modules/comradecircle/index.js +2 -2
- package/dist/modules/conversations/index.cjs +7 -7
- package/dist/modules/conversations/index.js +2 -2
- package/dist/modules/coolandlovely/index.cjs +2 -2
- package/dist/modules/coolandlovely/index.js +2 -2
- package/dist/modules/cosmicintersection/index.cjs +6 -6
- package/dist/modules/cosmicintersection/index.js +2 -2
- package/dist/modules/crewfoundry/index.js +2 -2
- package/dist/modules/devportal/index.cjs +2 -2
- package/dist/modules/devportal/index.js +2 -2
- package/dist/modules/ecoimpacthub/index.cjs +5 -5
- package/dist/modules/ecoimpacthub/index.js +2 -2
- package/dist/modules/eventfullymanaged/index.cjs +12 -12
- package/dist/modules/eventfullymanaged/index.js +2 -2
- package/dist/modules/export/index.cjs +4 -4
- package/dist/modules/export/index.js +2 -2
- package/dist/modules/files/index.cjs +3 -3
- package/dist/modules/files/index.js +4 -4
- package/dist/modules/fluidgrids/index.cjs +16 -16
- package/dist/modules/fluidgrids/index.js +3 -3
- package/dist/modules/ggnomad/index.cjs +4 -4
- package/dist/modules/ggnomad/index.js +2 -2
- package/dist/modules/govcitizenhub/index.cjs +4 -4
- package/dist/modules/govcitizenhub/index.js +2 -2
- package/dist/modules/groups/index.cjs +4 -4
- package/dist/modules/groups/index.js +2 -2
- package/dist/modules/headshotmarketing/index.js +2 -2
- package/dist/modules/hookmovies/index.cjs +6 -6
- package/dist/modules/hookmovies/index.js +2 -2
- package/dist/modules/housingvista/index.cjs +3 -3
- package/dist/modules/housingvista/index.js +2 -2
- package/dist/modules/integrations/index.cjs +5 -5
- package/dist/modules/integrations/index.js +2 -2
- package/dist/modules/intelwatchtower/index.cjs +5 -5
- package/dist/modules/intelwatchtower/index.js +2 -2
- package/dist/modules/kadaikodi/index.cjs +2 -2
- package/dist/modules/kadaikodi/index.js +2 -2
- package/dist/modules/labsofscience/index.cjs +3 -3
- package/dist/modules/labsofscience/index.js +2 -2
- package/dist/modules/manufacturedops/index.cjs +2 -2
- package/dist/modules/manufacturedops/index.js +2 -2
- package/dist/modules/movethewheels/index.js +2 -2
- package/dist/modules/notifications/index.cjs +2 -2
- package/dist/modules/notifications/index.js +2 -2
- package/dist/modules/organizations/index.js +2 -2
- package/dist/modules/planmagnet/index.js +2 -2
- package/dist/modules/products/index.cjs +4 -4
- package/dist/modules/products/index.js +2 -2
- package/dist/modules/proserviceworld/index.cjs +2 -2
- package/dist/modules/proserviceworld/index.js +2 -2
- package/dist/modules/rbac/index.js +2 -2
- package/dist/modules/sandbox/index.cjs +17 -17
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +2 -2
- package/dist/modules/scheduler/index.js +2 -2
- package/dist/modules/security/index.cjs +3 -3
- package/dist/modules/security/index.js +2 -2
- package/dist/modules/semanticfed/index.cjs +3 -3
- package/dist/modules/semanticfed/index.js +2 -2
- package/dist/modules/store/index.cjs +3 -3
- package/dist/modules/store/index.js +2 -2
- package/dist/modules/subscriberbot/index.cjs +1 -1
- package/dist/modules/subscriberbot/index.js +2 -2
- package/dist/modules/support/index.cjs +2 -2
- package/dist/modules/support/index.js +2 -2
- package/dist/modules/tags/index.js +2 -2
- package/dist/modules/technospam/index.cjs +2 -2
- package/dist/modules/technospam/index.js +2 -2
- package/dist/modules/theculturepost/index.js +2 -2
- package/dist/modules/theglobalfuel/index.cjs +2 -2
- package/dist/modules/theglobalfuel/index.js +2 -2
- package/dist/modules/timecampus/index.js +2 -2
- package/dist/modules/tours/index.cjs +2 -2
- package/dist/modules/tours/index.js +2 -2
- package/dist/modules/vibecontrols/index.cjs +563 -567
- package/dist/modules/vibecontrols/index.js +5 -4
- package/dist/modules/workspaces/index.cjs +4 -4
- package/dist/modules/workspaces/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-W4JZR7RJ.js +0 -1
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
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
|
-
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=`
|
|
1
|
+
import {a,u,h,v,e,n,x,f,k,y,E,q as q$1,i,w,c,r,p,o as o$1,m,D}from'../../chunk-O6UCQ5IT.js';import {q,o,f as f$1,h as h$1,g,d,i as i$1,e as e$1}from'../../chunk-YIY5IDXQ.js';var B=`
|
|
4
2
|
query currentUser {
|
|
5
3
|
currentUser {
|
|
6
4
|
id email firstName lastName username phoneNumber name
|
|
7
5
|
emailVerified mfaEnabled isAdmin role status createdAt lastLoginAt
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
`,
|
|
8
|
+
`,H=`
|
|
11
9
|
mutation updateCurrentUserProfile($input: UpdateUserInput!) {
|
|
12
10
|
updateCurrentUserProfile(input: $input) {
|
|
13
11
|
id name firstName lastName username phoneNumber
|
|
@@ -24,7 +22,7 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
24
22
|
hasMore
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
`,
|
|
25
|
+
`,j=`
|
|
28
26
|
query activeSessions($pagination: PaginationInput) {
|
|
29
27
|
activeSessions(pagination: $pagination) {
|
|
30
28
|
sessions {
|
|
@@ -34,7 +32,7 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
34
32
|
hasMore
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
`,
|
|
35
|
+
`,J=`
|
|
38
36
|
query currentUserMFAMethods($pagination: PaginationInput) {
|
|
39
37
|
currentUserMFAMethods(pagination: $pagination) {
|
|
40
38
|
methods { id method status createdAt updatedAt }
|
|
@@ -42,21 +40,21 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
42
40
|
hasMore
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
|
-
`,
|
|
43
|
+
`,X=`
|
|
46
44
|
mutation setupMFA($method: MFAMethod!) {
|
|
47
45
|
setupMFA(method: $method) {
|
|
48
46
|
method backupCodes qrCode secret
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
`;var
|
|
49
|
+
`;var Q=`
|
|
52
50
|
mutation enableMFA($code: String!) {
|
|
53
51
|
enableMFA(code: $code)
|
|
54
52
|
}
|
|
55
|
-
`,
|
|
53
|
+
`,Z=`
|
|
56
54
|
mutation disableMFA {
|
|
57
55
|
disableMFA
|
|
58
56
|
}
|
|
59
|
-
`,
|
|
57
|
+
`,ee=`
|
|
60
58
|
query myApiKeys($pagination: PaginationInput) {
|
|
61
59
|
myApiKeys(pagination: $pagination) {
|
|
62
60
|
apiKeys { id name prefix appId appName scopes expiresAt lastUsedAt createdAt }
|
|
@@ -64,7 +62,7 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
64
62
|
hasMore
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
|
-
`,
|
|
65
|
+
`,te=`
|
|
68
66
|
query appApiKeys($appId: ID!, $pagination: PaginationInput) {
|
|
69
67
|
appApiKeys(appId: $appId, pagination: $pagination) {
|
|
70
68
|
apiKeys { id name prefix appId appName scopes expiresAt lastUsedAt createdAt }
|
|
@@ -72,23 +70,23 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
72
70
|
hasMore
|
|
73
71
|
}
|
|
74
72
|
}
|
|
75
|
-
`,
|
|
73
|
+
`,ne=`
|
|
76
74
|
mutation generateAPIKey($input: GenerateAPIKeyInput!) {
|
|
77
75
|
generateAPIKey(input: $input) {
|
|
78
76
|
keyId apiKey apiSecret
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
|
-
`;var
|
|
79
|
+
`;var ie=`
|
|
82
80
|
mutation revokeAPIKey($keyId: String!) {
|
|
83
81
|
revokeAPIKey(keyId: $keyId)
|
|
84
82
|
}
|
|
85
|
-
`,
|
|
83
|
+
`,oe=`
|
|
86
84
|
mutation rotateAPIKey($keyId: String!) {
|
|
87
85
|
rotateAPIKey(keyId: $keyId) {
|
|
88
86
|
apiSecret
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
|
-
`,
|
|
89
|
+
`,se=`
|
|
92
90
|
query currentUserDelegations($pagination: PaginationInput) {
|
|
93
91
|
currentUserDelegations(pagination: $pagination) {
|
|
94
92
|
delegations {
|
|
@@ -100,17 +98,17 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
100
98
|
hasMore
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
`,
|
|
101
|
+
`,re=`
|
|
104
102
|
mutation grantDelegation($input: GrantDelegationInput!) {
|
|
105
103
|
grantDelegation(input: $input) {
|
|
106
104
|
id appId userId grantedBy grantedAt expiresAt scopes workspaceIds status
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
|
-
`,
|
|
107
|
+
`,ae=`
|
|
110
108
|
mutation revokeDelegation($id: ID!, $reason: String) {
|
|
111
109
|
revokeDelegation(id: $id, reason: $reason)
|
|
112
110
|
}
|
|
113
|
-
`,
|
|
111
|
+
`,pe=`
|
|
114
112
|
query currentUserApps($pagination: PaginationInput) {
|
|
115
113
|
currentUserApps(pagination: $pagination) {
|
|
116
114
|
apps {
|
|
@@ -121,62 +119,68 @@ Available workspaces:`),t.forEach((A,C)=>console.log(` ${C+1}. ${A.name} (${A.s
|
|
|
121
119
|
hasMore
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
|
-
`,
|
|
122
|
+
`,ce=`
|
|
125
123
|
query app($id: ID!) {
|
|
126
124
|
app(id: $id) {
|
|
127
125
|
id clientId name description type actorType status ownerUserId redirectUris scopes
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
|
-
`,
|
|
128
|
+
`,de=`
|
|
131
129
|
mutation createApp($input: CreateAppInput!) {
|
|
132
130
|
createApp(input: $input) {
|
|
133
131
|
app { id clientId name type status }
|
|
134
132
|
clientSecret
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
|
-
`,
|
|
135
|
+
`,me=`
|
|
138
136
|
mutation updateApp($id: ID!, $input: UpdateAppInput!) {
|
|
139
137
|
updateApp(id: $id, input: $input) {
|
|
140
138
|
id name description redirectUris scopes status
|
|
141
139
|
}
|
|
142
140
|
}
|
|
143
|
-
`,
|
|
141
|
+
`,ue=`
|
|
144
142
|
mutation deactivateApp($id: ID!) {
|
|
145
143
|
deactivateApp(id: $id)
|
|
146
144
|
}
|
|
147
|
-
`,
|
|
145
|
+
`,le=`
|
|
148
146
|
query getSSOConfig($tenantId: String!) {
|
|
149
147
|
getSSOConfig(tenantId: $tenantId) {
|
|
150
148
|
id identifier tenantId entityId ssoUrl sloUrl certificate enabled metadata
|
|
151
149
|
}
|
|
152
150
|
}
|
|
153
|
-
`,
|
|
151
|
+
`,ge=`
|
|
154
152
|
mutation saveSSOConfig($tenantId: String!, $input: SSOConfigInput!) {
|
|
155
153
|
saveSSOConfig(tenantId: $tenantId, input: $input) {
|
|
156
154
|
id identifier entityId ssoUrl sloUrl certificate enabled
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
|
-
`,
|
|
157
|
+
`,fe=`
|
|
160
158
|
mutation deleteSSOConfig($tenantId: String!) {
|
|
161
159
|
deleteSSOConfig(tenantId: $tenantId)
|
|
162
160
|
}
|
|
163
|
-
`,
|
|
161
|
+
`,Ae=`
|
|
164
162
|
query users($filter: UserFilterInput, $pagination: PaginationInput) {
|
|
165
163
|
users(filter: $filter, pagination: $pagination) {
|
|
166
164
|
users { id email firstName lastName username role status createdAt }
|
|
167
165
|
totalCount hasMore
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
|
-
`,
|
|
168
|
+
`,he=`
|
|
171
169
|
query user($id: ID!) {
|
|
172
170
|
user(id: $id) {
|
|
173
171
|
id email firstName lastName username role status emailVerified lastLoginAt
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
|
-
`,
|
|
174
|
+
`,ke=`
|
|
177
175
|
mutation updateUser($id: ID!, $input: AdminUpdateUserInput!) {
|
|
178
176
|
updateUser(id: $id, input: $input) {
|
|
179
177
|
id email firstName lastName username role status
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
|
-
`;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(Z);h(e,t.currentUser);}catch(t){g(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 o$1("No updates specified");let n=await c(ee,{input:t});i("Profile updated"),h(e,n.updateCurrentUserProfile);}catch(t){g(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}});h(e,t.authAuditLogs.auditLogs,{headers:["When","Action","Resource","IP"],rows:t.authAuditLogs.auditLogs.map(n=>[o(n.createdAt),n.action,n.resource??"-",n.ipAddress??"-"])});}catch(t){g(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(te,{pagination:{limit:e.limit,offset:0}});h(e,t.activeSessions.sessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:t.activeSessions.sessions.map(n$1=>[p(n$1.id,12),n(n$1.status),n$1.ipAddress??"-",o(n$1.lastActivityAt),String(!!n$1.isCurrent)])});}catch(t){g(t);}});let o$2=s.command("mfa").description("Multi-factor authentication");o$2.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(ne,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserMFAMethods.methods,{headers:["Method","Status","Created"],rows:t.currentUserMFAMethods.methods.map(n$1=>[n$1.method,n(n$1.status),o(n$1.createdAt)])});}catch(t){g(t);}}),o$2.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(ie,{method:e.method.toUpperCase()});e.format?h(e,t.setupMFA):(i("MFA enrollment started"),m(t.setupMFA),k("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){g(t);}}),o$2.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async e=>{try{await c(oe,{code:e.code}),i("MFA enabled");}catch(t){g(t);}}),o$2.command("disable").description("Disable MFA for the current user").action(async()=>{try{await c(se),i("MFA disabled");}catch(e){g(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?ae:re,n=e.app?{appId:e.app,pagination:{limit:e.limit,offset:0}}:{pagination:{limit:e.limit,offset:0}},m=await c(t,n),I=(m.myApiKeys??m.appApiKeys)?.apiKeys??[];h(e,I,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:I.map(A=>[p(A.id,12),A.name??"-",A.prefix??"-",A.appName??"-",Array.isArray(A.scopes)?A.scopes.join(","):"-",o(A.lastUsedAt)])});}catch(t){g(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(pe,{input:t});i("API key generated. Store the secret \u2014 it is only shown once."),m(n.generateAPIKey);}catch(t){g(t);}}),c$1.command("revoke").description("Revoke an API key").argument("<keyId>").action(async e=>{try{await c(ce,{keyId:e}),i("API key revoked");}catch(t){g(t);}}),c$1.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async e=>{try{let t=await c(de,{keyId:e});i("API key rotated"),m(t.rotateAPIKey);}catch(t){g(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}});h(e,t.authAuditLogs.auditLogs);}catch(t){g(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(me,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserDelegations.delegations);}catch(t){g(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(ue,{input:t});i("Delegation granted"),h(e,n.grantDelegation);}catch(t){g(t);}}),u.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(e,t)=>{try{await c(le,{id:e,reason:t.reason}),i("Delegation revoked");}catch(n){g(n);}});let g$1=s.command("apps").description("OAuth/system app management");g$1.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(ge,{pagination:{limit:e.limit,offset:0}});h(e,t.currentUserApps.apps,{headers:["ID","ClientID","Name","Type","Status"],rows:t.currentUserApps.apps.map(n$1=>[p(n$1.id,12),p(n$1.clientId,24),n$1.name??"-",n$1.type??"-",n(n$1.status)])});}catch(t){g(t);}}),g$1.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await c(fe,{id:e});if(!n.app)throw new o$1(`App ${e} not found`);h(t,n.app);}catch(n){g(n);}}),g$1.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(Ae,{input:t});i("App created. Client secret only shown once."),m(n.createApp);}catch(t){g(t);}}),g$1.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 o$1("No updates specified");let m=await c(he,{id:e,input:n});i("App updated"),h(t,m.updateApp);}catch(n){g(n);}}),g$1.command("deactivate").description("Deactivate an app").argument("<id>").action(async e=>{try{await c(Ie,{id:e}),i("App deactivated");}catch(t){g(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(ke,{tenantId:e.tenant});h(e,t.getSSOConfig);}catch(t){g(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(we,{tenantId:e.tenant,input:t});i("SSO config saved"),h(e,n.saveSSOConfig);}catch(t){g(t);}}),f.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async e=>{try{await c(ye,{tenantId:e.tenant}),i("SSO config deleted");}catch(t){g(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$1=await c(Ee,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});h(e,n$1.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:n$1.users.users.map(m=>[p(m.id,12),m.email,m.username??"-",m.role??"-",n(m.status),o(m.createdAt)])});}catch(t){g(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(Se,{id:e});if(!n.user)throw new o$1(`User ${e} not found`);h(t,n.user);}catch(n){g(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 o$1("No updates specified");let m=await c(Te,{id:e,input:n});i("User updated"),h(t,m.updateUser);}catch(n){g(n);}});}var _e={id:"auth",version:"1.0.0",displayName:"Authentication",register(s,p){a(p),Q(s);let i=s.commands.find(o=>o.name()==="auth");if(!i)throw new q("auth command group missing after registerAuthCommands");Ue(i);}},Qe=_e;export{Qe as default};
|
|
180
|
+
`,Ie="mutation SignOut { signOut }",we=`
|
|
181
|
+
mutation RefreshToken($token: String!) {
|
|
182
|
+
refreshToken(token: $token) { accessToken refreshToken expiresIn }
|
|
183
|
+
}
|
|
184
|
+
`;async function ye(s,p){if(s.length===0)throw new o("No workspaces to choose from");if(p.preferredId){let g=s.find(f=>f.id===p.preferredId);if(!g)throw new o(`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$1=await p.ask(`
|
|
185
|
+
Select workspace [1-${s.length}]: `),c=o$1===null?-1:parseInt(o$1.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$1(new Date(o.expiresAt).toISOString()):"-",h=o?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",e=o?.workspaceTokenExpiresAt?q$1(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$1=v();if(i.workspace){if(!o$1?.workspaceToken)throw new o(`No workspace token. Set a workspace: ${u().productName} workspace set <id>`);process.stdout.write(o$1.workspaceToken);return}if(!o$1?.accessToken)throw new o(`Not authenticated. Run: ${u().productName} auth login`);process.stdout.write(o$1.accessToken);}),p.command("refresh").description("Force token refresh").action(async()=>{try{let i=v();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new o(`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$1=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),c=await new Promise(k=>{o$1.question("Client ID: ",A=>k(A.trim()));}),u=await new Promise(k=>{o$1.question("Client Secret: ",A=>{o$1.close(),k(A.trim());});});if(!c||!u)throw new o("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 o("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$1(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$1(n.lastActivityAt),String(!!n.isCurrent)])});}catch(t){h(t);}});let o$2=s.command("mfa").description("Multi-factor authentication");o$2.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$1(n.createdAt)])});}catch(t){h(t);}}),o$2.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$1(t.setupMFA),m("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(t){h(t);}}),o$2.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$2.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$1(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$1(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$1(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 o(`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$1(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 o("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$1(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 o(`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 o("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 q("auth command group missing after registerAuthCommands");Ue(i);}},Qe=_e;export{Qe as default};
|
|
@@ -102,4 +102,4 @@
|
|
|
102
102
|
id name limits currentUsageSum reusable
|
|
103
103
|
}
|
|
104
104
|
}
|
|
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
|
|
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 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 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);}}),h.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);}}),h.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 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 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);}}),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 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);}}),y.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,4 +1,4 @@
|
|
|
1
|
-
import {a,c,h as h$1,
|
|
1
|
+
import {a,c,i,r,p,q as q$1,h as h$1,k,m}from'../../chunk-O6UCQ5IT.js';import {o}from'../../chunk-YIY5IDXQ.js';var y=`
|
|
2
2
|
query GetDefaultBillingAccount {
|
|
3
3
|
getDefaultBillingAccount {
|
|
4
4
|
id creditAmount currency
|
|
@@ -102,4 +102,4 @@ import {a,c,h as h$1,p,n,o,g,i,k}from'../../chunk-W4JZR7RJ.js';import {o as o$1}
|
|
|
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 o
|
|
105
|
+
`;async function s(){let u=await c(y);if(!u.getDefaultBillingAccount?.id)throw new o("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 o(`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 o(`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 o(`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 o(`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};
|