@periskope/types 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ # Define the path to the TypeScript file
2
+ $filePath = ".\supabase.types.ts"
3
+
4
+ # Read the content of the file as a single string
5
+ $fileContent = Get-Content $filePath -Raw
6
+
7
+ # Define the current and new type definitions
8
+ $oldTypeDefinition = 'export type Json =\s*\| string\s*\| number\s*\| boolean\s*\| null\s*\| \{ \[key: string\]: Json \| undefined \}\s*\| Json\[\]'
9
+ $newTypeDefinition = 'export type Json = { [key: string]: any } | any'
10
+
11
+ # Replace the old type definition with the new one
12
+ $updatedContent = $fileContent -replace $oldTypeDefinition, $newTypeDefinition
13
+
14
+ # Write the updated content back to the file
15
+ $updatedContent | Set-Content $filePath
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@periskope/types",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "main": "types.ts",
6
+ "dependencies": {
7
+ "type-fest": "^4.8.3",
8
+ "whatsapp-web.js": "^1.23.0"
9
+ }
10
+ }
@@ -0,0 +1,969 @@
1
+ export type Json = { [key: string]: any } | any
2
+
3
+ export interface Database {
4
+ graphql_public: {
5
+ Tables: {
6
+ [_ in never]: never
7
+ }
8
+ Views: {
9
+ [_ in never]: never
10
+ }
11
+ Functions: {
12
+ graphql: {
13
+ Args: {
14
+ operationName?: string
15
+ query?: string
16
+ variables?: Json
17
+ extensions?: Json
18
+ }
19
+ Returns: Json
20
+ }
21
+ }
22
+ Enums: {
23
+ [_ in never]: never
24
+ }
25
+ CompositeTypes: {
26
+ [_ in never]: never
27
+ }
28
+ }
29
+ public: {
30
+ Tables: {
31
+ tbl_chat_messages: {
32
+ Row: {
33
+ ack: string | null
34
+ author: string | null
35
+ body: string | null
36
+ broadcast: boolean | null
37
+ chat_id: string | null
38
+ device_type: string | null
39
+ duration: string | null
40
+ forwarding_score: number | null
41
+ from: string | null
42
+ from_me: boolean | null
43
+ has_media: boolean | null
44
+ has_quoted_msg: boolean | null
45
+ has_reaction: boolean | null
46
+ id: Json | null
47
+ invite_v4: Json | null
48
+ is_ephemeral: boolean | null
49
+ is_forwarded: boolean | null
50
+ is_gif: boolean | null
51
+ is_starred: boolean | null
52
+ is_status: boolean | null
53
+ links: Json | null
54
+ location: Json | null
55
+ media_key: string | null
56
+ mentioned_ids: string[] | null
57
+ message_id: string
58
+ order_id: string | null
59
+ org_id: string
60
+ org_phone: string
61
+ raw_data: Json | null
62
+ timestamp: string | null
63
+ to: string | null
64
+ token: string | null
65
+ type: string | null
66
+ vcards: string[] | null
67
+ }
68
+ Insert: {
69
+ ack?: string | null
70
+ author?: string | null
71
+ body?: string | null
72
+ broadcast?: boolean | null
73
+ chat_id?: string | null
74
+ device_type?: string | null
75
+ duration?: string | null
76
+ forwarding_score?: number | null
77
+ from?: string | null
78
+ from_me?: boolean | null
79
+ has_media?: boolean | null
80
+ has_quoted_msg?: boolean | null
81
+ has_reaction?: boolean | null
82
+ id?: Json | null
83
+ invite_v4?: Json | null
84
+ is_ephemeral?: boolean | null
85
+ is_forwarded?: boolean | null
86
+ is_gif?: boolean | null
87
+ is_starred?: boolean | null
88
+ is_status?: boolean | null
89
+ links?: Json | null
90
+ location?: Json | null
91
+ media_key?: string | null
92
+ mentioned_ids?: string[] | null
93
+ message_id: string
94
+ order_id?: string | null
95
+ org_id: string
96
+ org_phone: string
97
+ raw_data?: Json | null
98
+ timestamp?: string | null
99
+ to?: string | null
100
+ token?: string | null
101
+ type?: string | null
102
+ vcards?: string[] | null
103
+ }
104
+ Update: {
105
+ ack?: string | null
106
+ author?: string | null
107
+ body?: string | null
108
+ broadcast?: boolean | null
109
+ chat_id?: string | null
110
+ device_type?: string | null
111
+ duration?: string | null
112
+ forwarding_score?: number | null
113
+ from?: string | null
114
+ from_me?: boolean | null
115
+ has_media?: boolean | null
116
+ has_quoted_msg?: boolean | null
117
+ has_reaction?: boolean | null
118
+ id?: Json | null
119
+ invite_v4?: Json | null
120
+ is_ephemeral?: boolean | null
121
+ is_forwarded?: boolean | null
122
+ is_gif?: boolean | null
123
+ is_starred?: boolean | null
124
+ is_status?: boolean | null
125
+ links?: Json | null
126
+ location?: Json | null
127
+ media_key?: string | null
128
+ mentioned_ids?: string[] | null
129
+ message_id?: string
130
+ order_id?: string | null
131
+ org_id?: string
132
+ org_phone?: string
133
+ raw_data?: Json | null
134
+ timestamp?: string | null
135
+ to?: string | null
136
+ token?: string | null
137
+ type?: string | null
138
+ vcards?: string[] | null
139
+ }
140
+ Relationships: [
141
+ {
142
+ foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
143
+ columns: ["org_id", "org_phone"]
144
+ isOneToOne: false
145
+ referencedRelation: "tbl_org_phones"
146
+ referencedColumns: ["org_id", "org_phone"]
147
+ }
148
+ ]
149
+ }
150
+ tbl_chat_notifications: {
151
+ Row: {
152
+ author: string | null
153
+ body: string | null
154
+ chat_id: string | null
155
+ group_notification_id: string
156
+ id: Json | null
157
+ org_id: string
158
+ org_phone: string
159
+ recipientids: string[] | null
160
+ timestamp: string | null
161
+ type: string | null
162
+ }
163
+ Insert: {
164
+ author?: string | null
165
+ body?: string | null
166
+ chat_id?: string | null
167
+ group_notification_id: string
168
+ id?: Json | null
169
+ org_id: string
170
+ org_phone: string
171
+ recipientids?: string[] | null
172
+ timestamp?: string | null
173
+ type?: string | null
174
+ }
175
+ Update: {
176
+ author?: string | null
177
+ body?: string | null
178
+ chat_id?: string | null
179
+ group_notification_id?: string
180
+ id?: Json | null
181
+ org_id?: string
182
+ org_phone?: string
183
+ recipientids?: string[] | null
184
+ timestamp?: string | null
185
+ type?: string | null
186
+ }
187
+ Relationships: [
188
+ {
189
+ foreignKeyName: "tbl_chat_notifications_fkey_tbl_org_phones"
190
+ columns: ["org_id", "org_phone"]
191
+ isOneToOne: false
192
+ referencedRelation: "tbl_org_phones"
193
+ referencedColumns: ["org_id", "org_phone"]
194
+ }
195
+ ]
196
+ }
197
+ tbl_chat_participants: {
198
+ Row: {
199
+ chat_id: string
200
+ contact_id: string
201
+ id: Json | null
202
+ is_admin: boolean | null
203
+ is_super_admin: boolean | null
204
+ org_id: string
205
+ }
206
+ Insert: {
207
+ chat_id: string
208
+ contact_id: string
209
+ id?: Json | null
210
+ is_admin?: boolean | null
211
+ is_super_admin?: boolean | null
212
+ org_id: string
213
+ }
214
+ Update: {
215
+ chat_id?: string
216
+ contact_id?: string
217
+ id?: Json | null
218
+ is_admin?: boolean | null
219
+ is_super_admin?: boolean | null
220
+ org_id?: string
221
+ }
222
+ Relationships: []
223
+ }
224
+ tbl_chat_reactions: {
225
+ Row: {
226
+ ack: number | null
227
+ id: Json | null
228
+ message_id: string | null
229
+ msg_id: Json | null
230
+ org_id: string
231
+ org_phone: string
232
+ orphan: number | null
233
+ orphan_reason: string | null
234
+ reaction: string | null
235
+ reaction_id: string
236
+ read: boolean | null
237
+ sender_id: string | null
238
+ timestamp: string | null
239
+ }
240
+ Insert: {
241
+ ack?: number | null
242
+ id?: Json | null
243
+ message_id?: string | null
244
+ msg_id?: Json | null
245
+ org_id: string
246
+ org_phone: string
247
+ orphan?: number | null
248
+ orphan_reason?: string | null
249
+ reaction?: string | null
250
+ reaction_id: string
251
+ read?: boolean | null
252
+ sender_id?: string | null
253
+ timestamp?: string | null
254
+ }
255
+ Update: {
256
+ ack?: number | null
257
+ id?: Json | null
258
+ message_id?: string | null
259
+ msg_id?: Json | null
260
+ org_id?: string
261
+ org_phone?: string
262
+ orphan?: number | null
263
+ orphan_reason?: string | null
264
+ reaction?: string | null
265
+ reaction_id?: string
266
+ read?: boolean | null
267
+ sender_id?: string | null
268
+ timestamp?: string | null
269
+ }
270
+ Relationships: [
271
+ {
272
+ foreignKeyName: "tbl_chat_reactions_fkey_tbl_org_phones"
273
+ columns: ["org_id", "org_phone"]
274
+ isOneToOne: false
275
+ referencedRelation: "tbl_org_phones"
276
+ referencedColumns: ["org_id", "org_phone"]
277
+ }
278
+ ]
279
+ }
280
+ tbl_chats: {
281
+ Row: {
282
+ archived: boolean | null
283
+ chat_id: string
284
+ chat_image: string | null
285
+ group_metadata: Json | null
286
+ id: Json | null
287
+ invite_link: string | null
288
+ is_group: boolean | null
289
+ is_muted: boolean | null
290
+ is_read_only: boolean | null
291
+ label_ids: string[] | null
292
+ mute_expiration: number | null
293
+ name: string | null
294
+ org_id: string
295
+ org_phone: string
296
+ pinned: boolean | null
297
+ timestamp: string | null
298
+ unread_count: number | null
299
+ }
300
+ Insert: {
301
+ archived?: boolean | null
302
+ chat_id: string
303
+ chat_image?: string | null
304
+ group_metadata?: Json | null
305
+ id?: Json | null
306
+ invite_link?: string | null
307
+ is_group?: boolean | null
308
+ is_muted?: boolean | null
309
+ is_read_only?: boolean | null
310
+ label_ids?: string[] | null
311
+ mute_expiration?: number | null
312
+ name?: string | null
313
+ org_id: string
314
+ org_phone: string
315
+ pinned?: boolean | null
316
+ timestamp?: string | null
317
+ unread_count?: number | null
318
+ }
319
+ Update: {
320
+ archived?: boolean | null
321
+ chat_id?: string
322
+ chat_image?: string | null
323
+ group_metadata?: Json | null
324
+ id?: Json | null
325
+ invite_link?: string | null
326
+ is_group?: boolean | null
327
+ is_muted?: boolean | null
328
+ is_read_only?: boolean | null
329
+ label_ids?: string[] | null
330
+ mute_expiration?: number | null
331
+ name?: string | null
332
+ org_id?: string
333
+ org_phone?: string
334
+ pinned?: boolean | null
335
+ timestamp?: string | null
336
+ unread_count?: number | null
337
+ }
338
+ Relationships: []
339
+ }
340
+ tbl_contacts: {
341
+ Row: {
342
+ contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null
343
+ contact_id: string
344
+ contact_image: string | null
345
+ id: Json | null
346
+ is_blocked: boolean | null
347
+ is_business: boolean | null
348
+ is_enterprise: boolean | null
349
+ is_group: boolean | null
350
+ is_me: boolean | null
351
+ is_my_contact: boolean | null
352
+ is_user: boolean | null
353
+ is_wa_contact: boolean | null
354
+ name: string | null
355
+ number: string | null
356
+ org_id: string
357
+ pushname: string | null
358
+ short_name: string | null
359
+ type: string | null
360
+ }
361
+ Insert: {
362
+ contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null
363
+ contact_id: string
364
+ contact_image?: string | null
365
+ id?: Json | null
366
+ is_blocked?: boolean | null
367
+ is_business?: boolean | null
368
+ is_enterprise?: boolean | null
369
+ is_group?: boolean | null
370
+ is_me?: boolean | null
371
+ is_my_contact?: boolean | null
372
+ is_user?: boolean | null
373
+ is_wa_contact?: boolean | null
374
+ name?: string | null
375
+ number?: string | null
376
+ org_id: string
377
+ pushname?: string | null
378
+ short_name?: string | null
379
+ type?: string | null
380
+ }
381
+ Update: {
382
+ contact_color?: Database["public"]["Enums"]["enum_chat_colors"] | null
383
+ contact_id?: string
384
+ contact_image?: string | null
385
+ id?: Json | null
386
+ is_blocked?: boolean | null
387
+ is_business?: boolean | null
388
+ is_enterprise?: boolean | null
389
+ is_group?: boolean | null
390
+ is_me?: boolean | null
391
+ is_my_contact?: boolean | null
392
+ is_user?: boolean | null
393
+ is_wa_contact?: boolean | null
394
+ name?: string | null
395
+ number?: string | null
396
+ org_id?: string
397
+ pushname?: string | null
398
+ short_name?: string | null
399
+ type?: string | null
400
+ }
401
+ Relationships: [
402
+ {
403
+ foreignKeyName: "tbl_contacts_org_id_fkey"
404
+ columns: ["org_id"]
405
+ isOneToOne: false
406
+ referencedRelation: "tbl_org"
407
+ referencedColumns: ["org_id"]
408
+ }
409
+ ]
410
+ }
411
+ tbl_org: {
412
+ Row: {
413
+ created_at: string
414
+ org_id: string
415
+ org_image: string | null
416
+ org_name: string | null
417
+ support_link: string | null
418
+ }
419
+ Insert: {
420
+ created_at?: string
421
+ org_id?: string
422
+ org_image?: string | null
423
+ org_name?: string | null
424
+ support_link?: string | null
425
+ }
426
+ Update: {
427
+ created_at?: string
428
+ org_id?: string
429
+ org_image?: string | null
430
+ org_name?: string | null
431
+ support_link?: string | null
432
+ }
433
+ Relationships: []
434
+ }
435
+ tbl_org_labels: {
436
+ Row: {
437
+ color: string
438
+ created_at: string
439
+ label_id: string
440
+ name: string
441
+ org_id: string
442
+ type: string
443
+ }
444
+ Insert: {
445
+ color?: string
446
+ created_at?: string
447
+ label_id?: string
448
+ name: string
449
+ org_id: string
450
+ type: string
451
+ }
452
+ Update: {
453
+ color?: string
454
+ created_at?: string
455
+ label_id?: string
456
+ name?: string
457
+ org_id?: string
458
+ type?: string
459
+ }
460
+ Relationships: [
461
+ {
462
+ foreignKeyName: "tbl_org_labels_org_id_fkey"
463
+ columns: ["org_id"]
464
+ isOneToOne: false
465
+ referencedRelation: "tbl_org"
466
+ referencedColumns: ["org_id"]
467
+ }
468
+ ]
469
+ }
470
+ tbl_org_members: {
471
+ Row: {
472
+ created_at: string | null
473
+ email: string
474
+ invited_at: string | null
475
+ invited_by: string | null
476
+ is_active: boolean
477
+ member_image: string | null
478
+ member_name: string | null
479
+ org_id: string
480
+ role: Database["public"]["Enums"]["enum_member_role"]
481
+ user_id: string | null
482
+ }
483
+ Insert: {
484
+ created_at?: string | null
485
+ email: string
486
+ invited_at?: string | null
487
+ invited_by?: string | null
488
+ is_active?: boolean
489
+ member_image?: string | null
490
+ member_name?: string | null
491
+ org_id: string
492
+ role?: Database["public"]["Enums"]["enum_member_role"]
493
+ user_id?: string | null
494
+ }
495
+ Update: {
496
+ created_at?: string | null
497
+ email?: string
498
+ invited_at?: string | null
499
+ invited_by?: string | null
500
+ is_active?: boolean
501
+ member_image?: string | null
502
+ member_name?: string | null
503
+ org_id?: string
504
+ role?: Database["public"]["Enums"]["enum_member_role"]
505
+ user_id?: string | null
506
+ }
507
+ Relationships: [
508
+ {
509
+ foreignKeyName: "tbl_org_members_fkey_auth_users"
510
+ columns: ["user_id"]
511
+ isOneToOne: false
512
+ referencedRelation: "users"
513
+ referencedColumns: ["id"]
514
+ },
515
+ {
516
+ foreignKeyName: "tbl_org_members_fkey_tbl_org"
517
+ columns: ["org_id"]
518
+ isOneToOne: false
519
+ referencedRelation: "tbl_org"
520
+ referencedColumns: ["org_id"]
521
+ }
522
+ ]
523
+ }
524
+ tbl_org_phones: {
525
+ Row: {
526
+ created_at: string
527
+ is_ready: boolean
528
+ org_id: string
529
+ org_phone: string | null
530
+ phone_id: string
531
+ updated_at: string
532
+ wa_state: string | null
533
+ }
534
+ Insert: {
535
+ created_at?: string
536
+ is_ready?: boolean
537
+ org_id: string
538
+ org_phone?: string | null
539
+ phone_id?: string
540
+ updated_at?: string
541
+ wa_state?: string | null
542
+ }
543
+ Update: {
544
+ created_at?: string
545
+ is_ready?: boolean
546
+ org_id?: string
547
+ org_phone?: string | null
548
+ phone_id?: string
549
+ updated_at?: string
550
+ wa_state?: string | null
551
+ }
552
+ Relationships: [
553
+ {
554
+ foreignKeyName: "tbl_org_phones_fkey_tbl_org"
555
+ columns: ["org_id"]
556
+ isOneToOne: false
557
+ referencedRelation: "tbl_org"
558
+ referencedColumns: ["org_id"]
559
+ }
560
+ ]
561
+ }
562
+ }
563
+ Views: {
564
+ view_chat_messages: {
565
+ Row: {
566
+ ack: string | null
567
+ author: string | null
568
+ body: string | null
569
+ broadcast: boolean | null
570
+ chat_id: string | null
571
+ contact_color: Database["public"]["Enums"]["enum_chat_colors"] | null
572
+ device_type: string | null
573
+ duration: string | null
574
+ forwarding_score: number | null
575
+ from: string | null
576
+ from_me: boolean | null
577
+ has_media: boolean | null
578
+ has_quoted_msg: boolean | null
579
+ has_reaction: boolean | null
580
+ id: Json | null
581
+ invite_v4: Json | null
582
+ is_ephemeral: boolean | null
583
+ is_forwarded: boolean | null
584
+ is_gif: boolean | null
585
+ is_starred: boolean | null
586
+ is_status: boolean | null
587
+ links: Json | null
588
+ location: Json | null
589
+ media_key: string | null
590
+ mentioned_ids: string[] | null
591
+ message_id: string | null
592
+ name: string | null
593
+ order_id: string | null
594
+ org_id: string | null
595
+ org_phone: string | null
596
+ pushname: string | null
597
+ raw_data: Json | null
598
+ sender_phone: string | null
599
+ timestamp: string | null
600
+ to: string | null
601
+ token: string | null
602
+ type: string | null
603
+ vcards: string[] | null
604
+ }
605
+ Relationships: [
606
+ {
607
+ foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
608
+ columns: ["org_id", "org_phone"]
609
+ isOneToOne: false
610
+ referencedRelation: "tbl_org_phones"
611
+ referencedColumns: ["org_id", "org_phone"]
612
+ }
613
+ ]
614
+ }
615
+ view_chats: {
616
+ Row: {
617
+ archived: boolean | null
618
+ chat_id: string | null
619
+ chat_image: string | null
620
+ chat_type: string | null
621
+ group_metadata: Json | null
622
+ id: Json | null
623
+ invite_link: string | null
624
+ is_group: boolean | null
625
+ is_muted: boolean | null
626
+ is_read_only: boolean | null
627
+ label_ids: string[] | null
628
+ latest_message: Json | null
629
+ latest_message_timestamp: string | null
630
+ member_count: number | null
631
+ mute_expiration: number | null
632
+ name: string | null
633
+ org_id: string | null
634
+ org_participants: Json | null
635
+ org_phone: string | null
636
+ pinned: boolean | null
637
+ timestamp: string | null
638
+ unread_count: number | null
639
+ }
640
+ Relationships: []
641
+ }
642
+ }
643
+ Functions: {
644
+ gen_id: {
645
+ Args: {
646
+ prefix: string
647
+ size?: number
648
+ alphabet?: string
649
+ }
650
+ Returns: string
651
+ }
652
+ get_chats: {
653
+ Args: {
654
+ chat_id_input?: string[]
655
+ with_metadata?: boolean
656
+ }
657
+ Returns: Json
658
+ }
659
+ get_contacts: {
660
+ Args: {
661
+ filters?: Json
662
+ page_num?: number
663
+ contact_id_input?: string
664
+ }
665
+ Returns: Json
666
+ }
667
+ get_media: {
668
+ Args: {
669
+ filters?: Json
670
+ page_num?: number
671
+ }
672
+ Returns: Json
673
+ }
674
+ get_org: {
675
+ Args: {
676
+ org_id_input?: string
677
+ }
678
+ Returns: Json
679
+ }
680
+ list_org_from_user: {
681
+ Args: Record<PropertyKey, never>
682
+ Returns: string
683
+ }
684
+ }
685
+ Enums: {
686
+ enum_chat_colors:
687
+ | "#B4876E"
688
+ | "#A5B337"
689
+ | "#06CF9C"
690
+ | "#25D366"
691
+ | "#02A698"
692
+ | "#7D9EF1"
693
+ | "#007BFC"
694
+ | "#5E47DE"
695
+ | "#7F66FF"
696
+ | "#9333EA"
697
+ | "#FA6533"
698
+ | "#C4532D"
699
+ | "#DC2626"
700
+ | "#FF2E74"
701
+ | "#DB2777"
702
+ enum_member_role: "admin" | "member"
703
+ }
704
+ CompositeTypes: {
705
+ [_ in never]: never
706
+ }
707
+ }
708
+ storage: {
709
+ Tables: {
710
+ buckets: {
711
+ Row: {
712
+ allowed_mime_types: string[] | null
713
+ avif_autodetection: boolean | null
714
+ created_at: string | null
715
+ file_size_limit: number | null
716
+ id: string
717
+ name: string
718
+ owner: string | null
719
+ owner_id: string | null
720
+ public: boolean | null
721
+ updated_at: string | null
722
+ }
723
+ Insert: {
724
+ allowed_mime_types?: string[] | null
725
+ avif_autodetection?: boolean | null
726
+ created_at?: string | null
727
+ file_size_limit?: number | null
728
+ id: string
729
+ name: string
730
+ owner?: string | null
731
+ owner_id?: string | null
732
+ public?: boolean | null
733
+ updated_at?: string | null
734
+ }
735
+ Update: {
736
+ allowed_mime_types?: string[] | null
737
+ avif_autodetection?: boolean | null
738
+ created_at?: string | null
739
+ file_size_limit?: number | null
740
+ id?: string
741
+ name?: string
742
+ owner?: string | null
743
+ owner_id?: string | null
744
+ public?: boolean | null
745
+ updated_at?: string | null
746
+ }
747
+ Relationships: []
748
+ }
749
+ migrations: {
750
+ Row: {
751
+ executed_at: string | null
752
+ hash: string
753
+ id: number
754
+ name: string
755
+ }
756
+ Insert: {
757
+ executed_at?: string | null
758
+ hash: string
759
+ id: number
760
+ name: string
761
+ }
762
+ Update: {
763
+ executed_at?: string | null
764
+ hash?: string
765
+ id?: number
766
+ name?: string
767
+ }
768
+ Relationships: []
769
+ }
770
+ objects: {
771
+ Row: {
772
+ bucket_id: string | null
773
+ created_at: string | null
774
+ id: string
775
+ last_accessed_at: string | null
776
+ metadata: Json | null
777
+ name: string | null
778
+ owner: string | null
779
+ owner_id: string | null
780
+ path_tokens: string[] | null
781
+ updated_at: string | null
782
+ version: string | null
783
+ }
784
+ Insert: {
785
+ bucket_id?: string | null
786
+ created_at?: string | null
787
+ id?: string
788
+ last_accessed_at?: string | null
789
+ metadata?: Json | null
790
+ name?: string | null
791
+ owner?: string | null
792
+ owner_id?: string | null
793
+ path_tokens?: string[] | null
794
+ updated_at?: string | null
795
+ version?: string | null
796
+ }
797
+ Update: {
798
+ bucket_id?: string | null
799
+ created_at?: string | null
800
+ id?: string
801
+ last_accessed_at?: string | null
802
+ metadata?: Json | null
803
+ name?: string | null
804
+ owner?: string | null
805
+ owner_id?: string | null
806
+ path_tokens?: string[] | null
807
+ updated_at?: string | null
808
+ version?: string | null
809
+ }
810
+ Relationships: [
811
+ {
812
+ foreignKeyName: "objects_bucketId_fkey"
813
+ columns: ["bucket_id"]
814
+ isOneToOne: false
815
+ referencedRelation: "buckets"
816
+ referencedColumns: ["id"]
817
+ }
818
+ ]
819
+ }
820
+ }
821
+ Views: {
822
+ [_ in never]: never
823
+ }
824
+ Functions: {
825
+ can_insert_object: {
826
+ Args: {
827
+ bucketid: string
828
+ name: string
829
+ owner: string
830
+ metadata: Json
831
+ }
832
+ Returns: undefined
833
+ }
834
+ extension: {
835
+ Args: {
836
+ name: string
837
+ }
838
+ Returns: string
839
+ }
840
+ filename: {
841
+ Args: {
842
+ name: string
843
+ }
844
+ Returns: string
845
+ }
846
+ foldername: {
847
+ Args: {
848
+ name: string
849
+ }
850
+ Returns: unknown
851
+ }
852
+ get_size_by_bucket: {
853
+ Args: Record<PropertyKey, never>
854
+ Returns: {
855
+ size: number
856
+ bucket_id: string
857
+ }[]
858
+ }
859
+ search: {
860
+ Args: {
861
+ prefix: string
862
+ bucketname: string
863
+ limits?: number
864
+ levels?: number
865
+ offsets?: number
866
+ search?: string
867
+ sortcolumn?: string
868
+ sortorder?: string
869
+ }
870
+ Returns: {
871
+ name: string
872
+ id: string
873
+ updated_at: string
874
+ created_at: string
875
+ last_accessed_at: string
876
+ metadata: Json
877
+ }[]
878
+ }
879
+ }
880
+ Enums: {
881
+ [_ in never]: never
882
+ }
883
+ CompositeTypes: {
884
+ [_ in never]: never
885
+ }
886
+ }
887
+ }
888
+
889
+ export type Tables<
890
+ PublicTableNameOrOptions extends
891
+ | keyof (Database["public"]["Tables"] & Database["public"]["Views"])
892
+ | { schema: keyof Database },
893
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
894
+ ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
895
+ Database[PublicTableNameOrOptions["schema"]]["Views"])
896
+ : never = never
897
+ > = PublicTableNameOrOptions extends { schema: keyof Database }
898
+ ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
899
+ Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
900
+ Row: infer R
901
+ }
902
+ ? R
903
+ : never
904
+ : PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] &
905
+ Database["public"]["Views"])
906
+ ? (Database["public"]["Tables"] &
907
+ Database["public"]["Views"])[PublicTableNameOrOptions] extends {
908
+ Row: infer R
909
+ }
910
+ ? R
911
+ : never
912
+ : never
913
+
914
+ export type TablesInsert<
915
+ PublicTableNameOrOptions extends
916
+ | keyof Database["public"]["Tables"]
917
+ | { schema: keyof Database },
918
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
919
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
920
+ : never = never
921
+ > = PublicTableNameOrOptions extends { schema: keyof Database }
922
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
923
+ Insert: infer I
924
+ }
925
+ ? I
926
+ : never
927
+ : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
928
+ ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
929
+ Insert: infer I
930
+ }
931
+ ? I
932
+ : never
933
+ : never
934
+
935
+ export type TablesUpdate<
936
+ PublicTableNameOrOptions extends
937
+ | keyof Database["public"]["Tables"]
938
+ | { schema: keyof Database },
939
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
940
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
941
+ : never = never
942
+ > = PublicTableNameOrOptions extends { schema: keyof Database }
943
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
944
+ Update: infer U
945
+ }
946
+ ? U
947
+ : never
948
+ : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
949
+ ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
950
+ Update: infer U
951
+ }
952
+ ? U
953
+ : never
954
+ : never
955
+
956
+ export type Enums<
957
+ PublicEnumNameOrOptions extends
958
+ | keyof Database["public"]["Enums"]
959
+ | { schema: keyof Database },
960
+ EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
961
+ ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
962
+ : never = never
963
+ > = PublicEnumNameOrOptions extends { schema: keyof Database }
964
+ ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
965
+ : PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]
966
+ ? Database["public"]["Enums"][PublicEnumNameOrOptions]
967
+ : never
968
+
969
+
package/types.ts ADDED
@@ -0,0 +1,65 @@
1
+ import { Merge, OverrideProperties } from 'type-fest';
2
+ import { Chat, MessageTypes } from 'whatsapp-web.js';
3
+ import { Database as DatabaseGenerated, Tables } from './supabase.types';
4
+ export * from './supabase.types';
5
+
6
+ // Override the type for a specific column in a view:
7
+ export type Database = OverrideProperties<DatabaseGenerated, {}>;
8
+
9
+ /* ----------------------------- TYPE SHORTHANDS ---------------------------- */
10
+
11
+ /* ------------------------------ WHATSAPP ------------------------------ */
12
+
13
+ export type WhatsappChat = Chat & { groupMetadata?: any; pinned?: boolean };
14
+
15
+ /* ------------------------------ PERISKOPE TYPES ------------------------------ */
16
+
17
+ export type OrgType = Tables<'tbl_org'> & {
18
+ user: Tables<'tbl_org_members'>;
19
+ members: Tables<'tbl_org_members'>[];
20
+ phones: Tables<'tbl_org_phones'>[];
21
+ labels: Tables<'tbl_org_labels'>[];
22
+ };
23
+
24
+ export type ChatType = Merge<
25
+ Tables<'view_chats'>,
26
+ {
27
+ chat_id: string;
28
+ latest_message: MessageType | null;
29
+ members:
30
+ | (Tables<'tbl_chat_participants'> & Partial<Tables<'tbl_contacts'>>)[]
31
+ | null;
32
+ notifications: Tables<'tbl_chat_notifications'>[] | null;
33
+ chat_type: 'user' | 'group' | 'business';
34
+ active_phone?: boolean;
35
+ org_participants?: Tables<'tbl_chat_participants'>[];
36
+ }
37
+ >;
38
+
39
+ export type MessageType = OverrideProperties<
40
+ Tables<'view_chat_messages'>,
41
+ {
42
+ type: MessageTypes;
43
+ }
44
+ >;
45
+
46
+ export type ContactType = Merge<
47
+ Tables<'tbl_contacts'>,
48
+ { chats: ChatType[] | null; chat_count: number | null }
49
+ >;
50
+
51
+ export type ContactsFilterType = {
52
+ page: number;
53
+ total: number;
54
+ contacts: ContactType[];
55
+ };
56
+
57
+ /* -------------------------------- CONSTANTS ------------------------------- */
58
+
59
+ export const labelColors = [
60
+ '#9333EA',
61
+ '#0D9488',
62
+ '#DB2777',
63
+ '#2563EB',
64
+ '#F97316',
65
+ ];