@buoy-gg/storage 7.0.40 → 7.0.42

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.
Files changed (215) hide show
  1. package/README.md +11 -86
  2. package/lib/commonjs/index.js +1 -346
  3. package/lib/commonjs/preset.js +1 -80
  4. package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +1 -36
  5. package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -12
  6. package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +1 -24
  7. package/lib/commonjs/storage/components/GameUIStorageBrowser.js +3 -1258
  8. package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +1 -257
  9. package/lib/commonjs/storage/components/MMKVInstanceSelector.js +1 -418
  10. package/lib/commonjs/storage/components/SelectionActionBar.js +1 -207
  11. package/lib/commonjs/storage/components/StorageActionButtons.js +1 -241
  12. package/lib/commonjs/storage/components/StorageBrowserMode.js +1 -61
  13. package/lib/commonjs/storage/components/StorageEventActionButton.js +1 -121
  14. package/lib/commonjs/storage/components/StorageEventCard.js +1 -117
  15. package/lib/commonjs/storage/components/StorageEventDetailContent.js +1 -494
  16. package/lib/commonjs/storage/components/StorageEventFilterView.js +1 -159
  17. package/lib/commonjs/storage/components/StorageEventsSection.js +1 -24
  18. package/lib/commonjs/storage/components/StorageFilterCards.js +1 -231
  19. package/lib/commonjs/storage/components/StorageKeyCard.js +1 -520
  20. package/lib/commonjs/storage/components/StorageKeyDetailScreen.js +1 -579
  21. package/lib/commonjs/storage/components/StorageKeyRow.js +1 -559
  22. package/lib/commonjs/storage/components/StorageKeySection.js +1 -160
  23. package/lib/commonjs/storage/components/StorageKeyStats.js +1 -344
  24. package/lib/commonjs/storage/components/StorageModalWithTabs.js +1 -954
  25. package/lib/commonjs/storage/components/StorageSaveNotice.js +1 -171
  26. package/lib/commonjs/storage/components/StorageSection.js +1 -43
  27. package/lib/commonjs/storage/components/StorageTypeFilterBar.js +1 -143
  28. package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +1 -141
  29. package/lib/commonjs/storage/hooks/useMMKVInstances.js +1 -210
  30. package/lib/commonjs/storage/hooks/useMMKVKeys.js +1 -376
  31. package/lib/commonjs/storage/hooks/useSecureStoreKeys.js +1 -159
  32. package/lib/commonjs/storage/hooks/useStorageEvents.js +1 -61
  33. package/lib/commonjs/storage/stores/storageEventStore.js +1 -312
  34. package/lib/commonjs/storage/sync/storageSyncAdapter.js +1 -478
  35. package/lib/commonjs/storage/types.js +1 -5
  36. package/lib/commonjs/storage/utils/AsyncStorageListener.js +1 -691
  37. package/lib/commonjs/storage/utils/AsyncStorageListener.web.js +1 -0
  38. package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +1 -203
  39. package/lib/commonjs/storage/utils/MMKVListener.js +1 -416
  40. package/lib/commonjs/storage/utils/SecureStoreRegistry.js +1 -200
  41. package/lib/commonjs/storage/utils/asyncStorageCompat.js +1 -89
  42. package/lib/commonjs/storage/utils/browserStorageLifecycle.js +1 -0
  43. package/lib/commonjs/storage/utils/browserStorageLifecycle.web.js +1 -0
  44. package/lib/commonjs/storage/utils/clearAllStorage.js +1 -48
  45. package/lib/commonjs/storage/utils/deleteStorageKeys.js +1 -82
  46. package/lib/commonjs/storage/utils/lineDiff.js +1 -30
  47. package/lib/commonjs/storage/utils/mmkvAvailability.js +1 -62
  48. package/lib/commonjs/storage/utils/mmkvAvailability.web.js +1 -0
  49. package/lib/commonjs/storage/utils/mmkvTypeDetection.js +1 -154
  50. package/lib/commonjs/storage/utils/requiredStorageKeyScope.js +1 -17
  51. package/lib/commonjs/storage/utils/setStorageValue.js +1 -218
  52. package/lib/commonjs/storage/utils/snapshotProvider.js +1 -382
  53. package/lib/commonjs/storage/utils/storageActionHelpers.js +1 -46
  54. package/lib/commonjs/storage/utils/storageBrowserRefresh.js +1 -49
  55. package/lib/commonjs/storage/utils/storageLabels.js +1 -0
  56. package/lib/commonjs/storage/utils/storageLabels.web.js +1 -0
  57. package/lib/commonjs/storage/utils/storageOps.js +1 -53
  58. package/lib/commonjs/storage/utils/storageQueryUtils.js +1 -35
  59. package/lib/commonjs/storage/utils/storageTimeTravelUtils.js +1 -288
  60. package/lib/commonjs/storage/utils/valueType.js +1 -83
  61. package/lib/module/index.js +1 -112
  62. package/lib/module/preset.js +1 -76
  63. package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +1 -32
  64. package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -9
  65. package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +1 -10
  66. package/lib/module/storage/components/GameUIStorageBrowser.js +3 -1256
  67. package/lib/module/storage/components/MMKVInstanceInfoPanel.js +1 -253
  68. package/lib/module/storage/components/MMKVInstanceSelector.js +1 -414
  69. package/lib/module/storage/components/SelectionActionBar.js +1 -204
  70. package/lib/module/storage/components/StorageActionButtons.js +1 -237
  71. package/lib/module/storage/components/StorageBrowserMode.js +1 -57
  72. package/lib/module/storage/components/StorageEventActionButton.js +1 -118
  73. package/lib/module/storage/components/StorageEventCard.js +1 -112
  74. package/lib/module/storage/components/StorageEventDetailContent.js +1 -490
  75. package/lib/module/storage/components/StorageEventFilterView.js +1 -155
  76. package/lib/module/storage/components/StorageEventsSection.js +1 -20
  77. package/lib/module/storage/components/StorageFilterCards.js +1 -227
  78. package/lib/module/storage/components/StorageKeyCard.js +1 -517
  79. package/lib/module/storage/components/StorageKeyDetailScreen.js +1 -577
  80. package/lib/module/storage/components/StorageKeyRow.js +1 -554
  81. package/lib/module/storage/components/StorageKeySection.js +1 -155
  82. package/lib/module/storage/components/StorageKeyStats.js +1 -341
  83. package/lib/module/storage/components/StorageModalWithTabs.js +1 -949
  84. package/lib/module/storage/components/StorageSaveNotice.js +1 -168
  85. package/lib/module/storage/components/StorageSection.js +1 -40
  86. package/lib/module/storage/components/StorageTypeFilterBar.js +1 -138
  87. package/lib/module/storage/hooks/useAsyncStorageKeys.js +1 -136
  88. package/lib/module/storage/hooks/useMMKVInstances.js +1 -204
  89. package/lib/module/storage/hooks/useMMKVKeys.js +1 -371
  90. package/lib/module/storage/hooks/useSecureStoreKeys.js +1 -156
  91. package/lib/module/storage/hooks/useStorageEvents.js +1 -58
  92. package/lib/module/storage/stores/storageEventStore.js +1 -301
  93. package/lib/module/storage/sync/storageSyncAdapter.js +1 -474
  94. package/lib/module/storage/types.js +1 -3
  95. package/lib/module/storage/utils/AsyncStorageListener.js +1 -679
  96. package/lib/module/storage/utils/AsyncStorageListener.web.js +1 -0
  97. package/lib/module/storage/utils/MMKVInstanceRegistry.js +1 -197
  98. package/lib/module/storage/utils/MMKVListener.js +1 -403
  99. package/lib/module/storage/utils/SecureStoreRegistry.js +1 -194
  100. package/lib/module/storage/utils/asyncStorageCompat.js +1 -81
  101. package/lib/module/storage/utils/browserStorageLifecycle.js +1 -0
  102. package/lib/module/storage/utils/browserStorageLifecycle.web.js +1 -0
  103. package/lib/module/storage/utils/clearAllStorage.js +1 -43
  104. package/lib/module/storage/utils/deleteStorageKeys.js +1 -78
  105. package/lib/module/storage/utils/lineDiff.js +1 -12
  106. package/lib/module/storage/utils/mmkvAvailability.js +1 -56
  107. package/lib/module/storage/utils/mmkvAvailability.web.js +1 -0
  108. package/lib/module/storage/utils/mmkvTypeDetection.js +1 -148
  109. package/lib/module/storage/utils/requiredStorageKeyScope.js +1 -13
  110. package/lib/module/storage/utils/setStorageValue.js +1 -209
  111. package/lib/module/storage/utils/snapshotProvider.js +1 -380
  112. package/lib/module/storage/utils/storageActionHelpers.js +1 -42
  113. package/lib/module/storage/utils/storageBrowserRefresh.js +1 -44
  114. package/lib/module/storage/utils/storageLabels.js +1 -0
  115. package/lib/module/storage/utils/storageLabels.web.js +1 -0
  116. package/lib/module/storage/utils/storageOps.js +1 -46
  117. package/lib/module/storage/utils/storageQueryUtils.js +1 -30
  118. package/lib/module/storage/utils/storageTimeTravelUtils.js +1 -281
  119. package/lib/module/storage/utils/valueType.js +1 -76
  120. package/lib/typescript/index.d.ts +1 -0
  121. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +0 -8
  122. package/lib/typescript/storage/components/StorageEventCard.d.ts +0 -7
  123. package/lib/typescript/storage/components/StorageKeyRow.d.ts +2 -6
  124. package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts +0 -15
  125. package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts +2 -2
  126. package/lib/typescript/storage/sync/storageSyncAdapter.d.ts +7 -13
  127. package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts +24 -0
  128. package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts +3 -0
  129. package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts +2 -0
  130. package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts +4 -0
  131. package/lib/typescript/storage/utils/storageLabels.d.ts +8 -0
  132. package/lib/typescript/storage/utils/storageLabels.web.d.ts +8 -0
  133. package/lib/web/index.mjs +4 -0
  134. package/package.json +40 -14
  135. package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +0 -356
  136. package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +0 -122
  137. package/lib/commonjs/storage/components/StorageKeyEditorScreen.js +0 -414
  138. package/lib/commonjs/storage/components/StorageScalarKeyEditor.js +0 -61
  139. package/lib/commonjs/storage/components/StorageValueEditModal.js +0 -24
  140. package/lib/commonjs/storage/hooks/useKeyEditor.js +0 -31
  141. package/lib/commonjs/storage/hooks/useTreeDraft.js +0 -25
  142. package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +0 -352
  143. package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +0 -118
  144. package/lib/module/storage/components/StorageKeyEditorScreen.js +0 -410
  145. package/lib/module/storage/components/StorageScalarKeyEditor.js +0 -57
  146. package/lib/module/storage/components/StorageValueEditModal.js +0 -20
  147. package/lib/module/storage/hooks/useKeyEditor.js +0 -27
  148. package/lib/module/storage/hooks/useTreeDraft.js +0 -21
  149. package/lib/typescript/index.d.ts.map +0 -1
  150. package/lib/typescript/preset.d.ts.map +0 -1
  151. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +0 -18
  152. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +0 -1
  153. package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +0 -1
  154. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +0 -12
  155. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts.map +0 -1
  156. package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +0 -1
  157. package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +0 -1
  158. package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +0 -1
  159. package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +0 -1
  160. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +0 -1
  161. package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +0 -1
  162. package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +0 -1
  163. package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +0 -1
  164. package/lib/typescript/storage/components/StorageEventActionButton.d.ts.map +0 -1
  165. package/lib/typescript/storage/components/StorageEventCard.d.ts.map +0 -1
  166. package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +0 -1
  167. package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +0 -1
  168. package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +0 -1
  169. package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +0 -1
  170. package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +0 -1
  171. package/lib/typescript/storage/components/StorageKeyDetailScreen.d.ts.map +0 -1
  172. package/lib/typescript/storage/components/StorageKeyEditorScreen.d.ts +0 -42
  173. package/lib/typescript/storage/components/StorageKeyEditorScreen.d.ts.map +0 -1
  174. package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +0 -1
  175. package/lib/typescript/storage/components/StorageKeySection.d.ts.map +0 -1
  176. package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +0 -1
  177. package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +0 -1
  178. package/lib/typescript/storage/components/StorageSaveNotice.d.ts.map +0 -1
  179. package/lib/typescript/storage/components/StorageScalarKeyEditor.d.ts +0 -24
  180. package/lib/typescript/storage/components/StorageScalarKeyEditor.d.ts.map +0 -1
  181. package/lib/typescript/storage/components/StorageSection.d.ts.map +0 -1
  182. package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts.map +0 -1
  183. package/lib/typescript/storage/components/StorageValueEditModal.d.ts +0 -14
  184. package/lib/typescript/storage/components/StorageValueEditModal.d.ts.map +0 -1
  185. package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +0 -1
  186. package/lib/typescript/storage/hooks/useKeyEditor.d.ts +0 -27
  187. package/lib/typescript/storage/hooks/useKeyEditor.d.ts.map +0 -1
  188. package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +0 -1
  189. package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +0 -1
  190. package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts.map +0 -1
  191. package/lib/typescript/storage/hooks/useStorageEvents.d.ts.map +0 -1
  192. package/lib/typescript/storage/hooks/useTreeDraft.d.ts +0 -16
  193. package/lib/typescript/storage/hooks/useTreeDraft.d.ts.map +0 -1
  194. package/lib/typescript/storage/stores/storageEventStore.d.ts.map +0 -1
  195. package/lib/typescript/storage/sync/storageSyncAdapter.d.ts.map +0 -1
  196. package/lib/typescript/storage/types.d.ts.map +0 -1
  197. package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +0 -1
  198. package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +0 -1
  199. package/lib/typescript/storage/utils/MMKVListener.d.ts.map +0 -1
  200. package/lib/typescript/storage/utils/SecureStoreRegistry.d.ts.map +0 -1
  201. package/lib/typescript/storage/utils/asyncStorageCompat.d.ts.map +0 -1
  202. package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +0 -1
  203. package/lib/typescript/storage/utils/deleteStorageKeys.d.ts.map +0 -1
  204. package/lib/typescript/storage/utils/lineDiff.d.ts.map +0 -1
  205. package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +0 -1
  206. package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +0 -1
  207. package/lib/typescript/storage/utils/requiredStorageKeyScope.d.ts.map +0 -1
  208. package/lib/typescript/storage/utils/setStorageValue.d.ts.map +0 -1
  209. package/lib/typescript/storage/utils/snapshotProvider.d.ts.map +0 -1
  210. package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +0 -1
  211. package/lib/typescript/storage/utils/storageBrowserRefresh.d.ts.map +0 -1
  212. package/lib/typescript/storage/utils/storageOps.d.ts.map +0 -1
  213. package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +0 -1
  214. package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts.map +0 -1
  215. package/lib/typescript/storage/utils/valueType.d.ts.map +0 -1
