@buoy-gg/storage 1.7.2
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/README.md +607 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +94 -0
- package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +356 -0
- package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +29 -0
- package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +121 -0
- package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +419 -0
- package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +122 -0
- package/lib/commonjs/storage/components/GameUIStorageBrowser.js +924 -0
- package/lib/commonjs/storage/components/GameUIStorageStats.js +746 -0
- package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +257 -0
- package/lib/commonjs/storage/components/MMKVInstanceSelector.js +418 -0
- package/lib/commonjs/storage/components/SelectionActionBar.js +224 -0
- package/lib/commonjs/storage/components/StorageActionButtons.js +239 -0
- package/lib/commonjs/storage/components/StorageActions.js +192 -0
- package/lib/commonjs/storage/components/StorageBrowserMode.js +31 -0
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +1025 -0
- package/lib/commonjs/storage/components/StorageEventFilterView.js +141 -0
- package/lib/commonjs/storage/components/StorageEventListener.js +357 -0
- package/lib/commonjs/storage/components/StorageEventsSection.js +24 -0
- package/lib/commonjs/storage/components/StorageFilterCards.js +345 -0
- package/lib/commonjs/storage/components/StorageFilterViewV2.js +42 -0
- package/lib/commonjs/storage/components/StorageKeyCard.js +516 -0
- package/lib/commonjs/storage/components/StorageKeyRow.js +356 -0
- package/lib/commonjs/storage/components/StorageKeySection.js +105 -0
- package/lib/commonjs/storage/components/StorageKeyStats.js +344 -0
- package/lib/commonjs/storage/components/StorageModalWithTabs.js +871 -0
- package/lib/commonjs/storage/components/StorageSection.js +43 -0
- package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +126 -0
- package/lib/commonjs/storage/hooks/useMMKVInstances.js +221 -0
- package/lib/commonjs/storage/hooks/useMMKVKeys.js +362 -0
- package/lib/commonjs/storage/hooks/useTickEverySecond.js +21 -0
- package/lib/commonjs/storage/index.js +148 -0
- package/lib/commonjs/storage/types.js +5 -0
- package/lib/commonjs/storage/utils/AsyncStorageListener.js +510 -0
- package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +202 -0
- package/lib/commonjs/storage/utils/MMKVListener.js +380 -0
- package/lib/commonjs/storage/utils/clearAllStorage.js +47 -0
- package/lib/commonjs/storage/utils/index.js +180 -0
- package/lib/commonjs/storage/utils/lineDiff.js +363 -0
- package/lib/commonjs/storage/utils/mmkvAvailability.js +62 -0
- package/lib/commonjs/storage/utils/mmkvTypeDetection.js +139 -0
- package/lib/commonjs/storage/utils/objectDiff.js +157 -0
- package/lib/commonjs/storage/utils/safeAsyncStorage.js +140 -0
- package/lib/commonjs/storage/utils/storageActionHelpers.js +46 -0
- package/lib/commonjs/storage/utils/storageQueryUtils.js +35 -0
- package/lib/commonjs/storage/utils/valueType.js +18 -0
- package/lib/module/index.js +7 -0
- package/lib/module/preset.js +89 -0
- package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +352 -0
- package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +25 -0
- package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +117 -0
- package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +415 -0
- package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +118 -0
- package/lib/module/storage/components/GameUIStorageBrowser.js +922 -0
- package/lib/module/storage/components/GameUIStorageStats.js +742 -0
- package/lib/module/storage/components/MMKVInstanceInfoPanel.js +253 -0
- package/lib/module/storage/components/MMKVInstanceSelector.js +414 -0
- package/lib/module/storage/components/SelectionActionBar.js +221 -0
- package/lib/module/storage/components/StorageActionButtons.js +236 -0
- package/lib/module/storage/components/StorageActions.js +189 -0
- package/lib/module/storage/components/StorageBrowserMode.js +27 -0
- package/lib/module/storage/components/StorageEventDetailContent.js +1020 -0
- package/lib/module/storage/components/StorageEventFilterView.js +137 -0
- package/lib/module/storage/components/StorageEventListener.js +354 -0
- package/lib/module/storage/components/StorageEventsSection.js +20 -0
- package/lib/module/storage/components/StorageFilterCards.js +341 -0
- package/lib/module/storage/components/StorageFilterViewV2.js +38 -0
- package/lib/module/storage/components/StorageKeyCard.js +513 -0
- package/lib/module/storage/components/StorageKeyRow.js +353 -0
- package/lib/module/storage/components/StorageKeySection.js +101 -0
- package/lib/module/storage/components/StorageKeyStats.js +340 -0
- package/lib/module/storage/components/StorageModalWithTabs.js +867 -0
- package/lib/module/storage/components/StorageSection.js +40 -0
- package/lib/module/storage/hooks/useAsyncStorageKeys.js +121 -0
- package/lib/module/storage/hooks/useMMKVInstances.js +216 -0
- package/lib/module/storage/hooks/useMMKVKeys.js +359 -0
- package/lib/module/storage/hooks/useTickEverySecond.js +18 -0
- package/lib/module/storage/index.js +25 -0
- package/lib/module/storage/types.js +3 -0
- package/lib/module/storage/utils/AsyncStorageListener.js +500 -0
- package/lib/module/storage/utils/MMKVInstanceRegistry.js +196 -0
- package/lib/module/storage/utils/MMKVListener.js +367 -0
- package/lib/module/storage/utils/clearAllStorage.js +42 -0
- package/lib/module/storage/utils/index.js +22 -0
- package/lib/module/storage/utils/lineDiff.js +359 -0
- package/lib/module/storage/utils/mmkvAvailability.js +56 -0
- package/lib/module/storage/utils/mmkvTypeDetection.js +133 -0
- package/lib/module/storage/utils/objectDiff.js +153 -0
- package/lib/module/storage/utils/safeAsyncStorage.js +134 -0
- package/lib/module/storage/utils/storageActionHelpers.js +42 -0
- package/lib/module/storage/utils/storageQueryUtils.js +30 -0
- package/lib/module/storage/utils/valueType.js +14 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +90 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +18 -0
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts +7 -0
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +12 -0
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts +13 -0
- package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts +64 -0
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +1 -0
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts +16 -0
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -0
- package/lib/typescript/storage/components/GameUIStorageStats.d.ts +7 -0
- package/lib/typescript/storage/components/GameUIStorageStats.d.ts.map +1 -0
- package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts +42 -0
- package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +1 -0
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +35 -0
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +1 -0
- package/lib/typescript/storage/components/SelectionActionBar.d.ts +21 -0
- package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageActionButtons.d.ts +21 -0
- package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageActions.d.ts +10 -0
- package/lib/typescript/storage/components/StorageActions.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageBrowserMode.d.ts +18 -0
- package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts +40 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventFilterView.d.ts +11 -0
- package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventListener.d.ts +6 -0
- package/lib/typescript/storage/components/StorageEventListener.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventsSection.d.ts +7 -0
- package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageFilterCards.d.ts +36 -0
- package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageFilterViewV2.d.ts +9 -0
- package/lib/typescript/storage/components/StorageFilterViewV2.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyCard.d.ts +17 -0
- package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyRow.d.ts +15 -0
- package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeySection.d.ts +25 -0
- package/lib/typescript/storage/components/StorageKeySection.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyStats.d.ts +15 -0
- package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts +13 -0
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageSection.d.ts +10 -0
- package/lib/typescript/storage/components/StorageSection.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts +10 -0
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useMMKVInstances.d.ts +114 -0
- package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useMMKVKeys.d.ts +94 -0
- package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useTickEverySecond.d.ts +6 -0
- package/lib/typescript/storage/hooks/useTickEverySecond.d.ts.map +1 -0
- package/lib/typescript/storage/index.d.ts +15 -0
- package/lib/typescript/storage/index.d.ts.map +1 -0
- package/lib/typescript/storage/types.d.ts +41 -0
- package/lib/typescript/storage/types.d.ts.map +1 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts +195 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +1 -0
- package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts +224 -0
- package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +1 -0
- package/lib/typescript/storage/utils/MMKVListener.d.ts +218 -0
- package/lib/typescript/storage/utils/MMKVListener.d.ts.map +1 -0
- package/lib/typescript/storage/utils/clearAllStorage.d.ts +11 -0
- package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +1 -0
- package/lib/typescript/storage/utils/index.d.ts +8 -0
- package/lib/typescript/storage/utils/index.d.ts.map +1 -0
- package/lib/typescript/storage/utils/lineDiff.d.ts +34 -0
- package/lib/typescript/storage/utils/lineDiff.d.ts.map +1 -0
- package/lib/typescript/storage/utils/mmkvAvailability.d.ts +23 -0
- package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +1 -0
- package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts +71 -0
- package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +1 -0
- package/lib/typescript/storage/utils/objectDiff.d.ts +35 -0
- package/lib/typescript/storage/utils/objectDiff.d.ts.map +1 -0
- package/lib/typescript/storage/utils/safeAsyncStorage.d.ts +56 -0
- package/lib/typescript/storage/utils/safeAsyncStorage.d.ts.map +1 -0
- package/lib/typescript/storage/utils/storageActionHelpers.d.ts +5 -0
- package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +1 -0
- package/lib/typescript/storage/utils/storageQueryUtils.d.ts +6 -0
- package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +1 -0
- package/lib/typescript/storage/utils/valueType.d.ts +3 -0
- package/lib/typescript/storage/utils/valueType.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line-by-line diff computation for React Native
|
|
3
|
+
* Adapted from react-diff-viewer for object comparison
|
|
4
|
+
*/
|
|
5
|
+
export declare enum DiffType {
|
|
6
|
+
DEFAULT = "unchanged",
|
|
7
|
+
ADDED = "added",
|
|
8
|
+
REMOVED = "removed",
|
|
9
|
+
MODIFIED = "modified"
|
|
10
|
+
}
|
|
11
|
+
export interface WordDiff {
|
|
12
|
+
value: string;
|
|
13
|
+
type: DiffType;
|
|
14
|
+
}
|
|
15
|
+
export interface LineDiffInfo {
|
|
16
|
+
leftLineNumber?: number;
|
|
17
|
+
rightLineNumber?: number;
|
|
18
|
+
type: DiffType;
|
|
19
|
+
leftContent?: string | WordDiff[];
|
|
20
|
+
rightContent?: string | WordDiff[];
|
|
21
|
+
leftRaw?: string;
|
|
22
|
+
rightRaw?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DiffComputeOptions {
|
|
25
|
+
compareMethod?: "chars" | "words" | "lines" | "trimmedLines";
|
|
26
|
+
disableWordDiff?: boolean;
|
|
27
|
+
showDiffOnly?: boolean;
|
|
28
|
+
contextLines?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Compute line-by-line diff between two objects
|
|
32
|
+
*/
|
|
33
|
+
export declare function computeLineDiff(oldValue: unknown, newValue: unknown, options?: DiffComputeOptions): LineDiffInfo[];
|
|
34
|
+
//# sourceMappingURL=lineDiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineDiff.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/lineDiff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,QAAQ;IAClB,OAAO,cAAc;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAqJD,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,cAAc,CAAC;IAC7D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA+ED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,kBAAuB,GAC/B,YAAY,EAAE,CA4HhB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MMKV Availability Detection
|
|
3
|
+
*
|
|
4
|
+
* Safely detects if react-native-mmkv is available in the current environment.
|
|
5
|
+
* This allows the app to work in Expo Go where native modules aren't available.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Check if MMKV is available in the current environment
|
|
9
|
+
*
|
|
10
|
+
* @returns True if react-native-mmkv is installed and available
|
|
11
|
+
*/
|
|
12
|
+
export declare function isMMKVAvailable(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Get the MMKV class if available
|
|
15
|
+
*
|
|
16
|
+
* @returns MMKV class or null if not available
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMMKVClass(): any | null;
|
|
19
|
+
/**
|
|
20
|
+
* Get a user-friendly error message when MMKV is not available
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMMKVUnavailableMessage(): string;
|
|
23
|
+
//# sourceMappingURL=mmkvAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mmkvAvailability.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/mmkvAvailability.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAoBzC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,GAAG,GAAG,IAAI,CAKzC;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MMKV Type Detection Utilities
|
|
3
|
+
*
|
|
4
|
+
* MMKV stores values with native types (string, number, boolean, ArrayBuffer).
|
|
5
|
+
* This module provides utilities to detect the type of a stored value by trying
|
|
6
|
+
* each getter sequentially.
|
|
7
|
+
*/
|
|
8
|
+
type MMKV = any;
|
|
9
|
+
export type MMKVValueType = 'string' | 'number' | 'boolean' | 'buffer' | 'unknown';
|
|
10
|
+
export interface MMKVValueInfo {
|
|
11
|
+
value: any;
|
|
12
|
+
type: MMKVValueType;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Detect the type of a value stored in MMKV by trying each getter.
|
|
16
|
+
*
|
|
17
|
+
* Since MMKV doesn't provide a getType() method, we must try each getter
|
|
18
|
+
* (getString, getNumber, getBoolean, getBuffer) until one returns a value.
|
|
19
|
+
*
|
|
20
|
+
* Order matters: We try in order of most common types first.
|
|
21
|
+
*
|
|
22
|
+
* @param instance - MMKV instance to read from
|
|
23
|
+
* @param key - Storage key
|
|
24
|
+
* @returns Value and its detected type
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const instance = createMMKV();
|
|
29
|
+
* instance.set('name', 'John');
|
|
30
|
+
* instance.set('age', 30);
|
|
31
|
+
* instance.set('active', true);
|
|
32
|
+
*
|
|
33
|
+
* detectMMKVType(instance, 'name'); // { value: 'John', type: 'string' }
|
|
34
|
+
* detectMMKVType(instance, 'age'); // { value: 30, type: 'number' }
|
|
35
|
+
* detectMMKVType(instance, 'active'); // { value: true, type: 'boolean' }
|
|
36
|
+
* detectMMKVType(instance, 'missing');// { value: undefined, type: 'unknown' }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function detectMMKVType(instance: MMKV, key: string): MMKVValueInfo;
|
|
40
|
+
/**
|
|
41
|
+
* Format an MMKV value for display in the UI.
|
|
42
|
+
*
|
|
43
|
+
* @param value - The value to format
|
|
44
|
+
* @param type - The detected type
|
|
45
|
+
* @returns Formatted string representation
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* formatMMKVValue('hello', 'string'); // '"hello"'
|
|
50
|
+
* formatMMKVValue(42, 'number'); // '42'
|
|
51
|
+
* formatMMKVValue(true, 'boolean'); // 'true'
|
|
52
|
+
* formatMMKVValue('<ArrayBuffer 1024 bytes>', 'buffer'); // '<ArrayBuffer 1024 bytes>'
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatMMKVValue(value: any, type: MMKVValueType): string;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a value type matches an expected type for validation.
|
|
58
|
+
*
|
|
59
|
+
* @param actualType - Detected type
|
|
60
|
+
* @param expectedType - Expected type from configuration
|
|
61
|
+
* @returns True if types match
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* isTypeMatch('string', 'string'); // true
|
|
66
|
+
* isTypeMatch('number', 'string'); // false
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function isTypeMatch(actualType: MMKVValueType, expectedType: string): boolean;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=mmkvTypeDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mmkvTypeDetection.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/mmkvTypeDetection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,KAAK,IAAI,GAAG,GAAG,CAAC;AAEhB,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,CA+BzE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAmBvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAEpF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DiffItem {
|
|
2
|
+
type: "CREATE" | "REMOVE" | "CHANGE";
|
|
3
|
+
path: (string | number)[];
|
|
4
|
+
value?: unknown;
|
|
5
|
+
oldValue?: unknown;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generate a comprehensive diff between two objects or values
|
|
9
|
+
*
|
|
10
|
+
* This function performs a deep comparison between two values and returns
|
|
11
|
+
* a detailed list of all differences, including additions, removals, and changes.
|
|
12
|
+
* Each difference includes the exact path where the change occurred.
|
|
13
|
+
*
|
|
14
|
+
* @param oldObj - The original object/value to compare from
|
|
15
|
+
* @param newObj - The new object/value to compare to
|
|
16
|
+
* @returns Array of DiffItem objects describing all differences
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const oldData = { user: { name: "John", age: 30 }, items: [1, 2] };
|
|
21
|
+
* const newData = { user: { name: "Jane", age: 30 }, items: [1, 2, 3] };
|
|
22
|
+
*
|
|
23
|
+
* const diffs = objectDiff(oldData, newData);
|
|
24
|
+
* // Returns:
|
|
25
|
+
* // [
|
|
26
|
+
* // { type: "CHANGE", path: ["user", "name"], oldValue: "John", value: "Jane" },
|
|
27
|
+
* // { type: "CREATE", path: ["items", 2], value: 3 }
|
|
28
|
+
* // ]
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @performance Handles circular references and deep nesting efficiently
|
|
32
|
+
* @performance Uses Set for key deduplication to optimize comparison speed
|
|
33
|
+
*/
|
|
34
|
+
export declare function objectDiff(oldObj: unknown, newObj: unknown): DiffItem[];
|
|
35
|
+
//# sourceMappingURL=objectDiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectDiff.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/objectDiff.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACrC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA2GD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,CA+BvE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe AsyncStorage wrapper that handles missing dependencies gracefully.
|
|
3
|
+
*
|
|
4
|
+
* This wrapper allows the storage dev tools to work even when
|
|
5
|
+
* @react-native-async-storage/async-storage is not installed in the host app.
|
|
6
|
+
*
|
|
7
|
+
* When AsyncStorage is not available:
|
|
8
|
+
* - All operations return empty results or no-ops
|
|
9
|
+
* - No errors are thrown
|
|
10
|
+
* - The dev tools can still load (but storage features will be limited)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if AsyncStorage is available in the host app
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAsyncStorageAvailable(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Safe AsyncStorage wrapper that provides no-op fallbacks when unavailable.
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { safeAsyncStorage } from './utils/safeAsyncStorage';
|
|
22
|
+
*
|
|
23
|
+
* // This will work even if AsyncStorage is not installed
|
|
24
|
+
* const value = await safeAsyncStorage.getItem('myKey');
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const safeAsyncStorage: {
|
|
28
|
+
getItem: (_key: string) => Promise<string | null>;
|
|
29
|
+
setItem: (_key: string, _value: string) => Promise<void>;
|
|
30
|
+
removeItem: (_key: string) => Promise<void>;
|
|
31
|
+
getAllKeys: () => Promise<string[]>;
|
|
32
|
+
multiGet: (_keys: string[]) => Promise<[string, string | null][]>;
|
|
33
|
+
multiSet: (_keyValuePairs: [string, string][]) => Promise<void>;
|
|
34
|
+
multiRemove: (_keys: string[]) => Promise<void>;
|
|
35
|
+
clear: () => Promise<void>;
|
|
36
|
+
mergeItem: (_key: string, _value: string) => Promise<void>;
|
|
37
|
+
multiMerge: (_keyValuePairs: [string, string][]) => Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Get the actual AsyncStorage instance if available, or null if not.
|
|
41
|
+
* Use this when you need to check if AsyncStorage is available before using it.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const storage = getAsyncStorageInstance();
|
|
46
|
+
* if (storage) {
|
|
47
|
+
* // AsyncStorage is available
|
|
48
|
+
* await storage.setItem('key', 'value');
|
|
49
|
+
* } else {
|
|
50
|
+
* // AsyncStorage is not available, handle gracefully
|
|
51
|
+
* console.warn('AsyncStorage not available');
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAsyncStorageInstance(): any | null;
|
|
56
|
+
//# sourceMappingURL=safeAsyncStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeAsyncStorage.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/safeAsyncStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgDH;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAkBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;oBAvBL,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;oBAC/B,MAAM,UAAU,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;uBACnC,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;sBACzB,OAAO,CAAC,MAAM,EAAE,CAAC;sBACf,MAAM,EAAE,KAAG,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;+BACpC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;yBACxC,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;iBAClC,OAAO,CAAC,IAAI,CAAC;sBACN,MAAM,UAAU,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;iCAC3B,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC;CAmCrE,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,IAAI,GAAG,GAAG,IAAI,CAGpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageActionHelpers.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/storageActionHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqC7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type StorageType = "mmkv" | "async" | "secure";
|
|
2
|
+
/** Human readable label for a storage type id. */
|
|
3
|
+
export declare function getStorageTypeLabel(storageType: StorageType): string;
|
|
4
|
+
/** Preferred color token for rendering a given storage type. */
|
|
5
|
+
export declare function getStorageTypeHexColor(storageType: StorageType): string;
|
|
6
|
+
//# sourceMappingURL=storageQueryUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageQueryUtils.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/storageQueryUtils.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD,kDAAkD;AAClD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAWpE;AAED,gEAAgE;AAChE,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAWvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueType.d.ts","sourceRoot":"","sources":["../../../../src/storage/utils/valueType.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYxD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buoy-gg/storage",
|
|
3
|
+
"version": "1.7.2",
|
|
4
|
+
"description": "storage package",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index.tsx",
|
|
9
|
+
"source": "src/index.tsx",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib"
|
|
12
|
+
],
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "bob build",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"prepublishOnly": "bob build",
|
|
18
|
+
"clean": "rimraf lib",
|
|
19
|
+
"test": "pnpm run typecheck"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@buoy-gg/floating-tools-core": "workspace:*",
|
|
23
|
+
"@buoy-gg/shared-ui": "workspace:*"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@react-native-async-storage/async-storage": ">=1.0.0",
|
|
27
|
+
"react": "*",
|
|
28
|
+
"react-native": "*"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@react-native-async-storage/async-storage": "^2.1.0",
|
|
32
|
+
"@types/react": "^19.1.0",
|
|
33
|
+
"@types/react-native": "^0.73.0",
|
|
34
|
+
"typescript": "~5.8.3"
|
|
35
|
+
},
|
|
36
|
+
"react-native-builder-bob": {
|
|
37
|
+
"source": "src",
|
|
38
|
+
"output": "lib",
|
|
39
|
+
"targets": [
|
|
40
|
+
[
|
|
41
|
+
"commonjs",
|
|
42
|
+
{
|
|
43
|
+
"sourceMaps": false
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"module",
|
|
48
|
+
{
|
|
49
|
+
"sourceMaps": false
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"typescript"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/LovesWorking/react-native-buoy.git",
|
|
58
|
+
"directory": "packages/storage"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/LovesWorking/react-native-buoy/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/LovesWorking/react-native-buoy/tree/main/packages/storage#readme",
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public",
|
|
66
|
+
"tag": "latest"
|
|
67
|
+
}
|
|
68
|
+
}
|