database-devtools 0.1.0 → 0.1.2

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 (53) hide show
  1. package/README.md +96 -0
  2. package/dist/DatabaseDevTools-CdpQJBqG.d.ts +39 -0
  3. package/dist/DatabaseDevTools-sw1wX5nW.d.cts +39 -0
  4. package/dist/adapter/index.d.cts +3 -3
  5. package/dist/adapter/index.d.ts +3 -3
  6. package/dist/{adapter-BjJm71wW.d.cts → adapter-DQyQ5ycj.d.cts} +1 -1
  7. package/dist/{adapter-DJSjDewg.d.ts → adapter-cIF5P6qI.d.ts} +1 -1
  8. package/dist/adapters/sqlite/index.d.cts +4 -4
  9. package/dist/adapters/sqlite/index.d.ts +4 -4
  10. package/dist/chunk-7UY2LDRW.js +2739 -0
  11. package/dist/chunk-7UY2LDRW.js.map +1 -0
  12. package/dist/chunk-S4Z7A4TW.js +116 -0
  13. package/dist/chunk-S4Z7A4TW.js.map +1 -0
  14. package/dist/{chunk-ZS5MZR75.js → chunk-UNVCJMJK.js} +4 -114
  15. package/dist/chunk-UNVCJMJK.js.map +1 -0
  16. package/dist/client/index.d.cts +4 -3
  17. package/dist/client/index.d.ts +4 -3
  18. package/dist/client/index.js +2 -1
  19. package/dist/client/index.js.map +1 -1
  20. package/dist/{createDevToolsServer-B7NQ_5H4.d.cts → createDevToolsServer-Cqb7xzIv.d.cts} +1 -1
  21. package/dist/{createDevToolsServer-DlNMoCJR.d.ts → createDevToolsServer-D3QnP8Yb.d.ts} +1 -1
  22. package/dist/{handleDeviceSnapshot-cYGuitSc.d.cts → handleDeviceSnapshot-CIZ_00fE.d.cts} +2 -50
  23. package/dist/{handleDeviceSnapshot-CR-4QMdk.d.ts → handleDeviceSnapshot-DF9sS1Pm.d.ts} +2 -50
  24. package/dist/index.d.cts +13 -45
  25. package/dist/index.d.ts +13 -45
  26. package/dist/index.js +8 -2741
  27. package/dist/index.js.map +1 -1
  28. package/dist/inspector/index.d.cts +2 -2
  29. package/dist/inspector/index.d.ts +2 -2
  30. package/dist/inspectors/sqlite/index.d.cts +2 -2
  31. package/dist/inspectors/sqlite/index.d.ts +2 -2
  32. package/dist/native.cjs +3946 -0
  33. package/dist/native.cjs.map +1 -0
  34. package/dist/native.d.cts +37 -0
  35. package/dist/native.d.ts +37 -0
  36. package/dist/native.js +13 -0
  37. package/dist/native.js.map +1 -0
  38. package/dist/{register-BuicFu9L.d.cts → register-DEZ0kK1p.d.cts} +2 -2
  39. package/dist/{register-aITLN9Q9.d.ts → register-Dawue1_L.d.ts} +2 -2
  40. package/dist/resolveDeviceDatabaseUrl-DhRP-h1Y.d.cts +49 -0
  41. package/dist/resolveDeviceDatabaseUrl-DhRP-h1Y.d.ts +49 -0
  42. package/dist/server/index.d.cts +1 -1
  43. package/dist/server/index.d.ts +1 -1
  44. package/dist/{snapshot-Dhyecgo2.d.cts → snapshot-Dknp_qP1.d.cts} +1 -1
  45. package/dist/{snapshot-Dhyecgo2.d.ts → snapshot-Dknp_qP1.d.ts} +1 -1
  46. package/dist/{types-CKVRCX-e.d.ts → types-6nco_RRp.d.ts} +2 -2
  47. package/dist/{types-CIA11diJ.d.cts → types-BQHZtFwx.d.cts} +2 -2
  48. package/dist/{types-CF6qEU-_.d.ts → types-DkVlU6t-.d.ts} +2 -2
  49. package/dist/{types-BRLJdBRY.d.cts → types-gT3gDw_T.d.cts} +2 -2
  50. package/dist/web/assets/{index-DQrPRTOy.js → index-DogMAkgu.js} +1 -1
  51. package/dist/web/index.html +1 -1
  52. package/package.json +22 -12
  53. package/dist/chunk-ZS5MZR75.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # database-devtools
