local-lite 1.0.1 → 1.0.3
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/actions/manager.js +6 -2
- package/dist/actions/store.js +33 -19
- package/dist/adapters/local/expo-sqlite.js +4 -2
- package/dist/adapters/local/libsql.js +3 -1
- package/dist/adapters/local/op-sqlite.js +2 -1
- package/dist/adapters/network/index.js +10 -5
- package/dist/adapters/remote/convex.js +37 -10
- package/dist/adapters/remote/firestore.js +11 -4
- package/dist/adapters/remote/self-hosted.js +9 -5
- package/dist/adapters/remote/supabase.js +95 -29
- package/dist/auth/apple.js +8 -4
- package/dist/auth/github.js +15 -7
- package/dist/auth/google.js +7 -4
- package/dist/auth/identity.js +5 -1
- package/dist/auth/local.js +74 -21
- package/dist/auth/microsoft.js +22 -8
- package/dist/auth/session.js +45 -34
- package/dist/auth/unified.js +3 -2
- package/dist/backups/cloud-storage.js +10 -7
- package/dist/backups/encryption.js +4 -2
- package/dist/backups/onedrive.js +3 -3
- package/dist/backups/operations.js +4 -2
- package/dist/config/index.d.ts +1 -1
- package/dist/config/resolve-local.js +18 -6
- package/dist/config/resolve-remote.js +2 -1
- package/dist/core/client.d.ts +2 -2
- package/dist/core/client.js +64 -26
- package/dist/core/index.d.ts +1 -1
- package/dist/core/maintenance.js +5 -4
- package/dist/core/meta-store.js +3 -3
- package/dist/core/outbox-store.js +32 -25
- package/dist/core/query-builder.js +23 -10
- package/dist/core/query.js +19 -7
- package/dist/core/schema-manager.js +6 -2
- package/dist/core/sync-worker.js +38 -12
- package/dist/core/table-manager.js +8 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/devtools/BenchmarkModal.d.ts +1 -1
- package/dist/devtools/BenchmarkModal.js +234 -54
- package/dist/devtools/SyncInspector.js +260 -37
- package/dist/email/index.js +46 -18
- package/dist/keys/generator.js +4 -1
- package/dist/keys/manager.js +22 -4
- package/dist/keys/signed-token.js +12 -4
- package/dist/keys/store.js +23 -16
- package/dist/kv/manager.js +5 -2
- package/dist/kv/store.js +13 -13
- package/dist/react/auth.js +12 -12
- package/dist/react/backups.js +1 -1
- package/dist/react/index.js +14 -9
- package/dist/react/runner.js +1 -1
- package/dist/react/status.js +6 -2
- package/dist/reactive/event-emitter.js +2 -2
- package/dist/scheduler/cron.js +3 -1
- package/dist/scheduler/store.js +37 -31
- package/dist/schema/generator.js +37 -34
- package/dist/search/manager.js +3 -1
- package/dist/search/store.js +17 -16
- package/dist/server/email.js +3 -2
- package/dist/server/index.js +4 -4
- package/dist/server/sync.js +11 -4
- package/dist/storage/driver.js +2 -1
- package/dist/storage/expo.js +5 -2
- package/dist/storage/manager.js +3 -1
- package/dist/storage/store.js +26 -25
- package/dist/utils/dynamic.js +4 -2
- package/dist/utils/logger.js +13 -6
- package/dist/utils/portability.js +21 -9
- package/package.json +1 -1
|
@@ -37,7 +37,10 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
37
37
|
(0, react_1.useEffect)(() => {
|
|
38
38
|
if (!client || !isOpen)
|
|
39
39
|
return;
|
|
40
|
-
client
|
|
40
|
+
client
|
|
41
|
+
.getMetrics()
|
|
42
|
+
.then(setMetrics)
|
|
43
|
+
.catch(() => { });
|
|
41
44
|
}, [client, isOpen, status.isSyncing, status.pendingCount]);
|
|
42
45
|
const runAction = (0, react_1.useCallback)(async (startMsg, doneMsg, action) => {
|
|
43
46
|
if (!client)
|
|
@@ -63,9 +66,14 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
63
66
|
const clearOutbox = () => runAction('Clearing stuck outbox...', (count) => `Cleared ${count || 0} stuck outbox mutations`, async () => {
|
|
64
67
|
client.syncWorker.pause();
|
|
65
68
|
try {
|
|
66
|
-
const count = await client.maintenance.pruneOutbox({
|
|
69
|
+
const count = await client.maintenance.pruneOutbox({
|
|
70
|
+
statuses: ['PENDING', 'PROCESSING', 'FAILED'],
|
|
71
|
+
});
|
|
67
72
|
if (count > 0) {
|
|
68
|
-
client.events.emit('sync_outbox', {
|
|
73
|
+
client.events.emit('sync_outbox', {
|
|
74
|
+
operation: 'DELETE',
|
|
75
|
+
rowId: 'clear-stuck',
|
|
76
|
+
});
|
|
69
77
|
}
|
|
70
78
|
await status.refresh();
|
|
71
79
|
return count;
|
|
@@ -78,11 +86,18 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
78
86
|
if (RN?.Alert?.alert) {
|
|
79
87
|
RN.Alert.alert('Clear stuck outbox?', message, [
|
|
80
88
|
{ text: 'Cancel', style: 'cancel' },
|
|
81
|
-
{
|
|
89
|
+
{
|
|
90
|
+
text: 'Clear outbox',
|
|
91
|
+
style: 'destructive',
|
|
92
|
+
onPress: () => {
|
|
93
|
+
void clearOutbox();
|
|
94
|
+
},
|
|
95
|
+
},
|
|
82
96
|
]);
|
|
83
97
|
return;
|
|
84
98
|
}
|
|
85
|
-
if (typeof globalThis.confirm === 'function' &&
|
|
99
|
+
if (typeof globalThis.confirm === 'function' &&
|
|
100
|
+
globalThis.confirm(message)) {
|
|
86
101
|
void clearOutbox();
|
|
87
102
|
}
|
|
88
103
|
};
|
|
@@ -95,8 +110,16 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
95
110
|
setIsBenchmarkModalOpen(true);
|
|
96
111
|
}
|
|
97
112
|
};
|
|
98
|
-
const statusColor = !status.isOnline
|
|
99
|
-
|
|
113
|
+
const statusColor = !status.isOnline
|
|
114
|
+
? '#EF4444'
|
|
115
|
+
: status.isSyncing
|
|
116
|
+
? '#F59E0B'
|
|
117
|
+
: '#10B981';
|
|
118
|
+
const statusLabel = !status.isOnline
|
|
119
|
+
? 'Offline'
|
|
120
|
+
: status.isSyncing
|
|
121
|
+
? 'Syncing'
|
|
122
|
+
: 'Online';
|
|
100
123
|
const isInline = position === 'inline';
|
|
101
124
|
const isTop = position.startsWith('top') || position === 'top';
|
|
102
125
|
const isLeft = position.includes('left');
|
|
@@ -120,11 +143,42 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
120
143
|
], [status.pendingCount, metrics?.outboxFailedCount, currentTheme.text]);
|
|
121
144
|
// Shared Action Buttons
|
|
122
145
|
const actionButtons = (0, react_1.useMemo)(() => [
|
|
123
|
-
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
146
|
+
{
|
|
147
|
+
id: 'push',
|
|
148
|
+
label: '🚀 Push Changes',
|
|
149
|
+
onPress: handlePush,
|
|
150
|
+
bg: '#3B82F6',
|
|
151
|
+
color: '#FFFFFF',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'pull',
|
|
155
|
+
label: '📥 Pull Changes',
|
|
156
|
+
onPress: handlePull,
|
|
157
|
+
bg: '#2563EB',
|
|
158
|
+
color: '#FFFFFF',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'retry',
|
|
162
|
+
label: '🔄 Retry Failed',
|
|
163
|
+
onPress: handleRetryFailed,
|
|
164
|
+
bg: currentTheme.actionBg,
|
|
165
|
+
color: currentTheme.actionText,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: 'reset',
|
|
169
|
+
label: '⏪ Reset Cursor',
|
|
170
|
+
onPress: handleResetCursor,
|
|
171
|
+
bg: currentTheme.actionBg,
|
|
172
|
+
color: currentTheme.actionText,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: 'clear-outbox',
|
|
176
|
+
label: 'Clear Stuck Outbox',
|
|
177
|
+
onPress: handleClearOutbox,
|
|
178
|
+
disabled: status.pendingCount === 0,
|
|
179
|
+
bg: '#EF4444',
|
|
180
|
+
color: '#FFFFFF',
|
|
181
|
+
},
|
|
128
182
|
{
|
|
129
183
|
id: 'flush-actions',
|
|
130
184
|
label: '📨 Flush Actions & Email',
|
|
@@ -132,7 +186,18 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
132
186
|
bg: '#8B5CF6',
|
|
133
187
|
color: '#FFFFFF',
|
|
134
188
|
},
|
|
135
|
-
], [
|
|
189
|
+
], [
|
|
190
|
+
handlePush,
|
|
191
|
+
handlePull,
|
|
192
|
+
handleRetryFailed,
|
|
193
|
+
handleResetCursor,
|
|
194
|
+
handleClearOutbox,
|
|
195
|
+
runAction,
|
|
196
|
+
client,
|
|
197
|
+
currentTheme.actionBg,
|
|
198
|
+
currentTheme.actionText,
|
|
199
|
+
status.pendingCount,
|
|
200
|
+
]);
|
|
136
201
|
const triggerLabel = variant === 'compact'
|
|
137
202
|
? status.pendingCount > 0
|
|
138
203
|
? `${status.pendingCount} queued`
|
|
@@ -142,7 +207,7 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
142
207
|
return null;
|
|
143
208
|
// React Native Renderer
|
|
144
209
|
if (RN && RN.View) {
|
|
145
|
-
const { View, Text, TouchableOpacity, ScrollView, Modal, Platform, StatusBar } = RN;
|
|
210
|
+
const { View, Text, TouchableOpacity, ScrollView, Modal, Platform, StatusBar, } = RN;
|
|
146
211
|
const SafeComp = RNSafeArea?.SafeAreaView || RN.SafeAreaView || View;
|
|
147
212
|
const isAndroid = Platform?.OS === 'android';
|
|
148
213
|
const statusBarHeight = isAndroid ? StatusBar?.currentHeight || 24 : 0;
|
|
@@ -153,7 +218,9 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
153
218
|
zIndex: 99999,
|
|
154
219
|
left: isCenter ? 16 : isLeft ? 16 : undefined,
|
|
155
220
|
right: isCenter ? 16 : !isLeft ? 16 : undefined,
|
|
156
|
-
...(isTop
|
|
221
|
+
...(isTop
|
|
222
|
+
? { top: isAndroid ? statusBarHeight + 12 : 48 }
|
|
223
|
+
: { bottom: 24 }),
|
|
157
224
|
};
|
|
158
225
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isOpen && ((0, jsx_runtime_1.jsx)(View, { style: [pillPosStyle, style], pointerEvents: "box-none", children: renderTrigger ? (renderTrigger({
|
|
159
226
|
isOpen,
|
|
@@ -162,33 +229,101 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
162
229
|
metrics,
|
|
163
230
|
statusColor,
|
|
164
231
|
statusLabel,
|
|
165
|
-
})) : !alwaysVisible &&
|
|
232
|
+
})) : !alwaysVisible &&
|
|
233
|
+
status.pendingCount === 0 &&
|
|
234
|
+
status.isOnline &&
|
|
235
|
+
!status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)(TouchableOpacity, { onPress: () => setIsOpen(true), style: [
|
|
166
236
|
isInline ? rnStyles.inlinePill : rnStyles.pill,
|
|
167
237
|
{
|
|
168
238
|
borderColor: statusColor,
|
|
169
239
|
backgroundColor: currentTheme.surface,
|
|
170
|
-
alignSelf: isInline
|
|
240
|
+
alignSelf: isInline
|
|
241
|
+
? 'auto'
|
|
242
|
+
: isCenter
|
|
243
|
+
? 'center'
|
|
244
|
+
: isLeft
|
|
245
|
+
? 'flex-start'
|
|
246
|
+
: 'flex-end',
|
|
171
247
|
},
|
|
172
|
-
], activeOpacity: 0.8, children: [(0, jsx_runtime_1.jsx)(View, { style: [rnStyles.dot, { backgroundColor: statusColor }] }), variant !== 'icon' && variant !== 'minimal' && ((0, jsx_runtime_1.jsx)(Text, { style: [
|
|
248
|
+
], activeOpacity: 0.8, children: [(0, jsx_runtime_1.jsx)(View, { style: [rnStyles.dot, { backgroundColor: statusColor }] }), variant !== 'icon' && variant !== 'minimal' && ((0, jsx_runtime_1.jsx)(Text, { style: [
|
|
249
|
+
isInline ? rnStyles.inlinePillText : rnStyles.pillText,
|
|
250
|
+
{ color: currentTheme.text },
|
|
251
|
+
], children: triggerLabel })), status.pendingCount > 0 && variant !== 'compact' && ((0, jsx_runtime_1.jsx)(View, { style: rnStyles.badge, children: (0, jsx_runtime_1.jsx)(Text, { style: rnStyles.badgeText, children: status.pendingCount }) }))] })) })), (0, jsx_runtime_1.jsx)(Modal, { visible: isOpen, animationType: "slide", presentationStyle: "fullScreen", statusBarTranslucent: true, onRequestClose: () => setIsOpen(false), children: (0, jsx_runtime_1.jsxs)(SafeComp, { style: [
|
|
252
|
+
rnStyles.fullScreenSafe,
|
|
253
|
+
{ backgroundColor: currentTheme.bg },
|
|
254
|
+
], edges: ['top', 'bottom', 'left', 'right'], children: [(0, jsx_runtime_1.jsxs)(View, { style: [
|
|
173
255
|
rnStyles.topBar,
|
|
174
256
|
{
|
|
175
257
|
backgroundColor: currentTheme.surface,
|
|
176
258
|
borderBottomColor: currentTheme.border,
|
|
177
259
|
},
|
|
178
|
-
!RNSafeArea?.SafeAreaView &&
|
|
179
|
-
|
|
260
|
+
!RNSafeArea?.SafeAreaView &&
|
|
261
|
+
isAndroid && { paddingTop: statusBarHeight + 10 },
|
|
262
|
+
], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.topBarTitle, { color: currentTheme.text }], children: title }), (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
263
|
+
rnStyles.topBarSub,
|
|
264
|
+
{ color: currentTheme.textMuted },
|
|
265
|
+
], children: "Engine Inspector & Sync Telemetry" })] }), (0, jsx_runtime_1.jsx)(View, { style: [
|
|
266
|
+
rnStyles.statusBadge,
|
|
267
|
+
{
|
|
268
|
+
borderColor: statusColor,
|
|
269
|
+
backgroundColor: `${statusColor}20`,
|
|
270
|
+
},
|
|
271
|
+
], children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statusBadgeText, { color: statusColor }], children: statusLabel }) }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: () => setIsOpen(false), style: [
|
|
272
|
+
rnStyles.closeCircle,
|
|
273
|
+
{ backgroundColor: currentTheme.actionBg },
|
|
274
|
+
], activeOpacity: 0.7, children: (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
275
|
+
rnStyles.closeCircleText,
|
|
276
|
+
{ color: currentTheme.actionText },
|
|
277
|
+
], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsxs)(ScrollView, { style: [
|
|
278
|
+
rnStyles.scrollBody,
|
|
279
|
+
{ backgroundColor: currentTheme.bg },
|
|
280
|
+
], contentContainerStyle: rnStyles.scrollContent, showsVerticalScrollIndicator: true, children: [actionMessage && ((0, jsx_runtime_1.jsx)(View, { style: rnStyles.actionMsgBox, children: (0, jsx_runtime_1.jsx)(Text, { style: rnStyles.actionMsgText, children: actionMessage }) })), (0, jsx_runtime_1.jsx)(View, { style: rnStyles.statGrid, children: statCards.map((card) => ((0, jsx_runtime_1.jsxs)(View, { style: [
|
|
180
281
|
rnStyles.statCard,
|
|
181
282
|
{
|
|
182
283
|
backgroundColor: currentTheme.card,
|
|
183
284
|
borderColor: currentTheme.border,
|
|
184
285
|
},
|
|
185
|
-
], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statNum, { color: card.numColor }], children: String(card.num ?? 0) }), (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
286
|
+
], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statNum, { color: card.numColor }], children: String(card.num ?? 0) }), (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
287
|
+
rnStyles.statLabel,
|
|
288
|
+
{ color: currentTheme.textSecondary },
|
|
289
|
+
], children: card.label }), (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
290
|
+
rnStyles.statSub,
|
|
291
|
+
{ color: currentTheme.textMuted },
|
|
292
|
+
], children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)(View, { style: [
|
|
186
293
|
rnStyles.infoCard,
|
|
187
294
|
{
|
|
188
295
|
backgroundColor: currentTheme.card,
|
|
189
296
|
borderColor: currentTheme.border,
|
|
190
297
|
},
|
|
191
|
-
], children: [(0, jsx_runtime_1.jsx)(Text, { style: [
|
|
298
|
+
], children: [(0, jsx_runtime_1.jsx)(Text, { style: [
|
|
299
|
+
rnStyles.infoCardTitle,
|
|
300
|
+
{ color: currentTheme.textMuted },
|
|
301
|
+
], children: "ENGINE ACTIONS" }), (0, jsx_runtime_1.jsx)(View, { style: rnStyles.btnRow, children: actionButtons.slice(0, 2).map((btn) => ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: btn.onPress, style: [rnStyles.actionBtn, { backgroundColor: btn.bg }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: btn.color }], children: btn.label }) }, btn.id))) }), (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.btnRow, { marginTop: 8 }], children: actionButtons.slice(2, 4).map((btn) => ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: btn.onPress, style: [
|
|
302
|
+
rnStyles.actionBtn,
|
|
303
|
+
{ backgroundColor: btn.bg },
|
|
304
|
+
btn.disabled && { opacity: 0.5 },
|
|
305
|
+
], disabled: btn.disabled, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: btn.color }], children: btn.label }) }, btn.id))) }), (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.btnRow, { marginTop: 8 }], children: actionButtons.slice(4, 6).map((btn) => ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: btn.onPress, style: [
|
|
306
|
+
rnStyles.actionBtn,
|
|
307
|
+
{ backgroundColor: btn.bg },
|
|
308
|
+
btn.disabled && { opacity: 0.5 },
|
|
309
|
+
], disabled: btn.disabled, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: btn.color }], children: btn.label }) }, btn.id))) })] }), (metrics?.lastPushError || metrics?.lastPullError) && ((0, jsx_runtime_1.jsxs)(View, { style: [
|
|
310
|
+
rnStyles.infoCard,
|
|
311
|
+
{
|
|
312
|
+
borderColor: currentTheme.border,
|
|
313
|
+
backgroundColor: currentTheme.surfaceSubtle,
|
|
314
|
+
},
|
|
315
|
+
], children: [(0, jsx_runtime_1.jsx)(Text, { style: [
|
|
316
|
+
rnStyles.infoCardTitle,
|
|
317
|
+
{ color: currentTheme.text },
|
|
318
|
+
], children: "SYNC ENGINE ERRORS" }), metrics?.lastPushError && ((0, jsx_runtime_1.jsxs)(View, { style: { marginBottom: 6 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: {
|
|
319
|
+
fontSize: 11,
|
|
320
|
+
color: currentTheme.textSecondary,
|
|
321
|
+
fontWeight: '700',
|
|
322
|
+
}, children: "Last Push Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: currentTheme.text }, children: String(metrics.lastPushError) })] })), metrics?.lastPullError && ((0, jsx_runtime_1.jsxs)(View, { children: [(0, jsx_runtime_1.jsx)(Text, { style: {
|
|
323
|
+
fontSize: 11,
|
|
324
|
+
color: currentTheme.textSecondary,
|
|
325
|
+
fontWeight: '700',
|
|
326
|
+
}, children: "Last Pull Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: currentTheme.text }, children: String(metrics.lastPullError) })] }))] })), status.pendingRecords && status.pendingRecords.length > 0 && ((0, jsx_runtime_1.jsxs)(View, { style: [
|
|
192
327
|
rnStyles.infoCard,
|
|
193
328
|
{
|
|
194
329
|
backgroundColor: currentTheme.card,
|
|
@@ -199,23 +334,65 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
199
334
|
justifyContent: 'space-between',
|
|
200
335
|
alignItems: 'center',
|
|
201
336
|
marginBottom: 10,
|
|
202
|
-
}, children: [(0, jsx_runtime_1.jsxs)(Text, { style: [
|
|
337
|
+
}, children: [(0, jsx_runtime_1.jsxs)(Text, { style: [
|
|
338
|
+
rnStyles.infoCardTitle,
|
|
339
|
+
{ color: currentTheme.textMuted },
|
|
340
|
+
], children: ["QUEUED OUTBOX MUTATIONS (", status.pendingRecords.length, ")"] }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: currentTheme.textMuted }, children: "Latest queued" })] }), status.pendingRecords
|
|
341
|
+
.slice(0, 8)
|
|
342
|
+
.map((rec, idx) => ((0, jsx_runtime_1.jsxs)(View, { style: [
|
|
203
343
|
rnStyles.infoRow,
|
|
204
344
|
{ borderBottomColor: currentTheme.border },
|
|
205
|
-
idx ===
|
|
206
|
-
|
|
345
|
+
idx ===
|
|
346
|
+
Math.min(status.pendingRecords.length, 8) - 1 && {
|
|
347
|
+
borderBottomWidth: 0,
|
|
348
|
+
},
|
|
349
|
+
], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsxs)(View, { style: {
|
|
350
|
+
flexDirection: 'row',
|
|
351
|
+
alignItems: 'center',
|
|
352
|
+
gap: 6,
|
|
353
|
+
}, children: [(0, jsx_runtime_1.jsx)(View, { style: [
|
|
207
354
|
rnStyles.dotSmall,
|
|
208
|
-
{
|
|
209
|
-
|
|
355
|
+
{
|
|
356
|
+
backgroundColor: rec.status === 'FAILED'
|
|
357
|
+
? '#EF4444'
|
|
358
|
+
: '#F59E0B',
|
|
359
|
+
},
|
|
360
|
+
] }), (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
361
|
+
color: currentTheme.text,
|
|
362
|
+
fontSize: 13,
|
|
363
|
+
fontWeight: '600',
|
|
364
|
+
}, children: rec.tableName || 'record' }), (0, jsx_runtime_1.jsx)(View, { style: {
|
|
210
365
|
backgroundColor: currentTheme.actionBg,
|
|
211
366
|
paddingHorizontal: 5,
|
|
212
367
|
paddingVertical: 1,
|
|
213
368
|
borderRadius: 4,
|
|
214
|
-
}, children: (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
369
|
+
}, children: (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
370
|
+
color: currentTheme.actionText,
|
|
371
|
+
fontSize: 10,
|
|
372
|
+
fontWeight: '700',
|
|
373
|
+
}, children: rec.operation || 'MUTATE' }) })] }), rec.rowId && ((0, jsx_runtime_1.jsxs)(Text, { style: {
|
|
374
|
+
color: currentTheme.textMuted,
|
|
375
|
+
fontSize: 11,
|
|
376
|
+
marginTop: 2,
|
|
377
|
+
}, numberOfLines: 1, children: ["ID: ", rec.rowId] })), rec.errorMessage && ((0, jsx_runtime_1.jsx)(Text, { style: {
|
|
378
|
+
color: '#EF4444',
|
|
379
|
+
fontSize: 11,
|
|
380
|
+
marginTop: 2,
|
|
381
|
+
}, children: rec.errorMessage }))] }), (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
382
|
+
color: currentTheme.textMuted,
|
|
383
|
+
fontSize: 11,
|
|
384
|
+
}, children: rec.status || 'PENDING' })] }, rec.id || idx))), status.pendingRecords.length > 8 && ((0, jsx_runtime_1.jsxs)(Text, { style: {
|
|
385
|
+
color: currentTheme.textMuted,
|
|
386
|
+
fontSize: 11,
|
|
387
|
+
textAlign: 'center',
|
|
388
|
+
marginTop: 8,
|
|
389
|
+
}, children: ["+ ", status.pendingRecords.length - 8, " more mutations in outbox"] }))] })), enableBenchmark && ((0, jsx_runtime_1.jsxs)(View, { style: [
|
|
215
390
|
rnStyles.infoCard,
|
|
216
391
|
{
|
|
217
392
|
borderColor: '#8B5CF640',
|
|
218
|
-
backgroundColor: currentTheme.isDark
|
|
393
|
+
backgroundColor: currentTheme.isDark
|
|
394
|
+
? '#1E1B4B25'
|
|
395
|
+
: '#F5F3FF',
|
|
219
396
|
},
|
|
220
397
|
], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
|
|
221
398
|
flexDirection: 'row',
|
|
@@ -224,12 +401,23 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
224
401
|
marginBottom: 8,
|
|
225
402
|
}, children: [(0, jsx_runtime_1.jsx)(Text, { style: [
|
|
226
403
|
rnStyles.infoCardTitle,
|
|
227
|
-
{
|
|
404
|
+
{
|
|
405
|
+
color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9',
|
|
406
|
+
marginBottom: 0,
|
|
407
|
+
},
|
|
228
408
|
], children: "PERFORMANCE BENCHMARK" }), (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
229
409
|
fontSize: 10,
|
|
230
410
|
color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
|
|
231
411
|
fontWeight: '700',
|
|
232
|
-
}, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
412
|
+
}, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)(Text, { style: {
|
|
413
|
+
fontSize: 12,
|
|
414
|
+
color: currentTheme.textMuted,
|
|
415
|
+
marginBottom: 12,
|
|
416
|
+
lineHeight: 18,
|
|
417
|
+
}, children: BENCHMARK_DESCRIPTION }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: handleBenchmarkPress, style: [rnStyles.actionBtn, { backgroundColor: '#8B5CF6' }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [
|
|
418
|
+
rnStyles.actionBtnText,
|
|
419
|
+
{ color: '#FFFFFF', fontWeight: '700' },
|
|
420
|
+
], children: "\u26A1 Open SQLite Benchmark Suite" }) })] }))] })] }) }), enableBenchmark && !onOpenBenchmark && ((0, jsx_runtime_1.jsx)(BenchmarkModal_js_1.BenchmarkModal, { client: client, visible: isBenchmarkModalOpen, onDismiss: () => setIsBenchmarkModalOpen(false), theme: theme }))] }));
|
|
233
421
|
}
|
|
234
422
|
// Web / DOM Renderer Fallback
|
|
235
423
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOpen ? ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
@@ -253,7 +441,15 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
253
441
|
height: 12,
|
|
254
442
|
borderRadius: 6,
|
|
255
443
|
backgroundColor: statusColor,
|
|
256
|
-
} }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
444
|
+
} }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
445
|
+
fontSize: 17,
|
|
446
|
+
fontWeight: 700,
|
|
447
|
+
color: currentTheme.text,
|
|
448
|
+
}, children: title }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
449
|
+
fontSize: 11,
|
|
450
|
+
color: currentTheme.textMuted,
|
|
451
|
+
marginTop: 2,
|
|
452
|
+
}, children: "Engine Inspector & Sync Telemetry" })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
257
453
|
border: `1px solid ${statusColor}`,
|
|
258
454
|
color: statusColor,
|
|
259
455
|
padding: '3px 10px',
|
|
@@ -302,7 +498,20 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
302
498
|
border: `1px solid ${currentTheme.border}`,
|
|
303
499
|
borderRadius: 12,
|
|
304
500
|
padding: 8,
|
|
305
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
501
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
502
|
+
fontSize: 24,
|
|
503
|
+
fontWeight: 800,
|
|
504
|
+
color: card.numColor,
|
|
505
|
+
}, children: card.num }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
506
|
+
fontSize: 12,
|
|
507
|
+
color: currentTheme.textSecondary,
|
|
508
|
+
marginTop: 4,
|
|
509
|
+
fontWeight: 600,
|
|
510
|
+
}, children: card.label }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
511
|
+
fontSize: 11,
|
|
512
|
+
color: currentTheme.textMuted,
|
|
513
|
+
marginTop: 2,
|
|
514
|
+
}, children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
306
515
|
backgroundColor: currentTheme.card,
|
|
307
516
|
border: `1px solid ${currentTheme.border}`,
|
|
308
517
|
borderRadius: 12,
|
|
@@ -313,7 +522,11 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
313
522
|
color: currentTheme.textMuted,
|
|
314
523
|
letterSpacing: '0.8px',
|
|
315
524
|
marginBottom: 12,
|
|
316
|
-
}, children: "ENGINE ACTIONS" }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
525
|
+
}, children: "ENGINE ACTIONS" }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
526
|
+
display: 'grid',
|
|
527
|
+
gridTemplateColumns: '1fr 1fr',
|
|
528
|
+
gap: 10,
|
|
529
|
+
}, children: actionButtons.map((btn) => ((0, jsx_runtime_1.jsx)("button", { onClick: btn.onPress, disabled: btn.disabled, style: {
|
|
317
530
|
padding: '10px 14px',
|
|
318
531
|
backgroundColor: btn.bg,
|
|
319
532
|
color: btn.color,
|
|
@@ -323,7 +536,9 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
323
536
|
cursor: btn.disabled ? 'not-allowed' : 'pointer',
|
|
324
537
|
opacity: btn.disabled ? 0.5 : 1,
|
|
325
538
|
}, children: btn.label }, btn.id))) })] }), enableBenchmark && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
326
|
-
backgroundColor: currentTheme.isDark
|
|
539
|
+
backgroundColor: currentTheme.isDark
|
|
540
|
+
? '#1E1B4B25'
|
|
541
|
+
: '#F5F3FF',
|
|
327
542
|
border: '1px solid #8B5CF640',
|
|
328
543
|
borderRadius: 12,
|
|
329
544
|
padding: 16,
|
|
@@ -340,7 +555,12 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
340
555
|
fontSize: 10,
|
|
341
556
|
color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
|
|
342
557
|
fontWeight: 700,
|
|
343
|
-
}, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)("p", { style: {
|
|
558
|
+
}, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)("p", { style: {
|
|
559
|
+
fontSize: 12,
|
|
560
|
+
color: currentTheme.textMuted,
|
|
561
|
+
margin: '0 0 12px 0',
|
|
562
|
+
lineHeight: '18px',
|
|
563
|
+
}, children: BENCHMARK_DESCRIPTION }), (0, jsx_runtime_1.jsx)("button", { onClick: handleBenchmarkPress, style: {
|
|
344
564
|
width: '100%',
|
|
345
565
|
padding: '10px 16px',
|
|
346
566
|
backgroundColor: '#8B5CF6',
|
|
@@ -368,7 +588,10 @@ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', in
|
|
|
368
588
|
metrics,
|
|
369
589
|
statusColor,
|
|
370
590
|
statusLabel,
|
|
371
|
-
})) : !alwaysVisible &&
|
|
591
|
+
})) : !alwaysVisible &&
|
|
592
|
+
status.pendingCount === 0 &&
|
|
593
|
+
status.isOnline &&
|
|
594
|
+
!status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setIsOpen(true), style: {
|
|
372
595
|
display: 'inline-flex',
|
|
373
596
|
alignItems: 'center',
|
|
374
597
|
gap: 8,
|
package/dist/email/index.js
CHANGED
|
@@ -79,7 +79,8 @@ async function renderReactEmail(element) {
|
|
|
79
79
|
// 2. Try react-dom/server
|
|
80
80
|
try {
|
|
81
81
|
const ReactDOMServer = await (0, dynamic_js_1.safeDynamicImport)('react-dom/server');
|
|
82
|
-
const renderToStaticMarkup = ReactDOMServer?.renderToStaticMarkup ||
|
|
82
|
+
const renderToStaticMarkup = ReactDOMServer?.renderToStaticMarkup ||
|
|
83
|
+
ReactDOMServer?.default?.renderToStaticMarkup;
|
|
83
84
|
if (typeof renderToStaticMarkup === 'function') {
|
|
84
85
|
const html = renderToStaticMarkup(component);
|
|
85
86
|
const text = html.replace(/<[^>]*>/g, '').trim();
|
|
@@ -101,7 +102,9 @@ async function hydrateAttachment(att) {
|
|
|
101
102
|
if (att.url) {
|
|
102
103
|
const rawUrl = att.url;
|
|
103
104
|
if (rawUrl.startsWith('file://') ||
|
|
104
|
-
(!rawUrl.startsWith('http://') &&
|
|
105
|
+
(!rawUrl.startsWith('http://') &&
|
|
106
|
+
!rawUrl.startsWith('https://') &&
|
|
107
|
+
!rawUrl.startsWith('data:'))) {
|
|
105
108
|
const filePath = rawUrl.startsWith('file://') ? rawUrl.slice(7) : rawUrl;
|
|
106
109
|
try {
|
|
107
110
|
const fs = await import('node:fs/promises');
|
|
@@ -140,7 +143,9 @@ function buildMailOptions(payload, options = {}) {
|
|
|
140
143
|
mailOptions.replyTo = payload.replyTo;
|
|
141
144
|
if (payload.headers) {
|
|
142
145
|
mailOptions.headers = {
|
|
143
|
-
...(typeof options.defaults?.headers === 'object'
|
|
146
|
+
...(typeof options.defaults?.headers === 'object'
|
|
147
|
+
? options.defaults.headers
|
|
148
|
+
: {}),
|
|
144
149
|
...payload.headers,
|
|
145
150
|
};
|
|
146
151
|
}
|
|
@@ -216,7 +221,8 @@ async function prepareMailOptions(payload, options, record) {
|
|
|
216
221
|
* directly via Nodemailer (SMTP, Sendmail, SES, etc.).
|
|
217
222
|
*/
|
|
218
223
|
function createNodemailerHandler(transporterOrOptions, handlerOptions = {}) {
|
|
219
|
-
let cachedTransporter = transporterOrOptions &&
|
|
224
|
+
let cachedTransporter = transporterOrOptions &&
|
|
225
|
+
typeof transporterOrOptions.sendMail === 'function'
|
|
220
226
|
? transporterOrOptions
|
|
221
227
|
: null;
|
|
222
228
|
const getTransporter = async () => {
|
|
@@ -281,17 +287,23 @@ function createHttpEmailHandler(options) {
|
|
|
281
287
|
if (options.apiKey) {
|
|
282
288
|
headers['Authorization'] = `Bearer ${options.apiKey}`;
|
|
283
289
|
}
|
|
284
|
-
const toAddresses = Array.isArray(mailOptions.to)
|
|
290
|
+
const toAddresses = Array.isArray(mailOptions.to)
|
|
291
|
+
? mailOptions.to
|
|
292
|
+
: [mailOptions.to];
|
|
285
293
|
const personalizations = {
|
|
286
|
-
to: toAddresses.map((email) =>
|
|
294
|
+
to: toAddresses.map((email) => typeof email === 'string' ? { email } : email),
|
|
287
295
|
};
|
|
288
296
|
if (mailOptions.cc) {
|
|
289
|
-
const ccAddresses = Array.isArray(mailOptions.cc)
|
|
290
|
-
|
|
297
|
+
const ccAddresses = Array.isArray(mailOptions.cc)
|
|
298
|
+
? mailOptions.cc
|
|
299
|
+
: [mailOptions.cc];
|
|
300
|
+
personalizations.cc = ccAddresses.map((email) => typeof email === 'string' ? { email } : email);
|
|
291
301
|
}
|
|
292
302
|
if (mailOptions.bcc) {
|
|
293
|
-
const bccAddresses = Array.isArray(mailOptions.bcc)
|
|
294
|
-
|
|
303
|
+
const bccAddresses = Array.isArray(mailOptions.bcc)
|
|
304
|
+
? mailOptions.bcc
|
|
305
|
+
: [mailOptions.bcc];
|
|
306
|
+
personalizations.bcc = bccAddresses.map((email) => typeof email === 'string' ? { email } : email);
|
|
295
307
|
}
|
|
296
308
|
const content = [];
|
|
297
309
|
if (mailOptions.text)
|
|
@@ -300,7 +312,9 @@ function createHttpEmailHandler(options) {
|
|
|
300
312
|
content.push({ type: 'text/html', value: String(mailOptions.html) });
|
|
301
313
|
body = {
|
|
302
314
|
personalizations: [personalizations],
|
|
303
|
-
from: typeof mailOptions.from === 'string'
|
|
315
|
+
from: typeof mailOptions.from === 'string'
|
|
316
|
+
? { email: mailOptions.from }
|
|
317
|
+
: mailOptions.from,
|
|
304
318
|
subject: mailOptions.subject,
|
|
305
319
|
content: content.length > 0 ? content : [{ type: 'text/plain', value: '' }],
|
|
306
320
|
};
|
|
@@ -312,12 +326,18 @@ function createHttpEmailHandler(options) {
|
|
|
312
326
|
}
|
|
313
327
|
body = {
|
|
314
328
|
From: mailOptions.from,
|
|
315
|
-
To: Array.isArray(mailOptions.to)
|
|
329
|
+
To: Array.isArray(mailOptions.to)
|
|
330
|
+
? mailOptions.to.join(',')
|
|
331
|
+
: mailOptions.to,
|
|
316
332
|
Subject: mailOptions.subject,
|
|
317
333
|
HtmlBody: mailOptions.html,
|
|
318
334
|
TextBody: mailOptions.text,
|
|
319
|
-
Cc: Array.isArray(mailOptions.cc)
|
|
320
|
-
|
|
335
|
+
Cc: Array.isArray(mailOptions.cc)
|
|
336
|
+
? mailOptions.cc.join(',')
|
|
337
|
+
: mailOptions.cc,
|
|
338
|
+
Bcc: Array.isArray(mailOptions.bcc)
|
|
339
|
+
? mailOptions.bcc.join(',')
|
|
340
|
+
: mailOptions.bcc,
|
|
321
341
|
ReplyTo: mailOptions.replyTo,
|
|
322
342
|
};
|
|
323
343
|
}
|
|
@@ -363,7 +383,9 @@ function createHttpEmailHandler(options) {
|
|
|
363
383
|
const sendResult = {
|
|
364
384
|
messageId,
|
|
365
385
|
response: resultData,
|
|
366
|
-
accepted: Array.isArray(mailOptions.to)
|
|
386
|
+
accepted: Array.isArray(mailOptions.to)
|
|
387
|
+
? mailOptions.to
|
|
388
|
+
: [mailOptions.to],
|
|
367
389
|
};
|
|
368
390
|
if (options.afterSend) {
|
|
369
391
|
await options.afterSend(sendResult, payload, record);
|
|
@@ -387,14 +409,20 @@ function createDevEmailHandler(options = {}) {
|
|
|
387
409
|
};
|
|
388
410
|
DevMailbox.record(sentRecord);
|
|
389
411
|
if (!options.silent) {
|
|
390
|
-
const toStr = Array.isArray(mailOptions.to)
|
|
391
|
-
|
|
412
|
+
const toStr = Array.isArray(mailOptions.to)
|
|
413
|
+
? mailOptions.to.join(', ')
|
|
414
|
+
: mailOptions.to;
|
|
415
|
+
const previewText = (mailOptions.text || mailOptions.html || '')
|
|
416
|
+
.toString()
|
|
417
|
+
.slice(0, 120);
|
|
392
418
|
console.log(`[local-lite:email:dev] Dispatched to: ${toStr} | Subject: "${mailOptions.subject}" | Body: "${previewText}"`);
|
|
393
419
|
}
|
|
394
420
|
const result = {
|
|
395
421
|
messageId: sentRecord.id,
|
|
396
422
|
response: { dev: true, previewUrl: `dev://mailbox/${sentRecord.id}` },
|
|
397
|
-
accepted: Array.isArray(mailOptions.to)
|
|
423
|
+
accepted: Array.isArray(mailOptions.to)
|
|
424
|
+
? mailOptions.to
|
|
425
|
+
: [mailOptions.to],
|
|
398
426
|
};
|
|
399
427
|
if (options.afterSend) {
|
|
400
428
|
await options.afterSend(result, payload, record);
|
package/dist/keys/generator.js
CHANGED
|
@@ -86,7 +86,10 @@ function hashApiKey(key) {
|
|
|
86
86
|
* prop_a7F9x2K1m8P0qW4z_c4f910e2
|
|
87
87
|
*/
|
|
88
88
|
function generateApiKey(options = {}) {
|
|
89
|
-
const prefix = (options.prefix || 'key')
|
|
89
|
+
const prefix = (options.prefix || 'key')
|
|
90
|
+
.trim()
|
|
91
|
+
.toLowerCase()
|
|
92
|
+
.replace(/[^a-z0-9_-]/g, '');
|
|
90
93
|
const byteLength = options.byteLength ?? 24;
|
|
91
94
|
const withChecksum = options.withChecksum ?? true;
|
|
92
95
|
const entropyBytes = getRandomBytes(byteLength);
|