local-lite 1.0.2 → 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.
Files changed (69) hide show
  1. package/dist/actions/manager.js +6 -2
  2. package/dist/actions/store.js +33 -19
  3. package/dist/adapters/local/expo-sqlite.js +4 -2
  4. package/dist/adapters/local/libsql.js +3 -1
  5. package/dist/adapters/local/op-sqlite.js +2 -1
  6. package/dist/adapters/network/index.js +10 -5
  7. package/dist/adapters/remote/convex.js +37 -10
  8. package/dist/adapters/remote/firestore.js +11 -4
  9. package/dist/adapters/remote/self-hosted.js +8 -4
  10. package/dist/adapters/remote/supabase.js +95 -29
  11. package/dist/auth/apple.js +8 -4
  12. package/dist/auth/github.js +15 -7
  13. package/dist/auth/google.js +7 -4
  14. package/dist/auth/identity.js +5 -1
  15. package/dist/auth/local.js +74 -21
  16. package/dist/auth/microsoft.js +22 -8
  17. package/dist/auth/session.js +45 -34
  18. package/dist/auth/unified.js +3 -2
  19. package/dist/backups/cloud-storage.js +10 -7
  20. package/dist/backups/encryption.js +4 -2
  21. package/dist/backups/onedrive.js +3 -3
  22. package/dist/backups/operations.js +4 -2
  23. package/dist/config/index.d.ts +1 -1
  24. package/dist/config/resolve-local.js +18 -6
  25. package/dist/config/resolve-remote.js +2 -1
  26. package/dist/core/client.d.ts +2 -2
  27. package/dist/core/client.js +64 -26
  28. package/dist/core/index.d.ts +1 -1
  29. package/dist/core/maintenance.js +5 -4
  30. package/dist/core/meta-store.js +3 -3
  31. package/dist/core/outbox-store.js +32 -25
  32. package/dist/core/query-builder.js +23 -10
  33. package/dist/core/query.js +19 -7
  34. package/dist/core/schema-manager.js +6 -2
  35. package/dist/core/sync-worker.js +38 -12
  36. package/dist/core/table-manager.js +8 -2
  37. package/dist/core/types.d.ts +1 -1
  38. package/dist/devtools/BenchmarkModal.d.ts +1 -1
  39. package/dist/devtools/BenchmarkModal.js +234 -54
  40. package/dist/devtools/SyncInspector.js +260 -37
  41. package/dist/email/index.js +46 -18
  42. package/dist/keys/generator.js +4 -1
  43. package/dist/keys/manager.js +22 -4
  44. package/dist/keys/signed-token.js +12 -4
  45. package/dist/keys/store.js +23 -16
  46. package/dist/kv/manager.js +5 -2
  47. package/dist/kv/store.js +13 -13
  48. package/dist/react/auth.js +12 -12
  49. package/dist/react/backups.js +1 -1
  50. package/dist/react/index.js +14 -9
  51. package/dist/react/runner.js +1 -1
  52. package/dist/react/status.js +6 -2
  53. package/dist/reactive/event-emitter.js +2 -2
  54. package/dist/scheduler/cron.js +3 -1
  55. package/dist/scheduler/store.js +37 -31
  56. package/dist/schema/generator.js +37 -34
  57. package/dist/search/manager.js +3 -1
  58. package/dist/search/store.js +17 -16
  59. package/dist/server/email.js +3 -2
  60. package/dist/server/index.js +4 -4
  61. package/dist/server/sync.js +11 -4
  62. package/dist/storage/driver.js +2 -1
  63. package/dist/storage/expo.js +5 -2
  64. package/dist/storage/manager.js +3 -1
  65. package/dist/storage/store.js +26 -25
  66. package/dist/utils/dynamic.js +4 -2
  67. package/dist/utils/logger.js +13 -6
  68. package/dist/utils/portability.js +21 -9
  69. package/package.json +1 -1
@@ -116,28 +116,30 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
116
116
  });
117
117
  await db.execute('DROP TABLE IF EXISTS "_sync_bench_tags"').catch(() => { });
118
118
  await db.execute('DROP TABLE IF EXISTS "_sync_bench_temp"').catch(() => { });
