@periskope/types 0.6.14 → 0.6.16-3.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.
@@ -1,7 +1,7 @@
1
1
  export type Json = {
2
2
  [key: string]: any;
3
3
  } | any;
4
- export interface Database {
4
+ export type Database = {
5
5
  graphql_public: {
6
6
  Tables: {
7
7
  [_ in never]: never;
@@ -27,92 +27,419 @@ export interface Database {
27
27
  [_ in never]: never;
28
28
  };
29
29
  };
30
+ internal: {
31
+ Tables: {
32
+ config: {
33
+ Row: {
34
+ key: string;
35
+ updated_at: string;
36
+ value: string | null;
37
+ };
38
+ Insert: {
39
+ key: string;
40
+ updated_at?: string;
41
+ value?: string | null;
42
+ };
43
+ Update: {
44
+ key?: string;
45
+ updated_at?: string;
46
+ value?: string | null;
47
+ };
48
+ Relationships: [];
49
+ };
50
+ org_phone_logs: {
51
+ Row: {
52
+ connection_history: Json | null;
53
+ created_at: string;
54
+ deleted_at: string | null;
55
+ first_connected_at: string | null;
56
+ org_id: string;
57
+ org_phone: string | null;
58
+ phone_id: string;
59
+ };
60
+ Insert: {
61
+ connection_history?: Json | null;
62
+ created_at?: string;
63
+ deleted_at?: string | null;
64
+ first_connected_at?: string | null;
65
+ org_id: string;
66
+ org_phone?: string | null;
67
+ phone_id: string;
68
+ };
69
+ Update: {
70
+ connection_history?: Json | null;
71
+ created_at?: string;
72
+ deleted_at?: string | null;
73
+ first_connected_at?: string | null;
74
+ org_id?: string;
75
+ org_phone?: string | null;
76
+ phone_id?: string;
77
+ };
78
+ Relationships: [];
79
+ };
80
+ tbl_communication_logs: {
81
+ Row: {
82
+ communication_type: string | null;
83
+ created_at: string;
84
+ id: number;
85
+ metadata: Json | null;
86
+ org_id: string | null;
87
+ recipient: string | null;
88
+ success: boolean | null;
89
+ type: string | null;
90
+ };
91
+ Insert: {
92
+ communication_type?: string | null;
93
+ created_at?: string;
94
+ id?: number;
95
+ metadata?: Json | null;
96
+ org_id?: string | null;
97
+ recipient?: string | null;
98
+ success?: boolean | null;
99
+ type?: string | null;
100
+ };
101
+ Update: {
102
+ communication_type?: string | null;
103
+ created_at?: string;
104
+ id?: number;
105
+ metadata?: Json | null;
106
+ org_id?: string | null;
107
+ recipient?: string | null;
108
+ success?: boolean | null;
109
+ type?: string | null;
110
+ };
111
+ Relationships: [];
112
+ };
113
+ tbl_feature_flags: {
114
+ Row: {
115
+ created_at: string | null;
116
+ enabled: boolean | null;
117
+ excluded_orgs: string[] | null;
118
+ exclusive_to_orgs: string[] | null;
119
+ feature: string;
120
+ included_orgs: string[] | null;
121
+ percentage: number | null;
122
+ plans: string[] | null;
123
+ start_date: string | null;
124
+ };
125
+ Insert: {
126
+ created_at?: string | null;
127
+ enabled?: boolean | null;
128
+ excluded_orgs?: string[] | null;
129
+ exclusive_to_orgs?: string[] | null;
130
+ feature: string;
131
+ included_orgs?: string[] | null;
132
+ percentage?: number | null;
133
+ plans?: string[] | null;
134
+ start_date?: string | null;
135
+ };
136
+ Update: {
137
+ created_at?: string | null;
138
+ enabled?: boolean | null;
139
+ excluded_orgs?: string[] | null;
140
+ exclusive_to_orgs?: string[] | null;
141
+ feature?: string;
142
+ included_orgs?: string[] | null;
143
+ percentage?: number | null;
144
+ plans?: string[] | null;
145
+ start_date?: string | null;
146
+ };
147
+ Relationships: [];
148
+ };
149
+ tbl_trigger_logs: {
150
+ Row: {
151
+ created_at: string;
152
+ id: number;
153
+ request_body: Json;
154
+ request_id: string;
155
+ trace_id: string;
156
+ trigger_name: string;
157
+ };
158
+ Insert: {
159
+ created_at?: string;
160
+ id?: number;
161
+ request_body: Json;
162
+ request_id: string;
163
+ trace_id?: string;
164
+ trigger_name: string;
165
+ };
166
+ Update: {
167
+ created_at?: string;
168
+ id?: number;
169
+ request_body?: Json;
170
+ request_id?: string;
171
+ trace_id?: string;
172
+ trigger_name?: string;
173
+ };
174
+ Relationships: [];
175
+ };
176
+ };
177
+ Views: {
178
+ [_ in never]: never;
179
+ };
180
+ Functions: {
181
+ [_ in never]: never;
182
+ };
183
+ Enums: {
184
+ [_ in never]: never;
185
+ };
186
+ CompositeTypes: {
187
+ [_ in never]: never;
188
+ };
189
+ };
30
190
  public: {
31
191
  Tables: {
32
- tbl_broadcast_scheduled_messages: {
192
+ tbl_api_logs: {
193
+ Row: {
194
+ org_id: string;
195
+ path: string;
196
+ req: Json;
197
+ request_id: string;
198
+ res: Json | null;
199
+ status: number;
200
+ timestamp: string;
201
+ token_id: string;
202
+ };
203
+ Insert: {
204
+ org_id: string;
205
+ path: string;
206
+ req: Json;
207
+ request_id: string;
208
+ res?: Json | null;
209
+ status: number;
210
+ timestamp: string;
211
+ token_id: string;
212
+ };
213
+ Update: {
214
+ org_id?: string;
215
+ path?: string;
216
+ req?: Json;
217
+ request_id?: string;
218
+ res?: Json | null;
219
+ status?: number;
220
+ timestamp?: string;
221
+ token_id?: string;
222
+ };
223
+ Relationships: [];
224
+ };
225
+ tbl_automation_rules: {
226
+ Row: {
227
+ actions: Json;
228
+ conditions: Json;
229
+ created_at: string;
230
+ id: string;
231
+ is_active: boolean;
232
+ last_updated_at: string;
233
+ last_updated_by: string;
234
+ org_id: string;
235
+ rule_name: string;
236
+ trigger: string;
237
+ };
238
+ Insert: {
239
+ actions: Json;
240
+ conditions: Json;
241
+ created_at?: string;
242
+ id?: string;
243
+ is_active?: boolean;
244
+ last_updated_at?: string;
245
+ last_updated_by: string;
246
+ org_id: string;
247
+ rule_name: string;
248
+ trigger: string;
249
+ };
250
+ Update: {
251
+ actions?: Json;
252
+ conditions?: Json;
253
+ created_at?: string;
254
+ id?: string;
255
+ is_active?: boolean;
256
+ last_updated_at?: string;
257
+ last_updated_by?: string;
258
+ org_id?: string;
259
+ rule_name?: string;
260
+ trigger?: string;
261
+ };
262
+ Relationships: [
263
+ {
264
+ foreignKeyName: "public_tbl_automation_rules_org_id_fkey";
265
+ columns: ["org_id"];
266
+ isOneToOne: false;
267
+ referencedRelation: "tbl_org";
268
+ referencedColumns: ["org_id"];
269
+ },
270
+ {
271
+ foreignKeyName: "public_tbl_automation_rules_org_id_fkey";
272
+ columns: ["org_id"];
273
+ isOneToOne: false;
274
+ referencedRelation: "view_org";
275
+ referencedColumns: ["org_id"];
276
+ }
277
+ ];
278
+ };
279
+ tbl_broadcast_logs: {
280
+ Row: {
281
+ broadcast_id: string;
282
+ chat_id: string;
283
+ completed_at: string | null;
284
+ created_at: string;
285
+ delivered_count: number | null;
286
+ delivery_info: Json | null;
287
+ is_success: boolean | null;
288
+ member_count: number | null;
289
+ message_id: string | null;
290
+ org_id: string;
291
+ org_phone: string | null;
292
+ read_count: number | null;
293
+ remarks: string | null;
294
+ };
295
+ Insert: {
296
+ broadcast_id: string;
297
+ chat_id: string;
298
+ completed_at?: string | null;
299
+ created_at?: string;
300
+ delivered_count?: number | null;
301
+ delivery_info?: Json | null;
302
+ is_success?: boolean | null;
303
+ member_count?: number | null;
304
+ message_id?: string | null;
305
+ org_id: string;
306
+ org_phone?: string | null;
307
+ read_count?: number | null;
308
+ remarks?: string | null;
309
+ };
310
+ Update: {
311
+ broadcast_id?: string;
312
+ chat_id?: string;
313
+ completed_at?: string | null;
314
+ created_at?: string;
315
+ delivered_count?: number | null;
316
+ delivery_info?: Json | null;
317
+ is_success?: boolean | null;
318
+ member_count?: number | null;
319
+ message_id?: string | null;
320
+ org_id?: string;
321
+ org_phone?: string | null;
322
+ read_count?: number | null;
323
+ remarks?: string | null;
324
+ };
325
+ Relationships: [
326
+ {
327
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey";
328
+ columns: ["broadcast_id"];
329
+ isOneToOne: false;
330
+ referencedRelation: "tbl_broadcast_messages";
331
+ referencedColumns: ["broadcast_id"];
332
+ },
333
+ {
334
+ foreignKeyName: "tbl_broadcast_logs_broadcast_id_fkey";
335
+ columns: ["broadcast_id"];
336
+ isOneToOne: false;
337
+ referencedRelation: "view_broadcast_logs";
338
+ referencedColumns: ["broadcast_id"];
339
+ },
340
+ {
341
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey";
342
+ columns: ["org_id"];
343
+ isOneToOne: false;
344
+ referencedRelation: "tbl_org";
345
+ referencedColumns: ["org_id"];
346
+ },
347
+ {
348
+ foreignKeyName: "tbl_broadcast_logs_org_id_fkey";
349
+ columns: ["org_id"];
350
+ isOneToOne: false;
351
+ referencedRelation: "view_org";
352
+ referencedColumns: ["org_id"];
353
+ }
354
+ ];
355
+ };
356
+ tbl_broadcast_messages: {
33
357
  Row: {
34
- added_by: string | null;
35
- chat_ids: Json | null;
358
+ broadcast_id: string;
359
+ broadcast_status: Database["public"]["Enums"]["enum_broadcast_status"] | null;
360
+ chat_ids: string[] | null;
36
361
  created_at: string;
362
+ delay: number | null;
37
363
  message_payload: Json | null;
38
- org_id: string | null;
364
+ org_id: string;
365
+ org_phone: string | null;
366
+ performed_at: string | null;
367
+ performed_by: string | null;
39
368
  scheduled_at: string | null;
40
- scheduled_message_id: string;
41
- status: string | null;
42
- template_id: string | null;
369
+ variables: Json | null;
43
370
  };
44
371
  Insert: {
45
- added_by?: string | null;
46
- chat_ids?: Json | null;
372
+ broadcast_id?: string;
373
+ broadcast_status?: Database["public"]["Enums"]["enum_broadcast_status"] | null;
374
+ chat_ids?: string[] | null;
47
375
  created_at?: string;
376
+ delay?: number | null;
48
377
  message_payload?: Json | null;
49
- org_id?: string | null;
378
+ org_id: string;
379
+ org_phone?: string | null;
380
+ performed_at?: string | null;
381
+ performed_by?: string | null;
50
382
  scheduled_at?: string | null;
51
- scheduled_message_id?: string;
52
- status?: string | null;
53
- template_id?: string | null;
383
+ variables?: Json | null;
54
384
  };
55
385
  Update: {
56
- added_by?: string | null;
57
- chat_ids?: Json | null;
386
+ broadcast_id?: string;
387
+ broadcast_status?: Database["public"]["Enums"]["enum_broadcast_status"] | null;
388
+ chat_ids?: string[] | null;
58
389
  created_at?: string;
390
+ delay?: number | null;
59
391
  message_payload?: Json | null;
60
- org_id?: string | null;
392
+ org_id?: string;
393
+ org_phone?: string | null;
394
+ performed_at?: string | null;
395
+ performed_by?: string | null;
61
396
  scheduled_at?: string | null;
62
- scheduled_message_id?: string;
63
- status?: string | null;
64
- template_id?: string | null;
397
+ variables?: Json | null;
65
398
  };
66
399
  Relationships: [
67
400
  {
68
- foreignKeyName: "tbl_broadcast_scheduled_messages_org_id_fkey";
401
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
69
402
  columns: ["org_id"];
70
403
  isOneToOne: false;
71
404
  referencedRelation: "tbl_org";
72
405
  referencedColumns: ["org_id"];
73
406
  },
74
407
  {
75
- foreignKeyName: "tbl_broadcast_scheduled_messages_template_id_fkey";
76
- columns: ["template_id"];
408
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
409
+ columns: ["org_id"];
77
410
  isOneToOne: false;
78
- referencedRelation: "tbl_broadcast_templates";
79
- referencedColumns: ["template_id"];
411
+ referencedRelation: "view_org";
412
+ referencedColumns: ["org_id"];
80
413
  }
81
414
  ];
82
415
  };
83
416
  tbl_broadcast_templates: {
84
417
  Row: {
85
- body: string | null;
86
418
  created_at: string;
87
- filename: string | null;
88
- mimetype: string | null;
419
+ message_payload: Json | null;
89
420
  org_id: string;
90
421
  template_id: string;
91
422
  template_name: string | null;
92
423
  updated_at: string | null;
93
- url: string | null;
424
+ variable_names: Json | null;
94
425
  };
95
426
  Insert: {
96
- body?: string | null;
97
427
  created_at?: string;
98
- filename?: string | null;
99
- mimetype?: string | null;
100
- org_id?: string;
428
+ message_payload?: Json | null;
429
+ org_id: string;
101
430
  template_id?: string;
102
431
  template_name?: string | null;
103
432
  updated_at?: string | null;
104
- url?: string | null;
433
+ variable_names?: Json | null;
105
434
  };
106
435
  Update: {
107
- body?: string | null;
108
436
  created_at?: string;
109
- filename?: string | null;
110
- mimetype?: string | null;
437
+ message_payload?: Json | null;
111
438
  org_id?: string;
112
439
  template_id?: string;
113
440
  template_name?: string | null;
114
441
  updated_at?: string | null;
115
- url?: string | null;
442
+ variable_names?: Json | null;
116
443
  };
117
444
  Relationships: [
118
445
  {
@@ -121,38 +448,70 @@ export interface Database {
121
448
  isOneToOne: false;
122
449
  referencedRelation: "tbl_org";
123
450
  referencedColumns: ["org_id"];
451
+ },
452
+ {
453
+ foreignKeyName: "tbl_broadcast_templates_org_id_fkey";
454
+ columns: ["org_id"];
455
+ isOneToOne: false;
456
+ referencedRelation: "view_org";
457
+ referencedColumns: ["org_id"];
124
458
  }
125
459
  ];
126
460
  };
127
- tbl_chat_access: {
461
+ tbl_chat_logs: {
128
462
  Row: {
129
- chat_id: string;
130
- email: string;
131
- has_access: boolean | null;
132
- last_read_timestamp: string | null;
463
+ action: string | null;
464
+ chat_id: string | null;
465
+ is_success: boolean | null;
466
+ log_id: string;
467
+ metadata: Json | null;
468
+ operation_id: string;
133
469
  org_id: string;
470
+ org_phone: string;
471
+ participant_id: string | null;
472
+ performed_by: string | null;
473
+ timestamp: string | null;
134
474
  };
135
475
  Insert: {
136
- chat_id: string;
137
- email: string;
138
- has_access?: boolean | null;
139
- last_read_timestamp?: string | null;
140
- org_id?: string;
476
+ action?: string | null;
477
+ chat_id?: string | null;
478
+ is_success?: boolean | null;
479
+ log_id?: string;
480
+ metadata?: Json | null;
481
+ operation_id: string;
482
+ org_id: string;
483
+ org_phone: string;
484
+ participant_id?: string | null;
485
+ performed_by?: string | null;
486
+ timestamp?: string | null;
141
487
  };
142
488
  Update: {
143
- chat_id?: string;
144
- email?: string;
145
- has_access?: boolean | null;
146
- last_read_timestamp?: string | null;
489
+ action?: string | null;
490
+ chat_id?: string | null;
491
+ is_success?: boolean | null;
492
+ log_id?: string;
493
+ metadata?: Json | null;
494
+ operation_id?: string;
147
495
  org_id?: string;
496
+ org_phone?: string;
497
+ participant_id?: string | null;
498
+ performed_by?: string | null;
499
+ timestamp?: string | null;
148
500
  };
149
501
  Relationships: [
150
502
  {
151
- foreignKeyName: "tbl_chat_access_org_id_fkey";
503
+ foreignKeyName: "tbl_chat_logs_org_id_fkey";
152
504
  columns: ["org_id"];
153
505
  isOneToOne: false;
154
506
  referencedRelation: "tbl_org";
155
507
  referencedColumns: ["org_id"];
508
+ },
509
+ {
510
+ foreignKeyName: "tbl_chat_logs_org_id_fkey";
511
+ columns: ["org_id"];
512
+ isOneToOne: false;
513
+ referencedRelation: "view_org";
514
+ referencedColumns: ["org_id"];
156
515
  }
157
516
  ];
158
517
  };
@@ -164,11 +523,16 @@ export interface Database {
164
523
  broadcast: boolean | null;
165
524
  broadcast_id: string | null;
166
525
  chat_id: string | null;
526
+ delivery_info: Json | null;
167
527
  device_type: string | null;
168
528
  duration: string | null;
529
+ flag_metadata: Json | null;
530
+ flag_response_time: number | null;
531
+ flag_status: boolean | null;
169
532
  forwarding_score: number | null;
170
533
  from: string | null;
171
534
  from_me: boolean | null;
535
+ fts: unknown | null;
172
536
  has_media: boolean | null;
173
537
  has_quoted_msg: boolean | null;
174
538
  has_reaction: boolean | null;
@@ -186,11 +550,14 @@ export interface Database {
186
550
  media_key: string | null;
187
551
  mentioned_ids: string[] | null;
188
552
  message_id: string;
553
+ message_ticket_id: string | null;
189
554
  message_type: string | null;
190
555
  order_id: string | null;
191
556
  org_id: string;
192
557
  org_phone: string;
193
558
  performed_by: string | null;
559
+ poll_info: Json | null;
560
+ poll_results: Json | null;
194
561
  prev_body: string | null;
195
562
  quoted_message_id: string | null;
196
563
  raw_data: Json | null;
@@ -199,6 +566,8 @@ export interface Database {
199
566
  timestamp: string | null;
200
567
  to: string | null;
201
568
  token: string | null;
569
+ unique_id: string | null;
570
+ updated_at: string | null;
202
571
  vcards: string[] | null;
203
572
  };
204
573
  Insert: {
@@ -208,11 +577,16 @@ export interface Database {
208
577
  broadcast?: boolean | null;
209
578
  broadcast_id?: string | null;
210
579
  chat_id?: string | null;
580
+ delivery_info?: Json | null;
211
581
  device_type?: string | null;
212
582
  duration?: string | null;
583
+ flag_metadata?: Json | null;
584
+ flag_response_time?: number | null;
585
+ flag_status?: boolean | null;
213
586
  forwarding_score?: number | null;
214
587
  from?: string | null;
215
588
  from_me?: boolean | null;
589
+ fts?: unknown | null;
216
590
  has_media?: boolean | null;
217
591
  has_quoted_msg?: boolean | null;
218
592
  has_reaction?: boolean | null;
@@ -230,11 +604,14 @@ export interface Database {
230
604
  media_key?: string | null;
231
605
  mentioned_ids?: string[] | null;
232
606
  message_id: string;
607
+ message_ticket_id?: string | null;
233
608
  message_type?: string | null;
234
609
  order_id?: string | null;
235
610
  org_id: string;
236
611
  org_phone: string;
237
612
  performed_by?: string | null;
613
+ poll_info?: Json | null;
614
+ poll_results?: Json | null;
238
615
  prev_body?: string | null;
239
616
  quoted_message_id?: string | null;
240
617
  raw_data?: Json | null;
@@ -243,6 +620,8 @@ export interface Database {
243
620
  timestamp?: string | null;
244
621
  to?: string | null;
245
622
  token?: string | null;
623
+ unique_id?: string | null;
624
+ updated_at?: string | null;
246
625
  vcards?: string[] | null;
247
626
  };
248
627
  Update: {
@@ -252,11 +631,16 @@ export interface Database {
252
631
  broadcast?: boolean | null;
253
632
  broadcast_id?: string | null;
254
633
  chat_id?: string | null;
634
+ delivery_info?: Json | null;
255
635
  device_type?: string | null;
256
636
  duration?: string | null;
637
+ flag_metadata?: Json | null;
638
+ flag_response_time?: number | null;
639
+ flag_status?: boolean | null;
257
640
  forwarding_score?: number | null;
258
641
  from?: string | null;
259
642
  from_me?: boolean | null;
643
+ fts?: unknown | null;
260
644
  has_media?: boolean | null;
261
645
  has_quoted_msg?: boolean | null;
262
646
  has_reaction?: boolean | null;
@@ -274,11 +658,14 @@ export interface Database {
274
658
  media_key?: string | null;
275
659
  mentioned_ids?: string[] | null;
276
660
  message_id?: string;
661
+ message_ticket_id?: string | null;
277
662
  message_type?: string | null;
278
663
  order_id?: string | null;
279
664
  org_id?: string;
280
665
  org_phone?: string;
281
666
  performed_by?: string | null;
667
+ poll_info?: Json | null;
668
+ poll_results?: Json | null;
282
669
  prev_body?: string | null;
283
670
  quoted_message_id?: string | null;
284
671
  raw_data?: Json | null;
@@ -287,17 +674,11 @@ export interface Database {
287
674
  timestamp?: string | null;
288
675
  to?: string | null;
289
676
  token?: string | null;
677
+ unique_id?: string | null;
678
+ updated_at?: string | null;
290
679
  vcards?: string[] | null;
291
680
  };
292
- Relationships: [
293
- {
294
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
295
- columns: ["org_id", "org_phone"];
296
- isOneToOne: false;
297
- referencedRelation: "tbl_org_phones";
298
- referencedColumns: ["org_id", "org_phone"];
299
- }
300
- ];
681
+ Relationships: [];
301
682
  };
302
683
  tbl_chat_notifications: {
303
684
  Row: {
@@ -311,6 +692,7 @@ export interface Database {
311
692
  recipientids: string[] | null;
312
693
  timestamp: string | null;
313
694
  type: string | null;
695
+ unique_id: string | null;
314
696
  };
315
697
  Insert: {
316
698
  author?: string | null;
@@ -323,6 +705,7 @@ export interface Database {
323
705
  recipientids?: string[] | null;
324
706
  timestamp?: string | null;
325
707
  type?: string | null;
708
+ unique_id?: string | null;
326
709
  };
327
710
  Update: {
328
711
  author?: string | null;
@@ -335,16 +718,9 @@ export interface Database {
335
718
  recipientids?: string[] | null;
336
719
  timestamp?: string | null;
337
720
  type?: string | null;
721
+ unique_id?: string | null;
338
722
  };
339
- Relationships: [
340
- {
341
- foreignKeyName: "tbl_chat_notifications_fkey_tbl_org_phones";
342
- columns: ["org_id", "org_phone"];
343
- isOneToOne: false;
344
- referencedRelation: "tbl_org_phones";
345
- referencedColumns: ["org_id", "org_phone"];
346
- }
347
- ];
723
+ Relationships: [];
348
724
  };
349
725
  tbl_chat_participants: {
350
726
  Row: {
@@ -354,6 +730,7 @@ export interface Database {
354
730
  is_admin: boolean | null;
355
731
  is_super_admin: boolean | null;
356
732
  org_id: string;
733
+ org_phone: string;
357
734
  };
358
735
  Insert: {
359
736
  chat_id: string;
@@ -362,6 +739,7 @@ export interface Database {
362
739
  is_admin?: boolean | null;
363
740
  is_super_admin?: boolean | null;
364
741
  org_id: string;
742
+ org_phone: string;
365
743
  };
366
744
  Update: {
367
745
  chat_id?: string;
@@ -370,14 +748,73 @@ export interface Database {
370
748
  is_admin?: boolean | null;
371
749
  is_super_admin?: boolean | null;
372
750
  org_id?: string;
751
+ org_phone?: string;
373
752
  };
374
753
  Relationships: [];
375
754
  };
376
- tbl_chat_reactions: {
755
+ tbl_chat_properties: {
377
756
  Row: {
378
- ack: number | null;
379
- id: Json | null;
380
- message_id: string | null;
757
+ assigned_to: string | null;
758
+ chat_access: Json | null;
759
+ chat_id: string;
760
+ chat_image: string | null;
761
+ chat_name: string | null;
762
+ chat_org_phones: string[];
763
+ chat_type: string | null;
764
+ closed_at: number | null;
765
+ custom_properties: Json | null;
766
+ flag_count_map: Json | null;
767
+ hubspot_metadata: Json | null;
768
+ label_ids: Json | null;
769
+ latest_message_timestamp: string | null;
770
+ org_id: string;
771
+ unread_count: Json | null;
772
+ updated_at: string | null;
773
+ };
774
+ Insert: {
775
+ assigned_to?: string | null;
776
+ chat_access?: Json | null;
777
+ chat_id: string;
778
+ chat_image?: string | null;
779
+ chat_name?: string | null;
780
+ chat_org_phones?: string[];
781
+ chat_type?: string | null;
782
+ closed_at?: number | null;
783
+ custom_properties?: Json | null;
784
+ flag_count_map?: Json | null;
785
+ hubspot_metadata?: Json | null;
786
+ label_ids?: Json | null;
787
+ latest_message_timestamp?: string | null;
788
+ org_id: string;
789
+ unread_count?: Json | null;
790
+ updated_at?: string | null;
791
+ };
792
+ Update: {
793
+ assigned_to?: string | null;
794
+ chat_access?: Json | null;
795
+ chat_id?: string;
796
+ chat_image?: string | null;
797
+ chat_name?: string | null;
798
+ chat_org_phones?: string[];
799
+ chat_type?: string | null;
800
+ closed_at?: number | null;
801
+ custom_properties?: Json | null;
802
+ flag_count_map?: Json | null;
803
+ hubspot_metadata?: Json | null;
804
+ label_ids?: Json | null;
805
+ latest_message_timestamp?: string | null;
806
+ org_id?: string;
807
+ unread_count?: Json | null;
808
+ updated_at?: string | null;
809
+ };
810
+ Relationships: [];
811
+ };
812
+ tbl_chat_reactions: {
813
+ Row: {
814
+ ack: number | null;
815
+ chat_id: string | null;
816
+ id: Json | null;
817
+ message_id: string;
381
818
  msg_id: Json | null;
382
819
  org_id: string;
383
820
  org_phone: string;
@@ -386,13 +823,15 @@ export interface Database {
386
823
  reaction: string | null;
387
824
  reaction_id: string;
388
825
  read: boolean | null;
389
- sender_id: string | null;
826
+ sender_id: string;
390
827
  timestamp: string | null;
828
+ unique_id: string | null;
391
829
  };
392
830
  Insert: {
393
831
  ack?: number | null;
832
+ chat_id?: string | null;
394
833
  id?: Json | null;
395
- message_id?: string | null;
834
+ message_id: string;
396
835
  msg_id?: Json | null;
397
836
  org_id: string;
398
837
  org_phone: string;
@@ -401,13 +840,15 @@ export interface Database {
401
840
  reaction?: string | null;
402
841
  reaction_id: string;
403
842
  read?: boolean | null;
404
- sender_id?: string | null;
843
+ sender_id: string;
405
844
  timestamp?: string | null;
845
+ unique_id?: string | null;
406
846
  };
407
847
  Update: {
408
848
  ack?: number | null;
849
+ chat_id?: string | null;
409
850
  id?: Json | null;
410
- message_id?: string | null;
851
+ message_id?: string;
411
852
  msg_id?: Json | null;
412
853
  org_id?: string;
413
854
  org_phone?: string;
@@ -416,16 +857,99 @@ export interface Database {
416
857
  reaction?: string | null;
417
858
  reaction_id?: string;
418
859
  read?: boolean | null;
419
- sender_id?: string | null;
860
+ sender_id?: string;
420
861
  timestamp?: string | null;
862
+ unique_id?: string | null;
863
+ };
864
+ Relationships: [];
865
+ };
866
+ tbl_chat_tickets: {
867
+ Row: {
868
+ assigned_by: string | null;
869
+ assignee: string | null;
870
+ chat_id: string;
871
+ close_ticket_metadata: Json | null;
872
+ closed_at: string | null;
873
+ created_at: string;
874
+ custom_properties: Json | null;
875
+ due_date: string | null;
876
+ freshdesk_metadata: Json | null;
877
+ hubspot_metadata: Json | null;
878
+ is_deleted: boolean;
879
+ label_ids: Json | null;
880
+ last_updated_at: string;
881
+ org_id: string;
882
+ priority: number | null;
883
+ quoted_message_id: string | null;
884
+ raised_by: string | null;
885
+ response_time: number | null;
886
+ status: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
887
+ subject: string;
888
+ ticket_id: string;
889
+ zohodesk_metadata: Json | null;
890
+ };
891
+ Insert: {
892
+ assigned_by?: string | null;
893
+ assignee?: string | null;
894
+ chat_id: string;
895
+ close_ticket_metadata?: Json | null;
896
+ closed_at?: string | null;
897
+ created_at?: string;
898
+ custom_properties?: Json | null;
899
+ due_date?: string | null;
900
+ freshdesk_metadata?: Json | null;
901
+ hubspot_metadata?: Json | null;
902
+ is_deleted?: boolean;
903
+ label_ids?: Json | null;
904
+ last_updated_at?: string;
905
+ org_id: string;
906
+ priority?: number | null;
907
+ quoted_message_id?: string | null;
908
+ raised_by?: string | null;
909
+ response_time?: number | null;
910
+ status?: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
911
+ subject: string;
912
+ ticket_id?: string;
913
+ zohodesk_metadata?: Json | null;
914
+ };
915
+ Update: {
916
+ assigned_by?: string | null;
917
+ assignee?: string | null;
918
+ chat_id?: string;
919
+ close_ticket_metadata?: Json | null;
920
+ closed_at?: string | null;
921
+ created_at?: string;
922
+ custom_properties?: Json | null;
923
+ due_date?: string | null;
924
+ freshdesk_metadata?: Json | null;
925
+ hubspot_metadata?: Json | null;
926
+ is_deleted?: boolean;
927
+ label_ids?: Json | null;
928
+ last_updated_at?: string;
929
+ org_id?: string;
930
+ priority?: number | null;
931
+ quoted_message_id?: string | null;
932
+ raised_by?: string | null;
933
+ response_time?: number | null;
934
+ status?: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
935
+ subject?: string;
936
+ ticket_id?: string;
937
+ zohodesk_metadata?: Json | null;
421
938
  };
422
939
  Relationships: [
423
940
  {
424
- foreignKeyName: "tbl_chat_reactions_fkey_tbl_org_phones";
425
- columns: ["org_id", "org_phone"];
941
+ foreignKeyName: "tbl_chat_tickets_org_id_fkey";
942
+ columns: ["org_id"];
943
+ isOneToOne: false;
944
+ referencedRelation: "tbl_org";
945
+ referencedColumns: ["org_id"];
946
+ },
947
+ {
948
+ foreignKeyName: "tbl_chat_tickets_org_id_fkey";
949
+ columns: ["org_id"];
426
950
  isOneToOne: false;
427
- referencedRelation: "tbl_org_phones";
428
- referencedColumns: ["org_id", "org_phone"];
951
+ referencedRelation: "view_org";
952
+ referencedColumns: ["org_id"];
429
953
  }
430
954
  ];
431
955
  };
@@ -434,13 +958,20 @@ export interface Database {
434
958
  archived: boolean | null;
435
959
  chat_id: string;
436
960
  chat_image: string | null;
961
+ chat_name: string | null;
962
+ chat_type: string | null;
963
+ created_at: string;
964
+ created_by: string | null;
437
965
  group_metadata: Json | null;
438
966
  id: Json | null;
439
967
  invite_link: string | null;
968
+ is_exited: boolean | null;
440
969
  is_group: boolean | null;
441
970
  is_muted: boolean | null;
442
971
  is_read_only: boolean | null;
443
- label_ids: Json;
972
+ latest_message: Json | null;
973
+ member_count: number | null;
974
+ member_unread_count: Json | null;
444
975
  mute_expiration: number | null;
445
976
  name: string | null;
446
977
  org_id: string;
@@ -448,18 +979,26 @@ export interface Database {
448
979
  pinned: boolean | null;
449
980
  timestamp: string | null;
450
981
  unread_count: number | null;
982
+ updated_at: string;
451
983
  };
452
984
  Insert: {
453
985
  archived?: boolean | null;
454
986
  chat_id: string;
455
987
  chat_image?: string | null;
988
+ chat_name?: string | null;
989
+ chat_type?: string | null;
990
+ created_at?: string;
991
+ created_by?: string | null;
456
992
  group_metadata?: Json | null;
457
993
  id?: Json | null;
458
994
  invite_link?: string | null;
995
+ is_exited?: boolean | null;
459
996
  is_group?: boolean | null;
460
997
  is_muted?: boolean | null;
461
998
  is_read_only?: boolean | null;
462
- label_ids?: Json;
999
+ latest_message?: Json | null;
1000
+ member_count?: number | null;
1001
+ member_unread_count?: Json | null;
463
1002
  mute_expiration?: number | null;
464
1003
  name?: string | null;
465
1004
  org_id: string;
@@ -467,18 +1006,26 @@ export interface Database {
467
1006
  pinned?: boolean | null;
468
1007
  timestamp?: string | null;
469
1008
  unread_count?: number | null;
1009
+ updated_at?: string;
470
1010
  };
471
1011
  Update: {
472
1012
  archived?: boolean | null;
473
1013
  chat_id?: string;
474
1014
  chat_image?: string | null;
1015
+ chat_name?: string | null;
1016
+ chat_type?: string | null;
1017
+ created_at?: string;
1018
+ created_by?: string | null;
475
1019
  group_metadata?: Json | null;
476
1020
  id?: Json | null;
477
1021
  invite_link?: string | null;
1022
+ is_exited?: boolean | null;
478
1023
  is_group?: boolean | null;
479
1024
  is_muted?: boolean | null;
480
1025
  is_read_only?: boolean | null;
481
- label_ids?: Json;
1026
+ latest_message?: Json | null;
1027
+ member_count?: number | null;
1028
+ member_unread_count?: Json | null;
482
1029
  mute_expiration?: number | null;
483
1030
  name?: string | null;
484
1031
  org_id?: string;
@@ -486,16 +1033,9 @@ export interface Database {
486
1033
  pinned?: boolean | null;
487
1034
  timestamp?: string | null;
488
1035
  unread_count?: number | null;
1036
+ updated_at?: string;
489
1037
  };
490
- Relationships: [
491
- {
492
- foreignKeyName: "tbl_chats_org_id_fkey";
493
- columns: ["org_id"];
494
- isOneToOne: false;
495
- referencedRelation: "tbl_org";
496
- referencedColumns: ["org_id"];
497
- }
498
- ];
1038
+ Relationships: [];
499
1039
  };
500
1040
  tbl_contacts: {
501
1041
  Row: {
@@ -510,6 +1050,7 @@ export interface Database {
510
1050
  is_business: boolean | null;
511
1051
  is_enterprise: boolean | null;
512
1052
  is_group: boolean | null;
1053
+ is_imported: boolean | null;
513
1054
  is_internal: boolean | null;
514
1055
  is_me: boolean | null;
515
1056
  is_my_contact: boolean | null;
@@ -519,8 +1060,10 @@ export interface Database {
519
1060
  name: string | null;
520
1061
  number: string | null;
521
1062
  org_id: string;
1063
+ periskope_name: string | null;
522
1064
  pushname: string | null;
523
1065
  short_name: string | null;
1066
+ updated_at: string | null;
524
1067
  verified_level: number | null;
525
1068
  verified_name: string | null;
526
1069
  };
@@ -536,6 +1079,7 @@ export interface Database {
536
1079
  is_business?: boolean | null;
537
1080
  is_enterprise?: boolean | null;
538
1081
  is_group?: boolean | null;
1082
+ is_imported?: boolean | null;
539
1083
  is_internal?: boolean | null;
540
1084
  is_me?: boolean | null;
541
1085
  is_my_contact?: boolean | null;
@@ -545,8 +1089,10 @@ export interface Database {
545
1089
  name?: string | null;
546
1090
  number?: string | null;
547
1091
  org_id: string;
1092
+ periskope_name?: string | null;
548
1093
  pushname?: string | null;
549
1094
  short_name?: string | null;
1095
+ updated_at?: string | null;
550
1096
  verified_level?: number | null;
551
1097
  verified_name?: string | null;
552
1098
  };
@@ -562,6 +1108,7 @@ export interface Database {
562
1108
  is_business?: boolean | null;
563
1109
  is_enterprise?: boolean | null;
564
1110
  is_group?: boolean | null;
1111
+ is_imported?: boolean | null;
565
1112
  is_internal?: boolean | null;
566
1113
  is_me?: boolean | null;
567
1114
  is_my_contact?: boolean | null;
@@ -571,8 +1118,10 @@ export interface Database {
571
1118
  name?: string | null;
572
1119
  number?: string | null;
573
1120
  org_id?: string;
1121
+ periskope_name?: string | null;
574
1122
  pushname?: string | null;
575
1123
  short_name?: string | null;
1124
+ updated_at?: string | null;
576
1125
  verified_level?: number | null;
577
1126
  verified_name?: string | null;
578
1127
  };
@@ -583,6 +1132,220 @@ export interface Database {
583
1132
  isOneToOne: false;
584
1133
  referencedRelation: "tbl_org";
585
1134
  referencedColumns: ["org_id"];
1135
+ },
1136
+ {
1137
+ foreignKeyName: "tbl_contacts_org_id_fkey";
1138
+ columns: ["org_id"];
1139
+ isOneToOne: false;
1140
+ referencedRelation: "view_org";
1141
+ referencedColumns: ["org_id"];
1142
+ }
1143
+ ];
1144
+ };
1145
+ tbl_custom_properties: {
1146
+ Row: {
1147
+ created_at: string;
1148
+ created_by: string | null;
1149
+ org_id: string | null;
1150
+ property_id: string;
1151
+ property_name: string;
1152
+ property_value: Json | null;
1153
+ property_value_type: string | null;
1154
+ type: string | null;
1155
+ };
1156
+ Insert: {
1157
+ created_at?: string;
1158
+ created_by?: string | null;
1159
+ org_id?: string | null;
1160
+ property_id?: string;
1161
+ property_name: string;
1162
+ property_value?: Json | null;
1163
+ property_value_type?: string | null;
1164
+ type?: string | null;
1165
+ };
1166
+ Update: {
1167
+ created_at?: string;
1168
+ created_by?: string | null;
1169
+ org_id?: string | null;
1170
+ property_id?: string;
1171
+ property_name?: string;
1172
+ property_value?: Json | null;
1173
+ property_value_type?: string | null;
1174
+ type?: string | null;
1175
+ };
1176
+ Relationships: [
1177
+ {
1178
+ foreignKeyName: "tbl_custom_properties_org_id_fkey";
1179
+ columns: ["org_id"];
1180
+ isOneToOne: false;
1181
+ referencedRelation: "tbl_org";
1182
+ referencedColumns: ["org_id"];
1183
+ },
1184
+ {
1185
+ foreignKeyName: "tbl_custom_properties_org_id_fkey";
1186
+ columns: ["org_id"];
1187
+ isOneToOne: false;
1188
+ referencedRelation: "view_org";
1189
+ referencedColumns: ["org_id"];
1190
+ }
1191
+ ];
1192
+ };
1193
+ tbl_integration_hooks: {
1194
+ Row: {
1195
+ hook_url: string;
1196
+ id: string;
1197
+ integration_id: string | null;
1198
+ integration_metadata: Json;
1199
+ integration_name: Database["public"]["Enums"]["enum_integration_name"];
1200
+ integration_type: string;
1201
+ is_subscribed: boolean;
1202
+ org_id: string;
1203
+ subscribed_at: string;
1204
+ type: Database["public"]["Enums"]["enum_integration_type"];
1205
+ };
1206
+ Insert: {
1207
+ hook_url: string;
1208
+ id?: string;
1209
+ integration_id?: string | null;
1210
+ integration_metadata: Json;
1211
+ integration_name: Database["public"]["Enums"]["enum_integration_name"];
1212
+ integration_type: string;
1213
+ is_subscribed: boolean;
1214
+ org_id: string;
1215
+ subscribed_at?: string;
1216
+ type: Database["public"]["Enums"]["enum_integration_type"];
1217
+ };
1218
+ Update: {
1219
+ hook_url?: string;
1220
+ id?: string;
1221
+ integration_id?: string | null;
1222
+ integration_metadata?: Json;
1223
+ integration_name?: Database["public"]["Enums"]["enum_integration_name"];
1224
+ integration_type?: string;
1225
+ is_subscribed?: boolean;
1226
+ org_id?: string;
1227
+ subscribed_at?: string;
1228
+ type?: Database["public"]["Enums"]["enum_integration_type"];
1229
+ };
1230
+ Relationships: [
1231
+ {
1232
+ foreignKeyName: "tbl_integration_hooks_org_id_fkey";
1233
+ columns: ["org_id"];
1234
+ isOneToOne: false;
1235
+ referencedRelation: "tbl_org";
1236
+ referencedColumns: ["org_id"];
1237
+ },
1238
+ {
1239
+ foreignKeyName: "tbl_integration_hooks_org_id_fkey";
1240
+ columns: ["org_id"];
1241
+ isOneToOne: false;
1242
+ referencedRelation: "view_org";
1243
+ referencedColumns: ["org_id"];
1244
+ }
1245
+ ];
1246
+ };
1247
+ tbl_integration_logs: {
1248
+ Row: {
1249
+ created_at: string;
1250
+ id: string;
1251
+ integration_name: Database["public"]["Enums"]["enum_integration_name"];
1252
+ integration_type: string;
1253
+ metadata: Json;
1254
+ org_id: string;
1255
+ response: Json | null;
1256
+ success: boolean;
1257
+ type: Database["public"]["Enums"]["enum_integration_type"];
1258
+ };
1259
+ Insert: {
1260
+ created_at?: string;
1261
+ id?: string;
1262
+ integration_name: Database["public"]["Enums"]["enum_integration_name"];
1263
+ integration_type: string;
1264
+ metadata?: Json;
1265
+ org_id: string;
1266
+ response?: Json | null;
1267
+ success?: boolean;
1268
+ type: Database["public"]["Enums"]["enum_integration_type"];
1269
+ };
1270
+ Update: {
1271
+ created_at?: string;
1272
+ id?: string;
1273
+ integration_name?: Database["public"]["Enums"]["enum_integration_name"];
1274
+ integration_type?: string;
1275
+ metadata?: Json;
1276
+ org_id?: string;
1277
+ response?: Json | null;
1278
+ success?: boolean;
1279
+ type?: Database["public"]["Enums"]["enum_integration_type"];
1280
+ };
1281
+ Relationships: [
1282
+ {
1283
+ foreignKeyName: "tbl_integration_logs_org_id_fkey";
1284
+ columns: ["org_id"];
1285
+ isOneToOne: false;
1286
+ referencedRelation: "tbl_org";
1287
+ referencedColumns: ["org_id"];
1288
+ },
1289
+ {
1290
+ foreignKeyName: "tbl_integration_logs_org_id_fkey";
1291
+ columns: ["org_id"];
1292
+ isOneToOne: false;
1293
+ referencedRelation: "view_org";
1294
+ referencedColumns: ["org_id"];
1295
+ }
1296
+ ];
1297
+ };
1298
+ tbl_integration_tokens: {
1299
+ Row: {
1300
+ exp: string;
1301
+ iat: string;
1302
+ id: string;
1303
+ is_revealed: boolean;
1304
+ name: string;
1305
+ org_id: string;
1306
+ role: string;
1307
+ token: string;
1308
+ token_metadata: Json | null;
1309
+ type: Database["public"]["Enums"]["enum_integration_type"];
1310
+ };
1311
+ Insert: {
1312
+ exp: string;
1313
+ iat: string;
1314
+ id?: string;
1315
+ is_revealed?: boolean;
1316
+ name: string;
1317
+ org_id: string;
1318
+ role: string;
1319
+ token: string;
1320
+ token_metadata?: Json | null;
1321
+ type: Database["public"]["Enums"]["enum_integration_type"];
1322
+ };
1323
+ Update: {
1324
+ exp?: string;
1325
+ iat?: string;
1326
+ id?: string;
1327
+ is_revealed?: boolean;
1328
+ name?: string;
1329
+ org_id?: string;
1330
+ role?: string;
1331
+ token?: string;
1332
+ token_metadata?: Json | null;
1333
+ type?: Database["public"]["Enums"]["enum_integration_type"];
1334
+ };
1335
+ Relationships: [
1336
+ {
1337
+ foreignKeyName: "public_tbl_integration_tokens_org_id_fkey";
1338
+ columns: ["org_id"];
1339
+ isOneToOne: false;
1340
+ referencedRelation: "tbl_org";
1341
+ referencedColumns: ["org_id"];
1342
+ },
1343
+ {
1344
+ foreignKeyName: "public_tbl_integration_tokens_org_id_fkey";
1345
+ columns: ["org_id"];
1346
+ isOneToOne: false;
1347
+ referencedRelation: "view_org";
1348
+ referencedColumns: ["org_id"];
586
1349
  }
587
1350
  ];
588
1351
  };
@@ -591,21 +1354,36 @@ export interface Database {
591
1354
  created_at: string;
592
1355
  org_id: string;
593
1356
  org_image: string | null;
1357
+ org_metadata: Json | null;
594
1358
  org_name: string | null;
1359
+ org_plan: Json | null;
1360
+ stripe_customer_details: Json | null;
1361
+ stripe_customer_id: string | null;
1362
+ stripe_subscription_details: Json | null;
595
1363
  support_link: string | null;
596
1364
  };
597
1365
  Insert: {
598
1366
  created_at?: string;
599
1367
  org_id?: string;
600
1368
  org_image?: string | null;
1369
+ org_metadata?: Json | null;
601
1370
  org_name?: string | null;
1371
+ org_plan?: Json | null;
1372
+ stripe_customer_details?: Json | null;
1373
+ stripe_customer_id?: string | null;
1374
+ stripe_subscription_details?: Json | null;
602
1375
  support_link?: string | null;
603
1376
  };
604
1377
  Update: {
605
1378
  created_at?: string;
606
1379
  org_id?: string;
607
1380
  org_image?: string | null;
1381
+ org_metadata?: Json | null;
608
1382
  org_name?: string | null;
1383
+ org_plan?: Json | null;
1384
+ stripe_customer_details?: Json | null;
1385
+ stripe_customer_id?: string | null;
1386
+ stripe_subscription_details?: Json | null;
609
1387
  support_link?: string | null;
610
1388
  };
611
1389
  Relationships: [];
@@ -624,7 +1402,7 @@ export interface Database {
624
1402
  created_at?: string;
625
1403
  label_id?: string;
626
1404
  name: string;
627
- org_id?: string;
1405
+ org_id: string;
628
1406
  type?: string;
629
1407
  };
630
1408
  Update: {
@@ -642,6 +1420,13 @@ export interface Database {
642
1420
  isOneToOne: false;
643
1421
  referencedRelation: "tbl_org";
644
1422
  referencedColumns: ["org_id"];
1423
+ },
1424
+ {
1425
+ foreignKeyName: "tbl_org_labels_org_id_fkey";
1426
+ columns: ["org_id"];
1427
+ isOneToOne: false;
1428
+ referencedRelation: "view_org";
1429
+ referencedColumns: ["org_id"];
645
1430
  }
646
1431
  ];
647
1432
  };
@@ -652,9 +1437,14 @@ export interface Database {
652
1437
  invited_at: string | null;
653
1438
  invited_by: string | null;
654
1439
  is_active: boolean;
1440
+ is_owner: boolean | null;
1441
+ label_ids: string[] | null;
1442
+ member_color: Database["public"]["Enums"]["enum_chat_colors"];
655
1443
  member_image: string | null;
656
1444
  member_name: string | null;
657
1445
  org_id: string;
1446
+ org_phones: string[] | null;
1447
+ preferences: Json;
658
1448
  role: Database["public"]["Enums"]["enum_member_role"];
659
1449
  user_id: string | null;
660
1450
  };
@@ -664,9 +1454,14 @@ export interface Database {
664
1454
  invited_at?: string | null;
665
1455
  invited_by?: string | null;
666
1456
  is_active?: boolean;
1457
+ is_owner?: boolean | null;
1458
+ label_ids?: string[] | null;
1459
+ member_color?: Database["public"]["Enums"]["enum_chat_colors"];
667
1460
  member_image?: string | null;
668
1461
  member_name?: string | null;
669
1462
  org_id: string;
1463
+ org_phones?: string[] | null;
1464
+ preferences?: Json;
670
1465
  role?: Database["public"]["Enums"]["enum_member_role"];
671
1466
  user_id?: string | null;
672
1467
  };
@@ -676,9 +1471,14 @@ export interface Database {
676
1471
  invited_at?: string | null;
677
1472
  invited_by?: string | null;
678
1473
  is_active?: boolean;
1474
+ is_owner?: boolean | null;
1475
+ label_ids?: string[] | null;
1476
+ member_color?: Database["public"]["Enums"]["enum_chat_colors"];
679
1477
  member_image?: string | null;
680
1478
  member_name?: string | null;
681
1479
  org_id?: string;
1480
+ org_phones?: string[] | null;
1481
+ preferences?: Json;
682
1482
  role?: Database["public"]["Enums"]["enum_member_role"];
683
1483
  user_id?: string | null;
684
1484
  };
@@ -696,45 +1496,79 @@ export interface Database {
696
1496
  isOneToOne: false;
697
1497
  referencedRelation: "tbl_org";
698
1498
  referencedColumns: ["org_id"];
1499
+ },
1500
+ {
1501
+ foreignKeyName: "tbl_org_members_fkey_tbl_org";
1502
+ columns: ["org_id"];
1503
+ isOneToOne: false;
1504
+ referencedRelation: "view_org";
1505
+ referencedColumns: ["org_id"];
699
1506
  }
700
1507
  ];
701
1508
  };
702
1509
  tbl_org_phones: {
703
1510
  Row: {
704
1511
  created_at: string;
705
- is_ready: boolean;
1512
+ first_connected_at: string | null;
1513
+ is_browser_open: boolean;
1514
+ is_ready: boolean | null;
1515
+ legacy_version: boolean | null;
1516
+ library: string | null;
706
1517
  org_id: string;
707
1518
  org_phone: string | null;
708
1519
  phone_id: string;
709
1520
  phone_image: string | null;
710
1521
  phone_name: string | null;
1522
+ phone_state: Json | null;
711
1523
  qr_code: string | null;
712
- updated_at: string;
1524
+ server_image: string | null;
1525
+ server_ip: string | null;
1526
+ soft_restart: boolean;
1527
+ updated_at: string | null;
713
1528
  wa_state: string | null;
1529
+ wa_version: string | null;
714
1530
  };
715
1531
  Insert: {
716
1532
  created_at?: string;
717
- is_ready?: boolean;
1533
+ first_connected_at?: string | null;
1534
+ is_browser_open?: boolean;
1535
+ is_ready?: boolean | null;
1536
+ legacy_version?: boolean | null;
1537
+ library?: string | null;
718
1538
  org_id: string;
719
1539
  org_phone?: string | null;
720
1540
  phone_id?: string;
721
1541
  phone_image?: string | null;
722
1542
  phone_name?: string | null;
1543
+ phone_state?: Json | null;
723
1544
  qr_code?: string | null;
724
- updated_at?: string;
1545
+ server_image?: string | null;
1546
+ server_ip?: string | null;
1547
+ soft_restart?: boolean;
1548
+ updated_at?: string | null;
725
1549
  wa_state?: string | null;
1550
+ wa_version?: string | null;
726
1551
  };
727
1552
  Update: {
728
1553
  created_at?: string;
729
- is_ready?: boolean;
1554
+ first_connected_at?: string | null;
1555
+ is_browser_open?: boolean;
1556
+ is_ready?: boolean | null;
1557
+ legacy_version?: boolean | null;
1558
+ library?: string | null;
730
1559
  org_id?: string;
731
1560
  org_phone?: string | null;
732
1561
  phone_id?: string;
733
1562
  phone_image?: string | null;
734
1563
  phone_name?: string | null;
1564
+ phone_state?: Json | null;
735
1565
  qr_code?: string | null;
736
- updated_at?: string;
1566
+ server_image?: string | null;
1567
+ server_ip?: string | null;
1568
+ soft_restart?: boolean;
1569
+ updated_at?: string | null;
737
1570
  wa_state?: string | null;
1571
+ wa_version?: string | null;
738
1572
  };
739
1573
  Relationships: [
740
1574
  {
@@ -743,51 +1577,465 @@ export interface Database {
743
1577
  isOneToOne: false;
744
1578
  referencedRelation: "tbl_org";
745
1579
  referencedColumns: ["org_id"];
1580
+ },
1581
+ {
1582
+ foreignKeyName: "tbl_org_phones_fkey_tbl_org";
1583
+ columns: ["org_id"];
1584
+ isOneToOne: false;
1585
+ referencedRelation: "view_org";
1586
+ referencedColumns: ["org_id"];
1587
+ },
1588
+ {
1589
+ foreignKeyName: "tbl_org_phones_org_id_fkey";
1590
+ columns: ["org_id"];
1591
+ isOneToOne: false;
1592
+ referencedRelation: "tbl_org";
1593
+ referencedColumns: ["org_id"];
1594
+ },
1595
+ {
1596
+ foreignKeyName: "tbl_org_phones_org_id_fkey";
1597
+ columns: ["org_id"];
1598
+ isOneToOne: false;
1599
+ referencedRelation: "view_org";
1600
+ referencedColumns: ["org_id"];
746
1601
  }
747
1602
  ];
748
1603
  };
749
- };
750
- Views: {
751
- view_chats: {
1604
+ tbl_org_transactions: {
752
1605
  Row: {
753
- archived: boolean | null;
754
- chat_access: Json | null;
755
- chat_id: string | null;
756
- chat_image: string | null;
757
- chat_type: string | null;
758
- group_metadata: Json | null;
759
- has_access: boolean | null;
760
- id: Json | null;
761
- invite_link: string | null;
762
- is_group: boolean | null;
763
- is_muted: boolean | null;
764
- is_read_only: boolean | null;
765
- label_ids: Json | null;
766
- last_read_timestamp: string | null;
767
- latest_message: Json | null;
768
- latest_message_timestamp: string | null;
769
- member_count: number | null;
770
- message_unread_count: number | null;
771
- mute_expiration: number | null;
772
- name: string | null;
773
- org_id: string | null;
774
- org_phone: string | null;
775
- pinned: boolean | null;
1606
+ amount: number;
1607
+ is_top_up: boolean | null;
1608
+ org_id: string;
776
1609
  timestamp: string | null;
777
- unread_count: number | null;
1610
+ transaction_id: string;
1611
+ transaction_metadata: Json | null;
1612
+ transaction_type: Database["public"]["Enums"]["enum_credit_transaction_type"];
1613
+ usage_metadata: Json | null;
1614
+ };
1615
+ Insert: {
1616
+ amount: number;
1617
+ is_top_up?: boolean | null;
1618
+ org_id: string;
1619
+ timestamp?: string | null;
1620
+ transaction_id?: string;
1621
+ transaction_metadata?: Json | null;
1622
+ transaction_type: Database["public"]["Enums"]["enum_credit_transaction_type"];
1623
+ usage_metadata?: Json | null;
1624
+ };
1625
+ Update: {
1626
+ amount?: number;
1627
+ is_top_up?: boolean | null;
1628
+ org_id?: string;
1629
+ timestamp?: string | null;
1630
+ transaction_id?: string;
1631
+ transaction_metadata?: Json | null;
1632
+ transaction_type?: Database["public"]["Enums"]["enum_credit_transaction_type"];
1633
+ usage_metadata?: Json | null;
1634
+ };
1635
+ Relationships: [
1636
+ {
1637
+ foreignKeyName: "tbl_org_transactions_org_id_fkey";
1638
+ columns: ["org_id"];
1639
+ isOneToOne: false;
1640
+ referencedRelation: "tbl_org";
1641
+ referencedColumns: ["org_id"];
1642
+ },
1643
+ {
1644
+ foreignKeyName: "tbl_org_transactions_org_id_fkey";
1645
+ columns: ["org_id"];
1646
+ isOneToOne: false;
1647
+ referencedRelation: "view_org";
1648
+ referencedColumns: ["org_id"];
1649
+ }
1650
+ ];
1651
+ };
1652
+ tbl_quick_replies: {
1653
+ Row: {
1654
+ command: string | null;
1655
+ created_at: string;
1656
+ message_payload: Json | null;
1657
+ org_id: string;
1658
+ reply_id: string;
1659
+ };
1660
+ Insert: {
1661
+ command?: string | null;
1662
+ created_at?: string;
1663
+ message_payload?: Json | null;
1664
+ org_id: string;
1665
+ reply_id?: string;
1666
+ };
1667
+ Update: {
1668
+ command?: string | null;
1669
+ created_at?: string;
1670
+ message_payload?: Json | null;
1671
+ org_id?: string;
1672
+ reply_id?: string;
1673
+ };
1674
+ Relationships: [
1675
+ {
1676
+ foreignKeyName: "tbl_quick_replies_org_id_fkey";
1677
+ columns: ["org_id"];
1678
+ isOneToOne: false;
1679
+ referencedRelation: "tbl_org";
1680
+ referencedColumns: ["org_id"];
1681
+ },
1682
+ {
1683
+ foreignKeyName: "tbl_quick_replies_org_id_fkey";
1684
+ columns: ["org_id"];
1685
+ isOneToOne: false;
1686
+ referencedRelation: "view_org";
1687
+ referencedColumns: ["org_id"];
1688
+ }
1689
+ ];
1690
+ };
1691
+ tbl_rules_logs: {
1692
+ Row: {
1693
+ actions_progress: Json | null;
1694
+ conditions_progress: Json | null;
1695
+ created_at: string;
1696
+ log_id: string;
1697
+ metadata: Json | null;
1698
+ org_id: string;
1699
+ rule_id: string;
1700
+ trace_id: string | null;
1701
+ trigger: string;
1702
+ };
1703
+ Insert: {
1704
+ actions_progress?: Json | null;
1705
+ conditions_progress?: Json | null;
1706
+ created_at?: string;
1707
+ log_id?: string;
1708
+ metadata?: Json | null;
1709
+ org_id: string;
1710
+ rule_id: string;
1711
+ trace_id?: string | null;
1712
+ trigger: string;
1713
+ };
1714
+ Update: {
1715
+ actions_progress?: Json | null;
1716
+ conditions_progress?: Json | null;
1717
+ created_at?: string;
1718
+ log_id?: string;
1719
+ metadata?: Json | null;
1720
+ org_id?: string;
1721
+ rule_id?: string;
1722
+ trace_id?: string | null;
1723
+ trigger?: string;
1724
+ };
1725
+ Relationships: [
1726
+ {
1727
+ foreignKeyName: "tbl_rules_logs_org_id_fkey";
1728
+ columns: ["org_id"];
1729
+ isOneToOne: false;
1730
+ referencedRelation: "tbl_org";
1731
+ referencedColumns: ["org_id"];
1732
+ },
1733
+ {
1734
+ foreignKeyName: "tbl_rules_logs_org_id_fkey";
1735
+ columns: ["org_id"];
1736
+ isOneToOne: false;
1737
+ referencedRelation: "view_org";
1738
+ referencedColumns: ["org_id"];
1739
+ },
1740
+ {
1741
+ foreignKeyName: "tbl_rules_logs_rule_id_fkey";
1742
+ columns: ["rule_id"];
1743
+ isOneToOne: false;
1744
+ referencedRelation: "tbl_automation_rules";
1745
+ referencedColumns: ["id"];
1746
+ }
1747
+ ];
1748
+ };
1749
+ tbl_scheduled_messages: {
1750
+ Row: {
1751
+ chat_id: string;
1752
+ created_at: string;
1753
+ message_id: string | null;
1754
+ message_payload: Json | null;
1755
+ org_id: string;
1756
+ org_phone: string | null;
1757
+ performed_by: string | null;
1758
+ scheduled_at: string;
1759
+ sent_message_id: string;
1760
+ status: boolean | null;
1761
+ updated_at: string | null;
1762
+ };
1763
+ Insert: {
1764
+ chat_id: string;
1765
+ created_at?: string;
1766
+ message_id?: string | null;
1767
+ message_payload?: Json | null;
1768
+ org_id: string;
1769
+ org_phone?: string | null;
1770
+ performed_by?: string | null;
1771
+ scheduled_at: string;
1772
+ sent_message_id: string;
1773
+ status?: boolean | null;
1774
+ updated_at?: string | null;
1775
+ };
1776
+ Update: {
1777
+ chat_id?: string;
1778
+ created_at?: string;
1779
+ message_id?: string | null;
1780
+ message_payload?: Json | null;
1781
+ org_id?: string;
1782
+ org_phone?: string | null;
1783
+ performed_by?: string | null;
1784
+ scheduled_at?: string;
1785
+ sent_message_id?: string;
1786
+ status?: boolean | null;
1787
+ updated_at?: string | null;
778
1788
  };
779
1789
  Relationships: [
780
1790
  {
781
- foreignKeyName: "tbl_chats_org_id_fkey";
1791
+ foreignKeyName: "tbl_scheduled_messages_org_id_fkey";
782
1792
  columns: ["org_id"];
783
1793
  isOneToOne: false;
784
1794
  referencedRelation: "tbl_org";
785
1795
  referencedColumns: ["org_id"];
1796
+ },
1797
+ {
1798
+ foreignKeyName: "tbl_scheduled_messages_org_id_fkey";
1799
+ columns: ["org_id"];
1800
+ isOneToOne: false;
1801
+ referencedRelation: "view_org";
1802
+ referencedColumns: ["org_id"];
786
1803
  }
787
1804
  ];
788
1805
  };
1806
+ tbl_tools_whatsapp_links: {
1807
+ Row: {
1808
+ created_at: string;
1809
+ link_id: string;
1810
+ link_name: string;
1811
+ message: string | null;
1812
+ phone: string;
1813
+ };
1814
+ Insert: {
1815
+ created_at?: string;
1816
+ link_id?: string;
1817
+ link_name: string;
1818
+ message?: string | null;
1819
+ phone: string;
1820
+ };
1821
+ Update: {
1822
+ created_at?: string;
1823
+ link_id?: string;
1824
+ link_name?: string;
1825
+ message?: string | null;
1826
+ phone?: string;
1827
+ };
1828
+ Relationships: [];
1829
+ };
1830
+ };
1831
+ Views: {
1832
+ view_broadcast_logs: {
1833
+ Row: {
1834
+ broadcast_id: string | null;
1835
+ broadcast_status: Database["public"]["Enums"]["enum_broadcast_status"] | null;
1836
+ created_at: string | null;
1837
+ delivered_percentage: number | null;
1838
+ failed_chats: number | null;
1839
+ message_payload: Json | null;
1840
+ org_id: string | null;
1841
+ pending_chats: number | null;
1842
+ performed_at: string | null;
1843
+ performed_by: string | null;
1844
+ read_percentage: number | null;
1845
+ scheduled_at: string | null;
1846
+ sent_chats: number | null;
1847
+ total_chats: number | null;
1848
+ total_delivered_count: number | null;
1849
+ total_member_count: number | null;
1850
+ total_read_count: number | null;
1851
+ };
1852
+ Relationships: [
1853
+ {
1854
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
1855
+ columns: ["org_id"];
1856
+ isOneToOne: false;
1857
+ referencedRelation: "tbl_org";
1858
+ referencedColumns: ["org_id"];
1859
+ },
1860
+ {
1861
+ foreignKeyName: "tbl_broadcast_messages_org_id_fkey";
1862
+ columns: ["org_id"];
1863
+ isOneToOne: false;
1864
+ referencedRelation: "view_org";
1865
+ referencedColumns: ["org_id"];
1866
+ }
1867
+ ];
1868
+ };
1869
+ view_chat_logs: {
1870
+ Row: {
1871
+ action: string | null;
1872
+ failed: number | null;
1873
+ operation_id: string | null;
1874
+ org_id: string | null;
1875
+ pending: number | null;
1876
+ performed_at: string | null;
1877
+ performed_by: string | null;
1878
+ success: number | null;
1879
+ total_chats: number | null;
1880
+ total_logs: number | null;
1881
+ total_participants: number | null;
1882
+ };
1883
+ Relationships: [
1884
+ {
1885
+ foreignKeyName: "tbl_chat_logs_org_id_fkey";
1886
+ columns: ["org_id"];
1887
+ isOneToOne: false;
1888
+ referencedRelation: "tbl_org";
1889
+ referencedColumns: ["org_id"];
1890
+ },
1891
+ {
1892
+ foreignKeyName: "tbl_chat_logs_org_id_fkey";
1893
+ columns: ["org_id"];
1894
+ isOneToOne: false;
1895
+ referencedRelation: "view_org";
1896
+ referencedColumns: ["org_id"];
1897
+ }
1898
+ ];
1899
+ };
1900
+ view_chats: {
1901
+ Row: {
1902
+ assigned_to: string | null;
1903
+ chat_access: Json | null;
1904
+ chat_id: string | null;
1905
+ chat_image: string | null;
1906
+ chat_name: string | null;
1907
+ chat_org_phones: string[] | null;
1908
+ chat_type: string | null;
1909
+ closed_at: number | null;
1910
+ created_at: string | null;
1911
+ custom_properties: Json | null;
1912
+ flag_count_map: Json | null;
1913
+ group_description: string | null;
1914
+ hubspot_metadata: Json | null;
1915
+ info_admins_only: boolean | null;
1916
+ invite_link: string | null;
1917
+ is_exited: boolean | null;
1918
+ is_muted: boolean | null;
1919
+ label_ids: Json | null;
1920
+ latest_message: Json | null;
1921
+ member_add_mode: string | null;
1922
+ member_count: number | null;
1923
+ message_unread_count: number | null;
1924
+ messages_admins_only: boolean | null;
1925
+ org_id: string | null;
1926
+ org_phone: string | null;
1927
+ updated_at: string | null;
1928
+ };
1929
+ Relationships: [];
1930
+ };
1931
+ view_org: {
1932
+ Row: {
1933
+ access_scopes: Json | null;
1934
+ created_at: string | null;
1935
+ is_enterprise: boolean | null;
1936
+ is_free_trial: boolean | null;
1937
+ is_freshdesk_connected: boolean | null;
1938
+ is_hubspot_connected: boolean | null;
1939
+ is_zohodesk_connected: boolean | null;
1940
+ org_id: string | null;
1941
+ org_image: string | null;
1942
+ org_metadata: Json | null;
1943
+ org_name: string | null;
1944
+ org_plan: Json | null;
1945
+ pending_days: number | null;
1946
+ phone_limit: string | null;
1947
+ plan_id: string | null;
1948
+ stripe_customer_details: Json | null;
1949
+ stripe_customer_id: string | null;
1950
+ stripe_subscription_details: Json | null;
1951
+ subscription_status: string | null;
1952
+ support_link: string | null;
1953
+ user_limit: string | null;
1954
+ };
1955
+ Insert: {
1956
+ access_scopes?: never;
1957
+ created_at?: string | null;
1958
+ is_enterprise?: never;
1959
+ is_free_trial?: never;
1960
+ is_freshdesk_connected?: never;
1961
+ is_hubspot_connected?: never;
1962
+ is_zohodesk_connected?: never;
1963
+ org_id?: string | null;
1964
+ org_image?: string | null;
1965
+ org_metadata?: Json | null;
1966
+ org_name?: string | null;
1967
+ org_plan?: Json | null;
1968
+ pending_days?: never;
1969
+ phone_limit?: never;
1970
+ plan_id?: never;
1971
+ stripe_customer_details?: Json | null;
1972
+ stripe_customer_id?: string | null;
1973
+ stripe_subscription_details?: Json | null;
1974
+ subscription_status?: never;
1975
+ support_link?: string | null;
1976
+ user_limit?: never;
1977
+ };
1978
+ Update: {
1979
+ access_scopes?: never;
1980
+ created_at?: string | null;
1981
+ is_enterprise?: never;
1982
+ is_free_trial?: never;
1983
+ is_freshdesk_connected?: never;
1984
+ is_hubspot_connected?: never;
1985
+ is_zohodesk_connected?: never;
1986
+ org_id?: string | null;
1987
+ org_image?: string | null;
1988
+ org_metadata?: Json | null;
1989
+ org_name?: string | null;
1990
+ org_plan?: Json | null;
1991
+ pending_days?: never;
1992
+ phone_limit?: never;
1993
+ plan_id?: never;
1994
+ stripe_customer_details?: Json | null;
1995
+ stripe_customer_id?: string | null;
1996
+ stripe_subscription_details?: Json | null;
1997
+ subscription_status?: never;
1998
+ support_link?: string | null;
1999
+ user_limit?: never;
2000
+ };
2001
+ Relationships: [];
2002
+ };
789
2003
  };
790
2004
  Functions: {
2005
+ check_feature_flag_access: {
2006
+ Args: {
2007
+ org_id_input: string;
2008
+ feature_input: string;
2009
+ };
2010
+ Returns: boolean;
2011
+ };
2012
+ create_partition: {
2013
+ Args: {
2014
+ org_id_input: string;
2015
+ };
2016
+ Returns: boolean;
2017
+ };
2018
+ custom_access_token_hook: {
2019
+ Args: {
2020
+ event: Json;
2021
+ };
2022
+ Returns: Json;
2023
+ };
2024
+ drop_partition: {
2025
+ Args: {
2026
+ org_id_input: string;
2027
+ };
2028
+ Returns: boolean;
2029
+ };
2030
+ find_discrepancies: {
2031
+ Args: {
2032
+ p_org_id: string;
2033
+ };
2034
+ Returns: {
2035
+ a_chat_id: string;
2036
+ discrepancy_count: number;
2037
+ }[];
2038
+ };
791
2039
  gen_id: {
792
2040
  Args: {
793
2041
  prefix: string;
@@ -796,23 +2044,118 @@ export interface Database {
796
2044
  };
797
2045
  Returns: string;
798
2046
  };
2047
+ gen_ticket_id: {
2048
+ Args: {
2049
+ org_id_input: string;
2050
+ };
2051
+ Returns: string;
2052
+ };
2053
+ generate_access_token: {
2054
+ Args: {
2055
+ name_input?: string;
2056
+ type_input?: Database["public"]["Enums"]["enum_integration_type"];
2057
+ org_id_input?: string;
2058
+ };
2059
+ Returns: Json;
2060
+ };
2061
+ get_api_auth_details: {
2062
+ Args: {
2063
+ org_id_input?: string;
2064
+ org_phone_input?: string;
2065
+ token_id_input?: string;
2066
+ token_type_input?: Database["public"]["Enums"]["enum_integration_type"];
2067
+ };
2068
+ Returns: Json;
2069
+ };
2070
+ get_chat_labels_data: {
2071
+ Args: {
2072
+ org_id_input: string;
2073
+ chat_ids_input?: string[];
2074
+ };
2075
+ Returns: Json[];
2076
+ };
2077
+ get_chat_rule_info: {
2078
+ Args: {
2079
+ chat_id_input: string;
2080
+ org_id_input: string;
2081
+ org_phone_input: string;
2082
+ };
2083
+ Returns: Json;
2084
+ };
799
2085
  get_chats: {
800
2086
  Args: {
2087
+ org_id_input: string;
801
2088
  chat_id_input?: string[];
802
- with_metadata?: boolean;
2089
+ with_members?: boolean;
2090
+ last_updated_at?: string;
2091
+ batch_limit?: number;
2092
+ batch_offset?: number;
2093
+ };
2094
+ Returns: Json;
2095
+ };
2096
+ get_chats_info: {
2097
+ Args: {
2098
+ chat_id_input: string;
2099
+ org_id_input: string;
2100
+ org_phone_input?: string;
803
2101
  };
804
2102
  Returns: Json;
805
2103
  };
806
2104
  get_contacts: {
807
2105
  Args: {
2106
+ org_id_input: string;
808
2107
  contact_ids_input?: string[];
2108
+ sync_phone_contacts?: boolean;
2109
+ search_input?: string;
2110
+ label_ids_input?: string[];
2111
+ is_internal_input?: boolean;
2112
+ offset_input?: number;
2113
+ limit_input?: number;
2114
+ };
2115
+ Returns: Json;
2116
+ };
2117
+ get_export_chats_data: {
2118
+ Args: {
2119
+ org_id_input: string;
2120
+ chat_id_input?: string[];
2121
+ };
2122
+ Returns: Json;
2123
+ };
2124
+ get_export_tickets_data: {
2125
+ Args: {
2126
+ org_id_input: string;
2127
+ ticket_id_input?: string[];
2128
+ };
2129
+ Returns: Json;
2130
+ };
2131
+ get_feature_flags: {
2132
+ Args: {
2133
+ org_id_input: string;
2134
+ };
2135
+ Returns: Json;
2136
+ };
2137
+ get_integration_data: {
2138
+ Args: {
2139
+ org_id_input?: string;
809
2140
  };
810
2141
  Returns: Json;
811
2142
  };
812
- get_media: {
2143
+ get_message_rule_info: {
813
2144
  Args: {
814
- filters?: Json;
815
- page_num?: number;
2145
+ message_id_input: string;
2146
+ chat_id_input: string;
2147
+ org_id_input: string;
2148
+ org_phone_input: string;
2149
+ sender_id_input: string;
2150
+ };
2151
+ Returns: Json;
2152
+ };
2153
+ get_messages_notifications_reactions: {
2154
+ Args: {
2155
+ org_id_input: string;
2156
+ chat_id_input?: string[];
2157
+ limit_input?: number;
2158
+ offset_input?: number;
816
2159
  };
817
2160
  Returns: Json;
818
2161
  };
@@ -822,25 +2165,120 @@ export interface Database {
822
2165
  };
823
2166
  Returns: Json;
824
2167
  };
2168
+ get_org_credits: {
2169
+ Args: {
2170
+ org_id_input?: string;
2171
+ };
2172
+ Returns: Json;
2173
+ };
2174
+ get_org_phones: {
2175
+ Args: {
2176
+ org_id_input?: string;
2177
+ phone_id_input?: string;
2178
+ };
2179
+ Returns: Json;
2180
+ };
2181
+ get_reaction_rule_info: {
2182
+ Args: {
2183
+ reaction_id_input: string;
2184
+ message_id_input: string;
2185
+ chat_id_input: string;
2186
+ org_id_input: string;
2187
+ org_phone_input: string;
2188
+ sender_id_input: string;
2189
+ };
2190
+ Returns: Json;
2191
+ };
2192
+ get_team_metrics_between_dates: {
2193
+ Args: {
2194
+ org_id_input: string;
2195
+ start_date: string;
2196
+ end_date: string;
2197
+ chat_id_input?: string[];
2198
+ };
2199
+ Returns: Json;
2200
+ };
2201
+ get_ticket_info: {
2202
+ Args: {
2203
+ ticket_id_input?: string;
2204
+ org_id_input?: string;
2205
+ chat_id_input?: string;
2206
+ unique_message_id_input?: string;
2207
+ };
2208
+ Returns: Json;
2209
+ };
2210
+ get_ticket_rule_info: {
2211
+ Args: {
2212
+ ticket_id_input: string;
2213
+ unique_message_id_input: string;
2214
+ chat_id_input: string;
2215
+ org_id_input: string;
2216
+ };
2217
+ Returns: Json;
2218
+ };
2219
+ get_universal_search_result: {
2220
+ Args: {
2221
+ search_category_input: string;
2222
+ search_query_input: string;
2223
+ org_id_input: string;
2224
+ };
2225
+ Returns: {
2226
+ category: string;
2227
+ result: Json;
2228
+ }[];
2229
+ };
2230
+ image_path: {
2231
+ Args: {
2232
+ path_input?: string;
2233
+ bucket_name?: string;
2234
+ req_base?: boolean;
2235
+ };
2236
+ Returns: string;
2237
+ };
825
2238
  list_org_from_user: {
826
2239
  Args: Record<PropertyKey, never>;
827
- Returns: string;
2240
+ Returns: string[];
828
2241
  };
829
2242
  list_role_from_user: {
830
2243
  Args: Record<PropertyKey, never>;
831
2244
  Returns: Database["public"]["Enums"]["enum_member_role"];
832
2245
  };
2246
+ update_chat_properties: {
2247
+ Args: {
2248
+ column_name: string;
2249
+ org_id_input: string;
2250
+ chat_id_input: string[];
2251
+ column_value_input?: string;
2252
+ key_input?: string;
2253
+ value_input?: Json;
2254
+ };
2255
+ Returns: undefined;
2256
+ };
2257
+ update_custom_properties: {
2258
+ Args: {
2259
+ org_id_input: string;
2260
+ row_properties_map: Json;
2261
+ replace_properties?: boolean;
2262
+ };
2263
+ Returns: undefined;
2264
+ };
833
2265
  update_labels: {
834
2266
  Args: {
2267
+ org_id_input: string;
835
2268
  tbl_type: string;
836
- label_ids_input: Json;
837
- row_id_input: string[];
2269
+ row_label_map: Json;
2270
+ replace_labels?: boolean;
838
2271
  };
839
2272
  Returns: undefined;
840
2273
  };
841
2274
  };
842
2275
  Enums: {
2276
+ enum_broadcast_status: "inprogress" | "completed" | "stopped" | "expired";
843
2277
  enum_chat_colors: "#B4876E" | "#A5B337" | "#06CF9C" | "#25D366" | "#02A698" | "#7D9EF1" | "#007BFC" | "#5E47DE" | "#7F66FF" | "#9333EA" | "#FA6533" | "#C4532D" | "#DC2626" | "#FF2E74" | "#DB2777";
2278
+ enum_chat_tickets_status: "open" | "inprogress" | "closed" | "archived";
2279
+ enum_credit_transaction_type: "credit" | "debit";
2280
+ enum_integration_name: "org.created" | "org.updated" | "org.member.created" | "org.member.updated" | "org.phone.created" | "org.phone.connected" | "org.phone.disconnected" | "org.subscription.trial_will_end" | "chat.created" | "chat.updated" | "chat.notification.created" | "message.created" | "message.updated" | "message.deleted" | "message.ack.updated" | "reaction.created" | "reaction.updated" | "ticket.created" | "ticket.updated" | "ticket.deleted" | "org.integrations.updated" | "message.flagged" | "message.unflagged" | "chat.label.updated" | "reaction.added" | "message.ticket.attached";
2281
+ enum_integration_type: "zapier" | "pabbly" | "api" | "webhook" | "hubspot" | "freshdesk" | "slack" | "jira" | "salesforce" | "zohodesk" | "gsheets";
844
2282
  enum_member_role: "admin" | "member";
845
2283
  };
846
2284
  CompositeTypes: {
@@ -959,6 +2397,101 @@ export interface Database {
959
2397
  }
960
2398
  ];
961
2399
  };
2400
+ s3_multipart_uploads: {
2401
+ Row: {
2402
+ bucket_id: string;
2403
+ created_at: string;
2404
+ id: string;
2405
+ in_progress_size: number;
2406
+ key: string;
2407
+ owner_id: string | null;
2408
+ upload_signature: string;
2409
+ version: string;
2410
+ };
2411
+ Insert: {
2412
+ bucket_id: string;
2413
+ created_at?: string;
2414
+ id: string;
2415
+ in_progress_size?: number;
2416
+ key: string;
2417
+ owner_id?: string | null;
2418
+ upload_signature: string;
2419
+ version: string;
2420
+ };
2421
+ Update: {
2422
+ bucket_id?: string;
2423
+ created_at?: string;
2424
+ id?: string;
2425
+ in_progress_size?: number;
2426
+ key?: string;
2427
+ owner_id?: string | null;
2428
+ upload_signature?: string;
2429
+ version?: string;
2430
+ };
2431
+ Relationships: [
2432
+ {
2433
+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey";
2434
+ columns: ["bucket_id"];
2435
+ isOneToOne: false;
2436
+ referencedRelation: "buckets";
2437
+ referencedColumns: ["id"];
2438
+ }
2439
+ ];
2440
+ };
2441
+ s3_multipart_uploads_parts: {
2442
+ Row: {
2443
+ bucket_id: string;
2444
+ created_at: string;
2445
+ etag: string;
2446
+ id: string;
2447
+ key: string;
2448
+ owner_id: string | null;
2449
+ part_number: number;
2450
+ size: number;
2451
+ upload_id: string;
2452
+ version: string;
2453
+ };
2454
+ Insert: {
2455
+ bucket_id: string;
2456
+ created_at?: string;
2457
+ etag: string;
2458
+ id?: string;
2459
+ key: string;
2460
+ owner_id?: string | null;
2461
+ part_number: number;
2462
+ size?: number;
2463
+ upload_id: string;
2464
+ version: string;
2465
+ };
2466
+ Update: {
2467
+ bucket_id?: string;
2468
+ created_at?: string;
2469
+ etag?: string;
2470
+ id?: string;
2471
+ key?: string;
2472
+ owner_id?: string | null;
2473
+ part_number?: number;
2474
+ size?: number;
2475
+ upload_id?: string;
2476
+ version?: string;
2477
+ };
2478
+ Relationships: [
2479
+ {
2480
+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey";
2481
+ columns: ["bucket_id"];
2482
+ isOneToOne: false;
2483
+ referencedRelation: "buckets";
2484
+ referencedColumns: ["id"];
2485
+ },
2486
+ {
2487
+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey";
2488
+ columns: ["upload_id"];
2489
+ isOneToOne: false;
2490
+ referencedRelation: "s3_multipart_uploads";
2491
+ referencedColumns: ["id"];
2492
+ }
2493
+ ];
2494
+ };
962
2495
  };
963
2496
  Views: {
964
2497
  [_ in never]: never;
@@ -989,7 +2522,7 @@ export interface Database {
989
2522
  Args: {
990
2523
  name: string;
991
2524
  };
992
- Returns: unknown;
2525
+ Returns: string[];
993
2526
  };
994
2527
  get_size_by_bucket: {
995
2528
  Args: Record<PropertyKey, never>;
@@ -998,6 +2531,37 @@ export interface Database {
998
2531
  bucket_id: string;
999
2532
  }[];
1000
2533
  };
2534
+ list_multipart_uploads_with_delimiter: {
2535
+ Args: {
2536
+ bucket_id: string;
2537
+ prefix_param: string;
2538
+ delimiter_param: string;
2539
+ max_keys?: number;
2540
+ next_key_token?: string;
2541
+ next_upload_token?: string;
2542
+ };
2543
+ Returns: {
2544
+ key: string;
2545
+ id: string;
2546
+ created_at: string;
2547
+ }[];
2548
+ };
2549
+ list_objects_with_delimiter: {
2550
+ Args: {
2551
+ bucket_id: string;
2552
+ prefix_param: string;
2553
+ delimiter_param: string;
2554
+ max_keys?: number;
2555
+ start_after?: string;
2556
+ next_token?: string;
2557
+ };
2558
+ Returns: {
2559
+ name: string;
2560
+ id: string;
2561
+ metadata: Json;
2562
+ updated_at: string;
2563
+ }[];
2564
+ };
1001
2565
  search: {
1002
2566
  Args: {
1003
2567
  prefix: string;
@@ -1026,8 +2590,9 @@ export interface Database {
1026
2590
  [_ in never]: never;
1027
2591
  };
1028
2592
  };
1029
- }
1030
- export type Tables<PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] & Database["public"]["Views"]) | {
2593
+ };
2594
+ type PublicSchema = Database[Extract<keyof Database, "public">];
2595
+ export type Tables<PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & PublicSchema["Views"]) | {
1031
2596
  schema: keyof Database;
1032
2597
  }, TableName extends PublicTableNameOrOptions extends {
1033
2598
  schema: keyof Database;
@@ -1035,10 +2600,10 @@ export type Tables<PublicTableNameOrOptions extends keyof (Database["public"]["T
1035
2600
  schema: keyof Database;
1036
2601
  } ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
1037
2602
  Row: infer R;
1038
- } ? R : never : PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] & Database["public"]["Views"]) ? (Database["public"]["Tables"] & Database["public"]["Views"])[PublicTableNameOrOptions] extends {
2603
+ } ? R : never : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & PublicSchema["Views"]) ? (PublicSchema["Tables"] & PublicSchema["Views"])[PublicTableNameOrOptions] extends {
1039
2604
  Row: infer R;
1040
2605
  } ? R : never : never;
1041
- export type TablesInsert<PublicTableNameOrOptions extends keyof Database["public"]["Tables"] | {
2606
+ export type TablesInsert<PublicTableNameOrOptions extends keyof PublicSchema["Tables"] | {
1042
2607
  schema: keyof Database;
1043
2608
  }, TableName extends PublicTableNameOrOptions extends {
1044
2609
  schema: keyof Database;
@@ -1046,10 +2611,10 @@ export type TablesInsert<PublicTableNameOrOptions extends keyof Database["public
1046
2611
  schema: keyof Database;
1047
2612
  } ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
1048
2613
  Insert: infer I;
1049
- } ? I : never : PublicTableNameOrOptions extends keyof Database["public"]["Tables"] ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
2614
+ } ? I : never : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
1050
2615
  Insert: infer I;
1051
2616
  } ? I : never : never;
1052
- export type TablesUpdate<PublicTableNameOrOptions extends keyof Database["public"]["Tables"] | {
2617
+ export type TablesUpdate<PublicTableNameOrOptions extends keyof PublicSchema["Tables"] | {
1053
2618
  schema: keyof Database;
1054
2619
  }, TableName extends PublicTableNameOrOptions extends {
1055
2620
  schema: keyof Database;
@@ -1057,13 +2622,14 @@ export type TablesUpdate<PublicTableNameOrOptions extends keyof Database["public
1057
2622
  schema: keyof Database;
1058
2623
  } ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
1059
2624
  Update: infer U;
1060
- } ? U : never : PublicTableNameOrOptions extends keyof Database["public"]["Tables"] ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
2625
+ } ? U : never : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
1061
2626
  Update: infer U;
1062
2627
  } ? U : never : never;
1063
- export type Enums<PublicEnumNameOrOptions extends keyof Database["public"]["Enums"] | {
2628
+ export type Enums<PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] | {
1064
2629
  schema: keyof Database;
1065
2630
  }, EnumName extends PublicEnumNameOrOptions extends {
1066
2631
  schema: keyof Database;
1067
2632
  } ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] : never = never> = PublicEnumNameOrOptions extends {
1068
2633
  schema: keyof Database;
1069
- } ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] : PublicEnumNameOrOptions extends keyof Database["public"]["Enums"] ? Database["public"]["Enums"][PublicEnumNameOrOptions] : never;
2634
+ } ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] ? PublicSchema["Enums"][PublicEnumNameOrOptions] : never;
2635
+ export {};