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.
- package/README.md +96 -0
- package/dist/DatabaseDevTools-CdpQJBqG.d.ts +39 -0
- package/dist/DatabaseDevTools-sw1wX5nW.d.cts +39 -0
- package/dist/adapter/index.d.cts +3 -3
- package/dist/adapter/index.d.ts +3 -3
- package/dist/{adapter-BjJm71wW.d.cts → adapter-DQyQ5ycj.d.cts} +1 -1
- package/dist/{adapter-DJSjDewg.d.ts → adapter-cIF5P6qI.d.ts} +1 -1
- package/dist/adapters/sqlite/index.d.cts +4 -4
- package/dist/adapters/sqlite/index.d.ts +4 -4
- package/dist/chunk-7UY2LDRW.js +2739 -0
- package/dist/chunk-7UY2LDRW.js.map +1 -0
- package/dist/chunk-S4Z7A4TW.js +116 -0
- package/dist/chunk-S4Z7A4TW.js.map +1 -0
- package/dist/{chunk-ZS5MZR75.js → chunk-UNVCJMJK.js} +4 -114
- package/dist/chunk-UNVCJMJK.js.map +1 -0
- package/dist/client/index.d.cts +4 -3
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/{createDevToolsServer-B7NQ_5H4.d.cts → createDevToolsServer-Cqb7xzIv.d.cts} +1 -1
- package/dist/{createDevToolsServer-DlNMoCJR.d.ts → createDevToolsServer-D3QnP8Yb.d.ts} +1 -1
- package/dist/{handleDeviceSnapshot-cYGuitSc.d.cts → handleDeviceSnapshot-CIZ_00fE.d.cts} +2 -50
- package/dist/{handleDeviceSnapshot-CR-4QMdk.d.ts → handleDeviceSnapshot-DF9sS1Pm.d.ts} +2 -50
- package/dist/index.d.cts +13 -45
- package/dist/index.d.ts +13 -45
- package/dist/index.js +8 -2741
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.cts +2 -2
- package/dist/inspector/index.d.ts +2 -2
- package/dist/inspectors/sqlite/index.d.cts +2 -2
- package/dist/inspectors/sqlite/index.d.ts +2 -2
- package/dist/native.cjs +3946 -0
- package/dist/native.cjs.map +1 -0
- package/dist/native.d.cts +37 -0
- package/dist/native.d.ts +37 -0
- package/dist/native.js +13 -0
- package/dist/native.js.map +1 -0
- package/dist/{register-BuicFu9L.d.cts → register-DEZ0kK1p.d.cts} +2 -2
- package/dist/{register-aITLN9Q9.d.ts → register-Dawue1_L.d.ts} +2 -2
- package/dist/resolveDeviceDatabaseUrl-DhRP-h1Y.d.cts +49 -0
- package/dist/resolveDeviceDatabaseUrl-DhRP-h1Y.d.ts +49 -0
- package/dist/server/index.d.cts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/{snapshot-Dhyecgo2.d.cts → snapshot-Dknp_qP1.d.cts} +1 -1
- package/dist/{snapshot-Dhyecgo2.d.ts → snapshot-Dknp_qP1.d.ts} +1 -1
- package/dist/{types-CKVRCX-e.d.ts → types-6nco_RRp.d.ts} +2 -2
- package/dist/{types-CIA11diJ.d.cts → types-BQHZtFwx.d.cts} +2 -2
- package/dist/{types-CF6qEU-_.d.ts → types-DkVlU6t-.d.ts} +2 -2
- package/dist/{types-BRLJdBRY.d.cts → types-gT3gDw_T.d.cts} +2 -2
- package/dist/web/assets/{index-DQrPRTOy.js → index-DogMAkgu.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +22 -12
- package/dist/chunk-ZS5MZR75.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# database-devtools
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/database-devtools)
|
|
4
|
+
[](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 };
|
package/dist/adapter/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-
|
|
2
|
-
import {
|
|
3
|
-
import { D as DatabaseAdapter } from '../adapter-
|
|
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 = {
|
package/dist/adapter/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AdapterDefinition, R as ResolveAdapterOptions } from '../types-
|
|
2
|
-
import {
|
|
3
|
-
import { D as DatabaseAdapter } from '../adapter-
|
|
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 {
|
|
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 {
|
|
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-
|
|
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-
|
|
4
|
-
import '../../snapshot-
|
|
5
|
-
import '../../types-
|
|
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-
|
|
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-
|
|
4
|
-
import '../../snapshot-
|
|
5
|
-
import '../../types-
|
|
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): {
|