@periskope/types 0.6.4 → 0.6.6

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.
@@ -51,7 +51,15 @@ export interface Database {
51
51
  last_read_timestamp?: string | null;
52
52
  org_id?: string;
53
53
  };
54
- Relationships: [];
54
+ Relationships: [
55
+ {
56
+ foreignKeyName: "tbl_chat_access_org_id_fkey";
57
+ columns: ["org_id"];
58
+ isOneToOne: false;
59
+ referencedRelation: "tbl_org";
60
+ referencedColumns: ["org_id"];
61
+ }
62
+ ];
55
63
  };
56
64
  tbl_chat_messages: {
57
65
  Row: {
@@ -77,19 +85,20 @@ export interface Database {
77
85
  is_status: boolean | null;
78
86
  links: Json | null;
79
87
  location: Json | null;
88
+ media: Json | null;
80
89
  media_key: string | null;
81
90
  mentioned_ids: string[] | null;
82
91
  message_id: string;
92
+ message_type: string | null;
83
93
  order_id: string | null;
84
94
  org_id: string;
85
95
  org_phone: string;
86
96
  performed_by: string | null;
87
97
  raw_data: Json | null;
98
+ sender_phone: string | null;
88
99
  timestamp: string | null;
89
100
  to: string | null;
90
101
  token: string | null;
91
- type: string | null;
92
- url: string | null;
93
102
  vcards: string[] | null;
94
103
  };
95
104
  Insert: {
@@ -115,19 +124,20 @@ export interface Database {
115
124
  is_status?: boolean | null;
116
125
  links?: Json | null;
117
126
  location?: Json | null;
127
+ media?: Json | null;
118
128
  media_key?: string | null;
119
129
  mentioned_ids?: string[] | null;
120
130
  message_id: string;
131
+ message_type?: string | null;
121
132
  order_id?: string | null;
122
133
  org_id: string;
123
134
  org_phone: string;
124
135
  performed_by?: string | null;
125
136
  raw_data?: Json | null;
137
+ sender_phone?: string | null;
126
138
  timestamp?: string | null;
127
139
  to?: string | null;
128
140
  token?: string | null;
129
- type?: string | null;
130
- url?: string | null;
131
141
  vcards?: string[] | null;
132
142
  };
133
143
  Update: {
@@ -153,19 +163,20 @@ export interface Database {
153
163
  is_status?: boolean | null;
154
164
  links?: Json | null;
155
165
  location?: Json | null;
166
+ media?: Json | null;
156
167
  media_key?: string | null;
157
168
  mentioned_ids?: string[] | null;
158
169
  message_id?: string;
170
+ message_type?: string | null;
159
171
  order_id?: string | null;
160
172
  org_id?: string;
161
173
  org_phone?: string;
162
174
  performed_by?: string | null;
163
175
  raw_data?: Json | null;
176
+ sender_phone?: string | null;
164
177
  timestamp?: string | null;
165
178
  to?: string | null;
166
179
  token?: string | null;
167
- type?: string | null;
168
- url?: string | null;
169
180
  vcards?: string[] | null;
170
181
  };
171
182
  Relationships: [
@@ -319,7 +330,7 @@ export interface Database {
319
330
  is_group: boolean | null;
320
331
  is_muted: boolean | null;
321
332
  is_read_only: boolean | null;
322
- label_ids: string[] | null;
333
+ label_ids: Json;
323
334
  mute_expiration: number | null;
324
335
  name: string | null;
325
336
  org_id: string;
@@ -338,7 +349,7 @@ export interface Database {
338
349
  is_group?: boolean | null;
339
350
  is_muted?: boolean | null;
340
351
  is_read_only?: boolean | null;
341
- label_ids?: string[] | null;
352
+ label_ids?: Json;
342
353
  mute_expiration?: number | null;
343
354
  name?: string | null;
344
355
  org_id: string;
@@ -357,7 +368,7 @@ export interface Database {
357
368
  is_group?: boolean | null;
358
369
  is_muted?: boolean | null;
359
370
  is_read_only?: boolean | null;
360
- label_ids?: string[] | null;
371
+ label_ids?: Json;
361
372
  mute_expiration?: number | null;
362
373
  name?: string | null;
363
374
  org_id?: string;
@@ -366,71 +377,82 @@ export interface Database {
366
377
  timestamp?: string | null;
367
378
  unread_count?: number | null;
368
379
  };
369
- Relationships: [];
380
+ Relationships: [
381
+ {
382
+ foreignKeyName: "tbl_chats_org_id_fkey";
383
+ columns: ["org_id"];
384
+ isOneToOne: false;
385
+ referencedRelation: "tbl_org";
386
+ referencedColumns: ["org_id"];
387
+ }
388
+ ];
370
389
  };
371
390
  tbl_contacts: {
372
391
  Row: {
373
392
  contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null;
374
393
  contact_id: string;
375
394
  contact_image: string | null;
395
+ contact_type: string | null;
376
396
  id: Json | null;
377
397
  is_blocked: boolean | null;
378
398
  is_business: boolean | null;
379
399
  is_enterprise: boolean | null;
380
400
  is_group: boolean | null;
401
+ is_internal: boolean | null;
381
402
  is_me: boolean | null;
382
403
  is_my_contact: boolean | null;
383
404
  is_user: boolean | null;
384
405
  is_wa_contact: boolean | null;
385
- label_ids: string[] | null;
406
+ label_ids: Json;
386
407
  name: string | null;
387
408
  number: string | null;
388
409
  org_id: string;
389
410
  pushname: string | null;
390
411
  short_name: string | null;
391
- type: string | null;
392
412
  };
393
413
  Insert: {
394
414
  contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null;
395
415
  contact_id: string;
396
416
  contact_image?: string | null;
417
+ contact_type?: string | null;
397
418
  id?: Json | null;
398
419
  is_blocked?: boolean | null;
399
420
  is_business?: boolean | null;
400
421
  is_enterprise?: boolean | null;
401
422
  is_group?: boolean | null;
423
+ is_internal?: boolean | null;
402
424
  is_me?: boolean | null;
403
425
  is_my_contact?: boolean | null;
404
426
  is_user?: boolean | null;
405
427
  is_wa_contact?: boolean | null;
406
- label_ids?: string[] | null;
428
+ label_ids?: Json;
407
429
  name?: string | null;
408
430
  number?: string | null;
409
431
  org_id: string;
410
432
  pushname?: string | null;
411
433
  short_name?: string | null;
412
- type?: string | null;
413
434
  };
414
435
  Update: {
415
436
  contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null;
416
437
  contact_id?: string;
417
438
  contact_image?: string | null;
439
+ contact_type?: string | null;
418
440
  id?: Json | null;
419
441
  is_blocked?: boolean | null;
420
442
  is_business?: boolean | null;
421
443
  is_enterprise?: boolean | null;
422
444
  is_group?: boolean | null;
445
+ is_internal?: boolean | null;
423
446
  is_me?: boolean | null;
424
447
  is_my_contact?: boolean | null;
425
448
  is_user?: boolean | null;
426
449
  is_wa_contact?: boolean | null;
427
- label_ids?: string[] | null;
450
+ label_ids?: Json;
428
451
  name?: string | null;
429
452
  number?: string | null;
430
453
  org_id?: string;
431
454
  pushname?: string | null;
432
455
  short_name?: string | null;
433
- type?: string | null;
434
456
  };
435
457
  Relationships: [
436
458
  {
@@ -562,6 +584,8 @@ export interface Database {
562
584
  org_id: string;
563
585
  org_phone: string | null;
564
586
  phone_id: string;
587
+ phone_image: string | null;
588
+ phone_name: string | null;
565
589
  qr_code: string | null;
566
590
  updated_at: string;
567
591
  wa_state: string | null;
@@ -572,6 +596,8 @@ export interface Database {
572
596
  org_id: string;
573
597
  org_phone?: string | null;
574
598
  phone_id?: string;
599
+ phone_image?: string | null;
600
+ phone_name?: string | null;
575
601
  qr_code?: string | null;
576
602
  updated_at?: string;
577
603
  wa_state?: string | null;
@@ -582,6 +608,8 @@ export interface Database {
582
608
  org_id?: string;
583
609
  org_phone?: string | null;
584
610
  phone_id?: string;
611
+ phone_image?: string | null;
612
+ phone_name?: string | null;
585
613
  qr_code?: string | null;
586
614
  updated_at?: string;
587
615
  wa_state?: string | null;
@@ -598,59 +626,6 @@ export interface Database {
598
626
  };
599
627
  };
600
628
  Views: {
601
- view_chat_messages: {
602
- Row: {
603
- ack: string | null;
604
- author: string | null;
605
- body: string | null;
606
- broadcast: boolean | null;
607
- chat_id: string | null;
608
- contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null;
609
- device_type: string | null;
610
- duration: string | null;
611
- forwarding_score: number | null;
612
- from: string | null;
613
- from_me: boolean | null;
614
- has_media: boolean | null;
615
- has_quoted_msg: boolean | null;
616
- has_reaction: boolean | null;
617
- id: Json | null;
618
- invite_v4: Json | null;
619
- is_ephemeral: boolean | null;
620
- is_forwarded: boolean | null;
621
- is_gif: boolean | null;
622
- is_starred: boolean | null;
623
- is_status: boolean | null;
624
- links: Json | null;
625
- location: Json | null;
626
- media_key: string | null;
627
- mentioned_ids: string[] | null;
628
- message_id: string | null;
629
- name: string | null;
630
- order_id: string | null;
631
- org_id: string | null;
632
- org_phone: string | null;
633
- performed_by: string | null;
634
- pushname: string | null;
635
- raw_data: Json | null;
636
- sender_phone: string | null;
637
- timestamp: string | null;
638
- to: string | null;
639
- token: string | null;
640
- type: string | null;
641
- url: string | null;
642
- vcards: string[] | null;
643
- };
644
- Relationships: [
645
- {
646
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
647
- columns: ["org_id", "org_phone"];
648
- isOneToOne: false;
649
- referencedRelation: "tbl_org_phones";
650
- referencedColumns: ["org_id", "org_phone"];
651
- }
652
- ];
653
- };
654
629
  view_chats: {
655
630
  Row: {
656
631
  archived: boolean | null;
@@ -665,11 +640,12 @@ export interface Database {
665
640
  is_group: boolean | null;
666
641
  is_muted: boolean | null;
667
642
  is_read_only: boolean | null;
668
- label_ids: string[] | null;
643
+ label_ids: Json | null;
669
644
  last_read_timestamp: string | null;
670
645
  latest_message: Json | null;
671
646
  latest_message_timestamp: string | null;
672
647
  member_count: number | null;
648
+ message_unread_count: number | null;
673
649
  mute_expiration: number | null;
674
650
  name: string | null;
675
651
  org_id: string | null;
@@ -679,7 +655,15 @@ export interface Database {
679
655
  timestamp: string | null;
680
656
  unread_count: number | null;
681
657
  };
682
- Relationships: [];
658
+ Relationships: [
659
+ {
660
+ foreignKeyName: "tbl_chats_org_id_fkey";
661
+ columns: ["org_id"];
662
+ isOneToOne: false;
663
+ referencedRelation: "tbl_org";
664
+ referencedColumns: ["org_id"];
665
+ }
666
+ ];
683
667
  };
684
668
  };
685
669
  Functions: {
@@ -700,7 +684,7 @@ export interface Database {
700
684
  };
701
685
  get_contacts: {
702
686
  Args: {
703
- contact_id_input?: string;
687
+ contact_ids_input?: string[];
704
688
  };
705
689
  Returns: Json;
706
690
  };
@@ -725,6 +709,14 @@ export interface Database {
725
709
  Args: Record<PropertyKey, never>;
726
710
  Returns: Database["public"]["Enums"]["enum_member_role"];
727
711
  };
712
+ update_labels: {
713
+ Args: {
714
+ tbl_type: string;
715
+ label_ids_input: Json;
716
+ row_id_input: string[];
717
+ };
718
+ Returns: undefined;
719
+ };
728
720
  };
729
721
  Enums: {
730
722
  enum_chat_colors: "#B4876E" | "#A5B337" | "#06CF9C" | "#25D366" | "#02A698" | "#7D9EF1" | "#007BFC" | "#5E47DE" | "#7F66FF" | "#9333EA" | "#FA6533" | "#C4532D" | "#DC2626" | "#FF2E74" | "#DB2777";
package/dist/types.d.ts CHANGED
@@ -12,25 +12,25 @@ export type OrgType = Tables<'tbl_org'> & {
12
12
  phones: Tables<'tbl_org_phones'>[];
13
13
  labels: Tables<'tbl_org_labels'>[];
14
14
  };
15
+ export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>, Tables<'tbl_contacts'>>;
15
16
  export type ChatType = Merge<Tables<'view_chats'>, {
16
17
  chat_id: string;
17
18
  latest_message: MessageType | null;
18
- members: (Tables<'tbl_chat_participants'> & Partial<Tables<'tbl_contacts'>>)[] | null;
19
- notifications: Tables<'tbl_chat_notifications'>[] | null;
19
+ members: Record<string, ChatMemberType> | null;
20
20
  chat_type: 'user' | 'group' | 'business';
21
21
  active_phone?: boolean;
22
22
  org_participants?: Tables<'tbl_chat_participants'>[];
23
- chat_access?: {
24
- email: string;
25
- has_access: boolean | null;
26
- }[];
23
+ chat_access: Record<string, boolean>;
24
+ label_ids: Record<string, boolean>;
27
25
  }>;
28
- export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
29
- type: MessageTypes;
26
+ export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
27
+ message_type: MessageTypes;
30
28
  }>;
31
29
  export type ContactType = Merge<Tables<'tbl_contacts'>, {
32
30
  chats: ChatType[] | null;
33
31
  chat_count: number | null;
32
+ chat_ids: string[] | null;
34
33
  }>;
34
+ export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>, Tables<'tbl_org_members'>>;
35
35
  export declare const labelColors: string[];
36
36
  export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
package/dist/types.js CHANGED
@@ -10,7 +10,19 @@ exports.labelColors = [
10
10
  '#F97316',
11
11
  ];
12
12
  exports.enumChatColors = [
13
- "#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698",
14
- "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA",
15
- "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"
13
+ '#B4876E',
14
+ '#A5B337',
15
+ '#06CF9C',
16
+ '#25D366',
17
+ '#02A698',
18
+ '#7D9EF1',
19
+ '#007BFC',
20
+ '#5E47DE',
21
+ '#7F66FF',
22
+ '#9333EA',
23
+ '#FA6533',
24
+ '#C4532D',
25
+ '#DC2626',
26
+ '#FF2E74',
27
+ '#DB2777',
16
28
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/supabase.types.ts CHANGED
@@ -50,7 +50,15 @@ export interface Database {
50
50
  last_read_timestamp?: string | null
51
51
  org_id?: string
52
52
  }
53
- Relationships: []
53
+ Relationships: [
54
+ {
55
+ foreignKeyName: "tbl_chat_access_org_id_fkey"
56
+ columns: ["org_id"]
57
+ isOneToOne: false
58
+ referencedRelation: "tbl_org"
59
+ referencedColumns: ["org_id"]
60
+ }
61
+ ]
54
62
  }
55
63
  tbl_chat_messages: {
56
64
  Row: {
@@ -76,19 +84,20 @@ export interface Database {
76
84
  is_status: boolean | null
77
85
  links: Json | null
78
86
  location: Json | null
87
+ media: Json | null
79
88
  media_key: string | null
80
89
  mentioned_ids: string[] | null
81
90
  message_id: string
91
+ message_type: string | null
82
92
  order_id: string | null
83
93
  org_id: string
84
94
  org_phone: string
85
95
  performed_by: string | null
86
96
  raw_data: Json | null
97
+ sender_phone: string | null
87
98
  timestamp: string | null
88
99
  to: string | null
89
100
  token: string | null
90
- type: string | null
91
- url: string | null
92
101
  vcards: string[] | null
93
102
  }
94
103
  Insert: {
@@ -114,19 +123,20 @@ export interface Database {
114
123
  is_status?: boolean | null
115
124
  links?: Json | null
116
125
  location?: Json | null
126
+ media?: Json | null
117
127
  media_key?: string | null
118
128
  mentioned_ids?: string[] | null
119
129
  message_id: string
130
+ message_type?: string | null
120
131
  order_id?: string | null
121
132
  org_id: string
122
133
  org_phone: string
123
134
  performed_by?: string | null
124
135
  raw_data?: Json | null
136
+ sender_phone?: string | null
125
137
  timestamp?: string | null
126
138
  to?: string | null
127
139
  token?: string | null
128
- type?: string | null
129
- url?: string | null
130
140
  vcards?: string[] | null
131
141
  }
132
142
  Update: {
@@ -152,19 +162,20 @@ export interface Database {
152
162
  is_status?: boolean | null
153
163
  links?: Json | null
154
164
  location?: Json | null
165
+ media?: Json | null
155
166
  media_key?: string | null
156
167
  mentioned_ids?: string[] | null
157
168
  message_id?: string
169
+ message_type?: string | null
158
170
  order_id?: string | null
159
171
  org_id?: string
160
172
  org_phone?: string
161
173
  performed_by?: string | null
162
174
  raw_data?: Json | null
175
+ sender_phone?: string | null
163
176
  timestamp?: string | null
164
177
  to?: string | null
165
178
  token?: string | null
166
- type?: string | null
167
- url?: string | null
168
179
  vcards?: string[] | null
169
180
  }
170
181
  Relationships: [
@@ -318,7 +329,7 @@ export interface Database {
318
329
  is_group: boolean | null
319
330
  is_muted: boolean | null
320
331
  is_read_only: boolean | null
321
- label_ids: string[] | null
332
+ label_ids: Json
322
333
  mute_expiration: number | null
323
334
  name: string | null
324
335
  org_id: string
@@ -337,7 +348,7 @@ export interface Database {
337
348
  is_group?: boolean | null
338
349
  is_muted?: boolean | null
339
350
  is_read_only?: boolean | null
340
- label_ids?: string[] | null
351
+ label_ids?: Json
341
352
  mute_expiration?: number | null
342
353
  name?: string | null
343
354
  org_id: string
@@ -356,7 +367,7 @@ export interface Database {
356
367
  is_group?: boolean | null
357
368
  is_muted?: boolean | null
358
369
  is_read_only?: boolean | null
359
- label_ids?: string[] | null
370
+ label_ids?: Json
360
371
  mute_expiration?: number | null
361
372
  name?: string | null
362
373
  org_id?: string
@@ -365,71 +376,82 @@ export interface Database {
365
376
  timestamp?: string | null
366
377
  unread_count?: number | null
367
378
  }
368
- Relationships: []
379
+ Relationships: [
380
+ {
381
+ foreignKeyName: "tbl_chats_org_id_fkey"
382
+ columns: ["org_id"]
383
+ isOneToOne: false
384
+ referencedRelation: "tbl_org"
385
+ referencedColumns: ["org_id"]
386
+ }
387
+ ]
369
388
  }
370
389
  tbl_contacts: {
371
390
  Row: {
372
391
  contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null
373
392
  contact_id: string
374
393
  contact_image: string | null
394
+ contact_type: string | null
375
395
  id: Json | null
376
396
  is_blocked: boolean | null
377
397
  is_business: boolean | null
378
398
  is_enterprise: boolean | null
379
399
  is_group: boolean | null
400
+ is_internal: boolean | null
380
401
  is_me: boolean | null
381
402
  is_my_contact: boolean | null
382
403
  is_user: boolean | null
383
404
  is_wa_contact: boolean | null
384
- label_ids: string[] | null
405
+ label_ids: Json
385
406
  name: string | null
386
407
  number: string | null
387
408
  org_id: string
388
409
  pushname: string | null
389
410
  short_name: string | null
390
- type: string | null
391
411
  }
392
412
  Insert: {
393
413
  contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null
394
414
  contact_id: string
395
415
  contact_image?: string | null
416
+ contact_type?: string | null
396
417
  id?: Json | null
397
418
  is_blocked?: boolean | null
398
419
  is_business?: boolean | null
399
420
  is_enterprise?: boolean | null
400
421
  is_group?: boolean | null
422
+ is_internal?: boolean | null
401
423
  is_me?: boolean | null
402
424
  is_my_contact?: boolean | null
403
425
  is_user?: boolean | null
404
426
  is_wa_contact?: boolean | null
405
- label_ids?: string[] | null
427
+ label_ids?: Json
406
428
  name?: string | null
407
429
  number?: string | null
408
430
  org_id: string
409
431
  pushname?: string | null
410
432
  short_name?: string | null
411
- type?: string | null
412
433
  }
413
434
  Update: {
414
435
  contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null
415
436
  contact_id?: string
416
437
  contact_image?: string | null
438
+ contact_type?: string | null
417
439
  id?: Json | null
418
440
  is_blocked?: boolean | null
419
441
  is_business?: boolean | null
420
442
  is_enterprise?: boolean | null
421
443
  is_group?: boolean | null
444
+ is_internal?: boolean | null
422
445
  is_me?: boolean | null
423
446
  is_my_contact?: boolean | null
424
447
  is_user?: boolean | null
425
448
  is_wa_contact?: boolean | null
426
- label_ids?: string[] | null
449
+ label_ids?: Json
427
450
  name?: string | null
428
451
  number?: string | null
429
452
  org_id?: string
430
453
  pushname?: string | null
431
454
  short_name?: string | null
432
- type?: string | null
433
455
  }
434
456
  Relationships: [
435
457
  {
@@ -561,6 +583,8 @@ export interface Database {
561
583
  org_id: string
562
584
  org_phone: string | null
563
585
  phone_id: string
586
+ phone_image: string | null
587
+ phone_name: string | null
564
588
  qr_code: string | null
565
589
  updated_at: string
566
590
  wa_state: string | null
@@ -571,6 +595,8 @@ export interface Database {
571
595
  org_id: string
572
596
  org_phone?: string | null
573
597
  phone_id?: string
598
+ phone_image?: string | null
599
+ phone_name?: string | null
574
600
  qr_code?: string | null
575
601
  updated_at?: string
576
602
  wa_state?: string | null
@@ -581,6 +607,8 @@ export interface Database {
581
607
  org_id?: string
582
608
  org_phone?: string | null
583
609
  phone_id?: string
610
+ phone_image?: string | null
611
+ phone_name?: string | null
584
612
  qr_code?: string | null
585
613
  updated_at?: string
586
614
  wa_state?: string | null
@@ -597,59 +625,6 @@ export interface Database {
597
625
  }
598
626
  }
599
627
  Views: {
600
- view_chat_messages: {
601
- Row: {
602
- ack: string | null
603
- author: string | null
604
- body: string | null
605
- broadcast: boolean | null
606
- chat_id: string | null
607
- contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null
608
- device_type: string | null
609
- duration: string | null
610
- forwarding_score: number | null
611
- from: string | null
612
- from_me: boolean | null
613
- has_media: boolean | null
614
- has_quoted_msg: boolean | null
615
- has_reaction: boolean | null
616
- id: Json | null
617
- invite_v4: Json | null
618
- is_ephemeral: boolean | null
619
- is_forwarded: boolean | null
620
- is_gif: boolean | null
621
- is_starred: boolean | null
622
- is_status: boolean | null
623
- links: Json | null
624
- location: Json | null
625
- media_key: string | null
626
- mentioned_ids: string[] | null
627
- message_id: string | null
628
- name: string | null
629
- order_id: string | null
630
- org_id: string | null
631
- org_phone: string | null
632
- performed_by: string | null
633
- pushname: string | null
634
- raw_data: Json | null
635
- sender_phone: string | null
636
- timestamp: string | null
637
- to: string | null
638
- token: string | null
639
- type: string | null
640
- url: string | null
641
- vcards: string[] | null
642
- }
643
- Relationships: [
644
- {
645
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
646
- columns: ["org_id", "org_phone"]
647
- isOneToOne: false
648
- referencedRelation: "tbl_org_phones"
649
- referencedColumns: ["org_id", "org_phone"]
650
- }
651
- ]
652
- }
653
628
  view_chats: {
654
629
  Row: {
655
630
  archived: boolean | null
@@ -664,11 +639,12 @@ export interface Database {
664
639
  is_group: boolean | null
665
640
  is_muted: boolean | null
666
641
  is_read_only: boolean | null
667
- label_ids: string[] | null
642
+ label_ids: Json | null
668
643
  last_read_timestamp: string | null
669
644
  latest_message: Json | null
670
645
  latest_message_timestamp: string | null
671
646
  member_count: number | null
647
+ message_unread_count: number | null
672
648
  mute_expiration: number | null
673
649
  name: string | null
674
650
  org_id: string | null
@@ -678,7 +654,15 @@ export interface Database {
678
654
  timestamp: string | null
679
655
  unread_count: number | null
680
656
  }
681
- Relationships: []
657
+ Relationships: [
658
+ {
659
+ foreignKeyName: "tbl_chats_org_id_fkey"
660
+ columns: ["org_id"]
661
+ isOneToOne: false
662
+ referencedRelation: "tbl_org"
663
+ referencedColumns: ["org_id"]
664
+ }
665
+ ]
682
666
  }
683
667
  }
684
668
  Functions: {
@@ -699,7 +683,7 @@ export interface Database {
699
683
  }
700
684
  get_contacts: {
701
685
  Args: {
702
- contact_id_input?: string
686
+ contact_ids_input?: string[]
703
687
  }
704
688
  Returns: Json
705
689
  }
@@ -724,6 +708,14 @@ export interface Database {
724
708
  Args: Record<PropertyKey, never>
725
709
  Returns: Database["public"]["Enums"]["enum_member_role"]
726
710
  }
711
+ update_labels: {
712
+ Args: {
713
+ tbl_type: string
714
+ label_ids_input: Json
715
+ row_id_input: string[]
716
+ }
717
+ Returns: undefined
718
+ }
727
719
  }
728
720
  Enums: {
729
721
  enum_chat_colors:
package/types.ts CHANGED
@@ -6,7 +6,11 @@ import { Tables } from './supabase.types';
6
6
 
7
7
  /* ------------------------------ WHATSAPP ------------------------------ */
8
8
 
9
- export type WhatsappChat = Chat & { groupMetadata?: any; pinned?: boolean; invite_link?:string };
9
+ export type WhatsappChat = Chat & {
10
+ groupMetadata?: any;
11
+ pinned?: boolean;
12
+ invite_link?: string;
13
+ };
10
14
 
11
15
  /* ------------------------------ PERISKOPE TYPES ------------------------------ */
12
16
 
@@ -17,34 +21,34 @@ export type OrgType = Tables<'tbl_org'> & {
17
21
  labels: Tables<'tbl_org_labels'>[];
18
22
  };
19
23
 
24
+ export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>,
25
+ Tables<'tbl_contacts'>>;
26
+
20
27
  export type ChatType = Merge<
21
28
  Tables<'view_chats'>,
22
29
  {
23
30
  chat_id: string;
24
31
  latest_message: MessageType | null;
25
- members:
26
- | (Tables<'tbl_chat_participants'> & Partial<Tables<'tbl_contacts'>>)[]
27
- | null;
28
- notifications: Tables<'tbl_chat_notifications'>[] | null;
32
+ members: Record<string,ChatMemberType> | null;
29
33
  chat_type: 'user' | 'group' | 'business';
30
34
  active_phone?: boolean;
31
35
  org_participants?: Tables<'tbl_chat_participants'>[];
32
- chat_access?: {email:string; has_access:boolean | null}[];
33
- }
36
+ chat_access: Record<string, boolean>;
37
+ label_ids: Record<string, boolean>;
38
+ }
34
39
  >;
35
40
 
36
- export type MessageType = OverrideProperties<
37
- Tables<'view_chat_messages'>,
38
- {
39
- type: MessageTypes;
40
- }
41
- >;
41
+ export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
42
+ message_type: MessageTypes;
43
+ }>;
42
44
 
43
45
  export type ContactType = Merge<
44
46
  Tables<'tbl_contacts'>,
45
- { chats: ChatType[] | null; chat_count: number | null }
47
+ { chats: ChatType[] | null; chat_count: number | null; chat_ids: string[] | null }
46
48
  >;
47
49
 
50
+ export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>,Tables<'tbl_org_members'>>;
51
+
48
52
  /* -------------------------------- CONSTANTS ------------------------------- */
49
53
 
50
54
  export const labelColors = [
@@ -56,7 +60,19 @@ export const labelColors = [
56
60
  ];
57
61
 
58
62
  export const enumChatColors = [
59
- "#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698",
60
- "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA",
61
- "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"
63
+ '#B4876E',
64
+ '#A5B337',
65
+ '#06CF9C',
66
+ '#25D366',
67
+ '#02A698',
68
+ '#7D9EF1',
69
+ '#007BFC',
70
+ '#5E47DE',
71
+ '#7F66FF',
72
+ '#9333EA',
73
+ '#FA6533',
74
+ '#C4532D',
75
+ '#DC2626',
76
+ '#FF2E74',
77
+ '#DB2777',
62
78
  ] as const;