@periskope/types 0.6.270 → 0.6.272
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 +353 -430
- package/dist/supabase.types.d.ts.map +1 -1
- package/dist/supabase.types.js +58 -59
- package/dist/types.d.ts +0 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/workflows.types.d.ts +307 -0
- package/dist/workflows.types.d.ts.map +1 -0
- package/dist/workflows.types.js +256 -0
- package/mod_json_type.ps1 +108 -108
- package/mod_json_type.sh +22 -22
- package/package.json +19 -19
- package/src/index.ts +4 -4
- package/src/object.types.ts +100 -100
- package/src/rules.types.ts +2109 -2109
- package/src/supabase.types.ts +167 -194
- package/src/types.ts +1238 -1241
- package/tsconfig.json +18 -18
- package/tsconfig.tsbuildinfo +1 -0
- package/update_package.ps1 +21 -21
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triggers = void 0;
|
|
4
|
+
exports.isSplitPathAction = isSplitPathAction;
|
|
5
|
+
exports.isConditionLeaf = isConditionLeaf;
|
|
6
|
+
function isSplitPathAction(workflow_action) {
|
|
7
|
+
return workflow_action.action_metadata.type === 'split_path';
|
|
8
|
+
}
|
|
9
|
+
/***************************** CONDITIONS TYPES *****************************/
|
|
10
|
+
// {
|
|
11
|
+
// "operator": "AND",
|
|
12
|
+
// "conditions": [
|
|
13
|
+
// {
|
|
14
|
+
// "id": "cond1",
|
|
15
|
+
// "variable_name": "message",
|
|
16
|
+
// "variable_type": "string",
|
|
17
|
+
// "condition": "CONTAINS",
|
|
18
|
+
// "value": "urgent"
|
|
19
|
+
// },
|
|
20
|
+
// {
|
|
21
|
+
// "operator": "OR",
|
|
22
|
+
// "conditions": [
|
|
23
|
+
// {
|
|
24
|
+
// "id": "cond2",
|
|
25
|
+
// "variable_name": "priority",
|
|
26
|
+
// "variable_type": "number",
|
|
27
|
+
// "condition": "GT",
|
|
28
|
+
// "value": 2
|
|
29
|
+
// },
|
|
30
|
+
// {
|
|
31
|
+
// "id": "cond3",
|
|
32
|
+
// "variable_name": "assigned",
|
|
33
|
+
// "variable_type": "boolean",
|
|
34
|
+
// "condition": "NKNOWN"
|
|
35
|
+
// }
|
|
36
|
+
// ]
|
|
37
|
+
// }
|
|
38
|
+
// ]
|
|
39
|
+
// }
|
|
40
|
+
var Conditions;
|
|
41
|
+
(function (Conditions) {
|
|
42
|
+
// string
|
|
43
|
+
Conditions["CONTAINS"] = "contains";
|
|
44
|
+
Conditions["NCONTAINS"] = "not contains";
|
|
45
|
+
Conditions["EQUALS"] = "equals";
|
|
46
|
+
Conditions["NEQUALS"] = "not equals";
|
|
47
|
+
Conditions["STARTS_WITH"] = "starts with";
|
|
48
|
+
Conditions["ENDS_WITH"] = "ends with";
|
|
49
|
+
// number, date, time
|
|
50
|
+
Conditions["GREATER_THAN"] = "greater than";
|
|
51
|
+
Conditions["GREATER_THAN_OR_EQUAL"] = "greater than or equal";
|
|
52
|
+
Conditions["LESS_THAN"] = "less than";
|
|
53
|
+
Conditions["LESS_THAN_OR_EQUAL"] = "less than or equal";
|
|
54
|
+
// none
|
|
55
|
+
Conditions["IS_KNOWN"] = "is known";
|
|
56
|
+
Conditions["IS_UNKNOWN"] = "is unknown";
|
|
57
|
+
// boolean
|
|
58
|
+
Conditions["IS"] = "is";
|
|
59
|
+
Conditions["IS_NOT"] = "is not";
|
|
60
|
+
// array
|
|
61
|
+
Conditions["IS_ANY_OF"] = "is any of";
|
|
62
|
+
Conditions["IS_NOT_ANY_OF"] = "is not any of";
|
|
63
|
+
// day
|
|
64
|
+
Conditions["ON"] = "on";
|
|
65
|
+
})(Conditions || (Conditions = {}));
|
|
66
|
+
function isConditionLeaf(condition) {
|
|
67
|
+
return 'id' in condition && !('operator' in condition);
|
|
68
|
+
}
|
|
69
|
+
var Triggers;
|
|
70
|
+
(function (Triggers) {
|
|
71
|
+
Triggers["MESSAGE_CREATED"] = "message.created";
|
|
72
|
+
Triggers["MESSAGE_UPDATED"] = "message.updated";
|
|
73
|
+
Triggers["MESSAGE_DELETED"] = "message.deleted";
|
|
74
|
+
Triggers["MESSAGE_FLAGGED"] = "message.flagged";
|
|
75
|
+
Triggers["MESSAGE_UNFLAGGED"] = "message.unflagged";
|
|
76
|
+
Triggers["REACTION_ADDED"] = "reaction.added";
|
|
77
|
+
Triggers["TICKET_CREATED"] = "ticket.created";
|
|
78
|
+
Triggers["TICKET_UPDATED"] = "ticket.updated";
|
|
79
|
+
Triggers["TICKET_DELETED"] = "ticket.deleted";
|
|
80
|
+
Triggers["TICKET_CLOSED"] = "ticket.closed";
|
|
81
|
+
Triggers["TICKET_DUE"] = "ticket.due";
|
|
82
|
+
Triggers["CHAT_CREATED"] = "chat.created";
|
|
83
|
+
Triggers["CHAT_LABEL_UPDATED"] = "chat.label.updated";
|
|
84
|
+
Triggers["CHAT_CLOSED"] = "chat.closed";
|
|
85
|
+
Triggers["TASK_CREATED"] = "task.created";
|
|
86
|
+
Triggers["TASK_DUE"] = "task.due";
|
|
87
|
+
})(Triggers || (exports.Triggers = Triggers = {}));
|
|
88
|
+
// Example workflow type ->
|
|
89
|
+
// const demoWorkflow: WorkflowType = {
|
|
90
|
+
// id: 'workflow-1',
|
|
91
|
+
// name: 'Urgent Chat Auto-Responder',
|
|
92
|
+
// trigger: Triggers.MESSAGE_CREATED,
|
|
93
|
+
// trigger_metadata: {
|
|
94
|
+
// org_phones: ['phone-1'],
|
|
95
|
+
// allow_internal_messages: false,
|
|
96
|
+
// first_action_id: 'action-validate',
|
|
97
|
+
// },
|
|
98
|
+
// actions: [
|
|
99
|
+
// {
|
|
100
|
+
// id: 'action-validate',
|
|
101
|
+
// action_metadata: {
|
|
102
|
+
// type: 'validate_action',
|
|
103
|
+
// metadata: {
|
|
104
|
+
// operator: 'AND',
|
|
105
|
+
// conditions: [
|
|
106
|
+
// {
|
|
107
|
+
// id: 'cond-1',
|
|
108
|
+
// variable_name: 'message.text',
|
|
109
|
+
// variable_type: 'string',
|
|
110
|
+
// condition: 'CONTAINS',
|
|
111
|
+
// value: 'urgent',
|
|
112
|
+
// },
|
|
113
|
+
// {
|
|
114
|
+
// id: 'cond-2',
|
|
115
|
+
// variable_name: 'chat.assigned',
|
|
116
|
+
// variable_type: 'boolean',
|
|
117
|
+
// condition: 'IS',
|
|
118
|
+
// value: false,
|
|
119
|
+
// },
|
|
120
|
+
// ],
|
|
121
|
+
// },
|
|
122
|
+
// },
|
|
123
|
+
// next: 'action-add-label',
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// id: 'action-add-label',
|
|
127
|
+
// action_metadata: {
|
|
128
|
+
// type: 'add_chat_label',
|
|
129
|
+
// metadata: {
|
|
130
|
+
// labels: ['urgent'],
|
|
131
|
+
// },
|
|
132
|
+
// },
|
|
133
|
+
// next: 'action-assign-chat',
|
|
134
|
+
// },
|
|
135
|
+
// {
|
|
136
|
+
// id: 'action-assign-chat',
|
|
137
|
+
// action_metadata: {
|
|
138
|
+
// type: 'assign_chat',
|
|
139
|
+
// metadata: {
|
|
140
|
+
// assignee: {
|
|
141
|
+
// round_robin: true,
|
|
142
|
+
// emails: ['agent1@example.com', 'agent2@example.com'],
|
|
143
|
+
// assignee_check_for: 'all',
|
|
144
|
+
// },
|
|
145
|
+
// },
|
|
146
|
+
// },
|
|
147
|
+
// next: 'action-delay',
|
|
148
|
+
// },
|
|
149
|
+
// {
|
|
150
|
+
// id: 'action-delay',
|
|
151
|
+
// action_metadata: {
|
|
152
|
+
// type: 'delay',
|
|
153
|
+
// metadata: {
|
|
154
|
+
// delay: '5 minutes',
|
|
155
|
+
// },
|
|
156
|
+
// },
|
|
157
|
+
// next: 'action-send-message',
|
|
158
|
+
// },
|
|
159
|
+
// {
|
|
160
|
+
// id: 'action-send-message',
|
|
161
|
+
// action_metadata: {
|
|
162
|
+
// type: 'send_message_to_chat',
|
|
163
|
+
// metadata: {
|
|
164
|
+
// message: 'We’re on it!',
|
|
165
|
+
// chat_id: 'trigger_chat',
|
|
166
|
+
// },
|
|
167
|
+
// },
|
|
168
|
+
// next: 'action-split',
|
|
169
|
+
// },
|
|
170
|
+
// {
|
|
171
|
+
// id: 'action-split',
|
|
172
|
+
// action_metadata: {
|
|
173
|
+
// type: 'split_path',
|
|
174
|
+
// metadata: {
|
|
175
|
+
// paths: [
|
|
176
|
+
// {
|
|
177
|
+
// id: 'path-flagged',
|
|
178
|
+
// condition_action_id: 'action-condition-flagged',
|
|
179
|
+
// },
|
|
180
|
+
// {
|
|
181
|
+
// id: 'path-not-flagged',
|
|
182
|
+
// condition_action_id: 'action-condition-not-flagged',
|
|
183
|
+
// },
|
|
184
|
+
// ],
|
|
185
|
+
// },
|
|
186
|
+
// },
|
|
187
|
+
// {
|
|
188
|
+
// id: 'action-condition-flagged',
|
|
189
|
+
// action_metadata: {
|
|
190
|
+
// type: 'validate_action',
|
|
191
|
+
// metadata: {
|
|
192
|
+
// operator: 'AND',
|
|
193
|
+
// conditions: [
|
|
194
|
+
// {
|
|
195
|
+
// id: 'cond-flagged',
|
|
196
|
+
// variable_name: 'chat.has_flagged_messages',
|
|
197
|
+
// variable_type: 'boolean',
|
|
198
|
+
// condition: 'IS',
|
|
199
|
+
// value: true,
|
|
200
|
+
// },
|
|
201
|
+
// ],
|
|
202
|
+
// },
|
|
203
|
+
// },
|
|
204
|
+
// next: 'action-create-ticket',
|
|
205
|
+
// },
|
|
206
|
+
// {
|
|
207
|
+
// id: 'action-condition-not-flagged',
|
|
208
|
+
// action_metadata: {
|
|
209
|
+
// type: 'validate_action',
|
|
210
|
+
// metadata: {
|
|
211
|
+
// operator: 'AND',
|
|
212
|
+
// conditions: [
|
|
213
|
+
// {
|
|
214
|
+
// id: 'cond-unflagged',
|
|
215
|
+
// variable_name: 'chat.has_flagged_messages',
|
|
216
|
+
// variable_type: 'boolean',
|
|
217
|
+
// condition: 'IS',
|
|
218
|
+
// value: false,
|
|
219
|
+
// },
|
|
220
|
+
// ],
|
|
221
|
+
// },
|
|
222
|
+
// },
|
|
223
|
+
// next: 'action-send-slack',
|
|
224
|
+
// },
|
|
225
|
+
// {
|
|
226
|
+
// id: 'action-create-ticket',
|
|
227
|
+
// action_metadata: {
|
|
228
|
+
// type: 'create_ticket',
|
|
229
|
+
// metadata: {
|
|
230
|
+
// subject: 'Urgent Chat Follow-up',
|
|
231
|
+
// assignee: {
|
|
232
|
+
// email: 'manager@example.com',
|
|
233
|
+
// },
|
|
234
|
+
// priority: '4',
|
|
235
|
+
// status: 'open',
|
|
236
|
+
// labels: ['urgent', 'auto-created'],
|
|
237
|
+
// due_date: '30 minutes',
|
|
238
|
+
// },
|
|
239
|
+
// },
|
|
240
|
+
// next: '', // End
|
|
241
|
+
// },
|
|
242
|
+
// {
|
|
243
|
+
// id: 'action-send-slack',
|
|
244
|
+
// action_metadata: {
|
|
245
|
+
// type: 'send_slack_notification',
|
|
246
|
+
// metadata: {
|
|
247
|
+
// slack_payload: JSON.stringify({
|
|
248
|
+
// text: 'An urgent chat was received, no flagged messages.',
|
|
249
|
+
// }),
|
|
250
|
+
// url: 'https://hooks.slack.com/services/XXX/YYY/ZZZ',
|
|
251
|
+
// },
|
|
252
|
+
// },
|
|
253
|
+
// next: '', // End
|
|
254
|
+
// },
|
|
255
|
+
// ],
|
|
256
|
+
// };
|
package/mod_json_type.ps1
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
# Define the path to the TypeScript file
|
|
2
|
-
$filePath = ".\src\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 = ".\src\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="./src/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="./src/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"
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name":
|
|
3
|
-
"version":
|
|
4
|
-
"private":
|
|
5
|
-
"main":
|
|
6
|
-
"types":
|
|
7
|
-
"dependencies":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"scripts":
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@periskope/types",
|
|
3
|
+
"version": "0.6.272",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@types/pg": "8.11.2",
|
|
9
|
+
"pg": "^8.11.3",
|
|
10
|
+
"stripe": "17.6.0",
|
|
11
|
+
"ts-node": "^10.9.2",
|
|
12
|
+
"type-fest": "^4.8.3"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"update-package": "tsc && npm publish --access public"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './object.types';
|
|
2
|
-
export * from './rules.types';
|
|
3
|
-
export * from './supabase.types';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './object.types';
|
|
2
|
+
export * from './rules.types';
|
|
3
|
+
export * from './supabase.types';
|
|
4
|
+
export * from './types';
|