@burdenoff/cli-sdk 2026.504.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.
- package/README.md +60 -0
- package/dist/chunk-KTKHJORN.js +1 -0
- package/dist/chunk-MRONTCXQ.js +879 -0
- package/dist/chunk-RNWXATAC.js +32 -0
- package/dist/core/index.cjs +32 -0
- package/dist/core/index.d.cts +57 -0
- package/dist/core/index.d.ts +57 -0
- package/dist/core/index.js +1 -0
- package/dist/index.cjs +32 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/module-Bv5zhYt2.d.cts +166 -0
- package/dist/module-Bv5zhYt2.d.ts +166 -0
- package/dist/modules/auth/index.cjs +183 -0
- package/dist/modules/auth/index.d.cts +7 -0
- package/dist/modules/auth/index.d.ts +7 -0
- package/dist/modules/auth/index.js +160 -0
- package/dist/modules/billing/index.cjs +105 -0
- package/dist/modules/billing/index.d.cts +7 -0
- package/dist/modules/billing/index.d.ts +7 -0
- package/dist/modules/billing/index.js +105 -0
- package/dist/modules/channels/index.cjs +70 -0
- package/dist/modules/channels/index.d.cts +7 -0
- package/dist/modules/channels/index.d.ts +7 -0
- package/dist/modules/channels/index.js +70 -0
- package/dist/modules/conversations/index.cjs +37 -0
- package/dist/modules/conversations/index.d.cts +7 -0
- package/dist/modules/conversations/index.d.ts +7 -0
- package/dist/modules/conversations/index.js +37 -0
- package/dist/modules/devportal/index.cjs +133 -0
- package/dist/modules/devportal/index.d.cts +7 -0
- package/dist/modules/devportal/index.d.ts +7 -0
- package/dist/modules/devportal/index.js +133 -0
- package/dist/modules/export/index.cjs +37 -0
- package/dist/modules/export/index.d.cts +7 -0
- package/dist/modules/export/index.d.ts +7 -0
- package/dist/modules/export/index.js +37 -0
- package/dist/modules/files/index.cjs +49 -0
- package/dist/modules/files/index.d.cts +7 -0
- package/dist/modules/files/index.d.ts +7 -0
- package/dist/modules/files/index.js +49 -0
- package/dist/modules/groups/index.cjs +67 -0
- package/dist/modules/groups/index.d.cts +7 -0
- package/dist/modules/groups/index.d.ts +7 -0
- package/dist/modules/groups/index.js +67 -0
- package/dist/modules/health/index.cjs +1 -0
- package/dist/modules/health/index.d.cts +7 -0
- package/dist/modules/health/index.d.ts +7 -0
- package/dist/modules/health/index.js +1 -0
- package/dist/modules/integrations/index.cjs +44 -0
- package/dist/modules/integrations/index.d.cts +7 -0
- package/dist/modules/integrations/index.d.ts +7 -0
- package/dist/modules/integrations/index.js +44 -0
- package/dist/modules/notifications/index.cjs +26 -0
- package/dist/modules/notifications/index.d.cts +7 -0
- package/dist/modules/notifications/index.d.ts +7 -0
- package/dist/modules/notifications/index.js +26 -0
- package/dist/modules/organizations/index.cjs +53 -0
- package/dist/modules/organizations/index.d.cts +7 -0
- package/dist/modules/organizations/index.d.ts +7 -0
- package/dist/modules/organizations/index.js +53 -0
- package/dist/modules/products/index.cjs +102 -0
- package/dist/modules/products/index.d.cts +7 -0
- package/dist/modules/products/index.d.ts +7 -0
- package/dist/modules/products/index.js +102 -0
- package/dist/modules/rbac/index.cjs +63 -0
- package/dist/modules/rbac/index.d.cts +7 -0
- package/dist/modules/rbac/index.d.ts +7 -0
- package/dist/modules/rbac/index.js +63 -0
- package/dist/modules/sandbox/index.cjs +33 -0
- package/dist/modules/sandbox/index.d.cts +7 -0
- package/dist/modules/sandbox/index.d.ts +7 -0
- package/dist/modules/sandbox/index.js +1 -0
- package/dist/modules/scheduler/index.cjs +32 -0
- package/dist/modules/scheduler/index.d.cts +7 -0
- package/dist/modules/scheduler/index.d.ts +7 -0
- package/dist/modules/scheduler/index.js +32 -0
- package/dist/modules/security/index.cjs +69 -0
- package/dist/modules/security/index.d.cts +7 -0
- package/dist/modules/security/index.d.ts +7 -0
- package/dist/modules/security/index.js +69 -0
- package/dist/modules/store/index.cjs +63 -0
- package/dist/modules/store/index.d.cts +7 -0
- package/dist/modules/store/index.d.ts +7 -0
- package/dist/modules/store/index.js +63 -0
- package/dist/modules/support/index.cjs +45 -0
- package/dist/modules/support/index.d.cts +7 -0
- package/dist/modules/support/index.d.ts +7 -0
- package/dist/modules/support/index.js +45 -0
- package/dist/modules/tags/index.cjs +54 -0
- package/dist/modules/tags/index.d.cts +7 -0
- package/dist/modules/tags/index.d.ts +7 -0
- package/dist/modules/tags/index.js +54 -0
- package/dist/modules/tours/index.cjs +48 -0
- package/dist/modules/tours/index.d.cts +7 -0
- package/dist/modules/tours/index.d.ts +7 -0
- package/dist/modules/tours/index.js +48 -0
- package/dist/modules/vibecontrols/index.cjs +844 -0
- package/dist/modules/vibecontrols/index.d.cts +7 -0
- package/dist/modules/vibecontrols/index.d.ts +7 -0
- package/dist/modules/vibecontrols/index.js +2 -0
- package/dist/modules/workspaces/index.cjs +90 -0
- package/dist/modules/workspaces/index.d.cts +7 -0
- package/dist/modules/workspaces/index.d.ts +7 -0
- package/dist/modules/workspaces/index.js +77 -0
- package/package.json +104 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var p=class extends Error{exitCode;hint;constructor(i,d){super(i),this.name="CliUserError",this.exitCode=d?.exitCode??1,this.hint=d?.hint;}};var l=class extends Error{cause;constructor(i,d){super(i),this.name="CliInternalError",this.cause=d;}};var b=null;function D(r){b=r;}function g(){if(!b)throw new l("vibecontrols module helpers used before setHelpersContext was called");return b}async function s(r,i){return g().gql.global.request(r,i)}function a(r){let i=r instanceof Error?r.message:String(r);throw new p(i)}function c(r,i,d){g().output.formatAndOutput(r,i,d);}function f(r){g().output.printSuccess(r);}function P(r){g().output.printInfo(r);}function x(r){return g().output.formatStatus(r)}function I(r){return g().output.formatDate(r)}function m(r,i){return g().output.truncate(r,i)}var k=`
|
|
2
|
+
query GetDefaultBillingAccount {
|
|
3
|
+
getDefaultBillingAccount {
|
|
4
|
+
id creditAmount currency
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`,O=`
|
|
8
|
+
query GetActiveSubscriptions($billingAccountId: ID!) {
|
|
9
|
+
getActiveSubscriptions(billingAccountId: $billingAccountId) {
|
|
10
|
+
id status seatCount nextBillingDate
|
|
11
|
+
plan { name price currency }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`,R=`
|
|
15
|
+
query GetSubscription($id: ID!) {
|
|
16
|
+
getSubscription(id: $id) {
|
|
17
|
+
id status startDate endDate seatCount billingAccountId
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`,_=`
|
|
21
|
+
mutation UpdateSubscriptionSeats($input: UpdateSubscriptionSeatsInput!) {
|
|
22
|
+
updateSubscriptionSeats(input: $input) {
|
|
23
|
+
id seatCount lastSeatChangeAt
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,$=`
|
|
27
|
+
mutation CancelSubscription($input: CancelSubscriptionInput!) {
|
|
28
|
+
cancelSubscription(input: $input) {
|
|
29
|
+
id status canceledAt cancellationReason
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,L=`
|
|
33
|
+
query GetAllPlans($filter: PlansFilter) {
|
|
34
|
+
getAllPlans(filter: $filter) {
|
|
35
|
+
id name price currency duration pricingModel
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`,N=`
|
|
39
|
+
query GetPlan($id: ID!) {
|
|
40
|
+
getPlan(id: $id) {
|
|
41
|
+
id name price pricePerSeat minSeats maxSeats isActive
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,q=`
|
|
45
|
+
query GetAllAddOns($filter: AddonsFilter, $limit: Int) {
|
|
46
|
+
getAllAddOns(filter: $filter, limit: $limit) {
|
|
47
|
+
id name price currency duration isActive
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`,G=`
|
|
51
|
+
query GetPaginatedInvoices($billingAccountId: ID!, $page: Int, $pageSize: Int) {
|
|
52
|
+
getPaginatedInvoices(billingAccountId: $billingAccountId, page: $page, pageSize: $pageSize) {
|
|
53
|
+
invoices { id invoiceNumber status total currency paidAt pdfUrl }
|
|
54
|
+
totalCount hasMore
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,A=`
|
|
58
|
+
query GetInvoice($id: ID!) {
|
|
59
|
+
getInvoice(id: $id) {
|
|
60
|
+
id invoiceNumber status subtotal tax total
|
|
61
|
+
items { description amount }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`,M=`
|
|
65
|
+
query GetPaymentMethods($billingAccountId: ID!) {
|
|
66
|
+
getPaymentMethods(billingAccountId: $billingAccountId) {
|
|
67
|
+
id type last4 expiryYear brand isDefault isVerified
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`,U=`
|
|
71
|
+
mutation AddPaymentMethod($input: CreatePaymentMethodInput!) {
|
|
72
|
+
addPaymentMethod(input: $input) {
|
|
73
|
+
id type isDefault isVerified
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,F=`
|
|
77
|
+
mutation DeletePaymentMethod($id: ID!) {
|
|
78
|
+
deletePaymentMethod(id: $id) { success }
|
|
79
|
+
}
|
|
80
|
+
`,B=`
|
|
81
|
+
mutation GrantCredits($input: GrantCreditsInput!) {
|
|
82
|
+
grantCredits(input: $input) {
|
|
83
|
+
id amount status type
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`,W=`
|
|
87
|
+
mutation RequestCreditWithdrawal($input: RequestCreditWithdrawalInput!) {
|
|
88
|
+
requestCreditWithdrawal(input: $input) {
|
|
89
|
+
id status amount
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`,j=`
|
|
93
|
+
query GetPendingRefunds($page: Int, $pageSize: Int) {
|
|
94
|
+
getPendingRefunds(page: $page, pageSize: $pageSize) {
|
|
95
|
+
records { id amount status source createdAt }
|
|
96
|
+
totalCount
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`,V=`
|
|
100
|
+
query GetQuotas($subscriptionId: ID!) {
|
|
101
|
+
getAllQuotasOfSub(subscriptionId: $subscriptionId) {
|
|
102
|
+
id name limits currentUsageSum reusable
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;async function w(){let r=await s(k);if(!r.getDefaultBillingAccount?.id)throw new p("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"),d=i.command("subscriptions").description("Subscriptions");d.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(O,{billingAccountId:e});c(t,n.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:n.getActiveSubscriptions.map(o=>[m(o.id,12),x(o.status),o.plan?.name??"-",String(o.seatCount??"-"),I(o.nextBillingDate)])});}catch(e){a(e);}}),d.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(R,{id:t});if(!n.getSubscription)throw new p(`Subscription ${t} not found`);c(e,n.getSubscription);}catch(n){a(n);}}),d.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});f(`Seat count updated to ${o.updateSubscriptionSeats.seatCount}`),c(e,o.updateSubscriptionSeats);}catch(n){a(n);}}),d.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});f("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=>[m(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 p(`Plan ${t} not found`);c(e,n.getPlan);}catch(n){a(n);}}),i.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.product&&(e.productId=t.product);let n=await s(q,{filter:Object.keys(e).length?e:void 0,limit:t.limit});c(t,n.getAllAddOns);}catch(e){a(e);}});let y=i.command("invoices").description("Invoices");y.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=t.account??await w(),n=await s(G,{billingAccountId:e,page:t.page,pageSize:t.pageSize});c(t,n.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:n.getPaginatedInvoices.invoices.map(o=>[m(o.id,12),o.invoiceNumber??"-",x(o.status),String(o.total??"-"),o.currency??"-",I(o.paidAt)])});}catch(e){a(e);}}),y.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(A,{id:t});if(!n.getInvoice)throw new p(`Invoice ${t} not found`);c(e,n.getInvoice);}catch(n){a(n);}}),y.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let e=await s(A,{id:t});if(!e.getInvoice?.pdfUrl)throw new p(`Invoice ${t} has no pdfUrl`);P("PDF URL:"),console.log(e.getInvoice.pdfUrl);}catch(e){a(e);}});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 w(),n=await s(M,{billingAccountId:e});c(t,n.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:n.getPaymentMethods.map(o=>[m(o.id,12),o.type,o.brand??"-",o.last4??"-",String(!!o.isDefault),String(!!o.isVerified)])});}catch(e){a(e);}}),h.command("add").description("Add a payment method (card metadata only \u2014 providers handle secrets)").requiredOption("--type <t>","CREDIT_CARD|BANK|UPI","CREDIT_CARD").requiredOption("--last4 <s>").option("--brand <s>","Visa|MasterCard|...").option("--expiry-month <n>","",t=>parseInt(t,10)).option("--expiry-year <n>","",t=>parseInt(t,10)).option("--account <id>").option("--default","Make it the default").option("-f, --format <format>").action(async t=>{try{let n={billingAccountId:t.account??await w(),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});f("Payment method added"),c(t,o.addPaymentMethod);}catch(e){a(e);}}),h.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await s(F,{id:t}),f("Payment method removed");}catch(e){a(e);}});let C=i.command("credits").description("Credits & withdrawal");C.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let e=await s(k);c(t,e.getDefaultBillingAccount);}catch(e){a(e);}}),C.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let e={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await s(B,{input:e}),f("Credits granted");}catch(e){a(e);}}),C.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let e={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await s(W,{input:e}),f("Withdrawal requested");}catch(e){a(e);}}),i.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let e=await s(j,{page:t.page,pageSize:t.pageSize});c(t,e.getPendingRefunds.records);}catch(e){a(e);}}),i.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,e)=>{try{let n=await s(V,{subscriptionId:t});c(e,n.getAllQuotasOfSub);}catch(n){a(n);}});}var it={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(r,i){D(i),z(r);}},we=it;module.exports=we;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {a,c,g,o,m as m$1,n,f,h as h$1,j}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';var A=`
|
|
2
|
+
query GetDefaultBillingAccount {
|
|
3
|
+
getDefaultBillingAccount {
|
|
4
|
+
id creditAmount currency
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
`,D=`
|
|
8
|
+
query GetActiveSubscriptions($billingAccountId: ID!) {
|
|
9
|
+
getActiveSubscriptions(billingAccountId: $billingAccountId) {
|
|
10
|
+
id status seatCount nextBillingDate
|
|
11
|
+
plan { name price currency }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`,h=`
|
|
15
|
+
query GetSubscription($id: ID!) {
|
|
16
|
+
getSubscription(id: $id) {
|
|
17
|
+
id status startDate endDate seatCount billingAccountId
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`,_=`
|
|
21
|
+
mutation UpdateSubscriptionSeats($input: UpdateSubscriptionSeatsInput!) {
|
|
22
|
+
updateSubscriptionSeats(input: $input) {
|
|
23
|
+
id seatCount lastSeatChangeAt
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,R=`
|
|
27
|
+
mutation CancelSubscription($input: CancelSubscriptionInput!) {
|
|
28
|
+
cancelSubscription(input: $input) {
|
|
29
|
+
id status canceledAt cancellationReason
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,N=`
|
|
33
|
+
query GetAllPlans($filter: PlansFilter) {
|
|
34
|
+
getAllPlans(filter: $filter) {
|
|
35
|
+
id name price currency duration pricingModel
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`,v=`
|
|
39
|
+
query GetPlan($id: ID!) {
|
|
40
|
+
getPlan(id: $id) {
|
|
41
|
+
id name price pricePerSeat minSeats maxSeats isActive
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,G=`
|
|
45
|
+
query GetAllAddOns($filter: AddonsFilter, $limit: Int) {
|
|
46
|
+
getAllAddOns(filter: $filter, limit: $limit) {
|
|
47
|
+
id name price currency duration isActive
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`,O=`
|
|
51
|
+
query GetPaginatedInvoices($billingAccountId: ID!, $page: Int, $pageSize: Int) {
|
|
52
|
+
getPaginatedInvoices(billingAccountId: $billingAccountId, page: $page, pageSize: $pageSize) {
|
|
53
|
+
invoices { id invoiceNumber status total currency paidAt pdfUrl }
|
|
54
|
+
totalCount hasMore
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,S=`
|
|
58
|
+
query GetInvoice($id: ID!) {
|
|
59
|
+
getInvoice(id: $id) {
|
|
60
|
+
id invoiceNumber status subtotal tax total
|
|
61
|
+
items { description amount }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`,$=`
|
|
65
|
+
query GetPaymentMethods($billingAccountId: ID!) {
|
|
66
|
+
getPaymentMethods(billingAccountId: $billingAccountId) {
|
|
67
|
+
id type last4 expiryYear brand isDefault isVerified
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`,x=`
|
|
71
|
+
mutation AddPaymentMethod($input: CreatePaymentMethodInput!) {
|
|
72
|
+
addPaymentMethod(input: $input) {
|
|
73
|
+
id type isDefault isVerified
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`,M=`
|
|
77
|
+
mutation DeletePaymentMethod($id: ID!) {
|
|
78
|
+
deletePaymentMethod(id: $id) { success }
|
|
79
|
+
}
|
|
80
|
+
`,L=`
|
|
81
|
+
mutation GrantCredits($input: GrantCreditsInput!) {
|
|
82
|
+
grantCredits(input: $input) {
|
|
83
|
+
id amount status type
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`,U=`
|
|
87
|
+
mutation RequestCreditWithdrawal($input: RequestCreditWithdrawalInput!) {
|
|
88
|
+
requestCreditWithdrawal(input: $input) {
|
|
89
|
+
id status amount
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`,B=`
|
|
93
|
+
query GetPendingRefunds($page: Int, $pageSize: Int) {
|
|
94
|
+
getPendingRefunds(page: $page, pageSize: $pageSize) {
|
|
95
|
+
records { id amount status source createdAt }
|
|
96
|
+
totalCount
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`,q=`
|
|
100
|
+
query GetQuotas($subscriptionId: ID!) {
|
|
101
|
+
getAllQuotasOfSub(subscriptionId: $subscriptionId) {
|
|
102
|
+
id name limits currentUsageSum reusable
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
`;async function m(){let d=await c(A);if(!d.getDefaultBillingAccount?.id)throw new o$1("No default billing account on file. Pass --account <id> explicitly.");return d.getDefaultBillingAccount.id}function z(d){let s=d.command("billing").description("Billing: subscriptions, invoices, credits"),l=s.command("subscriptions").description("Subscriptions");l.command("list").description("List active subscriptions").option("--account <id>","Billing account id (defaults to current)").option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(D,{billingAccountId:n$1});g(t,i.getActiveSubscriptions,{headers:["ID","Status","Plan","Seats","NextBilling"],rows:i.getActiveSubscriptions.map(e=>[o(e.id,12),m$1(e.status),e.plan?.name??"-",String(e.seatCount??"-"),n(e.nextBillingDate)])});}catch(n){f(n);}}),l.command("get").description("Get a subscription").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(h,{id:t});if(!i.getSubscription)throw new o$1(`Subscription ${t} not found`);g(n,i.getSubscription);}catch(i){f(i);}}),l.command("upgrade").description("Change subscription seat count").argument("<id>").requiredOption("--seats <n>","Target seat count",t=>parseInt(t,10)).option("-f, --format <format>").action(async(t,n)=>{try{let i={subscriptionId:t,seatCount:n.seats},e=await c(_,{input:i});h$1(`Seat count updated to ${e.updateSubscriptionSeats.seatCount}`),g(n,e.updateSubscriptionSeats);}catch(i){f(i);}}),l.command("cancel").description("Cancel a subscription").argument("<id>").option("--reason <s>").action(async(t,n)=>{try{let i={subscriptionId:t,reason:n.reason},e=await c(R,{input:i});h$1("Subscription canceled"),g({},e.cancelSubscription);}catch(i){f(i);}});let P=s.command("plans").description("Plans");P.command("list").description("List available plans").option("--product <id>").option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(N,{filter:Object.keys(n).length?n:void 0});g(t,i.getAllPlans,{headers:["ID","Name","Price","Currency","Duration"],rows:i.getAllPlans.map(e=>[o(e.id,12),e.name,String(e.price??"-"),e.currency??"-",e.duration??"-"])});}catch(n){f(n);}}),P.command("get").description("Get a plan").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(v,{id:t});if(!i.getPlan)throw new o$1(`Plan ${t} not found`);g(n,i.getPlan);}catch(i){f(i);}}),s.command("addons").description("Addons").command("list").description("List addons").option("--product <id>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.product&&(n.productId=t.product);let i=await c(G,{filter:Object.keys(n).length?n:void 0,limit:t.limit});g(t,i.getAllAddOns);}catch(n){f(n);}});let g$1=s.command("invoices").description("Invoices");g$1.command("list").description("List invoices").option("--account <id>").option("--page <n>","",t=>parseInt(t,10),1).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n$1=t.account??await m(),i=await c(O,{billingAccountId:n$1,page:t.page,pageSize:t.pageSize});g(t,i.getPaginatedInvoices.invoices,{headers:["ID","#","Status","Total","Currency","Paid"],rows:i.getPaginatedInvoices.invoices.map(e=>[o(e.id,12),e.invoiceNumber??"-",m$1(e.status),String(e.total??"-"),e.currency??"-",n(e.paidAt)])});}catch(n){f(n);}}),g$1.command("get").description("Get an invoice").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(S,{id:t});if(!i.getInvoice)throw new o$1(`Invoice ${t} not found`);g(n,i.getInvoice);}catch(i){f(i);}}),g$1.command("download").description("Print invoice PDF URL (browser-only download)").argument("<id>").action(async t=>{try{let n=await c(S,{id:t});if(!n.getInvoice?.pdfUrl)throw new o$1(`Invoice ${t} has no pdfUrl`);j("PDF URL:"),console.log(n.getInvoice.pdfUrl);}catch(n){f(n);}});let f$1=s.command("payment-methods").description("Payment methods");f$1.command("list").description("List payment methods").option("--account <id>").option("-f, --format <format>").action(async t=>{try{let n=t.account??await m(),i=await c($,{billingAccountId:n});g(t,i.getPaymentMethods,{headers:["ID","Type","Brand","Last4","Default","Verified"],rows:i.getPaymentMethods.map(e=>[o(e.id,12),e.type,e.brand??"-",e.last4??"-",String(!!e.isDefault),String(!!e.isVerified)])});}catch(n){f(n);}}),f$1.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={billingAccountId:t.account??await m(),type:t.type.toUpperCase(),last4:t.last4,brand:t.brand,expiryMonth:t.expiryMonth,expiryYear:t.expiryYear,isDefault:!!t.default},e=await c(x,{input:i});h$1("Payment method added"),g(t,e.addPaymentMethod);}catch(n){f(n);}}),f$1.command("remove").description("Remove a payment method").argument("<id>").action(async t=>{try{await c(M,{id:t}),h$1("Payment method removed");}catch(n){f(n);}});let I=s.command("credits").description("Credits & withdrawal");I.command("balance").description("Show current credit balance").option("-f, --format <format>").action(async t=>{try{let n=await c(A);g(t,n.getDefaultBillingAccount);}catch(n){f(n);}}),I.command("grant").description("Grant credits to a billing account (admin)").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).option("--reason <s>").action(async t=>{try{let n={billingAccountId:t.account,amount:t.amount,reason:t.reason??"cli-grant"};await c(L,{input:n}),h$1("Credits granted");}catch(n){f(n);}}),I.command("withdraw").description("Request a credit withdrawal").requiredOption("--account <id>").requiredOption("--amount <n>","Amount",t=>parseFloat(t)).requiredOption("--payout <id>","Payout account id").action(async t=>{try{let n={billingAccountId:t.account,creditAmount:t.amount,payoutAccountId:t.payout};await c(U,{input:n}),h$1("Withdrawal requested");}catch(n){f(n);}}),s.command("refunds").description("Pending refunds").option("--page <n>","",t=>parseInt(t,10),0).option("--page-size <n>","",t=>parseInt(t,10),20).option("-f, --format <format>").action(async t=>{try{let n=await c(B,{page:t.page,pageSize:t.pageSize});g(t,n.getPendingRefunds.records);}catch(n){f(n);}}),s.command("quota").description("Quotas for a subscription").argument("<subscriptionId>").option("-f, --format <format>").action(async(t,n)=>{try{let i=await c(q,{subscriptionId:t});g(n,i.getAllQuotasOfSub);}catch(i){f(i);}});}var V={id:"billing",version:"1.0.0",displayName:"Billing",dependsOn:["auth"],register(d,s){a(s),z(d);}},J=V;export{J as default};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var l=class extends Error{exitCode;hint;constructor(o,p){super(o),this.name="CliUserError",this.exitCode=p?.exitCode??1,this.hint=p?.hint;}};var d=class extends Error{cause;constructor(o,p){super(o),this.name="CliInternalError",this.cause=p;}};var h=null;function E(r){h=r;}function g(){if(!h)throw new d("vibecontrols module helpers used before setHelpersContext was called");return h}async function a(r,o){return g().gql.global.request(r,o)}function c(r){let o=r instanceof Error?r.message:String(r);throw new l(o)}function u(r,o,p){g().output.formatAndOutput(r,o,p);}function f(r){g().output.printSuccess(r);}function C(r){return g().output.formatStatus(r)}function T(r){return g().output.formatDate(r)}function w(r,o){return g().output.truncate(r,o)}function I(){return g()}var b=`
|
|
2
|
+
query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {
|
|
3
|
+
getChannels(filter: $filter, pagination: $pagination) {
|
|
4
|
+
items { id name platform adapterType status connectionHealth priority createdAt }
|
|
5
|
+
total hasMore
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
`,A=`
|
|
9
|
+
query GetChannel($id: ID!) {
|
|
10
|
+
getChannel(id: $id) {
|
|
11
|
+
id name platform adapterType status channelType
|
|
12
|
+
connection { id authType isActive isHealthy }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,v=`
|
|
16
|
+
mutation CreateChannel($input: CreateChannelInput!) {
|
|
17
|
+
createChannel(input: $input) {
|
|
18
|
+
id name platform adapterType status
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`,S=`
|
|
22
|
+
mutation DeleteChannel($id: ID!) {
|
|
23
|
+
deleteChannel(id: $id)
|
|
24
|
+
}
|
|
25
|
+
`,O=`
|
|
26
|
+
mutation SendChannelMessage($input: SendMessageInput!) {
|
|
27
|
+
sendMessage(input: $input) {
|
|
28
|
+
success messageId status sentAt
|
|
29
|
+
error { code message retryable }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,N=`
|
|
33
|
+
query GetChannelDeliveryAttempts($channelId: ID!, $cursor: String, $limit: Int) {
|
|
34
|
+
getChannelDeliveryAttempts(channelId: $channelId, cursor: $cursor, limit: $limit) {
|
|
35
|
+
items { id channelId status sentAt retryCount errorMessage }
|
|
36
|
+
total hasMore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`,$=`
|
|
40
|
+
query ListChannelUsers($channelId: ID!, $pagination: ChannelPaginationInput) {
|
|
41
|
+
listUserPlatformConnectionsByChannel(channelId: $channelId, pagination: $pagination) {
|
|
42
|
+
items { id externalUserId externalDisplayName platform dmAllowed presenceStatus }
|
|
43
|
+
total hasMore
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,D=`
|
|
47
|
+
query GetChannelWebhookEvents($channelId: ID!, $cursor: String, $limit: Int) {
|
|
48
|
+
getChannelWebhookEvents(channelId: $channelId, cursor: $cursor, limit: $limit) {
|
|
49
|
+
items { id eventType status createdAt }
|
|
50
|
+
total hasMore
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`,L=`
|
|
54
|
+
query GetConnectionsByOrg($organizationId: ID!, $pagination: ChannelPaginationInput) {
|
|
55
|
+
getConnectionsByOrganization(organizationId: $organizationId, pagination: $pagination) {
|
|
56
|
+
items { id channelId authType tokenExpiresAt isActive isHealthy }
|
|
57
|
+
total hasMore
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`,R=`
|
|
61
|
+
mutation CreateChannelConnection($input: CreateConnectionInput!) {
|
|
62
|
+
createConnection(input: $input) {
|
|
63
|
+
id channelId authType isActive
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`,_=`
|
|
67
|
+
mutation DeleteChannelConnection($id: ID!) {
|
|
68
|
+
deleteConnection(id: $id)
|
|
69
|
+
}
|
|
70
|
+
`;function q(r){let o=r.command("channels").description("Multi-platform message channels (email/SMS/Slack/etc.)");o.command("list").description("List channels").option("--platform <p>").option("--status <s>").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.platform&&(t.platform=e.platform.toUpperCase()),e.status&&(t.status=e.status.toUpperCase());let n=await a(b,{filter:Object.keys(t).length?t:void 0,pagination:{limit:e.limit,offset:0}});u(e,n.getChannels.items,{headers:["ID","Name","Platform","Status","Priority"],rows:n.getChannels.items.map(i=>[w(i.id,12),i.name,i.platform,C(i.status),String(i.priority??"-")])});}catch(t){c(t);}}),o.command("get").description("Get a channel").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await a(A,{id:e});if(!n.getChannel)throw new l(`Channel ${e} not found`);u(t,n.getChannel);}catch(n){c(n);}}),o.command("create").description("Create a channel").requiredOption("--name <s>").requiredOption("--platform <p>","EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK").option("--organization <id>","Organization id (defaults to current actor org)").option("--adapter <t>").option("-f, --format <format>").action(async e=>{try{let t=e.organization??I().auth.read()?.organizationId;if(!t)throw new l("No organization context. Pass --organization <id> or set auth.organizationId.");let n={name:e.name,platform:e.platform.toUpperCase(),organizationId:t,adapterType:e.adapter?e.adapter.toUpperCase():void 0},i=await a(v,{input:n});f("Channel created"),u(e,i.createChannel);}catch(t){c(t);}}),o.command("delete").description("Delete a channel").argument("<id>").action(async e=>{try{await a(S,{id:e}),f("Channel deleted");}catch(t){c(t);}}),o.command("send").description("Send a message via a channel").argument("<channelId>").requiredOption("--content <s>").option("--recipient <id>","External recipient id (e.g. email)").option("--subject <s>").option("-f, --format <format>").action(async(e,t)=>{try{let n={channelId:e,content:t.content,recipientId:t.recipient,subject:t.subject},i=await a(O,{input:n});i.sendMessage.success&&f(`Sent: ${i.sendMessage.messageId??"(no id)"}`),u(t,i.sendMessage);}catch(n){c(n);}}),o.command("deliveries").description("Recent delivery attempts for a channel").argument("<channelId>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async(e,t)=>{try{let n=await a(N,{channelId:e,limit:t.limit});u(t,n.getChannelDeliveryAttempts.items);}catch(n){c(n);}}),o.command("users").description("Users connected to this channel").argument("<channelId>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async(e,t)=>{try{let n=await a($,{channelId:e,pagination:{limit:t.limit,offset:0}});u(t,n.listUserPlatformConnectionsByChannel.items);}catch(n){c(n);}}),o.command("webhooks").description("Channel webhook events").command("list").description("List webhook events for a channel").argument("<channelId>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async(e,t)=>{try{let n=await a(D,{channelId:e,limit:t.limit});u(t,n.getChannelWebhookEvents.items,{headers:["ID","Event","Status","When"],rows:n.getChannelWebhookEvents.items.map(i=>[w(i.id,12),i.eventType,C(i.status),T(i.createdAt)])});}catch(n){c(n);}});let m=o.command("connections").description("Channel connections (OAuth/API keys)");m.command("list").description("List connections for an organization").requiredOption("--organization <id>").option("--limit <n>","Page size",e=>parseInt(e,10),100).option("-f, --format <format>").action(async e=>{try{let t=await a(L,{organizationId:e.organization,pagination:{limit:e.limit,offset:0}});u(e,t.getConnectionsByOrganization.items);}catch(t){c(t);}}),m.command("create").description("Create a channel connection").requiredOption("--channel <id>").requiredOption("--auth-type <t>","OAUTH|API_KEY|WEBHOOK").option("-f, --format <format>").action(async e=>{try{let t={channelId:e.channel,authType:e.authType.toUpperCase()},n=await a(R,{input:t});f("Connection created"),u(e,n.createConnection);}catch(t){c(t);}}),m.command("delete").description("Delete a connection").argument("<id>").action(async e=>{try{await a(_,{id:e}),f("Connection deleted");}catch(t){c(t);}});}var Y={id:"channels",version:"1.0.0",displayName:"Channels",dependsOn:["auth"],register(r,o){E(o),q(r);}},it=Y;module.exports=it;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {a,c,g,o,m,f,r,h,n}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';var y=`
|
|
2
|
+
query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {
|
|
3
|
+
getChannels(filter: $filter, pagination: $pagination) {
|
|
4
|
+
items { id name platform adapterType status connectionHealth priority createdAt }
|
|
5
|
+
total hasMore
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
`,I=`
|
|
9
|
+
query GetChannel($id: ID!) {
|
|
10
|
+
getChannel(id: $id) {
|
|
11
|
+
id name platform adapterType status channelType
|
|
12
|
+
connection { id authType isActive isHealthy }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,N=`
|
|
16
|
+
mutation CreateChannel($input: CreateChannelInput!) {
|
|
17
|
+
createChannel(input: $input) {
|
|
18
|
+
id name platform adapterType status
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`,A=`
|
|
22
|
+
mutation DeleteChannel($id: ID!) {
|
|
23
|
+
deleteChannel(id: $id)
|
|
24
|
+
}
|
|
25
|
+
`,T=`
|
|
26
|
+
mutation SendChannelMessage($input: SendMessageInput!) {
|
|
27
|
+
sendMessage(input: $input) {
|
|
28
|
+
success messageId status sentAt
|
|
29
|
+
error { code message retryable }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,_=`
|
|
33
|
+
query GetChannelDeliveryAttempts($channelId: ID!, $cursor: String, $limit: Int) {
|
|
34
|
+
getChannelDeliveryAttempts(channelId: $channelId, cursor: $cursor, limit: $limit) {
|
|
35
|
+
items { id channelId status sentAt retryCount errorMessage }
|
|
36
|
+
total hasMore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`,S=`
|
|
40
|
+
query ListChannelUsers($channelId: ID!, $pagination: ChannelPaginationInput) {
|
|
41
|
+
listUserPlatformConnectionsByChannel(channelId: $channelId, pagination: $pagination) {
|
|
42
|
+
items { id externalUserId externalDisplayName platform dmAllowed presenceStatus }
|
|
43
|
+
total hasMore
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`,O=`
|
|
47
|
+
query GetChannelWebhookEvents($channelId: ID!, $cursor: String, $limit: Int) {
|
|
48
|
+
getChannelWebhookEvents(channelId: $channelId, cursor: $cursor, limit: $limit) {
|
|
49
|
+
items { id eventType status createdAt }
|
|
50
|
+
total hasMore
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`,$=`
|
|
54
|
+
query GetConnectionsByOrg($organizationId: ID!, $pagination: ChannelPaginationInput) {
|
|
55
|
+
getConnectionsByOrganization(organizationId: $organizationId, pagination: $pagination) {
|
|
56
|
+
items { id channelId authType tokenExpiresAt isActive isHealthy }
|
|
57
|
+
total hasMore
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`,L=`
|
|
61
|
+
mutation CreateChannelConnection($input: CreateConnectionInput!) {
|
|
62
|
+
createConnection(input: $input) {
|
|
63
|
+
id channelId authType isActive
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`,w=`
|
|
67
|
+
mutation DeleteChannelConnection($id: ID!) {
|
|
68
|
+
deleteConnection(id: $id)
|
|
69
|
+
}
|
|
70
|
+
`;function H(m$1){let r$1=m$1.command("channels").description("Multi-platform message channels (email/SMS/Slack/etc.)");r$1.command("list").description("List channels").option("--platform <p>").option("--status <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let n={};t.platform&&(n.platform=t.platform.toUpperCase()),t.status&&(n.status=t.status.toUpperCase());let e=await c(y,{filter:Object.keys(n).length?n:void 0,pagination:{limit:t.limit,offset:0}});g(t,e.getChannels.items,{headers:["ID","Name","Platform","Status","Priority"],rows:e.getChannels.items.map(a=>[o(a.id,12),a.name,a.platform,m(a.status),String(a.priority??"-")])});}catch(n){f(n);}}),r$1.command("get").description("Get a channel").argument("<id>").option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(I,{id:t});if(!e.getChannel)throw new o$1(`Channel ${t} not found`);g(n,e.getChannel);}catch(e){f(e);}}),r$1.command("create").description("Create a channel").requiredOption("--name <s>").requiredOption("--platform <p>","EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK").option("--organization <id>","Organization id (defaults to current actor org)").option("--adapter <t>").option("-f, --format <format>").action(async t=>{try{let n=t.organization??r().auth.read()?.organizationId;if(!n)throw new o$1("No organization context. Pass --organization <id> or set auth.organizationId.");let e={name:t.name,platform:t.platform.toUpperCase(),organizationId:n,adapterType:t.adapter?t.adapter.toUpperCase():void 0},a=await c(N,{input:e});h("Channel created"),g(t,a.createChannel);}catch(n){f(n);}}),r$1.command("delete").description("Delete a channel").argument("<id>").action(async t=>{try{await c(A,{id:t}),h("Channel deleted");}catch(n){f(n);}}),r$1.command("send").description("Send a message via a channel").argument("<channelId>").requiredOption("--content <s>").option("--recipient <id>","External recipient id (e.g. email)").option("--subject <s>").option("-f, --format <format>").action(async(t,n)=>{try{let e={channelId:t,content:n.content,recipientId:n.recipient,subject:n.subject},a=await c(T,{input:e});a.sendMessage.success&&h(`Sent: ${a.sendMessage.messageId??"(no id)"}`),g(n,a.sendMessage);}catch(e){f(e);}}),r$1.command("deliveries").description("Recent delivery attempts for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(_,{channelId:t,limit:n.limit});g(n,e.getChannelDeliveryAttempts.items);}catch(e){f(e);}}),r$1.command("users").description("Users connected to this channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n)=>{try{let e=await c(S,{channelId:t,pagination:{limit:n.limit,offset:0}});g(n,e.listUserPlatformConnectionsByChannel.items);}catch(e){f(e);}}),r$1.command("webhooks").description("Channel webhook events").command("list").description("List webhook events for a channel").argument("<channelId>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async(t,n$1)=>{try{let e=await c(O,{channelId:t,limit:n$1.limit});g(n$1,e.getChannelWebhookEvents.items,{headers:["ID","Event","Status","When"],rows:e.getChannelWebhookEvents.items.map(a=>[o(a.id,12),a.eventType,m(a.status),n(a.createdAt)])});}catch(e){f(e);}});let l=r$1.command("connections").description("Channel connections (OAuth/API keys)");l.command("list").description("List connections for an organization").requiredOption("--organization <id>").option("--limit <n>","Page size",t=>parseInt(t,10),100).option("-f, --format <format>").action(async t=>{try{let n=await c($,{organizationId:t.organization,pagination:{limit:t.limit,offset:0}});g(t,n.getConnectionsByOrganization.items);}catch(n){f(n);}}),l.command("create").description("Create a channel connection").requiredOption("--channel <id>").requiredOption("--auth-type <t>","OAUTH|API_KEY|WEBHOOK").option("-f, --format <format>").action(async t=>{try{let n={channelId:t.channel,authType:t.authType.toUpperCase()},e=await c(L,{input:n});h("Connection created"),g(t,e.createConnection);}catch(n){f(n);}}),l.command("delete").description("Delete a connection").argument("<id>").action(async t=>{try{await c(w,{id:t}),h("Connection deleted");}catch(n){f(n);}});}var D={id:"channels",version:"1.0.0",displayName:"Channels",dependsOn:["auth"],register(m,r){a(r),H(m);}},P=D;export{P as default};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var s=class extends Error{exitCode;hint;constructor(r,e){super(r),this.name="CliUserError",this.exitCode=e?.exitCode??1,this.hint=e?.hint;}},g=class extends s{constructor(r,e){super(r,{exitCode:2,hint:e?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},u=class extends Error{cause;constructor(r,e){super(r),this.name="CliInternalError",this.cause=e;}};var C=null;function k(t){C=t;}function p(){if(!C)throw new u("vibecontrols module helpers used before setHelpersContext was called");return C}function j(){let t=p();if(!t.auth.isAuthenticated())throw new g(`Authentication required. Run \`${t.productName} auth login\`.`)}async function l(t,r){return j(),p().gql.workspace.request(t,r)}function d(t){let r=t instanceof Error?t.message:String(t);throw new s(r)}function f(t,r,e){p().output.formatAndOutput(t,r,e);}function m(t){p().output.printSuccess(t);}function x(t){return p().output.formatDate(t)}function y(t,r){return p().output.truncate(t,r)}function v(){return p()}var T=`
|
|
2
|
+
query ListConversations($filter: ConversationFilter, $first: Int, $after: String) {
|
|
3
|
+
conversations(filter: $filter, first: $first, after: $after) {
|
|
4
|
+
edges { node { id title type description createdAt updatedAt unreadCount } }
|
|
5
|
+
pageInfo { hasNextPage endCursor }
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
`,b=`
|
|
9
|
+
query GetConversation($id: ID!) {
|
|
10
|
+
conversation(id: $id) {
|
|
11
|
+
id title type description avatarUrl settings
|
|
12
|
+
createdAt updatedAt
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,E=`
|
|
16
|
+
mutation CreateConversation($input: CreateConversationInput!) {
|
|
17
|
+
createConversation(input: $input) {
|
|
18
|
+
conversation { id title type }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`,I=`
|
|
22
|
+
mutation DeleteConversation($id: ID!) {
|
|
23
|
+
deleteConversation(id: $id) { success }
|
|
24
|
+
}
|
|
25
|
+
`,A=`
|
|
26
|
+
mutation UpdateConversation($input: UpdateConversationInput!) {
|
|
27
|
+
updateConversation(input: $input) {
|
|
28
|
+
conversation { id title description }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`,S=`
|
|
32
|
+
mutation SendMessage($input: SendMessageInput!) {
|
|
33
|
+
sendMessage(input: $input) {
|
|
34
|
+
message { id content type createdAt }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;function O(t){let r=t.command("conversations").description("Conversation management");r.command("list").description("List conversations").option("--type <t>","Filter by type (DIRECT|GROUP|CHANNEL)").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let n={};e.type&&(n.type=e.type.toUpperCase());let a=(await l(T,{filter:Object.keys(n).length?n:void 0,first:e.limit})).conversations.edges.map(c=>c.node);f(e,a,{headers:["ID","Title","Type","Unread","Created"],rows:a.map(c=>[y(c.id,12),c.title??"-",c.type??"-",String(c.unreadCount??0),x(c.createdAt)])});}catch(n){d(n);}}),r.command("get").description("Get a conversation").argument("<id>").option("-f, --format <format>").action(async(e,n)=>{try{let o=await l(b,{id:e});if(!o.conversation)throw new s(`Conversation ${e} not found`);f(n,o.conversation);}catch(o){d(o);}}),r.command("create").description("Create a conversation").requiredOption("--title <s>").requiredOption("--participants <ids>","Comma-separated participant userIds (required by schema)").option("--description <s>").option("--type <t>","DIRECT|GROUP|CHANNEL","GROUP").option("-f, --format <format>").action(async e=>{try{let n=v().auth.read();if(!n?.workspaceId)throw new s("No workspace set. Run: vibecontrols workspace set <id>");let o={title:e.title,description:e.description,type:(e.type??"GROUP").toUpperCase(),participantIds:e.participants.split(","),workspaceId:n.workspaceId},a=await l(E,{input:o});m("Conversation created"),f(e,a.createConversation.conversation);}catch(n){d(n);}}),r.command("update").description("Update a conversation").argument("<id>").option("--title <s>").option("--description <s>").option("-f, --format <format>").action(async(e,n)=>{try{let o={id:e};if(n.title&&(o.title=n.title),n.description!==void 0&&(o.description=n.description),Object.keys(o).length===1)throw new s("No updates specified");let a=await l(A,{input:o});m("Conversation updated"),f(n,a.updateConversation.conversation);}catch(o){d(o);}}),r.command("delete").description("Delete a conversation").argument("<id>").action(async e=>{try{await l(I,{id:e}),m("Conversation deleted");}catch(n){d(n);}}),r.command("send").description("Send a message to a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>","Reply parent").option("-f, --format <format>").action(async(e,n)=>{try{let o={conversationId:e,content:{text:n.content},type:"TEXT",parentMessageId:n.parent},a=await l(S,{input:o});m("Message sent"),f(n,a.sendMessage.message);}catch(o){d(o);}});}var U={id:"conversations",version:"1.0.0",displayName:"Conversations",dependsOn:["auth","workspaces"],register(t,r){k(r),O(t);}},Ze=U;module.exports=Ze;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {a,b,g,o,n,f,r,h}from'../../chunk-KTKHJORN.js';import {o as o$1}from'../../chunk-RNWXATAC.js';var y=`
|
|
2
|
+
query ListConversations($filter: ConversationFilter, $first: Int, $after: String) {
|
|
3
|
+
conversations(filter: $filter, first: $first, after: $after) {
|
|
4
|
+
edges { node { id title type description createdAt updatedAt unreadCount } }
|
|
5
|
+
pageInfo { hasNextPage endCursor }
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
`,E=`
|
|
9
|
+
query GetConversation($id: ID!) {
|
|
10
|
+
conversation(id: $id) {
|
|
11
|
+
id title type description avatarUrl settings
|
|
12
|
+
createdAt updatedAt
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,N=`
|
|
16
|
+
mutation CreateConversation($input: CreateConversationInput!) {
|
|
17
|
+
createConversation(input: $input) {
|
|
18
|
+
conversation { id title type }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`,I=`
|
|
22
|
+
mutation DeleteConversation($id: ID!) {
|
|
23
|
+
deleteConversation(id: $id) { success }
|
|
24
|
+
}
|
|
25
|
+
`,O=`
|
|
26
|
+
mutation UpdateConversation($input: UpdateConversationInput!) {
|
|
27
|
+
updateConversation(input: $input) {
|
|
28
|
+
conversation { id title description }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`,A=`
|
|
32
|
+
mutation SendMessage($input: SendMessageInput!) {
|
|
33
|
+
sendMessage(input: $input) {
|
|
34
|
+
message { id content type createdAt }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;function S(m){let o$2=m.command("conversations").description("Conversation management");o$2.command("list").description("List conversations").option("--type <t>","Filter by type (DIRECT|GROUP|CHANNEL)").option("--limit <n>","Page size",e=>parseInt(e,10),50).option("-f, --format <format>").action(async e=>{try{let t={};e.type&&(t.type=e.type.toUpperCase());let i=(await b(y,{filter:Object.keys(t).length?t:void 0,first:e.limit})).conversations.edges.map(r=>r.node);g(e,i,{headers:["ID","Title","Type","Unread","Created"],rows:i.map(r=>[o(r.id,12),r.title??"-",r.type??"-",String(r.unreadCount??0),n(r.createdAt)])});}catch(t){f(t);}}),o$2.command("get").description("Get a conversation").argument("<id>").option("-f, --format <format>").action(async(e,t)=>{try{let n=await b(E,{id:e});if(!n.conversation)throw new o$1(`Conversation ${e} not found`);g(t,n.conversation);}catch(n){f(n);}}),o$2.command("create").description("Create a conversation").requiredOption("--title <s>").requiredOption("--participants <ids>","Comma-separated participant userIds (required by schema)").option("--description <s>").option("--type <t>","DIRECT|GROUP|CHANNEL","GROUP").option("-f, --format <format>").action(async e=>{try{let t=r().auth.read();if(!t?.workspaceId)throw new o$1("No workspace set. Run: vibecontrols workspace set <id>");let n={title:e.title,description:e.description,type:(e.type??"GROUP").toUpperCase(),participantIds:e.participants.split(","),workspaceId:t.workspaceId},i=await b(N,{input:n});h("Conversation created"),g(e,i.createConversation.conversation);}catch(t){f(t);}}),o$2.command("update").description("Update a conversation").argument("<id>").option("--title <s>").option("--description <s>").option("-f, --format <format>").action(async(e,t)=>{try{let n={id:e};if(t.title&&(n.title=t.title),t.description!==void 0&&(n.description=t.description),Object.keys(n).length===1)throw new o$1("No updates specified");let i=await b(O,{input:n});h("Conversation updated"),g(t,i.updateConversation.conversation);}catch(n){f(n);}}),o$2.command("delete").description("Delete a conversation").argument("<id>").action(async e=>{try{await b(I,{id:e}),h("Conversation deleted");}catch(t){f(t);}}),o$2.command("send").description("Send a message to a conversation").argument("<conversationId>").requiredOption("--content <text>").option("--parent <messageId>","Reply parent").option("-f, --format <format>").action(async(e,t)=>{try{let n={conversationId:e,content:{text:t.content},type:"TEXT",parentMessageId:t.parent},i=await b(A,{input:n});h("Message sent"),g(t,i.sendMessage.message);}catch(n){f(n);}});}var R={id:"conversations",version:"1.0.0",displayName:"Conversations",dependsOn:["auth","workspaces"],register(m,o){a(o),S(m);}},k=R;export{k as default};
|