database-devtools 0.1.2 → 0.1.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.
- package/README.md +13 -0
- package/dist/adapter/index.js +0 -1
- package/dist/adapters/sqlite/index.js +0 -1
- package/dist/{chunk-7UY2LDRW.js → chunk-KIQ3TEVO.js} +35 -40
- package/dist/chunk-KIQ3TEVO.js.map +1 -0
- package/dist/client/index.js +0 -1
- package/dist/client/index.js.map +1 -1
- package/dist/index.cjs +34 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -2
- package/dist/inspector/index.js +0 -1
- package/dist/inspectors/sqlite/index.cjs +1 -1
- package/dist/inspectors/sqlite/index.cjs.map +1 -1
- package/dist/inspectors/sqlite/index.js +1 -2
- package/dist/inspectors/sqlite/index.js.map +1 -1
- package/dist/native.cjs +34 -43
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +1 -2
- package/dist/server/index.js +0 -1
- package/dist/types/protocol.js +0 -1
- package/dist/web/assets/{index-DogMAkgu.js → index-Cyrcn84h.js} +27 -27
- package/dist/web/index.html +1 -1
- package/dist/web/sql-wasm.wasm +0 -0
- package/package.json +6 -3
- package/dist/chunk-7UY2LDRW.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -10
- package/dist/chunk-DGUM43GV.js.map +0 -1
package/README.md
CHANGED
|
@@ -94,3 +94,16 @@ For **local development only**. The hub listens on `0.0.0.0`. The RN overlay is
|
|
|
94
94
|
## License
|
|
95
95
|
|
|
96
96
|
MIT © [tamangRajkumar/database-devtools](https://github.com/tamangRajkumar/database-devtools)
|
|
97
|
+
|
|
98
|
+
## Publishing (maintainers)
|
|
99
|
+
|
|
100
|
+
The npm package ships **two artifacts**: the JS library (`dist/*.js`) and the static browser hub (`dist/web/` including `sql-wasm.wasm`).
|
|
101
|
+
|
|
102
|
+
Always run the **full** build before publishing:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm build # from monorepo root
|
|
106
|
+
pnpm --filter database-devtools publish --no-git-checks --otp=CODE
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Do **not** run `tsup` alone — it wipes `dist/` and does not rebuild the web UI. `prepublishOnly` will fail if `dist/web` or wasm assets are missing.
|
package/dist/adapter/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { AdapterResolutionError, registerBuiltInAdapters, resolveAdapter } from '../chunk-BLOSGEQV.js';
|
|
2
2
|
export { AdapterRegistry, getAdapterRegistry, resetAdapterRegistry } from '../chunk-I65IM47D.js';
|
|
3
3
|
import '../chunk-HIDZTOJ3.js';
|
|
4
|
-
import '../chunk-DGUM43GV.js';
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import '../../chunk-O6AO7KHA.js';
|
|
2
2
|
export { buildDeleteSql, buildInsertSql, buildUpdateSql, createExpoSqliteAdapter, detectExpoSqlite, detectExpoSqliteInspectable, quoteIdentifier, registerSqliteAdapter, sqliteAdapterDefinition } from '../../chunk-I65IM47D.js';
|
|
3
3
|
import '../../chunk-HIDZTOJ3.js';
|
|
4
|
-
import '../../chunk-DGUM43GV.js';
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -3,9 +3,10 @@ import { generateDeviceId } from './chunk-AZECU6D7.js';
|
|
|
3
3
|
import { DevToolsRole, REFRESH_TIMEOUT_MS, buildDevToolsWsUrl, DEFAULT_DEVTOOLS_PORT } from './chunk-CPVVIH5G.js';
|
|
4
4
|
import { resolveAdapter } from './chunk-BLOSGEQV.js';
|
|
5
5
|
import { detectExpoSqliteInspectable } from './chunk-I65IM47D.js';
|
|
6
|
-
import {
|
|
7
|
-
import { StyleSheet, View, useWindowDimensions, PanResponder, Pressable, Modal, Text, ActivityIndicator, ScrollView, TextInput, Platform, FlatList } from 'react-native';
|
|
6
|
+
import { StyleSheet, View, useWindowDimensions, PanResponder, Pressable, Modal, Text, ActivityIndicator, ScrollView, TextInput, Platform, FlatList, NativeModules } from 'react-native';
|
|
8
7
|
import { createContext, useState, useMemo, useRef, useCallback, useEffect, useContext } from 'react';
|
|
8
|
+
import Constants from 'expo-constants';
|
|
9
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
9
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
11
|
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
11
12
|
|
|
@@ -334,8 +335,6 @@ function useDevTools() {
|
|
|
334
335
|
}
|
|
335
336
|
return context;
|
|
336
337
|
}
|
|
337
|
-
|
|
338
|
-
// src/utils/resolveDevToolsHost.ts
|
|
339
338
|
var ANDROID_LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
|
|
340
339
|
var ANDROID_EMULATOR_HOST = "10.0.2.2";
|
|
341
340
|
function isAndroidLoopbackHost(host) {
|
|
@@ -376,20 +375,10 @@ function getConnectionHintForPlatform(platformOs, serverUrl) {
|
|
|
376
375
|
return null;
|
|
377
376
|
}
|
|
378
377
|
function getPlatformOs() {
|
|
379
|
-
|
|
380
|
-
const { Platform: Platform2 } = __require("react-native");
|
|
381
|
-
return Platform2.OS;
|
|
382
|
-
} catch {
|
|
383
|
-
return "web";
|
|
384
|
-
}
|
|
378
|
+
return Platform.OS;
|
|
385
379
|
}
|
|
386
380
|
function readMetroDevHostRuntime() {
|
|
387
|
-
|
|
388
|
-
const mod = __require("expo-constants");
|
|
389
|
-
return readMetroDevHostFromConstants(mod.default);
|
|
390
|
-
} catch {
|
|
391
|
-
return void 0;
|
|
392
|
-
}
|
|
381
|
+
return readMetroDevHostFromConstants(Constants);
|
|
393
382
|
}
|
|
394
383
|
function resolveDevToolsHost() {
|
|
395
384
|
return resolveDevToolsHostFromInputs(getPlatformOs(), readMetroDevHostRuntime());
|
|
@@ -398,12 +387,7 @@ function getConnectionHint(serverUrl) {
|
|
|
398
387
|
return getConnectionHintForPlatform(getPlatformOs(), serverUrl);
|
|
399
388
|
}
|
|
400
389
|
function getExpoConstants() {
|
|
401
|
-
|
|
402
|
-
const mod = __require("expo-constants");
|
|
403
|
-
return mod.default;
|
|
404
|
-
} catch {
|
|
405
|
-
return void 0;
|
|
406
|
-
}
|
|
390
|
+
return Constants;
|
|
407
391
|
}
|
|
408
392
|
function resolveDeviceMetadata() {
|
|
409
393
|
const constants = getExpoConstants();
|
|
@@ -440,33 +424,40 @@ function resolveServerUrl(serverUrl) {
|
|
|
440
424
|
}
|
|
441
425
|
return buildDevToolsWsUrl(resolveDevToolsHost(), DEFAULT_DEVTOOLS_PORT);
|
|
442
426
|
}
|
|
443
|
-
|
|
444
|
-
// src/utils/persistDeviceId.ts
|
|
445
427
|
var PERSISTED_DEVICE_ID_STORAGE_KEY = "@database-devtools/device-id";
|
|
446
428
|
var memoryDeviceId = null;
|
|
429
|
+
function hasAsyncStorageNativeModule() {
|
|
430
|
+
return Boolean(
|
|
431
|
+
NativeModules.RNCAsyncStorage ?? NativeModules.RNC_AsyncSQLiteDBStoragePassThru ?? NativeModules.PlatformLocalStorage
|
|
432
|
+
);
|
|
433
|
+
}
|
|
447
434
|
function createAsyncStorageDeviceIdStore() {
|
|
448
|
-
|
|
449
|
-
const AsyncStorage = __require("@react-native-async-storage/async-storage").default;
|
|
450
|
-
return AsyncStorage;
|
|
451
|
-
} catch {
|
|
435
|
+
if (!hasAsyncStorageNativeModule()) {
|
|
452
436
|
return null;
|
|
453
437
|
}
|
|
438
|
+
return AsyncStorage;
|
|
454
439
|
}
|
|
455
|
-
|
|
456
|
-
if (storage) {
|
|
457
|
-
const stored = await storage.getItem(PERSISTED_DEVICE_ID_STORAGE_KEY);
|
|
458
|
-
if (stored) {
|
|
459
|
-
return stored;
|
|
460
|
-
}
|
|
461
|
-
const created = generateDeviceId();
|
|
462
|
-
await storage.setItem(PERSISTED_DEVICE_ID_STORAGE_KEY, created);
|
|
463
|
-
return created;
|
|
464
|
-
}
|
|
440
|
+
function loadOrCreateMemoryDeviceId() {
|
|
465
441
|
if (!memoryDeviceId) {
|
|
466
442
|
memoryDeviceId = generateDeviceId();
|
|
467
443
|
}
|
|
468
444
|
return memoryDeviceId;
|
|
469
445
|
}
|
|
446
|
+
async function loadOrCreateDeviceId(storage = createAsyncStorageDeviceIdStore()) {
|
|
447
|
+
if (storage) {
|
|
448
|
+
try {
|
|
449
|
+
const stored = await storage.getItem(PERSISTED_DEVICE_ID_STORAGE_KEY);
|
|
450
|
+
if (stored) {
|
|
451
|
+
return stored;
|
|
452
|
+
}
|
|
453
|
+
const created = generateDeviceId();
|
|
454
|
+
await storage.setItem(PERSISTED_DEVICE_ID_STORAGE_KEY, created);
|
|
455
|
+
return created;
|
|
456
|
+
} catch {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return loadOrCreateMemoryDeviceId();
|
|
460
|
+
}
|
|
470
461
|
function DevToolsProvider({
|
|
471
462
|
children,
|
|
472
463
|
database,
|
|
@@ -589,6 +580,10 @@ function DevToolsProvider({
|
|
|
589
580
|
setDeviceId(persistedId);
|
|
590
581
|
setDeviceIdReady(true);
|
|
591
582
|
}
|
|
583
|
+
}).catch(() => {
|
|
584
|
+
if (!cancelled) {
|
|
585
|
+
setDeviceIdReady(true);
|
|
586
|
+
}
|
|
592
587
|
});
|
|
593
588
|
return () => {
|
|
594
589
|
cancelled = true;
|
|
@@ -2735,5 +2730,5 @@ function DatabaseDevTools({
|
|
|
2735
2730
|
}
|
|
2736
2731
|
|
|
2737
2732
|
export { DatabaseDevTools, createExpoSqliteInspector, handleBeginTransaction, handleCommitTransaction, handleExecuteWrite, handleRollbackTransaction, isEditableDatabaseAdapter, isWritableDatabaseAdapter };
|
|
2738
|
-
//# sourceMappingURL=chunk-
|
|
2739
|
-
//# sourceMappingURL=chunk-
|
|
2733
|
+
//# sourceMappingURL=chunk-KIQ3TEVO.js.map
|
|
2734
|
+
//# sourceMappingURL=chunk-KIQ3TEVO.js.map
|