@rozenite/sqlite-plugin 1.7.0-rc.0

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 (56) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +20 -0
  3. package/README.md +102 -0
  4. package/dist/devtools/assets/panel-B3paLkwG.js +82 -0
  5. package/dist/devtools/assets/panel-CIU0JBOs.css +1 -0
  6. package/dist/devtools/panel.html +31 -0
  7. package/dist/react-native/chunks/bridge-values.cjs +5 -0
  8. package/dist/react-native/chunks/bridge-values.js +258 -0
  9. package/dist/react-native/chunks/index.require.cjs +1 -0
  10. package/dist/react-native/chunks/index.require.js +118 -0
  11. package/dist/react-native/chunks/useRozeniteSqlitePlugin.require.cjs +1 -0
  12. package/dist/react-native/chunks/useRozeniteSqlitePlugin.require.js +189 -0
  13. package/dist/react-native/index.cjs +1 -0
  14. package/dist/react-native/index.d.ts +178 -0
  15. package/dist/react-native/index.js +16 -0
  16. package/dist/rozenite.json +1 -0
  17. package/package.json +83 -0
  18. package/postcss.config.js +6 -0
  19. package/react-native.ts +55 -0
  20. package/rozenite.config.ts +8 -0
  21. package/src/react-native/adapters/__tests__/expo-sqlite.test.ts +94 -0
  22. package/src/react-native/adapters/expo-sqlite.ts +230 -0
  23. package/src/react-native/adapters/generic.ts +88 -0
  24. package/src/react-native/adapters/index.ts +9 -0
  25. package/src/react-native/sqlite-view.ts +24 -0
  26. package/src/react-native/useRozeniteSqlitePlugin.ts +262 -0
  27. package/src/shared/__tests__/bridge-values.test.ts +34 -0
  28. package/src/shared/__tests__/sql.test.ts +55 -0
  29. package/src/shared/bridge-values.ts +170 -0
  30. package/src/shared/protocol.ts +41 -0
  31. package/src/shared/sql.ts +420 -0
  32. package/src/shared/types.ts +81 -0
  33. package/src/ui/__tests__/sql-editor-utils.test.ts +135 -0
  34. package/src/ui/__tests__/sqlite-row-edit-value.test.ts +22 -0
  35. package/src/ui/__tests__/sqlite-row-mutations.test.ts +310 -0
  36. package/src/ui/__tests__/sqlite-table-column-order.test.ts +83 -0
  37. package/src/ui/__tests__/value-utils.test.tsx +12 -0
  38. package/src/ui/cell-detail-drawer.tsx +65 -0
  39. package/src/ui/globals.css +1415 -0
  40. package/src/ui/panel.tsx +2815 -0
  41. package/src/ui/query-result-table.tsx +199 -0
  42. package/src/ui/sql-editor-utils.ts +352 -0
  43. package/src/ui/sql-editor.tsx +509 -0
  44. package/src/ui/sqlite-data-table.tsx +296 -0
  45. package/src/ui/sqlite-introspection.ts +189 -0
  46. package/src/ui/sqlite-modal-controls.tsx +32 -0
  47. package/src/ui/sqlite-row-delete-modal.tsx +130 -0
  48. package/src/ui/sqlite-row-edit-modal.tsx +487 -0
  49. package/src/ui/sqlite-row-edit-value.ts +53 -0
  50. package/src/ui/sqlite-row-mutations.ts +246 -0
  51. package/src/ui/sqlite-table-column-order.ts +154 -0
  52. package/src/ui/use-sqlite-requests.ts +205 -0
  53. package/src/ui/utils.ts +107 -0
  54. package/src/ui/value-utils.tsx +162 -0
  55. package/tsconfig.json +36 -0
  56. package/vite.config.ts +20 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @rozenite/sqlite-plugin
2
+
3
+ ## 1.6.0
4
+
5
+ - Initial release.
6
+ - Added adapter-driven SQLite inspection for Rozenite.
7
+ - Added an `expo-sqlite` adapter and query-first runtime bridge.
8
+ - Added Browse, Schema, and Query views for registered databases.
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Szymon Chmal
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ ![rozenite-banner](https://www.rozenite.dev/rozenite-banner.jpg)
2
+
3
+ ### A Rozenite plugin for inspecting SQLite databases in React Native DevTools.
4
+
5
+ The SQLite Plugin provides a query-first inspector for registered SQLite databases. It ships with an `expo-sqlite` adapter and supports custom adapters for any SQLite-like library that can execute ordered SQL statements and return normalized metadata for each statement.
6
+
7
+ ![SQLite Plugin](https://rozenite.dev/sqlite-plugin.png)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @rozenite/sqlite-plugin
13
+ ```
14
+
15
+ Optional peer for the built-in Expo adapter:
16
+
17
+ ```bash
18
+ npm install expo-sqlite
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```ts
24
+ import * as SQLite from 'expo-sqlite';
25
+ import {
26
+ createExpoSqliteAdapter,
27
+ useRozeniteSqlitePlugin,
28
+ } from '@rozenite/sqlite-plugin';
29
+
30
+ const adapters = __DEV__
31
+ ? [
32
+ createExpoSqliteAdapter({
33
+ adapterName: 'Expo SQLite',
34
+ databases: {
35
+ app: {
36
+ name: 'app.db',
37
+ database: SQLite.openDatabaseSync('app.db'),
38
+ },
39
+ analytics: {
40
+ name: 'analytics.db',
41
+ database: SQLite.openDatabaseSync('analytics.db'),
42
+ },
43
+ },
44
+ }),
45
+ ]
46
+ : [];
47
+
48
+ function App() {
49
+ useRozeniteSqlitePlugin({ adapters });
50
+
51
+ return <YourApp />;
52
+ }
53
+ ```
54
+
55
+ ## Custom adapters
56
+
57
+ You can support any SQLite-like library by normalizing its statement execution API:
58
+
59
+ ```ts
60
+ import { createSqliteAdapter } from '@rozenite/sqlite-plugin';
61
+
62
+ const adapters = [
63
+ createSqliteAdapter({
64
+ adapterName: 'My SQLite Driver',
65
+ databases: {
66
+ main: {
67
+ name: 'main.db',
68
+ executeStatements: async (statements) => {
69
+ const results = [];
70
+
71
+ for (const statement of statements) {
72
+ const result = await driver.query(statement.sql, statement.params);
73
+
74
+ results.push({
75
+ rows: result.rows,
76
+ columns: result.columns,
77
+ metadata: {
78
+ statementType: result.statementType,
79
+ rowCount: result.rows.length,
80
+ changes: result.changes,
81
+ lastInsertRowId: result.lastInsertRowId,
82
+ durationMs: result.durationMs,
83
+ },
84
+ });
85
+ }
86
+
87
+ return results;
88
+ },
89
+ },
90
+ },
91
+ }),
92
+ ];
93
+ ```
94
+
95
+ ## Notes
96
+
97
+ - Register adapters in development only. The hook no-ops in production, but your app-level database setup should still stay behind `__DEV__`.
98
+ - The SQL editor executes multi-statement scripts in order and stops on the first error.
99
+ - Custom adapters receive the full ordered statement array for scripts. To preserve per-statement failure details, throw an error enriched with `completedResults` and `failedStatementIndex`.
100
+ - Explicit `BEGIN`, `COMMIT`, and `ROLLBACK` statements are preserved as written. The plugin does not wrap scripts in an implicit transaction.
101
+ - The UI derives tables, schema, and browse views from SQL and `PRAGMA` queries.
102
+ - Database display names are shown in the panel; opaque IDs are generated internally.