@rozenite/storage-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 +30 -0
- package/README.md +6 -0
- package/dist/devtools/assets/{panel-9uIwTlU4.js → panel-eGOuOVos.js} +6 -6
- package/dist/devtools/panel.html +1 -1
- package/dist/react-native/chunks/async-storage.require.cjs +1 -0
- package/dist/react-native/chunks/async-storage.require.js +52 -0
- package/dist/react-native/chunks/index.require.cjs +1 -1
- package/dist/react-native/chunks/index.require.js +76 -159
- package/dist/react-native/chunks/secure-storage.require.cjs +1 -0
- package/dist/react-native/chunks/secure-storage.require.js +42 -0
- package/dist/react-native/chunks/useRozeniteStoragePlugin.require.cjs +1 -1
- package/dist/react-native/chunks/useRozeniteStoragePlugin.require.js +148 -135
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.d.ts +1 -1
- package/dist/react-native/index.js +20 -19
- package/dist/rozenite.json +1 -1
- package/dist/sdk/index.cjs +1 -0
- package/dist/sdk/index.d.ts +197 -0
- package/dist/sdk/index.js +113 -0
- package/package.json +14 -6
- package/react-native.ts +33 -21
- package/sdk.ts +44 -0
- package/src/react-native/useStorageAgentTools.ts +24 -146
- package/src/shared/agent-tools.ts +213 -0
- package/tsconfig.json +3 -1
- package/vite.config.ts +3 -0
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { useRozeniteDevToolsClient as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { g as
|
|
1
|
+
import { useRozeniteDevToolsClient as A } from "@rozenite/plugin-bridge";
|
|
2
|
+
import { useCallback as P, useMemo as T, useEffect as R } from "react";
|
|
3
|
+
import { g as k, s as M } from "./types.js";
|
|
4
4
|
import { useRozenitePluginAgentTool as l } from "@rozenite/agent-bridge";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { defineAgentToolContract as g } from "@rozenite/agent-shared";
|
|
6
|
+
const x = 1500, h = (e) => e.kind === "async", w = (e) => e.type === "buffer" ? `${e.type}:${e.value.join(",")}` : `${e.type}:${String(e.value)}`, N = (e) => new Map(e.map((t) => [t.key, t])), I = (e, t) => e.blacklist ? (e.blacklist.lastIndex = 0, e.blacklist.test(t)) : !1, z = (e, t, r) => {
|
|
7
|
+
if (!M(e, t))
|
|
7
8
|
throw new Error(
|
|
8
9
|
`Type "${t}" is not supported by storage "${r.storageId}" in adapter "${r.adapterId}".`
|
|
9
10
|
);
|
|
10
|
-
},
|
|
11
|
-
if (
|
|
11
|
+
}, b = async (e) => (h(e), e.getAllKeys()), E = async (e, t) => (h(e), e.get(t)), K = async (e, t) => {
|
|
12
|
+
if (h(e)) {
|
|
12
13
|
await e.set(t);
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
16
|
e.set(t);
|
|
16
|
-
},
|
|
17
|
-
if (
|
|
17
|
+
}, j = async (e, t) => {
|
|
18
|
+
if (h(e)) {
|
|
18
19
|
await e.delete(t);
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
e.delete(t);
|
|
22
|
-
},
|
|
23
|
+
}, S = async (e) => {
|
|
23
24
|
const t = await e();
|
|
24
|
-
return
|
|
25
|
-
},
|
|
25
|
+
return N(t);
|
|
26
|
+
}, V = (e, t, r) => {
|
|
26
27
|
t.forEach((s, n) => {
|
|
27
28
|
const o = e.get(n);
|
|
28
29
|
if (!o) {
|
|
29
30
|
r.onSet(s);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
w(o) !== w(s) && r.onSet(s);
|
|
33
34
|
}), e.forEach((s, n) => {
|
|
34
35
|
t.has(n) || r.onDelete(n);
|
|
35
36
|
});
|
|
36
|
-
},
|
|
37
|
-
let r = await
|
|
37
|
+
}, _ = async (e, t) => {
|
|
38
|
+
let r = await S(e);
|
|
38
39
|
const s = setInterval(async () => {
|
|
39
40
|
try {
|
|
40
|
-
const n = await
|
|
41
|
-
|
|
41
|
+
const n = await S(e);
|
|
42
|
+
V(r, n, t), r = n;
|
|
42
43
|
} catch {
|
|
43
44
|
}
|
|
44
45
|
}, x);
|
|
@@ -47,33 +48,33 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
47
48
|
clearInterval(s);
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
|
-
},
|
|
51
|
+
}, D = (e, t) => {
|
|
51
52
|
const r = t.storage, s = {
|
|
52
53
|
adapterId: e.id,
|
|
53
54
|
storageId: t.id
|
|
54
55
|
}, n = async (d) => {
|
|
55
|
-
if (!
|
|
56
|
-
return
|
|
56
|
+
if (!I(t, d))
|
|
57
|
+
return E(r, d);
|
|
57
58
|
}, o = async () => {
|
|
58
|
-
const d = await
|
|
59
|
+
const d = await b(r);
|
|
59
60
|
return (await Promise.all(
|
|
60
|
-
d.filter((c) => !
|
|
61
|
+
d.filter((c) => !I(t, c)).map((c) => E(r, c))
|
|
61
62
|
)).filter((c) => !!c);
|
|
62
63
|
};
|
|
63
64
|
return {
|
|
64
|
-
id:
|
|
65
|
+
id: k(s),
|
|
65
66
|
target: s,
|
|
66
67
|
adapterName: e.name,
|
|
67
68
|
storageName: t.name,
|
|
68
69
|
capabilities: t.capabilities,
|
|
69
70
|
get: n,
|
|
70
71
|
set: async (d) => {
|
|
71
|
-
|
|
72
|
+
z(t.capabilities, d.type, s), await K(r, d);
|
|
72
73
|
},
|
|
73
74
|
delete: async (d) => {
|
|
74
|
-
await
|
|
75
|
+
await j(r, d);
|
|
75
76
|
},
|
|
76
|
-
getAllKeys: async () => (await
|
|
77
|
+
getAllKeys: async () => (await b(r)).filter((a) => !I(t, a)),
|
|
77
78
|
getAllEntries: o,
|
|
78
79
|
watch: async ({ onSet: d, onDelete: a }) => r.subscribe ? r.subscribe(async (c) => {
|
|
79
80
|
try {
|
|
@@ -85,11 +86,11 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
85
86
|
d(i);
|
|
86
87
|
} catch {
|
|
87
88
|
}
|
|
88
|
-
}) :
|
|
89
|
+
}) : _(o, { onSet: d, onDelete: a })
|
|
89
90
|
};
|
|
90
|
-
},
|
|
91
|
-
(t) => t.storages.map((r) =>
|
|
92
|
-
),
|
|
91
|
+
}, F = (e) => e.flatMap(
|
|
92
|
+
(t) => t.storages.map((r) => D(t, r))
|
|
93
|
+
), f = {
|
|
93
94
|
adapterId: {
|
|
94
95
|
type: "string",
|
|
95
96
|
description: "Storage adapter ID. Required when multiple adapters are configured."
|
|
@@ -98,88 +99,100 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
98
99
|
type: "string",
|
|
99
100
|
description: "Storage node ID within the adapter. Required when multiple storages are configured."
|
|
100
101
|
}
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
properties: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
102
|
+
}, u = "@rozenite/storage-plugin", $ = [
|
|
103
|
+
"string",
|
|
104
|
+
"number",
|
|
105
|
+
"boolean",
|
|
106
|
+
"buffer"
|
|
107
|
+
], y = {
|
|
108
|
+
listStorages: g({
|
|
109
|
+
name: "list-storages",
|
|
110
|
+
description: "List all storage adapters and their storage nodes currently available on the device, including supported entry types and entry counts.",
|
|
111
|
+
inputSchema: { type: "object", properties: {} }
|
|
112
|
+
}),
|
|
113
|
+
listEntries: g({
|
|
114
|
+
name: "list-entries",
|
|
115
|
+
description: "List keys in a storage. This call intentionally does not return entry values to keep responses token-efficient.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
...f,
|
|
120
|
+
offset: {
|
|
121
|
+
type: "number",
|
|
122
|
+
description: "Pagination offset. Defaults to 0."
|
|
123
|
+
},
|
|
124
|
+
limit: {
|
|
125
|
+
type: "number",
|
|
126
|
+
description: "Pagination size. Defaults to 100."
|
|
127
|
+
}
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
required: ["key"]
|
|
132
|
-
}
|
|
133
|
-
}, L = {
|
|
134
|
-
name: "create-entry",
|
|
135
|
-
description: "Create a new storage entry. Fails if the key already exists.",
|
|
136
|
-
inputSchema: {
|
|
137
|
-
type: "object",
|
|
138
|
-
properties: {
|
|
139
|
-
...y,
|
|
140
|
-
key: { type: "string", description: "Entry key." },
|
|
141
|
-
type: {
|
|
142
|
-
type: "string",
|
|
143
|
-
enum: ["string", "number", "boolean", "buffer"],
|
|
144
|
-
description: "Entry value type. Must be one of the supported types for the target storage (see list-storages)."
|
|
130
|
+
}),
|
|
131
|
+
readEntry: g({
|
|
132
|
+
name: "read-entry",
|
|
133
|
+
description: "Read a single storage entry value by key.",
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
...f,
|
|
138
|
+
key: { type: "string", description: "Entry key." }
|
|
145
139
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
140
|
+
required: ["key"]
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
createEntry: g({
|
|
144
|
+
name: "create-entry",
|
|
145
|
+
description: "Create a new storage entry. Fails if the key already exists.",
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: "object",
|
|
148
|
+
properties: {
|
|
149
|
+
...f,
|
|
150
|
+
key: { type: "string", description: "Entry key." },
|
|
151
|
+
type: {
|
|
152
|
+
type: "string",
|
|
153
|
+
enum: [...$],
|
|
154
|
+
description: "Entry value type. Must be one of the supported types for the target storage (see list-storages)."
|
|
155
|
+
},
|
|
156
|
+
value: {
|
|
157
|
+
description: "Entry value matching the provided type."
|
|
158
|
+
}
|
|
164
159
|
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
required: ["key", "type", "value"]
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
editEntry: g({
|
|
164
|
+
name: "edit-entry",
|
|
165
|
+
description: "Edit an existing storage entry. Fails if the key does not exist.",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
...f,
|
|
170
|
+
key: { type: "string", description: "Entry key." },
|
|
171
|
+
type: {
|
|
172
|
+
type: "string",
|
|
173
|
+
enum: [...$],
|
|
174
|
+
description: "Entry value type. Must be one of the supported types for the target storage (see list-storages)."
|
|
175
|
+
},
|
|
176
|
+
value: {
|
|
177
|
+
description: "Entry value matching the provided type."
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
required: ["key", "type", "value"]
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
removeEntry: g({
|
|
184
|
+
name: "remove-entry",
|
|
185
|
+
description: "Remove a storage entry by key.",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
type: "object",
|
|
188
|
+
properties: {
|
|
189
|
+
...f,
|
|
190
|
+
key: { type: "string", description: "Entry key." }
|
|
191
|
+
},
|
|
192
|
+
required: ["key"]
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
}, v = (e, t) => {
|
|
183
196
|
if (e === "string") {
|
|
184
197
|
if (typeof t != "string")
|
|
185
198
|
throw new Error("Expected string value for type=string");
|
|
@@ -198,8 +211,8 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
198
211
|
if (!Array.isArray(t) || !t.every((r) => Number.isInteger(r)))
|
|
199
212
|
throw new Error("Expected number[] value for type=buffer");
|
|
200
213
|
return t;
|
|
201
|
-
},
|
|
202
|
-
const t =
|
|
214
|
+
}, m = (e) => `${e.target.adapterId}/${e.target.storageId}`, q = (e) => {
|
|
215
|
+
const t = P(
|
|
203
216
|
(r, s) => {
|
|
204
217
|
if (e.length === 0)
|
|
205
218
|
throw new Error("No storages are registered.");
|
|
@@ -213,22 +226,22 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
213
226
|
s && `storageId="${s}"`
|
|
214
227
|
].filter(Boolean).join(", ");
|
|
215
228
|
throw new Error(
|
|
216
|
-
`No storage matched ${o}. Available: ${e.map(
|
|
229
|
+
`No storage matched ${o}. Available: ${e.map(m).join(", ")}`
|
|
217
230
|
);
|
|
218
231
|
}
|
|
219
232
|
return n;
|
|
220
233
|
}
|
|
221
234
|
if (e.length > 1)
|
|
222
235
|
throw new Error(
|
|
223
|
-
`Multiple storages detected. Provide adapterId and/or storageId. Available: ${e.map(
|
|
236
|
+
`Multiple storages detected. Provide adapterId and/or storageId. Available: ${e.map(m).join(", ")}`
|
|
224
237
|
);
|
|
225
238
|
return e[0];
|
|
226
239
|
},
|
|
227
240
|
[e]
|
|
228
241
|
);
|
|
229
242
|
l({
|
|
230
|
-
pluginId:
|
|
231
|
-
tool:
|
|
243
|
+
pluginId: u,
|
|
244
|
+
tool: y.listStorages,
|
|
232
245
|
handler: async () => ({
|
|
233
246
|
storages: await Promise.all(
|
|
234
247
|
e.map(async (r) => ({
|
|
@@ -242,8 +255,8 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
242
255
|
)
|
|
243
256
|
})
|
|
244
257
|
}), l({
|
|
245
|
-
pluginId:
|
|
246
|
-
tool:
|
|
258
|
+
pluginId: u,
|
|
259
|
+
tool: y.listEntries,
|
|
247
260
|
handler: async ({ adapterId: r, storageId: s, offset: n = 0, limit: o = 100 }) => {
|
|
248
261
|
const d = t(r, s), a = await d.getAllKeys(), c = Math.max(0, Math.floor(n)), i = Math.max(1, Math.floor(o)), p = a.slice(c, c + i);
|
|
249
262
|
return {
|
|
@@ -256,13 +269,13 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
256
269
|
};
|
|
257
270
|
}
|
|
258
271
|
}), l({
|
|
259
|
-
pluginId:
|
|
260
|
-
tool:
|
|
272
|
+
pluginId: u,
|
|
273
|
+
tool: y.readEntry,
|
|
261
274
|
handler: async ({ adapterId: r, storageId: s, key: n }) => {
|
|
262
275
|
const o = t(r, s), d = await o.get(n);
|
|
263
276
|
if (!d)
|
|
264
277
|
throw new Error(
|
|
265
|
-
`Key "${n}" not found in storage "${
|
|
278
|
+
`Key "${n}" not found in storage "${m(o)}".`
|
|
266
279
|
);
|
|
267
280
|
return {
|
|
268
281
|
adapterId: o.target.adapterId,
|
|
@@ -271,15 +284,15 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
271
284
|
};
|
|
272
285
|
}
|
|
273
286
|
}), l({
|
|
274
|
-
pluginId:
|
|
275
|
-
tool:
|
|
287
|
+
pluginId: u,
|
|
288
|
+
tool: y.createEntry,
|
|
276
289
|
handler: async ({ adapterId: r, storageId: s, key: n, type: o, value: d }) => {
|
|
277
290
|
const a = t(r, s);
|
|
278
291
|
if (await a.get(n))
|
|
279
292
|
throw new Error(
|
|
280
|
-
`Key "${n}" already exists in storage "${
|
|
293
|
+
`Key "${n}" already exists in storage "${m(a)}". Use edit-entry instead.`
|
|
281
294
|
);
|
|
282
|
-
const i =
|
|
295
|
+
const i = v(o, d);
|
|
283
296
|
return await a.set({ key: n, type: o, value: i }), {
|
|
284
297
|
adapterId: a.target.adapterId,
|
|
285
298
|
storageId: a.target.storageId,
|
|
@@ -288,15 +301,15 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
288
301
|
};
|
|
289
302
|
}
|
|
290
303
|
}), l({
|
|
291
|
-
pluginId:
|
|
292
|
-
tool:
|
|
304
|
+
pluginId: u,
|
|
305
|
+
tool: y.editEntry,
|
|
293
306
|
handler: async ({ adapterId: r, storageId: s, key: n, type: o, value: d }) => {
|
|
294
307
|
const a = t(r, s);
|
|
295
308
|
if (!await a.get(n))
|
|
296
309
|
throw new Error(
|
|
297
|
-
`Key "${n}" not found in storage "${
|
|
310
|
+
`Key "${n}" not found in storage "${m(a)}". Use create-entry instead.`
|
|
298
311
|
);
|
|
299
|
-
const i =
|
|
312
|
+
const i = v(o, d);
|
|
300
313
|
return await a.set({ key: n, type: o, value: i }), {
|
|
301
314
|
adapterId: a.target.adapterId,
|
|
302
315
|
storageId: a.target.storageId,
|
|
@@ -305,8 +318,8 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
305
318
|
};
|
|
306
319
|
}
|
|
307
320
|
}), l({
|
|
308
|
-
pluginId:
|
|
309
|
-
tool:
|
|
321
|
+
pluginId: u,
|
|
322
|
+
tool: y.removeEntry,
|
|
310
323
|
handler: async ({ adapterId: r, storageId: s, key: n }) => {
|
|
311
324
|
const o = t(r, s), d = !!await o.get(n);
|
|
312
325
|
return await o.delete(n), {
|
|
@@ -317,15 +330,15 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
317
330
|
};
|
|
318
331
|
}
|
|
319
332
|
});
|
|
320
|
-
},
|
|
333
|
+
}, Y = ({
|
|
321
334
|
storages: e
|
|
322
335
|
}) => {
|
|
323
|
-
const t =
|
|
324
|
-
|
|
325
|
-
const r =
|
|
336
|
+
const t = T(() => F(e), [e]);
|
|
337
|
+
q(t);
|
|
338
|
+
const r = A({
|
|
326
339
|
pluginId: "@rozenite/storage-plugin"
|
|
327
340
|
});
|
|
328
|
-
return
|
|
341
|
+
return R(() => {
|
|
329
342
|
if (!r)
|
|
330
343
|
return;
|
|
331
344
|
const s = async (a) => {
|
|
@@ -439,5 +452,5 @@ const x = 1500, f = (e) => e.kind === "async", m = (e) => e.type === "buffer" ?
|
|
|
439
452
|
}, [r, t]), r;
|
|
440
453
|
};
|
|
441
454
|
export {
|
|
442
|
-
|
|
455
|
+
Y as useRozeniteStoragePlugin
|
|
443
456
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.createAsyncStorageAdapter=void 0;exports.createExpoAsyncStorageAdapter=void 0;exports.createExpoSecureStorageAdapter=void 0;exports.createMMKVStorageAdapter=void 0;exports.useRozeniteStoragePlugin=void 0;const o=typeof window<"u"&&window.navigator.product!=="ReactNative",c=process.env.NODE_ENV!=="production",d=typeof window>"u"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.createAsyncStorageAdapter=void 0;exports.createExpoAsyncStorageAdapter=void 0;exports.createExpoSecureStorageAdapter=void 0;exports.createMMKVStorageAdapter=void 0;exports.useRozeniteStoragePlugin=void 0;const o=typeof window<"u"&&window.navigator.product!=="ReactNative",c=process.env.NODE_ENV!=="production",d=typeof window>"u",r=(e,t,a)=>({id:e?.adapterId??t,name:e?.adapterName??a,storages:[]});if(!c||d)exports.createAsyncStorageAdapter=(e=>r(e,"async-storage","AsyncStorage")),exports.createExpoAsyncStorageAdapter=exports.createAsyncStorageAdapter,exports.createExpoSecureStorageAdapter=(e=>r(e,"expo-secure-store","Expo SecureStore")),exports.createMMKVStorageAdapter=(e=>r(e,"mmkv","MMKV")),exports.useRozeniteStoragePlugin=()=>null;else if(o){const e=require("./chunks/async-storage.require.cjs"),t=require("./chunks/secure-storage.require.cjs");exports.createAsyncStorageAdapter=e.createAsyncStorageAdapter,exports.createExpoAsyncStorageAdapter=e.createExpoAsyncStorageAdapter,exports.createExpoSecureStorageAdapter=t.createExpoSecureStorageAdapter,exports.createMMKVStorageAdapter=(a=>r(a,"mmkv","MMKV")),exports.useRozeniteStoragePlugin=require("./chunks/useRozeniteStoragePlugin.require.cjs").useRozeniteStoragePlugin}else exports.createAsyncStorageAdapter=require("./chunks/index.require.cjs").createAsyncStorageAdapter,exports.createExpoAsyncStorageAdapter=require("./chunks/index.require.cjs").createExpoAsyncStorageAdapter,exports.createExpoSecureStorageAdapter=require("./chunks/index.require.cjs").createExpoSecureStorageAdapter,exports.createMMKVStorageAdapter=require("./chunks/index.require.cjs").createMMKVStorageAdapter,exports.useRozeniteStoragePlugin=require("./chunks/useRozeniteStoragePlugin.require.cjs").useRozeniteStoragePlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MMKV as MMKV_2 } from 'react-native-mmkv-v3';
|
|
2
2
|
import { MMKV as MMKV_3 } from 'react-native-mmkv-v4';
|
|
3
|
-
import { RozeniteDevToolsClient } from '
|
|
3
|
+
import { RozeniteDevToolsClient } from '@rozenite/plugin-bridge';
|
|
4
4
|
|
|
5
5
|
export declare type AsyncStorage = {
|
|
6
6
|
kind: 'async';
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
let
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
storages: []
|
|
10
|
-
});
|
|
11
|
-
t = ((e) => r(
|
|
1
|
+
let r, c, n, s, p;
|
|
2
|
+
const d = typeof window < "u" && window.navigator.product !== "ReactNative", i = process.env.NODE_ENV !== "production", u = typeof window > "u", t = (e, a, o) => ({
|
|
3
|
+
id: e?.adapterId ?? a,
|
|
4
|
+
name: e?.adapterName ?? o,
|
|
5
|
+
storages: []
|
|
6
|
+
});
|
|
7
|
+
if (!i || u)
|
|
8
|
+
r = ((e) => t(
|
|
12
9
|
e,
|
|
13
10
|
"async-storage",
|
|
14
11
|
"AsyncStorage"
|
|
15
|
-
)),
|
|
12
|
+
)), c = r, n = ((e) => t(
|
|
16
13
|
e,
|
|
17
14
|
"expo-secure-store",
|
|
18
15
|
"Expo SecureStore"
|
|
19
|
-
)),
|
|
20
|
-
|
|
16
|
+
)), s = ((e) => t(e, "mmkv", "MMKV")), p = () => null;
|
|
17
|
+
else if (d) {
|
|
18
|
+
const e = require("./chunks/async-storage.require.js"), a = require("./chunks/secure-storage.require.js");
|
|
19
|
+
r = e.createAsyncStorageAdapter, c = e.createExpoAsyncStorageAdapter, n = a.createExpoSecureStorageAdapter, s = ((o) => t(o, "mmkv", "MMKV")), p = require("./chunks/useRozeniteStoragePlugin.require.js").useRozeniteStoragePlugin;
|
|
20
|
+
} else
|
|
21
|
+
r = require("./chunks/index.require.js").createAsyncStorageAdapter, c = require("./chunks/index.require.js").createExpoAsyncStorageAdapter, n = require("./chunks/index.require.js").createExpoSecureStorageAdapter, s = require("./chunks/index.require.js").createMMKVStorageAdapter, p = require("./chunks/useRozeniteStoragePlugin.require.js").useRozeniteStoragePlugin;
|
|
21
22
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
r as createAsyncStorageAdapter,
|
|
24
|
+
c as createExpoAsyncStorageAdapter,
|
|
25
|
+
n as createExpoSecureStorageAdapter,
|
|
26
|
+
s as createMMKVStorageAdapter,
|
|
27
|
+
p as useRozeniteStoragePlugin
|
|
27
28
|
};
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@rozenite/storage-plugin","version":"1.
|
|
1
|
+
{"name":"@rozenite/storage-plugin","version":"1.8.1","description":"Generic Storage Inspector for Rozenite.","panels":[{"name":"Storage","source":"/devtools/panel.html"}]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@rozenite/agent-shared"),t={adapterId:{type:"string",description:"Storage adapter ID. Required when multiple adapters are configured."},storageId:{type:"string",description:"Storage node ID within the adapter. Required when multiple storages are configured."}},n="@rozenite/storage-plugin",r=["string","number","boolean","buffer"],i={listStorages:e.defineAgentToolContract({name:"list-storages",description:"List all storage adapters and their storage nodes currently available on the device, including supported entry types and entry counts.",inputSchema:{type:"object",properties:{}}}),listEntries:e.defineAgentToolContract({name:"list-entries",description:"List keys in a storage. This call intentionally does not return entry values to keep responses token-efficient.",inputSchema:{type:"object",properties:{...t,offset:{type:"number",description:"Pagination offset. Defaults to 0."},limit:{type:"number",description:"Pagination size. Defaults to 100."}}}}),readEntry:e.defineAgentToolContract({name:"read-entry",description:"Read a single storage entry value by key.",inputSchema:{type:"object",properties:{...t,key:{type:"string",description:"Entry key."}},required:["key"]}}),createEntry:e.defineAgentToolContract({name:"create-entry",description:"Create a new storage entry. Fails if the key already exists.",inputSchema:{type:"object",properties:{...t,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...r],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),editEntry:e.defineAgentToolContract({name:"edit-entry",description:"Edit an existing storage entry. Fails if the key does not exist.",inputSchema:{type:"object",properties:{...t,key:{type:"string",description:"Entry key."},type:{type:"string",enum:[...r],description:"Entry value type. Must be one of the supported types for the target storage (see list-storages)."},value:{description:"Entry value matching the provided type."}},required:["key","type","value"]}}),removeEntry:e.defineAgentToolContract({name:"remove-entry",description:"Remove a storage entry by key.",inputSchema:{type:"object",properties:{...t,key:{type:"string",description:"Entry key."}},required:["key"]}})},o=e.defineAgentToolDescriptors(n,i);exports.STORAGE_AGENT_ENTRY_TYPES=r;exports.STORAGE_AGENT_PLUGIN_ID=n;exports.storageToolDefinitions=i;exports.storageTools=o;
|