@periskope/types 0.6.462 → 0.6.464

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.
@@ -0,0 +1,567 @@
1
+ import { Merge, OverrideProperties } from 'type-fest';
2
+
3
+ import { OrgPlanEnterprise, OrgPlanNonEnterprise } from './types';
4
+
5
+ /* ----------------------------- BILLING V2 PLANS & PACKS ----------------------------- */
6
+
7
+ export type BillingVersion = 'v1' | 'v2';
8
+
9
+ export enum AllPlansV2 {
10
+ FREE_TRIAL = 'v2-free-trial',
11
+ MONTHLY_STARTER = 'v2-monthly-starter',
12
+ YEARLY_STARTER = 'v2-annual-starter',
13
+ MONTHLY_PRO = 'v2-monthly-pro',
14
+ YEARLY_PRO = 'v2-annual-pro',
15
+ }
16
+
17
+ export type AddonPackId = SeatAddonPackId | RecurringAddonPackId;
18
+
19
+ /** V2-only — per-seat user & phone add-ons (tier-specific). */
20
+ export type SeatAddonPackId =
21
+ | 'v2-additional-phone-pro'
22
+ | 'v2-additional-user-pro'
23
+ | 'v2-additional-phone-starter'
24
+ | 'v2-additional-user-starter';
25
+
26
+ /** Shared by v1 and v2 — recurring optional add-ons. */
27
+ export type RecurringAddonPackId = 'priority-support-pack' | 'automation-pack';
28
+
29
+ /** Shared by v1 and v2 — one-time charge packs. `ai-pack`: 1,000 AI credits per quantity unit. */
30
+ export type ChargesPack =
31
+ | 'ai-pack'
32
+ | 'bulk-message-credits'
33
+ | 'guided-onboarding'
34
+ | 'support-call'
35
+ | 'support-call-pack';
36
+
37
+ /** Packs with no billing-version prefix — included under both v1 and v2. */
38
+ export type GenericPackId = RecurringAddonPackId | ChargesPack;
39
+
40
+ export const GENERIC_PACK_IDS: readonly GenericPackId[] = [
41
+ 'priority-support-pack',
42
+ 'automation-pack',
43
+ 'ai-pack',
44
+ 'bulk-message-credits',
45
+ 'guided-onboarding',
46
+ 'support-call',
47
+ 'support-call-pack',
48
+ ];
49
+
50
+ export type UsageType = 'ai_credits' | 'automation_rules' | 'bm_credits';
51
+
52
+ export type UsageAllowances = Partial<Record<UsageType, number>>;
53
+
54
+ export type UsageConsumption = Partial<Record<UsageType, number>>;
55
+
56
+ /** Recurring add-on flags derived from subscription line items. */
57
+ export type V2AddonEntitlements = Partial<
58
+ Record<RecurringAddonPackId, boolean>
59
+ >;
60
+
61
+ export type OrgPlanV2 = Merge<
62
+ OverrideProperties<
63
+ OrgPlanEnterprise | OrgPlanNonEnterprise,
64
+ {
65
+ plan_id: AllPlansV2;
66
+ }
67
+ >,
68
+ {
69
+ billing_version: 'v2';
70
+ usage_allowances?: UsageAllowances;
71
+ usage_consumption?: UsageConsumption;
72
+ addon_entitlements?: V2AddonEntitlements;
73
+ /** Paid one-time charge invoice ids already granted — webhook idempotency. */
74
+ processed_charge_invoices?: string[];
75
+ }
76
+ >;
77
+
78
+ export type OrgPlanV1 = (OrgPlanEnterprise | OrgPlanNonEnterprise) & {
79
+ billing_version?: 'v1';
80
+ };
81
+
82
+ export type AnyOrgPlan = OrgPlanV1 | OrgPlanV2;
83
+
84
+ export const isV2Plan = (plan: AnyOrgPlan): plan is OrgPlanV2 =>
85
+ plan.billing_version === 'v2';
86
+
87
+ /* ----------------------------- SHARED ----------------------------- */
88
+
89
+ export type BillingEntity = 'IN' | 'US';
90
+
91
+ /** Line item passed to Chargebee item-price / subscription APIs. */
92
+ export type BillingV2LineItem = {
93
+ item_price_id: string;
94
+ quantity?: number;
95
+ unit_price?: number;
96
+ };
97
+
98
+ /** Headers required on all billing V2 requests. */
99
+ export type BillingV2RequestHeaders = {
100
+ org_id: string;
101
+ 'x-periskope-trace-id'?: string;
102
+ };
103
+
104
+ export type BillingFrequency = 'monthly' | 'yearly';
105
+
106
+ export type BillingPlanTier = 'starter' | 'pro';
107
+
108
+ /** Money in major currency units (e.g. 2400 = ₹2,400). */
109
+ export type BillingMoney = {
110
+ amount: number;
111
+ currency_code: string;
112
+ };
113
+
114
+ /* ----------------------------- GET PRICES ----------------------------- */
115
+
116
+ export type BillingPriceItem = {
117
+ item_price_id: string;
118
+ item_id: string;
119
+ lookup_key: string | null;
120
+ name: string;
121
+ description: string | null;
122
+ price: BillingMoney;
123
+ frequency: BillingFrequency | null;
124
+ period: number | null;
125
+ status: string;
126
+ };
127
+
128
+ export type BillingVersionPrices = {
129
+ plan: BillingPriceItem[];
130
+ addons: BillingPriceItem[];
131
+ charges: BillingPriceItem[];
132
+ };
133
+
134
+ export type GetPricesParams = {
135
+ currency: string;
136
+ };
137
+
138
+ export type GetPricesResponse = {
139
+ v1: BillingVersionPrices;
140
+ v2: BillingVersionPrices;
141
+ };
142
+
143
+ /* ----------------------------- UPGRADE FLOW — STEP 2: SEAT ADDONS ----------------------------- */
144
+
145
+ export type SeatAddonConfig = {
146
+ pack_id: SeatAddonPackId;
147
+ label: string;
148
+ unit_price: BillingMoney;
149
+ /** Included in base plan before add-on quantity applies (typically 1). */
150
+ included_quantity: number;
151
+ };
152
+
153
+ export type GetSeatAddonsParams = {
154
+ currency: string;
155
+ plan_key: AllPlansV2;
156
+ };
157
+
158
+ export type GetSeatAddonsResponse = {
159
+ users: SeatAddonConfig;
160
+ phones: SeatAddonConfig;
161
+ credits_per_seat_per_month: number;
162
+ };
163
+
164
+ /* ----------------------------- UPGRADE FLOW — STEP 3: RECURRING ADDONS ----------------------------- */
165
+
166
+ export type RecurringAddonBillingModel = 'quantity' | 'flat';
167
+
168
+ export type RecurringAddonOption = {
169
+ pack_id: RecurringAddonPackId;
170
+ name: string;
171
+ description: string;
172
+ billing_model: RecurringAddonBillingModel;
173
+ unit_price: BillingMoney;
174
+ /** e.g. "pack" for automation rules. */
175
+ unit_label?: string;
176
+ /** Automation rules included per pack unit (`automation-pack` — default `25`). */
177
+ rules_per_pack?: number;
178
+ };
179
+
180
+ export type GetRecurringAddonsParams = {
181
+ currency: string;
182
+ };
183
+
184
+ export type GetRecurringAddonsResponse = {
185
+ automation_pack: RecurringAddonOption;
186
+ priority_support: RecurringAddonOption;
187
+ };
188
+
189
+ /* ----------------------------- ORDER SUMMARY (SIDEBAR + REVIEW) ----------------------------- */
190
+
191
+ export type OrderSummaryItemType = 'plan' | 'addon' | 'charge';
192
+
193
+ export type OrderSummaryItem = {
194
+ type: OrderSummaryItemType;
195
+ item_price_id: string;
196
+ lookup_key: string | null;
197
+ name: string;
198
+ description: string | null;
199
+ quantity: number;
200
+ unit_price: BillingMoney;
201
+ amount: BillingMoney;
202
+ /** null for one-time charge line items */
203
+ frequency: BillingFrequency | null;
204
+ };
205
+
206
+ export type GetOrderSummaryRequestBody = {
207
+ subscription_id?: string;
208
+ line_items: BillingV2LineItem[];
209
+ coupon_id?: string;
210
+ };
211
+
212
+ export type OrderSummaryNextCharge = {
213
+ /** Unix timestamp for the next recurring charge. */
214
+ date: number;
215
+ amount: BillingMoney;
216
+ };
217
+
218
+ export type GetOrderSummaryResponse = {
219
+ frequency: BillingFrequency;
220
+ currency_code: string;
221
+ items: OrderSummaryItem[];
222
+ /** Line items with quantity > 0 — for "Subtotal (N items)". */
223
+ item_count: number;
224
+ /** Pre-adjustment subtotal from Chargebee invoice_estimate.sub_total. */
225
+ subtotal: BillingMoney;
226
+ /** Promotional / account credits applied — null when none on estimate. */
227
+ credits_applied: BillingMoney | null;
228
+ /** null when no coupon on the estimate. */
229
+ coupon: AppliedCouponSummary | null;
230
+ /** Amount due after credits and coupon (invoice_estimate.total). */
231
+ total: BillingMoney;
232
+ /** Prorated amount due now (invoice_estimate.amount_due). */
233
+ due_today: BillingMoney;
234
+ /** Next full recurring charge — null when not available on estimate. */
235
+ next_charge: OrderSummaryNextCharge | null;
236
+ };
237
+
238
+ /* ----------------------------- ONE-TIME CHARGE ORDER SUMMARY ----------------------------- */
239
+
240
+ export type GetChargeOrderSummaryRequestBody = {
241
+ line_items: BillingV2LineItem[];
242
+ /** Chargebee coupon id — resolve via POST /get-coupon-details */
243
+ coupon_id?: string;
244
+ /** Override currency (e.g. INR, USD). Omit to use customer default. */
245
+ currency?: string;
246
+ };
247
+
248
+ export type GetChargeOrderSummaryResponse = {
249
+ currency_code: string;
250
+ items: OrderSummaryItem[];
251
+ /** Line items with quantity > 0 */
252
+ item_count: number;
253
+ subtotal: BillingMoney;
254
+ credits_applied: BillingMoney | null;
255
+ coupon: AppliedCouponSummary | null;
256
+ total: BillingMoney;
257
+ /** Amount due now — equals total for one-time charges (no proration). */
258
+ due_today: BillingMoney;
259
+ };
260
+
261
+ /* ----------------------------- COUPONS ----------------------------- */
262
+
263
+ export type CouponDiscountType = 'fixed_amount' | 'percentage' | 'offer_quantity';
264
+
265
+ export type GetCouponDetailsRequestBody = {
266
+ coupon_code: string;
267
+ };
268
+
269
+ export type GetCouponDetailsResponse = {
270
+ coupon_id: string;
271
+ coupon_code: string;
272
+ name: string | null;
273
+ discount_type: CouponDiscountType;
274
+ /** Set when discount_type is percentage; otherwise null. */
275
+ discount_percentage: number | null;
276
+ /** Set when discount_type is fixed_amount; otherwise null. */
277
+ discount_amount: BillingMoney | null;
278
+ duration_type: 'one_time' | 'forever' | 'limited_period';
279
+ status: string;
280
+ };
281
+
282
+ export type AppliedCouponSummary = {
283
+ coupon_id: string;
284
+ name: string | null;
285
+ discount_type: CouponDiscountType;
286
+ discount_percentage: number | null;
287
+ discount_amount: BillingMoney | null;
288
+ /** Coupon discount applied on this estimate — null when coupon present but discount is zero. */
289
+ applied_amount: BillingMoney | null;
290
+ };
291
+
292
+ /* ----------------------------- CHECKOUT (POST-CONFIRM) ----------------------------- */
293
+
294
+ export type CreateCheckoutSessionRequestBody = {
295
+ success_url: string;
296
+ cancel_url: string;
297
+ line_items: BillingV2LineItem[];
298
+ subscription_id?: string;
299
+ /** Chargebee coupon ids — resolve via POST /get-coupon-details */
300
+ coupon_ids?: string[];
301
+ /** When upgrading an existing sub with coupons. Default `true`. */
302
+ replace_coupon_list?: boolean;
303
+ };
304
+
305
+ export type CreateCheckoutSessionResponse = {
306
+ url: string;
307
+ hosted_page_id: string | null;
308
+ expires_at: number | null;
309
+ };
310
+
311
+ export type CreateChargeCheckoutSessionRequestBody = {
312
+ line_items: BillingV2LineItem[];
313
+ currency?: string;
314
+ };
315
+
316
+ export type CreateChargeCheckoutSessionResponse = {
317
+ url: string;
318
+ hosted_page_id: string | null;
319
+ expires_at: number | null;
320
+ };
321
+
322
+ export type CreateCustomerPortalRequestBody = {
323
+ redirect_url: string;
324
+ };
325
+
326
+ export type CreateCustomerPortalResponse = {
327
+ url: string;
328
+ expires_at?: number;
329
+ };
330
+
331
+ /* ----------------------------- SUBSCRIPTION ----------------------------- */
332
+
333
+ export type UpdateSubscriptionRequestBody = {
334
+ subscription_id: string;
335
+ line_items: BillingV2LineItem[];
336
+ replace_addon_list?: boolean;
337
+ };
338
+
339
+ export type UpdateSubscriptionResponse = {
340
+ subscription_id: string;
341
+ status: string;
342
+ current_term_start: number | null;
343
+ current_term_end: number | null;
344
+ cancelled_at: number | null;
345
+ };
346
+
347
+ export type CancelSubscriptionRequestBody = {
348
+ subscription_id: string;
349
+ };
350
+
351
+ export type CancelSubscriptionResponse = {
352
+ subscription_id: string;
353
+ status: string;
354
+ cancelled_at?: number;
355
+ };
356
+
357
+ export type ResumeCancelledSubscriptionRequestBody = {
358
+ subscription_id: string;
359
+ };
360
+
361
+ export type ResumeCancelledSubscriptionResponse = {
362
+ subscription_id: string;
363
+ status: string;
364
+ };
365
+
366
+ /* ----------------------------- INVOICES ----------------------------- */
367
+
368
+ export type BillingV2InvoiceSummary = {
369
+ invoice_id: string;
370
+ status: string;
371
+ amount_due: BillingMoney;
372
+ date: number;
373
+ };
374
+
375
+ export type GetUnpaidInvoicesResponse = BillingV2InvoiceSummary[];
376
+
377
+ export type GetLatestNextInvoiceResponse = {
378
+ latest_invoice: BillingV2InvoiceSummary | null;
379
+ next_invoice: {
380
+ amount: BillingMoney;
381
+ date: number;
382
+ } | null;
383
+ };
384
+
385
+ export type GetInvoiceLinkResponse = {
386
+ url: string;
387
+ } | null;
388
+
389
+ export type DownloadInvoiceParams = {
390
+ invoice_id: string;
391
+ };
392
+
393
+ export type DownloadInvoiceResponse = {
394
+ url: string;
395
+ valid_till?: number;
396
+ };
397
+
398
+ export type GetRecentInvoicesParams = {
399
+ /** Max invoices to return (default 10, max 50). Customer resolved from org_id — do not pass customer_id. */
400
+ limit?: number;
401
+ };
402
+
403
+ export type RecentInvoiceLineItem = {
404
+ description: string | null;
405
+ entity_description: string | null;
406
+ quantity: number;
407
+ amount: BillingMoney;
408
+ };
409
+
410
+ /** Chargebee invoice row — aligned with dashboard fields (ID, status, type, total, credits). */
411
+ export type ChargebeeInvoiceSummary = {
412
+ invoice_id: string;
413
+ /** Primary display title — first line item description from Chargebee. */
414
+ name: string;
415
+ description: string | null;
416
+ status: string;
417
+ /** `recurring` → "Recurring"; otherwise "One-time" on Chargebee. */
418
+ type: 'recurring' | 'one_time';
419
+ recurring: boolean;
420
+ /** Invoice created date (Chargebee `date`). */
421
+ date: number | null;
422
+ due_date: number | null;
423
+ paid_at: number | null;
424
+ subscription_id: string | null;
425
+ total: BillingMoney;
426
+ amount_due: BillingMoney;
427
+ amount_paid: BillingMoney;
428
+ /** Promotional / account credits applied ("Credits Issued" on Chargebee). */
429
+ credits_applied: BillingMoney | null;
430
+ line_items: RecentInvoiceLineItem[];
431
+ download_url: string | null;
432
+ download_valid_till: number | null;
433
+ };
434
+
435
+ export type RecentInvoice = ChargebeeInvoiceSummary;
436
+
437
+ export type GetRecentInvoicesResponse = RecentInvoice[];
438
+
439
+ /* ----------------------------- CUSTOMER ----------------------------- */
440
+
441
+ /** Billing address fields accepted by Chargebee customer.updateBillingInfo. */
442
+ export type BillingAddress = {
443
+ first_name?: string;
444
+ last_name?: string;
445
+ email?: string;
446
+ company?: string;
447
+ phone?: string;
448
+ line1?: string;
449
+ line2?: string;
450
+ line3?: string;
451
+ city?: string;
452
+ state_code?: string;
453
+ state?: string;
454
+ country?: string;
455
+ zip?: string;
456
+ vat_number?: string;
457
+ };
458
+
459
+ export type UpdateBillingDetailsRequestBody = {
460
+ billing_address: BillingAddress;
461
+ /** When country is IN, optionally move free-trial customer to IN entity. Defaults to US behaviour otherwise. */
462
+ move_to_entity?: BillingEntity;
463
+ };
464
+
465
+ export type UpdateBillingDetailsResponse = {
466
+ customer_id: string;
467
+ billing_address: BillingAddress;
468
+ preferred_currency_code: string;
469
+ };
470
+
471
+ /* ----------------------------- USAGE ----------------------------- */
472
+
473
+ export type GetUsageResponse = {
474
+ allowances: UsageAllowances;
475
+ consumption: UsageConsumption;
476
+ };
477
+
478
+ /* ----------------------------- PLAN SUMMARY ----------------------------- */
479
+
480
+ /** Upcoming renewal charge — null when no subscription or estimate unavailable. */
481
+ export type PlanSummaryNextInvoice = {
482
+ amount: BillingMoney;
483
+ date: number;
484
+ /** e.g. "USD 56.00 on 18 Jul 2026" */
485
+ label: string;
486
+ };
487
+
488
+ /** Scheduled end-of-term cancellation — null when subscription will renew. */
489
+ export type PlanSummaryCancelsOn = {
490
+ date: number;
491
+ /** e.g. "Cancels on 18 Jul 2026" */
492
+ label: string;
493
+ };
494
+
495
+ export type PlanSummarySection = {
496
+ current_plan: string;
497
+ /** null when org_plan is not seeded yet */
498
+ plan_id: AllPlansV2 | string | null;
499
+ billing_frequency: BillingFrequency | 'weekly' | 'custom';
500
+ users: number;
501
+ phones: number;
502
+ /** null on free trial — no recurring rules allowance */
503
+ rules_allowance: number | null;
504
+ /** null on free trial — recurring BM only; free trial has top-up via charge_packs */
505
+ bm_credits_allowance: number | null;
506
+ /** null on free trial — recurring AI from seats; purchased top-up via charge_packs */
507
+ ai_credits_allowance: number | null;
508
+ /** null on free trial, when scheduled to cancel, or when no upcoming renewal */
509
+ next_invoice: PlanSummaryNextInvoice | null;
510
+ /** null unless subscription is scheduled to cancel at period end (`non_renewing`) */
511
+ cancels_on: PlanSummaryCancelsOn | null;
512
+ };
513
+
514
+ export type PlanSummarySubscriptionStatus = 'active' | 'unpaid' | 'inactive';
515
+
516
+ export type PlanSummaryInvoice = ChargebeeInvoiceSummary & {
517
+ /** Hosted payment page — null unless status is payment_due / not_paid. */
518
+ payment_url: string | null;
519
+ };
520
+
521
+ export type PlanSummaryChargePack = {
522
+ pack_id: 'bulk-message-credits' | 'ai-pack';
523
+ lookup_key: string;
524
+ name: string;
525
+ /** Total purchased credits granted (from usage_allowances). */
526
+ purchased_credits: number | null;
527
+ /** Remaining after consumption — null when zero. */
528
+ remaining_credits: number | null;
529
+ };
530
+
531
+ export type GetPlanSummaryResponse = {
532
+ billing_version: BillingVersion;
533
+ summary: PlanSummarySection;
534
+ subscription_status: PlanSummarySubscriptionStatus;
535
+ /** Newest first — empty when customer has no invoices. */
536
+ last_5_invoices: PlanSummaryInvoice[];
537
+ /** BM + AI one-time top-ups — empty when no purchased balance. */
538
+ charge_packs: PlanSummaryChargePack[];
539
+ /** Purchased top-up allowances and consumption from org_plan (V2). */
540
+ usage: {
541
+ allowances: UsageAllowances;
542
+ consumption: UsageConsumption;
543
+ remaining: UsageAllowances;
544
+ } | null;
545
+ };
546
+
547
+ /* ----------------------------- WEBHOOKS ----------------------------- */
548
+
549
+ /** Raw Chargebee webhook POST body. */
550
+ export type ChargebeeWebhookEventPayload = {
551
+ id: string;
552
+ occurred_at: number;
553
+ event_type: string;
554
+ content: Record<string, unknown>;
555
+ source?: string;
556
+ webhook_status?: string;
557
+ };
558
+
559
+ export type ChargebeeV2EventHandleResult = {
560
+ received: true;
561
+ handled: boolean;
562
+ event_id: string;
563
+ event_type: string;
564
+ billing_version?: BillingVersion;
565
+ org_id?: string;
566
+ reason?: string;
567
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './billing.types';
1
2
  export * from './object.types';
2
3
  export * from './rules.types';
3
4
  export * from './supabase.types';
@@ -2249,6 +2249,56 @@ export type Database = {
2249
2249
  },
2250
2250
  ]
