@buoy-gg/storage 1.7.7 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +219 -16
- package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +35 -44
- package/lib/commonjs/storage/components/GameUIStorageBrowser.js +9 -23
- package/lib/commonjs/storage/components/SelectionActionBar.js +8 -22
- package/lib/commonjs/storage/components/StorageActionButtons.js +8 -22
- package/lib/commonjs/storage/components/StorageActions.js +8 -22
- package/lib/commonjs/storage/components/StorageEventActionButton.js +120 -0
- package/lib/commonjs/storage/components/StorageEventCard.js +112 -0
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +331 -822
- package/lib/commonjs/storage/components/StorageModalWithTabs.js +43 -200
- package/lib/commonjs/storage/hooks/useStorageEvents.js +98 -0
- package/lib/commonjs/storage/index.js +111 -2
- package/lib/commonjs/storage/stores/storageEventStore.js +243 -0
- package/lib/commonjs/storage/utils/AsyncStorageListener.js +164 -35
- package/lib/commonjs/storage/utils/index.js +37 -0
- package/lib/commonjs/storage/utils/storageTimeTravelUtils.js +251 -0
- package/lib/module/index.js +74 -3
- package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +35 -44
- package/lib/module/storage/components/GameUIStorageBrowser.js +9 -23
- package/lib/module/storage/components/SelectionActionBar.js +9 -24
- package/lib/module/storage/components/StorageActionButtons.js +9 -24
- package/lib/module/storage/components/StorageActions.js +9 -24
- package/lib/module/storage/components/StorageEventActionButton.js +117 -0
- package/lib/module/storage/components/StorageEventCard.js +107 -0
- package/lib/module/storage/components/StorageEventDetailContent.js +332 -824
- package/lib/module/storage/components/StorageModalWithTabs.js +45 -202
- package/lib/module/storage/hooks/useStorageEvents.js +95 -0
- package/lib/module/storage/index.js +7 -1
- package/lib/module/storage/stores/storageEventStore.js +231 -0
- package/lib/module/storage/utils/AsyncStorageListener.js +159 -33
- package/lib/module/storage/utils/index.js +4 -1
- package/lib/module/storage/utils/storageTimeTravelUtils.js +245 -0
- package/lib/typescript/index.d.ts +36 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts +1 -1
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +1 -1
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -1
- package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageActionButtons.d.ts +0 -2
- package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageActions.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageEventActionButton.d.ts +37 -0
- package/lib/typescript/storage/components/StorageEventActionButton.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventCard.d.ts +40 -0
- package/lib/typescript/storage/components/StorageEventCard.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts +11 -3
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +1 -1
- package/lib/typescript/storage/hooks/useStorageEvents.d.ts +51 -0
- package/lib/typescript/storage/hooks/useStorageEvents.d.ts.map +1 -0
- package/lib/typescript/storage/index.d.ts +4 -0
- package/lib/typescript/storage/index.d.ts.map +1 -1
- package/lib/typescript/storage/stores/storageEventStore.d.ts +113 -0
- package/lib/typescript/storage/stores/storageEventStore.d.ts.map +1 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts +38 -1
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +1 -1
- package/lib/typescript/storage/utils/index.d.ts +2 -1
- package/lib/typescript/storage/utils/index.d.ts.map +1 -1
- package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts +35 -0
- package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts.map +1 -0
- package/package.json +20 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageActions.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageActions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"StorageActions.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageActions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK1C,UAAU,mBAAmB;IAC3B,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,GACX,EAAE,mBAAmB,+BAwHrB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageEventActionButton
|
|
3
|
+
*
|
|
4
|
+
* Action button for Storage DevTools detail view
|
|
5
|
+
* Matches Redux DevTools ActionButton styling
|
|
6
|
+
*/
|
|
7
|
+
declare const buttonConfigs: {
|
|
8
|
+
copy: {
|
|
9
|
+
color: "#20C997";
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
borderColor: string;
|
|
12
|
+
textColor: "#20C997";
|
|
13
|
+
};
|
|
14
|
+
jump: {
|
|
15
|
+
color: "#FFA94D";
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
borderColor: string;
|
|
18
|
+
textColor: "#FFA94D";
|
|
19
|
+
};
|
|
20
|
+
undo: {
|
|
21
|
+
color: "#00B8E6";
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
borderColor: string;
|
|
24
|
+
textColor: "#00B8E6";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type StorageButtonType = keyof typeof buttonConfigs;
|
|
28
|
+
interface StorageEventActionButtonProps {
|
|
29
|
+
onPress: () => void;
|
|
30
|
+
text: string;
|
|
31
|
+
type: StorageButtonType;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
locked?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function StorageEventActionButton({ onPress, text, type, disabled, locked, }: StorageEventActionButtonProps): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=StorageEventActionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageEventActionButton.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageEventActionButton.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;CAmBlB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,aAAa,CAAC;AAE3D,UAAU,6BAA6B;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAgB,EAChB,MAAc,GACf,EAAE,6BAA6B,+BA6C/B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageEventCard
|
|
3
|
+
*
|
|
4
|
+
* Shared card component for displaying storage events.
|
|
5
|
+
* Used by both Storage DevTools and Events DevTools for consistent UI.
|
|
6
|
+
* Uses CompactRow for consistent layout with Redux/React Query cards.
|
|
7
|
+
*/
|
|
8
|
+
/** Value type for storage events */
|
|
9
|
+
export type StorageValueType = "string" | "number" | "boolean" | "null" | "undefined" | "object" | "array";
|
|
10
|
+
/**
|
|
11
|
+
* Compute value type from a value
|
|
12
|
+
*/
|
|
13
|
+
export declare function getValueType(value: unknown): StorageValueType;
|
|
14
|
+
export interface StorageEventCardData {
|
|
15
|
+
/** Storage key name */
|
|
16
|
+
key: string;
|
|
17
|
+
/** Last action performed (e.g., 'setItem', 'removeItem') */
|
|
18
|
+
lastAction: string;
|
|
19
|
+
/** Total number of operations on this key (defaults to 1 for single events) */
|
|
20
|
+
totalOperations?: number;
|
|
21
|
+
/** Timestamp of the last event */
|
|
22
|
+
lastEventTimestamp: Date;
|
|
23
|
+
/** Storage types that have this key */
|
|
24
|
+
storageTypes: Set<"async" | "mmkv">;
|
|
25
|
+
/** Type of the current value (optional, will show no badge if not provided) */
|
|
26
|
+
valueType?: StorageValueType;
|
|
27
|
+
}
|
|
28
|
+
interface StorageEventCardProps {
|
|
29
|
+
/** Event data to display */
|
|
30
|
+
data: StorageEventCardData;
|
|
31
|
+
/** Called when the card is pressed */
|
|
32
|
+
onPress: () => void;
|
|
33
|
+
/** Whether this card is selected */
|
|
34
|
+
isSelected?: boolean;
|
|
35
|
+
/** Whether to show chevron */
|
|
36
|
+
showChevron?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const StorageEventCard: import("react").NamedExoticComponent<StorageEventCardProps>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=StorageEventCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageEventCard.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageEventCard.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,GACX,QAAQ,GACR,OAAO,CAAC;AAEZ;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAU7D;AAED,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,kBAAkB,EAAE,IAAI,CAAC;IACzB,uCAAuC;IACvC,YAAY,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACpC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,UAAU,qBAAqB;IAC7B,4BAA4B;IAC5B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,sCAAsC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAsDD,eAAO,MAAM,gBAAgB,6DA6B3B,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StorageEventDetailContent
|
|
3
|
+
*
|
|
4
|
+
* Detail view for storage events using the shared EventHistoryViewer component.
|
|
5
|
+
*/
|
|
1
6
|
import { AsyncStorageEvent } from "../utils/AsyncStorageListener";
|
|
2
7
|
type MMKVEvent = {
|
|
3
8
|
action: string;
|
|
@@ -11,9 +16,9 @@ type MMKVEvent = {
|
|
|
11
16
|
};
|
|
12
17
|
};
|
|
13
18
|
type StorageEvent = (AsyncStorageEvent & {
|
|
14
|
-
storageType?:
|
|
19
|
+
storageType?: "async";
|
|
15
20
|
}) | (MMKVEvent & {
|
|
16
|
-
storageType?:
|
|
21
|
+
storageType?: "mmkv";
|
|
17
22
|
});
|
|
18
23
|
interface StorageKeyConversation {
|
|
19
24
|
key: string;
|
|
@@ -22,7 +27,7 @@ interface StorageKeyConversation {
|
|
|
22
27
|
totalOperations: number;
|
|
23
28
|
currentValue: unknown;
|
|
24
29
|
valueType: "string" | "number" | "boolean" | "null" | "undefined" | "object" | "array";
|
|
25
|
-
storageTypes?: Set<
|
|
30
|
+
storageTypes?: Set<"async" | "mmkv">;
|
|
26
31
|
}
|
|
27
32
|
interface StorageEventDetailContentProps {
|
|
28
33
|
conversation: StorageKeyConversation;
|
|
@@ -31,6 +36,9 @@ interface StorageEventDetailContentProps {
|
|
|
31
36
|
disableInternalFooter?: boolean;
|
|
32
37
|
}
|
|
33
38
|
export declare function StorageEventDetailContent({ conversation, selectedEventIndex, onEventIndexChange, disableInternalFooter, }: StorageEventDetailContentProps): import("react").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* External footer component for modal use
|
|
41
|
+
*/
|
|
34
42
|
export declare function StorageEventDetailFooter({ conversation, selectedEventIndex, onEventIndexChange, }: {
|
|
35
43
|
conversation: StorageKeyConversation;
|
|
36
44
|
selectedEventIndex?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageEventDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageEventDetailContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageEventDetailContent.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageEventDetailContent.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AA6BlE,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;CACH,CAAC;AAEF,KAAK,YAAY,GACb,CAAC,iBAAiB,GAAG;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/C,CAAC,SAAS,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3C,UAAU,sBAAsB;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EACL,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,GACX,QAAQ,GACR,OAAO,CAAC;IACZ,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;CACtC;AAED,UAAU,8BAA8B;IACtC,YAAY,EAAE,sBAAsB,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AA2CD,wBAAgB,yBAAyB,CAAC,EACxC,YAAY,EACZ,kBAAsB,EACtB,kBAA6B,EAC7B,qBAA6B,GAC9B,EAAE,8BAA8B,+BA2ZhC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAY,EACZ,kBAAsB,EACtB,kBAA6B,GAC9B,EAAE;IACD,YAAY,EAAE,sBAAsB,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,+BAkBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageModalWithTabs.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageModalWithTabs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StorageModalWithTabs.d.ts","sourceRoot":"","sources":["../../../../src/storage/components/StorageModalWithTabs.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA0B9C,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC5C;AAqBD,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,2BAAmC,EACnC,mBAAwB,GACzB,EAAE,yBAAyB,sCA6sB3B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useStorageEvents Hook
|
|
3
|
+
*
|
|
4
|
+
* React hook for subscribing to storage events from the centralized store.
|
|
5
|
+
* Provides a clean interface for components to receive storage events.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* function MyComponent() {
|
|
10
|
+
* const { events, clearEvents, isCapturing } = useStorageEvents();
|
|
11
|
+
*
|
|
12
|
+
* return (
|
|
13
|
+
* <View>
|
|
14
|
+
* {events.map((event) => (
|
|
15
|
+
* <Text key={event.timestamp.toString()}>
|
|
16
|
+
* {event.action}: {event.data?.key}
|
|
17
|
+
* </Text>
|
|
18
|
+
* ))}
|
|
19
|
+
* </View>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import { type StorageEvent } from "../stores/storageEventStore";
|
|
25
|
+
export type { StorageEvent } from "../stores/storageEventStore";
|
|
26
|
+
export interface UseStorageEventsOptions {
|
|
27
|
+
/** Filter by storage type */
|
|
28
|
+
storageType?: "async" | "mmkv" | "all";
|
|
29
|
+
/** Maximum number of events to keep in state */
|
|
30
|
+
maxEvents?: number;
|
|
31
|
+
/** Auto-start capturing on mount (default: true) */
|
|
32
|
+
autoStart?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface UseStorageEventsResult {
|
|
35
|
+
/** All storage events (newest first) */
|
|
36
|
+
events: StorageEvent[];
|
|
37
|
+
/** Clear all events */
|
|
38
|
+
clearEvents: () => void;
|
|
39
|
+
/** Whether events are being captured */
|
|
40
|
+
isCapturing: boolean;
|
|
41
|
+
/** Start capturing events */
|
|
42
|
+
startCapturing: () => Promise<void>;
|
|
43
|
+
/** Stop capturing events */
|
|
44
|
+
stopCapturing: () => void;
|
|
45
|
+
/** Pause capturing (for time-travel) */
|
|
46
|
+
pauseCapturing: () => void;
|
|
47
|
+
/** Resume capturing after pause */
|
|
48
|
+
resumeCapturing: () => void;
|
|
49
|
+
}
|
|
50
|
+
export declare function useStorageEvents(options?: UseStorageEventsOptions): UseStorageEventsResult;
|
|
51
|
+
//# sourceMappingURL=useStorageEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorageEvents.d.ts","sourceRoot":"","sources":["../../../../src/storage/hooks/useStorageEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,uBAAuB;IACtC,6BAA6B;IAC7B,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;IACvC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,wCAAwC;IACxC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,uBAAuB;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,wCAAwC;IACxC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mCAAmC;IACnC,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,CAoExB"}
|
|
@@ -5,11 +5,15 @@ export { StorageKeyStatsSection } from "./components/StorageKeyStats";
|
|
|
5
5
|
export { StorageKeySection } from "./components/StorageKeySection";
|
|
6
6
|
export { StorageBrowserMode } from "./components/StorageBrowserMode";
|
|
7
7
|
export { StorageEventsSection } from "./components/StorageEventsSection";
|
|
8
|
+
export { StorageEventCard, getValueType, type StorageEventCardData, type StorageValueType } from "./components/StorageEventCard";
|
|
9
|
+
export { StorageEventDetailContent, StorageEventDetailFooter } from "./components/StorageEventDetailContent";
|
|
8
10
|
export { useAsyncStorageKeys } from "./hooks/useAsyncStorageKeys";
|
|
9
11
|
export { useMMKVKeys, useMultiMMKVKeys } from "./hooks/useMMKVKeys";
|
|
10
12
|
export { useMMKVInstances, useMMKVInstance, useMMKVInstanceExists } from "./hooks/useMMKVInstances";
|
|
13
|
+
export { useStorageEvents, type UseStorageEventsOptions, type UseStorageEventsResult } from "./hooks/useStorageEvents";
|
|
11
14
|
export { MMKVInstanceSelector } from "./components/MMKVInstanceSelector";
|
|
12
15
|
export { MMKVInstanceInfoPanel } from "./components/MMKVInstanceInfoPanel";
|
|
13
16
|
export * from "./types";
|
|
14
17
|
export * from "./utils";
|
|
18
|
+
export { storageEventStore, startStorageCapture, stopStorageCapture, pauseStorageCapture, resumeStorageCapture, subscribeToStorageEvents, onStorageEvent, getStorageEvents, clearStorageEvents, isStorageCapturing, type StorageEvent, type StorageEventListener, type StorageEventCallback, } from "./stores/storageEventStore";
|
|
15
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjI,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAG7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Event Store
|
|
3
|
+
*
|
|
4
|
+
* Centralized store that aggregates storage events from AsyncStorage and MMKV
|
|
5
|
+
* into a single event stream. This provides a single source of truth for all
|
|
6
|
+
* storage operations, eliminating duplicate subscriptions across components.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { storageEventStore } from '@buoy-gg/storage';
|
|
11
|
+
*
|
|
12
|
+
* // Subscribe to storage events
|
|
13
|
+
* const unsubscribe = storageEventStore.subscribe((events) => {
|
|
14
|
+
* console.log('Storage events:', events);
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Start capturing (must be called once)
|
|
18
|
+
* await storageEventStore.startCapturing();
|
|
19
|
+
*
|
|
20
|
+
* // Later, clean up
|
|
21
|
+
* unsubscribe();
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
import { type AsyncStorageEvent } from "../utils/AsyncStorageListener";
|
|
25
|
+
import { type MMKVEvent } from "../utils/MMKVListener";
|
|
26
|
+
/**
|
|
27
|
+
* Unified storage event type combining AsyncStorage and MMKV events
|
|
28
|
+
*/
|
|
29
|
+
export type StorageEvent = (AsyncStorageEvent & {
|
|
30
|
+
storageType: "async";
|
|
31
|
+
}) | (MMKVEvent & {
|
|
32
|
+
storageType: "mmkv";
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Listener callback type for storage events
|
|
36
|
+
*/
|
|
37
|
+
export type StorageEventListener = (events: StorageEvent[]) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Listener callback for individual new events
|
|
40
|
+
*/
|
|
41
|
+
export type StorageEventCallback = (event: StorageEvent) => void;
|
|
42
|
+
declare class StorageEventStore {
|
|
43
|
+
private events;
|
|
44
|
+
private listeners;
|
|
45
|
+
private eventCallbacks;
|
|
46
|
+
private isCapturing;
|
|
47
|
+
private asyncStorageUnsubscribe;
|
|
48
|
+
private mmkvUnsubscribe;
|
|
49
|
+
/**
|
|
50
|
+
* Start capturing storage events from both AsyncStorage and MMKV
|
|
51
|
+
*/
|
|
52
|
+
startCapturing(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Stop capturing storage events
|
|
55
|
+
*/
|
|
56
|
+
stopCapturing(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Pause event capture (used during time-travel operations)
|
|
59
|
+
*/
|
|
60
|
+
pauseCapture(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Resume event capture after pausing
|
|
63
|
+
*/
|
|
64
|
+
resumeCapture(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Add an event to the store
|
|
67
|
+
*/
|
|
68
|
+
private addEvent;
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to all storage events (receives full event array on each change)
|
|
71
|
+
*/
|
|
72
|
+
subscribe(listener: StorageEventListener): () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Subscribe to new events only (receives individual events as they occur)
|
|
75
|
+
*/
|
|
76
|
+
onEvent(callback: StorageEventCallback): () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Notify all listeners of changes
|
|
79
|
+
*/
|
|
80
|
+
private notifyListeners;
|
|
81
|
+
/**
|
|
82
|
+
* Get all events
|
|
83
|
+
*/
|
|
84
|
+
getEvents(): StorageEvent[];
|
|
85
|
+
/**
|
|
86
|
+
* Get events filtered by storage type
|
|
87
|
+
*/
|
|
88
|
+
getEventsByType(storageType: "async" | "mmkv"): StorageEvent[];
|
|
89
|
+
/**
|
|
90
|
+
* Get event count
|
|
91
|
+
*/
|
|
92
|
+
getEventCount(): number;
|
|
93
|
+
/**
|
|
94
|
+
* Clear all events
|
|
95
|
+
*/
|
|
96
|
+
clearEvents(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Check if currently capturing events
|
|
99
|
+
*/
|
|
100
|
+
get capturing(): boolean;
|
|
101
|
+
}
|
|
102
|
+
export declare const storageEventStore: StorageEventStore;
|
|
103
|
+
export declare const startStorageCapture: () => Promise<void>;
|
|
104
|
+
export declare const stopStorageCapture: () => void;
|
|
105
|
+
export declare const pauseStorageCapture: () => void;
|
|
106
|
+
export declare const resumeStorageCapture: () => void;
|
|
107
|
+
export declare const subscribeToStorageEvents: (listener: StorageEventListener) => () => void;
|
|
108
|
+
export declare const onStorageEvent: (callback: StorageEventCallback) => () => void;
|
|
109
|
+
export declare const getStorageEvents: () => StorageEvent[];
|
|
110
|
+
export declare const clearStorageEvents: () => void;
|
|
111
|
+
export declare const isStorageCapturing: () => boolean;
|
|
112
|
+
export {};
|
|
113
|
+
//# sourceMappingURL=storageEventStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageEventStore.d.ts","sourceRoot":"","sources":["../../../../src/storage/stores/storageEventStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,CAAC,iBAAiB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC,GAC9C,CAAC,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1C;;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;AAIjE,cAAM,iBAAiB;IACrB,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAwC;IACzD,OAAO,CAAC,cAAc,CAAwC;IAC9D,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,uBAAuB,CAA6B;IAC5D,OAAO,CAAC,eAAe,CAA6B;IAEpD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BrC;;OAEG;IACH,aAAa,IAAI,IAAI;IAoBrB;;OAEG;IACH,YAAY,IAAI,IAAI;IAKpB;;OAEG;IACH,aAAa,IAAI,IAAI;IAIrB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAiBhB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAYrD;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAQnD;;OAEG;IACH,OAAO,CAAC,eAAe;IAWvB;;OAEG;IACH,SAAS,IAAI,YAAY,EAAE;IAI3B;;OAEG;IACH,eAAe,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,EAAE;IAI9D;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,WAAW,IAAI,IAAI;IAKnB;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;CACF;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAGzD,eAAO,MAAM,mBAAmB,qBAA2C,CAAC;AAC5E,eAAO,MAAM,kBAAkB,YAA0C,CAAC;AAC1E,eAAO,MAAM,mBAAmB,YAAyC,CAAC;AAC1E,eAAO,MAAM,oBAAoB,YAA0C,CAAC;AAC5E,eAAO,MAAM,wBAAwB,GAAI,UAAU,oBAAoB,WAlFpB,IAmFZ,CAAC;AACxC,eAAO,MAAM,cAAc,GAAI,UAAU,oBAAoB,WArEZ,IAsEZ,CAAC;AACtC,eAAO,MAAM,gBAAgB,sBAAsC,CAAC;AACpE,eAAO,MAAM,kBAAkB,YAAwC,CAAC;AACxE,eAAO,MAAM,kBAAkB,eAAoC,CAAC"}
|
|
@@ -4,8 +4,10 @@ export interface AsyncStorageEvent {
|
|
|
4
4
|
data?: {
|
|
5
5
|
key?: string;
|
|
6
6
|
value?: string;
|
|
7
|
+
prevValue?: string | null;
|
|
7
8
|
keys?: string[];
|
|
8
9
|
pairs?: [string, string][];
|
|
10
|
+
prevPairs?: [string, string | null][];
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
export type AsyncStorageEventListener = (event: AsyncStorageEvent) => void;
|
|
@@ -39,6 +41,7 @@ declare class AsyncStorageListener {
|
|
|
39
41
|
private listeners;
|
|
40
42
|
private isListening;
|
|
41
43
|
private isInitialized;
|
|
44
|
+
private isPaused;
|
|
42
45
|
private ignoredKeys;
|
|
43
46
|
private originalSetItem;
|
|
44
47
|
private originalRemoveItem;
|
|
@@ -80,7 +83,7 @@ declare class AsyncStorageListener {
|
|
|
80
83
|
*
|
|
81
84
|
* @param event - The AsyncStorage event to emit
|
|
82
85
|
*
|
|
83
|
-
* @performance Skips processing when no listeners are registered
|
|
86
|
+
* @performance Skips processing when no listeners are registered or when paused
|
|
84
87
|
*/
|
|
85
88
|
private emit;
|
|
86
89
|
/**
|
|
@@ -137,6 +140,23 @@ declare class AsyncStorageListener {
|
|
|
137
140
|
* @returns Number of active listeners
|
|
138
141
|
*/
|
|
139
142
|
get listenerCount(): number;
|
|
143
|
+
/**
|
|
144
|
+
* Pause event emission (used during time-travel operations)
|
|
145
|
+
*
|
|
146
|
+
* When paused, storage operations still execute but events are not emitted.
|
|
147
|
+
* This prevents circular event triggering during replay/jump operations.
|
|
148
|
+
*/
|
|
149
|
+
pause(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Resume event emission after pausing
|
|
152
|
+
*/
|
|
153
|
+
resume(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Check if event emission is currently paused
|
|
156
|
+
*
|
|
157
|
+
* @returns True if paused, false otherwise
|
|
158
|
+
*/
|
|
159
|
+
get paused(): boolean;
|
|
140
160
|
}
|
|
141
161
|
/**
|
|
142
162
|
* Singleton instance of AsyncStorageListener
|
|
@@ -178,6 +198,23 @@ export declare const isListening: () => boolean;
|
|
|
178
198
|
* @returns Number of active listeners
|
|
179
199
|
*/
|
|
180
200
|
export declare const getListenerCount: () => number;
|
|
201
|
+
/**
|
|
202
|
+
* Pause event emission (used during time-travel operations)
|
|
203
|
+
*
|
|
204
|
+
* When paused, storage operations still execute but events are not emitted.
|
|
205
|
+
* This prevents circular event triggering during replay/jump operations.
|
|
206
|
+
*/
|
|
207
|
+
export declare const pauseCapture: () => void;
|
|
208
|
+
/**
|
|
209
|
+
* Resume event emission after pausing
|
|
210
|
+
*/
|
|
211
|
+
export declare const resumeCapture: () => void;
|
|
212
|
+
/**
|
|
213
|
+
* Check if event emission is currently paused
|
|
214
|
+
*
|
|
215
|
+
* @returns True if paused, false otherwise
|
|
216
|
+
*/
|
|
217
|
+
export declare const isPaused: () => boolean;
|
|
181
218
|
/**
|
|
182
219
|
* Export the singleton instance for advanced usage
|
|
183
220
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncStorageListener.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/AsyncStorageListener.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EACF,SAAS,GACT,YAAY,GACZ,WAAW,GACX,OAAO,GACP,UAAU,GACV,aAAa,GACb,YAAY,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"AsyncStorageListener.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/AsyncStorageListener.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EACF,SAAS,GACT,YAAY,GACZ,WAAW,GACX,OAAO,GACP,UAAU,GACV,aAAa,GACb,YAAY,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;QAC3B,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;KACvC,CAAC;CACH;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAIzB,OAAO,CAAC,WAAW,CAKhB;IAGH,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,iBAAiB,CAAsC;IAC/D,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,mBAAmB,CAAwC;IACnE,OAAO,CAAC,kBAAkB,CAAuC;IAEjE;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAYvB;;;;;;;;;OASG;YACW,UAAU;IAiCxB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IA0B9B;;;;;;OAMG;IACH,OAAO,CAAC,IAAI;IAoBZ;;;;;;;;;;OAUG;IACG,cAAc;IAkRpB;;;;;OAKG;IACH,aAAa;IAsCb;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,QAAQ,EAAE,yBAAyB;IAY/C;;;;OAIG;IACH,kBAAkB;IAKlB;;;;OAIG;IACH,IAAI,QAAQ,YAEX;IAED;;;;OAIG;IACH,IAAI,aAAa,WAEhB;IAED;;;;;OAKG;IACH,KAAK;IAIL;;OAEG;IACH,MAAM;IAIN;;;;OAIG;IACH,IAAI,MAAM,YAET;CACF;AAED;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,sBAA6B,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,cAAc,qBAA8C,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,aAAa,YAA6C,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,yBAAyB,eACnB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,kBAAkB,YACY,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,WAAW,eAAsC,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,cAA2C,CAAC;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,YAAqC,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,aAAa,YAAsC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,eAAoC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { clearAllAppStorage } from "./clearAllStorage";
|
|
2
2
|
export { isMMKVAvailable, getMMKVClass, getMMKVUnavailableMessage, } from "./mmkvAvailability";
|
|
3
|
-
export { startListening, stopListening, addListener, removeAllListeners, isListening, getListenerCount, type AsyncStorageEvent, type AsyncStorageEventListener, } from "./AsyncStorageListener";
|
|
3
|
+
export { startListening, stopListening, addListener, removeAllListeners, isListening, getListenerCount, pauseCapture, resumeCapture, isPaused, type AsyncStorageEvent, type AsyncStorageEventListener, } from "./AsyncStorageListener";
|
|
4
4
|
export { default as asyncStorageListener } from "./AsyncStorageListener";
|
|
5
|
+
export { undoOperation, jumpToState, canUndo, } from "./storageTimeTravelUtils";
|
|
5
6
|
export { registerMMKVInstance, unregisterMMKVInstance, mmkvInstanceRegistry, type MMKVInstanceInfo, } from "./MMKVInstanceRegistry";
|
|
6
7
|
export { addMMKVInstance, removeMMKVInstance, removeAllMMKVInstances, addMMKVListener, removeAllMMKVListeners, isMMKVInstanceMonitored, getMonitoredMMKVInstances, getMMKVInstanceCount, getMMKVListenerCount, isMMKVListening, mmkvListener, type MMKVEvent, type MMKVEventListener, } from "./MMKVListener";
|
|
7
8
|
export { detectMMKVType, formatMMKVValue, isTypeMatch, type MMKVValueType, type MMKVValueInfo, } from "./mmkvTypeDetection";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGzE,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGzE,OAAO,EACL,aAAa,EACb,WAAW,EACX,OAAO,GACR,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Time-Travel Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides jump and undo functionality for AsyncStorage operations.
|
|
5
|
+
*/
|
|
6
|
+
import { type AsyncStorageEvent } from "./AsyncStorageListener";
|
|
7
|
+
/**
|
|
8
|
+
* Undo a single storage operation
|
|
9
|
+
*
|
|
10
|
+
* Restores the previous value(s) before the operation occurred.
|
|
11
|
+
* This pauses event capture to avoid creating new events during restoration.
|
|
12
|
+
*
|
|
13
|
+
* @param event - The storage event to undo
|
|
14
|
+
*/
|
|
15
|
+
export declare function undoOperation(event: AsyncStorageEvent): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Jump to a specific point in storage history
|
|
18
|
+
*
|
|
19
|
+
* This reconstructs the storage state as it was after a specific event
|
|
20
|
+
* by clearing storage and replaying all events up to that point.
|
|
21
|
+
*
|
|
22
|
+
* Note: This is a destructive operation - it will clear current storage
|
|
23
|
+
* and replay events to reach the target state.
|
|
24
|
+
*
|
|
25
|
+
* @param events - All events in chronological order (oldest first)
|
|
26
|
+
* @param targetEventIndex - The index of the event to jump to (0-based)
|
|
27
|
+
*/
|
|
28
|
+
export declare function jumpToState(events: AsyncStorageEvent[], targetEventIndex: number): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if an operation can be undone
|
|
31
|
+
*
|
|
32
|
+
* Some operations may not have the previous value captured.
|
|
33
|
+
*/
|
|
34
|
+
export declare function canUndo(event: AsyncStorageEvent): boolean;
|
|
35
|
+
//# sourceMappingURL=storageTimeTravelUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageTimeTravelUtils.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/storageTimeTravelUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE7F;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwE3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,iBAAiB,EAAE,EAC3B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAoCf;AAuFD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAoBzD"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/storage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "storage package",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
8
8
|
"react-native": "lib/module/index.js",
|
|
9
9
|
"source": "src/index.tsx",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"react-native": "./lib/module/index.js",
|
|
13
|
+
"import": {
|
|
14
|
+
"default": "./lib/module/index.js",
|
|
15
|
+
"types": "./lib/typescript/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"default": "./lib/commonjs/index.js",
|
|
19
|
+
"types": "./lib/typescript/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
10
24
|
"files": [
|
|
11
25
|
"lib"
|
|
12
26
|
],
|
|
13
27
|
"sideEffects": false,
|
|
14
28
|
"dependencies": {
|
|
15
|
-
"@buoy-gg/floating-tools-core": "1.
|
|
16
|
-
"@buoy-gg/shared-ui": "1.
|
|
29
|
+
"@buoy-gg/floating-tools-core": "2.1.1",
|
|
30
|
+
"@buoy-gg/shared-ui": "2.1.1"
|
|
17
31
|
},
|
|
18
32
|
"peerDependencies": {
|
|
33
|
+
"@buoy-gg/license": "*",
|
|
19
34
|
"@react-native-async-storage/async-storage": ">=1.0.0",
|
|
20
35
|
"react": "*",
|
|
21
36
|
"react-native": "*"
|
|
@@ -24,7 +39,8 @@
|
|
|
24
39
|
"@react-native-async-storage/async-storage": "^2.1.0",
|
|
25
40
|
"@types/react": "^19.1.0",
|
|
26
41
|
"@types/react-native": "^0.73.0",
|
|
27
|
-
"typescript": "~5.8.3"
|
|
42
|
+
"typescript": "~5.8.3",
|
|
43
|
+
"@buoy-gg/license": "2.1.1"
|
|
28
44
|
},
|
|
29
45
|
"react-native-builder-bob": {
|
|
30
46
|
"source": "src",
|