@buoy-gg/storage 4.0.1 → 5.0.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.
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.storageSyncAdapter = void 0;
|
|
7
7
|
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
8
9
|
var _asyncStorageCompat = require("../utils/asyncStorageCompat");
|
|
9
10
|
var _storageEventStore = require("../stores/storageEventStore");
|
|
10
11
|
var _clearAllStorage = require("../utils/clearAllStorage");
|
|
@@ -23,7 +24,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
23
24
|
*/
|
|
24
25
|
const storageSyncAdapter = exports.storageSyncAdapter = {
|
|
25
26
|
version: 1,
|
|
26
|
-
|
|
27
|
+
// Strip Buoy's OWN devtool keys (@react_buoy*, @buoy*, buoy-*, legacy) at the
|
|
28
|
+
// source so no sync client (desktop, MCP, raw socket) ever sees them as if
|
|
29
|
+
// they were app data — matching the tools' default key filters, but
|
|
30
|
+
// authoritative instead of UI-only.
|
|
31
|
+
getSnapshot: () => _storageEventStore.storageEventStore.getEvents().filter(e => {
|
|
32
|
+
const key = e.data?.key;
|
|
33
|
+
return !(typeof key === "string" && (0, _sharedUi.isDevToolsStorageKey)(key));
|
|
34
|
+
}),
|
|
27
35
|
subscribe: onChange => _storageEventStore.storageEventStore.subscribeToEvents(onChange),
|
|
28
36
|
actions: {
|
|
29
37
|
clearEvents: () => {
|
|
@@ -35,9 +43,15 @@ const storageSyncAdapter = exports.storageSyncAdapter = {
|
|
|
35
43
|
// Single-item methods share the same signature across async-storage v2/v3;
|
|
36
44
|
// batch methods go through the compat helpers (which translate to v3's
|
|
37
45
|
// getMany/setMany/removeMany) and keep the v2 tuple/pairs shape on the wire.
|
|
38
|
-
|
|
39
|
-
"async.
|
|
40
|
-
"async.
|
|
46
|
+
// Read paths filter out Buoy's own devtool keys so they're never exposed.
|
|
47
|
+
"async.getAllKeys": async () => (await _asyncStorage.default.getAllKeys()).filter(k => !(0, _sharedUi.isDevToolsStorageKey)(k)),
|
|
48
|
+
"async.multiGet": async params => (await (0, _asyncStorageCompat.readMany)(params.keys)).filter(([k]) => !(0, _sharedUi.isDevToolsStorageKey)(k)),
|
|
49
|
+
"async.getItem": params => {
|
|
50
|
+
const {
|
|
51
|
+
key
|
|
52
|
+
} = params;
|
|
53
|
+
return (0, _sharedUi.isDevToolsStorageKey)(key) ? Promise.resolve(null) : _asyncStorage.default.getItem(key);
|
|
54
|
+
},
|
|
41
55
|
"async.setItem": params => {
|
|
42
56
|
const {
|
|
43
57
|
key,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
|
+
import { isDevToolsStorageKey } from "@buoy-gg/shared-ui";
|
|
4
5
|
import { readMany, writeMany, removeMany } from "../utils/asyncStorageCompat";
|
|
5
6
|
import { storageEventStore } from "../stores/storageEventStore";
|
|
6
7
|
import { clearAllAppStorage } from "../utils/clearAllStorage";
|
|
@@ -18,7 +19,14 @@ import { clearAllAppStorage } from "../utils/clearAllStorage";
|
|
|
18
19
|
*/
|
|
19
20
|
export const storageSyncAdapter = {
|
|
20
21
|
version: 1,
|
|
21
|
-
|
|
22
|
+
// Strip Buoy's OWN devtool keys (@react_buoy*, @buoy*, buoy-*, legacy) at the
|
|
23
|
+
// source so no sync client (desktop, MCP, raw socket) ever sees them as if
|
|
24
|
+
// they were app data — matching the tools' default key filters, but
|
|
25
|
+
// authoritative instead of UI-only.
|
|
26
|
+
getSnapshot: () => storageEventStore.getEvents().filter(e => {
|
|
27
|
+
const key = e.data?.key;
|
|
28
|
+
return !(typeof key === "string" && isDevToolsStorageKey(key));
|
|
29
|
+
}),
|
|
22
30
|
subscribe: onChange => storageEventStore.subscribeToEvents(onChange),
|
|
23
31
|
actions: {
|
|
24
32
|
clearEvents: () => {
|
|
@@ -30,9 +38,15 @@ export const storageSyncAdapter = {
|
|
|
30
38
|
// Single-item methods share the same signature across async-storage v2/v3;
|
|
31
39
|
// batch methods go through the compat helpers (which translate to v3's
|
|
32
40
|
// getMany/setMany/removeMany) and keep the v2 tuple/pairs shape on the wire.
|
|
33
|
-
|
|
34
|
-
"async.
|
|
35
|
-
"async.
|
|
41
|
+
// Read paths filter out Buoy's own devtool keys so they're never exposed.
|
|
42
|
+
"async.getAllKeys": async () => (await AsyncStorage.getAllKeys()).filter(k => !isDevToolsStorageKey(k)),
|
|
43
|
+
"async.multiGet": async params => (await readMany(params.keys)).filter(([k]) => !isDevToolsStorageKey(k)),
|
|
44
|
+
"async.getItem": params => {
|
|
45
|
+
const {
|
|
46
|
+
key
|
|
47
|
+
} = params;
|
|
48
|
+
return isDevToolsStorageKey(key) ? Promise.resolve(null) : AsyncStorage.getItem(key);
|
|
49
|
+
},
|
|
36
50
|
"async.setItem": params => {
|
|
37
51
|
const {
|
|
38
52
|
key,
|
|
@@ -18,7 +18,7 @@ export declare const storageSyncAdapter: {
|
|
|
18
18
|
clearEvents: () => void;
|
|
19
19
|
/** Clears all app storage keys, preserving dev tools settings. */
|
|
20
20
|
clearAppStorage: () => Promise<void>;
|
|
21
|
-
"async.getAllKeys": () => Promise<
|
|
21
|
+
"async.getAllKeys": () => Promise<string[]>;
|
|
22
22
|
"async.multiGet": (params: unknown) => Promise<[string, string | null][]>;
|
|
23
23
|
"async.getItem": (params: unknown) => Promise<string | null>;
|
|
24
24
|
"async.setItem": (params: unknown) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/storage/sync/storageSyncAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storageSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/storage/sync/storageSyncAdapter.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;;;0BAaP,MAAM,IAAI;;;QAM9B,kEAAkE;;;mCAUjC,OAAO;kCAId,OAAO;kCAMP,OAAO;qCAIJ,OAAO;sCAEN,OAAO;mCAEV,OAAO;;;CAIrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/storage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "storage package",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/floating-tools-core": "
|
|
30
|
-
"@buoy-gg/shared-ui": "
|
|
29
|
+
"@buoy-gg/floating-tools-core": "5.0.0",
|
|
30
|
+
"@buoy-gg/shared-ui": "5.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@buoy-gg/license": "
|
|
33
|
+
"@buoy-gg/license": "5.0.0",
|
|
34
34
|
"@react-native-async-storage/async-storage": "^2.0.0 || ^3.1.0",
|
|
35
35
|
"react": "*",
|
|
36
36
|
"react-native": "*"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/react": "^19.1.0",
|
|
41
41
|
"@types/react-native": "^0.73.0",
|
|
42
42
|
"typescript": "~5.8.3",
|
|
43
|
-
"@buoy-gg/license": "
|
|
43
|
+
"@buoy-gg/license": "5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"react-native-builder-bob": {
|
|
46
46
|
"source": "src",
|