@periskope/types 0.6.8 → 0.6.9-2.2
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 +959 -85
- package/dist/types.d.ts +297 -18
- package/dist/types.js +42 -1
- package/mod_json_type.ps1 +95 -1
- package/package.json +16 -12
- package/supabase.types.ts +1910 -1006
- package/tsconfig.json +15 -18
- package/types.ts +416 -29
- package/update_package.ps1 +21 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,47 +1,326 @@
|
|
|
1
|
+
import { Chat, Location } from '@periskope/whatsapp-web.js';
|
|
2
|
+
import type { default as _Stripe } from 'stripe';
|
|
1
3
|
import { Merge, OverrideProperties } from 'type-fest';
|
|
2
|
-
import { Chat, MessageTypes } from 'whatsapp-web.js';
|
|
3
4
|
import { Tables } from './supabase.types';
|
|
4
5
|
export type WhatsappChat = Chat & {
|
|
5
6
|
groupMetadata?: any;
|
|
6
7
|
pinned?: boolean;
|
|
7
8
|
invite_link?: string;
|
|
8
9
|
};
|
|
9
|
-
export
|
|
10
|
+
export declare enum AllPlans {
|
|
11
|
+
FREE_TRIAL = "free-trial",
|
|
12
|
+
ENTERPRISE = "enterprise",
|
|
13
|
+
MONTHLY_STARTER_SINGLE = "monthly-starter-single",
|
|
14
|
+
YEARLY_STARTER_SINGLE = "yearly-starter-single",
|
|
15
|
+
MONTHLY_PRO_SINGLE = "monthly-pro-single",
|
|
16
|
+
YEARLY_PRO_SINGLE = "yearly-pro-single"
|
|
17
|
+
}
|
|
18
|
+
export type Frequency = 'yearly' | 'monthly' | 'weekly' | 'custom';
|
|
19
|
+
export type Enterprise = `${string}-enterprise`;
|
|
20
|
+
export type OrgPlanEnterprise = {
|
|
21
|
+
subscription_id: string;
|
|
22
|
+
plan_id: Enterprise;
|
|
23
|
+
interval: number;
|
|
24
|
+
frequency: Frequency;
|
|
25
|
+
user_limit: number;
|
|
26
|
+
phone_limit: number;
|
|
27
|
+
current_period_start: number;
|
|
28
|
+
current_period_end: number | null;
|
|
29
|
+
};
|
|
30
|
+
export type OrgPlanNonEnterprise = {
|
|
31
|
+
subscription_id: string;
|
|
32
|
+
plan_id: AllPlans;
|
|
33
|
+
interval: number;
|
|
34
|
+
frequency: Frequency;
|
|
35
|
+
user_limit: number;
|
|
36
|
+
phone_limit: number;
|
|
37
|
+
current_period_end: number;
|
|
38
|
+
current_period_start: number;
|
|
39
|
+
};
|
|
40
|
+
export type OrgPlan<T extends AllPlans | Enterprise> = T extends Enterprise ? OrgPlanEnterprise : T extends AllPlans ? OrgPlanNonEnterprise : never;
|
|
41
|
+
export type MicrosurveyData = {
|
|
42
|
+
key: string;
|
|
43
|
+
text: string;
|
|
44
|
+
checked: boolean;
|
|
45
|
+
}[];
|
|
46
|
+
export type OrgPreferences = {
|
|
47
|
+
disable_ai_flagging?: boolean;
|
|
48
|
+
allow_exports?: boolean;
|
|
49
|
+
sync_phone_contacts?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type OrgMetadata = {
|
|
52
|
+
phone_number: string;
|
|
53
|
+
ticket_prefix: string;
|
|
54
|
+
referralSource?: string;
|
|
55
|
+
surveyData?: MicrosurveyData;
|
|
56
|
+
onboarding: Record<string, boolean>;
|
|
57
|
+
onboarding_completed_at: Date | null;
|
|
58
|
+
preferences?: OrgPreferences;
|
|
59
|
+
hubspot_pipelines?: {
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
default_stage: {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
export type OrgType = OverrideProperties<Merge<Tables<'tbl_org'>, {
|
|
10
69
|
user: Tables<'tbl_org_members'>;
|
|
11
70
|
members: Tables<'tbl_org_members'>[];
|
|
12
71
|
phones: Tables<'tbl_org_phones'>[];
|
|
13
72
|
labels: Tables<'tbl_org_labels'>[];
|
|
14
|
-
|
|
73
|
+
quick_replies: Tables<'tbl_quick_replies'>[];
|
|
74
|
+
custom_properties: Tables<'tbl_custom_properties'>[];
|
|
75
|
+
subscription_status: 'active' | 'inactive' | 'unpaid';
|
|
76
|
+
is_enterprise: boolean;
|
|
77
|
+
is_free_trial: boolean;
|
|
78
|
+
is_hubspot_connected: boolean;
|
|
79
|
+
}>, {
|
|
80
|
+
org_plan: OrgPlan<AllPlans | Enterprise>;
|
|
81
|
+
stripe_customer_details: _Stripe.Customer | null;
|
|
82
|
+
stripe_subscription_details: Array<_Stripe.Subscription> | null;
|
|
83
|
+
stripe_customer_id: _Stripe.Customer['id'] | null;
|
|
84
|
+
org_metadata: OrgMetadata;
|
|
85
|
+
}>;
|
|
15
86
|
export type ChatMemberType = Merge<Tables<'tbl_chat_participants'>, Tables<'tbl_contacts'>>;
|
|
16
87
|
export type ChatType = Merge<Tables<'view_chats'>, {
|
|
17
88
|
chat_id: string;
|
|
18
89
|
latest_message: MessageType | null;
|
|
19
|
-
members:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
chat_access:
|
|
24
|
-
|
|
90
|
+
members: {
|
|
91
|
+
[key: string]: ChatMemberType;
|
|
92
|
+
} | null;
|
|
93
|
+
chat_type: 'user' | 'group' | 'business' | 'unknown';
|
|
94
|
+
chat_access: {
|
|
95
|
+
[key: string]: boolean;
|
|
96
|
+
};
|
|
97
|
+
label_ids: {
|
|
98
|
+
[key: string]: boolean;
|
|
99
|
+
};
|
|
100
|
+
chat_org_phones?: string[];
|
|
101
|
+
message_unread_count: number | null;
|
|
102
|
+
hubspot_metadata: {
|
|
103
|
+
id: string;
|
|
104
|
+
type: string;
|
|
105
|
+
hubId: string;
|
|
106
|
+
object_data: HubspotObjectDataType;
|
|
107
|
+
} | null;
|
|
25
108
|
}>;
|
|
26
109
|
export type MediaType = {
|
|
27
110
|
path: string;
|
|
28
|
-
mimetype
|
|
29
|
-
filename
|
|
111
|
+
mimetype?: string;
|
|
112
|
+
filename?: string;
|
|
113
|
+
dimensions?: {
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
ar: number;
|
|
117
|
+
};
|
|
118
|
+
size?: number;
|
|
119
|
+
thumbnail?: string;
|
|
30
120
|
};
|
|
31
121
|
export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
|
|
32
|
-
|
|
122
|
+
message_id: string;
|
|
123
|
+
org_id: string;
|
|
124
|
+
org_phone: string;
|
|
125
|
+
chat_id: string;
|
|
126
|
+
message_type: (typeof SUPPORTED_TYPES)[number];
|
|
33
127
|
media: MediaType | null;
|
|
128
|
+
flag_metadata: MessageFlagType | null;
|
|
129
|
+
}>;
|
|
130
|
+
export type MessageFlagType = {
|
|
131
|
+
status: boolean;
|
|
132
|
+
response_type?: 'message' | 'reaction' | 'ticket';
|
|
133
|
+
response_id?: string;
|
|
134
|
+
response_timestamp?: string;
|
|
135
|
+
response_email?: string;
|
|
136
|
+
};
|
|
137
|
+
export type TicketType = OverrideProperties<Tables<'tbl_chat_tickets'>, {
|
|
138
|
+
label_ids: {
|
|
139
|
+
[key: string]: boolean;
|
|
140
|
+
};
|
|
141
|
+
hubspot_metadata: {
|
|
142
|
+
id?: string;
|
|
143
|
+
type?: string;
|
|
144
|
+
hubId?: string;
|
|
145
|
+
pipeline: {
|
|
146
|
+
id: string;
|
|
147
|
+
label: string;
|
|
148
|
+
};
|
|
149
|
+
object_data?: HubspotObjectDataType;
|
|
150
|
+
} | null;
|
|
34
151
|
}>;
|
|
35
152
|
export type ContactType = Merge<Tables<'tbl_contacts'>, {
|
|
36
153
|
chats: ChatType[] | null;
|
|
37
|
-
|
|
38
|
-
chat_ids: string[] | null;
|
|
154
|
+
chat_ids?: string[];
|
|
39
155
|
}>;
|
|
156
|
+
export type ReactionType = Tables<'tbl_chat_reactions'>;
|
|
157
|
+
export type NotificationType = Tables<'tbl_chat_notifications'>;
|
|
40
158
|
export type ChatAccessType = Merge<Partial<Tables<'tbl_chat_access'>>, Tables<'tbl_org_members'>>;
|
|
41
|
-
export
|
|
159
|
+
export declare const labelColors: string[];
|
|
160
|
+
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
|
161
|
+
export declare const SUPPORTED_TYPES: readonly ["chat", "sticker", "image", "video", "document", "vcard", "multi_vcard", "audio", "ptt", "poll_creation", "location"];
|
|
162
|
+
export type SendMessageContent = {
|
|
163
|
+
message_type?: (typeof SUPPORTED_TYPES)[number];
|
|
164
|
+
body?: string;
|
|
165
|
+
media?: MediaType;
|
|
166
|
+
contact_ids?: string[];
|
|
167
|
+
location?: Location;
|
|
168
|
+
quoted_message_id?: string;
|
|
169
|
+
quoted_message_type?: 'reply' | 'forward' | 'reply_private';
|
|
170
|
+
broadcast_id?: string;
|
|
171
|
+
performed_by?: string;
|
|
172
|
+
variables?: {
|
|
173
|
+
[key: string]: VariableType;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export type QuickReplyContent = Omit<SendMessageContent, 'broadcast_id' | 'variables'>;
|
|
177
|
+
export type VariableType = {
|
|
178
|
+
[key: string]: string;
|
|
179
|
+
};
|
|
180
|
+
export type BroadcastMessagePayload = SendMessageContent & {
|
|
181
|
+
chat_ids: string[];
|
|
182
|
+
broadcast_id?: string;
|
|
183
|
+
};
|
|
184
|
+
export type SingleMessagePayload = SendMessageContent & {
|
|
185
|
+
chat_id: string;
|
|
186
|
+
job_id?: string;
|
|
187
|
+
};
|
|
188
|
+
export type MessageAttachmentFileTypes = 'image' | 'audio' | 'document' | 'video';
|
|
189
|
+
export type AttachmentTypeProps = {
|
|
190
|
+
result: string;
|
|
191
|
+
file: File | null;
|
|
192
|
+
type: MessageAttachmentFileTypes;
|
|
193
|
+
} | {
|
|
194
|
+
link: {
|
|
195
|
+
url: string;
|
|
196
|
+
type: MessageAttachmentFileTypes;
|
|
197
|
+
name: string;
|
|
198
|
+
mimetype?: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
export type BroadcastLogType = Tables<'view_broadcast_logs'> & {
|
|
202
|
+
logs: (Tables<'tbl_broadcast_logs'> & Partial<ChatType>)[];
|
|
203
|
+
} & {
|
|
204
|
+
chats: ChatType[];
|
|
205
|
+
};
|
|
206
|
+
export type ChatParticipantOperation = {
|
|
207
|
+
participant_ids: string[];
|
|
208
|
+
operation_type: 'ADD' | 'REMOVE' | 'PROMOTE' | 'DEMOTE';
|
|
209
|
+
};
|
|
210
|
+
export type ChatParticipantOperationPayload = ChatParticipantOperation & {
|
|
211
|
+
chat_ids: string[];
|
|
212
|
+
};
|
|
213
|
+
export type StripeSubscription = _Stripe.Subscription;
|
|
214
|
+
export type StripeCustomer = _Stripe.Customer;
|
|
215
|
+
export type StripeCoupon = _Stripe.Coupon;
|
|
216
|
+
export type StripePrice = _Stripe.Price;
|
|
217
|
+
export type Stripe = _Stripe;
|
|
218
|
+
export type StripeUpcomingInvoice = _Stripe.UpcomingInvoice;
|
|
219
|
+
export type StripeLineItem = _Stripe.Checkout.SessionCreateParams.LineItem;
|
|
220
|
+
export type PhoneStateType = {
|
|
42
221
|
loading: boolean;
|
|
222
|
+
state: string;
|
|
223
|
+
sync: number;
|
|
43
224
|
percent: number | null;
|
|
44
|
-
|
|
225
|
+
message?: string;
|
|
226
|
+
error?: string;
|
|
227
|
+
};
|
|
228
|
+
export type ChatInfoType = Merge<ChatType, {
|
|
229
|
+
members: {
|
|
230
|
+
[key: string]: Merge<ChatMemberType, {
|
|
231
|
+
contact_labels: string;
|
|
232
|
+
}>;
|
|
233
|
+
} | null;
|
|
234
|
+
chat_labels: string | null;
|
|
235
|
+
custom_properties: {
|
|
236
|
+
[key: string]: string;
|
|
237
|
+
} | null;
|
|
238
|
+
}>;
|
|
239
|
+
export type TicketInfoType = {
|
|
240
|
+
chat: ChatInfoType;
|
|
241
|
+
message: {
|
|
242
|
+
body: string;
|
|
243
|
+
chat_id: string;
|
|
244
|
+
org_phone: string;
|
|
245
|
+
timestamp: string;
|
|
246
|
+
media_path: string;
|
|
247
|
+
message_id: string;
|
|
248
|
+
sender_name: string;
|
|
249
|
+
performed_by: string;
|
|
250
|
+
sender_phone: string;
|
|
251
|
+
};
|
|
252
|
+
ticket: {
|
|
253
|
+
org_id: string;
|
|
254
|
+
status: string;
|
|
255
|
+
subject: string;
|
|
256
|
+
assignee: string;
|
|
257
|
+
due_date: string;
|
|
258
|
+
priority: 0 | 1 | 2 | 3 | 4;
|
|
259
|
+
raised_by: string;
|
|
260
|
+
ticket_id: string;
|
|
261
|
+
created_at: string;
|
|
262
|
+
assigned_by: string;
|
|
263
|
+
ticket_labels: string;
|
|
264
|
+
quoted_message_id: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
export declare enum IntegrationLogType {
|
|
268
|
+
NEW_CHAT = "chat.created",
|
|
269
|
+
NEW_MESSAGE = "message.created",
|
|
270
|
+
MESSAGE_UPDATED = "message.updated",
|
|
271
|
+
MESSAGE_DELETED = "message.deleted",
|
|
272
|
+
MESSAGE_ACK_UPDATED = "message.ack.updated",
|
|
273
|
+
REACTION_CREATED = "reaction.created",
|
|
274
|
+
REACTION_UPDATED = "reaction.updated",
|
|
275
|
+
NEW_TICKET = "ticket.created",
|
|
276
|
+
TICKET_UPDATED = "ticket.updated",
|
|
277
|
+
TICKET_DELETED = "ticket.deleted"
|
|
278
|
+
}
|
|
279
|
+
export type IntegrationLogMetadataType<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED ? TicketInfoType : T extends IntegrationLogType.NEW_CHAT ? Tables<'tbl_chats'> : T extends IntegrationLogType.NEW_MESSAGE | IntegrationLogType.MESSAGE_UPDATED | IntegrationLogType.MESSAGE_DELETED | IntegrationLogType.MESSAGE_ACK_UPDATED ? Tables<'tbl_chat_messages'> : T extends IntegrationLogType.REACTION_CREATED | IntegrationLogType.REACTION_UPDATED ? Tables<'tbl_chat_reactions'> : {
|
|
280
|
+
[key: string]: unknown;
|
|
281
|
+
};
|
|
282
|
+
export type IntegrationLogDetailsType<T extends IntegrationLogType> = OverrideProperties<Tables<'tbl_integration_logs'>, {
|
|
283
|
+
integration_name: T;
|
|
284
|
+
metadata: {
|
|
285
|
+
event: IntegrationLogMetadataType<T> & {
|
|
286
|
+
event_type: string;
|
|
287
|
+
org_id: string;
|
|
288
|
+
previous_attributes: {
|
|
289
|
+
[key: string]: unknown;
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
hook_id: string;
|
|
293
|
+
name: string;
|
|
294
|
+
};
|
|
295
|
+
}>;
|
|
296
|
+
export type APIAuthDetails = {
|
|
297
|
+
org_details: Tables<'view_org'> | null;
|
|
298
|
+
phone_details: Tables<'tbl_org_phones'> | null;
|
|
299
|
+
token_details: Tables<'tbl_integration_tokens'> | null;
|
|
300
|
+
};
|
|
301
|
+
export type WebhookDataType = OverrideProperties<Tables<'tbl_integration_hooks'>, {
|
|
302
|
+
integration_name: string[];
|
|
303
|
+
}>;
|
|
304
|
+
export type HubspotObjectDataType = {
|
|
305
|
+
createdAt: string;
|
|
306
|
+
archived: boolean;
|
|
307
|
+
id: string;
|
|
308
|
+
type: 'contacts' | 'tickets' | 'companies';
|
|
309
|
+
properties: Record<string, {
|
|
310
|
+
groupLabel: string;
|
|
311
|
+
groupName: string;
|
|
312
|
+
propertyKeyName: string;
|
|
313
|
+
propertyKey: string;
|
|
314
|
+
propertyInternalValue: string;
|
|
315
|
+
propertyValue: string;
|
|
316
|
+
propertyType: string;
|
|
317
|
+
propertyFieldType: string;
|
|
318
|
+
}[]>;
|
|
319
|
+
};
|
|
320
|
+
export type UserPreferences = {
|
|
321
|
+
theme: 'light' | 'dark';
|
|
322
|
+
language: 'en' | 'es';
|
|
323
|
+
left_sidebar_open: boolean;
|
|
324
|
+
right_sidepanel_open: boolean;
|
|
325
|
+
sync_wa_unread_count: boolean;
|
|
45
326
|
};
|
|
46
|
-
export declare const labelColors: string[];
|
|
47
|
-
export declare const enumChatColors: readonly ["#B4876E", "#A5B337", "#06CF9C", "#25D366", "#02A698", "#7D9EF1", "#007BFC", "#5E47DE", "#7F66FF", "#9333EA", "#FA6533", "#C4532D", "#DC2626", "#FF2E74", "#DB2777"];
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enumChatColors = exports.labelColors = void 0;
|
|
3
|
+
exports.IntegrationLogType = exports.SUPPORTED_TYPES = exports.enumChatColors = exports.labelColors = exports.AllPlans = void 0;
|
|
4
|
+
/* ------------------------------ PERISKOPE TYPES ------------------------------ */
|
|
5
|
+
var AllPlans;
|
|
6
|
+
(function (AllPlans) {
|
|
7
|
+
AllPlans["FREE_TRIAL"] = "free-trial";
|
|
8
|
+
// MONTHLY_STARTER = 'monthly-starter',
|
|
9
|
+
// YEARLY_STARTER = 'yearly-starter',
|
|
10
|
+
// MONTHLY_PRO = 'monthly-pro',
|
|
11
|
+
// YEARLY_PRO = 'yearly-pro',
|
|
12
|
+
AllPlans["ENTERPRISE"] = "enterprise";
|
|
13
|
+
AllPlans["MONTHLY_STARTER_SINGLE"] = "monthly-starter-single";
|
|
14
|
+
AllPlans["YEARLY_STARTER_SINGLE"] = "yearly-starter-single";
|
|
15
|
+
AllPlans["MONTHLY_PRO_SINGLE"] = "monthly-pro-single";
|
|
16
|
+
AllPlans["YEARLY_PRO_SINGLE"] = "yearly-pro-single";
|
|
17
|
+
})(AllPlans || (exports.AllPlans = AllPlans = {}));
|
|
4
18
|
/* -------------------------------- CONSTANTS ------------------------------- */
|
|
5
19
|
exports.labelColors = [
|
|
6
20
|
'#9333EA',
|
|
@@ -26,3 +40,30 @@ exports.enumChatColors = [
|
|
|
26
40
|
'#FF2E74',
|
|
27
41
|
'#DB2777',
|
|
28
42
|
];
|
|
43
|
+
/* -------------------------- SEND MESSAGE PAYLOAD -------------------------- */
|
|
44
|
+
exports.SUPPORTED_TYPES = [
|
|
45
|
+
'chat',
|
|
46
|
+
'sticker',
|
|
47
|
+
'image',
|
|
48
|
+
'video',
|
|
49
|
+
'document',
|
|
50
|
+
'vcard',
|
|
51
|
+
'multi_vcard',
|
|
52
|
+
'audio',
|
|
53
|
+
'ptt',
|
|
54
|
+
'poll_creation',
|
|
55
|
+
'location',
|
|
56
|
+
];
|
|
57
|
+
var IntegrationLogType;
|
|
58
|
+
(function (IntegrationLogType) {
|
|
59
|
+
IntegrationLogType["NEW_CHAT"] = "chat.created";
|
|
60
|
+
IntegrationLogType["NEW_MESSAGE"] = "message.created";
|
|
61
|
+
IntegrationLogType["MESSAGE_UPDATED"] = "message.updated";
|
|
62
|
+
IntegrationLogType["MESSAGE_DELETED"] = "message.deleted";
|
|
63
|
+
IntegrationLogType["MESSAGE_ACK_UPDATED"] = "message.ack.updated";
|
|
64
|
+
IntegrationLogType["REACTION_CREATED"] = "reaction.created";
|
|
65
|
+
IntegrationLogType["REACTION_UPDATED"] = "reaction.updated";
|
|
66
|
+
IntegrationLogType["NEW_TICKET"] = "ticket.created";
|
|
67
|
+
IntegrationLogType["TICKET_UPDATED"] = "ticket.updated";
|
|
68
|
+
IntegrationLogType["TICKET_DELETED"] = "ticket.deleted";
|
|
69
|
+
})(IntegrationLogType || (exports.IntegrationLogType = IntegrationLogType = {}));
|
package/mod_json_type.ps1
CHANGED
|
@@ -11,5 +11,99 @@ $newTypeDefinition = 'export type Json = { [key: string]: any } | any'
|
|
|
11
11
|
# Replace the old type definition with the new one
|
|
12
12
|
$updatedContent = $fileContent -replace $oldTypeDefinition, $newTypeDefinition
|
|
13
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
|
+
|
|
14
108
|
# Write the updated content back to the file
|
|
15
|
-
$updatedContent | Set-Content $filePath
|
|
109
|
+
$updatedContent | Set-Content $filePath
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
"name": "@periskope/types",
|
|
3
|
+
"version": "0.6.92.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@periskope/whatsapp-web.js": "1.23.1-alpha.exodus.8",
|
|
9
|
+
"@types/pg": "8.11.2",
|
|
10
|
+
"pg": "^8.11.3",
|
|
11
|
+
"stripe": "^14.19.0",
|
|
12
|
+
"ts-node": "^10.9.2",
|
|
13
|
+
"type-fest": "^4.8.3"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"update-package": "tsc \u0026\u0026 npm publish --access public"
|
|
17
|
+
}
|
|
14
18
|
}
|