119
- await db.execute('DROP TABLE IF EXISTS "_sync_bench_outbox"').catch(() => { });
120
- await db.execute(`
121
- CREATE TABLE IF NOT EXISTS "_sync_bench_temp" (
122
- id TEXT PRIMARY KEY,
123
- title TEXT,
124
- score INTEGER,
125
- metadata TEXT,
126
- created_at TEXT
127
- )
119
+ await db
120
+ .execute('DROP TABLE IF EXISTS "_sync_bench_outbox"')
121
+ .catch(() => { });
122
+ await db.execute(`
123
+ CREATE TABLE IF NOT EXISTS "_sync_bench_temp" (
124
+ id TEXT PRIMARY KEY,
125
+ title TEXT,
126
+ score INTEGER,
127
+ metadata TEXT,
128
+ created_at TEXT
129
+ )
128
130
  `);
129
131
  await db.execute('CREATE INDEX IF NOT EXISTS "idx_sync_bench_score" ON "_sync_bench_temp" (score)');
130
- await db.execute(`
131
- CREATE TABLE IF NOT EXISTS "_sync_bench_outbox" (
132
- id TEXT PRIMARY KEY,
133
- tableName TEXT NOT NULL,
134
- rowId TEXT NOT NULL,
135
- operation TEXT NOT NULL,
136
- payload TEXT,
137
- timestamp INTEGER NOT NULL,
138
- status TEXT DEFAULT 'PENDING',
139
- retryCount INTEGER DEFAULT 0
140
- )
132
+ await db.execute(`
133
+ CREATE TABLE IF NOT EXISTS "_sync_bench_outbox" (
134
+ id TEXT PRIMARY KEY,
135
+ tableName TEXT NOT NULL,
136
+ rowId TEXT NOT NULL,
137
+ operation TEXT NOT NULL,
138
+ payload TEXT,
139
+ timestamp INTEGER NOT NULL,
140
+ status TEXT DEFAULT 'PENDING',
141
+ retryCount INTEGER DEFAULT 0
142
+ )
141
143
  `);
142
144
  await db.execute('CREATE INDEX IF NOT EXISTS "idx_sync_bench_outbox" ON "_sync_bench_outbox" (status, timestamp)');
143
145
  // 1. client.batch() Ingestion
@@ -162,7 +164,13 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
162
164
  else {
163
165
  await db.transaction(async (tx) => {
164
166
  for (const m of batchMutations) {
165
- await tx.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [m.rowId, m.payload.title, m.payload.score, m.payload.metadata, m.payload.created_at]);
167
+ await tx.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [
168
+ m.rowId,
169
+ m.payload.title,
170
+ m.payload.score,
171
+ m.payload.metadata,
172
+ m.payload.created_at,
173
+ ]);
166
174
  }
167
175
  });
168
176
  }
@@ -189,10 +197,18 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
189
197
  created_at: new Date().toISOString(),
190
198
  };
191
199
  if (client?.insert) {
192
- await client.insert('_sync_bench_temp', `b-indiv-${i}`, payload, { skipOutbox: true });
200
+ await client.insert('_sync_bench_temp', `b-indiv-${i}`, payload, {
201
+ skipOutbox: true,
202
+ });
193
203
  }
194
204
  else {
195
- await db.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [`b-indiv-${i}`, payload.title, payload.score, payload.metadata, payload.created_at]);
205
+ await db.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [
206
+ `b-indiv-${i}`,
207
+ payload.title,
208
+ payload.score,
209
+ payload.metadata,
210
+ payload.created_at,
211
+ ]);
196
212
  }
197
213
  }
198
214
  const t2Duration = elapsed(t2Start);
@@ -216,7 +232,9 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
216
232
  metadata: makeMetadata(i, 'update'),
217
233
  };
218
234
  if (client?.update) {
219
- await client.update('_sync_bench_temp', `b-batch-${i}`, patch, { skipOutbox: true });
235
+ await client.update('_sync_bench_temp', `b-batch-${i}`, patch, {
236
+ skipOutbox: true,
237
+ });
220
238
  }
221
239
  else {
222
240
  await db.execute('UPDATE "_sync_bench_temp" SET title = ?, score = ?, metadata = ? WHERE id = ?', [patch.title, patch.score, patch.metadata, `b-batch-${i}`]);
@@ -350,10 +368,7 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
350
368
  }
351
369
  else {
352
370
  await db.transaction(async (tx) => {
353
- await tx.execute('INSERT INTO "_sync_bench_temp" (id, title) VALUES (?, ?)', [
354
- `rb-${c}`,
355
- 'Pre-rollback',
356
- ]);
371
+ await tx.execute('INSERT INTO "_sync_bench_temp" (id, title) VALUES (?, ?)', [`rb-${c}`, 'Pre-rollback']);
357
372
  throw new Error('INTENTIONAL_BENCHMARK_ROLLBACK');
358
373
  });
359
374
  }
