@periskope/types 0.6.181 → 0.6.182
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 +162 -70
- package/dist/types.d.ts +40 -3
- package/mod_json_type.ps1 +108 -108
- package/mod_json_type.sh +22 -22
- package/package.json +1 -1
- package/supabase.types.ts +172 -70
- package/tsconfig.json +105 -105
- package/types.ts +59 -10
- package/update_package.ps1 +21 -21
- package/dist/supabase.columns.d.ts +0 -19
- package/dist/supabase.columns.js +0 -290
package/dist/supabase.types.d.ts
CHANGED
|
@@ -2,31 +2,6 @@ export type Json = {
|
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
} | any;
|
|
4
4
|
export type Database = {
|
|
5
|
-
graphql_public: {
|
|
6
|
-
Tables: {
|
|
7
|
-
[_ in never]: never;
|
|
8
|
-
};
|
|
9
|
-
Views: {
|
|
10
|
-
[_ in never]: never;
|
|
11
|
-
};
|
|
12
|
-
Functions: {
|
|
13
|
-
graphql: {
|
|
14
|
-
Args: {
|
|
15
|
-
operationName?: string;
|
|
16
|
-
query?: string;
|
|
17
|
-
variables?: Json;
|
|
18
|
-
extensions?: Json;
|
|
19
|
-
};
|
|
20
|
-
Returns: Json;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
Enums: {
|
|
24
|
-
[_ in never]: never;
|
|
25
|
-
};
|
|
26
|
-
CompositeTypes: {
|
|
27
|
-
[_ in never]: never;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
5
|
internal: {
|
|
31
6
|
Tables: {
|
|
32
7
|
config: {
|
|
@@ -704,6 +679,72 @@ export type Database = {
|
|
|
704
679
|
};
|
|
705
680
|
Relationships: [];
|
|
706
681
|
};
|
|
682
|
+
tbl_chat_notes: {
|
|
683
|
+
Row: {
|
|
684
|
+
ack: string | null;
|
|
685
|
+
body: string | null;
|
|
686
|
+
chat_id: string | null;
|
|
687
|
+
from_me: boolean | null;
|
|
688
|
+
is_private_note: boolean;
|
|
689
|
+
media: Json | null;
|
|
690
|
+
mentioned_ids: string[] | null;
|
|
691
|
+
message_id: string;
|
|
692
|
+
message_type: string | null;
|
|
693
|
+
org_id: string;
|
|
694
|
+
org_phone: string;
|
|
695
|
+
performed_by: string | null;
|
|
696
|
+
prev_body: string | null;
|
|
697
|
+
quoted_message_id: string | null;
|
|
698
|
+
sender_phone: string | null;
|
|
699
|
+
sent_message_id: string | null;
|
|
700
|
+
timestamp: string | null;
|
|
701
|
+
unique_id: string | null;
|
|
702
|
+
updated_at: string | null;
|
|
703
|
+
};
|
|
704
|
+
Insert: {
|
|
705
|
+
ack?: string | null;
|
|
706
|
+
body?: string | null;
|
|
707
|
+
chat_id?: string | null;
|
|
708
|
+
from_me?: boolean | null;
|
|
709
|
+
is_private_note?: boolean;
|
|
710
|
+
media?: Json | null;
|
|
711
|
+
mentioned_ids?: string[] | null;
|
|
712
|
+
message_id: string;
|
|
713
|
+
message_type?: string | null;
|
|
714
|
+
org_id: string;
|
|
715
|
+
org_phone: string;
|
|
716
|
+
performed_by?: string | null;
|
|
717
|
+
prev_body?: string | null;
|
|
718
|
+
quoted_message_id?: string | null;
|
|
719
|
+
sender_phone?: string | null;
|
|
720
|
+
sent_message_id?: string | null;
|
|
721
|
+
timestamp?: string | null;
|
|
722
|
+
unique_id?: string | null;
|
|
723
|
+
updated_at?: string | null;
|
|
724
|
+
};
|
|
725
|
+
Update: {
|
|
726
|
+
ack?: string | null;
|
|
727
|
+
body?: string | null;
|
|
728
|
+
chat_id?: string | null;
|
|
729
|
+
from_me?: boolean | null;
|
|
730
|
+
is_private_note?: boolean;
|
|
731
|
+
media?: Json | null;
|
|
732
|
+
mentioned_ids?: string[] | null;
|
|
733
|
+
message_id?: string;
|
|
734
|
+
message_type?: string | null;
|
|
735
|
+
org_id?: string;
|
|
736
|
+
org_phone?: string;
|
|
737
|
+
performed_by?: string | null;
|
|
738
|
+
prev_body?: string | null;
|
|
739
|
+
quoted_message_id?: string | null;
|
|
740
|
+
sender_phone?: string | null;
|
|
741
|
+
sent_message_id?: string | null;
|
|
742
|
+
timestamp?: string | null;
|
|
743
|
+
unique_id?: string | null;
|
|
744
|
+
updated_at?: string | null;
|
|
745
|
+
};
|
|
746
|
+
Relationships: [];
|
|
747
|
+
};
|
|
707
748
|
tbl_chat_notifications: {
|
|
708
749
|
Row: {
|
|
709
750
|
author: string | null;
|
|
@@ -1510,13 +1551,6 @@ export type Database = {
|
|
|
1510
1551
|
user_id?: string | null;
|
|
1511
1552
|
};
|
|
1512
1553
|
Relationships: [
|
|
1513
|
-
{
|
|
1514
|
-
foreignKeyName: "tbl_org_members_fkey_auth_users";
|
|
1515
|
-
columns: ["user_id"];
|
|
1516
|
-
isOneToOne: false;
|
|
1517
|
-
referencedRelation: "users";
|
|
1518
|
-
referencedColumns: ["id"];
|
|
1519
|
-
},
|
|
1520
1554
|
{
|
|
1521
1555
|
foreignKeyName: "tbl_org_members_fkey_tbl_org";
|
|
1522
1556
|
columns: ["org_id"];
|
|
@@ -1634,6 +1668,81 @@ export type Database = {
|
|
|
1634
1668
|
}
|
|
1635
1669
|
];
|
|
1636
1670
|
};
|
|
1671
|
+
tbl_org_tasks: {
|
|
1672
|
+
Row: {
|
|
1673
|
+
assignee: string | null;
|
|
1674
|
+
associated_object_metadata: Json | null;
|
|
1675
|
+
completed_metadata: Json | null;
|
|
1676
|
+
created_at: string;
|
|
1677
|
+
created_by: string;
|
|
1678
|
+
due_date: string | null;
|
|
1679
|
+
last_updated_at: string;
|
|
1680
|
+
last_updated_by: string;
|
|
1681
|
+
notes: string | null;
|
|
1682
|
+
org_id: string;
|
|
1683
|
+
priority: number;
|
|
1684
|
+
remind_at: string | null;
|
|
1685
|
+
reminder_setting: Json | null;
|
|
1686
|
+
status: string;
|
|
1687
|
+
task_id: string;
|
|
1688
|
+
title: string;
|
|
1689
|
+
type: string;
|
|
1690
|
+
};
|
|
1691
|
+
Insert: {
|
|
1692
|
+
assignee?: string | null;
|
|
1693
|
+
associated_object_metadata?: Json | null;
|
|
1694
|
+
completed_metadata?: Json | null;
|
|
1695
|
+
created_at?: string;
|
|
1696
|
+
created_by?: string;
|
|
1697
|
+
due_date?: string | null;
|
|
1698
|
+
last_updated_at?: string;
|
|
1699
|
+
last_updated_by: string;
|
|
1700
|
+
notes?: string | null;
|
|
1701
|
+
org_id: string;
|
|
1702
|
+
priority?: number;
|
|
1703
|
+
remind_at?: string | null;
|
|
1704
|
+
reminder_setting?: Json | null;
|
|
1705
|
+
status?: string;
|
|
1706
|
+
task_id?: string;
|
|
1707
|
+
title: string;
|
|
1708
|
+
type: string;
|
|
1709
|
+
};
|
|
1710
|
+
Update: {
|
|
1711
|
+
assignee?: string | null;
|
|
1712
|
+
associated_object_metadata?: Json | null;
|
|
1713
|
+
completed_metadata?: Json | null;
|
|
1714
|
+
created_at?: string;
|
|
1715
|
+
created_by?: string;
|
|
1716
|
+
due_date?: string | null;
|
|
1717
|
+
last_updated_at?: string;
|
|
1718
|
+
last_updated_by?: string;
|
|
1719
|
+
notes?: string | null;
|
|
1720
|
+
org_id?: string;
|
|
1721
|
+
priority?: number;
|
|
1722
|
+
remind_at?: string | null;
|
|
1723
|
+
reminder_setting?: Json | null;
|
|
1724
|
+
status?: string;
|
|
1725
|
+
task_id?: string;
|
|
1726
|
+
title?: string;
|
|
1727
|
+
type?: string;
|
|
1728
|
+
};
|
|
1729
|
+
Relationships: [
|
|
1730
|
+
{
|
|
1731
|
+
foreignKeyName: "tbl_org_task_org_id_fkey";
|
|
1732
|
+
columns: ["org_id"];
|
|
1733
|
+
isOneToOne: false;
|
|
1734
|
+
referencedRelation: "tbl_org";
|
|
1735
|
+
referencedColumns: ["org_id"];
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
foreignKeyName: "tbl_org_task_org_id_fkey";
|
|
1739
|
+
columns: ["org_id"];
|
|
1740
|
+
isOneToOne: false;
|
|
1741
|
+
referencedRelation: "view_org";
|
|
1742
|
+
referencedColumns: ["org_id"];
|
|
1743
|
+
}
|
|
1744
|
+
];
|
|
1745
|
+
};
|
|
1637
1746
|
tbl_org_transactions: {
|
|
1638
1747
|
Row: {
|
|
1639
1748
|
amount: number;
|
|
@@ -1964,30 +2073,6 @@ export type Database = {
|
|
|
1964
2073
|
}
|
|
1965
2074
|
];
|
|
1966
2075
|
};
|
|
1967
|
-
tbl_tools_whatsapp_links: {
|
|
1968
|
-
Row: {
|
|
1969
|
-
created_at: string;
|
|
1970
|
-
link_id: string;
|
|
1971
|
-
link_name: string;
|
|
1972
|
-
message: string | null;
|
|
1973
|
-
phone: string;
|
|
1974
|
-
};
|
|
1975
|
-
Insert: {
|
|
1976
|
-
created_at?: string;
|
|
1977
|
-
link_id?: string;
|
|
1978
|
-
link_name: string;
|
|
1979
|
-
message?: string | null;
|
|
1980
|
-
phone: string;
|
|
1981
|
-
};
|
|
1982
|
-
Update: {
|
|
1983
|
-
created_at?: string;
|
|
1984
|
-
link_id?: string;
|
|
1985
|
-
link_name?: string;
|
|
1986
|
-
message?: string | null;
|
|
1987
|
-
phone?: string;
|
|
1988
|
-
};
|
|
1989
|
-
Relationships: [];
|
|
1990
|
-
};
|
|
1991
2076
|
};
|
|
1992
2077
|
Views: {
|
|
1993
2078
|
view_broadcast_logs: {
|
|
@@ -2203,12 +2288,6 @@ export type Database = {
|
|
|
2203
2288
|
};
|
|
2204
2289
|
Returns: boolean;
|
|
2205
2290
|
};
|
|
2206
|
-
create_partition: {
|
|
2207
|
-
Args: {
|
|
2208
|
-
org_id_input: string;
|
|
2209
|
-
};
|
|
2210
|
-
Returns: boolean;
|
|
2211
|
-
};
|
|
2212
2291
|
custom_access_token_hook: {
|
|
2213
2292
|
Args: {
|
|
2214
2293
|
event: Json;
|
|
@@ -2421,14 +2500,6 @@ export type Database = {
|
|
|
2421
2500
|
result: Json;
|
|
2422
2501
|
}[];
|
|
2423
2502
|
};
|
|
2424
|
-
image_path: {
|
|
2425
|
-
Args: {
|
|
2426
|
-
path_input?: string;
|
|
2427
|
-
bucket_name?: string;
|
|
2428
|
-
req_base?: boolean;
|
|
2429
|
-
};
|
|
2430
|
-
Returns: string;
|
|
2431
|
-
};
|
|
2432
2503
|
list_org_from_user: {
|
|
2433
2504
|
Args: Record<PropertyKey, never>;
|
|
2434
2505
|
Returns: string[];
|
|
@@ -2437,6 +2508,10 @@ export type Database = {
|
|
|
2437
2508
|
Args: Record<PropertyKey, never>;
|
|
2438
2509
|
Returns: Database["public"]["Enums"]["enum_member_role"];
|
|
2439
2510
|
};
|
|
2511
|
+
notify_org_tasks: {
|
|
2512
|
+
Args: Record<PropertyKey, never>;
|
|
2513
|
+
Returns: string;
|
|
2514
|
+
};
|
|
2440
2515
|
update_chat_properties: {
|
|
2441
2516
|
Args: {
|
|
2442
2517
|
column_name: string;
|
|
@@ -2553,6 +2628,7 @@ export type Database = {
|
|
|
2553
2628
|
owner_id: string | null;
|
|
2554
2629
|
path_tokens: string[] | null;
|
|
2555
2630
|
updated_at: string | null;
|
|
2631
|
+
user_metadata: Json | null;
|
|
2556
2632
|
version: string | null;
|
|
2557
2633
|
};
|
|
2558
2634
|
Insert: {
|
|
@@ -2566,6 +2642,7 @@ export type Database = {
|
|
|
2566
2642
|
owner_id?: string | null;
|
|
2567
2643
|
path_tokens?: string[] | null;
|
|
2568
2644
|
updated_at?: string | null;
|
|
2645
|
+
user_metadata?: Json | null;
|
|
2569
2646
|
version?: string | null;
|
|
2570
2647
|
};
|
|
2571
2648
|
Update: {
|
|
@@ -2579,6 +2656,7 @@ export type Database = {
|
|
|
2579
2656
|
owner_id?: string | null;
|
|
2580
2657
|
path_tokens?: string[] | null;
|
|
2581
2658
|
updated_at?: string | null;
|
|
2659
|
+
user_metadata?: Json | null;
|
|
2582
2660
|
version?: string | null;
|
|
2583
2661
|
};
|
|
2584
2662
|
Relationships: [
|
|
@@ -2600,6 +2678,7 @@ export type Database = {
|
|
|
2600
2678
|
key: string;
|
|
2601
2679
|
owner_id: string | null;
|
|
2602
2680
|
upload_signature: string;
|
|
2681
|
+
user_metadata: Json | null;
|
|
2603
2682
|
version: string;
|
|
2604
2683
|
};
|
|
2605
2684
|
Insert: {
|
|
@@ -2610,6 +2689,7 @@ export type Database = {
|
|
|
2610
2689
|
key: string;
|
|
2611
2690
|
owner_id?: string | null;
|
|
2612
2691
|
upload_signature: string;
|
|
2692
|
+
user_metadata?: Json | null;
|
|
2613
2693
|
version: string;
|
|
2614
2694
|
};
|
|
2615
2695
|
Update: {
|
|
@@ -2620,6 +2700,7 @@ export type Database = {
|
|
|
2620
2700
|
key?: string;
|
|
2621
2701
|
owner_id?: string | null;
|
|
2622
2702
|
upload_signature?: string;
|
|
2703
|
+
user_metadata?: Json | null;
|
|
2623
2704
|
version?: string;
|
|
2624
2705
|
};
|
|
2625
2706
|
Relationships: [
|
|
@@ -2756,6 +2837,10 @@ export type Database = {
|
|
|
2756
2837
|
updated_at: string;
|
|
2757
2838
|
}[];
|
|
2758
2839
|
};
|
|
2840
|
+
operation: {
|
|
2841
|
+
Args: Record<PropertyKey, never>;
|
|
2842
|
+
Returns: string;
|
|
2843
|
+
};
|
|
2759
2844
|
search: {
|
|
2760
2845
|
Args: {
|
|
2761
2846
|
prefix: string;
|
|
@@ -2826,4 +2911,11 @@ export type Enums<PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] |
|
|
|
2826
2911
|
} ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] : never = never> = PublicEnumNameOrOptions extends {
|
|
2827
2912
|
schema: keyof Database;
|
|
2828
2913
|
} ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] ? PublicSchema["Enums"][PublicEnumNameOrOptions] : never;
|
|
2914
|
+
export type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof PublicSchema["CompositeTypes"] | {
|
|
2915
|
+
schema: keyof Database;
|
|
2916
|
+
}, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
|
|
2917
|
+
schema: keyof Database;
|
|
2918
|
+
} ? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] : never = never> = PublicCompositeTypeNameOrOptions extends {
|
|
2919
|
+
schema: keyof Database;
|
|
2920
|
+
} ? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof PublicSchema["CompositeTypes"] ? PublicSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] : never;
|
|
2829
2921
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { default as _Stripe } from 'stripe';
|
|
2
2
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
3
3
|
import { Filter, Rule } from './rules.types';
|
|
4
|
-
import { Tables, TablesUpdate } from './supabase.types';
|
|
4
|
+
import { Tables, TablesInsert, TablesUpdate } from './supabase.types';
|
|
5
5
|
export declare enum AllPlans {
|
|
6
6
|
FREE_TRIAL = "free-trial",
|
|
7
7
|
ENTERPRISE = "enterprise",
|
|
@@ -81,6 +81,7 @@ export type OrgMetadata = {
|
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
attribution?: Object;
|
|
84
|
+
affiliate_id?: string;
|
|
84
85
|
custom_properties?: {
|
|
85
86
|
chats_order?: {
|
|
86
87
|
[id: string]: number;
|
|
@@ -175,14 +176,14 @@ export type MediaType = {
|
|
|
175
176
|
filedata?: string;
|
|
176
177
|
compress?: boolean;
|
|
177
178
|
};
|
|
178
|
-
export type MessageType = Merge<OverrideProperties<
|
|
179
|
+
export type MessageType = Merge<OverrideProperties<TablesInsert<'tbl_chat_messages'>, {
|
|
179
180
|
message_id: string;
|
|
180
181
|
org_id: string;
|
|
181
182
|
org_phone: string;
|
|
182
183
|
chat_id: string;
|
|
183
184
|
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
184
185
|
media: MediaType | null;
|
|
185
|
-
flag_metadata
|
|
186
|
+
flag_metadata?: MessageFlagType | null;
|
|
186
187
|
poll_info?: PollSendType | null;
|
|
187
188
|
poll_results?: PollResultType | null;
|
|
188
189
|
delivery_info?: DeliveryInfoType | null;
|
|
@@ -190,6 +191,7 @@ export type MessageType = Merge<OverrideProperties<Tables<'tbl_chat_messages'>,
|
|
|
190
191
|
reactions?: ReactionType[];
|
|
191
192
|
message_payload?: SingleMessagePayload;
|
|
192
193
|
highlight?: number;
|
|
194
|
+
is_private_note?: boolean;
|
|
193
195
|
}>;
|
|
194
196
|
export type MessageFlagType = {
|
|
195
197
|
status: boolean;
|
|
@@ -577,4 +579,39 @@ export type RuleLogsType = OverrideProperties<Tables<'tbl_rules_logs'>, {
|
|
|
577
579
|
checked_at: string | null;
|
|
578
580
|
};
|
|
579
581
|
}>;
|
|
582
|
+
/************************** TASKS ***************************/
|
|
583
|
+
export type TaskType = OverrideProperties<Tables<'tbl_org_tasks'>, {
|
|
584
|
+
reminder_setting: {
|
|
585
|
+
remind_in: `${number} ${'minutes' | 'hours' | 'days'} ${'before' | 'after'}` | string | null;
|
|
586
|
+
repeat?: {
|
|
587
|
+
frequency: number;
|
|
588
|
+
interval: 'days' | 'weeks' | 'months' | 'years';
|
|
589
|
+
end: 'never' | 'after' | 'on';
|
|
590
|
+
on?: string;
|
|
591
|
+
};
|
|
592
|
+
} | null;
|
|
593
|
+
associated_object_metadata: {
|
|
594
|
+
type: 'chat';
|
|
595
|
+
index: 'chat_id';
|
|
596
|
+
id: string;
|
|
597
|
+
object: ChatType;
|
|
598
|
+
} | {
|
|
599
|
+
type: 'message';
|
|
600
|
+
index: 'message_id';
|
|
601
|
+
id: string;
|
|
602
|
+
object: MessageType;
|
|
603
|
+
} | {
|
|
604
|
+
type: 'ticket';
|
|
605
|
+
index: 'ticket_id';
|
|
606
|
+
id: string;
|
|
607
|
+
object: TicketType;
|
|
608
|
+
} | null;
|
|
609
|
+
status: 'open' | 'inprogress' | 'closed';
|
|
610
|
+
priority: 0 | 1 | 2 | 3 | 4;
|
|
611
|
+
completed_metadata?: {
|
|
612
|
+
completed_at: string;
|
|
613
|
+
completed_by: string;
|
|
614
|
+
} | null;
|
|
615
|
+
type: 'todo' | 'chat' | 'message' | 'ticket';
|
|
616
|
+
}>;
|
|
580
617
|
export {};
|
package/mod_json_type.ps1
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
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
|
-
# Update interface to type
|
|
15
|
-
$oldText = 'export interface Database '
|
|
16
|
-
$newText = 'export type Database = '
|
|
17
|
-
|
|
18
|
-
$updatedContent = $updatedContent -replace $oldText, $newText
|
|
19
|
-
|
|
20
|
-
# # Append the new type definition if it doesn't exist
|
|
21
|
-
# $addContent = @"
|
|
22
|
-
# type PublicSchema = Database[Extract<keyof Database, "public">]
|
|
23
|
-
|
|
24
|
-
# export type Tables<
|
|
25
|
-
# PublicTableNameOrOptions extends
|
|
26
|
-
# | keyof (PublicSchema["Tables"] & PublicSchema["Views"])
|
|
27
|
-
# | { schema: keyof Database },
|
|
28
|
-
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
29
|
-
# ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
30
|
-
# Database[PublicTableNameOrOptions["schema"]]["Views"])
|
|
31
|
-
# : never = never,
|
|
32
|
-
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
33
|
-
# ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
34
|
-
# Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
|
|
35
|
-
# Row: infer R
|
|
36
|
-
# }
|
|
37
|
-
# ? R
|
|
38
|
-
# : never
|
|
39
|
-
# : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
|
|
40
|
-
# PublicSchema["Views"])
|
|
41
|
-
# ? (PublicSchema["Tables"] &
|
|
42
|
-
# PublicSchema["Views"])[PublicTableNameOrOptions] extends {
|
|
43
|
-
# Row: infer R
|
|
44
|
-
# }
|
|
45
|
-
# ? R
|
|
46
|
-
# : never
|
|
47
|
-
# : never
|
|
48
|
-
|
|
49
|
-
# export type TablesInsert<
|
|
50
|
-
# PublicTableNameOrOptions extends
|
|
51
|
-
# | keyof PublicSchema["Tables"]
|
|
52
|
-
# | { schema: keyof Database },
|
|
53
|
-
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
54
|
-
# ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
55
|
-
# : never = never,
|
|
56
|
-
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
57
|
-
# ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
58
|
-
# Insert: infer I
|
|
59
|
-
# }
|
|
60
|
-
# ? I
|
|
61
|
-
# : never
|
|
62
|
-
# : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
63
|
-
# ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
64
|
-
# Insert: infer I
|
|
65
|
-
# }
|
|
66
|
-
# ? I
|
|
67
|
-
# : never
|
|
68
|
-
# : never
|
|
69
|
-
|
|
70
|
-
# export type TablesUpdate<
|
|
71
|
-
# PublicTableNameOrOptions extends
|
|
72
|
-
# | keyof PublicSchema["Tables"]
|
|
73
|
-
# | { schema: keyof Database },
|
|
74
|
-
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
75
|
-
# ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
76
|
-
# : never = never,
|
|
77
|
-
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
78
|
-
# ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
79
|
-
# Update: infer U
|
|
80
|
-
# }
|
|
81
|
-
# ? U
|
|
82
|
-
# : never
|
|
83
|
-
# : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
84
|
-
# ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
85
|
-
# Update: infer U
|
|
86
|
-
# }
|
|
87
|
-
# ? U
|
|
88
|
-
# : never
|
|
89
|
-
# : never
|
|
90
|
-
|
|
91
|
-
# export type Enums<
|
|
92
|
-
# PublicEnumNameOrOptions extends
|
|
93
|
-
# | keyof PublicSchema["Enums"]
|
|
94
|
-
# | { schema: keyof Database },
|
|
95
|
-
# EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
96
|
-
# ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
|
|
97
|
-
# : never = never,
|
|
98
|
-
# > = PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
99
|
-
# ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
|
|
100
|
-
# : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
|
|
101
|
-
# ? PublicSchema["Enums"][PublicEnumNameOrOptions]
|
|
102
|
-
# : never
|
|
103
|
-
# "@
|
|
104
|
-
|
|
105
|
-
# # Append the new content to the updated content
|
|
106
|
-
# $updatedContent += $addContent
|
|
107
|
-
|
|
108
|
-
# Write the updated content back to the file
|
|
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
|
+
# Update interface to type
|
|
15
|
+
$oldText = 'export interface Database '
|
|
16
|
+
$newText = 'export type Database = '
|
|
17
|
+
|
|
18
|
+
$updatedContent = $updatedContent -replace $oldText, $newText
|
|
19
|
+
|
|
20
|
+
# # Append the new type definition if it doesn't exist
|
|
21
|
+
# $addContent = @"
|
|
22
|
+
# type PublicSchema = Database[Extract<keyof Database, "public">]
|
|
23
|
+
|
|
24
|
+
# export type Tables<
|
|
25
|
+
# PublicTableNameOrOptions extends
|
|
26
|
+
# | keyof (PublicSchema["Tables"] & PublicSchema["Views"])
|
|
27
|
+
# | { schema: keyof Database },
|
|
28
|
+
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
29
|
+
# ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
30
|
+
# Database[PublicTableNameOrOptions["schema"]]["Views"])
|
|
31
|
+
# : never = never,
|
|
32
|
+
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
33
|
+
# ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
34
|
+
# Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
|
|
35
|
+
# Row: infer R
|
|
36
|
+
# }
|
|
37
|
+
# ? R
|
|
38
|
+
# : never
|
|
39
|
+
# : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
|
|
40
|
+
# PublicSchema["Views"])
|
|
41
|
+
# ? (PublicSchema["Tables"] &
|
|
42
|
+
# PublicSchema["Views"])[PublicTableNameOrOptions] extends {
|
|
43
|
+
# Row: infer R
|
|
44
|
+
# }
|
|
45
|
+
# ? R
|
|
46
|
+
# : never
|
|
47
|
+
# : never
|
|
48
|
+
|
|
49
|
+
# export type TablesInsert<
|
|
50
|
+
# PublicTableNameOrOptions extends
|
|
51
|
+
# | keyof PublicSchema["Tables"]
|
|
52
|
+
# | { schema: keyof Database },
|
|
53
|
+
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
54
|
+
# ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
55
|
+
# : never = never,
|
|
56
|
+
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
57
|
+
# ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
58
|
+
# Insert: infer I
|
|
59
|
+
# }
|
|
60
|
+
# ? I
|
|
61
|
+
# : never
|
|
62
|
+
# : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
63
|
+
# ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
64
|
+
# Insert: infer I
|
|
65
|
+
# }
|
|
66
|
+
# ? I
|
|
67
|
+
# : never
|
|
68
|
+
# : never
|
|
69
|
+
|
|
70
|
+
# export type TablesUpdate<
|
|
71
|
+
# PublicTableNameOrOptions extends
|
|
72
|
+
# | keyof PublicSchema["Tables"]
|
|
73
|
+
# | { schema: keyof Database },
|
|
74
|
+
# TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
75
|
+
# ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
76
|
+
# : never = never,
|
|
77
|
+
# > = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
78
|
+
# ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
79
|
+
# Update: infer U
|
|
80
|
+
# }
|
|
81
|
+
# ? U
|
|
82
|
+
# : never
|
|
83
|
+
# : PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
84
|
+
# ? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
85
|
+
# Update: infer U
|
|
86
|
+
# }
|
|
87
|
+
# ? U
|
|
88
|
+
# : never
|
|
89
|
+
# : never
|
|
90
|
+
|
|
91
|
+
# export type Enums<
|
|
92
|
+
# PublicEnumNameOrOptions extends
|
|
93
|
+
# | keyof PublicSchema["Enums"]
|
|
94
|
+
# | { schema: keyof Database },
|
|
95
|
+
# EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
96
|
+
# ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
|
|
97
|
+
# : never = never,
|
|
98
|
+
# > = PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
99
|
+
# ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
|
|
100
|
+
# : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
|
|
101
|
+
# ? PublicSchema["Enums"][PublicEnumNameOrOptions]
|
|
102
|
+
# : never
|
|
103
|
+
# "@
|
|
104
|
+
|
|
105
|
+
# # Append the new content to the updated content
|
|
106
|
+
# $updatedContent += $addContent
|
|
107
|
+
|
|
108
|
+
# Write the updated content back to the file
|
|
109
109
|
$updatedContent | Set-Content $filePath
|
package/mod_json_type.sh
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Define the path to the TypeScript file
|
|
4
|
-
filePath="./supabase.types.ts"
|
|
5
|
-
|
|
6
|
-
# Read the content of the file as a single string
|
|
7
|
-
fileContent=$(cat "$filePath")
|
|
8
|
-
|
|
9
|
-
# Define the current and new type definitions using Perl-style regular expressions
|
|
10
|
-
oldTypeDefinition='export type Json =\s*\| string\s*\| number\s*\| boolean\s*\| null\s*\| \{ \[key: string\]: Json \| undefined \}\s*\| Json\[\]'
|
|
11
|
-
newTypeDefinition='export type Json = { [key: string]: any } | any'
|
|
12
|
-
|
|
13
|
-
# Replace the old type definition with the new one
|
|
14
|
-
updatedContent=$(echo "$fileContent" | perl -0777 -pe "s/$oldTypeDefinition/$newTypeDefinition/g")
|
|
15
|
-
|
|
16
|
-
# Update interface to type
|
|
17
|
-
oldText='export interface Database '
|
|
18
|
-
newText='export type Database = '
|
|
19
|
-
|
|
20
|
-
updatedContent=$(echo "$updatedContent" | sed "s/$oldText/$newText/g")
|
|
21
|
-
|
|
22
|
-
# Write the updated content back to the file
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Define the path to the TypeScript file
|
|
4
|
+
filePath="./supabase.types.ts"
|
|
5
|
+
|
|
6
|
+
# Read the content of the file as a single string
|
|
7
|
+
fileContent=$(cat "$filePath")
|
|
8
|
+
|
|
9
|
+
# Define the current and new type definitions using Perl-style regular expressions
|
|
10
|
+
oldTypeDefinition='export type Json =\s*\| string\s*\| number\s*\| boolean\s*\| null\s*\| \{ \[key: string\]: Json \| undefined \}\s*\| Json\[\]'
|
|
11
|
+
newTypeDefinition='export type Json = { [key: string]: any } | any'
|
|
12
|
+
|
|
13
|
+
# Replace the old type definition with the new one
|
|
14
|
+
updatedContent=$(echo "$fileContent" | perl -0777 -pe "s/$oldTypeDefinition/$newTypeDefinition/g")
|
|
15
|
+
|
|
16
|
+
# Update interface to type
|
|
17
|
+
oldText='export interface Database '
|
|
18
|
+
newText='export type Database = '
|
|
19
|
+
|
|
20
|
+
updatedContent=$(echo "$updatedContent" | sed "s/$oldText/$newText/g")
|
|
21
|
+
|
|
22
|
+
# Write the updated content back to the file
|
|
23
23
|
echo "$updatedContent" > "$filePath"
|