local-lite 1.0.2 → 1.0.4

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.
Files changed (73) hide show
  1. package/README.md +4 -3
  2. package/dist/actions/manager.js +6 -2
  3. package/dist/actions/store.js +33 -19
  4. package/dist/adapters/local/expo-sqlite.js +4 -2
  5. package/dist/adapters/local/libsql.js +3 -1
  6. package/dist/adapters/local/op-sqlite.js +2 -1
  7. package/dist/adapters/network/index.js +10 -5
  8. package/dist/adapters/remote/convex.js +37 -10
  9. package/dist/adapters/remote/firestore.js +11 -4
  10. package/dist/adapters/remote/self-hosted.js +8 -4
  11. package/dist/adapters/remote/supabase.js +95 -29
  12. package/dist/auth/apple.js +8 -4
  13. package/dist/auth/github.js +15 -7
  14. package/dist/auth/google.js +7 -4
  15. package/dist/auth/identity.js +5 -1
  16. package/dist/auth/local.js +74 -21
  17. package/dist/auth/microsoft.js +22 -8
  18. package/dist/auth/session.js +45 -34
  19. package/dist/auth/unified.js +3 -2
  20. package/dist/backups/cloud-storage.js +10 -7
  21. package/dist/backups/encryption.js +4 -2
  22. package/dist/backups/onedrive.js +3 -3
  23. package/dist/backups/operations.js +4 -2
  24. package/dist/config/index.d.ts +1 -1
  25. package/dist/config/index.js +3 -0
  26. package/dist/config/resolve-local.js +18 -6
  27. package/dist/config/resolve-remote.js +2 -1
  28. package/dist/core/client.d.ts +2 -2
  29. package/dist/core/client.js +64 -26
  30. package/dist/core/index.d.ts +1 -1
  31. package/dist/core/maintenance.js +5 -4
  32. package/dist/core/meta-store.js +3 -3
  33. package/dist/core/outbox-store.js +32 -25
  34. package/dist/core/query-builder.js +23 -10
  35. package/dist/core/query.js +19 -7
  36. package/dist/core/schema-manager.js +6 -2
  37. package/dist/core/sync-worker.js +38 -12
  38. package/dist/core/table-manager.js +8 -2
  39. package/dist/core/types.d.ts +1 -1
  40. package/dist/devtools/BenchmarkModal.d.ts +1 -1
  41. package/dist/devtools/BenchmarkModal.js +234 -54
  42. package/dist/devtools/SyncInspector.js +260 -37
  43. package/dist/email/index.d.ts +17 -18
  44. package/dist/email/index.js +46 -72
  45. package/dist/keys/generator.js +4 -1
  46. package/dist/keys/manager.js +22 -4
  47. package/dist/keys/signed-token.js +12 -4
  48. package/dist/keys/store.js +23 -16
  49. package/dist/kv/manager.js +5 -2
  50. package/dist/kv/store.js +13 -13
  51. package/dist/react/auth.js +12 -12
  52. package/dist/react/backups.js +1 -1
  53. package/dist/react/index.js +14 -9
  54. package/dist/react/runner.js +1 -1
  55. package/dist/react/status.js +6 -2
  56. package/dist/reactive/event-emitter.js +2 -2
  57. package/dist/scheduler/cron.js +3 -1
  58. package/dist/scheduler/store.js +37 -31
  59. package/dist/schema/generator.js +37 -34
  60. package/dist/search/manager.js +3 -1
  61. package/dist/search/store.js +17 -16
  62. package/dist/server/email.d.ts +8 -0
  63. package/dist/server/email.js +48 -3
  64. package/dist/server/index.js +4 -4
  65. package/dist/server/sync.js +11 -4
  66. package/dist/storage/driver.js +2 -1
  67. package/dist/storage/expo.js +5 -2
  68. package/dist/storage/manager.js +3 -1
  69. package/dist/storage/store.js +26 -25
  70. package/dist/utils/dynamic.js +4 -2
  71. package/dist/utils/logger.js +13 -6
  72. package/dist/utils/portability.js +21 -9
  73. 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.getMetrics().then(setMetrics).catch(() => { });
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({ statuses: ['PENDING', 'PROCESSING', 'FAILED'] });
69
+ const count = await client.maintenance.pruneOutbox({
70
+ statuses: ['PENDING', 'PROCESSING', 'FAILED'],
71
+ });
67
72
  if (count > 0) {
68
- client.events.emit('sync_outbox', { operation: 'DELETE', rowId: 'clear-stuck' });
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
- { text: 'Clear outbox', style: 'destructive', onPress: () => { void clearOutbox(); } },
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' && globalThis.confirm(message)) {
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 ? '#EF4444' : status.isSyncing ? '#F59E0B' : '#10B981';
99
- const statusLabel = !status.isOnline ? 'Offline' : status.isSyncing ? 'Syncing' : 'Online';
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
- { id: 'push', label: '🚀 Push Changes', onPress: handlePush, bg: '#3B82F6', color: '#FFFFFF' },
124
- { id: 'pull', label: '📥 Pull Changes', onPress: handlePull, bg: '#2563EB', color: '#FFFFFF' },
125
- { id: 'retry', label: '🔄 Retry Failed', onPress: handleRetryFailed, bg: currentTheme.actionBg, color: currentTheme.actionText },
126
- { id: 'reset', label: '⏪ Reset Cursor', onPress: handleResetCursor, bg: currentTheme.actionBg, color: currentTheme.actionText },
127
- { id: 'clear-outbox', label: 'Clear Stuck Outbox', onPress: handleClearOutbox, disabled: status.pendingCount === 0, bg: '#EF4444', color: '#FFFFFF' },
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
- ], [handlePush, handlePull, handleRetryFailed, handleResetCursor, handleClearOutbox, runAction, client, currentTheme.actionBg, currentTheme.actionText, status.pendingCount]);
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 ? { top: isAndroid ? statusBarHeight + 12 : 48 } : { bottom: 24 }),
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 && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)(TouchableOpacity, { onPress: () => setIsOpen(true), style: [
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 ? 'auto' : isCenter ? 'center' : isLeft ? 'flex-start' : 'flex-end',
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: [isInline ? rnStyles.inlinePillText : rnStyles.pillText, { color: currentTheme.text }], 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: [rnStyles.fullScreenSafe, { backgroundColor: currentTheme.bg }], edges: ['top', 'bottom', 'left', 'right'], children: [(0, jsx_runtime_1.jsxs)(View, { 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 && isAndroid && { paddingTop: statusBarHeight + 10 },
179
- ], 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: [rnStyles.topBarSub, { color: currentTheme.textMuted }], children: "Engine Inspector & Sync Telemetry" })] }), (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.statusBadge, { borderColor: statusColor, backgroundColor: `${statusColor}20` }], children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statusBadgeText, { color: statusColor }], children: statusLabel }) }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: () => setIsOpen(false), style: [rnStyles.closeCircle, { backgroundColor: currentTheme.actionBg }], activeOpacity: 0.7, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.closeCircleText, { color: currentTheme.actionText }], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsxs)(ScrollView, { style: [rnStyles.scrollBody, { backgroundColor: currentTheme.bg }], 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: [
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: [rnStyles.statLabel, { color: currentTheme.textSecondary }], children: card.label }), (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statSub, { color: currentTheme.textMuted }], children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)(View, { 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: [rnStyles.infoCardTitle, { color: currentTheme.textMuted }], 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: [rnStyles.actionBtn, { backgroundColor: btn.bg }, btn.disabled && { opacity: 0.5 }], 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: [rnStyles.actionBtn, { backgroundColor: btn.bg }, btn.disabled && { opacity: 0.5 }], 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: [rnStyles.infoCard, { borderColor: '#EF444480', backgroundColor: '#7F1D1D20' }], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.infoCardTitle, { color: '#F87171' }], children: "SYNC ENGINE ERRORS" }), metrics?.lastPushError && ((0, jsx_runtime_1.jsxs)(View, { style: { marginBottom: 6 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: '#FCA5A5', fontWeight: '700' }, children: "Last Push Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: '#FECACA' }, children: String(metrics.lastPushError) })] })), metrics?.lastPullError && ((0, jsx_runtime_1.jsxs)(View, { children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: '#FCA5A5', fontWeight: '700' }, children: "Last Pull Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: '#FECACA' }, children: String(metrics.lastPullError) })] }))] })), status.pendingRecords && status.pendingRecords.length > 0 && ((0, jsx_runtime_1.jsxs)(View, { 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: [rnStyles.infoCardTitle, { color: currentTheme.textMuted }], children: ["QUEUED OUTBOX MUTATIONS (", status.pendingRecords.length, ")"] }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: currentTheme.textMuted }, children: "Latest queued" })] }), status.pendingRecords.slice(0, 8).map((rec, idx) => ((0, jsx_runtime_1.jsxs)(View, { 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 === Math.min(status.pendingRecords.length, 8) - 1 && { borderBottomWidth: 0 },
206
- ], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [(0, jsx_runtime_1.jsx)(View, { style: [
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
- { backgroundColor: rec.status === 'FAILED' ? '#EF4444' : '#F59E0B' },
209
- ] }), (0, jsx_runtime_1.jsx)(Text, { style: { color: currentTheme.text, fontSize: 13, fontWeight: '600' }, children: rec.tableName || 'record' }), (0, jsx_runtime_1.jsx)(View, { style: {
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: { color: currentTheme.actionText, fontSize: 10, fontWeight: '700' }, children: rec.operation || 'MUTATE' }) })] }), rec.rowId && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: currentTheme.textMuted, fontSize: 11, marginTop: 2 }, numberOfLines: 1, children: ["ID: ", rec.rowId] })), rec.errorMessage && ((0, jsx_runtime_1.jsx)(Text, { style: { color: '#EF4444', fontSize: 11, marginTop: 2 }, children: rec.errorMessage }))] }), (0, jsx_runtime_1.jsx)(Text, { style: { color: currentTheme.textMuted, fontSize: 11 }, children: rec.status || 'PENDING' })] }, rec.id || idx))), status.pendingRecords.length > 8 && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: currentTheme.textMuted, fontSize: 11, textAlign: 'center', marginTop: 8 }, children: ["+ ", status.pendingRecords.length - 8, " more mutations in outbox"] }))] })), enableBenchmark && ((0, jsx_runtime_1.jsxs)(View, { 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 ? '#1E1B4B25' : '#F5F3FF',
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
- { color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9', marginBottom: 0 },
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: { fontSize: 12, color: currentTheme.textMuted, marginBottom: 12, lineHeight: 18 }, 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: [rnStyles.actionBtnText, { color: '#FFFFFF', fontWeight: '700' }], 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 }))] }));
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: { fontSize: 17, fontWeight: 700, color: currentTheme.text }, children: title }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 11, color: currentTheme.textMuted, marginTop: 2 }, 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: {
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: { fontSize: 24, fontWeight: 800, color: card.numColor }, children: card.num }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 12, color: currentTheme.textSecondary, marginTop: 4, fontWeight: 600 }, children: card.label }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 11, color: currentTheme.textMuted, marginTop: 2 }, children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)("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: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10 }, children: actionButtons.map((btn) => ((0, jsx_runtime_1.jsx)("button", { onClick: btn.onPress, disabled: btn.disabled, 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 ? '#1E1B4B25' : '#F5F3FF',
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: { fontSize: 12, color: currentTheme.textMuted, margin: '0 0 12px 0', lineHeight: '18px' }, children: BENCHMARK_DESCRIPTION }), (0, jsx_runtime_1.jsx)("button", { onClick: handleBenchmarkPress, 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 && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setIsOpen(true), style: {
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,
@@ -1,4 +1,3 @@
1
- import type { Transporter, SendMailOptions, TransportOptions } from 'nodemailer';
2
1
  import type { ActionHandlerContext, ActionRecord, EmailAttachment, EmailPayload } from '../actions/types.js';
3
2
  export type EmailProviderType = 'nodemailer' | 'resend' | 'sendgrid' | 'postmark' | 'http' | 'dev' | 'preview' | 'custom';
4
3
  export interface EmailHandlerOptions {
@@ -10,7 +9,7 @@ export interface EmailHandlerOptions {
10
9
  /**
11
10
  * Additional default options merged into every outgoing email.
12
11
  */
13
- defaults?: Partial<SendMailOptions> & Record<string, any>;
12
+ defaults?: Partial<EmailMailOptions> & Record<string, any>;
14
13
  /**
15
14
  * Custom template renderer invoked when `template` or `templateData` is provided in EmailPayload.
16
15
  */
@@ -53,7 +52,19 @@ export interface EmailDeliveryConfig extends EmailHandlerOptions {
53
52
  silentDev?: boolean;
54
53
  }
55
54
  export type NodemailerHandlerOptions = EmailHandlerOptions;
56
- export type NodemailerTransportInput = Transporter | TransportOptions | string | any;
55
+ export interface EmailMailOptions {
56
+ to?: any;
57
+ from?: any;
58
+ subject?: string;
59
+ text?: string;
60
+ html?: string;
61
+ cc?: any;
62
+ bcc?: any;
63
+ replyTo?: any;
64
+ headers?: Record<string, any>;
65
+ attachments?: any[];
66
+ [key: string]: any;
67
+ }
57
68
  export interface EmailSendResult {
58
69
  messageId: string;
59
70
  response?: any;
@@ -66,7 +77,7 @@ export type ConcreteEmailHandler = (payload: EmailPayload, record: ActionRecord<
66
77
  export interface DevSentEmail {
67
78
  id: string;
68
79
  sentAt: number;
69
- mailOptions: SendMailOptions;
80
+ mailOptions: EmailMailOptions;
70
81
  payload: EmailPayload;
71
82
  record: ActionRecord<EmailPayload>;
72
83
  }
@@ -80,14 +91,6 @@ export declare class DevMailbox {
80
91
  static clear(): void;
81
92
  static record(email: DevSentEmail): void;
82
93
  }
83
- /**
84
- * Dynamically loads the nodemailer module if not already available.
85
- */
86
- export declare function loadNodemailer(): Promise<any>;
87
- /**
88
- * Resolves or instantiates a Nodemailer Transporter instance.
89
- */
90
- export declare function resolveTransporter(input: NodemailerTransportInput, defaults?: Partial<SendMailOptions>): Promise<Transporter>;
91
94
  /**
92
95
  * Renders a React element or JSX component into clean HTML and plaintext fallback.
93
96
  */
@@ -102,12 +105,8 @@ export declare function hydrateAttachment(att: EmailAttachment): Promise<any>;
102
105
  /**
103
106
  * Maps an offline Local-Lite EmailPayload to standard email options.
104
107
  */
105
- export declare function buildMailOptions(payload: EmailPayload, options?: EmailHandlerOptions): SendMailOptions;
106
- /**
107
- * Creates an EmailHandler for local-lite ActionManager that sends emails
108
- * directly via Nodemailer (SMTP, Sendmail, SES, etc.).
109
- */
110
- export declare function createNodemailerHandler(transporterOrOptions: NodemailerTransportInput, handlerOptions?: NodemailerHandlerOptions): ConcreteEmailHandler;
108
+ export declare function buildMailOptions(payload: EmailPayload, options?: EmailHandlerOptions): EmailMailOptions;
109
+ export declare function prepareMailOptions(payload: EmailPayload, options: EmailHandlerOptions, record: ActionRecord<EmailPayload>): Promise<EmailMailOptions>;
111
110
  /**
112
111
  * Creates an EmailHandler for local-lite ActionManager that dispatches emails
113
112
  * via HTTP APIs (e.g. Resend, SendGrid, Postmark, or custom webhooks/endpoints).