@@ -411,10 +426,14 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
411
426
  const tDelStart = now();
412
427
  for (let i = 0; i < deleteCount; i++) {
413
428
  if (client?.delete) {
414
- await client.delete('_sync_bench_temp', `b-batch-${i}`, { skipOutbox: true });
429
+ await client.delete('_sync_bench_temp', `b-batch-${i}`, {
430
+ skipOutbox: true,
431
+ });
415
432
  }
416
433
  else {
417
- await db.execute('DELETE FROM "_sync_bench_temp" WHERE id = ?', [`b-batch-${i}`]);
434
+ await db.execute('DELETE FROM "_sync_bench_temp" WHERE id = ?', [
435
+ `b-batch-${i}`,
436
+ ]);
418
437
  }
419
438
  }
420
439
  const tDelDuration = elapsed(tDelStart);
@@ -434,7 +453,13 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
434
453
  const tConcStart = now();
435
454
  const writePromise = db.transaction(async (tx) => {
436
455
  for (let i = 0; i < concWriteCount; i++) {
437
- await tx.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [`wal-w-${i}`, `WAL Item ${i}`, i, '{"wal":true}', new Date().toISOString()]);
456
+ await tx.execute('INSERT INTO "_sync_bench_temp" (id, title, score, metadata, created_at) VALUES (?, ?, ?, ?, ?)', [
457
+ `wal-w-${i}`,
458
+ `WAL Item ${i}`,
459
+ i,
460
+ '{"wal":true}',
461
+ new Date().toISOString(),
462
+ ]);
438
463
  }
439
464
  });
440
465
  const readPromises = Array.from({ length: concReadCount }, (_, idx) => db.execute('SELECT COUNT(*) as c FROM "_sync_bench_temp" WHERE score >= ?', [idx % 50]));
@@ -454,7 +479,9 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
454
479
  const fuzzCount = scaleWorkload(1000);
455
480
  onProgress?.(`Testing resilient JSON fuzz hydration (${fuzzCount.toLocaleString()} cycles)...`, 0.99);
456
481
  const fuzzPayloads = [
457
- JSON.stringify({ nested: { title: 'Document 🏢', val: 42, tags: ['sync', 'offline'] } }),
482
+ JSON.stringify({
483
+ nested: { title: 'Document 🏢', val: 42, tags: ['sync', 'offline'] },
484
+ }),
458
485
  '{"corrupted": [1, 2, 3, {"unclosed": true',
459
486
  'plain-non-json-string',
460
487
  '{"nullValue": null, "boolean": false, "empty": {}}',
@@ -527,8 +554,12 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
527
554
  finally {
528
555
  await db.execute('DROP TABLE IF EXISTS "_sync_bench_tags"').catch(() => { });
529
556
  await db.execute('DROP TABLE IF EXISTS "_sync_bench_temp"').catch(() => { });
530
- await db.execute('DROP TABLE IF EXISTS "_sync_bench_outbox"').catch(() => { });
531
- await db.execute('DELETE FROM "sync_outbox" WHERE "tableName" LIKE ?', ['_sync%']).catch(() => { });
557
+ await db
558
+ .execute('DROP TABLE IF EXISTS "_sync_bench_outbox"')
559
+ .catch(() => { });
560
+ await db
561
+ .execute('DELETE FROM "sync_outbox" WHERE "tableName" LIKE ?', ['_sync%'])
562
+ .catch(() => { });
532
563
  }
533
564
  return list;
534
565
  }
@@ -536,7 +567,7 @@ async function runSQLiteBenchmark(clientOrDb, onProgress) {
536
567
  * Pure package-driven, full-height Performance Benchmark Modal.
537
568
  * Opens full-height with zero screen flickering or dynamic jumping.
538
569
  */
539
- function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
570
+ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto', }) {
540
571
  const [isRunning, setIsRunning] = (0, react_1.useState)(false);
541
572
  const [step, setStep] = (0, react_1.useState)('Idle');
542
573
  const [progress, setProgress] = (0, react_1.useState)(0);
@@ -575,7 +606,7 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
575
606
  '',
576
607
  '| Benchmark | Category | Operations | Duration | Throughput |',
577
608
  '| :--- | :--- | :--- | :--- | :--- |',
578
- ...results.map(r => `| ${r.name} | ${r.category} | ${r.operations.toLocaleString()} ops | ${r.durationMs} ms | ${r.opsPerSec.toLocaleString()} ops/s |`),
609
+ ...results.map((r) => `| ${r.name} | ${r.category} | ${r.operations.toLocaleString()} ops | ${r.durationMs} ms | ${r.opsPerSec.toLocaleString()} ops/s |`),
579
610
  ].join('\n');
