@periskope/types 0.6.53 → 0.6.55

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/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './supabase.columns';
2
1
  export * from './supabase.types';
3
2
  export * from './types';
package/dist/index.js CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./supabase.columns"), exports);
18
17
  __exportStar(require("./supabase.types"), exports);
19
18
  __exportStar(require("./types"), exports);
@@ -2,7 +2,7 @@ export declare const TableColumns: {
2
2
  readonly tbl_broadcast_messages: readonly ["broadcast_id", "created_at", "chat_ids", "scheduled_at", "org_id", "message_payload", "completed_at", "performed_by"];
3
3
  readonly tbl_broadcast_templates: readonly ["template_id", "created_at", "template_name", "org_id", "updated_at", "message_payload"];
4
4
  readonly tbl_chat_access: readonly ["org_id", "email", "chat_id", "has_access", "last_read_timestamp", "active_phone"];
5
- readonly tbl_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "broadcast", "device_type", "duration", "forwarding_score", "from", "from_me", "has_media", "has_quoted_msg", "has_reaction", "id", "invite_v4", "is_ephemeral", "is_forwarded", "is_gif", "is_starred", "is_status", "links", "location", "media_key", "mentioned_ids", "order_id", "raw_data", "to", "token", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id"];
5
+ readonly tbl_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id", "is_gif", "is_forwarded", "is_starred"];
6
6
  readonly tbl_chat_notifications: readonly ["org_id", "notification_id", "chat_id", "author", "body", "id", "recipientids", "type", "timestamp", "org_phone"];
7
7
  readonly tbl_chat_participants: readonly ["org_id", "chat_id", "contact_id", "id", "is_admin", "is_super_admin", "org_phone"];
8
8
  readonly tbl_chat_reactions: readonly ["org_id", "message_id", "ack", "id", "orphan", "reaction", "read", "reaction_id", "timestamp", "msg_id", "orphan_reason", "sender_id", "org_phone"];
@@ -14,6 +14,5 @@ export declare const TableColumns: {
14
14
  readonly tbl_org_members: readonly ["created_at", "email", "user_id", "invited_at", "invited_by", "org_id", "role", "member_image", "member_name", "is_active", "member_color"];
15
15
  readonly tbl_org_phones: readonly ["org_id", "org_phone", "created_at", "updated_at", "wa_state", "phone_id", "qr_code", "phone_image", "phone_name", "server_ip"];
16
16
  readonly view_broadcast_logs: readonly ["broadcast_id", "org_id", "message_payload", "created_at", "total_chats", "sent_chats", "failed_chats", "total_member_count", "delivered_member_count", "read_member_count", "completed_at", "scheduled_at", "performed_by", "delivery_percentage", "read_percentage"];
17
- readonly view_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id", "is_gif", "is_forwarded", "is_starred"];
18
17
  readonly view_chats: readonly ["org_id", "chat_id", "org_phone", "chat_image", "invite_link", "label_ids", "updated_at", "chat_name", "latest_message", "member_count", "chat_type", "chat_access", "has_access", "last_read_timestamp", "chat_org_phones", "active_phone", "group_description"];
19
18
  };
@@ -237,7 +237,7 @@ exports.TableColumns = {
237
237
  "delivery_percentage",
238
238
  "read_percentage"
239
239
  ],
240
- "view_chat_messages": [
240
+ "tbl_chat_messages": [
241
241
  "message_id",
242
242
  "org_id",
243
243
  "ack",
@@ -46,7 +46,7 @@ export interface Database {
46
46
  completed_at?: string | null;
47
47
  created_at?: string;
48
48
  message_payload?: Json | null;
49
- org_id?: string;
49
+ org_id: string;
50
50
  performed_by?: string | null;
51
51
  scheduled_at?: string | null;
52
52
  };
@@ -82,7 +82,7 @@ export interface Database {
82
82
  Insert: {
83
83
  created_at?: string;
84
84
  message_payload?: Json | null;
85
- org_id?: string;
85
+ org_id: string;
86
86
  template_id?: string;
87
87
  template_name?: string | null;
88
88
  updated_at?: string | null;
@@ -120,7 +120,7 @@ export interface Database {
120
120
  email: string;
121
121
  has_access?: boolean | null;
122
122
  last_read_timestamp?: string | null;
123
- org_id?: string;
123
+ org_id: string;
124
124
  };
125
125
  Update: {
126
126
  active_phone?: string | null;
@@ -130,15 +130,7 @@ export interface Database {
130
130
  last_read_timestamp?: string | null;
131
131
  org_id?: string;
132
132
  };
133
- Relationships: [
134
- {
135
- foreignKeyName: "tbl_chat_access_org_id_email_fkey";
136
- columns: ["org_id", "email"];
137
- isOneToOne: false;
138
- referencedRelation: "tbl_org_members";
139
- referencedColumns: ["org_id", "email"];
140
- }
141
- ];
133
+ Relationships: [];
142
134
  };
143
135
  tbl_chat_messages: {
144
136
  Row: {
@@ -165,7 +157,6 @@ export interface Database {
165
157
  is_gif: boolean | null;
166
158
  is_starred: boolean | null;
167
159
  is_status: boolean | null;
168
- is_supported_type: boolean | null;
169
160
  links: Json | null;
170
161
  location: Json | null;
171
162
  media: Json | null;
@@ -214,7 +205,6 @@ export interface Database {
214
205
  is_gif?: boolean | null;
215
206
  is_starred?: boolean | null;
216
207
  is_status?: boolean | null;
217
- is_supported_type?: boolean | null;
218
208
  links?: Json | null;
219
209
  location?: Json | null;
220
210
  media?: Json | null;
@@ -263,7 +253,6 @@ export interface Database {
263
253
  is_gif?: boolean | null;
264
254
  is_starred?: boolean | null;
265
255
  is_status?: boolean | null;
266
- is_supported_type?: boolean | null;
267
256
  links?: Json | null;
268
257
  location?: Json | null;
269
258
  media?: Json | null;
@@ -445,15 +434,7 @@ export interface Database {
445
434
  timestamp?: string | null;
446
435
  unique_id?: string | null;
447
436
  };
448
- Relationships: [
449
- {
450
- foreignKeyName: "tbl_chat_reactions_fkey_tbl_org_phones";
451
- columns: ["org_id", "org_phone"];
452
- isOneToOne: false;
453
- referencedRelation: "tbl_org_phones";
454
- referencedColumns: ["org_id", "org_phone"];
455
- }
456
- ];
437
+ Relationships: [];
457
438
  };
458
439
  tbl_chat_tickets: {
459
440
  Row: {
@@ -467,7 +448,7 @@ export interface Database {
467
448
  last_updated_at: string;
468
449
  org_id: string;
469
450
  priority: number | null;
470
- quoted_message_id: string;
451
+ quoted_message_id: string | null;
471
452
  raised_by: string | null;
472
453
  status: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
473
454
  subject: string;
@@ -484,7 +465,7 @@ export interface Database {
484
465
  last_updated_at?: string;
485
466
  org_id: string;
486
467
  priority?: number | null;
487
- quoted_message_id: string;
468
+ quoted_message_id?: string | null;
488
469
  raised_by?: string | null;
489
470
  status?: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
490
471
  subject: string;
@@ -501,7 +482,7 @@ export interface Database {
501
482
  last_updated_at?: string;
502
483
  org_id?: string;
503
484
  priority?: number | null;
504
- quoted_message_id?: string;
485
+ quoted_message_id?: string | null;
505
486
  raised_by?: string | null;
506
487
  status?: Database["public"]["Enums"]["enum_chat_tickets_status"] | null;
507
488
  subject?: string;
@@ -522,6 +503,7 @@ export interface Database {
522
503
  archived: boolean | null;
523
504
  chat_id: string;
524
505
  chat_image: string | null;
506
+ custom_properties: Json | null;
525
507
  group_metadata: Json | null;
526
508
  id: Json | null;
527
509
  invite_link: string | null;
@@ -544,6 +526,7 @@ export interface Database {
544
526
  archived?: boolean | null;
545
527
  chat_id: string;
546
528
  chat_image?: string | null;
529
+ custom_properties?: Json | null;
547
530
  group_metadata?: Json | null;
548
531
  id?: Json | null;
549
532
  invite_link?: string | null;
@@ -566,6 +549,7 @@ export interface Database {
566
549
  archived?: boolean | null;
567
550
  chat_id?: string;
568
551
  chat_image?: string | null;
552
+ custom_properties?: Json | null;
569
553
  group_metadata?: Json | null;
570
554
  id?: Json | null;
571
555
  invite_link?: string | null;
@@ -686,6 +670,47 @@ export interface Database {
686
670
  }
687
671
  ];
688
672
  };
673
+ tbl_custom_properties: {
674
+ Row: {
675
+ created_at: string;
676
+ created_by: string | null;
677
+ org_id: string | null;
678
+ property_id: string;
679
+ property_name: string;
680
+ property_value: string | null;
681
+ property_value_type: string | null;
682
+ type: string | null;
683
+ };
684
+ Insert: {
685
+ created_at?: string;
686
+ created_by?: string | null;
687
+ org_id?: string | null;
688
+ property_id?: string;
689
+ property_name: string;
690
+ property_value?: string | null;
691
+ property_value_type?: string | null;
692
+ type?: string | null;
693
+ };
694
+ Update: {
695
+ created_at?: string;
696
+ created_by?: string | null;
697
+ org_id?: string | null;
698
+ property_id?: string;
699
+ property_name?: string;
700
+ property_value?: string | null;
701
+ property_value_type?: string | null;
702
+ type?: string | null;
703
+ };
704
+ Relationships: [
705
+ {
706
+ foreignKeyName: "tbl_custom_properties_org_id_fkey";
707
+ columns: ["org_id"];
708
+ isOneToOne: false;
709
+ referencedRelation: "tbl_org";
710
+ referencedColumns: ["org_id"];
711
+ }
712
+ ];
713
+ };
689
714
  tbl_org: {
690
715
  Row: {
691
716
  created_at: string;
@@ -739,7 +764,7 @@ export interface Database {
739
764
  created_at?: string;
740
765
  label_id?: string;
741
766
  name: string;
742
- org_id?: string;
767
+ org_id: string;
743
768
  type?: string;
744
769
  };
745
770
  Update: {
@@ -834,7 +859,7 @@ export interface Database {
834
859
  Insert: {
835
860
  created_at?: string;
836
861
  is_ready?: boolean | null;
837
- org_id?: string;
862
+ org_id: string;
838
863
  org_phone?: string | null;
839
864
  phone_id?: string;
840
865
  phone_image?: string | null;
@@ -904,49 +929,6 @@ export interface Database {
904
929
  }
905
930
  ];
906
931
  };
907
- view_chat_messages: {
908
- Row: {
909
- ack: string | null;
910
- author: string | null;
911
- body: string | null;
912
- broadcast_id: string | null;
913
- chat_id: string | null;
914
- delivery_info: Json | null;
915
- from_me: boolean | null;
916
- invite_v4: Json | null;
917
- is_deleted: boolean | null;
918
- is_forwarded: boolean | null;
919
- is_gif: boolean | null;
920
- is_starred: boolean | null;
921
- links: Json | null;
922
- location: Json | null;
923
- media: Json | null;
924
- mentioned_ids: string[] | null;
925
- message_id: string | null;
926
- message_ticket_id: string | null;
927
- message_type: string | null;
928
- org_id: string | null;
929
- org_phone: string | null;
930
- performed_by: string | null;
931
- prev_body: string | null;
932
- quoted_message_id: string | null;
933
- sender_phone: string | null;
934
- sent_message_id: string | null;
935
- timestamp: string | null;
936
- unique_id: string | null;
937
- updated_at: string | null;
938
- vcards: string[] | null;
939
- };
940
- Relationships: [
941
- {
942
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
943
- columns: ["org_phone", "org_id"];
944
- isOneToOne: false;
945
- referencedRelation: "tbl_org_phones";
946
- referencedColumns: ["org_phone", "org_id"];
947
- }
948
- ];
949
- };
950
932
  view_chats: {
951
933
  Row: {
952
934
  active_phone: string | null;
@@ -956,6 +938,7 @@ export interface Database {
956
938
  chat_name: string | null;
957
939
  chat_org_phones: string[] | null;
958
940
  chat_type: string | null;
941
+ custom_properties: Json | null;
959
942
  group_description: string | null;
960
943
  has_access: boolean | null;
961
944
  invite_link: string | null;
@@ -979,6 +962,12 @@ export interface Database {
979
962
  };
980
963
  };
981
964
  Functions: {
965
+ custom_access_token_hook: {
966
+ Args: {
967
+ event: Json;
968
+ };
969
+ Returns: Json;
970
+ };
982
971
  gen_id: {
983
972
  Args: {
984
973
  prefix: string;
@@ -989,7 +978,7 @@ export interface Database {
989
978
  };
990
979
  gen_ticket_id: {
991
980
  Args: {
992
- org_id_input?: string;
981
+ org_id_input: string;
993
982
  };
994
983
  Returns: string;
995
984
  };
@@ -997,27 +986,28 @@ export interface Database {
997
986
  Args: {
998
987
  broadcast_id_input: string;
999
988
  chat_id_input?: string;
1000
- org_id_input?: string;
1001
989
  };
1002
990
  Returns: Json;
1003
991
  };
1004
992
  get_chat_labels_data: {
1005
993
  Args: {
994
+ org_id_input: string;
1006
995
  chat_ids_input?: string[];
1007
996
  };
1008
997
  Returns: unknown;
1009
998
  };
1010
999
  get_chats: {
1011
1000
  Args: {
1001
+ org_id_input: string;
1012
1002
  chat_id_input?: string[];
1013
1003
  with_metadata?: boolean;
1014
1004
  last_updated_at_input?: string;
1015
- org_id_input?: string;
1016
1005
  };
1017
1006
  Returns: Json;
1018
1007
  };
1019
1008
  get_contacts: {
1020
1009
  Args: {
1010
+ org_id_input: string;
1021
1011
  contact_ids_input?: string[];
1022
1012
  last_updated_at_input?: string;
1023
1013
  };
@@ -1025,6 +1015,7 @@ export interface Database {
1025
1015
  };
1026
1016
  get_dashboard_statistics: {
1027
1017
  Args: {
1018
+ org_id_input: string;
1028
1019
  type_input?: string;
1029
1020
  interval_input?: unknown;
1030
1021
  };
@@ -1032,30 +1023,30 @@ export interface Database {
1032
1023
  };
1033
1024
  get_export_chats_data: {
1034
1025
  Args: {
1035
- chat_ids: string[];
1036
- org_id_input?: string;
1026
+ org_id_input: string;
1027
+ chat_ids?: string[];
1037
1028
  };
1038
1029
  Returns: Json;
1039
1030
  };
1040
1031
  get_messages_notifications_reactions: {
1041
1032
  Args: {
1033
+ org_id_input: string;
1042
1034
  chat_id_input?: string[];
1043
1035
  message_limit_input?: number;
1044
1036
  reaction_notification_limit_input?: number;
1045
- org_id_input?: string;
1046
1037
  last_updated_at_input?: string;
1047
1038
  };
1048
1039
  Returns: Json;
1049
1040
  };
1050
1041
  get_org: {
1051
1042
  Args: {
1052
- org_id_input?: string;
1043
+ org_id_input: string;
1053
1044
  };
1054
1045
  Returns: Json;
1055
1046
  };
1056
1047
  list_org_from_user: {
1057
1048
  Args: Record<PropertyKey, never>;
1058
- Returns: string;
1049
+ Returns: unknown;
1059
1050
  };
1060
1051
  list_role_from_user: {
1061
1052
  Args: Record<PropertyKey, never>;
@@ -1063,6 +1054,7 @@ export interface Database {
1063
1054
  };
1064
1055
  update_labels: {
1065
1056
  Args: {
1057
+ org_id_input: string;
1066
1058
  tbl_type: string;
1067
1059
  label_ids_input: Json;
1068
1060
  row_id_input: string[];
package/dist/types.d.ts CHANGED
@@ -39,6 +39,7 @@ export type OrgType = OverrideProperties<Tables<'tbl_org'> & {
39
39
  members: Tables<'tbl_org_members'>[];
40
40
  phones: Tables<'tbl_org_phones'>[];
41
41
  labels: Tables<'tbl_org_labels'>[];
42
+ custom_properties: Tables<'tbl_custom_properties'>[];
42
43
  }, {
43
44
  org_plan: OrgPlan<AllPlans | Enterprise>;
44
45
  stripe_customer_details: _Stripe.Customer | null;
@@ -67,7 +68,7 @@ export type MediaType = {
67
68
  };
68
69
  size?: number;
69
70
  };
70
- export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
71
+ export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
71
72
  message_id: string;
72
73
  org_id: string;
73
74
  org_phone: string;
package/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './supabase.columns';
2
1
  export * from './supabase.types';
3
2
  export * from './types';
4
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.53",
3
+ "version": "0.6.55",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,6 @@
13
13
  "whatsapp-web.js": "1.23.1-alpha.4"
14
14
  },
15
15
  "scripts": {
16
- "update-package": "node scripts/extractColumnNames.js \u0026\u0026 tsc \u0026\u0026 npm publish --access public"
16
+ "update-package": "tsc \u0026\u0026 npm publish --access public"
17
17
  }
18
18
  }
package/supabase.types.ts CHANGED
@@ -45,7 +45,7 @@ export interface Database {
45
45
  completed_at?: string | null
46
46
  created_at?: string
47
47
  message_payload?: Json | null
48
- org_id?: string
48
+ org_id: string
49
49
  performed_by?: string | null
50
50
  scheduled_at?: string | null
51
51
  }
@@ -81,7 +81,7 @@ export interface Database {
81
81
  Insert: {
82
82
  created_at?: string
83
83
  message_payload?: Json | null
84
- org_id?: string
84
+ org_id: string
85
85
  template_id?: string
86
86
  template_name?: string | null
87
87
  updated_at?: string | null
@@ -119,7 +119,7 @@ export interface Database {
119
119
  email: string
120
120
  has_access?: boolean | null
121
121
  last_read_timestamp?: string | null
122
- org_id?: string
122
+ org_id: string
123
123
  }
124
124
  Update: {
125
125
  active_phone?: string | null
@@ -129,15 +129,7 @@ export interface Database {
129
129
  last_read_timestamp?: string | null
130
130
  org_id?: string
131
131
  }
132
- Relationships: [
133
- {
134
- foreignKeyName: "tbl_chat_access_org_id_email_fkey"
135
- columns: ["org_id", "email"]
136
- isOneToOne: false
137
- referencedRelation: "tbl_org_members"
138
- referencedColumns: ["org_id", "email"]
139
- }
140
- ]
132
+ Relationships: []
141
133
  }
142
134
  tbl_chat_messages: {
143
135
  Row: {
@@ -164,7 +156,6 @@ export interface Database {
164
156
  is_gif: boolean | null
165
157
  is_starred: boolean | null
166
158
  is_status: boolean | null
167
- is_supported_type: boolean | null
168
159
  links: Json | null
169
160
  location: Json | null
170
161
  media: Json | null
@@ -213,7 +204,6 @@ export interface Database {
213
204
  is_gif?: boolean | null
214
205
  is_starred?: boolean | null
215
206
  is_status?: boolean | null
216
- is_supported_type?: boolean | null
217
207
  links?: Json | null
218
208
  location?: Json | null
219
209
  media?: Json | null
@@ -262,7 +252,6 @@ export interface Database {
262
252
  is_gif?: boolean | null
263
253
  is_starred?: boolean | null
264
254
  is_status?: boolean | null
265
- is_supported_type?: boolean | null
266
255
  links?: Json | null
267
256
  location?: Json | null
268
257
  media?: Json | null
@@ -444,15 +433,7 @@ export interface Database {
444
433
  timestamp?: string | null
445
434
  unique_id?: string | null
446
435
  }
447
- Relationships: [
448
- {
449
- foreignKeyName: "tbl_chat_reactions_fkey_tbl_org_phones"
450
- columns: ["org_id", "org_phone"]
451
- isOneToOne: false
452
- referencedRelation: "tbl_org_phones"
453
- referencedColumns: ["org_id", "org_phone"]
454
- }
455
- ]
436
+ Relationships: []
456
437
  }
457
438
  tbl_chat_tickets: {
458
439
  Row: {
@@ -466,7 +447,7 @@ export interface Database {
466
447
  last_updated_at: string
467
448
  org_id: string
468
449
  priority: number | null
469
- quoted_message_id: string
450
+ quoted_message_id: string | null
470
451
  raised_by: string | null
471
452
  status: Database["public"]["Enums"]["enum_chat_tickets_status"] | null
472
453
  subject: string
@@ -483,7 +464,7 @@ export interface Database {
483
464
  last_updated_at?: string
484
465
  org_id: string
485
466
  priority?: number | null
486
- quoted_message_id: string
467
+ quoted_message_id?: string | null
487
468
  raised_by?: string | null
488
469
  status?:
489
470
  | Database["public"]["Enums"]["enum_chat_tickets_status"]
@@ -502,7 +483,7 @@ export interface Database {
502
483
  last_updated_at?: string
503
484
  org_id?: string
504
485
  priority?: number | null
505
- quoted_message_id?: string
486
+ quoted_message_id?: string | null
506
487
  raised_by?: string | null
507
488
  status?:
508
489
  | Database["public"]["Enums"]["enum_chat_tickets_status"]
@@ -525,6 +506,7 @@ export interface Database {
525
506
  archived: boolean | null
526
507
  chat_id: string
527
508
  chat_image: string | null
509
+ custom_properties: Json | null
528
510
  group_metadata: Json | null
529
511
  id: Json | null
530
512
  invite_link: string | null
@@ -547,6 +529,7 @@ export interface Database {
547
529
  archived?: boolean | null
548
530
  chat_id: string
549
531
  chat_image?: string | null
532
+ custom_properties?: Json | null
550
533
  group_metadata?: Json | null
551
534
  id?: Json | null
552
535
  invite_link?: string | null
@@ -569,6 +552,7 @@ export interface Database {
569
552
  archived?: boolean | null
570
553
  chat_id?: string
571
554
  chat_image?: string | null
555
+ custom_properties?: Json | null
572
556
  group_metadata?: Json | null
573
557
  id?: Json | null
574
558
  invite_link?: string | null
@@ -689,6 +673,47 @@ export interface Database {
689
673
  }
690
674
  ]
691
675
  }
676
+ tbl_custom_properties: {
677
+ Row: {
678
+ created_at: string
679
+ created_by: string | null
680
+ org_id: string | null
681
+ property_id: string
682
+ property_name: string
683
+ property_value: string | null
684
+ property_value_type: string | null
685
+ type: string | null
686
+ }
687
+ Insert: {
688
+ created_at?: string
689
+ created_by?: string | null
690
+ org_id?: string | null
691
+ property_id?: string
692
+ property_name: string
693
+ property_value?: string | null
694
+ property_value_type?: string | null
695
+ type?: string | null
696
+ }
697
+ Update: {
698
+ created_at?: string
699
+ created_by?: string | null
700
+ org_id?: string | null
701
+ property_id?: string
702
+ property_name?: string
703
+ property_value?: string | null
704
+ property_value_type?: string | null
705
+ type?: string | null
706
+ }
707
+ Relationships: [
708
+ {
709
+ foreignKeyName: "tbl_custom_properties_org_id_fkey"
710
+ columns: ["org_id"]
711
+ isOneToOne: false
712
+ referencedRelation: "tbl_org"
713
+ referencedColumns: ["org_id"]
714
+ }
715
+ ]
716
+ }
692
717
  tbl_org: {
693
718
  Row: {
694
719
  created_at: string
@@ -742,7 +767,7 @@ export interface Database {
742
767
  created_at?: string
743
768
  label_id?: string
744
769
  name: string
745
- org_id?: string
770
+ org_id: string
746
771
  type?: string
747
772
  }
748
773
  Update: {
@@ -837,7 +862,7 @@ export interface Database {
837
862
  Insert: {
838
863
  created_at?: string
839
864
  is_ready?: boolean | null
840
- org_id?: string
865
+ org_id: string
841
866
  org_phone?: string | null
842
867
  phone_id?: string
843
868
  phone_image?: string | null
@@ -907,49 +932,6 @@ export interface Database {
907
932
  }
908
933
  ]
909
934
  }
910
- view_chat_messages: {
911
- Row: {
912
- ack: string | null
913
- author: string | null
914
- body: string | null
915
- broadcast_id: string | null
916
- chat_id: string | null
917
- delivery_info: Json | null
918
- from_me: boolean | null
919
- invite_v4: Json | null
920
- is_deleted: boolean | null
921
- is_forwarded: boolean | null
922
- is_gif: boolean | null
923
- is_starred: boolean | null
924
- links: Json | null
925
- location: Json | null
926
- media: Json | null
927
- mentioned_ids: string[] | null
928
- message_id: string | null
929
- message_ticket_id: string | null
930
- message_type: string | null
931
- org_id: string | null
932
- org_phone: string | null
933
- performed_by: string | null
934
- prev_body: string | null
935
- quoted_message_id: string | null
936
- sender_phone: string | null
937
- sent_message_id: string | null
938
- timestamp: string | null
939
- unique_id: string | null
940
- updated_at: string | null
941
- vcards: string[] | null
942
- }
943
- Relationships: [
944
- {
945
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
946
- columns: ["org_phone", "org_id"]
947
- isOneToOne: false
948
- referencedRelation: "tbl_org_phones"
949
- referencedColumns: ["org_phone", "org_id"]
950
- }
951
- ]
952
- }
953
935
  view_chats: {
954
936
  Row: {
955
937
  active_phone: string | null
@@ -959,6 +941,7 @@ export interface Database {
959
941
  chat_name: string | null
960
942
  chat_org_phones: string[] | null
961
943
  chat_type: string | null
944
+ custom_properties: Json | null
962
945
  group_description: string | null
963
946
  has_access: boolean | null
964
947
  invite_link: string | null
@@ -982,6 +965,12 @@ export interface Database {
982
965
  }
983
966
  }
984
967
  Functions: {
968
+ custom_access_token_hook: {
969
+ Args: {
970
+ event: Json
971
+ }
972
+ Returns: Json
973
+ }
985
974
  gen_id: {
986
975
  Args: {
987
976
  prefix: string
@@ -992,7 +981,7 @@ export interface Database {
992
981
  }
993
982
  gen_ticket_id: {
994
983
  Args: {
995
- org_id_input?: string
984
+ org_id_input: string
996
985
  }
997
986
  Returns: string
998
987
  }
@@ -1000,27 +989,28 @@ export interface Database {
1000
989
  Args: {
1001
990
  broadcast_id_input: string
1002
991
  chat_id_input?: string
1003
- org_id_input?: string
1004
992
  }
1005
993
  Returns: Json
1006
994
  }
1007
995
  get_chat_labels_data: {
1008
996
  Args: {
997
+ org_id_input: string
1009
998
  chat_ids_input?: string[]
1010
999
  }
1011
1000
  Returns: unknown
1012
1001
  }
1013
1002
  get_chats: {
1014
1003
  Args: {
1004
+ org_id_input: string
1015
1005
  chat_id_input?: string[]
1016
1006
  with_metadata?: boolean
1017
1007
  last_updated_at_input?: string
1018
- org_id_input?: string
1019
1008
  }
1020
1009
  Returns: Json
1021
1010
  }
1022
1011
  get_contacts: {
1023
1012
  Args: {
1013
+ org_id_input: string
1024
1014
  contact_ids_input?: string[]
1025
1015
  last_updated_at_input?: string
1026
1016
  }
@@ -1028,6 +1018,7 @@ export interface Database {
1028
1018
  }
1029
1019
  get_dashboard_statistics: {
1030
1020
  Args: {
1021
+ org_id_input: string
1031
1022
  type_input?: string
1032
1023
  interval_input?: unknown
1033
1024
  }
@@ -1035,30 +1026,30 @@ export interface Database {
1035
1026
  }
1036
1027
  get_export_chats_data: {
1037
1028
  Args: {
1038
- chat_ids: string[]
1039
- org_id_input?: string
1029
+ org_id_input: string
1030
+ chat_ids?: string[]
1040
1031
  }
1041
1032
  Returns: Json
1042
1033
  }
1043
1034
  get_messages_notifications_reactions: {
1044
1035
  Args: {
1036
+ org_id_input: string
1045
1037
  chat_id_input?: string[]
1046
1038
  message_limit_input?: number
1047
1039
  reaction_notification_limit_input?: number
1048
- org_id_input?: string
1049
1040
  last_updated_at_input?: string
1050
1041
  }
1051
1042
  Returns: Json
1052
1043
  }
1053
1044
  get_org: {
1054
1045
  Args: {
1055
- org_id_input?: string
1046
+ org_id_input: string
1056
1047
  }
1057
1048
  Returns: Json
1058
1049
  }
1059
1050
  list_org_from_user: {
1060
1051
  Args: Record<PropertyKey, never>
1061
- Returns: string
1052
+ Returns: unknown
1062
1053
  }
1063
1054
  list_role_from_user: {
1064
1055
  Args: Record<PropertyKey, never>
@@ -1066,6 +1057,7 @@ export interface Database {
1066
1057
  }
1067
1058
  update_labels: {
1068
1059
  Args: {
1060
+ org_id_input: string
1069
1061
  tbl_type: string
1070
1062
  label_ids_input: Json
1071
1063
  row_id_input: string[]
package/types.ts CHANGED
@@ -58,6 +58,7 @@ export type OrgType = OverrideProperties<
58
58
  members: Tables<'tbl_org_members'>[];
59
59
  phones: Tables<'tbl_org_phones'>[];
60
60
  labels: Tables<'tbl_org_labels'>[];
61
+ custom_properties: Tables<'tbl_custom_properties'>[];
61
62
  },
62
63
  {
63
64
  org_plan: OrgPlan<AllPlans | Enterprise>;
@@ -95,7 +96,7 @@ export type MediaType = {
95
96
  };
96
97
 
97
98
  export type MessageType = OverrideProperties<
98
- Tables<'view_chat_messages'>,
99
+ Tables<'tbl_chat_messages'>,
99
100
  {
100
101
  message_id: string;
101
102
  org_id: string;
@@ -1,55 +0,0 @@
1
- const { Pool } = require('pg');
2
- const fs = require('fs');
3
-
4
- const SUPABASE_DB_URL =
5
- 'postgresql://postgres:postgres@localhost:54322/postgres';
6
- const pool = new Pool({
7
- connectionString: SUPABASE_DB_URL,
8
- });
9
- const outputFile = './supabase.columns.ts';
10
-
11
- async function fetchNonGeneratedColumns() {
12
- const query = `
13
- SELECT
14
- table_name,
15
- array_agg(column_name ORDER BY ordinal_position) AS non_generated_columns
16
- FROM
17
- information_schema.columns
18
- WHERE
19
- table_schema = 'public' -- Adjust this to your schema
20
- AND is_generated = 'NEVER'
21
- GROUP BY
22
- table_name;
23
- `;
24
-
25
- try {
26
- const res = await pool.query(query);
27
- return res.rows; // Each row will have `table_name` and `non_generated_columns`
28
- } catch (err) {
29
- console.error('Error fetching non-generated columns:', err);
30
- throw err;
31
- }
32
- }
33
-
34
- fetchNonGeneratedColumns().then((tables) => {
35
- const tableColumns = tables.reduce(
36
- (acc, { table_name, non_generated_columns }) => {
37
- const columns = non_generated_columns
38
- .slice(1, -1) // Remove the curly braces
39
- .split(',') // Split by comma to get individual column names
40
- .map((column) => column.trim()); // Trim any whitespace around column names
41
-
42
- acc[table_name] = columns;
43
- return acc;
44
- },
45
- {}
46
- );
47
-
48
- const tsContent = `export const TableColumns = ${JSON.stringify(
49
- tableColumns,
50
- null,
51
- 2
52
- )} as const;`;
53
-
54
- fs.writeFileSync(outputFile, tsContent, 'utf8'); // Write the TS content to file
55
- });
@@ -1,288 +0,0 @@
1
- export const TableColumns = {
2
- "tbl_broadcast_messages": [
3
- "broadcast_id",
4
- "created_at",
5
- "chat_ids",
6
- "scheduled_at",
7
- "org_id",
8
- "message_payload",
9
- "completed_at",
10
- "performed_by"
11
- ],
12
- "tbl_broadcast_templates": [
13
- "template_id",
14
- "created_at",
15
- "template_name",
16
- "org_id",
17
- "updated_at",
18
- "message_payload"
19
- ],
20
- "tbl_chat_access": [
21
- "org_id",
22
- "email",
23
- "chat_id",
24
- "has_access",
25
- "last_read_timestamp",
26
- "active_phone"
27
- ],
28
- "tbl_chat_messages": [
29
- "message_id",
30
- "org_id",
31
- "ack",
32
- "author",
33
- "body",
34
- "broadcast",
35
- "device_type",
36
- "duration",
37
- "forwarding_score",
38
- "from",
39
- "from_me",
40
- "has_media",
41
- "has_quoted_msg",
42
- "has_reaction",
43
- "id",
44
- "invite_v4",
45
- "is_ephemeral",
46
- "is_forwarded",
47
- "is_gif",
48
- "is_starred",
49
- "is_status",
50
- "links",
51
- "location",
52
- "media_key",
53
- "mentioned_ids",
54
- "order_id",
55
- "raw_data",
56
- "to",
57
- "token",
58
- "message_type",
59
- "vcards",
60
- "chat_id",
61
- "timestamp",
62
- "org_phone",
63
- "broadcast_id",
64
- "is_deleted",
65
- "media",
66
- "performed_by",
67
- "prev_body",
68
- "quoted_message_id",
69
- "sent_message_id",
70
- "delivery_info",
71
- "updated_at",
72
- "message_ticket_id"
73
- ],
74
- "tbl_chat_notifications": [
75
- "org_id",
76
- "notification_id",
77
- "chat_id",
78
- "author",
79
- "body",
80
- "id",
81
- "recipientids",
82
- "type",
83
- "timestamp",
84
- "org_phone"
85
- ],
86
- "tbl_chat_participants": [
87
- "org_id",
88
- "chat_id",
89
- "contact_id",
90
- "id",
91
- "is_admin",
92
- "is_super_admin",
93
- "org_phone"
94
- ],
95
- "tbl_chat_reactions": [
96
- "org_id",
97
- "message_id",
98
- "ack",
99
- "id",
100
- "orphan",
101
- "reaction",
102
- "read",
103
- "reaction_id",
104
- "timestamp",
105
- "msg_id",
106
- "orphan_reason",
107
- "sender_id",
108
- "org_phone"
109
- ],
110
- "tbl_chat_tickets": [
111
- "created_at",
112
- "ticket_id",
113
- "subject",
114
- "status",
115
- "assignee",
116
- "assigned_by",
117
- "chat_id",
118
- "due_date",
119
- "org_id",
120
- "label_ids",
121
- "quoted_message_id",
122
- "raised_by",
123
- "priority",
124
- "last_updated_at",
125
- "is_deleted"
126
- ],
127
- "tbl_chats": [
128
- "org_id",
129
- "chat_id",
130
- "archived",
131
- "id",
132
- "is_group",
133
- "is_muted",
134
- "is_read_only",
135
- "mute_expiration",
136
- "name",
137
- "pinned",
138
- "unread_count",
139
- "group_metadata",
140
- "chat_image",
141
- "timestamp",
142
- "invite_link",
143
- "org_phone",
144
- "label_ids",
145
- "updated_at",
146
- "latest_message",
147
- "member_count"
148
- ],
149
- "tbl_contacts": [
150
- "org_id",
151
- "contact_id",
152
- "id",
153
- "number",
154
- "is_business",
155
- "is_enterprise",
156
- "name",
157
- "pushname",
158
- "short_name",
159
- "contact_type",
160
- "is_me",
161
- "is_user",
162
- "is_group",
163
- "is_wa_contact",
164
- "is_my_contact",
165
- "is_blocked",
166
- "contact_image",
167
- "contact_color",
168
- "business_profile",
169
- "verified_name",
170
- "is_internal",
171
- "label_ids",
172
- "verified_level",
173
- "updated_at"
174
- ],
175
- "tbl_org": [
176
- "org_id",
177
- "created_at",
178
- "org_image",
179
- "org_name",
180
- "support_link",
181
- "org_metadata",
182
- "org_plan",
183
- "stripe_customer_details",
184
- "stripe_customer_id",
185
- "stripe_subscription_details"
186
- ],
187
- "tbl_org_labels": [
188
- "label_id",
189
- "created_at",
190
- "org_id",
191
- "name",
192
- "color",
193
- "type"
194
- ],
195
- "tbl_org_members": [
196
- "created_at",
197
- "email",
198
- "user_id",
199
- "invited_at",
200
- "invited_by",
201
- "org_id",
202
- "role",
203
- "member_image",
204
- "member_name",
205
- "is_active",
206
- "member_color"
207
- ],
208
- "tbl_org_phones": [
209
- "org_id",
210
- "org_phone",
211
- "created_at",
212
- "updated_at",
213
- "wa_state",
214
- "phone_id",
215
- "qr_code",
216
- "phone_image",
217
- "phone_name",
218
- "server_ip"
219
- ],
220
- "view_broadcast_logs": [
221
- "broadcast_id",
222
- "org_id",
223
- "message_payload",
224
- "created_at",
225
- "total_chats",
226
- "sent_chats",
227
- "failed_chats",
228
- "total_member_count",
229
- "delivered_member_count",
230
- "read_member_count",
231
- "completed_at",
232
- "scheduled_at",
233
- "performed_by",
234
- "delivery_percentage",
235
- "read_percentage"
236
- ],
237
- "view_chat_messages": [
238
- "message_id",
239
- "org_id",
240
- "ack",
241
- "author",
242
- "body",
243
- "from_me",
244
- "invite_v4",
245
- "links",
246
- "location",
247
- "mentioned_ids",
248
- "message_type",
249
- "vcards",
250
- "chat_id",
251
- "timestamp",
252
- "org_phone",
253
- "broadcast_id",
254
- "is_deleted",
255
- "media",
256
- "performed_by",
257
- "prev_body",
258
- "quoted_message_id",
259
- "sender_phone",
260
- "sent_message_id",
261
- "delivery_info",
262
- "updated_at",
263
- "message_ticket_id",
264
- "unique_id",
265
- "is_gif",
266
- "is_forwarded",
267
- "is_starred"
268
- ],
269
- "view_chats": [
270
- "org_id",
271
- "chat_id",
272
- "org_phone",
273
- "chat_image",
274
- "invite_link",
275
- "label_ids",
276
- "updated_at",
277
- "chat_name",
278
- "latest_message",
279
- "member_count",
280
- "chat_type",
281
- "chat_access",
282
- "has_access",
283
- "last_read_timestamp",
284
- "chat_org_phones",
285
- "active_phone",
286
- "group_description"
287
- ]
288
- } as const;