2251
2251
  }
2252
+ tbl_api_tokens: {
2253
+ Row: {
2254
+ exp: string
2255
+ iat: string
2256
+ id: string
2257
+ is_revealed: boolean
2258
+ name: string
2259
+ org_id: string
2260
+ role: string
2261
+ token: string
2262
+ token_hash: string
2263
+ token_metadata: Json
2264
+ type: Database["public"]["Enums"]["enum_integration_type"]
2265
+ }
2266
+ Insert: {
2267
+ exp: string
2268
+ iat: string
2269
+ id: string
2270
+ is_revealed?: boolean
2271
+ name: string
2272
+ org_id: string
2273
+ role: string
2274
+ token: string
2275
+ token_hash: string
2276
+ token_metadata?: Json
2277
+ type: Database["public"]["Enums"]["enum_integration_type"]
2278
+ }
2279
+ Update: {
2280
+ exp?: string
2281
+ iat?: string
2282
+ id?: string
2283
+ is_revealed?: boolean
2284
+ name?: string
2285
+ org_id?: string
2286
+ role?: string
2287
+ token?: string
2288
+ token_hash?: string
2289
+ token_metadata?: Json
2290
+ type?: Database["public"]["Enums"]["enum_integration_type"]
2291
+ }
2292
+ Relationships: [
2293
+ {
2294
+ foreignKeyName: "tbl_api_tokens_org_id_fkey"
2295
+ columns: ["org_id"]
2296
+ isOneToOne: false
2297
+ referencedRelation: "tbl_org"
2298
+ referencedColumns: ["org_id"]
2299
+ },
2300
+ ]
2301
+ }
2252
2302
  tbl_integration_tokens: {
2253
2303
  Row: {
2254
2304
  exp: string
@@ -2310,6 +2360,69 @@ export type Database = {
2310
2360
  },
2311
2361
  ]
2312
2362
  }