580
611
  let isCopied = false;
581
612
  try {
@@ -599,32 +630,109 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
599
630
  return null;
600
631
  // React Native renderer (Full-height modal)
601
632
  if (RN && RN.View) {
602
- const { View, Text, TouchableOpacity, ScrollView, Modal, ActivityIndicator, Platform, StatusBar } = RN;
633
+ const { View, Text, TouchableOpacity, ScrollView, Modal, ActivityIndicator, Platform, StatusBar, } = RN;
603
634
  const SafeComp = RNSafeArea?.SafeAreaView || RN.SafeAreaView || View;
604
635
  const isAndroid = Platform?.OS === 'android';
605
- const statusBarHeight = isAndroid ? (StatusBar?.currentHeight || 24) : 0;
636
+ const statusBarHeight = isAndroid ? StatusBar?.currentHeight || 24 : 0;
606
637
  return ((0, jsx_runtime_1.jsx)(Modal, { visible: visible, animationType: "slide", presentationStyle: "fullScreen", statusBarTranslucent: true, onRequestClose: onDismiss, children: (0, jsx_runtime_1.jsxs)(SafeComp, { style: [styles.fullScreenSafe, { backgroundColor: currentTheme.bg }], edges: ['top', 'bottom', 'left', 'right'], children: [(0, jsx_runtime_1.jsxs)(View, { style: [
607
638
  styles.topBar,
608
- { backgroundColor: currentTheme.surface, borderBottomColor: currentTheme.border },
609
- !RNSafeArea?.SafeAreaView && isAndroid && { paddingTop: statusBarHeight + 10 },
610
- ], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.topBarTitle, { color: currentTheme.text }], children: "\u26A1 SQLite Benchmark" }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.topBarSub, { color: currentTheme.textMuted }], children: "Inbuilt local-lite throughput & ACID test suite" })] }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: onDismiss, style: [styles.closeCircle, { backgroundColor: currentTheme.actionBg }], activeOpacity: 0.7, children: (0, jsx_runtime_1.jsx)(Text, { style: [styles.closeCircleText, { color: currentTheme.actionText }], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsxs)(View, { style: [styles.progressSection, { backgroundColor: currentTheme.surface, borderBottomColor: currentTheme.border }], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 22 }, children: [isRunning && (0, jsx_runtime_1.jsx)(ActivityIndicator, { size: "small", color: "#8B5CF6" }), (0, jsx_runtime_1.jsx)(Text, { style: styles.stepText, numberOfLines: 1, children: isRunning ? step : results.length > 0 ? 'Benchmark complete!' : 'Ready to test' })] }), (0, jsx_runtime_1.jsx)(View, { style: [styles.progressTrack, { backgroundColor: currentTheme.border }], children: (0, jsx_runtime_1.jsx)(View, { style: [
639
+ {
640
+ backgroundColor: currentTheme.surface,
641
+ borderBottomColor: currentTheme.border,
642
+ },
643
+ !RNSafeArea?.SafeAreaView &&
644
+ isAndroid && { paddingTop: statusBarHeight + 10 },
645
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.topBarTitle, { color: currentTheme.text }], children: "\u26A1 SQLite Benchmark" }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.topBarSub, { color: currentTheme.textMuted }], children: "Inbuilt local-lite throughput & ACID test suite" })] }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: onDismiss, style: [
646
+ styles.closeCircle,
647
+ { backgroundColor: currentTheme.actionBg },
648
+ ], activeOpacity: 0.7, children: (0, jsx_runtime_1.jsx)(Text, { style: [
649
+ styles.closeCircleText,
650
+ { color: currentTheme.actionText },
651
+ ], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsxs)(View, { style: [
652
+ styles.progressSection,
653
+ {
654
+ backgroundColor: currentTheme.surface,
655
+ borderBottomColor: currentTheme.border,
656
+ },
657
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
658
+ flexDirection: 'row',
659
+ alignItems: 'center',
660
+ gap: 8,
661
+ minHeight: 22,
662
+ }, children: [isRunning && (0, jsx_runtime_1.jsx)(ActivityIndicator, { size: "small", color: "#8B5CF6" }), (0, jsx_runtime_1.jsx)(Text, { style: styles.stepText, numberOfLines: 1, children: isRunning
663
+ ? step
664
+ : results.length > 0
665
+ ? 'Benchmark complete!'
666
+ : 'Ready to test' })] }), (0, jsx_runtime_1.jsx)(View, { style: [
667
+ styles.progressTrack,
668
+ { backgroundColor: currentTheme.border },
669
+ ], children: (0, jsx_runtime_1.jsx)(View, { style: [
611
670
  styles.progressFill,
612
- { width: isRunning ? `${Math.round(progress * 100)}%` : results.length > 0 ? '100%' : '0%' },
671
+ {
672
+ width: isRunning
673
+ ? `${Math.round(progress * 100)}%`
674
+ : results.length > 0
675
+ ? '100%'
676
+ : '0%',
677
+ },
613
678
  ] }) })] }), (0, jsx_runtime_1.jsxs)(ScrollView, { style: [styles.scrollList, { backgroundColor: currentTheme.bg }], contentContainerStyle: styles.scrollContent, showsVerticalScrollIndicator: true, children: [results.length === 0 && !isRunning && ((0, jsx_runtime_1.jsxs)(View, { style: styles.emptyCard, children: [(0, jsx_runtime_1.jsx)(Text, { style: styles.emptyIcon, children: "\u26A1" }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.emptyTitle, { color: currentTheme.text }], children: "Run Real-Time Inbuilt Tests" }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.emptyText, { color: currentTheme.textMuted }], children: "Executes ACID transactions, constraint rollbacks, bulk UPSERTs, point lookups, and heavy payload I/O in an isolated temporary table." }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: startBenchmark, style: styles.primaryActionBtn, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: styles.primaryActionBtnText, children: "Start Benchmark" }) })] })), results.map((r, idx) => {
614
679
  const rating = r.opsPerSec > 5000
615
- ? { label: 'Blazing 🚀', color: '#10B981', bg: currentTheme.isDark ? '#064E3B' : '#D1FAE5' }
680
+ ? {
681
+ label: 'Blazing 🚀',
682
+ color: '#10B981',
683
+ bg: currentTheme.isDark ? '#064E3B' : '#D1FAE5',
684
+ }
616
685
  : r.opsPerSec > 500
617
- ? { label: 'Fast ⚡', color: '#8B5CF6', bg: currentTheme.isDark ? '#4C1D95' : '#EDE9FE' }
618
- : { label: 'Normal 👍', color: currentTheme.textMuted, bg: currentTheme.border };
619
- return ((0, jsx_runtime_1.jsxs)(View, { style: [styles.card, { backgroundColor: currentTheme.card, borderColor: currentTheme.border }], children: [(0, jsx_runtime_1.jsxs)(View, { style: styles.cardHeader, children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.cardTitle, { color: currentTheme.text }], children: r.name }), (0, jsx_runtime_1.jsx)(View, { style: [styles.badge, { backgroundColor: rating.bg }], children: (0, jsx_runtime_1.jsx)(Text, { style: [styles.badgeText, { color: rating.color }], children: rating.label }) })] }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.cardDesc, { color: currentTheme.textMuted }], children: r.description }), r.note && ((0, jsx_runtime_1.jsx)(Text, { style: [styles.cardDesc, { color: currentTheme.textMuted }], children: r.note })), (0, jsx_runtime_1.jsxs)(View, { style: [styles.cardMetrics, { borderTopColor: currentTheme.border }], children: [(0, jsx_runtime_1.jsxs)(View, { children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.metricLabel, { color: currentTheme.textMuted }], children: "Duration" }), (0, jsx_runtime_1.jsxs)(Text, { style: [styles.metricVal, { color: currentTheme.text }], children: [r.durationMs, " ms"] })] }), (0, jsx_runtime_1.jsxs)(View, { style: { alignItems: 'flex-end' }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.metricLabel, { color: currentTheme.textMuted }], children: "Throughput" }), (0, jsx_runtime_1.jsxs)(Text, { style: [styles.metricVal, { color: '#8B5CF6' }], children: [r.opsPerSec.toLocaleString(), " ops/s"] })] })] })] }, idx));
686
+ ? {
687
+ label: 'Fast ⚡',
688
+ color: '#8B5CF6',
689
+ bg: currentTheme.isDark ? '#4C1D95' : '#EDE9FE',
690
+ }
691
+ : {
692
+ label: 'Normal 👍',
693
+ color: currentTheme.textMuted,
694
+ bg: currentTheme.border,
695
+ };
696
+ return ((0, jsx_runtime_1.jsxs)(View, { style: [
697
+ styles.card,
698
+ {
699
+ backgroundColor: currentTheme.card,
700
+ borderColor: currentTheme.border,
701
+ },
702
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: styles.cardHeader, children: [(0, jsx_runtime_1.jsx)(Text, { style: [styles.cardTitle, { color: currentTheme.text }], children: r.name }), (0, jsx_runtime_1.jsx)(View, { style: [styles.badge, { backgroundColor: rating.bg }], children: (0, jsx_runtime_1.jsx)(Text, { style: [styles.badgeText, { color: rating.color }], children: rating.label }) })] }), (0, jsx_runtime_1.jsx)(Text, { style: [styles.cardDesc, { color: currentTheme.textMuted }], children: r.description }), r.note && ((0, jsx_runtime_1.jsx)(Text, { style: [
703
+ styles.cardDesc,
704
+ { color: currentTheme.textMuted },
705
+ ], children: r.note })), (0, jsx_runtime_1.jsxs)(View, { style: [
706
+ styles.cardMetrics,
707
+ { borderTopColor: currentTheme.border },
708
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { children: [(0, jsx_runtime_1.jsx)(Text, { style: [
709
+ styles.metricLabel,
710
+ { color: currentTheme.textMuted },
711
+ ], children: "Duration" }), (0, jsx_runtime_1.jsxs)(Text, { style: [styles.metricVal, { color: currentTheme.text }], children: [r.durationMs, " ms"] })] }), (0, jsx_runtime_1.jsxs)(View, { style: { alignItems: 'flex-end' }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [
712
+ styles.metricLabel,
713
+ { color: currentTheme.textMuted },
714
+ ], children: "Throughput" }), (0, jsx_runtime_1.jsxs)(Text, { style: [styles.metricVal, { color: '#8B5CF6' }], children: [r.opsPerSec.toLocaleString(), " ops/s"] })] })] })] }, idx));
620
715
  })] }), (0, jsx_runtime_1.jsxs)(View, { style: [
621
716
  styles.bottomBar,
622
- { backgroundColor: currentTheme.surface, borderTopColor: currentTheme.border },
717
+ {
718
+ backgroundColor: currentTheme.surface,
719
+ borderTopColor: currentTheme.border,
720
+ },
623
721
  !RNSafeArea?.SafeAreaView && isAndroid && { paddingBottom: 32 },
624
722
  ], children: [(0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: startBenchmark, disabled: isRunning, style: [
625
723
  styles.footerBtn,
626
724
  { backgroundColor: isRunning ? '#6D28D9' : '#8B5CF6' },
627
- ], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: styles.footerBtnText, children: isRunning ? 'Running Benchmark...' : results.length > 0 ? 'Re-run Benchmark' : 'Run Benchmark' }) }), results.length > 0 && ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: copyReport, style: [styles.footerBtn, { backgroundColor: currentTheme.actionBg, flex: 0.8 }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [styles.footerBtnText, { color: currentTheme.actionText }], children: copied ? '✓ Copied' : 'Copy Report' }) }))] })] }) }));
725
+ ], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: styles.footerBtnText, children: isRunning
726
+ ? 'Running Benchmark...'
727
+ : results.length > 0
728
+ ? 'Re-run Benchmark'
729
+ : 'Run Benchmark' }) }), results.length > 0 && ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: copyReport, style: [
730
+ styles.footerBtn,
731
+ { backgroundColor: currentTheme.actionBg, flex: 0.8 },
732
+ ], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [
733
+ styles.footerBtnText,
734
+ { color: currentTheme.actionText },
735
+ ], children: copied ? '✓ Copied' : 'Copy Report' }) }))] })] }) }));
628
736
  }
