@periskope/types 0.6.39 → 0.6.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/supabase.types.d.ts +123 -74
- package/dist/types.d.ts +12 -7
- package/dist/types.js +14 -1
- package/package.json +1 -1
- package/supabase.types.ts +123 -74
- package/types.ts +25 -16
package/dist/supabase.types.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export interface Database {
|
|
|
107
107
|
};
|
|
108
108
|
tbl_chat_access: {
|
|
109
109
|
Row: {
|
|
110
|
+
active_phone: string | null;
|
|
110
111
|
chat_id: string;
|
|
111
112
|
email: string;
|
|
112
113
|
has_access: boolean | null;
|
|
@@ -114,6 +115,7 @@ export interface Database {
|
|
|
114
115
|
org_id: string;
|
|
115
116
|
};
|
|
116
117
|
Insert: {
|
|
118
|
+
active_phone?: string | null;
|
|
117
119
|
chat_id: string;
|
|
118
120
|
email: string;
|
|
119
121
|
has_access?: boolean | null;
|
|
@@ -121,6 +123,7 @@ export interface Database {
|
|
|
121
123
|
org_id?: string;
|
|
122
124
|
};
|
|
123
125
|
Update: {
|
|
126
|
+
active_phone?: string | null;
|
|
124
127
|
chat_id?: string;
|
|
125
128
|
email?: string;
|
|
126
129
|
has_access?: boolean | null;
|
|
@@ -129,11 +132,11 @@ export interface Database {
|
|
|
129
132
|
};
|
|
130
133
|
Relationships: [
|
|
131
134
|
{
|
|
132
|
-
foreignKeyName: "
|
|
133
|
-
columns: ["org_id"];
|
|
135
|
+
foreignKeyName: "tbl_chat_access_org_id_email_fkey";
|
|
136
|
+
columns: ["org_id", "email"];
|
|
134
137
|
isOneToOne: false;
|
|
135
|
-
referencedRelation: "
|
|
136
|
-
referencedColumns: ["org_id"];
|
|
138
|
+
referencedRelation: "tbl_org_members";
|
|
139
|
+
referencedColumns: ["org_id", "email"];
|
|
137
140
|
}
|
|
138
141
|
];
|
|
139
142
|
};
|
|
@@ -285,10 +288,10 @@ export interface Database {
|
|
|
285
288
|
Relationships: [
|
|
286
289
|
{
|
|
287
290
|
foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
|
|
288
|
-
columns: ["
|
|
291
|
+
columns: ["org_phone", "org_id"];
|
|
289
292
|
isOneToOne: false;
|
|
290
293
|
referencedRelation: "tbl_org_phones";
|
|
291
|
-
referencedColumns: ["
|
|
294
|
+
referencedColumns: ["org_phone", "org_id"];
|
|
292
295
|
}
|
|
293
296
|
];
|
|
294
297
|
};
|
|
@@ -678,6 +681,7 @@ export interface Database {
|
|
|
678
681
|
org_image: string | null;
|
|
679
682
|
org_metadata: Json | null;
|
|
680
683
|
org_name: string | null;
|
|
684
|
+
org_plan: Json | null;
|
|
681
685
|
support_link: string | null;
|
|
682
686
|
};
|
|
683
687
|
Insert: {
|
|
@@ -686,6 +690,7 @@ export interface Database {
|
|
|
686
690
|
org_image?: string | null;
|
|
687
691
|
org_metadata?: Json | null;
|
|
688
692
|
org_name?: string | null;
|
|
693
|
+
org_plan?: Json | null;
|
|
689
694
|
support_link?: string | null;
|
|
690
695
|
};
|
|
691
696
|
Update: {
|
|
@@ -694,6 +699,7 @@ export interface Database {
|
|
|
694
699
|
org_image?: string | null;
|
|
695
700
|
org_metadata?: Json | null;
|
|
696
701
|
org_name?: string | null;
|
|
702
|
+
org_plan?: Json | null;
|
|
697
703
|
support_link?: string | null;
|
|
698
704
|
};
|
|
699
705
|
Relationships: [];
|
|
@@ -740,6 +746,7 @@ export interface Database {
|
|
|
740
746
|
invited_at: string | null;
|
|
741
747
|
invited_by: string | null;
|
|
742
748
|
is_active: boolean;
|
|
749
|
+
member_color: Database["public"]["Enums"]["enum_chat_colors"];
|
|
743
750
|
member_image: string | null;
|
|
744
751
|
member_name: string | null;
|
|
745
752
|
org_id: string;
|
|
@@ -752,6 +759,7 @@ export interface Database {
|
|
|
752
759
|
invited_at?: string | null;
|
|
753
760
|
invited_by?: string | null;
|
|
754
761
|
is_active?: boolean;
|
|
762
|
+
member_color?: Database["public"]["Enums"]["enum_chat_colors"];
|
|
755
763
|
member_image?: string | null;
|
|
756
764
|
member_name?: string | null;
|
|
757
765
|
org_id: string;
|
|
@@ -764,6 +772,7 @@ export interface Database {
|
|
|
764
772
|
invited_at?: string | null;
|
|
765
773
|
invited_by?: string | null;
|
|
766
774
|
is_active?: boolean;
|
|
775
|
+
member_color?: Database["public"]["Enums"]["enum_chat_colors"];
|
|
767
776
|
member_image?: string | null;
|
|
768
777
|
member_name?: string | null;
|
|
769
778
|
org_id?: string;
|
|
@@ -804,7 +813,7 @@ export interface Database {
|
|
|
804
813
|
Insert: {
|
|
805
814
|
created_at?: string;
|
|
806
815
|
is_ready?: boolean | null;
|
|
807
|
-
org_id
|
|
816
|
+
org_id?: string;
|
|
808
817
|
org_phone?: string | null;
|
|
809
818
|
phone_id?: string;
|
|
810
819
|
phone_image?: string | null;
|
|
@@ -834,6 +843,13 @@ export interface Database {
|
|
|
834
843
|
isOneToOne: false;
|
|
835
844
|
referencedRelation: "tbl_org";
|
|
836
845
|
referencedColumns: ["org_id"];
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
foreignKeyName: "tbl_org_phones_org_id_fkey";
|
|
849
|
+
columns: ["org_id"];
|
|
850
|
+
isOneToOne: false;
|
|
851
|
+
referencedRelation: "tbl_org";
|
|
852
|
+
referencedColumns: ["org_id"];
|
|
837
853
|
}
|
|
838
854
|
];
|
|
839
855
|
};
|
|
@@ -867,34 +883,122 @@ export interface Database {
|
|
|
867
883
|
}
|
|
868
884
|
];
|
|
869
885
|
};
|
|
886
|
+
view_chat_messages: {
|
|
887
|
+
Row: {
|
|
888
|
+
ack: string | null;
|
|
889
|
+
author: string | null;
|
|
890
|
+
body: string | null;
|
|
891
|
+
broadcast_id: string | null;
|
|
892
|
+
chat_id: string | null;
|
|
893
|
+
delivery_info: Json | null;
|
|
894
|
+
from_me: boolean | null;
|
|
895
|
+
invite_v4: Json | null;
|
|
896
|
+
is_deleted: boolean | null;
|
|
897
|
+
links: Json | null;
|
|
898
|
+
location: Json | null;
|
|
899
|
+
media: Json | null;
|
|
900
|
+
mentioned_ids: string[] | null;
|
|
901
|
+
message_id: string | null;
|
|
902
|
+
message_ticket_id: string | null;
|
|
903
|
+
message_type: string | null;
|
|
904
|
+
org_id: string | null;
|
|
905
|
+
org_phone: string | null;
|
|
906
|
+
performed_by: string | null;
|
|
907
|
+
prev_body: string | null;
|
|
908
|
+
quoted_message_id: string | null;
|
|
909
|
+
sender_phone: string | null;
|
|
910
|
+
sent_message_id: string | null;
|
|
911
|
+
timestamp: string | null;
|
|
912
|
+
unique_id: string | null;
|
|
913
|
+
updated_at: string | null;
|
|
914
|
+
vcards: string[] | null;
|
|
915
|
+
};
|
|
916
|
+
Insert: {
|
|
917
|
+
ack?: string | null;
|
|
918
|
+
author?: string | null;
|
|
919
|
+
body?: string | null;
|
|
920
|
+
broadcast_id?: string | null;
|
|
921
|
+
chat_id?: string | null;
|
|
922
|
+
delivery_info?: Json | null;
|
|
923
|
+
from_me?: boolean | null;
|
|
924
|
+
invite_v4?: Json | null;
|
|
925
|
+
is_deleted?: boolean | null;
|
|
926
|
+
links?: Json | null;
|
|
927
|
+
location?: Json | null;
|
|
928
|
+
media?: Json | null;
|
|
929
|
+
mentioned_ids?: string[] | null;
|
|
930
|
+
message_id?: string | null;
|
|
931
|
+
message_ticket_id?: string | null;
|
|
932
|
+
message_type?: string | null;
|
|
933
|
+
org_id?: string | null;
|
|
934
|
+
org_phone?: string | null;
|
|
935
|
+
performed_by?: string | null;
|
|
936
|
+
prev_body?: string | null;
|
|
937
|
+
quoted_message_id?: string | null;
|
|
938
|
+
sender_phone?: string | null;
|
|
939
|
+
sent_message_id?: string | null;
|
|
940
|
+
timestamp?: string | null;
|
|
941
|
+
unique_id?: string | null;
|
|
942
|
+
updated_at?: string | null;
|
|
943
|
+
vcards?: string[] | null;
|
|
944
|
+
};
|
|
945
|
+
Update: {
|
|
946
|
+
ack?: string | null;
|
|
947
|
+
author?: string | null;
|
|
948
|
+
body?: string | null;
|
|
949
|
+
broadcast_id?: string | null;
|
|
950
|
+
chat_id?: string | null;
|
|
951
|
+
delivery_info?: Json | null;
|
|
952
|
+
from_me?: boolean | null;
|
|
953
|
+
invite_v4?: Json | null;
|
|
954
|
+
is_deleted?: boolean | null;
|
|
955
|
+
links?: Json | null;
|
|
956
|
+
location?: Json | null;
|
|
957
|
+
media?: Json | null;
|
|
958
|
+
mentioned_ids?: string[] | null;
|
|
959
|
+
message_id?: string | null;
|
|
960
|
+
message_ticket_id?: string | null;
|
|
961
|
+
message_type?: string | null;
|
|
962
|
+
org_id?: string | null;
|
|
963
|
+
org_phone?: string | null;
|
|
964
|
+
performed_by?: string | null;
|
|
965
|
+
prev_body?: string | null;
|
|
966
|
+
quoted_message_id?: string | null;
|
|
967
|
+
sender_phone?: string | null;
|
|
968
|
+
sent_message_id?: string | null;
|
|
969
|
+
timestamp?: string | null;
|
|
970
|
+
unique_id?: string | null;
|
|
971
|
+
updated_at?: string | null;
|
|
972
|
+
vcards?: string[] | null;
|
|
973
|
+
};
|
|
974
|
+
Relationships: [
|
|
975
|
+
{
|
|
976
|
+
foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
|
|
977
|
+
columns: ["org_phone", "org_id"];
|
|
978
|
+
isOneToOne: false;
|
|
979
|
+
referencedRelation: "tbl_org_phones";
|
|
980
|
+
referencedColumns: ["org_phone", "org_id"];
|
|
981
|
+
}
|
|
982
|
+
];
|
|
983
|
+
};
|
|
870
984
|
view_chats: {
|
|
871
985
|
Row: {
|
|
872
|
-
|
|
986
|
+
active_phone: string | null;
|
|
873
987
|
chat_access: Json | null;
|
|
874
988
|
chat_id: string | null;
|
|
875
989
|
chat_image: string | null;
|
|
876
990
|
chat_name: string | null;
|
|
877
991
|
chat_org_phones: string[] | null;
|
|
878
992
|
chat_type: string | null;
|
|
879
|
-
group_metadata: Json | null;
|
|
880
993
|
has_access: boolean | null;
|
|
881
|
-
id: Json | null;
|
|
882
994
|
invite_link: string | null;
|
|
883
|
-
is_group: boolean | null;
|
|
884
|
-
is_muted: boolean | null;
|
|
885
|
-
is_read_only: boolean | null;
|
|
886
995
|
label_ids: Json | null;
|
|
887
996
|
last_read_timestamp: string | null;
|
|
888
997
|
latest_message: Json | null;
|
|
889
998
|
member_count: number | null;
|
|
890
999
|
message_unread_count: number | null;
|
|
891
|
-
mute_expiration: number | null;
|
|
892
|
-
name: string | null;
|
|
893
1000
|
org_id: string | null;
|
|
894
1001
|
org_phone: string | null;
|
|
895
|
-
pinned: boolean | null;
|
|
896
|
-
timestamp: string | null;
|
|
897
|
-
unread_count: number | null;
|
|
898
1002
|
updated_at: string | null;
|
|
899
1003
|
};
|
|
900
1004
|
Relationships: [
|
|
@@ -907,47 +1011,6 @@ export interface Database {
|
|
|
907
1011
|
}
|
|
908
1012
|
];
|
|
909
1013
|
};
|
|
910
|
-
view_contacts: {
|
|
911
|
-
Row: {
|
|
912
|
-
business_profile: Json | null;
|
|
913
|
-
chat_count: number | null;
|
|
914
|
-
chat_ids: string[] | null;
|
|
915
|
-
contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null;
|
|
916
|
-
contact_id: string | null;
|
|
917
|
-
contact_image: string | null;
|
|
918
|
-
contact_name: string | null;
|
|
919
|
-
contact_type: string | null;
|
|
920
|
-
id: Json | null;
|
|
921
|
-
is_blocked: boolean | null;
|
|
922
|
-
is_business: boolean | null;
|
|
923
|
-
is_enterprise: boolean | null;
|
|
924
|
-
is_group: boolean | null;
|
|
925
|
-
is_internal: boolean | null;
|
|
926
|
-
is_me: boolean | null;
|
|
927
|
-
is_my_contact: boolean | null;
|
|
928
|
-
is_user: boolean | null;
|
|
929
|
-
is_wa_contact: boolean | null;
|
|
930
|
-
label_ids: Json | null;
|
|
931
|
-
last_updated_at: string | null;
|
|
932
|
-
name: string | null;
|
|
933
|
-
number: string | null;
|
|
934
|
-
org_id: string | null;
|
|
935
|
-
pushname: string | null;
|
|
936
|
-
short_name: string | null;
|
|
937
|
-
updated_at: string | null;
|
|
938
|
-
verified_level: number | null;
|
|
939
|
-
verified_name: string | null;
|
|
940
|
-
};
|
|
941
|
-
Relationships: [
|
|
942
|
-
{
|
|
943
|
-
foreignKeyName: "tbl_contacts_org_id_fkey";
|
|
944
|
-
columns: ["org_id"];
|
|
945
|
-
isOneToOne: false;
|
|
946
|
-
referencedRelation: "tbl_org";
|
|
947
|
-
referencedColumns: ["org_id"];
|
|
948
|
-
}
|
|
949
|
-
];
|
|
950
|
-
};
|
|
951
1014
|
};
|
|
952
1015
|
Functions: {
|
|
953
1016
|
gen_id: {
|
|
@@ -990,14 +1053,6 @@ export interface Database {
|
|
|
990
1053
|
};
|
|
991
1054
|
Returns: Json;
|
|
992
1055
|
};
|
|
993
|
-
get_dashboard_statistics: {
|
|
994
|
-
Args: {
|
|
995
|
-
org_id_input: string;
|
|
996
|
-
type_input?: string;
|
|
997
|
-
interval_input?: unknown;
|
|
998
|
-
};
|
|
999
|
-
Returns: Json;
|
|
1000
|
-
};
|
|
1001
1056
|
get_export_chats_data: {
|
|
1002
1057
|
Args: {
|
|
1003
1058
|
chat_ids: string[];
|
|
@@ -1005,13 +1060,6 @@ export interface Database {
|
|
|
1005
1060
|
};
|
|
1006
1061
|
Returns: Json;
|
|
1007
1062
|
};
|
|
1008
|
-
get_media: {
|
|
1009
|
-
Args: {
|
|
1010
|
-
filters?: Json;
|
|
1011
|
-
page_num?: number;
|
|
1012
|
-
};
|
|
1013
|
-
Returns: Json;
|
|
1014
|
-
};
|
|
1015
1063
|
get_org: {
|
|
1016
1064
|
Args: {
|
|
1017
1065
|
org_id_input?: string;
|
|
@@ -1031,6 +1079,7 @@ export interface Database {
|
|
|
1031
1079
|
tbl_type: string;
|
|
1032
1080
|
label_ids_input: Json;
|
|
1033
1081
|
row_id_input: string[];
|
|
1082
|
+
replace_labels?: boolean;
|
|
1034
1083
|
};
|
|
1035
1084
|
Returns: undefined;
|
|
1036
1085
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
2
|
-
import { Chat, Location, MessageInfo
|
|
2
|
+
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
3
3
|
import { Tables } from './supabase.types';
|
|
4
4
|
export type WhatsappChat = Chat & {
|
|
5
5
|
groupMetadata?: any;
|
|
@@ -18,10 +18,10 @@ export type ChatType = Merge<Tables<'view_chats'>, {
|
|
|
18
18
|
latest_message: MessageType | null;
|
|
19
19
|
members: Record<string, ChatMemberType> | null;
|
|
20
20
|
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
21
|
-
active_phone?: string;
|
|
22
21
|
chat_access: Record<string, boolean>;
|
|
23
22
|
label_ids: Record<string, boolean>;
|
|
24
23
|
chat_org_phones?: string[];
|
|
24
|
+
message_unread_count: number | null;
|
|
25
25
|
}>;
|
|
26
26
|
export type MediaType = {
|
|
27
27
|
path: string;
|
|
@@ -33,8 +33,12 @@ export type MediaType = {
|
|
|
33
33
|
ar: number;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export type MessageType = OverrideProperties<Tables<'
|
|
37
|
-
|
|
36
|
+
export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
|
|
37
|
+
message_id: string;
|
|
38
|
+
org_id: string;
|
|
39
|
+
org_phone: string;
|
|
40
|
+
chat_id: string;
|
|
41
|
+
message_type: typeof SUPPORTED_TYPES[number];
|
|
38
42
|
media: MediaType | null;
|
|
39
43
|
}>;
|
|
40
44
|
export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
|
|
@@ -42,14 +46,15 @@ export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
|
|
|
42
46
|
}>;
|
|
43
47
|
export type ContactType = Merge<Tables<'tbl_contacts'>, {
|
|
44
48
|
chats: ChatType[] | null;
|
|
45
|
-
chat_count: number | null;
|
|
46
|
-
chat_ids: string[] | null;
|
|
47
49
|
}>;
|
|
50
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
51
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
48
52
|
export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>, Tables<'tbl_org_members'>>;
|
|
49
53
|
export declare const labelColors: string[];
|
|
50
54
|
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
|
55
|
+
export declare const SUPPORTED_TYPES: readonly ["chat", "sticker", "image", "video", "document", "vcard", "multi_vcard", "audio", "ptt", "poll_creation"];
|
|
51
56
|
export type SendMessageContent = {
|
|
52
|
-
message_type?:
|
|
57
|
+
message_type?: typeof SUPPORTED_TYPES[number];
|
|
53
58
|
body?: string;
|
|
54
59
|
media?: MediaType;
|
|
55
60
|
contact_ids?: string[];
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enumChatColors = exports.labelColors = void 0;
|
|
3
|
+
exports.SUPPORTED_TYPES = exports.enumChatColors = exports.labelColors = void 0;
|
|
4
4
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
5
5
|
exports.labelColors = [
|
|
6
6
|
'#9333EA',
|
|
@@ -26,3 +26,16 @@ exports.enumChatColors = [
|
|
|
26
26
|
'#FF2E74',
|
|
27
27
|
'#DB2777',
|
|
28
28
|
];
|
|
29
|
+
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
30
|
+
exports.SUPPORTED_TYPES = [
|
|
31
|
+
'chat',
|
|
32
|
+
'sticker',
|
|
33
|
+
'image',
|
|
34
|
+
'video',
|
|
35
|
+
'document',
|
|
36
|
+
'vcard',
|
|
37
|
+
'multi_vcard',
|
|
38
|
+
'audio',
|
|
39
|
+
'ptt',
|
|
40
|
+
'poll_creation',
|
|
41
|
+
];
|
package/package.json
CHANGED
package/supabase.types.ts
CHANGED
|
@@ -106,6 +106,7 @@ export interface Database {
|
|
|
106
106
|
}
|
|
107
107
|
tbl_chat_access: {
|
|
108
108
|
Row: {
|
|
109
|
+
active_phone: string | null
|
|
109
110
|
chat_id: string
|
|
110
111
|
email: string
|
|
111
112
|
has_access: boolean | null
|
|
@@ -113,6 +114,7 @@ export interface Database {
|
|
|
113
114
|
org_id: string
|
|
114
115
|
}
|
|
115
116
|
Insert: {
|
|
117
|
+
active_phone?: string | null
|
|
116
118
|
chat_id: string
|
|
117
119
|
email: string
|
|
118
120
|
has_access?: boolean | null
|
|
@@ -120,6 +122,7 @@ export interface Database {
|
|
|
120
122
|
org_id?: string
|
|
121
123
|
}
|
|
122
124
|
Update: {
|
|
125
|
+
active_phone?: string | null
|
|
123
126
|
chat_id?: string
|
|
124
127
|
email?: string
|
|
125
128
|
has_access?: boolean | null
|
|
@@ -128,11 +131,11 @@ export interface Database {
|
|
|
128
131
|
}
|
|
129
132
|
Relationships: [
|
|
130
133
|
{
|
|
131
|
-
foreignKeyName: "
|
|
132
|
-
columns: ["org_id"]
|
|
134
|
+
foreignKeyName: "tbl_chat_access_org_id_email_fkey"
|
|
135
|
+
columns: ["org_id", "email"]
|
|
133
136
|
isOneToOne: false
|
|
134
|
-
referencedRelation: "
|
|
135
|
-
referencedColumns: ["org_id"]
|
|
137
|
+
referencedRelation: "tbl_org_members"
|
|
138
|
+
referencedColumns: ["org_id", "email"]
|
|
136
139
|
}
|
|
137
140
|
]
|
|
138
141
|
}
|
|
@@ -284,10 +287,10 @@ export interface Database {
|
|
|
284
287
|
Relationships: [
|
|
285
288
|
{
|
|
286
289
|
foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
|
|
287
|
-
columns: ["
|
|
290
|
+
columns: ["org_phone", "org_id"]
|
|
288
291
|
isOneToOne: false
|
|
289
292
|
referencedRelation: "tbl_org_phones"
|
|
290
|
-
referencedColumns: ["
|
|
293
|
+
referencedColumns: ["org_phone", "org_id"]
|
|
291
294
|
}
|
|
292
295
|
]
|
|
293
296
|
}
|
|
@@ -681,6 +684,7 @@ export interface Database {
|
|
|
681
684
|
org_image: string | null
|
|
682
685
|
org_metadata: Json | null
|
|
683
686
|
org_name: string | null
|
|
687
|
+
org_plan: Json | null
|
|
684
688
|
support_link: string | null
|
|
685
689
|
}
|
|
686
690
|
Insert: {
|
|
@@ -689,6 +693,7 @@ export interface Database {
|
|
|
689
693
|
org_image?: string | null
|
|
690
694
|
org_metadata?: Json | null
|
|
691
695
|
org_name?: string | null
|
|
696
|
+
org_plan?: Json | null
|
|
692
697
|
support_link?: string | null
|
|
693
698
|
}
|
|
694
699
|
Update: {
|
|
@@ -697,6 +702,7 @@ export interface Database {
|
|
|
697
702
|
org_image?: string | null
|
|
698
703
|
org_metadata?: Json | null
|
|
699
704
|
org_name?: string | null
|
|
705
|
+
org_plan?: Json | null
|
|
700
706
|
support_link?: string | null
|
|
701
707
|
}
|
|
702
708
|
Relationships: []
|
|
@@ -743,6 +749,7 @@ export interface Database {
|
|
|
743
749
|
invited_at: string | null
|
|
744
750
|
invited_by: string | null
|
|
745
751
|
is_active: boolean
|
|
752
|
+
member_color: Database["public"]["Enums"]["enum_chat_colors"]
|
|
746
753
|
member_image: string | null
|
|
747
754
|
member_name: string | null
|
|
748
755
|
org_id: string
|
|
@@ -755,6 +762,7 @@ export interface Database {
|
|
|
755
762
|
invited_at?: string | null
|
|
756
763
|
invited_by?: string | null
|
|
757
764
|
is_active?: boolean
|
|
765
|
+
member_color?: Database["public"]["Enums"]["enum_chat_colors"]
|
|
758
766
|
member_image?: string | null
|
|
759
767
|
member_name?: string | null
|
|
760
768
|
org_id: string
|
|
@@ -767,6 +775,7 @@ export interface Database {
|
|
|
767
775
|
invited_at?: string | null
|
|
768
776
|
invited_by?: string | null
|
|
769
777
|
is_active?: boolean
|
|
778
|
+
member_color?: Database["public"]["Enums"]["enum_chat_colors"]
|
|
770
779
|
member_image?: string | null
|
|
771
780
|
member_name?: string | null
|
|
772
781
|
org_id?: string
|
|
@@ -807,7 +816,7 @@ export interface Database {
|
|
|
807
816
|
Insert: {
|
|
808
817
|
created_at?: string
|
|
809
818
|
is_ready?: boolean | null
|
|
810
|
-
org_id
|
|
819
|
+
org_id?: string
|
|
811
820
|
org_phone?: string | null
|
|
812
821
|
phone_id?: string
|
|
813
822
|
phone_image?: string | null
|
|
@@ -837,6 +846,13 @@ export interface Database {
|
|
|
837
846
|
isOneToOne: false
|
|
838
847
|
referencedRelation: "tbl_org"
|
|
839
848
|
referencedColumns: ["org_id"]
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
foreignKeyName: "tbl_org_phones_org_id_fkey"
|
|
852
|
+
columns: ["org_id"]
|
|
853
|
+
isOneToOne: false
|
|
854
|
+
referencedRelation: "tbl_org"
|
|
855
|
+
referencedColumns: ["org_id"]
|
|
840
856
|
}
|
|
841
857
|
]
|
|
842
858
|
}
|
|
@@ -870,34 +886,122 @@ export interface Database {
|
|
|
870
886
|
}
|
|
871
887
|
]
|
|
872
888
|
}
|
|
889
|
+
view_chat_messages: {
|
|
890
|
+
Row: {
|
|
891
|
+
ack: string | null
|
|
892
|
+
author: string | null
|
|
893
|
+
body: string | null
|
|
894
|
+
broadcast_id: string | null
|
|
895
|
+
chat_id: string | null
|
|
896
|
+
delivery_info: Json | null
|
|
897
|
+
from_me: boolean | null
|
|
898
|
+
invite_v4: Json | null
|
|
899
|
+
is_deleted: boolean | null
|
|
900
|
+
links: Json | null
|
|
901
|
+
location: Json | null
|
|
902
|
+
media: Json | null
|
|
903
|
+
mentioned_ids: string[] | null
|
|
904
|
+
message_id: string | null
|
|
905
|
+
message_ticket_id: string | null
|
|
906
|
+
message_type: string | null
|
|
907
|
+
org_id: string | null
|
|
908
|
+
org_phone: string | null
|
|
909
|
+
performed_by: string | null
|
|
910
|
+
prev_body: string | null
|
|
911
|
+
quoted_message_id: string | null
|
|
912
|
+
sender_phone: string | null
|
|
913
|
+
sent_message_id: string | null
|
|
914
|
+
timestamp: string | null
|
|
915
|
+
unique_id: string | null
|
|
916
|
+
updated_at: string | null
|
|
917
|
+
vcards: string[] | null
|
|
918
|
+
}
|
|
919
|
+
Insert: {
|
|
920
|
+
ack?: string | null
|
|
921
|
+
author?: string | null
|
|
922
|
+
body?: string | null
|
|
923
|
+
broadcast_id?: string | null
|
|
924
|
+
chat_id?: string | null
|
|
925
|
+
delivery_info?: Json | null
|
|
926
|
+
from_me?: boolean | null
|
|
927
|
+
invite_v4?: Json | null
|
|
928
|
+
is_deleted?: boolean | null
|
|
929
|
+
links?: Json | null
|
|
930
|
+
location?: Json | null
|
|
931
|
+
media?: Json | null
|
|
932
|
+
mentioned_ids?: string[] | null
|
|
933
|
+
message_id?: string | null
|
|
934
|
+
message_ticket_id?: string | null
|
|
935
|
+
message_type?: string | null
|
|
936
|
+
org_id?: string | null
|
|
937
|
+
org_phone?: string | null
|
|
938
|
+
performed_by?: string | null
|
|
939
|
+
prev_body?: string | null
|
|
940
|
+
quoted_message_id?: string | null
|
|
941
|
+
sender_phone?: string | null
|
|
942
|
+
sent_message_id?: string | null
|
|
943
|
+
timestamp?: string | null
|
|
944
|
+
unique_id?: string | null
|
|
945
|
+
updated_at?: string | null
|
|
946
|
+
vcards?: string[] | null
|
|
947
|
+
}
|
|
948
|
+
Update: {
|
|
949
|
+
ack?: string | null
|
|
950
|
+
author?: string | null
|
|
951
|
+
body?: string | null
|
|
952
|
+
broadcast_id?: string | null
|
|
953
|
+
chat_id?: string | null
|
|
954
|
+
delivery_info?: Json | null
|
|
955
|
+
from_me?: boolean | null
|
|
956
|
+
invite_v4?: Json | null
|
|
957
|
+
is_deleted?: boolean | null
|
|
958
|
+
links?: Json | null
|
|
959
|
+
location?: Json | null
|
|
960
|
+
media?: Json | null
|
|
961
|
+
mentioned_ids?: string[] | null
|
|
962
|
+
message_id?: string | null
|
|
963
|
+
message_ticket_id?: string | null
|
|
964
|
+
message_type?: string | null
|
|
965
|
+
org_id?: string | null
|
|
966
|
+
org_phone?: string | null
|
|
967
|
+
performed_by?: string | null
|
|
968
|
+
prev_body?: string | null
|
|
969
|
+
quoted_message_id?: string | null
|
|
970
|
+
sender_phone?: string | null
|
|
971
|
+
sent_message_id?: string | null
|
|
972
|
+
timestamp?: string | null
|
|
973
|
+
unique_id?: string | null
|
|
974
|
+
updated_at?: string | null
|
|
975
|
+
vcards?: string[] | null
|
|
976
|
+
}
|
|
977
|
+
Relationships: [
|
|
978
|
+
{
|
|
979
|
+
foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
|
|
980
|
+
columns: ["org_phone", "org_id"]
|
|
981
|
+
isOneToOne: false
|
|
982
|
+
referencedRelation: "tbl_org_phones"
|
|
983
|
+
referencedColumns: ["org_phone", "org_id"]
|
|
984
|
+
}
|
|
985
|
+
]
|
|
986
|
+
}
|
|
873
987
|
view_chats: {
|
|
874
988
|
Row: {
|
|
875
|
-
|
|
989
|
+
active_phone: string | null
|
|
876
990
|
chat_access: Json | null
|
|
877
991
|
chat_id: string | null
|
|
878
992
|
chat_image: string | null
|
|
879
993
|
chat_name: string | null
|
|
880
994
|
chat_org_phones: string[] | null
|
|
881
995
|
chat_type: string | null
|
|
882
|
-
group_metadata: Json | null
|
|
883
996
|
has_access: boolean | null
|
|
884
|
-
id: Json | null
|
|
885
997
|
invite_link: string | null
|
|
886
|
-
is_group: boolean | null
|
|
887
|
-
is_muted: boolean | null
|
|
888
|
-
is_read_only: boolean | null
|
|
889
998
|
label_ids: Json | null
|
|
890
999
|
last_read_timestamp: string | null
|
|
891
1000
|
latest_message: Json | null
|
|
892
1001
|
member_count: number | null
|
|
893
1002
|
message_unread_count: number | null
|
|
894
|
-
mute_expiration: number | null
|
|
895
|
-
name: string | null
|
|
896
1003
|
org_id: string | null
|
|
897
1004
|
org_phone: string | null
|
|
898
|
-
pinned: boolean | null
|
|
899
|
-
timestamp: string | null
|
|
900
|
-
unread_count: number | null
|
|
901
1005
|
updated_at: string | null
|
|
902
1006
|
}
|
|
903
1007
|
Relationships: [
|
|
@@ -910,47 +1014,6 @@ export interface Database {
|
|
|
910
1014
|
}
|
|
911
1015
|
]
|
|
912
1016
|
}
|
|
913
|
-
view_contacts: {
|
|
914
|
-
Row: {
|
|
915
|
-
business_profile: Json | null
|
|
916
|
-
chat_count: number | null
|
|
917
|
-
chat_ids: string[] | null
|
|
918
|
-
contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null
|
|
919
|
-
contact_id: string | null
|
|
920
|
-
contact_image: string | null
|
|
921
|
-
contact_name: string | null
|
|
922
|
-
contact_type: string | null
|
|
923
|
-
id: Json | null
|
|
924
|
-
is_blocked: boolean | null
|
|
925
|
-
is_business: boolean | null
|
|
926
|
-
is_enterprise: boolean | null
|
|
927
|
-
is_group: boolean | null
|
|
928
|
-
is_internal: boolean | null
|
|
929
|
-
is_me: boolean | null
|
|
930
|
-
is_my_contact: boolean | null
|
|
931
|
-
is_user: boolean | null
|
|
932
|
-
is_wa_contact: boolean | null
|
|
933
|
-
label_ids: Json | null
|
|
934
|
-
last_updated_at: string | null
|
|
935
|
-
name: string | null
|
|
936
|
-
number: string | null
|
|
937
|
-
org_id: string | null
|
|
938
|
-
pushname: string | null
|
|
939
|
-
short_name: string | null
|
|
940
|
-
updated_at: string | null
|
|
941
|
-
verified_level: number | null
|
|
942
|
-
verified_name: string | null
|
|
943
|
-
}
|
|
944
|
-
Relationships: [
|
|
945
|
-
{
|
|
946
|
-
foreignKeyName: "tbl_contacts_org_id_fkey"
|
|
947
|
-
columns: ["org_id"]
|
|
948
|
-
isOneToOne: false
|
|
949
|
-
referencedRelation: "tbl_org"
|
|
950
|
-
referencedColumns: ["org_id"]
|
|
951
|
-
}
|
|
952
|
-
]
|
|
953
|
-
}
|
|
954
1017
|
}
|
|
955
1018
|
Functions: {
|
|
956
1019
|
gen_id: {
|
|
@@ -993,14 +1056,6 @@ export interface Database {
|
|
|
993
1056
|
}
|
|
994
1057
|
Returns: Json
|
|
995
1058
|
}
|
|
996
|
-
get_dashboard_statistics: {
|
|
997
|
-
Args: {
|
|
998
|
-
org_id_input: string
|
|
999
|
-
type_input?: string
|
|
1000
|
-
interval_input?: unknown
|
|
1001
|
-
}
|
|
1002
|
-
Returns: Json
|
|
1003
|
-
}
|
|
1004
1059
|
get_export_chats_data: {
|
|
1005
1060
|
Args: {
|
|
1006
1061
|
chat_ids: string[]
|
|
@@ -1008,13 +1063,6 @@ export interface Database {
|
|
|
1008
1063
|
}
|
|
1009
1064
|
Returns: Json
|
|
1010
1065
|
}
|
|
1011
|
-
get_media: {
|
|
1012
|
-
Args: {
|
|
1013
|
-
filters?: Json
|
|
1014
|
-
page_num?: number
|
|
1015
|
-
}
|
|
1016
|
-
Returns: Json
|
|
1017
|
-
}
|
|
1018
1066
|
get_org: {
|
|
1019
1067
|
Args: {
|
|
1020
1068
|
org_id_input?: string
|
|
@@ -1034,6 +1082,7 @@ export interface Database {
|
|
|
1034
1082
|
tbl_type: string
|
|
1035
1083
|
label_ids_input: Json
|
|
1036
1084
|
row_id_input: string[]
|
|
1085
|
+
replace_labels?: boolean
|
|
1037
1086
|
}
|
|
1038
1087
|
Returns: undefined
|
|
1039
1088
|
}
|
package/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
2
|
-
import { Chat, Location, MessageInfo
|
|
2
|
+
import { Chat, Location, MessageInfo } from 'whatsapp-web.js';
|
|
3
3
|
import { Tables } from './supabase.types';
|
|
4
4
|
|
|
5
5
|
/* ----------------------------- TYPE SHORTHANDS ---------------------------- */
|
|
@@ -33,10 +33,10 @@ export type ChatType = Merge<
|
|
|
33
33
|
latest_message: MessageType | null;
|
|
34
34
|
members: Record<string, ChatMemberType> | null;
|
|
35
35
|
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
36
|
-
active_phone?: string;
|
|
37
36
|
chat_access: Record<string, boolean>;
|
|
38
37
|
label_ids: Record<string, boolean>;
|
|
39
38
|
chat_org_phones?: string[];
|
|
39
|
+
message_unread_count: number | null;
|
|
40
40
|
}
|
|
41
41
|
>;
|
|
42
42
|
|
|
@@ -48,9 +48,13 @@ export type MediaType = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export type MessageType = OverrideProperties<
|
|
51
|
-
Tables<'
|
|
51
|
+
Tables<'view_chat_messages'>,
|
|
52
52
|
{
|
|
53
|
-
|
|
53
|
+
message_id: string;
|
|
54
|
+
org_id: string;
|
|
55
|
+
org_phone: string;
|
|
56
|
+
chat_id: string;
|
|
57
|
+
message_type: typeof SUPPORTED_TYPES[number];
|
|
54
58
|
media: MediaType | null;
|
|
55
59
|
}
|
|
56
60
|
>;
|
|
@@ -64,10 +68,11 @@ export type ContactType = Merge<
|
|
|
64
68
|
Tables<'tbl_contacts'>,
|
|
65
69
|
{
|
|
66
70
|
chats: ChatType[] | null;
|
|
67
|
-
chat_count: number | null;
|
|
68
|
-
chat_ids: string[] | null;
|
|
69
71
|
}
|
|
70
72
|
>;
|
|
73
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
74
|
+
|
|
75
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
71
76
|
|
|
72
77
|
export type ChatAccessType = Merge<
|
|
73
78
|
Partial<Tables<'tbl_chat_access'>>,
|
|
@@ -104,17 +109,21 @@ export const enumChatColors = [
|
|
|
104
109
|
|
|
105
110
|
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
106
111
|
|
|
112
|
+
export const SUPPORTED_TYPES = [
|
|
113
|
+
'chat',
|
|
114
|
+
'sticker',
|
|
115
|
+
'image',
|
|
116
|
+
'video',
|
|
117
|
+
'document',
|
|
118
|
+
'vcard',
|
|
119
|
+
'multi_vcard',
|
|
120
|
+
'audio',
|
|
121
|
+
'ptt',
|
|
122
|
+
'poll_creation',
|
|
123
|
+
] as const;
|
|
124
|
+
|
|
107
125
|
export type SendMessageContent = {
|
|
108
|
-
message_type?:
|
|
109
|
-
| 'chat'
|
|
110
|
-
| 'audio'
|
|
111
|
-
| 'ptt'
|
|
112
|
-
| 'image'
|
|
113
|
-
| 'video'
|
|
114
|
-
| 'document'
|
|
115
|
-
| 'sticker'
|
|
116
|
-
| 'location'
|
|
117
|
-
| 'vcard';
|
|
126
|
+
message_type?: typeof SUPPORTED_TYPES[number];
|
|
118
127
|
body?: string;
|
|
119
128
|
media?: MediaType;
|
|
120
129
|
contact_ids?: string[];
|