2
+
3
+ [![npm version](https://img.shields.io/npm/v/database-devtools.svg)](https://www.npmjs.com/package/database-devtools)
4
+ [![license](https://img.shields.io/npm/l/database-devtools.svg)](https://github.com/tamangRajkumar/database-devtools/blob/master/LICENSE)
5
+
6
+ > Inspect and debug **SQLite** in **React Native** and **Expo** apps from your browser — browse tables, run SQL, and edit live data on connected devices.
7
+
8
+ **database-devtools** is a Chrome DevTools-like toolkit for mobile app databases. Add one component to your app, run `npx database-devtools` on your machine, and inspect your local SQLite database in a full browser UI.
9
+
10
+ ## Features
11
+
12
+ - **React Native SQLite inspector** — zero-config [expo-sqlite](https://docs.expo.dev/versions/latest/sdk/sqlite/) auto-detection
13
+ - **Expo & React Native debugging** — floating dev overlay in your app during development
14
+ - **Browser database explorer** — tables, schema, paginated rows, search, and sort
15
+ - **SQL workspace** — run queries with history, favorites, and export (TSV, CSV, JSON)
16
+ - **Edit mode** — transactional inserts, updates, and deletes on the live device database
17
+ - **Offline exports** — snapshot saved per app; inspect even when the device disconnects
18
+ - **Single npm install** — no extra inspector packages required
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install database-devtools expo-sqlite
24
+ ```
25
+
26
+ Peer dependencies: `react`, `react-native`, `expo-sqlite`.
27
+
28
+ ## Quick start — React Native / Expo
29
+
30
+ ```tsx
31
+ import * as SQLite from 'expo-sqlite';
32
+ import { DatabaseDevTools } from 'database-devtools';
33
+
34
+ const db = await SQLite.openDatabaseAsync('myapp.db');
35
+
36
+ export function App() {
37
+ return (
38
+ <>
39
+ {/* your app */}
40
+ <DatabaseDevTools database={db} />
41
+ </>
42
+ );
43
+ }
44
+ ```
45
+
46
+ SQLite is auto-detected from the raw `expo-sqlite` instance. Optional:
47
+
48
+ ```tsx
49
+ <DatabaseDevTools database={db} type="sqlite" />
50
+ <DatabaseDevTools database={db} adapter={customAdapter} />
51
+ ```
52
+
53
+ ## Run the inspector hub
54
+
55
+ After installing, start the local hub and browser UI:
56
+
57
+ ```bash
58
+ npx database-devtools
59
+ ```
60
+
61
+ Opens [http://localhost:3847](http://localhost:3847). Connect your app (simulator, emulator, or physical device on the same network), then **Refresh** to pull a database snapshot.
62
+
63
+ ### Physical device
64
+
65
+ Point the mobile app at your machine's LAN IP:
66
+
67
+ ```bash
68
+ EXPO_PUBLIC_DATABASE_DEVTOOLS_URL=ws://192.168.1.10:3847/ws
69
+ ```
70
+
71
+ | Variable | Default | Purpose |
72
+ |----------|---------|---------|
73
+ | `DATABASE_DEVTOOLS_PORT` | `3847` | Hub and web UI port |
74
+ | `DATABASE_DEVTOOLS_NO_OPEN` | unset | Set to `1` to skip opening the browser |
75
+
76
+ ## Advanced exports
77
+
78
+ | Import | Use case |
79
+ |--------|----------|
80
+ | `database-devtools/adapters/sqlite` | Custom SQLite adapter wiring |
81
+ | `database-devtools/inspector-sqlite` | Browser-side sql.js inspector (custom UI) |
82
+ | `database-devtools/client` | WebSocket client for custom tools |
83
+ | `database-devtools/server` | Embed the hub in Node.js |
84
+
85
+ ## Documentation
86
+
87
+ - **Repository:** [github.com/tamangRajkumar/database-devtools](https://github.com/tamangRajkumar/database-devtools)
88
+ - **Issues:** [github.com/tamangRajkumar/database-devtools/issues](https://github.com/tamangRajkumar/database-devtools/issues)
89
+
90
+ ## Security
91
+
92
+ For **local development only**. The hub listens on `0.0.0.0`. The RN overlay is disabled in production by default (`__DEV__`). Edit mode writes to the live device database.
93
+
94
+ ## License
95
+
96
+ MIT © [tamangRajkumar/database-devtools](https://github.com/tamangRajkumar/database-devtools)
@@ -0,0 +1,39 @@
1
+ import { a as DatabaseKind } from './snapshot-Dknp_qP1.js';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { StyleProp, TextStyle } from 'react-native';
4
+ import { C as ConnectionState } from './handleDeviceSnapshot-DF9sS1Pm.js';
5
+ import { D as DatabaseAdapter } from './adapter-cIF5P6qI.js';
6
+
7
+ /** @deprecated Use `DatabaseKind` from `./kind` instead. */
8
+ type DatabaseDialect = DatabaseKind;
9
+
10
+ type FloatingButtonPosition = {
11
+ x: number;
12
+ y: number;
13
+ };
14
+
15
+ type DatabaseDevToolsProps = {
16
+ /** Raw database instance (auto-detected) or a resolved adapter. */
17
+ database?: unknown;
18
+ /** Explicit database kind override. */
19
+ type?: DatabaseKind;
20
+ /** Custom adapter override (advanced). */
21
+ adapter?: DatabaseAdapter;
22
+ serverUrl?: string;
23
+ enabled?: boolean;
24
+ position?: 'bottom-right' | 'bottom-left';
25
+ /** Allow dragging the floating button around the screen. */
26
+ draggable?: boolean;
27
+ /** Snap the button to screen edges after dragging. */
28
+ snapToEdges?: boolean;
29
+ /** Controlled floating button position. */
30
+ floatingPosition?: FloatingButtonPosition;
31
+ /** Called when the user drags the floating button to a new position. */
32
+ onFloatingPositionChange?: (position: FloatingButtonPosition) => void;
33
+ /** Optional style for the floating button database icon. */
34
+ style?: StyleProp<TextStyle>;
35
+ onConnectionStateChange?: (state: ConnectionState) => void;
36
+ };
37
+ declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
38
+
39
+ export { DatabaseDevTools as D, type FloatingButtonPosition as F, type DatabaseDevToolsProps as a, type DatabaseDialect as b };
@@ -0,0 +1,39 @@
1
+ import { a as DatabaseKind } from './snapshot-Dknp_qP1.cjs';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { StyleProp, TextStyle } from 'react-native';
4
+ import { C as ConnectionState } from './handleDeviceSnapshot-CIZ_00fE.cjs';
5
+ import { D as DatabaseAdapter } from './adapter-DQyQ5ycj.cjs';
6
+
7
+ /** @deprecated Use `DatabaseKind` from `./kind` instead. */
8
+ type DatabaseDialect = DatabaseKind;
9
+
10
+ type FloatingButtonPosition = {
11
+ x: number;
12
+ y: number;
13
+ };
14
+
15
+ type DatabaseDevToolsProps = {
16
+ /** Raw database instance (auto-detected) or a resolved adapter. */
17
+ database?: unknown;
18
+ /** Explicit database kind override. */
19
+ type?: DatabaseKind;
20
+ /** Custom adapter override (advanced). */
21
+ adapter?: DatabaseAdapter;
22
+ serverUrl?: string;
23
+ enabled?: boolean;
24
+ position?: 'bottom-right' | 'bottom-left';
25
+ /** Allow dragging the floating button around the screen. */
26
+ draggable?: boolean;
27
+ /** Snap the button to screen edges after dragging. */
28
+ snapToEdges?: boolean;
29
+ /** Controlled floating button position. */
30
+ floatingPosition?: FloatingButtonPosition;
31
+ /** Called when the user drags the floating button to a new position. */
32
+ onFloatingPositionChange?: (position: FloatingButtonPosition) => void;
33
+ /** Optional style for the floating button database icon. */
34
+ style?: StyleProp<TextStyle>;
35
+ onConnectionStateChange?: (state: ConnectionState) => void;
36
+ };
37
+ declare function DatabaseDevTools({ database, type, adapter, serverUrl, enabled, position, draggable, snapToEdges, floatingPosition, onFloatingPositionChange, style, onConnectionStateChange, }: DatabaseDevToolsProps): react_jsx_runtime.JSX.Element | null;
38
+
39
+ export { DatabaseDevTools as D, type FloatingButtonPosition as F, type DatabaseDevToolsProps as a, type DatabaseDialect as b };
@@ -1,6 +1,6 @@
1
- import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-BRLJdBRY.cjs';
2
- import { D as DatabaseKind } from '../snapshot-Dhyecgo2.cjs';
3
- import { D as DatabaseAdapter } from '../adapter-BjJm71wW.cjs';
1
+ import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-gT3gDw_T.cjs';
2
+ import { a as DatabaseKind } from '../snapshot-Dknp_qP1.cjs';
3
+ import { D as DatabaseAdapter } from '../adapter-DQyQ5ycj.cjs';
4
4
  import '../write-C3toEIMs.cjs';
5
5
 
6
6
  type SupportedDatabase = {
@@ -1,6 +1,6 @@
1
- import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-CF6qEU-_.js';
2
- import { D as DatabaseKind } from '../snapshot-Dhyecgo2.js';
3
- import { D as DatabaseAdapter } from '../adapter-DJSjDewg.js';
1
+ import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-DkVlU6t-.js';
2
+ import { a as DatabaseKind } from '../snapshot-Dknp_qP1.js';
3
+ import { D as DatabaseAdapter } from '../adapter-cIF5P6qI.js';
4
4
  import '../write-C3toEIMs.js';
5
5
 
6
6
  type SupportedDatabase = {
@@ -1,4 +1,4 @@
1
- import { D as DatabaseKind, A as AdapterCapabilities, S as SnapshotExport } from './snapshot-Dhyecgo2.cjs';
1
+ import { a as DatabaseKind, A as AdapterCapabilities, e as SnapshotExport } from './snapshot-Dknp_qP1.cjs';
2
2
  import { a as WriteOperation } from './write-C3toEIMs.cjs';
3
3
 
4
4
  /** Database adapter interface for export and write operations on the live device. */
@@ -1,4 +1,4 @@
1
- import { D as DatabaseKind, A as AdapterCapabilities, S as SnapshotExport } from './snapshot-Dhyecgo2.js';
1
+ import { a as DatabaseKind, A as AdapterCapabilities, e as SnapshotExport } from './snapshot-Dknp_qP1.js';
2
2
  import { a as WriteOperation } from './write-C3toEIMs.js';
3
3
 
4
4
  /** Database adapter interface for export and write operations on the live device. */
@@ -1,8 +1,8 @@
1
- export { C as CreateExpoSqliteAdapterOptions, E as ExpoSqliteDatabase, a as ExpoSqliteInspectableDatabase, c as createExpoSqliteAdapter, d as detectExpoSqlite, b as detectExpoSqliteInspectable, r as registerSqliteAdapter, s as sqliteAdapterDefinition } from '../../register-BuicFu9L.cjs';
1
+ export { C as CreateExpoSqliteAdapterOptions, E as ExpoSqliteDatabase, a as ExpoSqliteInspectableDatabase, c as createExpoSqliteAdapter, d as detectExpoSqlite, b as detectExpoSqliteInspectable, r as registerSqliteAdapter, s as sqliteAdapterDefinition } from '../../register-DEZ0kK1p.cjs';
2
2
  import { D as DeleteOperation, W as WriteCellValue, I as InsertOperation, U as UpdateOperation } from '../../write-C3toEIMs.cjs';
3
- import '../../adapter-BjJm71wW.cjs';
4
- import '../../snapshot-Dhyecgo2.cjs';
5
- import '../../types-BRLJdBRY.cjs';
3
+ import '../../adapter-DQyQ5ycj.cjs';
4
+ import '../../snapshot-Dknp_qP1.cjs';
5
+ import '../../types-gT3gDw_T.cjs';
6
6
 
7
7
  declare function quoteIdentifier(name: string): string;
8
8
  declare function buildInsertSql(operation: InsertOperation): {
@@ -1,8 +1,8 @@
1
- export { C as CreateExpoSqliteAdapterOptions, E as ExpoSqliteDatabase, a as ExpoSqliteInspectableDatabase, c as createExpoSqliteAdapter, d as detectExpoSqlite, b as detectExpoSqliteInspectable, r as registerSqliteAdapter, s as sqliteAdapterDefinition } from '../../register-aITLN9Q9.js';
1
+ export { C as CreateExpoSqliteAdapterOptions, E as ExpoSqliteDatabase, a as ExpoSqliteInspectableDatabase, c as createExpoSqliteAdapter, d as detectExpoSqlite, b as detectExpoSqliteInspectable, r as registerSqliteAdapter, s as sqliteAdapterDefinition } from '../../register-Dawue1_L.js';
2
2
  import { D as DeleteOperation, W as WriteCellValue, I as InsertOperation, U as UpdateOperation } from '../../write-C3toEIMs.js';
3
- import '../../adapter-DJSjDewg.js';
4
- import '../../snapshot-Dhyecgo2.js';
5
- import '../../types-CF6qEU-_.js';
3
+ import '../../adapter-cIF5P6qI.js';
4
+ import '../../snapshot-Dknp_qP1.js';
5
+ import '../../types-DkVlU6t-.js';
6
6
 
7
7
  declare function quoteIdentifier(name: string): string;
8
8
  declare function buildInsertSql(operation: InsertOperation): {