@rozenite/sqlite-plugin 1.7.0 → 1.8.1
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/CHANGELOG.md +20 -0
- package/dist/devtools/assets/{panel-B3paLkwG.js → panel-DjRs5NTl.js} +28 -28
- package/dist/devtools/panel.html +1 -1
- package/dist/react-native/chunks/useRozeniteSqlitePlugin.require.cjs +1 -1
- package/dist/react-native/chunks/useRozeniteSqlitePlugin.require.js +208 -97
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.d.ts +1 -1
- package/dist/react-native/index.js +2 -2
- package/dist/rozenite.json +1 -1
- package/package.json +6 -5
- package/react-native.ts +1 -1
- package/src/react-native/useRozeniteSqlitePlugin.ts +3 -0
- package/src/react-native/useSqliteAgentTools.ts +152 -0
- package/vite.config.ts +3 -0
package/dist/devtools/panel.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<script>
|
|
23
23
|
var __ROZENITE_PANEL__ = true;
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="../devtools/assets/panel-
|
|
25
|
+
<script type="module" crossorigin src="../devtools/assets/panel-DjRs5NTl.js"></script>
|
|
26
26
|
<link rel="stylesheet" crossorigin href="../devtools/assets/panel-CIU0JBOs.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@rozenite/plugin-bridge"),y=require("react"),g=require("./bridge-values.cjs"),E=require("@rozenite/agent-bridge"),M="@rozenite/sqlite-plugin",T=r=>r.flatMap(p=>p.databases.map(t=>({id:t.id,name:t.name,adapterId:p.id,adapterName:p.name,executeStatements:t.executeStatements}))),b="@rozenite/sqlite-plugin",v={name:"list-databases",description:"List all registered SQLite databases.",inputSchema:{type:"object",properties:{}}},z={name:"execute-sql",description:"Execute one or more SQL statements against a database. Supports SELECT, INSERT, UPDATE, DELETE, PRAGMA, DDL, and multi-statement scripts. Returns per-statement results including rows, columns, and metadata. Statements are executed in order and stop on first error.",inputSchema:{type:"object",properties:{databaseId:{type:"string",description:"Database ID from list-databases."},sql:{type:"string",description:"SQL to execute. May contain multiple semicolon-separated statements."}},required:["databaseId","sql"]}},I=r=>r instanceof Error&&("completedResults"in r||"failedStatementIndex"in r),L=r=>{const p=y.useCallback(t=>{const u=r.find(m=>m.id===t);if(!u){const m=r.map(c=>c.id).join(", ");throw new Error(`Unknown databaseId "${t}". Available: ${m||"(none)"}`)}return u},[r]);E.useRozenitePluginAgentTool({pluginId:b,tool:v,handler:()=>({databases:r.map(({id:t,name:u,adapterId:m,adapterName:c})=>({id:t,name:u,adapterId:m,adapterName:c}))})}),E.useRozenitePluginAgentTool({pluginId:b,tool:z,handler:async({databaseId:t,sql:u})=>{const m=p(t),c=g.splitSqlStatements(u);if(c.length===0)throw new Error("SQL cannot be empty.");const q=c.map(i=>({sql:g.normalizeSingleStatementSql(i.text)}));try{const i=await m.executeStatements(q);return{databaseId:t,totalStatementCount:c.length,failedStatementIndex:null,statements:c.map((S,n)=>{const e=i[n];return{index:n,sql:q[n].sql,rows:e.rows,columns:e.columns,metadata:e.metadata}})}}catch(i){if(!I(i))throw new Error(g.formatSqliteError(i));const S=Math.max(0,Math.min(typeof i.failedStatementIndex=="number"?i.failedStatementIndex:i.completedResults?.length??0,c.length-1)),n=(i.completedResults??[]).slice(0,S);return{databaseId:t,totalStatementCount:c.length,failedStatementIndex:S,statements:[...n.map((e,o)=>({index:o,sql:q[o].sql,rows:e.rows,columns:e.columns,metadata:e.metadata})),{index:S,sql:q[S].sql,error:g.formatSqliteError(i)}]}}}})},x=r=>g.formatSqliteError(r),P=r=>r instanceof Error&&("completedResults"in r||"failedStatementIndex"in r),A=({adapters:r})=>{const p=y.useMemo(()=>T(r),[r]);L(p);const t=D.useRozeniteDevToolsClient({pluginId:M}),u=y.useRef([]),m=y.useRef(new Map);return y.useEffect(()=>{if(!t)return;const c=async(n,e)=>{const a=(m.current.get(n)??Promise.resolve()).catch(()=>{}).then(e);return m.current.set(n,a.then(()=>{},()=>{})),a},q=n=>{const e=p.find(o=>o.id===n);if(!e)throw new Error(`Unknown database "${n}".`);return e},i=async(n,e)=>{const o=q(n),a=e.map(({sql:h,params:l})=>({sql:g.normalizeSingleStatementSql(h),params:l})),s=await o.executeStatements(a);if(s.length!==a.length)throw new Error(`Expected ${a.length} statement result(s), received ${s.length}.`);return{inputs:a,results:s}},S=async(n,e,o)=>{const s=(await i(n,[{sql:e,params:o}])).results[0];if(!s)throw new Error("The query completed without a result payload.");return s};return t.send("sqlite:ready",{timestamp:Date.now()}),u.current.push(t.onMessage("sqlite:list-databases",({requestId:n})=>{t.send("sqlite:list-databases:result",{requestId:n,databases:p.map(({id:e,name:o,adapterId:a,adapterName:s})=>({id:e,name:o,adapterId:a,adapterName:s}))})})),u.current.push(t.onMessage("sqlite:query",async({requestId:n,databaseId:e,sql:o,params:a})=>{try{const s=await c(e,()=>S(e,o,a));t.send("sqlite:query:result",{requestId:n,databaseId:e,result:s})}catch(s){t.send("sqlite:query:result",{requestId:n,databaseId:e,error:x(s)})}})),u.current.push(t.onMessage("sqlite:execute-script",async({requestId:n,databaseId:e,sql:o})=>{try{const a=await c(e,async()=>{const s=g.splitSqlStatements(o);if(s.length===0)throw new Error("Query cannot be empty.");const h=s.map(l=>({sql:l.text}));try{const l=await i(e,h);return{statements:s.map((d,f)=>({index:f,start:d.start,end:d.end,input:l.inputs[f],execution:{input:l.inputs[f],result:l.results[f]}})),totalStatementCount:s.length,failedStatementIndex:null}}catch(l){if(!P(l))throw l;const d=Math.max(0,Math.min(typeof l.failedStatementIndex=="number"?l.failedStatementIndex:l.completedResults?.length??0,s.length-1));return{statements:[...(l.completedResults??[]).slice(0,d).map((R,w)=>({index:w,start:s[w].start,end:s[w].end,input:h[w],execution:{input:h[w],result:R}})),{index:d,start:s[d].start,end:s[d].end,input:h[d],error:x(l)}],totalStatementCount:s.length,failedStatementIndex:d}}});t.send("sqlite:execute-script:result",{requestId:n,databaseId:e,result:a})}catch(a){t.send("sqlite:execute-script:result",{requestId:n,databaseId:e,error:x(a)})}})),()=>{u.current.forEach(n=>n.remove()),u.current=[],m.current.clear()}},[t,p]),t};exports.useRozeniteSqlitePlugin=A;
|
|
@@ -1,27 +1,138 @@
|
|
|
1
|
-
import { useRozeniteDevToolsClient as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useRozeniteDevToolsClient as T } from "@rozenite/plugin-bridge";
|
|
2
|
+
import { useCallback as v, useMemo as I, useRef as y, useEffect as L } from "react";
|
|
3
|
+
import { a as R, n as D, f as x } from "./bridge-values.js";
|
|
4
|
+
import { useRozenitePluginAgentTool as E } from "@rozenite/agent-bridge";
|
|
5
|
+
const z = "@rozenite/sqlite-plugin", C = (a) => a.flatMap(
|
|
6
|
+
(p) => p.databases.map((e) => ({
|
|
7
|
+
id: e.id,
|
|
8
|
+
name: e.name,
|
|
9
|
+
adapterId: p.id,
|
|
10
|
+
adapterName: p.name,
|
|
11
|
+
executeStatements: e.executeStatements
|
|
11
12
|
}))
|
|
12
|
-
),
|
|
13
|
-
|
|
13
|
+
), b = "@rozenite/sqlite-plugin", Q = {
|
|
14
|
+
name: "list-databases",
|
|
15
|
+
description: "List all registered SQLite databases.",
|
|
16
|
+
inputSchema: { type: "object", properties: {} }
|
|
17
|
+
}, A = {
|
|
18
|
+
name: "execute-sql",
|
|
19
|
+
description: "Execute one or more SQL statements against a database. Supports SELECT, INSERT, UPDATE, DELETE, PRAGMA, DDL, and multi-statement scripts. Returns per-statement results including rows, columns, and metadata. Statements are executed in order and stop on first error.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
databaseId: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Database ID from list-databases."
|
|
26
|
+
},
|
|
27
|
+
sql: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "SQL to execute. May contain multiple semicolon-separated statements."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: ["databaseId", "sql"]
|
|
33
|
+
}
|
|
34
|
+
}, P = (a) => a instanceof Error && ("completedResults" in a || "failedStatementIndex" in a), $ = (a) => {
|
|
35
|
+
const p = v(
|
|
36
|
+
(e) => {
|
|
37
|
+
const u = a.find((m) => m.id === e);
|
|
38
|
+
if (!u) {
|
|
39
|
+
const m = a.map((i) => i.id).join(", ");
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Unknown databaseId "${e}". Available: ${m || "(none)"}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return u;
|
|
45
|
+
},
|
|
46
|
+
[a]
|
|
47
|
+
);
|
|
48
|
+
E({
|
|
49
|
+
pluginId: b,
|
|
50
|
+
tool: Q,
|
|
51
|
+
handler: () => ({
|
|
52
|
+
databases: a.map(({ id: e, name: u, adapterId: m, adapterName: i }) => ({
|
|
53
|
+
id: e,
|
|
54
|
+
name: u,
|
|
55
|
+
adapterId: m,
|
|
56
|
+
adapterName: i
|
|
57
|
+
}))
|
|
58
|
+
})
|
|
59
|
+
}), E({
|
|
60
|
+
pluginId: b,
|
|
61
|
+
tool: A,
|
|
62
|
+
handler: async ({ databaseId: e, sql: u }) => {
|
|
63
|
+
const m = p(e), i = R(u);
|
|
64
|
+
if (i.length === 0)
|
|
65
|
+
throw new Error("SQL cannot be empty.");
|
|
66
|
+
const h = i.map((c) => ({
|
|
67
|
+
sql: D(c.text)
|
|
68
|
+
}));
|
|
69
|
+
try {
|
|
70
|
+
const c = await m.executeStatements(h);
|
|
71
|
+
return {
|
|
72
|
+
databaseId: e,
|
|
73
|
+
totalStatementCount: i.length,
|
|
74
|
+
failedStatementIndex: null,
|
|
75
|
+
statements: i.map((S, n) => {
|
|
76
|
+
const t = c[n];
|
|
77
|
+
return {
|
|
78
|
+
index: n,
|
|
79
|
+
sql: h[n].sql,
|
|
80
|
+
rows: t.rows,
|
|
81
|
+
columns: t.columns,
|
|
82
|
+
metadata: t.metadata
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
} catch (c) {
|
|
87
|
+
if (!P(c))
|
|
88
|
+
throw new Error(x(c));
|
|
89
|
+
const S = Math.max(
|
|
90
|
+
0,
|
|
91
|
+
Math.min(
|
|
92
|
+
typeof c.failedStatementIndex == "number" ? c.failedStatementIndex : c.completedResults?.length ?? 0,
|
|
93
|
+
i.length - 1
|
|
94
|
+
)
|
|
95
|
+
), n = (c.completedResults ?? []).slice(
|
|
96
|
+
0,
|
|
97
|
+
S
|
|
98
|
+
);
|
|
99
|
+
return {
|
|
100
|
+
databaseId: e,
|
|
101
|
+
totalStatementCount: i.length,
|
|
102
|
+
failedStatementIndex: S,
|
|
103
|
+
statements: [
|
|
104
|
+
...n.map((t, o) => ({
|
|
105
|
+
index: o,
|
|
106
|
+
sql: h[o].sql,
|
|
107
|
+
rows: t.rows,
|
|
108
|
+
columns: t.columns,
|
|
109
|
+
metadata: t.metadata
|
|
110
|
+
})),
|
|
111
|
+
{
|
|
112
|
+
index: S,
|
|
113
|
+
sql: h[S].sql,
|
|
114
|
+
error: x(c)
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}, w = (a) => x(a), k = (a) => a instanceof Error && ("completedResults" in a || "failedStatementIndex" in a), V = ({
|
|
122
|
+
adapters: a
|
|
14
123
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
124
|
+
const p = I(() => C(a), [a]);
|
|
125
|
+
$(p);
|
|
126
|
+
const e = T({
|
|
127
|
+
pluginId: z
|
|
128
|
+
}), u = y([]), m = y(/* @__PURE__ */ new Map());
|
|
129
|
+
return L(() => {
|
|
130
|
+
if (!e)
|
|
20
131
|
return;
|
|
21
|
-
const
|
|
22
|
-
const r = (
|
|
132
|
+
const i = async (n, t) => {
|
|
133
|
+
const r = (m.current.get(n) ?? Promise.resolve()).catch(() => {
|
|
23
134
|
}).then(t);
|
|
24
|
-
return
|
|
135
|
+
return m.current.set(
|
|
25
136
|
n,
|
|
26
137
|
r.then(
|
|
27
138
|
() => {
|
|
@@ -30,160 +141,160 @@ const b = "@rozenite/sqlite-plugin", C = (u) => u.flatMap(
|
|
|
30
141
|
}
|
|
31
142
|
)
|
|
32
143
|
), r;
|
|
33
|
-
},
|
|
34
|
-
const t =
|
|
144
|
+
}, h = (n) => {
|
|
145
|
+
const t = p.find((o) => o.id === n);
|
|
35
146
|
if (!t)
|
|
36
147
|
throw new Error(`Unknown database "${n}".`);
|
|
37
148
|
return t;
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
sql:
|
|
41
|
-
params:
|
|
42
|
-
})),
|
|
43
|
-
if (
|
|
149
|
+
}, c = async (n, t) => {
|
|
150
|
+
const o = h(n), r = t.map(({ sql: f, params: l }) => ({
|
|
151
|
+
sql: D(f),
|
|
152
|
+
params: l
|
|
153
|
+
})), s = await o.executeStatements(r);
|
|
154
|
+
if (s.length !== r.length)
|
|
44
155
|
throw new Error(
|
|
45
|
-
`Expected ${r.length} statement result(s), received ${
|
|
156
|
+
`Expected ${r.length} statement result(s), received ${s.length}.`
|
|
46
157
|
);
|
|
47
158
|
return {
|
|
48
159
|
inputs: r,
|
|
49
|
-
results:
|
|
160
|
+
results: s
|
|
50
161
|
};
|
|
51
|
-
},
|
|
52
|
-
const
|
|
162
|
+
}, S = async (n, t, o) => {
|
|
163
|
+
const s = (await c(n, [
|
|
53
164
|
{
|
|
54
165
|
sql: t,
|
|
55
|
-
params:
|
|
166
|
+
params: o
|
|
56
167
|
}
|
|
57
168
|
])).results[0];
|
|
58
|
-
if (!
|
|
169
|
+
if (!s)
|
|
59
170
|
throw new Error("The query completed without a result payload.");
|
|
60
|
-
return
|
|
171
|
+
return s;
|
|
61
172
|
};
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
|
|
173
|
+
return e.send("sqlite:ready", { timestamp: Date.now() }), u.current.push(
|
|
174
|
+
e.onMessage("sqlite:list-databases", ({ requestId: n }) => {
|
|
175
|
+
e.send("sqlite:list-databases:result", {
|
|
65
176
|
requestId: n,
|
|
66
|
-
databases:
|
|
177
|
+
databases: p.map(({ id: t, name: o, adapterId: r, adapterName: s }) => ({
|
|
67
178
|
id: t,
|
|
68
|
-
name:
|
|
179
|
+
name: o,
|
|
69
180
|
adapterId: r,
|
|
70
|
-
adapterName:
|
|
181
|
+
adapterName: s
|
|
71
182
|
}))
|
|
72
183
|
});
|
|
73
184
|
})
|
|
74
|
-
),
|
|
75
|
-
|
|
185
|
+
), u.current.push(
|
|
186
|
+
e.onMessage(
|
|
76
187
|
"sqlite:query",
|
|
77
|
-
async ({ requestId: n, databaseId: t, sql:
|
|
188
|
+
async ({ requestId: n, databaseId: t, sql: o, params: r }) => {
|
|
78
189
|
try {
|
|
79
|
-
const
|
|
190
|
+
const s = await i(
|
|
80
191
|
t,
|
|
81
|
-
() =>
|
|
192
|
+
() => S(t, o, r)
|
|
82
193
|
);
|
|
83
|
-
|
|
194
|
+
e.send("sqlite:query:result", {
|
|
84
195
|
requestId: n,
|
|
85
196
|
databaseId: t,
|
|
86
|
-
result:
|
|
197
|
+
result: s
|
|
87
198
|
});
|
|
88
|
-
} catch (
|
|
89
|
-
|
|
199
|
+
} catch (s) {
|
|
200
|
+
e.send("sqlite:query:result", {
|
|
90
201
|
requestId: n,
|
|
91
202
|
databaseId: t,
|
|
92
|
-
error:
|
|
203
|
+
error: w(s)
|
|
93
204
|
});
|
|
94
205
|
}
|
|
95
206
|
}
|
|
96
207
|
)
|
|
97
|
-
),
|
|
98
|
-
|
|
208
|
+
), u.current.push(
|
|
209
|
+
e.onMessage(
|
|
99
210
|
"sqlite:execute-script",
|
|
100
|
-
async ({ requestId: n, databaseId: t, sql:
|
|
211
|
+
async ({ requestId: n, databaseId: t, sql: o }) => {
|
|
101
212
|
try {
|
|
102
|
-
const r = await
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
213
|
+
const r = await i(t, async () => {
|
|
214
|
+
const s = R(o);
|
|
215
|
+
if (s.length === 0)
|
|
105
216
|
throw new Error("Query cannot be empty.");
|
|
106
|
-
const
|
|
107
|
-
sql:
|
|
217
|
+
const f = s.map((l) => ({
|
|
218
|
+
sql: l.text
|
|
108
219
|
}));
|
|
109
220
|
try {
|
|
110
|
-
const
|
|
221
|
+
const l = await c(
|
|
111
222
|
t,
|
|
112
|
-
|
|
223
|
+
f
|
|
113
224
|
);
|
|
114
225
|
return {
|
|
115
|
-
statements:
|
|
116
|
-
index:
|
|
117
|
-
start:
|
|
118
|
-
end:
|
|
119
|
-
input:
|
|
226
|
+
statements: s.map((d, q) => ({
|
|
227
|
+
index: q,
|
|
228
|
+
start: d.start,
|
|
229
|
+
end: d.end,
|
|
230
|
+
input: l.inputs[q],
|
|
120
231
|
execution: {
|
|
121
|
-
input:
|
|
122
|
-
result:
|
|
232
|
+
input: l.inputs[q],
|
|
233
|
+
result: l.results[q]
|
|
123
234
|
}
|
|
124
235
|
})),
|
|
125
|
-
totalStatementCount:
|
|
236
|
+
totalStatementCount: s.length,
|
|
126
237
|
failedStatementIndex: null
|
|
127
238
|
};
|
|
128
|
-
} catch (
|
|
129
|
-
if (!
|
|
130
|
-
throw
|
|
131
|
-
const
|
|
239
|
+
} catch (l) {
|
|
240
|
+
if (!k(l))
|
|
241
|
+
throw l;
|
|
242
|
+
const d = Math.max(
|
|
132
243
|
0,
|
|
133
244
|
Math.min(
|
|
134
|
-
typeof
|
|
135
|
-
|
|
245
|
+
typeof l.failedStatementIndex == "number" ? l.failedStatementIndex : l.completedResults?.length ?? 0,
|
|
246
|
+
s.length - 1
|
|
136
247
|
)
|
|
137
248
|
);
|
|
138
249
|
return {
|
|
139
250
|
statements: [
|
|
140
|
-
...(
|
|
251
|
+
...(l.completedResults ?? []).slice(
|
|
141
252
|
0,
|
|
142
|
-
|
|
253
|
+
d
|
|
143
254
|
).map(
|
|
144
|
-
(
|
|
145
|
-
index:
|
|
146
|
-
start:
|
|
147
|
-
end:
|
|
148
|
-
input:
|
|
255
|
+
(M, g) => ({
|
|
256
|
+
index: g,
|
|
257
|
+
start: s[g].start,
|
|
258
|
+
end: s[g].end,
|
|
259
|
+
input: f[g],
|
|
149
260
|
execution: {
|
|
150
|
-
input:
|
|
151
|
-
result:
|
|
261
|
+
input: f[g],
|
|
262
|
+
result: M
|
|
152
263
|
}
|
|
153
264
|
})
|
|
154
265
|
),
|
|
155
266
|
{
|
|
156
|
-
index:
|
|
157
|
-
start:
|
|
158
|
-
end:
|
|
159
|
-
input:
|
|
160
|
-
error:
|
|
267
|
+
index: d,
|
|
268
|
+
start: s[d].start,
|
|
269
|
+
end: s[d].end,
|
|
270
|
+
input: f[d],
|
|
271
|
+
error: w(l)
|
|
161
272
|
}
|
|
162
273
|
],
|
|
163
|
-
totalStatementCount:
|
|
164
|
-
failedStatementIndex:
|
|
274
|
+
totalStatementCount: s.length,
|
|
275
|
+
failedStatementIndex: d
|
|
165
276
|
};
|
|
166
277
|
}
|
|
167
278
|
});
|
|
168
|
-
|
|
279
|
+
e.send("sqlite:execute-script:result", {
|
|
169
280
|
requestId: n,
|
|
170
281
|
databaseId: t,
|
|
171
282
|
result: r
|
|
172
283
|
});
|
|
173
284
|
} catch (r) {
|
|
174
|
-
|
|
285
|
+
e.send("sqlite:execute-script:result", {
|
|
175
286
|
requestId: n,
|
|
176
287
|
databaseId: t,
|
|
177
|
-
error:
|
|
288
|
+
error: w(r)
|
|
178
289
|
});
|
|
179
290
|
}
|
|
180
291
|
}
|
|
181
292
|
)
|
|
182
293
|
), () => {
|
|
183
|
-
|
|
294
|
+
u.current.forEach((n) => n.remove()), u.current = [], m.current.clear();
|
|
184
295
|
};
|
|
185
|
-
}, [
|
|
296
|
+
}, [e, p]), e;
|
|
186
297
|
};
|
|
187
298
|
export {
|
|
188
|
-
|
|
299
|
+
V as useRozeniteSqlitePlugin
|
|
189
300
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.createSqliteAdapter=void 0;exports.createExpoSqliteAdapter=void 0;exports.useRozeniteSqlitePlugin=void 0;const t=typeof window<"u"&&window.navigator.product!=="ReactNative",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.createSqliteAdapter=void 0;exports.createExpoSqliteAdapter=void 0;exports.useRozeniteSqlitePlugin=void 0;const t=process.env.NODE_ENV!=="production",i=typeof window<"u"&&window.navigator.product!=="ReactNative",a=typeof window>"u";t&&!i&&!a?(exports.createSqliteAdapter=require("./chunks/index.require.cjs").createSqliteAdapter,exports.createExpoSqliteAdapter=require("./chunks/index.require.cjs").createExpoSqliteAdapter,exports.useRozeniteSqlitePlugin=require("./chunks/useRozeniteSqlitePlugin.require.cjs").useRozeniteSqlitePlugin):(exports.createSqliteAdapter=e=>({id:e.adapterId??"sqlite",name:e.adapterName??"SQLite",databases:[]}),exports.createExpoSqliteAdapter=e=>({id:e.adapterId??"expo-sqlite",name:e.adapterName??"Expo SQLite",databases:[]}),exports.useRozeniteSqlitePlugin=()=>null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let t, a, i;
|
|
2
|
-
const r = typeof window < "u" && window.navigator.product !== "ReactNative",
|
|
3
|
-
|
|
2
|
+
const r = process.env.NODE_ENV !== "production", d = typeof window < "u" && window.navigator.product !== "ReactNative", n = typeof window > "u";
|
|
3
|
+
r && !d && !n ? (t = require("./chunks/index.require.js").createSqliteAdapter, a = require("./chunks/index.require.js").createExpoSqliteAdapter, i = require("./chunks/useRozeniteSqlitePlugin.require.js").useRozeniteSqlitePlugin) : (t = (e) => ({
|
|
4
4
|
id: e.adapterId ?? "sqlite",
|
|
5
5
|
name: e.adapterName ?? "SQLite",
|
|
6
6
|
databases: []
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@rozenite/sqlite-plugin","version":"1.
|
|
1
|
+
{"name":"@rozenite/sqlite-plugin","version":"1.8.1","description":"SQLite inspector for Rozenite.","panels":[{"name":"SQLite","source":"/devtools/panel.html"}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/sqlite-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "SQLite inspector for Rozenite.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/react-native/index.cjs",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"url": "https://github.com/callstackincubator/rozenite.git"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@rozenite/
|
|
18
|
+
"@rozenite/agent-bridge": "1.8.1",
|
|
19
|
+
"@rozenite/plugin-bridge": "1.8.1"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"@dnd-kit/core": "^6.3.1",
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
"typescript": "~5.9.3",
|
|
49
50
|
"vite": "^7.3.1",
|
|
50
51
|
"vitest": "^3.2.4",
|
|
51
|
-
"@rozenite/vite-plugin": "1.
|
|
52
|
-
"rozenite": "1.
|
|
52
|
+
"@rozenite/vite-plugin": "1.8.1",
|
|
53
|
+
"rozenite": "1.8.1"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"expo-sqlite": "*",
|
|
@@ -78,6 +79,6 @@
|
|
|
78
79
|
"dev": "rozenite dev",
|
|
79
80
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
80
81
|
"lint": "eslint .",
|
|
81
|
-
"test": "vitest --run"
|
|
82
|
+
"test": "vitest --run --passWithNoTests"
|
|
82
83
|
}
|
|
83
84
|
}
|
package/react-native.ts
CHANGED
|
@@ -28,9 +28,9 @@ export let createSqliteAdapter: CreateSqliteAdapter;
|
|
|
28
28
|
export let createExpoSqliteAdapter: CreateExpoSqliteAdapter;
|
|
29
29
|
export let useRozeniteSqlitePlugin: typeof import('./src/react-native/useRozeniteSqlitePlugin').useRozeniteSqlitePlugin;
|
|
30
30
|
|
|
31
|
+
const isDev = process.env.NODE_ENV !== 'production';
|
|
31
32
|
const isWeb =
|
|
32
33
|
typeof window !== 'undefined' && window.navigator.product !== 'ReactNative';
|
|
33
|
-
const isDev = process.env.NODE_ENV !== 'production';
|
|
34
34
|
const isServer = typeof window === 'undefined';
|
|
35
35
|
|
|
36
36
|
if (isDev && !isWeb && !isServer) {
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
SqliteStatementInput,
|
|
11
11
|
} from '../shared/types';
|
|
12
12
|
import { createSqliteDatabaseViews } from './sqlite-view';
|
|
13
|
+
import { useSqliteAgentTools } from './useSqliteAgentTools';
|
|
13
14
|
|
|
14
15
|
export type RozeniteSqlitePluginOptions = {
|
|
15
16
|
adapters: SqliteAdapter[];
|
|
@@ -27,6 +28,8 @@ export const useRozeniteSqlitePlugin = ({
|
|
|
27
28
|
adapters,
|
|
28
29
|
}: RozeniteSqlitePluginOptions) => {
|
|
29
30
|
const views = useMemo(() => createSqliteDatabaseViews(adapters), [adapters]);
|
|
31
|
+
|
|
32
|
+
useSqliteAgentTools(views);
|
|
30
33
|
const client = useRozeniteDevToolsClient<SqliteEventMap>({
|
|
31
34
|
pluginId: PLUGIN_ID,
|
|
32
35
|
});
|