@periskope/types 0.6.53 → 0.6.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './supabase.columns';
2
1
  export * from './supabase.types';
3
2
  export * from './types';
package/dist/index.js CHANGED
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./supabase.columns"), exports);
18
17
  __exportStar(require("./supabase.types"), exports);
19
18
  __exportStar(require("./types"), exports);
@@ -2,7 +2,7 @@ export declare const TableColumns: {
2
2
  readonly tbl_broadcast_messages: readonly ["broadcast_id", "created_at", "chat_ids", "scheduled_at", "org_id", "message_payload", "completed_at", "performed_by"];
3
3
  readonly tbl_broadcast_templates: readonly ["template_id", "created_at", "template_name", "org_id", "updated_at", "message_payload"];
4
4
  readonly tbl_chat_access: readonly ["org_id", "email", "chat_id", "has_access", "last_read_timestamp", "active_phone"];
5
- readonly tbl_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "broadcast", "device_type", "duration", "forwarding_score", "from", "from_me", "has_media", "has_quoted_msg", "has_reaction", "id", "invite_v4", "is_ephemeral", "is_forwarded", "is_gif", "is_starred", "is_status", "links", "location", "media_key", "mentioned_ids", "order_id", "raw_data", "to", "token", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id"];
5
+ readonly tbl_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id", "is_gif", "is_forwarded", "is_starred"];
6
6
  readonly tbl_chat_notifications: readonly ["org_id", "notification_id", "chat_id", "author", "body", "id", "recipientids", "type", "timestamp", "org_phone"];
7
7
  readonly tbl_chat_participants: readonly ["org_id", "chat_id", "contact_id", "id", "is_admin", "is_super_admin", "org_phone"];
8
8
  readonly tbl_chat_reactions: readonly ["org_id", "message_id", "ack", "id", "orphan", "reaction", "read", "reaction_id", "timestamp", "msg_id", "orphan_reason", "sender_id", "org_phone"];
@@ -14,6 +14,5 @@ export declare const TableColumns: {
14
14
  readonly tbl_org_members: readonly ["created_at", "email", "user_id", "invited_at", "invited_by", "org_id", "role", "member_image", "member_name", "is_active", "member_color"];
15
15
  readonly tbl_org_phones: readonly ["org_id", "org_phone", "created_at", "updated_at", "wa_state", "phone_id", "qr_code", "phone_image", "phone_name", "server_ip"];
16
16
  readonly view_broadcast_logs: readonly ["broadcast_id", "org_id", "message_payload", "created_at", "total_chats", "sent_chats", "failed_chats", "total_member_count", "delivered_member_count", "read_member_count", "completed_at", "scheduled_at", "performed_by", "delivery_percentage", "read_percentage"];
17
- readonly view_chat_messages: readonly ["message_id", "org_id", "ack", "author", "body", "from_me", "invite_v4", "links", "location", "mentioned_ids", "message_type", "vcards", "chat_id", "timestamp", "org_phone", "broadcast_id", "is_deleted", "media", "performed_by", "prev_body", "quoted_message_id", "sender_phone", "sent_message_id", "delivery_info", "updated_at", "message_ticket_id", "unique_id", "is_gif", "is_forwarded", "is_starred"];
18
17
  readonly view_chats: readonly ["org_id", "chat_id", "org_phone", "chat_image", "invite_link", "label_ids", "updated_at", "chat_name", "latest_message", "member_count", "chat_type", "chat_access", "has_access", "last_read_timestamp", "chat_org_phones", "active_phone", "group_description"];
19
18
  };
@@ -237,7 +237,7 @@ exports.TableColumns = {
237
237
  "delivery_percentage",
238
238
  "read_percentage"
239
239
  ],
240
- "view_chat_messages": [
240
+ "tbl_chat_messages": [
241
241
  "message_id",
242
242
  "org_id",
243
243
  "ack",
@@ -165,7 +165,6 @@ export interface Database {
165
165
  is_gif: boolean | null;
166
166
  is_starred: boolean | null;
167
167
  is_status: boolean | null;
168
- is_supported_type: boolean | null;
169
168
  links: Json | null;
170
169
  location: Json | null;
171
170
  media: Json | null;
@@ -214,7 +213,6 @@ export interface Database {
214
213
  is_gif?: boolean | null;
215
214
  is_starred?: boolean | null;
216
215
  is_status?: boolean | null;
217
- is_supported_type?: boolean | null;
218
216
  links?: Json | null;
219
217
  location?: Json | null;
220
218
  media?: Json | null;
@@ -263,7 +261,6 @@ export interface Database {
263
261
  is_gif?: boolean | null;
264
262
  is_starred?: boolean | null;
265
263
  is_status?: boolean | null;
266
- is_supported_type?: boolean | null;
267
264
  links?: Json | null;
268
265
  location?: Json | null;
269
266
  media?: Json | null;
@@ -482,7 +479,7 @@ export interface Database {
482
479
  is_deleted?: boolean;
483
480
  label_ids?: Json | null;
484
481
  last_updated_at?: string;
485
- org_id: string;
482
+ org_id?: string;
486
483
  priority?: number | null;
487
484
  quoted_message_id: string;
488
485
  raised_by?: string | null;
@@ -904,49 +901,6 @@ export interface Database {
904
901
  }
905
902
  ];
906
903
  };
907
- view_chat_messages: {
908
- Row: {
909
- ack: string | null;
910
- author: string | null;
911
- body: string | null;
912
- broadcast_id: string | null;
913
- chat_id: string | null;
914
- delivery_info: Json | null;
915
- from_me: boolean | null;
916
- invite_v4: Json | null;
917
- is_deleted: boolean | null;
918
- is_forwarded: boolean | null;
919
- is_gif: boolean | null;
920
- is_starred: boolean | null;
921
- links: Json | null;
922
- location: Json | null;
923
- media: Json | null;
924
- mentioned_ids: string[] | null;
925
- message_id: string | null;
926
- message_ticket_id: string | null;
927
- message_type: string | null;
928
- org_id: string | null;
929
- org_phone: string | null;
930
- performed_by: string | null;
931
- prev_body: string | null;
932
- quoted_message_id: string | null;
933
- sender_phone: string | null;
934
- sent_message_id: string | null;
935
- timestamp: string | null;
936
- unique_id: string | null;
937
- updated_at: string | null;
938
- vcards: string[] | null;
939
- };
940
- Relationships: [
941
- {
942
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones";
943
- columns: ["org_phone", "org_id"];
944
- isOneToOne: false;
945
- referencedRelation: "tbl_org_phones";
946
- referencedColumns: ["org_phone", "org_id"];
947
- }
948
- ];
949
- };
950
904
  view_chats: {
951
905
  Row: {
952
906
  active_phone: string | null;
package/dist/types.d.ts CHANGED
@@ -66,8 +66,9 @@ export type MediaType = {
66
66
  ar: number;
67
67
  };
68
68
  size?: number;
69
+ thumbnail?: string;
69
70
  };
70
- export type MessageType = OverrideProperties<Tables<'view_chat_messages'>, {
71
+ export type MessageType = OverrideProperties<Tables<'tbl_chat_messages'>, {
71
72
  message_id: string;
72
73
  org_id: string;
73
74
  org_phone: string;
package/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './supabase.columns';
2
1
  export * from './supabase.types';
3
2
  export * from './types';
4
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.53",
3
+ "version": "0.6.58",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,6 +13,6 @@
13
13
  "whatsapp-web.js": "1.23.1-alpha.4"
14
14
  },
15
15
  "scripts": {
16
- "update-package": "node scripts/extractColumnNames.js \u0026\u0026 tsc \u0026\u0026 npm publish --access public"
16
+ "update-package": "tsc \u0026\u0026 npm publish --access public"
17
17
  }
18
18
  }
package/supabase.types.ts CHANGED
@@ -164,7 +164,6 @@ export interface Database {
164
164
  is_gif: boolean | null
165
165
  is_starred: boolean | null
166
166
  is_status: boolean | null
167
- is_supported_type: boolean | null
168
167
  links: Json | null
169
168
  location: Json | null
170
169
  media: Json | null
@@ -213,7 +212,6 @@ export interface Database {
213
212
  is_gif?: boolean | null
214
213
  is_starred?: boolean | null
215
214
  is_status?: boolean | null
216
- is_supported_type?: boolean | null
217
215
  links?: Json | null
218
216
  location?: Json | null
219
217
  media?: Json | null
@@ -262,7 +260,6 @@ export interface Database {
262
260
  is_gif?: boolean | null
263
261
  is_starred?: boolean | null
264
262
  is_status?: boolean | null
265
- is_supported_type?: boolean | null
266
263
  links?: Json | null
267
264
  location?: Json | null
268
265
  media?: Json | null
@@ -481,7 +478,7 @@ export interface Database {
481
478
  is_deleted?: boolean
482
479
  label_ids?: Json | null
483
480
  last_updated_at?: string
484
- org_id: string
481
+ org_id?: string
485
482
  priority?: number | null
486
483
  quoted_message_id: string
487
484
  raised_by?: string | null
@@ -907,49 +904,6 @@ export interface Database {
907
904
  }
908
905
  ]
909
906
  }
910
- view_chat_messages: {
911
- Row: {
912
- ack: string | null
913
- author: string | null
914
- body: string | null
915
- broadcast_id: string | null
916
- chat_id: string | null
917
- delivery_info: Json | null
918
- from_me: boolean | null
919
- invite_v4: Json | null
920
- is_deleted: boolean | null
921
- is_forwarded: boolean | null
922
- is_gif: boolean | null
923
- is_starred: boolean | null
924
- links: Json | null
925
- location: Json | null
926
- media: Json | null
927
- mentioned_ids: string[] | null
928
- message_id: string | null
929
- message_ticket_id: string | null
930
- message_type: string | null
931
- org_id: string | null
932
- org_phone: string | null
933
- performed_by: string | null
934
- prev_body: string | null
935
- quoted_message_id: string | null
936
- sender_phone: string | null
937
- sent_message_id: string | null
938
- timestamp: string | null
939
- unique_id: string | null
940
- updated_at: string | null
941
- vcards: string[] | null
942
- }
943
- Relationships: [
944
- {
945
- foreignKeyName: "tbl_chat_messages_fkey_tbl_org_phones"
946
- columns: ["org_phone", "org_id"]
947
- isOneToOne: false
948
- referencedRelation: "tbl_org_phones"
949
- referencedColumns: ["org_phone", "org_id"]
950
- }
951
- ]
952
- }
953
907
  view_chats: {
954
908
  Row: {
955
909
  active_phone: string | null
package/types.ts CHANGED
@@ -92,10 +92,11 @@ export type MediaType = {
92
92
  filename?: string;
93
93
  dimensions?: { width: number; height: number; ar: number };
94
94
  size?: number;
95
+ thumbnail?: string;
95
96
  };
96
97
 
97
98
  export type MessageType = OverrideProperties<
98
- Tables<'view_chat_messages'>,
99
+ Tables<'tbl_chat_messages'>,
99
100
  {
100
101
  message_id: string;
101
102
  org_id: string;
@@ -1,55 +0,0 @@
1
- const { Pool } = require('pg');
2
- const fs = require('fs');
3
-
4
- const SUPABASE_DB_URL =
5
- 'postgresql://postgres:postgres@localhost:54322/postgres';
6
- const pool = new Pool({
7
- connectionString: SUPABASE_DB_URL,
8
- });
9
- const outputFile = './supabase.columns.ts';
10
-
11
- async function fetchNonGeneratedColumns() {
12
- const query = `
13
- SELECT
14
- table_name,
15
- array_agg(column_name ORDER BY ordinal_position) AS non_generated_columns
16
- FROM
17
- information_schema.columns
18
- WHERE
19
- table_schema = 'public' -- Adjust this to your schema
20
- AND is_generated = 'NEVER'
21
- GROUP BY
22
- table_name;
23
- `;
24
-
25
- try {
26
- const res = await pool.query(query);
27
- return res.rows; // Each row will have `table_name` and `non_generated_columns`
28
- } catch (err) {
29
- console.error('Error fetching non-generated columns:', err);
30
- throw err;
31
- }
32
- }
33
-
34
- fetchNonGeneratedColumns().then((tables) => {
35
- const tableColumns = tables.reduce(
36
- (acc, { table_name, non_generated_columns }) => {
37
- const columns = non_generated_columns
38
- .slice(1, -1) // Remove the curly braces
39
- .split(',') // Split by comma to get individual column names
40
- .map((column) => column.trim()); // Trim any whitespace around column names
41
-
42
- acc[table_name] = columns;
43
- return acc;
44
- },
45
- {}
46
- );
47
-
48
- const tsContent = `export const TableColumns = ${JSON.stringify(
49
- tableColumns,
50
- null,
51
- 2
52
- )} as const;`;
53
-
54
- fs.writeFileSync(outputFile, tsContent, 'utf8'); // Write the TS content to file
55
- });
@@ -1,288 +0,0 @@
1
- export const TableColumns = {
2
- "tbl_broadcast_messages": [
3
- "broadcast_id",
4
- "created_at",
5
- "chat_ids",
6
- "scheduled_at",
7
- "org_id",
8
- "message_payload",
9
- "completed_at",
10
- "performed_by"
11
- ],
12
- "tbl_broadcast_templates": [
13
- "template_id",
14
- "created_at",
15
- "template_name",
16
- "org_id",
17
- "updated_at",
18
- "message_payload"
19
- ],
20
- "tbl_chat_access": [
21
- "org_id",
22
- "email",
23
- "chat_id",
24
- "has_access",
25
- "last_read_timestamp",
26
- "active_phone"
27
- ],
28
- "tbl_chat_messages": [
29
- "message_id",
30
- "org_id",
31
- "ack",
32
- "author",
33
- "body",
34
- "broadcast",
35
- "device_type",
36
- "duration",
37
- "forwarding_score",
38
- "from",
39
- "from_me",
40
- "has_media",
41
- "has_quoted_msg",
42
- "has_reaction",
43
- "id",
44
- "invite_v4",
45
- "is_ephemeral",
46
- "is_forwarded",
47
- "is_gif",
48
- "is_starred",
49
- "is_status",
50
- "links",
51
- "location",
52
- "media_key",
53
- "mentioned_ids",
54
- "order_id",
55
- "raw_data",
56
- "to",
57
- "token",
58
- "message_type",
59
- "vcards",
60
- "chat_id",
61
- "timestamp",
62
- "org_phone",
63
- "broadcast_id",
64
- "is_deleted",
65
- "media",
66
- "performed_by",
67
- "prev_body",
68
- "quoted_message_id",
69
- "sent_message_id",
70
- "delivery_info",
71
- "updated_at",
72
- "message_ticket_id"
73
- ],
74
- "tbl_chat_notifications": [
75
- "org_id",
76
- "notification_id",
77
- "chat_id",
78
- "author",
79
- "body",
80
- "id",
81
- "recipientids",
82
- "type",
83
- "timestamp",
84
- "org_phone"
85
- ],
86
- "tbl_chat_participants": [
87
- "org_id",
88
- "chat_id",
89
- "contact_id",
90
- "id",
91
- "is_admin",
92
- "is_super_admin",
93
- "org_phone"
94
- ],
95
- "tbl_chat_reactions": [
96
- "org_id",
97
- "message_id",
98
- "ack",
99
- "id",
100
- "orphan",
101
- "reaction",
102
- "read",
103
- "reaction_id",
104
- "timestamp",
105
- "msg_id",
106
- "orphan_reason",
107
- "sender_id",
108
- "org_phone"
109
- ],
110
- "tbl_chat_tickets": [
111
- "created_at",
112
- "ticket_id",
113
- "subject",
114
- "status",
115
- "assignee",
116
- "assigned_by",
117
- "chat_id",
118
- "due_date",
119
- "org_id",
120
- "label_ids",
121
- "quoted_message_id",
122
- "raised_by",
123
- "priority",
124
- "last_updated_at",
125
- "is_deleted"
126
- ],
127
- "tbl_chats": [
128
- "org_id",
129
- "chat_id",
130
- "archived",
131
- "id",
132
- "is_group",
133
- "is_muted",
134
- "is_read_only",
135
- "mute_expiration",
136
- "name",
137
- "pinned",
138
- "unread_count",
139
- "group_metadata",
140
- "chat_image",
141
- "timestamp",
142
- "invite_link",
143
- "org_phone",
144
- "label_ids",
145
- "updated_at",
146
- "latest_message",
147
- "member_count"
148
- ],
149
- "tbl_contacts": [
150
- "org_id",
151
- "contact_id",
152
- "id",
153
- "number",
154
- "is_business",
155
- "is_enterprise",
156
- "name",
157
- "pushname",
158
- "short_name",
159
- "contact_type",
160
- "is_me",
161
- "is_user",
162
- "is_group",
163
- "is_wa_contact",
164
- "is_my_contact",
165
- "is_blocked",
166
- "contact_image",
167
- "contact_color",
168
- "business_profile",
169
- "verified_name",
170
- "is_internal",
171
- "label_ids",
172
- "verified_level",
173
- "updated_at"
174
- ],
175
- "tbl_org": [
176
- "org_id",
177
- "created_at",
178
- "org_image",
179
- "org_name",
180
- "support_link",
181
- "org_metadata",
182
- "org_plan",
183
- "stripe_customer_details",
184
- "stripe_customer_id",
185
- "stripe_subscription_details"
186
- ],
187
- "tbl_org_labels": [
188
- "label_id",
189
- "created_at",
190
- "org_id",
191
- "name",
192
- "color",
193
- "type"
194
- ],
195
- "tbl_org_members": [
196
- "created_at",
197
- "email",
198
- "user_id",
199
- "invited_at",
200
- "invited_by",
201
- "org_id",
202
- "role",
203
- "member_image",
204
- "member_name",
205
- "is_active",
206
- "member_color"
207
- ],
208
- "tbl_org_phones": [
209
- "org_id",
210
- "org_phone",
211
- "created_at",
212
- "updated_at",
213
- "wa_state",
214
- "phone_id",
215
- "qr_code",
216
- "phone_image",
217
- "phone_name",
218
- "server_ip"
219
- ],
220
- "view_broadcast_logs": [
221
- "broadcast_id",
222
- "org_id",
223
- "message_payload",
224
- "created_at",
225
- "total_chats",
226
- "sent_chats",
227
- "failed_chats",
228
- "total_member_count",
229
- "delivered_member_count",
230
- "read_member_count",
231
- "completed_at",
232
- "scheduled_at",
233
- "performed_by",
234
- "delivery_percentage",
235
- "read_percentage"
236
- ],
237
- "view_chat_messages": [
238
- "message_id",
239
- "org_id",
240
- "ack",
241
- "author",
242
- "body",
243
- "from_me",
244
- "invite_v4",
245
- "links",
246
- "location",
247
- "mentioned_ids",
248
- "message_type",
249
- "vcards",
250
- "chat_id",
251
- "timestamp",
252
- "org_phone",
253
- "broadcast_id",
254
- "is_deleted",
255
- "media",
256
- "performed_by",
257
- "prev_body",
258
- "quoted_message_id",
259
- "sender_phone",
260
- "sent_message_id",
261
- "delivery_info",
262
- "updated_at",
263
- "message_ticket_id",
264
- "unique_id",
265
- "is_gif",
266
- "is_forwarded",
267
- "is_starred"
268
- ],
269
- "view_chats": [
270
- "org_id",
271
- "chat_id",
272
- "org_phone",
273
- "chat_image",
274
- "invite_link",
275
- "label_ids",
276
- "updated_at",
277
- "chat_name",
278
- "latest_message",
279
- "member_count",
280
- "chat_type",
281
- "chat_access",
282
- "has_access",
283
- "last_read_timestamp",
284
- "chat_org_phones",
285
- "active_phone",
286
- "group_description"
287
- ]
288
- } as const;