@@ -1,194 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Expo SecureStore Registry
5
- *
6
- * SecureStore (iOS Keychain / Android KeyStore) has NO key-enumeration API —
7
- * unlike AsyncStorage (`getAllKeys`) and MMKV (`getAllKeys()`), there is no way
8
- * to ask "what's stored?". Apps must therefore register the keys they want
9
- * visible in the Storage tool.
10
- *
11
- * The SecureStore module itself is passed in at registration (never imported
12
- * here) — the same Metro-safe pattern as `registerMMKVInstance`: this package
13
- * has zero dependency on `expo-secure-store`, so bare RN apps without it
14
- * bundle fine.
15
- *
16
- * @module SecureStoreRegistry
17
- */
18
-
19
- /**
20
- * Subset of expo-secure-store's SecureStoreOptions that the tool tracks.
21
- * `keychainService` MUST match what the value was written with, or reads
22
- * return null. `requireAuthentication` keys trigger a biometric prompt on
23
- * read, so the tool never auto-reads them.
24
- *
25
- * @public
26
- */
27
-
28
- /**
29
- * Structural type for the expo-secure-store module. Matches
30
- * `import * as SecureStore from "expo-secure-store"` without depending on it.
31
- *
32
- * @public
33
- */
34
-
35
- /**
36
- * A key to expose in the Storage tool: either a bare key name, or a key with
37
- * the SecureStore options it was written with (+ optional description shown
38
- * in the expanded card).
39
- *
40
- * @public
41
- */
42
-
43
- /**
44
- * Normalized info for a registered SecureStore key.
45
- *
46
- * @public
47
- */
48
-
49
- class SecureStoreRegistry {
50
- module = null;
51
- keys = new Map();
52
- listeners = new Set();
53
-
54
- /**
55
- * Register the SecureStore module and the keys to expose. Callable multiple
56
- * times — keys accumulate, the latest module wins.
57
- */
58
- register(module, descriptors) {
59
- const before = this.signature();
60
- this.module = module;
61
- for (const d of descriptors) {
62
- const entry = typeof d === "string" ? {
63
- key: d,
64
- options: {}
65
- } : {
66
- key: d.key,
67
- description: d.description,
68
- options: {
69
- keychainService: d.keychainService,
70
- requireAuthentication: d.requireAuthentication,
71
- authenticationPrompt: d.authenticationPrompt
72
- }
73
- };
74
- this.keys.set(entry.key, entry);
75
- }
76
- // Only announce a real change. The desktop dashboard re-registers the same
77
- // key set on every device snapshot, and subscribers re-read the keychain on
78
- // notify — signature-comparing keeps that from turning into a read storm.
79
- if (this.signature() !== before) this.notify();
80
- }
81
-
82
- /** Remove a key from the registry (does not delete the stored value). */
83
- unregister(key) {
84
- if (this.keys.delete(key)) this.notify();
85
- }
86
-
87
- /**
88
- * Subscribe to registry changes (keys registered/unregistered). Lets the
89
- * browser pick up keys that register after the tool is already open.
90
- * Returns an unsubscribe function.
91
- */
92
- subscribe(listener) {
93
- this.listeners.add(listener);
94
- return () => {
95
- this.listeners.delete(listener);
96
- };
97
- }
98
-
99
- /** Content signature of the registered entries (module identity excluded). */
100
- signature() {
101
- return JSON.stringify(Array.from(this.keys.values()));
102
- }
103
- notify() {
104
- this.listeners.forEach(listener => {
105
- try {
106
- listener();
107
- } catch {
108
- // Listener errors are not ours
109
- }
110
- });
111
- }
112
-
113
- /** The registered SecureStore module, or null if none registered yet. */
114
- getModule() {
115
- return this.module;
116
- }
117
-
118
- /** All registered key entries. */
119
- getAll() {
120
- return Array.from(this.keys.values());
121
- }
122
-
123
- /** Number of registered keys. */
124
- count() {
125
- return this.keys.size;
126
- }
127
-
128
- /**
129
- * Delete a stored value via the registered module, using the options the
130
- * key was registered with (required for keychainService-scoped keys).
131
- */
132
- async deleteValue(key) {
133
- const entry = this.keys.get(key);
134
- if (!this.module || !entry) return;
135
- await this.module.deleteItemAsync(key, entry.options);
136
- }
137
-
138
- /**
139
- * Write a stored value via the registered module, using the options the key
140
- * was registered with — writing with different `keychainService` options than
141
- * the value was created with silently creates a SECOND entry the app can't
142
- * read, so the registered options are the only safe ones to use.
143
- *
144
- * Throws rather than no-ops: unlike a delete, a write that quietly did
145
- * nothing would leave the UI showing a value that was never stored.
146
- */
147
- async setValue(key, value) {
148
- const entry = this.keys.get(key);
149
- if (!this.module) throw new Error("No SecureStore module is registered");
150
- if (!entry) throw new Error(`SecureStore key "${key}" is not registered`);
151
- if (entry.options.requireAuthentication) {
152
- throw new Error(`SecureStore key "${key}" is biometric-protected — DevTools never writes it`);
153
- }
154
- await this.module.setItemAsync(key, value, entry.options);
155
- }
156
- }
157
-
158
- /**
159
- * Singleton registry instance (advanced usage — most apps only need
160
- * {@link registerSecureStoreKeys}).
161
- */
162
- export const secureStoreRegistry = new SecureStoreRegistry();
163
-
164
- /**
165
- * Register Expo SecureStore keys with React Buoy DevTools.
166
- *
167
- * **⚠️ REQUIRED for SecureStore visibility**: SecureStore has no
168
- * key-enumeration API, so the tool can only show keys you declare here.
169
- * Pass the module itself so this package never has to import
170
- * `expo-secure-store`.
171
- *
172
- * @example
173
- * ```typescript
174
- * import * as SecureStore from "expo-secure-store";
175
- * import { registerSecureStoreKeys } from "@buoy-gg/storage";
176
- *
177
- * registerSecureStoreKeys(SecureStore, [
178
- * "auth.token",
179
- * { key: "session", keychainService: "com.myapp.auth" },
180
- * // Never auto-read; shown as biometric-protected:
181
- * { key: "pin", requireAuthentication: true },
182
- * ]);
183
- * ```
184
- */
185
- export function registerSecureStoreKeys(module, keys) {
186
- secureStoreRegistry.register(module, keys);
187
- }
188
-
189
- /**
190
- * Remove a key from the DevTools registry (the stored value is untouched).
191
- */
192
- export function unregisterSecureStoreKey(key) {
193
- secureStoreRegistry.unregister(key);
194
- }
1
+ "use strict";class n{module=null;keys=new Map;listeners=new Set;register(e,r){const i=this.signature();this.module=e;for(const t of r){const o=typeof t==="string"?{key:t,options:{}}:{key:t.key,description:t.description,options:{keychainService:t.keychainService,requireAuthentication:t.requireAuthentication,authenticationPrompt:t.authenticationPrompt}};this.keys.set(o.key,o)}if(this.signature()!==i)this.notify()}unregister(e){if(this.keys.delete(e))this.notify()}subscribe(e){this.listeners.add(e);return()=>{this.listeners.delete(e)}}signature(){return JSON.stringify(Array.from(this.keys.values()))}notify(){this.listeners.forEach(e=>{try{e()}catch{}})}getModule(){return this.module}getAll(){return Array.from(this.keys.values())}count(){return this.keys.size}async deleteValue(e){const r=this.keys.get(e);if(!this.module||!r)return;await this.module.deleteItemAsync(e,r.options)}async setValue(e,r){const i=this.keys.get(e);if(!this.module)throw new Error("No SecureStore module is registered");if(!i)throw new Error(`SecureStore key "${e}" is not registered`);if(i.options.requireAuthentication){throw new Error(`SecureStore key "${e}" is biometric-protected \u2014 DevTools never writes it`)}await this.module.setItemAsync(e,r,i.options)}}export const secureStoreRegistry=new n;export function registerSecureStoreKeys(s,e){secureStoreRegistry.register(s,e)}export function unregisterSecureStoreKey(s){secureStoreRegistry.unregister(s)}
@@ -1,81 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * AsyncStorage compatibility adapter (v2 + v3)
5
- *
6
- * `@react-native-async-storage/async-storage` 3.x reshaped the default-export
7
- * API. The single-item methods kept their v2 signatures, but the batch + merge
8
- * methods changed:
9
- *
10
- * v2 (what this package was written against) v3
11
- * ------------------------------------------ --------------------------------
12
- * multiGet(keys): [key, value|null][] getMany(keys): Record<key, value|null>
13
- * multiSet([[k, v]]): void setMany({ k: v }): void
14
- * multiRemove(keys): void removeMany(keys): void
15
- * mergeItem / multiMerge removed entirely
16
- *
17
- * This module is the single seam between the storage tool and whichever
18
- * async-storage version the host app installed. The rest of the package always
19
- * speaks the v2 tuple-shaped API; we translate to v3 here when needed.
20
- *
21
- * Reads (`readMany`) are routed through the *unswizzled* native methods, so the
22
- * event listener can safely call them while capturing previous values without
23
- * re-triggering itself.
24
- */
25
- import RawAsyncStorage from "@react-native-async-storage/async-storage";
26
-
27
- // Loosely typed because the surface differs across major versions; callers go
28
- // through the helpers below rather than touching this directly.
29
-
30
- /** The live default-export object (methods may be swizzled by the listener). */
31
- export const asyncStorage = RawAsyncStorage;
32
-
33
- /**
34
- * Capability flags describing which API surface the installed version exposes.
35
- * `multiGet` only exists on v2; `mergeItem` was removed in v3.
36
- */
37
- export const asyncStorageCaps = {
38
- /** v2 exposes multiGet/multiSet/multiRemove; v3 renamed these to *Many. */
39
- hasLegacyMultiApi: typeof asyncStorage?.multiGet === "function",
40
- /** v3 removed mergeItem/multiMerge with no replacement. */
41
- hasMergeApi: typeof asyncStorage?.mergeItem === "function"
42
- };
43
-
44
- /**
45
- * Batch-read keys, normalized to the v2 `[key, value|null][]` tuple shape and
46
- * preserving the requested key order regardless of installed version.
47
- */
48
- export async function readMany(keys) {
49
- if (typeof asyncStorage.multiGet === "function") {
50
- return await asyncStorage.multiGet(keys);
51
- }
52
- // v3: getMany returns a Record; rebuild ordered tuples ("what you request is
53
- // what you get" — missing keys come back as null).
54
- const record = await asyncStorage.getMany(keys);
55
- return keys.map(key => [key, record[key] ?? null]);
56
- }
57
-
58
- /**
59
- * Batch-write key/value pairs. Calls the live method (which may be swizzled by
60
- * the listener on v2's `multiSet` / v3's `setMany`) so writes still emit events.
61
- */
62
- export async function writeMany(pairs) {
63
- if (typeof asyncStorage.multiSet === "function") {
64
- return asyncStorage.multiSet(pairs);
65
- }
66
- const record = {};
67
- for (const [key, value] of pairs) record[key] = value;
68
- return asyncStorage.setMany(record);
69
- }
70
-
71
- /**
72
- * Batch-remove keys via the live method (swizzled on v2's `multiRemove` /
73
- * v3's `removeMany`).
74
- */
75
- export async function removeMany(keys) {
76
- if (typeof asyncStorage.multiRemove === "function") {
77
- return asyncStorage.multiRemove(keys);
78
- }
79
- return asyncStorage.removeMany(keys);
80
- }
81
- export default asyncStorage;
1
+ "use strict";import r from"@react-native-async-storage/async-storage";export const asyncStorage=r;export const asyncStorageCaps={hasLegacyMultiApi:typeof asyncStorage?.multiGet==="function",hasMergeApi:typeof asyncStorage?.mergeItem==="function"};export async function readMany(t){if(typeof asyncStorage.multiGet==="function"){return await asyncStorage.multiGet(t)}const e=await asyncStorage.getMany(t);return t.map(n=>[n,e[n]??null])}export async function writeMany(t){if(typeof asyncStorage.multiSet==="function"){return asyncStorage.multiSet(t)}const e={};for(const[n,o]of t)e[n]=o;return asyncStorage.setMany(e)}export async function removeMany(t){if(typeof asyncStorage.multiRemove==="function"){return asyncStorage.multiRemove(t)}return asyncStorage.removeMany(t)}export default asyncStorage;
@@ -0,0 +1 @@
1
+ "use strict";export function startBrowserStorageCapture(){return()=>{}}
@@ -0,0 +1 @@
1
+ "use strict";import{getBrowserStorage as i,subscribeToBrowserStorage as u}from"@buoy-gg/shared-ui/utils";import{registerMMKVInstance as a,unregisterMMKVInstance as g}from"./MMKVInstanceRegistry";let n=0;const r=()=>i("sessionStorage");const s=()=>Array.from({length:r().length},(e,t)=>r().key(t)).filter(e=>e!==null);const f={set(e,t){r().setItem(e,String(t))},getString(e){return r().getItem(e)??void 0},getNumber(){return void 0},getBoolean(){return void 0},getBuffer(){return void 0},contains(e){return r().getItem(e)!==null},delete(e){const t=this.contains(e);r().removeItem(e);return t},getAllKeys:s,clearAll(){r().clear()},get size(){return s().reduce((e,t)=>e+2*(t.length+(r().getItem(t)?.length??0)),0)},addOnValueChangedListener(e){return{remove:u(t=>{if(t.area!=="sessionStorage")return;if(t.key!==void 0)e(t.key);else t.prevPairs?.forEach(([o])=>e(o))})}}};export function startBrowserStorageCapture(){if(typeof window==="undefined")return()=>{};try{r()}catch{return()=>{}}if(++n===1)a("sessionStorage",f);let e=true;return()=>{if(e){e=false;if(--n===0)g("sessionStorage")}}}
@@ -1,43 +1 @@
1
- "use strict";
2
-
3
- import AsyncStorage from "@react-native-async-storage/async-storage";
4
- import { removeMany } from "./asyncStorageCompat";
5
- import { isDevToolsStorageKey } from "@buoy-gg/shared-ui";
6
-
7
- /**
8
- * Clear all storage data except dev tools keys
9
- * This preserves dev tool settings while clearing app data
10
- */
11
- export async function clearAllAppStorage() {
12
- // Get all keys
13
- const allKeys = await AsyncStorage.getAllKeys();
14
- if (!allKeys || allKeys.length === 0) {
15
- // No keys to clear
16
- return;
17
- }
18
-
19
- // Filter out dev tool keys - we don't want to clear those
20
- const keysToRemove = allKeys.filter(key => !isDevToolsStorageKey(key));
21
- if (keysToRemove.length === 0) {
22
- // No app keys to clear (only dev tool keys found)
23
- return;
24
- }
25
-
26
- // Clearing ${keysToRemove.length} app storage keys
27
-
28
- // Remove all non-dev-tool keys
29
- await removeMany(keysToRemove);
30
-
31
- // Successfully cleared app storage
32
- }
33
-
34
- /**
35
- * Clear absolutely all storage data including dev tools
36
- * Use with caution - this will reset all dev tool settings
37
- */
38
- export async function clearAllStorageIncludingDevTools() {
39
- // Clear everything
40
- await AsyncStorage.clear();
41
-
42
- // Successfully cleared all storage including dev tools
43
- }
1
+ "use strict";import o from"@react-native-async-storage/async-storage";import{removeMany as a}from"./asyncStorageCompat";import{isDevToolsStorageKey as l}from"@buoy-gg/shared-ui";export async function clearAllAppStorage(){const e=await o.getAllKeys();if(!e||e.length===0){return}const t=e.filter(r=>!l(r));if(t.length===0){return}await a(t)}export async function clearAllStorageIncludingDevTools(){await o.clear()}
@@ -1,78 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Deleting storage keys, in one place.
5
- *
6
- * Each backend removes keys differently — AsyncStorage takes a batch,
7
- * SecureStore has to go through the registry (only it knows each key's
8
- * `keychainService` options), and MMKV deletes per registered instance. A
9
- * second copy of that fan-out is exactly how one backend quietly stops being
10
- * cleaned up — which is not hypothetical: the MMKV branch called a method
11
- * react-native-mmkv v4 had renamed, and deleting an MMKV key silently did
12
- * nothing until an e2e test deleted from all three backends at once.
13
- *
14
- * One call site today: the selection action bar. Deleting is deliberately not
15
- * an affordance on the row itself — see `StorageKeyRow`, whose expanded card
16
- * carries three actions and only one of them changes anything.
17
- *
18
- * Pro gating and confirmation are deliberately NOT here: they belong to the UI
19
- * that has the user's attention. This function assumes the caller already asked.
20
- */
21
-
22
- import { removeMany } from "./asyncStorageCompat";
23
- import { secureStoreRegistry } from "./SecureStoreRegistry";
24
- /**
25
- * Remove one key from an MMKV instance, whichever version it is.
26
- *
27
- * react-native-mmkv v4 renamed `delete(key)` to `remove(key)`. Calling the old
28
- * name on a v4 instance throws, and because the callers wrap deletion in a
29
- * try/catch that only surfaces an alert, the visible result was a key that
30
- * refused to delete — the same shape as a permissions problem or a read-only
31
- * instance, and nothing to point at the real cause.
32
- *
33
- * `storageSyncAdapter` and `snapshotProvider` already did this; this path was
34
- * the one that missed it.
35
- */
36
- function removeMMKVKey(instance, key) {
37
- if (typeof instance.remove === "function") {
38
- instance.remove(key);
39
- return;
40
- }
41
- if (typeof instance.delete === "function") {
42
- instance.delete(key);
43
- return;
44
- }
45
- throw new Error("MMKV instance exposes neither remove() nor delete()");
46
- }
47
-
48
- /**
49
- * Removes every key from whichever backend holds it. Rejects on the first
50
- * failure — callers surface that, rather than reporting a partial delete as
51
- * success.
52
- */
53
- export async function deleteStorageKeys(keys, mmkvInstances) {
54
- if (keys.length === 0) return;
55
- const asyncKeys = keys.filter(k => k.storageType === "async");
56
- const mmkvKeys = keys.filter(k => k.storageType === "mmkv");
57
- const secureKeys = keys.filter(k => k.storageType === "secure");
58
- if (asyncKeys.length > 0) {
59
- await removeMany(asyncKeys.map(k => k.key));
60
- }
61
- for (const k of secureKeys) {
62
- await secureStoreRegistry.deleteValue(k.key);
63
- }
64
- if (mmkvKeys.length > 0) {
65
- const byInstance = {};
66
- mmkvKeys.forEach(k => {
67
- const instanceId = k.instanceId || "default";
68
- if (!byInstance[instanceId]) byInstance[instanceId] = [];
69
- byInstance[instanceId].push(k.key);
70
- });
71
- Object.entries(byInstance).forEach(([instanceId, instanceKeys]) => {
72
- const inst = mmkvInstances.find(i => i.id === instanceId);
73
- if (inst) {
74
- instanceKeys.forEach(key => removeMMKVKey(inst.instance, key));
75
- }
76
- });
77
- }
78
- }
1
+ "use strict";import{removeMany as y}from"./asyncStorageCompat";import{secureStoreRegistry as m}from"./SecureStoreRegistry";function u(t,o){if(typeof t.remove==="function"){t.remove(o);return}if(typeof t.delete==="function"){t.delete(o);return}throw new Error("MMKV instance exposes neither remove() nor delete()")}export async function deleteStorageKeys(t,o){if(t.length===0)return;const i=t.filter(e=>e.storageType==="async");const f=t.filter(e=>e.storageType==="mmkv");const a=t.filter(e=>e.storageType==="secure");if(i.length>0){await y(i.map(e=>e.key))}for(const e of a){await m.deleteValue(e.key)}if(f.length>0){const e={};f.forEach(n=>{const r=n.instanceId||"default";if(!e[r])e[r]=[];e[r].push(n.key)});Object.entries(e).forEach(([n,r])=>{const c=o.find(s=>s.id===n);if(c){r.forEach(s=>u(c.instance,s))}})}}
@@ -1,12 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Line-by-line diff computation.
5
- *
6
- * This used to be a verbatim copy of the shared implementation, which meant a
7
- * diff fix had to be made twice. It now re-exports the canonical one so the
8
- * storage split view, the tree view, and every other tool's diff (redux, jotai,
9
- * highlight-updates) share a single algorithm.
10
- */
11
-
12
- export { computeLineDiff, DiffType, ABSENT_VALUE, isAbsent } from "@buoy-gg/shared-ui/dataViewer";
1
+ "use strict";export{computeLineDiff,DiffType,ABSENT_VALUE,isAbsent}from"@buoy-gg/shared-ui/dataViewer";
@@ -1,56 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * MMKV Availability Detection
5
- *
6
- * Safely detects if react-native-mmkv is available in the current environment.
7
- * This allows the app to work in Expo Go where native modules aren't available.
8
- */
9
-
10
- let _isMMKVAvailable = null;
11
- let _MMKVClass = null;
12
-
13
- /**
14
- * Check if MMKV is available in the current environment
15
- *
16
- * @returns True if react-native-mmkv is installed and available
17
- */
18
- export function isMMKVAvailable() {
19
- // Cache the result after first check
20
- if (_isMMKVAvailable !== null) {
21
- return _isMMKVAvailable;
22
- }
23
- try {
24
- // Attempt to require MMKV
25
- const MMKVModule = require('react-native-mmkv');
26
-
27
- // v4 uses createMMKV factory function, v3 used MMKV class
28
- // Try v4 API first (recommended), fall back to v3
29
- _MMKVClass = MMKVModule.createMMKV || MMKVModule.MMKV;
30
- _isMMKVAvailable = _MMKVClass !== undefined;
31
- return _isMMKVAvailable;
32
- } catch (error) {
33
- // MMKV is not available (e.g., Expo Go, not installed)
34
- _isMMKVAvailable = false;
35
- return false;
36
- }
37
- }
38
-
39
- /**
40
- * Get the MMKV class if available
41
- *
42
- * @returns MMKV class or null if not available
43
- */
44
- export function getMMKVClass() {
45
- if (!isMMKVAvailable()) {
46
- return null;
47
- }
48
- return _MMKVClass;
49
- }
50
-
51
- /**
52
- * Get a user-friendly error message when MMKV is not available
53
- */
54
- export function getMMKVUnavailableMessage() {
55
- return 'MMKV is not available in this environment. MMKV requires native modules and cannot run in Expo Go. Please use a development build or EAS Build.';
56
- }
1
+ "use strict";let e=null;let t=null;export function isMMKVAvailable(){if(e!==null){return e}try{const n=require("react-native-mmkv");t=n.createMMKV||n.MMKV;e=t!==void 0;return e}catch(n){e=false;return false}}export function getMMKVClass(){if(!isMMKVAvailable()){return null}return t}export function getMMKVUnavailableMessage(){return"MMKV is not available in this environment. MMKV requires native modules and cannot run in Expo Go. Please use a development build or EAS Build."}
@@ -0,0 +1 @@
1
+ "use strict";export function isMMKVAvailable(){try{return typeof window!=="undefined"&&!!window.sessionStorage}catch{return false}}export function getMMKVClass(){return null}export function getMMKVUnavailableMessage(){return"Session storage is unavailable in this browser context."}
@@ -1,148 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * MMKV Type Detection Utilities
5
- *
6
- * MMKV stores values with native types (string, number, boolean, ArrayBuffer).
7
- * This module provides utilities to detect the type of a stored value by trying
8
- * each getter sequentially.
9
- */
10
-
11
- // Use 'any' type for MMKV to avoid hard dependency on react-native-mmkv
12
-
13
- /**
14
- * Detect the type of a value stored in MMKV by trying each getter.
15
- *
16
- * Since MMKV doesn't provide a getType() method, we must try each getter
17
- * (getString, getNumber, getBoolean, getBuffer) until one returns a value.
18
- *
19
- * Order matters: We try in order of most common types first.
20
- *
21
- * @param instance - MMKV instance to read from
22
- * @param key - Storage key
23
- * @returns Value and its detected type
24
- *
25
- * @example
26
- * ```typescript
27
- * const instance = createMMKV();
28
- * instance.set('name', 'John');
29
- * instance.set('age', 30);
30
- * instance.set('active', true);
31
- *
32
- * detectMMKVType(instance, 'name'); // { value: 'John', type: 'string' }
33
- * detectMMKVType(instance, 'age'); // { value: 30, type: 'number' }
34
- * detectMMKVType(instance, 'active'); // { value: true, type: 'boolean' }
35
- * detectMMKVType(instance, 'missing');// { value: undefined, type: 'unknown' }
36
- * ```
37
- */
38
- export function detectMMKVType(instance, key) {
39
- // MMKV stores no type metadata, so the native getters can cross-read: in
40
- // particular `getString` returns "" (an empty string, NOT undefined) for many
41
- // non-string values like numbers and `false`. Trying getString first and
42
- // trusting its result therefore mis-detects those as empty strings — e.g.
43
- // a key set to 42 or false would render as "". Probe the getters and only let
44
- // getString win when it returns a NON-empty string; treat an empty result as
45
- // ambiguous and prefer the number/boolean getters.
46
- const stringValue = instance.getString(key);
47
-
48
- // A non-empty string is unambiguously a string.
49
- if (stringValue !== undefined && stringValue !== '') {
50
- return {
51
- value: stringValue,
52
- type: 'string'
53
- };
54
- }
55
-
56
- // Empty getString result is ambiguous (genuine "" vs a number/boolean the
57
- // native layer decoded to ""). Prefer typed getters when they have a value.
58
- const numberValue = instance.getNumber(key);
59
- if (numberValue !== undefined) {
60
- return {
61
- value: numberValue,
62
- type: 'number'
63
- };
64
- }
65
- const booleanValue = instance.getBoolean(key);
66
- if (booleanValue !== undefined) {
67
- return {
68
- value: booleanValue,
69
- type: 'boolean'
70
- };
71
- }
72
-
73
- // getString returned "" and nothing else matched -> a genuine empty string.
74
- if (stringValue === '') {
75
- return {
76
- value: '',
77
- type: 'string'
78
- };
79
- }
80
-
81
- // Try buffer (least common)
82
- const bufferValue = instance.getBuffer(key);
83
- if (bufferValue !== undefined) {
84
- // Format buffer for display (don't return raw ArrayBuffer)
85
- return {
86
- value: `<ArrayBuffer ${bufferValue.byteLength} bytes>`,
87
- type: 'buffer'
88
- };
89
- }
90
-
91
- // Key doesn't exist or unknown type
92
- return {
93
- value: undefined,
94
- type: 'unknown'
95
- };
96
- }
97
-
98
- /**
99
- * Format an MMKV value for display in the UI.
100
- *
101
- * @param value - The value to format
102
- * @param type - The detected type
103
- * @returns Formatted string representation
104
- *
105
- * @example
106
- * ```typescript
107
- * formatMMKVValue('hello', 'string'); // '"hello"'
108
- * formatMMKVValue(42, 'number'); // '42'
109
- * formatMMKVValue(true, 'boolean'); // 'true'
110
- * formatMMKVValue('<ArrayBuffer 1024 bytes>', 'buffer'); // '<ArrayBuffer 1024 bytes>'
111
- * ```
112
- */
113
- export function formatMMKVValue(value, type) {
114
- if (value === undefined) return 'undefined';
115
- if (value === null) return 'null';
116
- switch (type) {
117
- case 'string':
118
- return `"${value}"`;
119
- case 'number':
120
- return String(value);
121
- case 'boolean':
122
- return value ? 'true' : 'false';
123
- case 'buffer':
124
- // Value is already formatted as "<ArrayBuffer X bytes>"
125
- return value;
126
- case 'unknown':
127
- return 'unknown';
128
- default:
129
- return String(value);
130
- }
131
- }
132
-
133
- /**
134
- * Check if a value type matches an expected type for validation.
135
- *
136
- * @param actualType - Detected type
137
- * @param expectedType - Expected type from configuration
138
- * @returns True if types match
139
- *
140
- * @example
141
- * ```typescript
142
- * isTypeMatch('string', 'string'); // true
143
- * isTypeMatch('number', 'string'); // false
144
- * ```
145
- */
146
- export function isTypeMatch(actualType, expectedType) {
147
- return actualType === expectedType;
148
- }
1
+ "use strict";export function detectMMKVType(e,n){const r=e.getString(n);if(r!==void 0&&r!==""){return{value:r,type:"string"}}const t=e.getNumber(n);if(t!==void 0){return{value:t,type:"number"}}const u=e.getBoolean(n);if(u!==void 0){return{value:u,type:"boolean"}}if(r===""){return{value:"",type:"string"}}const f=e.getBuffer(n);if(f!==void 0){return{value:`<ArrayBuffer ${f.byteLength} bytes>`,type:"buffer"}}return{value:void 0,type:"unknown"}}export function formatMMKVValue(e,n){if(e===void 0)return"undefined";if(e===null)return"null";switch(n){case"string":return`"${e}"`;case"number":return String(e);case"boolean":return e?"true":"false";case"buffer":return e;case"unknown":return"unknown";default:return String(e)}}export function isTypeMatch(e,n){return e===n}
@@ -1,13 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Whether a required-key declaration should be enforced by a given backend
5
- * hook. Explicit `storageType` wins; bare string keys default to AsyncStorage
6
- * (the historical zero-config backend). Objects without `storageType` still
7
- * apply to every backend — matching prior behavior for apps that never set it.
8
- */
9
- export function requiredKeyAppliesTo(req, backend) {
10
- if (typeof req === "string") return backend === "async";
11
- if (req.storageType) return req.storageType === backend;
12
- return true;
13
- }
1
+ "use strict";export function requiredKeyAppliesTo(e,r){if(typeof e==="string")return r==="async";if(e.storageType)return e.storageType===r;return true}