2363
+ tbl_mcp_clients: {
2364
+ Row: {
2365
+ client: Json
2366
+ client_id: string
2367
+ created_at: string
2368
+ }
2369
+ Insert: {
2370
+ client: Json
2371
+ client_id: string
2372
+ created_at?: string
2373
+ }
2374
+ Update: {
2375
+ client?: Json
2376
+ client_id?: string
2377
+ created_at?: string
2378
+ }
2379
+ Relationships: []
2380
+ }
2381
+ tbl_mcp_tokens: {
2382
+ Row: {
2383
+ access_token_expires_at: string
2384
+ access_token_hash: string
2385
+ client_id: string
2386
+ client_name: string | null
2387
+ created_at: string
2388
+ id: string
2389
+ integration_token_id: string
2390
+ org_id: string
2391
+ phone_scopes: string[] | null
2392
+ refresh_token_expires_at: string
2393
+ refresh_token_hash: string
2394
+ revoked_at: string | null
2395
+ }
2396
+ Insert: {
2397
+ access_token_expires_at: string
2398
+ access_token_hash: string
2399
+ client_id: string
2400
+ client_name?: string | null
2401
+ created_at?: string
2402
+ id?: string
2403
+ integration_token_id: string
2404
+ org_id: string
2405
+ phone_scopes?: string[] | null
2406
+ refresh_token_expires_at: string
2407
+ refresh_token_hash: string
2408
+ revoked_at?: string | null
2409
+ }
2410
+ Update: {
2411
+ access_token_expires_at?: string
2412
+ access_token_hash?: string
2413
+ client_id?: string
2414
+ client_name?: string | null
2415
+ created_at?: string
2416
+ id?: string
2417
+ integration_token_id?: string
2418
+ org_id?: string
2419
+ phone_scopes?: string[] | null
2420
+ refresh_token_expires_at?: string
2421
+ refresh_token_hash?: string
2422
+ revoked_at?: string | null
2423
+ }
2424
+ Relationships: []
2425
+ }
2313
2426
  tbl_org: {
2314
2427
  Row: {
2315
2428
  ai_settings: Json | null
@@ -3667,6 +3780,10 @@ export type Database = {
3667
3780
  Args: { chat_ids_input?: string[]; org_id_input: string }
3668
3781
  Returns: Json[]
3669
3782
  }
3783
+ get_mcp_connections: {
3784
+ Args: { org_id_input: string }
3785
+ Returns: Json
3786
+ }
3670
3787
  get_chat_properties_by_chat_ids: {
3671
3788
  Args: { chat_id_input?: string[]; org_id_input: string }
3672
3789
  Returns: Json
@@ -3959,6 +4076,10 @@ export type Database = {
3959
4076
  Args: { chat_id_input?: string; org_id_input: string }
3960
4077
  Returns: undefined
3961
4078
  }
4079
+ revoke_mcp_connection: {
4080
+ Args: { id_input: string }
4081
+ Returns: undefined
4082
+ }
3962
4083
  update_chat_properties: {
3963
4084
  Args: {
3964
4085
  chat_id_input: string[]