629
737
  // Web / DOM Full-screen Overlay Renderer
630
738
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
@@ -643,7 +751,12 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
643
751
  padding: '16px 24px',
644
752
  borderBottom: `1px solid ${currentTheme.border}`,
645
753
  backgroundColor: currentTheme.surface,
646
- }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { style: { margin: 0, fontSize: 18, fontWeight: 700, color: currentTheme.text }, children: "\u26A1 SQLite Benchmark" }), (0, jsx_runtime_1.jsx)("span", { style: { fontSize: 12, color: currentTheme.textMuted }, children: "Inbuilt local-lite throughput & ACID test suite" })] }), (0, jsx_runtime_1.jsx)("button", { onClick: onDismiss, style: {
754
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { style: {
755
+ margin: 0,
756
+ fontSize: 18,
757
+ fontWeight: 700,
758
+ color: currentTheme.text,
759
+ }, children: "\u26A1 SQLite Benchmark" }), (0, jsx_runtime_1.jsx)("span", { style: { fontSize: 12, color: currentTheme.textMuted }, children: "Inbuilt local-lite throughput & ACID test suite" })] }), (0, jsx_runtime_1.jsx)("button", { onClick: onDismiss, style: {
647
760
  background: currentTheme.actionBg,
648
761
  border: 'none',
649
762
  color: currentTheme.actionText,
@@ -652,12 +765,43 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
652
765
  borderRadius: 16,
653
766
  cursor: 'pointer',
654
767
  fontSize: 16,
655
- }, children: "\u2715" })] }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: '12px 24px', borderBottom: `1px solid ${currentTheme.border}`, backgroundColor: currentTheme.surface }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 12, color: '#A78BFA', marginBottom: 6 }, children: isRunning ? step : 'Ready' }), (0, jsx_runtime_1.jsx)("div", { style: { width: '100%', height: 6, backgroundColor: currentTheme.border, borderRadius: 3, overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)("div", { style: {
656
- width: isRunning ? `${Math.round(progress * 100)}%` : results.length > 0 ? '100%' : '0%',
768
+ }, children: "\u2715" })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
769
+ padding: '12px 24px',
770
+ borderBottom: `1px solid ${currentTheme.border}`,
771
+ backgroundColor: currentTheme.surface,
772
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 12, color: '#A78BFA', marginBottom: 6 }, children: isRunning ? step : 'Ready' }), (0, jsx_runtime_1.jsx)("div", { style: {
773
+ width: '100%',
774
+ height: 6,
775
+ backgroundColor: currentTheme.border,
776
+ borderRadius: 3,
777
+ overflow: 'hidden',
778
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
779
+ width: isRunning
780
+ ? `${Math.round(progress * 100)}%`
781
+ : results.length > 0
782
+ ? '100%'
783
+ : '0%',
657
784
  height: '100%',
658
785
  backgroundColor: '#8B5CF6',
659
786
  transition: 'width 0.2s',
660
- } }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, overflowY: 'auto', padding: 24, display: 'flex', flexDirection: 'column', gap: 12, backgroundColor: currentTheme.bg }, children: [results.length === 0 && !isRunning && ((0, jsx_runtime_1.jsxs)("div", { style: { textAlign: 'center', padding: '60px 20px', color: currentTheme.textMuted }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 48, marginBottom: 16 }, children: "\u26A1" }), (0, jsx_runtime_1.jsx)("h3", { style: { color: currentTheme.text, margin: '0 0 8px 0' }, children: "Run Inbuilt Performance Benchmark" }), (0, jsx_runtime_1.jsx)("p", { style: { maxWidth: 460, margin: '0 auto 20px auto', fontSize: 13, color: currentTheme.textMuted }, children: "Tests ACID transactions, constraint rollbacks, bulk UPSERTs, point lookups, and heavy payload I/O directly against your database." }), (0, jsx_runtime_1.jsx)("button", { onClick: startBenchmark, style: {
787
+ } }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
788
+ flex: 1,
789
+ overflowY: 'auto',
790
+ padding: 24,
791
+ display: 'flex',
792
+ flexDirection: 'column',
793
+ gap: 12,
794
+ backgroundColor: currentTheme.bg,
795
+ }, children: [results.length === 0 && !isRunning && ((0, jsx_runtime_1.jsxs)("div", { style: {
796
+ textAlign: 'center',
797
+ padding: '60px 20px',
798
+ color: currentTheme.textMuted,
799
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 48, marginBottom: 16 }, children: "\u26A1" }), (0, jsx_runtime_1.jsx)("h3", { style: { color: currentTheme.text, margin: '0 0 8px 0' }, children: "Run Inbuilt Performance Benchmark" }), (0, jsx_runtime_1.jsx)("p", { style: {
800
+ maxWidth: 460,
801
+ margin: '0 auto 20px auto',
802
+ fontSize: 13,
803
+ color: currentTheme.textMuted,
804
+ }, children: "Tests ACID transactions, constraint rollbacks, bulk UPSERTs, point lookups, and heavy payload I/O directly against your database." }), (0, jsx_runtime_1.jsx)("button", { onClick: startBenchmark, style: {
661
805
  padding: '10px 24px',
662
806
  backgroundColor: '#8B5CF6',
663
807
  color: '#FFF',
@@ -670,7 +814,39 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
670
814
  border: `1px solid ${currentTheme.border}`,
671
815
  borderRadius: 12,
672
816
  padding: 16,
673
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 6 }, children: [(0, jsx_runtime_1.jsx)("span", { style: { fontWeight: 700, fontSize: 14, color: currentTheme.text }, children: r.name }), (0, jsx_runtime_1.jsxs)("span", { style: { fontSize: 11, fontWeight: 700, color: '#8B5CF6', backgroundColor: currentTheme.isDark ? '#8B5CF625' : '#EDE9FE', padding: '2px 8px', borderRadius: 10 }, children: [r.opsPerSec.toLocaleString(), " ops/s"] })] }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 12, color: currentTheme.textMuted, marginBottom: 10 }, children: r.description }), r.note && ((0, jsx_runtime_1.jsx)("div", { style: { fontSize: 11, color: currentTheme.textMuted, marginBottom: 10 }, children: r.note })), (0, jsx_runtime_1.jsxs)("div", { style: { fontSize: 11, color: currentTheme.textMuted }, children: [r.operations.toLocaleString(), " ops in ", r.durationMs, "ms"] })] }, idx)))] }), (0, jsx_runtime_1.jsxs)("div", { style: { padding: '16px 24px', borderTop: `1px solid ${currentTheme.border}`, backgroundColor: currentTheme.surface, display: 'flex', gap: 12 }, children: [(0, jsx_runtime_1.jsx)("button", { onClick: startBenchmark, disabled: isRunning, style: {
817
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
818
+ display: 'flex',
819
+ justifyContent: 'space-between',
820
+ alignItems: 'center',
821
+ marginBottom: 6,
822
+ }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
823
+ fontWeight: 700,
824
+ fontSize: 14,
825
+ color: currentTheme.text,
826
+ }, children: r.name }), (0, jsx_runtime_1.jsxs)("span", { style: {
827
+ fontSize: 11,
828
+ fontWeight: 700,
829
+ color: '#8B5CF6',
830
+ backgroundColor: currentTheme.isDark
831
+ ? '#8B5CF625'
832
+ : '#EDE9FE',
833
+ padding: '2px 8px',
834
+ borderRadius: 10,
835
+ }, children: [r.opsPerSec.toLocaleString(), " ops/s"] })] }), (0, jsx_runtime_1.jsx)("div", { style: {
836
+ fontSize: 12,
837
+ color: currentTheme.textMuted,
838
+ marginBottom: 10,
839
+ }, children: r.description }), r.note && ((0, jsx_runtime_1.jsx)("div", { style: {
840
+ fontSize: 11,
841
+ color: currentTheme.textMuted,
842
+ marginBottom: 10,
843
+ }, children: r.note })), (0, jsx_runtime_1.jsxs)("div", { style: { fontSize: 11, color: currentTheme.textMuted }, children: [r.operations.toLocaleString(), " ops in ", r.durationMs, "ms"] })] }, idx)))] }), (0, jsx_runtime_1.jsxs)("div", { style: {
844
+ padding: '16px 24px',
845
+ borderTop: `1px solid ${currentTheme.border}`,
846
+ backgroundColor: currentTheme.surface,
847
+ display: 'flex',
848
+ gap: 12,
849
+ }, children: [(0, jsx_runtime_1.jsx)("button", { onClick: startBenchmark, disabled: isRunning, style: {
674
850
  flex: 1,
675
851
  padding: '12px 18px',
676
852
  backgroundColor: isRunning ? '#6D28D9' : '#8B5CF6',
@@ -679,7 +855,11 @@ function BenchmarkModal({ client, visible, onDismiss, theme = 'auto' }) {
679
855
  borderRadius: 8,
680
856
  fontWeight: 700,
681
857
  cursor: 'pointer',
682
- }, children: isRunning ? 'Running Benchmark...' : results.length > 0 ? 'Re-run Benchmark' : 'Run Benchmark' }), results.length > 0 && ((0, jsx_runtime_1.jsx)("button", { onClick: copyReport, style: {
858
+ }, children: isRunning
859
+ ? 'Running Benchmark...'
860
+ : results.length > 0
861
+ ? 'Re-run Benchmark'
862
+ : 'Run Benchmark' }), results.length > 0 && ((0, jsx_runtime_1.jsx)("button", { onClick: copyReport, style: {
683
863
  padding: '12px 20px',
684
864
  backgroundColor: currentTheme.actionBg,
685
865
  color: currentTheme.actionText,