rozenite-sqlite 0.0.9 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,210 @@
1
+ import type { RowData } from './theme';
2
+
3
+ export const MOCK_DBS = ['app.db', 'cache.db', 'analytics.db'];
4
+
5
+ export const MOCK_TABLES: Record<string, string[]> = {
6
+ 'app.db': ['users', 'products', 'orders'],
7
+ 'cache.db': ['sessions', 'tokens'],
8
+ 'analytics.db': ['events', 'pageviews'],
9
+ };
10
+
11
+ export const MOCK_ROWS: Record<string, RowData[]> = {
12
+ 'app.db|users': [
13
+ { id: 1, name: 'Alice Johnson', email: 'alice@example.com', role: 'admin', status: 'active', created_at: '2024-01-15 09:23:01' },
14
+ { id: 2, name: 'Bob Smith', email: 'bob@example.com', role: 'user', status: 'active', created_at: '2024-01-20 14:10:45' },
15
+ { id: 3, name: 'Carol White', email: 'carol@example.com', role: 'user', status: 'active', created_at: '2024-02-01 11:05:30' },
16
+ { id: 4, name: 'David Brown', email: 'david@example.com', role: 'moderator', status: 'active', created_at: '2024-02-08 16:45:12' },
17
+ { id: 5, name: 'Eva Martinez', email: 'eva@example.com', role: 'user', status: 'active', created_at: '2024-02-14 08:30:00' },
18
+ { id: 6, name: 'Frank Wilson', email: 'frank@example.com', role: 'user', status: 'inactive', created_at: '2024-02-18 12:00:00' },
19
+ { id: 7, name: 'Grace Lee', email: 'grace@example.com', role: 'user', status: 'active', created_at: '2024-02-20 09:15:00' },
20
+ { id: 8, name: 'Henry Taylor', email: 'henry@example.com', role: 'moderator', status: 'active', created_at: '2024-02-22 14:30:00' },
21
+ { id: 9, name: 'Iris Chen', email: 'iris@example.com', role: 'user', status: 'active', created_at: '2024-02-25 10:45:00' },
22
+ { id: 10, name: 'Jack Davis', email: 'jack@example.com', role: 'user', status: 'banned', created_at: '2024-02-28 16:00:00' },
23
+ { id: 11, name: 'Karen Miller', email: 'karen@example.com', role: 'user', status: 'active', created_at: '2024-03-01 08:00:00' },
24
+ { id: 12, name: 'Leo Thompson', email: 'leo@example.com', role: 'admin', status: 'active', created_at: '2024-03-03 09:30:00' },
25
+ { id: 13, name: 'Mia Anderson', email: 'mia@example.com', role: 'user', status: 'active', created_at: '2024-03-05 11:15:00' },
26
+ { id: 14, name: 'Noah Garcia', email: 'noah@example.com', role: 'user', status: 'inactive', created_at: '2024-03-07 13:00:00' },
27
+ { id: 15, name: 'Olivia Harris', email: 'olivia@example.com', role: 'user', status: 'active', created_at: '2024-03-09 15:45:00' },
28
+ { id: 16, name: 'Paul Jackson', email: 'paul@example.com', role: 'moderator', status: 'active', created_at: '2024-03-11 08:30:00' },
29
+ { id: 17, name: 'Quinn Lewis', email: 'quinn@example.com', role: 'user', status: 'active', created_at: '2024-03-13 10:00:00' },
30
+ { id: 18, name: 'Rachel Robinson', email: 'rachel@example.com', role: 'user', status: 'active', created_at: '2024-03-15 12:30:00' },
31
+ { id: 19, name: 'Sam Walker', email: 'sam@example.com', role: 'user', status: 'active', created_at: '2024-03-17 14:00:00' },
32
+ { id: 20, name: 'Tina Hall', email: 'tina@example.com', role: 'user', status: 'inactive', created_at: '2024-03-19 16:15:00' },
33
+ { id: 21, name: 'Uma Young', email: 'uma@example.com', role: 'user', status: 'active', created_at: '2024-03-21 09:00:00' },
34
+ { id: 22, name: 'Victor Allen', email: 'victor@example.com', role: 'user', status: 'active', created_at: '2024-03-23 11:45:00' },
35
+ { id: 23, name: 'Wendy Scott', email: 'wendy@example.com', role: 'moderator', status: 'active', created_at: '2024-03-25 13:30:00' },
36
+ { id: 24, name: 'Xander King', email: 'xander@example.com', role: 'user', status: 'banned', created_at: '2024-03-27 15:00:00' },
37
+ { id: 25, name: 'Yara Wright', email: 'yara@example.com', role: 'user', status: 'active', created_at: '2024-03-29 08:45:00' },
38
+ { id: 26, name: 'Zoe Adams', email: 'zoe@example.com', role: 'user', status: 'active', created_at: '2024-03-31 10:15:00' },
39
+ { id: 27, name: 'Aaron Baker', email: 'aaron@example.com', role: 'user', status: 'active', created_at: '2024-04-02 12:00:00' },
40
+ { id: 28, name: 'Bella Carter', email: 'bella@example.com', role: 'user', status: 'inactive', created_at: '2024-04-04 14:30:00' },
41
+ { id: 29, name: 'Carlos Diaz', email: 'carlos@example.com', role: 'user', status: 'active', created_at: '2024-04-06 09:15:00' },
42
+ { id: 30, name: 'Diana Evans', email: 'diana@example.com', role: 'admin', status: 'active', created_at: '2024-04-08 11:00:00' },
43
+ ],
44
+
45
+ 'app.db|products': [
46
+ { id: 1, name: 'Wireless Headphones', price: 79.99, category: 'Electronics', stock: 142, rating: 4.5, active: 1 },
47
+ { id: 2, name: 'Running Shoes', price: 129.50, category: 'Sport', stock: 58, rating: 4.3, active: 1 },
48
+ { id: 3, name: 'Coffee Maker', price: 49.00, category: 'Kitchen', stock: 0, rating: 3.8, active: 0 },
49
+ { id: 4, name: 'Laptop Stand', price: 34.99, category: 'Office', stock: 230, rating: 4.7, active: 1 },
50
+ { id: 5, name: 'Mechanical Keyboard', price: 89.00, category: 'Office', stock: 75, rating: 4.6, active: 1 },
51
+ { id: 6, name: 'USB-C Hub', price: 45.99, category: 'Electronics', stock: 310, rating: 4.2, active: 1 },
52
+ { id: 7, name: 'Yoga Mat', price: 28.00, category: 'Sport', stock: 190, rating: 4.4, active: 1 },
53
+ { id: 8, name: 'Blender Pro', price: 65.00, category: 'Kitchen', stock: 43, rating: 4.1, active: 1 },
54
+ { id: 9, name: 'Standing Desk', price: 349.00, category: 'Office', stock: 22, rating: 4.8, active: 1 },
55
+ { id: 10, name: 'Noise Cancel Earbuds', price: 59.99, category: 'Electronics', stock: 0, rating: 4.0, active: 0 },
56
+ { id: 11, name: 'Cycling Helmet', price: 74.50, category: 'Sport', stock: 88, rating: 4.3, active: 1 },
57
+ { id: 12, name: 'Air Fryer', price: 89.99, category: 'Kitchen', stock: 155, rating: 4.6, active: 1 },
58
+ { id: 13, name: 'Monitor Arm', price: 52.00, category: 'Office', stock: 67, rating: 4.5, active: 1 },
59
+ { id: 14, name: 'Smart Watch', price: 199.00, category: 'Electronics', stock: 34, rating: 4.2, active: 1 },
60
+ { id: 15, name: 'Resistance Bands', price: 18.99, category: 'Sport', stock: 400, rating: 4.7, active: 1 },
61
+ { id: 16, name: 'Electric Kettle', price: 39.99, category: 'Kitchen', stock: 210, rating: 4.4, active: 1 },
62
+ { id: 17, name: 'Webcam HD', price: 69.00, category: 'Electronics', stock: 98, rating: 4.1, active: 1 },
63
+ { id: 18, name: 'Foam Roller', price: 22.00, category: 'Sport', stock: 175, rating: 4.5, active: 1 },
64
+ { id: 19, name: 'Coffee Grinder', price: 44.00, category: 'Kitchen', stock: 0, rating: 4.3, active: 0 },
65
+ { id: 20, name: 'Cable Management Kit', price: 15.99, category: 'Office', stock: 520, rating: 4.6, active: 1 },
66
+ { id: 21, name: 'Portable Charger', price: 35.00, category: 'Electronics', stock: 265, rating: 4.4, active: 1 },
67
+ { id: 22, name: 'Water Bottle', price: 24.99, category: 'Sport', stock: 340, rating: 4.8, active: 1 },
68
+ { id: 23, name: 'Toaster Oven', price: 79.00, category: 'Kitchen', stock: 88, rating: 4.2, active: 1 },
69
+ { id: 24, name: 'Desk Organizer', price: 29.99, category: 'Office', stock: 145, rating: 4.3, active: 1 },
70
+ { id: 25, name: 'Bluetooth Speaker', price: 49.99, category: 'Electronics', stock: 182, rating: 4.5, active: 1 },
71
+ ],
72
+
73
+ 'app.db|orders': [
74
+ { id: 1, user_id: 2, product_id: 1, quantity: 1, total: 79.99, status: 'delivered', created_at: '2024-02-10' },
75
+ { id: 2, user_id: 3, product_id: 4, quantity: 2, total: 69.98, status: 'delivered', created_at: '2024-02-12' },
76
+ { id: 3, user_id: 1, product_id: 2, quantity: 1, total: 129.50, status: 'delivered', created_at: '2024-02-15' },
77
+ { id: 4, user_id: 5, product_id: 5, quantity: 1, total: 89.00, status: 'delivered', created_at: '2024-02-17' },
78
+ { id: 5, user_id: 7, product_id: 6, quantity: 2, total: 91.98, status: 'delivered', created_at: '2024-02-19' },
79
+ { id: 6, user_id: 9, product_id: 9, quantity: 1, total: 349.00, status: 'delivered', created_at: '2024-02-21' },
80
+ { id: 7, user_id: 11, product_id: 7, quantity: 3, total: 84.00, status: 'delivered', created_at: '2024-02-23' },
81
+ { id: 8, user_id: 13, product_id: 12, quantity: 1, total: 89.99, status: 'delivered', created_at: '2024-02-25' },
82
+ { id: 9, user_id: 2, product_id: 14, quantity: 1, total: 199.00, status: 'shipped', created_at: '2024-02-27' },
83
+ { id: 10, user_id: 15, product_id: 16, quantity: 2, total: 79.98, status: 'shipped', created_at: '2024-03-01' },
84
+ { id: 11, user_id: 17, product_id: 4, quantity: 1, total: 34.99, status: 'shipped', created_at: '2024-03-03' },
85
+ { id: 12, user_id: 19, product_id: 21, quantity: 1, total: 35.00, status: 'shipped', created_at: '2024-03-05' },
86
+ { id: 13, user_id: 21, product_id: 25, quantity: 2, total: 99.98, status: 'processing', created_at: '2024-03-07' },
87
+ { id: 14, user_id: 23, product_id: 13, quantity: 1, total: 52.00, status: 'processing', created_at: '2024-03-09' },
88
+ { id: 15, user_id: 25, product_id: 18, quantity: 4, total: 88.00, status: 'processing', created_at: '2024-03-11' },
89
+ { id: 16, user_id: 3, product_id: 22, quantity: 1, total: 24.99, status: 'processing', created_at: '2024-03-13' },
90
+ { id: 17, user_id: 5, product_id: 8, quantity: 1, total: 65.00, status: 'pending', created_at: '2024-03-15' },
91
+ { id: 18, user_id: 8, product_id: 17, quantity: 1, total: 69.00, status: 'pending', created_at: '2024-03-17' },
92
+ { id: 19, user_id: 12, product_id: 20, quantity: 5, total: 79.95, status: 'pending', created_at: '2024-03-19' },
93
+ { id: 20, user_id: 16, product_id: 23, quantity: 1, total: 79.00, status: 'pending', created_at: '2024-03-21' },
94
+ { id: 21, user_id: 18, product_id: 1, quantity: 2, total: 159.98, status: 'cancelled', created_at: '2024-03-23' },
95
+ { id: 22, user_id: 20, product_id: 5, quantity: 1, total: 89.00, status: 'cancelled', created_at: '2024-03-25' },
96
+ { id: 23, user_id: 22, product_id: 15, quantity: 3, total: 56.97, status: 'refunded', created_at: '2024-03-27' },
97
+ { id: 24, user_id: 24, product_id: 2, quantity: 1, total: 129.50, status: 'delivered', created_at: '2024-03-29' },
98
+ { id: 25, user_id: 26, product_id: 11, quantity: 1, total: 74.50, status: 'delivered', created_at: '2024-03-31' },
99
+ { id: 26, user_id: 28, product_id: 24, quantity: 2, total: 59.98, status: 'shipped', created_at: '2024-04-02' },
100
+ { id: 27, user_id: 30, product_id: 9, quantity: 1, total: 349.00, status: 'processing', created_at: '2024-04-04' },
101
+ { id: 28, user_id: 1, product_id: 6, quantity: 3, total: 137.97, status: 'pending', created_at: '2024-04-06' },
102
+ { id: 29, user_id: 4, product_id: 25, quantity: 1, total: 49.99, status: 'delivered', created_at: '2024-04-08' },
103
+ { id: 30, user_id: 6, product_id: 4, quantity: 2, total: 69.98, status: 'shipped', created_at: '2024-04-10' },
104
+ { id: 31, user_id: 10, product_id: 7, quantity: 1, total: 28.00, status: 'delivered', created_at: '2024-04-12' },
105
+ { id: 32, user_id: 14, product_id: 12, quantity: 2, total: 179.98, status: 'processing', created_at: '2024-04-14' },
106
+ { id: 33, user_id: 27, product_id: 16, quantity: 1, total: 39.99, status: 'pending', created_at: '2024-04-16' },
107
+ { id: 34, user_id: 29, product_id: 21, quantity: 2, total: 70.00, status: 'cancelled', created_at: '2024-04-18' },
108
+ { id: 35, user_id: 7, product_id: 14, quantity: 1, total: 199.00, status: 'delivered', created_at: '2024-04-20' },
109
+ ],
110
+
111
+ 'cache.db|sessions': [
112
+ { id: 'sess_a1b2c3', user_id: 1, expires_at: '2024-04-01 00:00:00', ip: '192.168.1.1', user_agent: 'Chrome/122', active: 1 },
113
+ { id: 'sess_d4e5f6', user_id: 2, expires_at: '2024-04-05 00:00:00', ip: '10.0.0.1', user_agent: 'Safari/17', active: 1 },
114
+ { id: 'sess_g7h8i9', user_id: 4, expires_at: '2024-03-20 00:00:00', ip: '172.16.0.5', user_agent: 'Firefox/123',active: 0 },
115
+ { id: 'sess_j1k2l3', user_id: 7, expires_at: '2024-04-10 00:00:00', ip: '10.0.0.42', user_agent: 'Chrome/122', active: 1 },
116
+ { id: 'sess_m4n5o6', user_id: 9, expires_at: '2024-04-08 00:00:00', ip: '192.168.2.20', user_agent: 'Edge/121', active: 1 },
117
+ { id: 'sess_p7q8r9', user_id: 12, expires_at: '2024-03-15 00:00:00', ip: '172.16.1.10', user_agent: 'Safari/17', active: 0 },
118
+ { id: 'sess_s1t2u3', user_id: 15, expires_at: '2024-04-12 00:00:00', ip: '10.0.1.5', user_agent: 'Chrome/122', active: 1 },
119
+ { id: 'sess_v4w5x6', user_id: 18, expires_at: '2024-04-14 00:00:00', ip: '192.168.0.55', user_agent: 'Firefox/123',active: 1 },
120
+ { id: 'sess_y7z8a9', user_id: 21, expires_at: '2024-03-28 00:00:00', ip: '10.0.2.30', user_agent: 'Chrome/122', active: 0 },
121
+ { id: 'sess_b1c2d3', user_id: 24, expires_at: '2024-04-18 00:00:00', ip: '172.16.2.8', user_agent: 'Safari/17', active: 1 },
122
+ { id: 'sess_e4f5g6', user_id: 3, expires_at: '2024-04-20 00:00:00', ip: '192.168.3.15', user_agent: 'Chrome/122', active: 1 },
123
+ { id: 'sess_h7i8j9', user_id: 5, expires_at: '2024-04-22 00:00:00', ip: '10.0.3.44', user_agent: 'Edge/122', active: 1 },
124
+ { id: 'sess_k1l2m3', user_id: 8, expires_at: '2024-03-10 00:00:00', ip: '172.16.3.22', user_agent: 'Firefox/123',active: 0 },
125
+ { id: 'sess_n4o5p6', user_id: 11, expires_at: '2024-04-25 00:00:00', ip: '192.168.4.9', user_agent: 'Chrome/123', active: 1 },
126
+ { id: 'sess_q7r8s9', user_id: 13, expires_at: '2024-04-27 00:00:00', ip: '10.0.4.67', user_agent: 'Safari/17', active: 1 },
127
+ ],
128
+
129
+ 'cache.db|tokens': [
130
+ { token: 'tok_aa1bb2', user_id: 1, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-01' },
131
+ { token: 'tok_cc3dd4', user_id: 1, type: 'refresh', expires_in: 86400, scope: 'read write', created_at: '2024-04-01' },
132
+ { token: 'tok_ee5ff6', user_id: 2, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-02' },
133
+ { token: 'tok_gg7hh8', user_id: 3, type: 'refresh', expires_in: 86400, scope: 'read write', created_at: '2024-04-02' },
134
+ { token: 'tok_ii9jj0', user_id: 4, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-03' },
135
+ { token: 'tok_kk1ll2', user_id: 5, type: 'access', expires_in: 3600, scope: 'read write', created_at: '2024-04-03' },
136
+ { token: 'tok_mm3nn4', user_id: 7, type: 'refresh', expires_in: 86400, scope: 'read', created_at: '2024-04-04' },
137
+ { token: 'tok_oo5pp6', user_id: 9, type: 'access', expires_in: 3600, scope: 'admin', created_at: '2024-04-04' },
138
+ { token: 'tok_qq7rr8', user_id: 12, type: 'refresh', expires_in: 86400, scope: 'read write', created_at: '2024-04-05' },
139
+ { token: 'tok_ss9tt0', user_id: 15, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-05' },
140
+ { token: 'tok_uu1vv2', user_id: 18, type: 'refresh', expires_in: 86400, scope: 'read write', created_at: '2024-04-06' },
141
+ { token: 'tok_ww3xx4', user_id: 21, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-06' },
142
+ { token: 'tok_yy5zz6', user_id: 24, type: 'refresh', expires_in: 86400, scope: 'read write', created_at: '2024-04-07' },
143
+ { token: 'tok_ab1cd2', user_id: 27, type: 'access', expires_in: 3600, scope: 'read', created_at: '2024-04-07' },
144
+ { token: 'tok_ef3gh4', user_id: 30, type: 'refresh', expires_in: 86400, scope: 'admin', created_at: '2024-04-08' },
145
+ ],
146
+
147
+ 'analytics.db|events': [
148
+ { id: 1, event: 'page_view', user_id: 1, session: 'sess_a1b2c3', page: '/home', referrer: 'google.com', ts: '2024-04-01 08:00:00' },
149
+ { id: 2, event: 'click', user_id: 1, session: 'sess_a1b2c3', page: '/home', referrer: null, ts: '2024-04-01 08:01:15' },
150
+ { id: 3, event: 'page_view', user_id: 2, session: 'sess_d4e5f6', page: '/products', referrer: 'bing.com', ts: '2024-04-01 08:05:23' },
151
+ { id: 4, event: 'search', user_id: 2, session: 'sess_d4e5f6', page: '/products', referrer: null, ts: '2024-04-01 08:06:45' },
152
+ { id: 5, event: 'page_view', user_id: 3, session: 'sess_e4f5g6', page: '/about', referrer: 'twitter.com', ts: '2024-04-01 08:10:00' },
153
+ { id: 6, event: 'purchase', user_id: 3, session: 'sess_e4f5g6', page: '/checkout', referrer: null, ts: '2024-04-01 08:12:45' },
154
+ { id: 7, event: 'page_view', user_id: 4, session: 'sess_j1k2l3', page: '/contact', referrer: 'facebook.com', ts: '2024-04-01 08:18:00' },
155
+ { id: 8, event: 'click', user_id: 5, session: 'sess_h7i8j9', page: '/home', referrer: 'google.com', ts: '2024-04-01 08:22:30' },
156
+ { id: 9, event: 'page_view', user_id: 5, session: 'sess_h7i8j9', page: '/products', referrer: null, ts: '2024-04-01 08:23:11' },
157
+ { id: 10, event: 'add_cart', user_id: 5, session: 'sess_h7i8j9', page: '/products', referrer: null, ts: '2024-04-01 08:24:05' },
158
+ { id: 11, event: 'page_view', user_id: 7, session: 'sess_j1k2l3', page: '/home', referrer: 'google.com', ts: '2024-04-01 09:00:00' },
159
+ { id: 12, event: 'purchase', user_id: 7, session: 'sess_j1k2l3', page: '/checkout', referrer: null, ts: '2024-04-01 09:05:30' },
160
+ { id: 13, event: 'page_view', user_id: 8, session: 'sess_k1l2m3', page: '/blog', referrer: 'reddit.com', ts: '2024-04-01 09:15:00' },
161
+ { id: 14, event: 'click', user_id: 9, session: 'sess_m4n5o6', page: '/products', referrer: null, ts: '2024-04-01 09:22:40' },
162
+ { id: 15, event: 'page_view', user_id: 10, session: 'sess_b1c2d3', page: '/home', referrer: 'google.com', ts: '2024-04-01 09:30:00' },
163
+ { id: 16, event: 'search', user_id: 10, session: 'sess_b1c2d3', page: '/products', referrer: null, ts: '2024-04-01 09:31:15' },
164
+ { id: 17, event: 'add_cart', user_id: 10, session: 'sess_b1c2d3', page: '/products', referrer: null, ts: '2024-04-01 09:32:45' },
165
+ { id: 18, event: 'purchase', user_id: 10, session: 'sess_b1c2d3', page: '/checkout', referrer: null, ts: '2024-04-01 09:35:00' },
166
+ { id: 19, event: 'page_view', user_id: 11, session: 'sess_n4o5p6', page: '/about', referrer: 'linkedin.com', ts: '2024-04-01 10:00:00' },
167
+ { id: 20, event: 'click', user_id: 12, session: 'sess_p7q8r9', page: '/home', referrer: 'google.com', ts: '2024-04-01 10:08:30' },
168
+ { id: 21, event: 'page_view', user_id: 13, session: 'sess_q7r8s9', page: '/products', referrer: 'bing.com', ts: '2024-04-01 10:15:00' },
169
+ { id: 22, event: 'page_view', user_id: 14, session: 'sess_v4w5x6', page: '/contact', referrer: null, ts: '2024-04-01 10:22:10' },
170
+ { id: 23, event: 'search', user_id: 15, session: 'sess_s1t2u3', page: '/products', referrer: 'google.com', ts: '2024-04-01 10:30:00' },
171
+ { id: 24, event: 'page_view', user_id: 16, session: 'sess_b1c2d3', page: '/home', referrer: 'twitter.com', ts: '2024-04-01 10:45:00' },
172
+ { id: 25, event: 'add_cart', user_id: 16, session: 'sess_b1c2d3', page: '/products', referrer: null, ts: '2024-04-01 10:46:30' },
173
+ { id: 26, event: 'page_view', user_id: 17, session: 'sess_v4w5x6', page: '/blog', referrer: 'google.com', ts: '2024-04-01 11:00:00' },
174
+ { id: 27, event: 'purchase', user_id: 18, session: 'sess_v4w5x6', page: '/checkout', referrer: null, ts: '2024-04-01 11:10:00' },
175
+ { id: 28, event: 'page_view', user_id: 19, session: 'sess_s1t2u3', page: '/home', referrer: 'facebook.com', ts: '2024-04-01 11:20:00' },
176
+ { id: 29, event: 'click', user_id: 20, session: 'sess_y7z8a9', page: '/products', referrer: null, ts: '2024-04-01 11:30:00' },
177
+ { id: 30, event: 'page_view', user_id: 21, session: 'sess_y7z8a9', page: '/home', referrer: 'google.com', ts: '2024-04-01 11:45:00' },
178
+ { id: 31, event: 'page_view', user_id: 22, session: 'sess_b1c2d3', page: '/about', referrer: 'instagram.com',ts: '2024-04-01 12:00:00' },
179
+ { id: 32, event: 'search', user_id: 23, session: 'sess_n4o5p6', page: '/products', referrer: null, ts: '2024-04-01 12:15:00' },
180
+ { id: 33, event: 'add_cart', user_id: 24, session: 'sess_b1c2d3', page: '/products', referrer: null, ts: '2024-04-01 12:20:00' },
181
+ { id: 34, event: 'purchase', user_id: 24, session: 'sess_b1c2d3', page: '/checkout', referrer: null, ts: '2024-04-01 12:22:00' },
182
+ { id: 35, event: 'page_view', user_id: 25, session: 'sess_d4e5f6', page: '/home', referrer: 'google.com', ts: '2024-04-01 12:30:00' },
183
+ { id: 36, event: 'click', user_id: 26, session: 'sess_e4f5g6', page: '/products', referrer: null, ts: '2024-04-01 12:45:00' },
184
+ { id: 37, event: 'page_view', user_id: 27, session: 'sess_h7i8j9', page: '/contact', referrer: 'bing.com', ts: '2024-04-01 13:00:00' },
185
+ { id: 38, event: 'purchase', user_id: 28, session: 'sess_m4n5o6', page: '/checkout', referrer: null, ts: '2024-04-01 13:10:00' },
186
+ { id: 39, event: 'page_view', user_id: 29, session: 'sess_q7r8s9', page: '/home', referrer: 'google.com', ts: '2024-04-01 13:20:00' },
187
+ { id: 40, event: 'search', user_id: 30, session: 'sess_s1t2u3', page: '/products', referrer: null, ts: '2024-04-01 13:30:00' },
188
+ ],
189
+
190
+ 'analytics.db|pageviews': [
191
+ { id: 1, path: '/home', views: 14230, unique_visitors: 8560, avg_duration: 142, bounce_rate: 42 },
192
+ { id: 2, path: '/products', views: 8920, unique_visitors: 6340, avg_duration: 215, bounce_rate: 31 },
193
+ { id: 3, path: '/about', views: 2340, unique_visitors: 1980, avg_duration: 88, bounce_rate: 65 },
194
+ { id: 4, path: '/contact', views: 1560, unique_visitors: 1340, avg_duration: 74, bounce_rate: 71 },
195
+ { id: 5, path: '/blog', views: 4520, unique_visitors: 3210, avg_duration: 310, bounce_rate: 28 },
196
+ { id: 6, path: '/checkout', views: 2180, unique_visitors: 1950, avg_duration: 185, bounce_rate: 18 },
197
+ { id: 7, path: '/login', views: 5640, unique_visitors: 4820, avg_duration: 55, bounce_rate: 12 },
198
+ { id: 8, path: '/register', views: 1890, unique_visitors: 1870, avg_duration: 120, bounce_rate: 22 },
199
+ { id: 9, path: '/profile', views: 3410, unique_visitors: 2100, avg_duration: 95, bounce_rate: 35 },
200
+ { id: 10, path: '/settings', views: 980, unique_visitors: 760, avg_duration: 130, bounce_rate: 30 },
201
+ { id: 11, path: '/faq', views: 1240, unique_visitors: 1100, avg_duration: 200, bounce_rate: 55 },
202
+ { id: 12, path: '/pricing', views: 3670, unique_visitors: 2890, avg_duration: 175, bounce_rate: 48 },
203
+ { id: 13, path: '/blog/post-1', views: 2100, unique_visitors: 1850, avg_duration: 420, bounce_rate: 20 },
204
+ { id: 14, path: '/blog/post-2', views: 1750, unique_visitors: 1600, avg_duration: 390, bounce_rate: 22 },
205
+ { id: 15, path: '/blog/post-3', views: 1320, unique_visitors: 1200, avg_duration: 360, bounce_rate: 25 },
206
+ { id: 16, path: '/terms', views: 430, unique_visitors: 410, avg_duration: 115, bounce_rate: 80 },
207
+ { id: 17, path: '/privacy', views: 510, unique_visitors: 490, avg_duration: 108, bounce_rate: 78 },
208
+ { id: 18, path: '/careers', views: 780, unique_visitors: 730, avg_duration: 160, bounce_rate: 60 },
209
+ ],
210
+ };
package/src/panel.tsx ADDED
@@ -0,0 +1,74 @@
1
+ import React, { useState } from 'react';
2
+ import { View, StyleSheet } from 'react-native';
3
+ import { C } from './theme';
4
+ import { useExplorerState } from './hooks/useExplorerState';
5
+ import { Toolbar } from './components/Toolbar';
6
+ import { SqlPanel } from './components/SqlPanel';
7
+ import { DataTable } from './components/DataTable';
8
+ import { RowDetailPanel } from './components/RowDetailPanel';
9
+
10
+ export default function SQLighterPanel() {
11
+ const { state, selectDB, selectTable, selectRow, closeRow, saveRow, deleteRow, refresh, clearTable, runCustomQuery, mutating, mutationError, clearMutationError, reconnect } = useExplorerState();
12
+ const { databases, selectedDB, tables, selectedTable, rows, columns, selectedRowIndex, status, error } = state;
13
+
14
+ const isLoadingTables = status === 'loadingTables';
15
+ const isLoadingData = status === 'loadingData';
16
+ const selectedRow = selectedRowIndex !== null ? rows[selectedRowIndex] ?? null : null;
17
+
18
+ const [sqlOpen, setSqlOpen] = useState(false);
19
+
20
+ return (
21
+ <View style={s.root}>
22
+ <Toolbar
23
+ databases={databases}
24
+ selectedDB={selectedDB}
25
+ tables={tables}
26
+ selectedTable={selectedTable}
27
+ loadingTables={isLoadingTables}
28
+ loadingData={isLoadingData}
29
+ rowCount={rows.length}
30
+ columnCount={columns.length}
31
+ onSelectDB={selectDB}
32
+ onSelectTable={selectTable}
33
+ onRefresh={refresh}
34
+ sqlOpen={sqlOpen}
35
+ onToggleSql={() => setSqlOpen((v) => !v)}
36
+ />
37
+
38
+ {sqlOpen && selectedDB && (
39
+ <SqlPanel selectedDB={selectedDB} runCustomQuery={runCustomQuery} />
40
+ )}
41
+
42
+ <View style={s.content}>
43
+ <DataTable
44
+ columns={columns}
45
+ rows={rows}
46
+ selectedRowIndex={selectedRowIndex}
47
+ onRowSelect={selectRow}
48
+ status={status}
49
+ error={error}
50
+ onClearTable={selectedTable ? clearTable : undefined}
51
+ onReconnect={reconnect}
52
+ />
53
+ {selectedRow !== null && (
54
+ <RowDetailPanel
55
+ row={selectedRow}
56
+ rowIndex={selectedRowIndex}
57
+ onClose={closeRow}
58
+ onSave={saveRow}
59
+ onDelete={deleteRow}
60
+ mutating={mutating}
61
+ mutationError={mutationError}
62
+ onClearError={clearMutationError}
63
+ />
64
+ )}
65
+ </View>
66
+ </View>
67
+ );
68
+ }
69
+
70
+ const s = StyleSheet.create({
71
+ root: { flex: 1, backgroundColor: C.bg, flexDirection: 'column' },
72
+ content: { flex: 1, flexDirection: 'row', overflow: 'hidden' },
73
+ });
74
+
package/src/theme.ts ADDED
@@ -0,0 +1,17 @@
1
+ export type RowData = Record<string, string | number | null>;
2
+
3
+ export const C = {
4
+ bg: '#0d1117',
5
+ surface: '#161b22',
6
+ surface2: '#21262d',
7
+ border: '#30363d',
8
+ borderSubtle: '#1c2129',
9
+ text: '#e6edf3',
10
+ textSecondary: '#8b949e',
11
+ textMuted: '#484f58',
12
+ accent: '#2dd4a0',
13
+ accentSubtle: '#0d2e26',
14
+ danger: '#f85149',
15
+ success: '#3fb950',
16
+ rowSelected: '#0d2620',
17
+ } as const;
@@ -0,0 +1,13 @@
1
+ import 'react-native';
2
+
3
+ declare module 'react-native' {
4
+ // Truly web-only CSS properties not present in React Native's type definitions
5
+ interface ViewStyle {
6
+ scrollbarWidth?: string;
7
+ scrollbarColor?: string;
8
+ boxShadow?: string;
9
+ }
10
+ interface ViewProps {
11
+ onMouseDown?: (event: any) => void;
12
+ }
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "esModuleInterop": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "noFallthroughCasesInSwitch": true,
12
+ "module": "ESNext",
13
+ "moduleResolution": "bundler",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": [
20
+ "src/**/*",
21
+ "react-native.ts",
22
+ "rozenite.config.ts"
23
+ ],
24
+ "exclude": ["node_modules", "dist", "build"]
25
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,20 @@
1
+ /// <reference types='vitest' />
2
+ import { defineConfig } from 'vite';
3
+ import { rozenitePlugin } from '@rozenite/vite-plugin';
4
+
5
+ export default defineConfig({
6
+ root: __dirname,
7
+ plugins: [rozenitePlugin()],
8
+ base: './',
9
+ build: {
10
+ outDir: './dist',
11
+ emptyOutDir: false,
12
+ reportCompressedSize: false,
13
+ minify: true,
14
+ sourcemap: false,
15
+ },
16
+ server: {
17
+ port: 3000,
18
+ open: true,
19
+ },
20
+ });