@rozenite/storage-plugin 1.5.1 → 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.
- package/CHANGELOG.md +16 -0
- package/dist/{panel.html → devtools/panel.html} +2 -2
- package/dist/react-native/chunks/index.require.cjs +1 -0
- package/dist/{react-native.js → react-native/chunks/index.require.js} +47 -51
- package/dist/react-native/index.cjs +1 -0
- package/dist/react-native/index.d.ts +194 -0
- package/dist/react-native/index.js +27 -0
- package/dist/rozenite.json +1 -1
- package/package.json +27 -8
- package/react-native.ts +43 -6
- package/src/react-native/adapters/async-storage.ts +1 -1
- package/src/react-native/storage-view.ts +1 -1
- package/src/shared/types.ts +1 -1
- package/dist/react-native.cjs +0 -1
- package/dist/react-native.d.ts +0 -4
- package/dist/rozenite.config.d.ts +0 -7
- package/dist/src/react-native/adapters/async-storage.d.ts +0 -33
- package/dist/src/react-native/adapters/index.d.ts +0 -6
- package/dist/src/react-native/adapters/mmkv.d.ts +0 -13
- package/dist/src/react-native/adapters/secure-storage.d.ts +0 -18
- package/dist/src/react-native/is-garbled.d.ts +0 -1
- package/dist/src/react-native/storage-view.d.ts +0 -19
- package/dist/src/react-native/useRozeniteStoragePlugin.d.ts +0 -6
- package/dist/src/react-native/useStorageAgentTools.d.ts +0 -2
- package/dist/src/shared/messaging.d.ts +0 -29
- package/dist/src/shared/types.d.ts +0 -60
- package/dist/src/ui/add-entry-dialog.d.ts +0 -9
- package/dist/src/ui/confirm-dialog.d.ts +0 -11
- package/dist/src/ui/edit-entry-dialog.d.ts +0 -9
- package/dist/src/ui/editable-table.d.ts +0 -10
- package/dist/src/ui/entry-detail-dialog.d.ts +0 -8
- package/dist/src/ui/panel.d.ts +0 -1
- /package/dist/{assets/panel-C7usUotG.js → devtools/assets/panel-9uIwTlU4.js} +0 -0
- /package/dist/{assets → devtools/assets}/panel-DMhXYHH4.css +0 -0
- /package/dist/{types.cjs → react-native/chunks/types.cjs} +0 -0
- /package/dist/{types.js → react-native/chunks/types.js} +0 -0
- /package/dist/{useRozeniteStoragePlugin.cjs → react-native/chunks/useRozeniteStoragePlugin.require.cjs} +0 -0
- /package/dist/{useRozeniteStoragePlugin.js → react-native/chunks/useRozeniteStoragePlugin.require.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @rozenite/storage-plugin
|
|
2
2
|
|
|
3
|
+
## 1.7.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies []:
|
|
8
|
+
- @rozenite/agent-bridge@1.7.0-rc.0
|
|
9
|
+
- @rozenite/plugin-bridge@1.7.0-rc.0
|
|
10
|
+
|
|
11
|
+
## 1.6.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies []:
|
|
16
|
+
- @rozenite/agent-bridge@1.6.0
|
|
17
|
+
- @rozenite/plugin-bridge@1.6.0
|
|
18
|
+
|
|
3
19
|
## 1.5.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
<script>
|
|
23
23
|
var __ROZENITE_PANEL__ = true;
|
|
24
24
|
</script>
|
|
25
|
-
<script type="module" crossorigin src="
|
|
26
|
-
<link rel="stylesheet" crossorigin href="
|
|
25
|
+
<script type="module" crossorigin src="../devtools/assets/panel-9uIwTlU4.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="../devtools/assets/panel-DMhXYHH4.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="root"></div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./types.cjs"),p=e=>!!(e.includes("�")||/[\u0000-\u001F\u007F-\u009F]/.test(e)||[...e].filter(n=>n>=" "&&n<="~").length/e.length<.7),c=e=>"remove"in e,y=e=>{if(Array.isArray(e)){if(e.some(c))throw new Error("[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances.");return Object.fromEntries(e.map(a=>[a.id,a]))}return e},A=e=>c(e)?{set:(t,a)=>e.set(t,a),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.remove(t),getAllKeys:()=>e.getAllKeys(),addOnValueChangedListener:t=>e.addOnValueChangedListener(t)}:{set:(t,a)=>e.set(t,a),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.delete(t),getAllKeys:()=>e.getAllKeys(),addOnValueChangedListener:t=>e.addOnValueChangedListener(t)},S=(e,t)=>{const a=e.getString(t);if(a!==void 0&&a.length>0)return p(a)?{key:t,type:"buffer",value:Array.from(new TextEncoder().encode(a))}:{key:t,type:"string",value:a};const n=e.getNumber(t);if(n!==void 0)return{key:t,type:"number",value:n};const l=e.getBoolean(t);if(l!==void 0)return{key:t,type:"boolean",value:l};const s=e.getBuffer(t);if(s!==void 0)return{key:t,type:"buffer",value:Array.from(new Uint8Array(s))}},b=(e,t)=>{if(t.type==="buffer"){e.set(t.key,new Uint8Array(t.value).buffer);return}e.set(t.key,t.value)},V=(e,t)=>{if(e)return e instanceof RegExp?e:e[t]},E=({adapterId:e="mmkv",adapterName:t="MMKV",storages:a,blacklist:n})=>{const l=y(a),s=Object.entries(l).map(([u,i])=>{const r=A(i);return{id:u,name:u,blacklist:V(n,u),capabilities:{supportedTypes:f.DEFAULT_SUPPORTED_TYPES},storage:{kind:"sync",getAllKeys:()=>r.getAllKeys(),get:o=>S(r,o),set:o=>b(r,o),delete:o=>r.delete(o),subscribe:o=>r.addOnValueChangedListener(o)}}});return{id:e,name:t,storages:s}},g=(e,t,a,n)=>{const l="storage"in t?t:{storage:t},{storage:s,name:u,blacklist:i}=l;return{id:e,name:u??a??e,blacklist:i??n,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>s.getAllKeys(),get:async r=>{const o=await s.getItem(r);if(o!==null)return{key:r,type:"string",value:o}},set:async r=>{if(r.type!=="string")throw new Error("AsyncStorage adapter supports only string values.");await s.setItem(r.key,r.value)},delete:r=>s.removeItem(r)}}},d=e=>{const{adapterId:t="async-storage",adapterName:a="AsyncStorage"}=e,n="storages"in e?Object.entries(e.storages).map(([l,s])=>g(l,s)):[g(e.storageId??"default",e.storage,e.storageName??"Default Storage",e.blacklist)];return{id:t,name:a,storages:n}},K=d,M=async e=>Array.isArray(e)?e:e(),v=({storage:e,keys:t,adapterId:a="expo-secure-store",adapterName:n="Expo SecureStore",storageId:l="default",storageName:s="Default Secure Storage",blacklist:u})=>({id:a,name:n,storages:[{id:l,name:s,blacklist:u,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>M(t),get:async r=>{const o=await e.getItemAsync(r);if(o!==null)return{key:r,type:"string",value:o}},set:async r=>{if(r.type!=="string")throw new Error("Expo SecureStore adapter supports only string values.");await e.setItemAsync(r.key,r.value)},delete:r=>e.deleteItemAsync(r)}}]});exports.createAsyncStorageAdapter=d;exports.createExpoAsyncStorageAdapter=K;exports.createExpoSecureStorageAdapter=v;exports.createMMKVStorageAdapter=E;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
const
|
|
1
|
+
import { D as d } from "./types.js";
|
|
2
|
+
const f = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e) || [...e].filter((a) => a >= " " && a <= "~").length / e.length < 0.7), c = (e) => "remove" in e, p = (e) => {
|
|
3
3
|
if (Array.isArray(e)) {
|
|
4
|
-
if (e.some(
|
|
4
|
+
if (e.some(c))
|
|
5
5
|
throw new Error(
|
|
6
6
|
"[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances."
|
|
7
7
|
);
|
|
@@ -10,7 +10,7 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
return e;
|
|
13
|
-
},
|
|
13
|
+
}, y = (e) => c(e) ? {
|
|
14
14
|
set: (t, n) => e.set(t, n),
|
|
15
15
|
getBoolean: (t) => e.getBoolean(t),
|
|
16
16
|
getString: (t) => e.getString(t),
|
|
@@ -28,10 +28,10 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
28
28
|
delete: (t) => e.delete(t),
|
|
29
29
|
getAllKeys: () => e.getAllKeys(),
|
|
30
30
|
addOnValueChangedListener: (t) => e.addOnValueChangedListener(t)
|
|
31
|
-
},
|
|
31
|
+
}, A = (e, t) => {
|
|
32
32
|
const n = e.getString(t);
|
|
33
33
|
if (n !== void 0 && n.length > 0)
|
|
34
|
-
return
|
|
34
|
+
return f(n) ? {
|
|
35
35
|
key: t,
|
|
36
36
|
type: "buffer",
|
|
37
37
|
value: Array.from(new TextEncoder().encode(n))
|
|
@@ -40,26 +40,26 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
40
40
|
type: "string",
|
|
41
41
|
value: n
|
|
42
42
|
};
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
43
|
+
const a = e.getNumber(t);
|
|
44
|
+
if (a !== void 0)
|
|
45
45
|
return {
|
|
46
46
|
key: t,
|
|
47
47
|
type: "number",
|
|
48
|
-
value:
|
|
48
|
+
value: a
|
|
49
49
|
};
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
50
|
+
const l = e.getBoolean(t);
|
|
51
|
+
if (l !== void 0)
|
|
52
52
|
return {
|
|
53
53
|
key: t,
|
|
54
54
|
type: "boolean",
|
|
55
|
-
value:
|
|
55
|
+
value: l
|
|
56
56
|
};
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
57
|
+
const s = e.getBuffer(t);
|
|
58
|
+
if (s !== void 0)
|
|
59
59
|
return {
|
|
60
60
|
key: t,
|
|
61
61
|
type: "buffer",
|
|
62
|
-
value: Array.from(new Uint8Array(
|
|
62
|
+
value: Array.from(new Uint8Array(s))
|
|
63
63
|
};
|
|
64
64
|
}, b = (e, t) => {
|
|
65
65
|
if (t.type === "buffer") {
|
|
@@ -67,29 +67,29 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
e.set(t.key, t.value);
|
|
70
|
-
},
|
|
70
|
+
}, S = (e, t) => {
|
|
71
71
|
if (e)
|
|
72
72
|
return e instanceof RegExp ? e : e[t];
|
|
73
|
-
},
|
|
73
|
+
}, h = ({
|
|
74
74
|
adapterId: e = "mmkv",
|
|
75
75
|
adapterName: t = "MMKV",
|
|
76
76
|
storages: n,
|
|
77
|
-
blacklist:
|
|
77
|
+
blacklist: a
|
|
78
78
|
}) => {
|
|
79
|
-
const
|
|
80
|
-
([u,
|
|
81
|
-
const r =
|
|
79
|
+
const l = p(n), s = Object.entries(l).map(
|
|
80
|
+
([u, i]) => {
|
|
81
|
+
const r = y(i);
|
|
82
82
|
return {
|
|
83
83
|
id: u,
|
|
84
84
|
name: u,
|
|
85
|
-
blacklist:
|
|
85
|
+
blacklist: S(a, u),
|
|
86
86
|
capabilities: {
|
|
87
|
-
supportedTypes:
|
|
87
|
+
supportedTypes: d
|
|
88
88
|
},
|
|
89
89
|
storage: {
|
|
90
90
|
kind: "sync",
|
|
91
91
|
getAllKeys: () => r.getAllKeys(),
|
|
92
|
-
get: (o) =>
|
|
92
|
+
get: (o) => A(r, o),
|
|
93
93
|
set: (o) => b(r, o),
|
|
94
94
|
delete: (o) => r.delete(o),
|
|
95
95
|
subscribe: (o) => r.addOnValueChangedListener(o)
|
|
@@ -100,24 +100,24 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
100
100
|
return {
|
|
101
101
|
id: e,
|
|
102
102
|
name: t,
|
|
103
|
-
storages:
|
|
103
|
+
storages: s
|
|
104
104
|
};
|
|
105
|
-
}, g = (e, t, n,
|
|
106
|
-
const
|
|
105
|
+
}, g = (e, t, n, a) => {
|
|
106
|
+
const l = "storage" in t ? t : {
|
|
107
107
|
storage: t
|
|
108
|
-
}, { storage:
|
|
108
|
+
}, { storage: s, name: u, blacklist: i } = l;
|
|
109
109
|
return {
|
|
110
110
|
id: e,
|
|
111
111
|
name: u ?? n ?? e,
|
|
112
|
-
blacklist:
|
|
112
|
+
blacklist: i ?? a,
|
|
113
113
|
capabilities: {
|
|
114
114
|
supportedTypes: ["string"]
|
|
115
115
|
},
|
|
116
116
|
storage: {
|
|
117
117
|
kind: "async",
|
|
118
|
-
getAllKeys: () =>
|
|
118
|
+
getAllKeys: () => s.getAllKeys(),
|
|
119
119
|
get: async (r) => {
|
|
120
|
-
const o = await
|
|
120
|
+
const o = await s.getItem(r);
|
|
121
121
|
if (o !== null)
|
|
122
122
|
return {
|
|
123
123
|
key: r,
|
|
@@ -128,14 +128,14 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
128
128
|
set: async (r) => {
|
|
129
129
|
if (r.type !== "string")
|
|
130
130
|
throw new Error("AsyncStorage adapter supports only string values.");
|
|
131
|
-
await
|
|
131
|
+
await s.setItem(r.key, r.value);
|
|
132
132
|
},
|
|
133
|
-
delete: (r) =>
|
|
133
|
+
delete: (r) => s.removeItem(r)
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
}, V = (e) => {
|
|
137
|
-
const { adapterId: t = "async-storage", adapterName: n = "AsyncStorage" } = e,
|
|
138
|
-
([
|
|
137
|
+
const { adapterId: t = "async-storage", adapterName: n = "AsyncStorage" } = e, a = "storages" in e ? Object.entries(e.storages).map(
|
|
138
|
+
([l, s]) => g(l, s)
|
|
139
139
|
) : [
|
|
140
140
|
g(
|
|
141
141
|
e.storageId ?? "default",
|
|
@@ -147,29 +147,29 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
147
147
|
return {
|
|
148
148
|
id: t,
|
|
149
149
|
name: n,
|
|
150
|
-
storages:
|
|
150
|
+
storages: a
|
|
151
151
|
};
|
|
152
|
-
},
|
|
152
|
+
}, v = V, K = async (e) => Array.isArray(e) ? e : e(), w = ({
|
|
153
153
|
storage: e,
|
|
154
154
|
keys: t,
|
|
155
155
|
adapterId: n = "expo-secure-store",
|
|
156
|
-
adapterName:
|
|
157
|
-
storageId:
|
|
158
|
-
storageName:
|
|
156
|
+
adapterName: a = "Expo SecureStore",
|
|
157
|
+
storageId: l = "default",
|
|
158
|
+
storageName: s = "Default Secure Storage",
|
|
159
159
|
blacklist: u
|
|
160
160
|
}) => ({
|
|
161
161
|
id: n,
|
|
162
|
-
name:
|
|
162
|
+
name: a,
|
|
163
163
|
storages: [{
|
|
164
|
-
id:
|
|
165
|
-
name:
|
|
164
|
+
id: l,
|
|
165
|
+
name: s,
|
|
166
166
|
blacklist: u,
|
|
167
167
|
capabilities: {
|
|
168
168
|
supportedTypes: ["string"]
|
|
169
169
|
},
|
|
170
170
|
storage: {
|
|
171
171
|
kind: "async",
|
|
172
|
-
getAllKeys: () =>
|
|
172
|
+
getAllKeys: () => K(t),
|
|
173
173
|
get: async (r) => {
|
|
174
174
|
const o = await e.getItemAsync(r);
|
|
175
175
|
if (o !== null)
|
|
@@ -188,13 +188,9 @@ const p = (e) => !!(e.includes("�") || /[\u0000-\u001F\u007F-\u009F]/.test(e)
|
|
|
188
188
|
}
|
|
189
189
|
}]
|
|
190
190
|
});
|
|
191
|
-
let c;
|
|
192
|
-
const E = typeof window < "u" && window.navigator.product !== "ReactNative", K = process.env.NODE_ENV !== "production", N = typeof window > "u";
|
|
193
|
-
K && !E && !N ? c = require("./useRozeniteStoragePlugin.js").useRozeniteStoragePlugin : c = () => null;
|
|
194
191
|
export {
|
|
195
192
|
V as createAsyncStorageAdapter,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
c as useRozeniteStoragePlugin
|
|
193
|
+
v as createExpoAsyncStorageAdapter,
|
|
194
|
+
w as createExpoSecureStorageAdapter,
|
|
195
|
+
h as createMMKVStorageAdapter
|
|
200
196
|
};
|
|
@@ -0,0 +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";if(c&&!o&&!d)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;else{const r=(e,t,a)=>({id:e?.adapterId??t,name:e?.adapterName??a,storages:[]});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}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { MMKV as MMKV_2 } from 'react-native-mmkv-v3';
|
|
2
|
+
import { MMKV as MMKV_3 } from 'react-native-mmkv-v4';
|
|
3
|
+
import { RozeniteDevToolsClient } from '../../../plugin-bridge/src/index.ts';
|
|
4
|
+
|
|
5
|
+
export declare type AsyncStorage = {
|
|
6
|
+
kind: 'async';
|
|
7
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
8
|
+
get: (key: string) => Promise<StorageEntry | undefined>;
|
|
9
|
+
set: (entry: StorageEntry) => Promise<void>;
|
|
10
|
+
delete: (key: string) => Promise<void>;
|
|
11
|
+
subscribe?: (callback: (key: string) => void) => StorageSubscription;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export declare type AsyncStorageInstanceConfig = {
|
|
15
|
+
storage: AsyncStorageLike;
|
|
16
|
+
name?: string;
|
|
17
|
+
blacklist?: RegExp;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export declare type AsyncStorageLike = {
|
|
21
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
22
|
+
getItem: (key: string) => Promise<string | null>;
|
|
23
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
24
|
+
removeItem: (key: string) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export declare let createAsyncStorageAdapter: createAsyncStorageAdapter_2;
|
|
28
|
+
|
|
29
|
+
declare const createAsyncStorageAdapter_2: (options: CreateAsyncStorageAdapterOptions) => StorageAdapter;
|
|
30
|
+
|
|
31
|
+
export declare type CreateAsyncStorageAdapterOptions = SingleStorageOptions | MultiStorageOptions;
|
|
32
|
+
|
|
33
|
+
export declare let createExpoAsyncStorageAdapter: createExpoAsyncStorageAdapter_2;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use createAsyncStorageAdapter instead.
|
|
37
|
+
*/
|
|
38
|
+
declare const createExpoAsyncStorageAdapter_2: (options: CreateAsyncStorageAdapterOptions) => StorageAdapter;
|
|
39
|
+
|
|
40
|
+
export declare type CreateExpoAsyncStorageAdapterOptions = CreateAsyncStorageAdapterOptions;
|
|
41
|
+
|
|
42
|
+
export declare let createExpoSecureStorageAdapter: createExpoSecureStorageAdapter_2;
|
|
43
|
+
|
|
44
|
+
declare const createExpoSecureStorageAdapter_2: ({ storage, keys, adapterId, adapterName, storageId, storageName, blacklist, }: CreateExpoSecureStorageAdapterOptions) => StorageAdapter;
|
|
45
|
+
|
|
46
|
+
export declare type CreateExpoSecureStorageAdapterOptions = {
|
|
47
|
+
storage: SecureStorageLike;
|
|
48
|
+
keys: KeySource;
|
|
49
|
+
adapterId?: string;
|
|
50
|
+
adapterName?: string;
|
|
51
|
+
storageId?: string;
|
|
52
|
+
storageName?: string;
|
|
53
|
+
blacklist?: RegExp;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export declare let createMMKVStorageAdapter: createMMKVStorageAdapter_2;
|
|
57
|
+
|
|
58
|
+
declare const createMMKVStorageAdapter_2: ({ adapterId, adapterName, storages, blacklist, }: CreateMMKVStorageAdapterOptions) => StorageAdapter;
|
|
59
|
+
|
|
60
|
+
export declare type CreateMMKVStorageAdapterOptions = {
|
|
61
|
+
adapterId?: string;
|
|
62
|
+
adapterName?: string;
|
|
63
|
+
storages: MMKV[] | Record<string, MMKV>;
|
|
64
|
+
blacklist?: MMKVBlacklistConfig;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type KeySource = string[] | (() => Promise<string[]>);
|
|
68
|
+
|
|
69
|
+
declare type MMKV = MMKV_2 | MMKV_3;
|
|
70
|
+
|
|
71
|
+
declare type MMKVBlacklistConfig = RegExp | Record<string, RegExp | undefined>;
|
|
72
|
+
|
|
73
|
+
declare type MultiStorageOptions = {
|
|
74
|
+
storages: Record<string, AsyncStorageLike | AsyncStorageInstanceConfig>;
|
|
75
|
+
adapterId?: string;
|
|
76
|
+
adapterName?: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
declare type RozeniteStoragePluginOptions = {
|
|
80
|
+
storages: StorageAdapter[];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export declare type SecureStorageLike = {
|
|
84
|
+
getItemAsync: (key: string) => Promise<string | null>;
|
|
85
|
+
setItemAsync: (key: string, value: string) => Promise<void>;
|
|
86
|
+
deleteItemAsync: (key: string) => Promise<void>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
declare type SingleStorageOptions = {
|
|
90
|
+
storage: AsyncStorageLike;
|
|
91
|
+
adapterId?: string;
|
|
92
|
+
adapterName?: string;
|
|
93
|
+
storageId?: string;
|
|
94
|
+
storageName?: string;
|
|
95
|
+
blacklist?: RegExp;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export declare type StorageAdapter = {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
storages: StorageNode[];
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export declare type StorageCapabilities = {
|
|
105
|
+
supportedTypes: StorageEntryType[];
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare type StorageDeleteEntryEvent = {
|
|
109
|
+
type: 'delete-entry';
|
|
110
|
+
target: StorageTarget;
|
|
111
|
+
key: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export declare type StorageEntry = {
|
|
115
|
+
key: string;
|
|
116
|
+
type: 'string';
|
|
117
|
+
value: string;
|
|
118
|
+
} | {
|
|
119
|
+
key: string;
|
|
120
|
+
type: 'number';
|
|
121
|
+
value: number;
|
|
122
|
+
} | {
|
|
123
|
+
key: string;
|
|
124
|
+
type: 'boolean';
|
|
125
|
+
value: boolean;
|
|
126
|
+
} | {
|
|
127
|
+
key: string;
|
|
128
|
+
type: 'buffer';
|
|
129
|
+
value: number[];
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export declare type StorageEntryType = StorageEntry['type'];
|
|
133
|
+
|
|
134
|
+
export declare type StorageEntryValue = StorageEntry['value'];
|
|
135
|
+
|
|
136
|
+
declare type StorageEvent_2 = StorageSnapshotEvent | StorageSetEntryEvent | StorageDeleteEntryEvent | StorageGetSnapshotEvent;
|
|
137
|
+
|
|
138
|
+
declare type StorageEventMap = {
|
|
139
|
+
[K in StorageEvent_2['type']]: Extract<StorageEvent_2, {
|
|
140
|
+
type: K;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
declare type StorageGetSnapshotEvent = {
|
|
145
|
+
type: 'get-snapshot';
|
|
146
|
+
target: StorageTarget | 'all';
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export declare type StorageNode = {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
storage: SyncStorage | AsyncStorage;
|
|
153
|
+
capabilities: StorageCapabilities;
|
|
154
|
+
blacklist?: RegExp;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
declare type StorageSetEntryEvent = {
|
|
158
|
+
type: 'set-entry';
|
|
159
|
+
target: StorageTarget;
|
|
160
|
+
entry: StorageEntry;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
declare type StorageSnapshotEvent = {
|
|
164
|
+
type: 'snapshot';
|
|
165
|
+
target: StorageTarget;
|
|
166
|
+
adapterName: string;
|
|
167
|
+
storageName: string;
|
|
168
|
+
capabilities: StorageCapabilities;
|
|
169
|
+
entries: StorageEntry[];
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
declare type StorageSubscription = {
|
|
173
|
+
remove: () => void;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
declare type StorageTarget = {
|
|
177
|
+
adapterId: string;
|
|
178
|
+
storageId: string;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export declare type SyncStorage = {
|
|
182
|
+
kind: 'sync';
|
|
183
|
+
getAllKeys: () => string[];
|
|
184
|
+
get: (key: string) => StorageEntry | undefined;
|
|
185
|
+
set: (entry: StorageEntry) => void;
|
|
186
|
+
delete: (key: string) => void;
|
|
187
|
+
subscribe?: (callback: (key: string) => void) => StorageSubscription;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export declare let useRozeniteStoragePlugin: useRozeniteStoragePlugin_2;
|
|
191
|
+
|
|
192
|
+
declare const useRozeniteStoragePlugin_2: ({ storages, }: RozeniteStoragePluginOptions) => RozeniteDevToolsClient<StorageEventMap> | null;
|
|
193
|
+
|
|
194
|
+
export { }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
let t, a, o, c, n;
|
|
2
|
+
const s = typeof window < "u" && window.navigator.product !== "ReactNative", i = process.env.NODE_ENV !== "production", u = typeof window > "u";
|
|
3
|
+
if (i && !s && !u)
|
|
4
|
+
t = require("./chunks/index.require.js").createAsyncStorageAdapter, a = require("./chunks/index.require.js").createExpoAsyncStorageAdapter, o = require("./chunks/index.require.js").createExpoSecureStorageAdapter, c = require("./chunks/index.require.js").createMMKVStorageAdapter, n = require("./chunks/useRozeniteStoragePlugin.require.js").useRozeniteStoragePlugin;
|
|
5
|
+
else {
|
|
6
|
+
const r = (e, p, d) => ({
|
|
7
|
+
id: e?.adapterId ?? p,
|
|
8
|
+
name: e?.adapterName ?? d,
|
|
9
|
+
storages: []
|
|
10
|
+
});
|
|
11
|
+
t = ((e) => r(
|
|
12
|
+
e,
|
|
13
|
+
"async-storage",
|
|
14
|
+
"AsyncStorage"
|
|
15
|
+
)), a = t, o = ((e) => r(
|
|
16
|
+
e,
|
|
17
|
+
"expo-secure-store",
|
|
18
|
+
"Expo SecureStore"
|
|
19
|
+
)), c = ((e) => r(e, "mmkv", "MMKV")), n = () => null;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
t as createAsyncStorageAdapter,
|
|
23
|
+
a as createExpoAsyncStorageAdapter,
|
|
24
|
+
o as createExpoSecureStorageAdapter,
|
|
25
|
+
c as createMMKVStorageAdapter,
|
|
26
|
+
n as useRozeniteStoragePlugin
|
|
27
|
+
};
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@rozenite/storage-plugin","version":"1.
|
|
1
|
+
{"name":"@rozenite/storage-plugin","version":"1.7.0-rc.0","description":"Generic Storage Inspector for Rozenite.","panels":[{"name":"Storage","source":"/devtools/panel.html"}]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/storage-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-rc.0",
|
|
4
4
|
"description": "Generic Storage Inspector for Rozenite.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/react-native.cjs",
|
|
7
|
-
"module": "./dist/react-native.js",
|
|
8
|
-
"types": "./dist/react-native.d.ts",
|
|
6
|
+
"main": "./dist/react-native/index.cjs",
|
|
7
|
+
"module": "./dist/react-native/index.js",
|
|
8
|
+
"types": "./dist/react-native/index.d.ts",
|
|
9
|
+
"homepage": "https://github.com/callstackincubator/rozenite#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/callstackincubator/rozenite/issues"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/callstackincubator/rozenite.git"
|
|
16
|
+
},
|
|
9
17
|
"dependencies": {
|
|
10
|
-
"@rozenite/
|
|
11
|
-
"@rozenite/
|
|
18
|
+
"@rozenite/agent-bridge": "1.7.0-rc.0",
|
|
19
|
+
"@rozenite/plugin-bridge": "1.7.0-rc.0"
|
|
12
20
|
},
|
|
13
21
|
"devDependencies": {
|
|
14
22
|
"@tanstack/react-table": "^8.21.3",
|
|
@@ -29,8 +37,8 @@
|
|
|
29
37
|
"tailwindcss-animate": "^1.0.7",
|
|
30
38
|
"typescript": "~5.9.3",
|
|
31
39
|
"vite": "^7.3.1",
|
|
32
|
-
"@rozenite/vite-plugin": "1.
|
|
33
|
-
"rozenite": "1.
|
|
40
|
+
"@rozenite/vite-plugin": "1.7.0-rc.0",
|
|
41
|
+
"rozenite": "1.7.0-rc.0"
|
|
34
42
|
},
|
|
35
43
|
"peerDependencies": {
|
|
36
44
|
"@react-native-async-storage/async-storage": "*",
|
|
@@ -51,6 +59,17 @@
|
|
|
51
59
|
}
|
|
52
60
|
},
|
|
53
61
|
"license": "MIT",
|
|
62
|
+
"exports": {
|
|
63
|
+
".": {
|
|
64
|
+
"types": "./dist/react-native/index.d.ts",
|
|
65
|
+
"import": "./dist/react-native/index.js",
|
|
66
|
+
"require": "./dist/react-native/index.cjs"
|
|
67
|
+
},
|
|
68
|
+
"./package.json": "./package.json"
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
},
|
|
54
73
|
"scripts": {
|
|
55
74
|
"build": "rozenite build",
|
|
56
75
|
"dev": "rozenite dev",
|
package/react-native.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
createAsyncStorageAdapter,
|
|
3
|
-
createExpoAsyncStorageAdapter,
|
|
4
|
-
createExpoSecureStorageAdapter,
|
|
5
|
-
createMMKVStorageAdapter,
|
|
6
|
-
} from './src/react-native/adapters';
|
|
7
1
|
export type {
|
|
8
2
|
AsyncStorageInstanceConfig,
|
|
9
3
|
AsyncStorageLike,
|
|
@@ -25,6 +19,10 @@ export type {
|
|
|
25
19
|
SyncStorage,
|
|
26
20
|
} from './src/shared/types';
|
|
27
21
|
|
|
22
|
+
export let createAsyncStorageAdapter: typeof import('./src/react-native/adapters').createAsyncStorageAdapter;
|
|
23
|
+
export let createExpoAsyncStorageAdapter: typeof import('./src/react-native/adapters').createExpoAsyncStorageAdapter;
|
|
24
|
+
export let createExpoSecureStorageAdapter: typeof import('./src/react-native/adapters').createExpoSecureStorageAdapter;
|
|
25
|
+
export let createMMKVStorageAdapter: typeof import('./src/react-native/adapters').createMMKVStorageAdapter;
|
|
28
26
|
export let useRozeniteStoragePlugin: typeof import('./src/react-native/useRozeniteStoragePlugin').useRozeniteStoragePlugin;
|
|
29
27
|
|
|
30
28
|
const isWeb =
|
|
@@ -33,8 +31,47 @@ const isDev = process.env.NODE_ENV !== 'production';
|
|
|
33
31
|
const isServer = typeof window === 'undefined';
|
|
34
32
|
|
|
35
33
|
if (isDev && !isWeb && !isServer) {
|
|
34
|
+
createAsyncStorageAdapter =
|
|
35
|
+
require('./src/react-native/adapters').createAsyncStorageAdapter;
|
|
36
|
+
createExpoAsyncStorageAdapter =
|
|
37
|
+
require('./src/react-native/adapters').createExpoAsyncStorageAdapter;
|
|
38
|
+
createExpoSecureStorageAdapter =
|
|
39
|
+
require('./src/react-native/adapters').createExpoSecureStorageAdapter;
|
|
40
|
+
createMMKVStorageAdapter =
|
|
41
|
+
require('./src/react-native/adapters').createMMKVStorageAdapter;
|
|
36
42
|
useRozeniteStoragePlugin =
|
|
37
43
|
require('./src/react-native/useRozeniteStoragePlugin').useRozeniteStoragePlugin;
|
|
38
44
|
} else {
|
|
45
|
+
const createNoopStorageAdapter = (
|
|
46
|
+
options: { adapterId?: string; adapterName?: string } | undefined,
|
|
47
|
+
defaultId: string,
|
|
48
|
+
defaultName: string
|
|
49
|
+
) => ({
|
|
50
|
+
id: options?.adapterId ?? defaultId,
|
|
51
|
+
name: options?.adapterName ?? defaultName,
|
|
52
|
+
storages: [],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
createAsyncStorageAdapter = ((
|
|
56
|
+
options: { adapterId?: string; adapterName?: string }
|
|
57
|
+
) =>
|
|
58
|
+
createNoopStorageAdapter(
|
|
59
|
+
options,
|
|
60
|
+
'async-storage',
|
|
61
|
+
'AsyncStorage'
|
|
62
|
+
)) as typeof createAsyncStorageAdapter;
|
|
63
|
+
createExpoAsyncStorageAdapter = createAsyncStorageAdapter;
|
|
64
|
+
createExpoSecureStorageAdapter = ((options: {
|
|
65
|
+
adapterId?: string;
|
|
66
|
+
adapterName?: string;
|
|
67
|
+
}) =>
|
|
68
|
+
createNoopStorageAdapter(
|
|
69
|
+
options,
|
|
70
|
+
'expo-secure-store',
|
|
71
|
+
'Expo SecureStore'
|
|
72
|
+
)) as typeof createExpoSecureStorageAdapter;
|
|
73
|
+
createMMKVStorageAdapter = ((
|
|
74
|
+
options: { adapterId?: string; adapterName?: string }
|
|
75
|
+
) => createNoopStorageAdapter(options, 'mmkv', 'MMKV')) as typeof createMMKVStorageAdapter;
|
|
39
76
|
useRozeniteStoragePlugin = () => null;
|
|
40
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StorageAdapter, StorageNode } from '../../shared/types';
|
|
2
2
|
|
|
3
3
|
export type AsyncStorageLike = {
|
|
4
|
-
getAllKeys: () => Promise<string[]>;
|
|
4
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
5
5
|
getItem: (key: string) => Promise<string | null>;
|
|
6
6
|
setItem: (key: string, value: string) => Promise<void>;
|
|
7
7
|
removeItem: (key: string) => Promise<void>;
|
|
@@ -99,7 +99,7 @@ export type StorageView = {
|
|
|
99
99
|
get: (key: string) => Promise<StorageEntry | undefined>;
|
|
100
100
|
set: (entry: StorageEntry) => Promise<void>;
|
|
101
101
|
delete: (key: string) => Promise<void>;
|
|
102
|
-
getAllKeys: () => Promise<string[]>;
|
|
102
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
103
103
|
getAllEntries: () => Promise<StorageEntry[]>;
|
|
104
104
|
watch: (callbacks: {
|
|
105
105
|
onSet: (entry: StorageEntry) => void;
|
package/src/shared/types.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type SyncStorage = {
|
|
|
24
24
|
|
|
25
25
|
export type AsyncStorage = {
|
|
26
26
|
kind: 'async';
|
|
27
|
-
getAllKeys: () => Promise<string[]>;
|
|
27
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
28
28
|
get: (key: string) => Promise<StorageEntry | undefined>;
|
|
29
29
|
set: (entry: StorageEntry) => Promise<void>;
|
|
30
30
|
delete: (key: string) => Promise<void>;
|
package/dist/react-native.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./types.cjs"),p=e=>!!(e.includes("�")||/[\u0000-\u001F\u007F-\u009F]/.test(e)||[...e].filter(a=>a>=" "&&a<="~").length/e.length<.7),c=e=>"remove"in e,y=e=>{if(Array.isArray(e)){if(e.some(c))throw new Error("[Rozenite] Storage Plugin: MMKV arrays are not supported for v4 storages. Pass a record of storage IDs and MMKV instances.");return Object.fromEntries(e.map(n=>[n.id,n]))}return e},S=e=>c(e)?{set:(t,n)=>e.set(t,n),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.remove(t),getAllKeys:()=>e.getAllKeys(),addOnValueChangedListener:t=>e.addOnValueChangedListener(t)}:{set:(t,n)=>e.set(t,n),getBoolean:t=>e.getBoolean(t),getString:t=>e.getString(t),getNumber:t=>e.getNumber(t),getBuffer:t=>e.getBuffer(t),delete:t=>e.delete(t),getAllKeys:()=>e.getAllKeys(),addOnValueChangedListener:t=>e.addOnValueChangedListener(t)},A=(e,t)=>{const n=e.getString(t);if(n!==void 0&&n.length>0)return p(n)?{key:t,type:"buffer",value:Array.from(new TextEncoder().encode(n))}:{key:t,type:"string",value:n};const a=e.getNumber(t);if(a!==void 0)return{key:t,type:"number",value:a};const i=e.getBoolean(t);if(i!==void 0)return{key:t,type:"boolean",value:i};const s=e.getBuffer(t);if(s!==void 0)return{key:t,type:"buffer",value:Array.from(new Uint8Array(s))}},b=(e,t)=>{if(t.type==="buffer"){e.set(t.key,new Uint8Array(t.value).buffer);return}e.set(t.key,t.value)},v=(e,t)=>{if(e)return e instanceof RegExp?e:e[t]},V=({adapterId:e="mmkv",adapterName:t="MMKV",storages:n,blacklist:a})=>{const i=y(n),s=Object.entries(i).map(([u,l])=>{const r=S(l);return{id:u,name:u,blacklist:v(a,u),capabilities:{supportedTypes:f.DEFAULT_SUPPORTED_TYPES},storage:{kind:"sync",getAllKeys:()=>r.getAllKeys(),get:o=>A(r,o),set:o=>b(r,o),delete:o=>r.delete(o),subscribe:o=>r.addOnValueChangedListener(o)}}});return{id:e,name:t,storages:s}},g=(e,t,n,a)=>{const i="storage"in t?t:{storage:t},{storage:s,name:u,blacklist:l}=i;return{id:e,name:u??n??e,blacklist:l??a,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>s.getAllKeys(),get:async r=>{const o=await s.getItem(r);if(o!==null)return{key:r,type:"string",value:o}},set:async r=>{if(r.type!=="string")throw new Error("AsyncStorage adapter supports only string values.");await s.setItem(r.key,r.value)},delete:r=>s.removeItem(r)}}},d=e=>{const{adapterId:t="async-storage",adapterName:n="AsyncStorage"}=e,a="storages"in e?Object.entries(e.storages).map(([i,s])=>g(i,s)):[g(e.storageId??"default",e.storage,e.storageName??"Default Storage",e.blacklist)];return{id:t,name:n,storages:a}},w=d,E=async e=>Array.isArray(e)?e:e(),K=({storage:e,keys:t,adapterId:n="expo-secure-store",adapterName:a="Expo SecureStore",storageId:i="default",storageName:s="Default Secure Storage",blacklist:u})=>({id:n,name:a,storages:[{id:i,name:s,blacklist:u,capabilities:{supportedTypes:["string"]},storage:{kind:"async",getAllKeys:()=>E(t),get:async r=>{const o=await e.getItemAsync(r);if(o!==null)return{key:r,type:"string",value:o}},set:async r=>{if(r.type!=="string")throw new Error("Expo SecureStore adapter supports only string values.");await e.setItemAsync(r.key,r.value)},delete:r=>e.deleteItemAsync(r)}}]});exports.useRozeniteStoragePlugin=void 0;const M=typeof window<"u"&&window.navigator.product!=="ReactNative",N=process.env.NODE_ENV!=="production",h=typeof window>"u";N&&!M&&!h?exports.useRozeniteStoragePlugin=require("./useRozeniteStoragePlugin.cjs").useRozeniteStoragePlugin:exports.useRozeniteStoragePlugin=()=>null;exports.createAsyncStorageAdapter=d;exports.createExpoAsyncStorageAdapter=w;exports.createExpoSecureStorageAdapter=K;exports.createMMKVStorageAdapter=V;
|
package/dist/react-native.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { createAsyncStorageAdapter, createExpoAsyncStorageAdapter, createExpoSecureStorageAdapter, createMMKVStorageAdapter, } from './src/react-native/adapters';
|
|
2
|
-
export type { AsyncStorageInstanceConfig, AsyncStorageLike, CreateAsyncStorageAdapterOptions, CreateExpoAsyncStorageAdapterOptions, CreateExpoSecureStorageAdapterOptions, CreateMMKVStorageAdapterOptions, SecureStorageLike, } from './src/react-native/adapters';
|
|
3
|
-
export type { AsyncStorage, StorageAdapter, StorageCapabilities, StorageEntry, StorageEntryType, StorageEntryValue, StorageNode, SyncStorage, } from './src/shared/types';
|
|
4
|
-
export declare let useRozeniteStoragePlugin: typeof import('./src/react-native/useRozeniteStoragePlugin').useRozeniteStoragePlugin;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StorageAdapter } from '../../shared/types';
|
|
2
|
-
export type AsyncStorageLike = {
|
|
3
|
-
getAllKeys: () => Promise<string[]>;
|
|
4
|
-
getItem: (key: string) => Promise<string | null>;
|
|
5
|
-
setItem: (key: string, value: string) => Promise<void>;
|
|
6
|
-
removeItem: (key: string) => Promise<void>;
|
|
7
|
-
};
|
|
8
|
-
export type AsyncStorageInstanceConfig = {
|
|
9
|
-
storage: AsyncStorageLike;
|
|
10
|
-
name?: string;
|
|
11
|
-
blacklist?: RegExp;
|
|
12
|
-
};
|
|
13
|
-
type SingleStorageOptions = {
|
|
14
|
-
storage: AsyncStorageLike;
|
|
15
|
-
adapterId?: string;
|
|
16
|
-
adapterName?: string;
|
|
17
|
-
storageId?: string;
|
|
18
|
-
storageName?: string;
|
|
19
|
-
blacklist?: RegExp;
|
|
20
|
-
};
|
|
21
|
-
type MultiStorageOptions = {
|
|
22
|
-
storages: Record<string, AsyncStorageLike | AsyncStorageInstanceConfig>;
|
|
23
|
-
adapterId?: string;
|
|
24
|
-
adapterName?: string;
|
|
25
|
-
};
|
|
26
|
-
export type CreateAsyncStorageAdapterOptions = SingleStorageOptions | MultiStorageOptions;
|
|
27
|
-
export declare const createAsyncStorageAdapter: (options: CreateAsyncStorageAdapterOptions) => StorageAdapter;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Use createAsyncStorageAdapter instead.
|
|
30
|
-
*/
|
|
31
|
-
export declare const createExpoAsyncStorageAdapter: (options: CreateAsyncStorageAdapterOptions) => StorageAdapter;
|
|
32
|
-
export type CreateExpoAsyncStorageAdapterOptions = CreateAsyncStorageAdapterOptions;
|
|
33
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { createMMKVStorageAdapter } from './mmkv';
|
|
2
|
-
export type { CreateMMKVStorageAdapterOptions } from './mmkv';
|
|
3
|
-
export { createAsyncStorageAdapter, createExpoAsyncStorageAdapter, } from './async-storage';
|
|
4
|
-
export type { AsyncStorageInstanceConfig, AsyncStorageLike, CreateAsyncStorageAdapterOptions, CreateExpoAsyncStorageAdapterOptions, } from './async-storage';
|
|
5
|
-
export { createExpoSecureStorageAdapter } from './secure-storage';
|
|
6
|
-
export type { CreateExpoSecureStorageAdapterOptions, SecureStorageLike, } from './secure-storage';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MMKV as MMKVV3 } from 'react-native-mmkv-v3';
|
|
2
|
-
import { MMKV as MMKVV4 } from 'react-native-mmkv-v4';
|
|
3
|
-
import { StorageAdapter } from '../../shared/types';
|
|
4
|
-
type MMKV = MMKVV3 | MMKVV4;
|
|
5
|
-
export type MMKVBlacklistConfig = RegExp | Record<string, RegExp | undefined>;
|
|
6
|
-
export type CreateMMKVStorageAdapterOptions = {
|
|
7
|
-
adapterId?: string;
|
|
8
|
-
adapterName?: string;
|
|
9
|
-
storages: MMKV[] | Record<string, MMKV>;
|
|
10
|
-
blacklist?: MMKVBlacklistConfig;
|
|
11
|
-
};
|
|
12
|
-
export declare const createMMKVStorageAdapter: ({ adapterId, adapterName, storages, blacklist, }: CreateMMKVStorageAdapterOptions) => StorageAdapter;
|
|
13
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StorageAdapter } from '../../shared/types';
|
|
2
|
-
export type SecureStorageLike = {
|
|
3
|
-
getItemAsync: (key: string) => Promise<string | null>;
|
|
4
|
-
setItemAsync: (key: string, value: string) => Promise<void>;
|
|
5
|
-
deleteItemAsync: (key: string) => Promise<void>;
|
|
6
|
-
};
|
|
7
|
-
type KeySource = string[] | (() => Promise<string[]>);
|
|
8
|
-
export type CreateExpoSecureStorageAdapterOptions = {
|
|
9
|
-
storage: SecureStorageLike;
|
|
10
|
-
keys: KeySource;
|
|
11
|
-
adapterId?: string;
|
|
12
|
-
adapterName?: string;
|
|
13
|
-
storageId?: string;
|
|
14
|
-
storageName?: string;
|
|
15
|
-
blacklist?: RegExp;
|
|
16
|
-
};
|
|
17
|
-
export declare const createExpoSecureStorageAdapter: ({ storage, keys, adapterId, adapterName, storageId, storageName, blacklist, }: CreateExpoSecureStorageAdapterOptions) => StorageAdapter;
|
|
18
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const looksLikeGarbled: (str: string) => boolean;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { StorageAdapter, StorageCapabilities, StorageEntry, StorageNode, StorageSubscription, StorageTarget } from '../shared/types';
|
|
2
|
-
export type StorageView = {
|
|
3
|
-
id: string;
|
|
4
|
-
target: StorageTarget;
|
|
5
|
-
adapterName: string;
|
|
6
|
-
storageName: string;
|
|
7
|
-
capabilities: StorageCapabilities;
|
|
8
|
-
get: (key: string) => Promise<StorageEntry | undefined>;
|
|
9
|
-
set: (entry: StorageEntry) => Promise<void>;
|
|
10
|
-
delete: (key: string) => Promise<void>;
|
|
11
|
-
getAllKeys: () => Promise<string[]>;
|
|
12
|
-
getAllEntries: () => Promise<StorageEntry[]>;
|
|
13
|
-
watch: (callbacks: {
|
|
14
|
-
onSet: (entry: StorageEntry) => void;
|
|
15
|
-
onDelete: (key: string) => void;
|
|
16
|
-
}) => Promise<StorageSubscription>;
|
|
17
|
-
};
|
|
18
|
-
export declare const createStorageView: (adapter: StorageAdapter, storageNode: StorageNode) => StorageView;
|
|
19
|
-
export declare const createStorageViews: (storages: StorageAdapter[]) => StorageView[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { StorageEventMap } from '../shared/messaging';
|
|
2
|
-
import { StorageAdapter } from '../shared/types';
|
|
3
|
-
export type RozeniteStoragePluginOptions = {
|
|
4
|
-
storages: StorageAdapter[];
|
|
5
|
-
};
|
|
6
|
-
export declare const useRozeniteStoragePlugin: ({ storages, }: RozeniteStoragePluginOptions) => import('../../../plugin-bridge/src/index.ts').RozeniteDevToolsClient<StorageEventMap> | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { StorageCapabilities, StorageEntry, StorageTarget } from './types';
|
|
2
|
-
export type StorageSnapshotEvent = {
|
|
3
|
-
type: 'snapshot';
|
|
4
|
-
target: StorageTarget;
|
|
5
|
-
adapterName: string;
|
|
6
|
-
storageName: string;
|
|
7
|
-
capabilities: StorageCapabilities;
|
|
8
|
-
entries: StorageEntry[];
|
|
9
|
-
};
|
|
10
|
-
export type StorageSetEntryEvent = {
|
|
11
|
-
type: 'set-entry';
|
|
12
|
-
target: StorageTarget;
|
|
13
|
-
entry: StorageEntry;
|
|
14
|
-
};
|
|
15
|
-
export type StorageDeleteEntryEvent = {
|
|
16
|
-
type: 'delete-entry';
|
|
17
|
-
target: StorageTarget;
|
|
18
|
-
key: string;
|
|
19
|
-
};
|
|
20
|
-
export type StorageGetSnapshotEvent = {
|
|
21
|
-
type: 'get-snapshot';
|
|
22
|
-
target: StorageTarget | 'all';
|
|
23
|
-
};
|
|
24
|
-
export type StorageEvent = StorageSnapshotEvent | StorageSetEntryEvent | StorageDeleteEntryEvent | StorageGetSnapshotEvent;
|
|
25
|
-
export type StorageEventMap = {
|
|
26
|
-
[K in StorageEvent['type']]: Extract<StorageEvent, {
|
|
27
|
-
type: K;
|
|
28
|
-
}>;
|
|
29
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export type StorageEntry = {
|
|
2
|
-
key: string;
|
|
3
|
-
type: 'string';
|
|
4
|
-
value: string;
|
|
5
|
-
} | {
|
|
6
|
-
key: string;
|
|
7
|
-
type: 'number';
|
|
8
|
-
value: number;
|
|
9
|
-
} | {
|
|
10
|
-
key: string;
|
|
11
|
-
type: 'boolean';
|
|
12
|
-
value: boolean;
|
|
13
|
-
} | {
|
|
14
|
-
key: string;
|
|
15
|
-
type: 'buffer';
|
|
16
|
-
value: number[];
|
|
17
|
-
};
|
|
18
|
-
export type StorageEntryType = StorageEntry['type'];
|
|
19
|
-
export type StorageEntryValue = StorageEntry['value'];
|
|
20
|
-
export type StorageCapabilities = {
|
|
21
|
-
supportedTypes: StorageEntryType[];
|
|
22
|
-
};
|
|
23
|
-
export type StorageSubscription = {
|
|
24
|
-
remove: () => void;
|
|
25
|
-
};
|
|
26
|
-
export type SyncStorage = {
|
|
27
|
-
kind: 'sync';
|
|
28
|
-
getAllKeys: () => string[];
|
|
29
|
-
get: (key: string) => StorageEntry | undefined;
|
|
30
|
-
set: (entry: StorageEntry) => void;
|
|
31
|
-
delete: (key: string) => void;
|
|
32
|
-
subscribe?: (callback: (key: string) => void) => StorageSubscription;
|
|
33
|
-
};
|
|
34
|
-
export type AsyncStorage = {
|
|
35
|
-
kind: 'async';
|
|
36
|
-
getAllKeys: () => Promise<string[]>;
|
|
37
|
-
get: (key: string) => Promise<StorageEntry | undefined>;
|
|
38
|
-
set: (entry: StorageEntry) => Promise<void>;
|
|
39
|
-
delete: (key: string) => Promise<void>;
|
|
40
|
-
subscribe?: (callback: (key: string) => void) => StorageSubscription;
|
|
41
|
-
};
|
|
42
|
-
export type StorageNode = {
|
|
43
|
-
id: string;
|
|
44
|
-
name: string;
|
|
45
|
-
storage: SyncStorage | AsyncStorage;
|
|
46
|
-
capabilities: StorageCapabilities;
|
|
47
|
-
blacklist?: RegExp;
|
|
48
|
-
};
|
|
49
|
-
export type StorageAdapter = {
|
|
50
|
-
id: string;
|
|
51
|
-
name: string;
|
|
52
|
-
storages: StorageNode[];
|
|
53
|
-
};
|
|
54
|
-
export type StorageTarget = {
|
|
55
|
-
adapterId: string;
|
|
56
|
-
storageId: string;
|
|
57
|
-
};
|
|
58
|
-
export declare const DEFAULT_SUPPORTED_TYPES: StorageEntryType[];
|
|
59
|
-
export declare const getStorageViewId: ({ adapterId, storageId }: StorageTarget) => string;
|
|
60
|
-
export declare const supportsType: (capabilities: StorageCapabilities, type: StorageEntryType) => boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StorageEntry, StorageEntryType } from '../shared/types';
|
|
2
|
-
export type AddEntryDialogProps = {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
onAddEntry: (entry: StorageEntry) => void;
|
|
6
|
-
existingKeys: string[];
|
|
7
|
-
supportedTypes: StorageEntryType[];
|
|
8
|
-
};
|
|
9
|
-
export declare const AddEntryDialog: ({ isOpen, onClose, onAddEntry, existingKeys, supportedTypes, }: AddEntryDialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type ConfirmDialogProps = {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
onClose: () => void;
|
|
4
|
-
onConfirm: () => void;
|
|
5
|
-
title: string;
|
|
6
|
-
message: string;
|
|
7
|
-
type?: 'confirm' | 'alert';
|
|
8
|
-
confirmText?: string;
|
|
9
|
-
cancelText?: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const ConfirmDialog: ({ isOpen, onClose, onConfirm, title, message, type, confirmText, cancelText, }: ConfirmDialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StorageEntry, StorageEntryType, StorageEntryValue } from '../shared/types';
|
|
2
|
-
export type EditEntryDialogProps = {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
onEditEntry: (key: string, newValue: StorageEntryValue) => void;
|
|
6
|
-
entry: StorageEntry | null;
|
|
7
|
-
supportedTypes: StorageEntryType[];
|
|
8
|
-
};
|
|
9
|
-
export declare const EditEntryDialog: ({ isOpen, onClose, onEditEntry, entry, supportedTypes, }: EditEntryDialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StorageEntry, StorageEntryType, StorageEntryValue } from '../shared/types';
|
|
2
|
-
export type EditableTableProps = {
|
|
3
|
-
data: StorageEntry[];
|
|
4
|
-
supportedTypes: StorageEntryType[];
|
|
5
|
-
onValueChange?: (key: string, newValue: StorageEntryValue) => void;
|
|
6
|
-
onDeleteEntry?: (key: string) => void;
|
|
7
|
-
onRowClick?: (entry: StorageEntry) => void;
|
|
8
|
-
loading?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export declare const EditableTable: ({ data, supportedTypes, onValueChange, onDeleteEntry, onRowClick, loading, }: EditableTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { StorageEntry } from '../shared/types';
|
|
2
|
-
export type EntryDetailDialogProps = {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
onEdit?: (entry: StorageEntry) => void;
|
|
6
|
-
entry: StorageEntry | null;
|
|
7
|
-
};
|
|
8
|
-
export declare const EntryDetailDialog: ({ isOpen, onClose, onEdit, entry, }: EntryDetailDialogProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/dist/src/ui/panel.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function StoragePanel(): import("react/jsx-runtime").JSX.Element;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|