@buoy-gg/storage 2.1.15 → 3.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.
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/storage/stores/storageEventStore.js +81 -0
- package/lib/commonjs/storage/sync/storageSyncAdapter.js +49 -0
- package/lib/module/index.js +5 -0
- package/lib/module/storage/stores/storageEventStore.js +81 -0
- package/lib/module/storage/sync/storageSyncAdapter.js +44 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/storage/stores/storageEventStore.d.ts +8 -0
- package/lib/typescript/storage/stores/storageEventStore.d.ts.map +1 -1
- package/lib/typescript/storage/sync/storageSyncAdapter.d.ts +31 -0
- package/lib/typescript/storage/sync/storageSyncAdapter.d.ts.map +1 -0
- package/package.json +5 -5
package/lib/commonjs/index.js
CHANGED
|
@@ -153,6 +153,12 @@ Object.defineProperty(exports, "storageEventStore", {
|
|
|
153
153
|
return _storageEventStore.storageEventStore;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
+
Object.defineProperty(exports, "storageSyncAdapter", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _storageSyncAdapter.storageSyncAdapter;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
156
162
|
Object.defineProperty(exports, "storageToolPreset", {
|
|
157
163
|
enumerable: true,
|
|
158
164
|
get: function () {
|
|
@@ -234,4 +240,5 @@ var _mmkvAvailability = require("./storage/utils/mmkvAvailability");
|
|
|
234
240
|
var _mmkvTypeDetection = require("./storage/utils/mmkvTypeDetection");
|
|
235
241
|
var _storageTimeTravelUtils = require("./storage/utils/storageTimeTravelUtils");
|
|
236
242
|
var _MMKVInstanceRegistry = require("./storage/utils/MMKVInstanceRegistry");
|
|
243
|
+
var _storageSyncAdapter = require("./storage/sync/storageSyncAdapter");
|
|
237
244
|
var _storageEventStore = require("./storage/stores/storageEventStore");
|
|
@@ -7,6 +7,8 @@ exports.subscribeToStorageEvents = exports.storageEventStore = exports.onStorage
|
|
|
7
7
|
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
8
8
|
var _AsyncStorageListener = require("../utils/AsyncStorageListener");
|
|
9
9
|
var _MMKVListener = require("../utils/MMKVListener");
|
|
10
|
+
var _MMKVInstanceRegistry = require("../utils/MMKVInstanceRegistry");
|
|
11
|
+
var _mmkvTypeDetection = require("../utils/mmkvTypeDetection");
|
|
10
12
|
/**
|
|
11
13
|
* Storage Event Store
|
|
12
14
|
*
|
|
@@ -53,6 +55,7 @@ class StorageEventStore extends _sharedUi.BaseEventStore {
|
|
|
53
55
|
// Unsubscribe functions for raw listeners
|
|
54
56
|
asyncStorageUnsubscribe = null;
|
|
55
57
|
mmkvUnsubscribe = null;
|
|
58
|
+
hasScannedInitialState = false;
|
|
56
59
|
constructor() {
|
|
57
60
|
super({
|
|
58
61
|
storeName: "storage",
|
|
@@ -60,6 +63,81 @@ class StorageEventStore extends _sharedUi.BaseEventStore {
|
|
|
60
63
|
});
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Scan all registered MMKV instances and AsyncStorage for existing keys,
|
|
68
|
+
* creating synthetic events so that getEvents() includes the current state
|
|
69
|
+
* (not just changes made after capture started). Only runs once per store
|
|
70
|
+
* lifetime to avoid duplicates.
|
|
71
|
+
*/
|
|
72
|
+
async scanExistingState() {
|
|
73
|
+
if (this.hasScannedInitialState) return;
|
|
74
|
+
this.hasScannedInitialState = true;
|
|
75
|
+
const now = new Date();
|
|
76
|
+
|
|
77
|
+
// ── MMKV: synchronous scan ──
|
|
78
|
+
const instances = _MMKVInstanceRegistry.mmkvInstanceRegistry.getAll();
|
|
79
|
+
for (const {
|
|
80
|
+
id: instanceId,
|
|
81
|
+
instance
|
|
82
|
+
} of instances) {
|
|
83
|
+
try {
|
|
84
|
+
const keys = instance.getAllKeys();
|
|
85
|
+
for (const key of keys) {
|
|
86
|
+
const {
|
|
87
|
+
value,
|
|
88
|
+
type: valueType
|
|
89
|
+
} = (0, _mmkvTypeDetection.detectMMKVType)(instance, key);
|
|
90
|
+
const actionMap = {
|
|
91
|
+
string: "set.string",
|
|
92
|
+
number: "set.number",
|
|
93
|
+
boolean: "set.boolean",
|
|
94
|
+
buffer: "set.buffer"
|
|
95
|
+
};
|
|
96
|
+
const action = actionMap[valueType] ?? "set.string";
|
|
97
|
+
this.addEvent({
|
|
98
|
+
action,
|
|
99
|
+
timestamp: now,
|
|
100
|
+
instanceId,
|
|
101
|
+
data: {
|
|
102
|
+
key,
|
|
103
|
+
value,
|
|
104
|
+
valueType
|
|
105
|
+
},
|
|
106
|
+
storageType: "mmkv",
|
|
107
|
+
id: nextStorageEventId()
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
// Instance may not be accessible — skip silently
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── AsyncStorage: async scan ──
|
|
116
|
+
try {
|
|
117
|
+
const AsyncStorage = require("@react-native-async-storage/async-storage").default;
|
|
118
|
+
if (AsyncStorage) {
|
|
119
|
+
const allKeys = await AsyncStorage.getAllKeys();
|
|
120
|
+
if (allKeys.length > 0) {
|
|
121
|
+
const pairs = await AsyncStorage.multiGet(allKeys);
|
|
122
|
+
for (const [key, rawValue] of pairs) {
|
|
123
|
+
this.addEvent({
|
|
124
|
+
action: "setItem",
|
|
125
|
+
timestamp: now,
|
|
126
|
+
data: {
|
|
127
|
+
key,
|
|
128
|
+
value: rawValue ?? undefined
|
|
129
|
+
},
|
|
130
|
+
storageType: "async",
|
|
131
|
+
id: nextStorageEventId()
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
// AsyncStorage not available — skip silently
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
63
141
|
/**
|
|
64
142
|
* Start capturing storage events from both AsyncStorage and MMKV
|
|
65
143
|
*/
|
|
@@ -92,6 +170,9 @@ class StorageEventStore extends _sharedUi.BaseEventStore {
|
|
|
92
170
|
this.addEvent(storageEvent);
|
|
93
171
|
});
|
|
94
172
|
}
|
|
173
|
+
|
|
174
|
+
// Scan existing keys so getEvents() includes pre-existing state
|
|
175
|
+
await this.scanExistingState();
|
|
95
176
|
}
|
|
96
177
|
|
|
97
178
|
/**
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.storageSyncAdapter = void 0;
|
|
7
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
+
var _storageEventStore = require("../stores/storageEventStore");
|
|
9
|
+
var _clearAllStorage = require("../utils/clearAllStorage");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Sync adapter for the storage tool, consumed by @buoy-gg/external-sync's
|
|
13
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
14
|
+
* this package doesn't need a dependency on it).
|
|
15
|
+
*
|
|
16
|
+
* Subscribing starts the underlying capture lifecycle (including the initial
|
|
17
|
+
* key scan), so storage events are only recorded while a dashboard is
|
|
18
|
+
* watching.
|
|
19
|
+
*
|
|
20
|
+
* The `async.*` actions mirror the AsyncStorage API so the desktop dashboard
|
|
21
|
+
* can proxy its browse/edit mode against the device's real storage.
|
|
22
|
+
*/
|
|
23
|
+
const storageSyncAdapter = exports.storageSyncAdapter = {
|
|
24
|
+
version: 1,
|
|
25
|
+
getSnapshot: () => _storageEventStore.storageEventStore.getEvents(),
|
|
26
|
+
subscribe: onChange => _storageEventStore.storageEventStore.subscribeToEvents(onChange),
|
|
27
|
+
actions: {
|
|
28
|
+
clearEvents: () => {
|
|
29
|
+
_storageEventStore.storageEventStore.clearEvents();
|
|
30
|
+
},
|
|
31
|
+
/** Clears all app storage keys, preserving dev tools settings. */
|
|
32
|
+
clearAppStorage: () => (0, _clearAllStorage.clearAllAppStorage)(),
|
|
33
|
+
// ── Remote AsyncStorage proxy (desktop browse/edit mode) ──
|
|
34
|
+
"async.getAllKeys": () => _asyncStorage.default.getAllKeys(),
|
|
35
|
+
"async.multiGet": params => _asyncStorage.default.multiGet(params.keys),
|
|
36
|
+
"async.getItem": params => _asyncStorage.default.getItem(params.key),
|
|
37
|
+
"async.setItem": params => {
|
|
38
|
+
const {
|
|
39
|
+
key,
|
|
40
|
+
value
|
|
41
|
+
} = params;
|
|
42
|
+
return _asyncStorage.default.setItem(key, value);
|
|
43
|
+
},
|
|
44
|
+
"async.removeItem": params => _asyncStorage.default.removeItem(params.key),
|
|
45
|
+
"async.multiRemove": params => _asyncStorage.default.multiRemove(params.keys),
|
|
46
|
+
"async.multiSet": params => _asyncStorage.default.multiSet(params.pairs),
|
|
47
|
+
"async.clear": () => _asyncStorage.default.clear()
|
|
48
|
+
}
|
|
49
|
+
};
|
package/lib/module/index.js
CHANGED
|
@@ -55,6 +55,11 @@ export { undoOperation, jumpToState, canUndo } from "./storage/utils/storageTime
|
|
|
55
55
|
// =============================================================================
|
|
56
56
|
export { registerMMKVInstance, unregisterMMKVInstance } from "./storage/utils/MMKVInstanceRegistry";
|
|
57
57
|
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// EXTERNAL SYNC (Adapter for @buoy-gg/external-sync's useExternalSync)
|
|
60
|
+
// =============================================================================
|
|
61
|
+
export { storageSyncAdapter } from "./storage/sync/storageSyncAdapter";
|
|
62
|
+
|
|
58
63
|
// =============================================================================
|
|
59
64
|
// INTERNAL EXPORTS (For @buoy-gg/* packages only - not part of public API)
|
|
60
65
|
// =============================================================================
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
import { BaseEventStore } from "@buoy-gg/shared-ui";
|
|
26
26
|
import { startListening as startAsyncStorageListening, addListener as addAsyncStorageListener, isListening as isAsyncStorageListening } from "../utils/AsyncStorageListener";
|
|
27
27
|
import { addMMKVListener } from "../utils/MMKVListener";
|
|
28
|
+
import { mmkvInstanceRegistry } from "../utils/MMKVInstanceRegistry";
|
|
29
|
+
import { detectMMKVType } from "../utils/mmkvTypeDetection";
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Unified storage event type combining AsyncStorage and MMKV events.
|
|
@@ -50,6 +52,7 @@ class StorageEventStore extends BaseEventStore {
|
|
|
50
52
|
// Unsubscribe functions for raw listeners
|
|
51
53
|
asyncStorageUnsubscribe = null;
|
|
52
54
|
mmkvUnsubscribe = null;
|
|
55
|
+
hasScannedInitialState = false;
|
|
53
56
|
constructor() {
|
|
54
57
|
super({
|
|
55
58
|
storeName: "storage",
|
|
@@ -57,6 +60,81 @@ class StorageEventStore extends BaseEventStore {
|
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Scan all registered MMKV instances and AsyncStorage for existing keys,
|
|
65
|
+
* creating synthetic events so that getEvents() includes the current state
|
|
66
|
+
* (not just changes made after capture started). Only runs once per store
|
|
67
|
+
* lifetime to avoid duplicates.
|
|
68
|
+
*/
|
|
69
|
+
async scanExistingState() {
|
|
70
|
+
if (this.hasScannedInitialState) return;
|
|
71
|
+
this.hasScannedInitialState = true;
|
|
72
|
+
const now = new Date();
|
|
73
|
+
|
|
74
|
+
// ── MMKV: synchronous scan ──
|
|
75
|
+
const instances = mmkvInstanceRegistry.getAll();
|
|
76
|
+
for (const {
|
|
77
|
+
id: instanceId,
|
|
78
|
+
instance
|
|
79
|
+
} of instances) {
|
|
80
|
+
try {
|
|
81
|
+
const keys = instance.getAllKeys();
|
|
82
|
+
for (const key of keys) {
|
|
83
|
+
const {
|
|
84
|
+
value,
|
|
85
|
+
type: valueType
|
|
86
|
+
} = detectMMKVType(instance, key);
|
|
87
|
+
const actionMap = {
|
|
88
|
+
string: "set.string",
|
|
89
|
+
number: "set.number",
|
|
90
|
+
boolean: "set.boolean",
|
|
91
|
+
buffer: "set.buffer"
|
|
92
|
+
};
|
|
93
|
+
const action = actionMap[valueType] ?? "set.string";
|
|
94
|
+
this.addEvent({
|
|
95
|
+
action,
|
|
96
|
+
timestamp: now,
|
|
97
|
+
instanceId,
|
|
98
|
+
data: {
|
|
99
|
+
key,
|
|
100
|
+
value,
|
|
101
|
+
valueType
|
|
102
|
+
},
|
|
103
|
+
storageType: "mmkv",
|
|
104
|
+
id: nextStorageEventId()
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
// Instance may not be accessible — skip silently
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── AsyncStorage: async scan ──
|
|
113
|
+
try {
|
|
114
|
+
const AsyncStorage = require("@react-native-async-storage/async-storage").default;
|
|
115
|
+
if (AsyncStorage) {
|
|
116
|
+
const allKeys = await AsyncStorage.getAllKeys();
|
|
117
|
+
if (allKeys.length > 0) {
|
|
118
|
+
const pairs = await AsyncStorage.multiGet(allKeys);
|
|
119
|
+
for (const [key, rawValue] of pairs) {
|
|
120
|
+
this.addEvent({
|
|
121
|
+
action: "setItem",
|
|
122
|
+
timestamp: now,
|
|
123
|
+
data: {
|
|
124
|
+
key,
|
|
125
|
+
value: rawValue ?? undefined
|
|
126
|
+
},
|
|
127
|
+
storageType: "async",
|
|
128
|
+
id: nextStorageEventId()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} catch {
|
|
134
|
+
// AsyncStorage not available — skip silently
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
60
138
|
/**
|
|
61
139
|
* Start capturing storage events from both AsyncStorage and MMKV
|
|
62
140
|
*/
|
|
@@ -89,6 +167,9 @@ class StorageEventStore extends BaseEventStore {
|
|
|
89
167
|
this.addEvent(storageEvent);
|
|
90
168
|
});
|
|
91
169
|
}
|
|
170
|
+
|
|
171
|
+
// Scan existing keys so getEvents() includes pre-existing state
|
|
172
|
+
await this.scanExistingState();
|
|
92
173
|
}
|
|
93
174
|
|
|
94
175
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
|
+
import { storageEventStore } from "../stores/storageEventStore";
|
|
5
|
+
import { clearAllAppStorage } from "../utils/clearAllStorage";
|
|
6
|
+
/**
|
|
7
|
+
* Sync adapter for the storage tool, consumed by @buoy-gg/external-sync's
|
|
8
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
9
|
+
* this package doesn't need a dependency on it).
|
|
10
|
+
*
|
|
11
|
+
* Subscribing starts the underlying capture lifecycle (including the initial
|
|
12
|
+
* key scan), so storage events are only recorded while a dashboard is
|
|
13
|
+
* watching.
|
|
14
|
+
*
|
|
15
|
+
* The `async.*` actions mirror the AsyncStorage API so the desktop dashboard
|
|
16
|
+
* can proxy its browse/edit mode against the device's real storage.
|
|
17
|
+
*/
|
|
18
|
+
export const storageSyncAdapter = {
|
|
19
|
+
version: 1,
|
|
20
|
+
getSnapshot: () => storageEventStore.getEvents(),
|
|
21
|
+
subscribe: onChange => storageEventStore.subscribeToEvents(onChange),
|
|
22
|
+
actions: {
|
|
23
|
+
clearEvents: () => {
|
|
24
|
+
storageEventStore.clearEvents();
|
|
25
|
+
},
|
|
26
|
+
/** Clears all app storage keys, preserving dev tools settings. */
|
|
27
|
+
clearAppStorage: () => clearAllAppStorage(),
|
|
28
|
+
// ── Remote AsyncStorage proxy (desktop browse/edit mode) ──
|
|
29
|
+
"async.getAllKeys": () => AsyncStorage.getAllKeys(),
|
|
30
|
+
"async.multiGet": params => AsyncStorage.multiGet(params.keys),
|
|
31
|
+
"async.getItem": params => AsyncStorage.getItem(params.key),
|
|
32
|
+
"async.setItem": params => {
|
|
33
|
+
const {
|
|
34
|
+
key,
|
|
35
|
+
value
|
|
36
|
+
} = params;
|
|
37
|
+
return AsyncStorage.setItem(key, value);
|
|
38
|
+
},
|
|
39
|
+
"async.removeItem": params => AsyncStorage.removeItem(params.key),
|
|
40
|
+
"async.multiRemove": params => AsyncStorage.multiRemove(params.keys),
|
|
41
|
+
"async.multiSet": params => AsyncStorage.multiSet(params.pairs),
|
|
42
|
+
"async.clear": () => AsyncStorage.clear()
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -33,6 +33,7 @@ export type { AsyncStorageEvent, AsyncStorageEventListener, } from "./storage/ut
|
|
|
33
33
|
export type { MMKVEvent, MMKVEventListener, } from "./storage/utils/MMKVListener";
|
|
34
34
|
export type { MMKVInstanceInfo } from "./storage/utils/MMKVInstanceRegistry";
|
|
35
35
|
export { registerMMKVInstance, unregisterMMKVInstance, } from "./storage/utils/MMKVInstanceRegistry";
|
|
36
|
+
export { storageSyncAdapter } from "./storage/sync/storageSyncAdapter";
|
|
36
37
|
/** @internal */
|
|
37
38
|
export { storageEventStore } from "./storage/stores/storageEventStore";
|
|
38
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAKhE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CA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AAoC,CAAC;AAK5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,WAAW,EACX,OAAO,GACR,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACV,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,SAAS,EACT,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAK7E,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAK9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAKvE,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -46,7 +46,15 @@ export type StorageEventCallback = (event: StorageEvent) => void;
|
|
|
46
46
|
declare class StorageEventStore extends BaseEventStore<StorageEvent> {
|
|
47
47
|
private asyncStorageUnsubscribe;
|
|
48
48
|
private mmkvUnsubscribe;
|
|
49
|
+
private hasScannedInitialState;
|
|
49
50
|
constructor();
|
|
51
|
+
/**
|
|
52
|
+
* Scan all registered MMKV instances and AsyncStorage for existing keys,
|
|
53
|
+
* creating synthetic events so that getEvents() includes the current state
|
|
54
|
+
* (not just changes made after capture started). Only runs once per store
|
|
55
|
+
* lifetime to avoid duplicates.
|
|
56
|
+
*/
|
|
57
|
+
private scanExistingState;
|
|
50
58
|
/**
|
|
51
59
|
* Start capturing storage events from both AsyncStorage and MMKV
|
|
52
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageEventStore.d.ts","sourceRoot":"","sources":["../../../../src/storage/stores/storageEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"storageEventStore.d.ts","sourceRoot":"","sources":["../../../../src/storage/stores/storageEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAI/B;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,CAAC,iBAAiB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1D,CAAC,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAOtD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;AAEjE,cAAM,iBAAkB,SAAQ,cAAc,CAAC,YAAY,CAAC;IAE1D,OAAO,CAAC,uBAAuB,CAA6B;IAC5D,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,sBAAsB,CAAS;;IASvC;;;;;OAKG;YACW,iBAAiB;IA4D/B;;OAEG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC/C;;OAEG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;IAc/B;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,eAAe,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,EAAE;CAG/D;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAGzD,eAAO,MAAM,wBAAwB,GAAI,UAAU,oBAAoB,eACxB,CAAC;AAChD,eAAO,MAAM,cAAc,GAAI,UAAU,oBAAoB,eACxB,CAAC;AACtC,eAAO,MAAM,gBAAgB,sBAAsC,CAAC;AACpE,eAAO,MAAM,kBAAkB,YAAwC,CAAC;AACxE,eAAO,MAAM,kBAAkB,eAAwC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync adapter for the storage tool, consumed by @buoy-gg/external-sync's
|
|
3
|
+
* `useExternalSync` (structurally matches its ToolSyncAdapter interface so
|
|
4
|
+
* this package doesn't need a dependency on it).
|
|
5
|
+
*
|
|
6
|
+
* Subscribing starts the underlying capture lifecycle (including the initial
|
|
7
|
+
* key scan), so storage events are only recorded while a dashboard is
|
|
8
|
+
* watching.
|
|
9
|
+
*
|
|
10
|
+
* The `async.*` actions mirror the AsyncStorage API so the desktop dashboard
|
|
11
|
+
* can proxy its browse/edit mode against the device's real storage.
|
|
12
|
+
*/
|
|
13
|
+
export declare const storageSyncAdapter: {
|
|
14
|
+
version: number;
|
|
15
|
+
getSnapshot: () => import("..").StorageEvent[];
|
|
16
|
+
subscribe: (onChange: () => void) => () => void;
|
|
17
|
+
actions: {
|
|
18
|
+
clearEvents: () => void;
|
|
19
|
+
/** Clears all app storage keys, preserving dev tools settings. */
|
|
20
|
+
clearAppStorage: () => Promise<void>;
|
|
21
|
+
"async.getAllKeys": () => Promise<readonly string[]>;
|
|
22
|
+
"async.multiGet": (params: unknown) => Promise<readonly import("@react-native-async-storage/async-storage/lib/typescript/types").KeyValuePair[]>;
|
|
23
|
+
"async.getItem": (params: unknown) => Promise<string | null>;
|
|
24
|
+
"async.setItem": (params: unknown) => Promise<void>;
|
|
25
|
+
"async.removeItem": (params: unknown) => Promise<void>;
|
|
26
|
+
"async.multiRemove": (params: unknown) => Promise<void>;
|
|
27
|
+
"async.multiSet": (params: unknown) => Promise<void>;
|
|
28
|
+
"async.clear": () => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=storageSyncAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/storage/sync/storageSyncAdapter.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB;;;0BAGP,MAAM,IAAI;;;QAM9B,kEAAkE;;;mCAKvC,OAAO;kCAER,OAAO;kCAEP,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": "3.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/
|
|
30
|
-
"@buoy-gg/
|
|
29
|
+
"@buoy-gg/floating-tools-core": "3.0.0",
|
|
30
|
+
"@buoy-gg/shared-ui": "3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@buoy-gg/license": "
|
|
33
|
+
"@buoy-gg/license": "3.0.0",
|
|
34
34
|
"@react-native-async-storage/async-storage": ">=1.0.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": "3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"react-native-builder-bob": {
|
|
46
46
|
"source": "src",
|