react-native-global-state-hooks 2.0.3 → 2.0.5

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.
@@ -1,24 +1,33 @@
1
- /// <reference types="lodash" />
2
1
  import * as IGlobalStore from './GlobalStoreTypes';
3
- export declare const isPrimitive: <T>(value: T) => boolean;
4
- export declare class GlobalStore<IState, IPersist extends string | null = null, IsPersist extends boolean = IPersist extends null ? false : true, IActions extends IGlobalStore.IActionCollectionConfig<IState> | null = null> implements IGlobalStore.IGlobalState<IState, IPersist, IsPersist, IActions> {
2
+ export declare type IValueWithMedaData = {
3
+ _type_?: 'map' | 'set' | 'date';
4
+ value?: unknown;
5
+ };
6
+ export declare const debounce: <T extends Function>(callback: T, wait?: number) => T;
7
+ export declare class GlobalStore<IState, IPersist extends string | null, IActions extends IGlobalStore.IActionCollectionConfig<IState> | null = null> implements IGlobalStore.IGlobalState<IState, IPersist, IActions> {
5
8
  protected state: IState;
6
9
  protected actions: IActions;
7
10
  persistStoreAs: IPersist;
11
+ /**
12
+ * This function can be used to format the data after it is loaded from the asyncStorage
13
+ */
14
+ onPersistStorageLoad: (obj: unknown) => (IState | null);
8
15
  subscribers: IGlobalStore.StateSetter<IState>[];
9
16
  get isPersistStore(): boolean;
10
- constructor(state: IState, actions?: IActions, persistStoreAs?: IPersist);
17
+ constructor(state: IState, actions?: IActions, persistStoreAs?: IPersist,
18
+ /**
19
+ * This function can be used to format the data after it is loaded from the asyncStorage
20
+ */
21
+ onPersistStorageLoad?: (obj: unknown) => (IState | null));
11
22
  private get isStoredStateItemUpdated();
12
23
  private storedStateItem;
13
- protected formatItemFromStore<T>(obj: T): unknown;
14
- protected formatToStore<T>(obj: T): unknown;
15
24
  protected getAsyncStoreItemPromise: Promise<IState> | null;
16
25
  protected asyncStorageGetItem(): Promise<string | null>;
17
26
  protected getAsyncStoreItem(): Promise<IState>;
18
27
  protected asyncStorageSetItem(valueToStore: string): Promise<void>;
19
28
  protected setAsyncStoreItem(): Promise<void>;
20
29
  protected getStateCopy: () => IState;
21
- getHook: <IApi extends IGlobalStore.IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IGlobalStore.IActionCollectionResult<IState, IActions>>() => () => [IState, IGlobalStore.IHookResult<IState, IActions, IApi>, IsPersist extends true ? boolean : null];
30
+ getHook: <IApi extends IGlobalStore.IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IGlobalStore.IActionCollectionResult<IState, IActions>>() => () => [IState, IGlobalStore.IHookResult<IState, IActions, IApi>, IPersist extends null ? false : boolean];
22
31
  getHookDecoupled: <IApi extends IGlobalStore.IActionCollectionResult<IState, IActions> | null = IActions extends null ? null : IGlobalStore.IActionCollectionResult<IState, IActions>>() => [() => IPersist extends string ? Promise<IState> : IState, IGlobalStore.IHookResult<IState, IActions, IApi>];
23
32
  private _stateOrchestrator;
24
33
  protected get stateOrchestrator(): IGlobalStore.StateSetter<IState> | IGlobalStore.IActionCollectionResult<IState, IActions>;
@@ -33,8 +42,9 @@ export declare class GlobalStore<IState, IPersist extends string | null = null,
33
42
  /**
34
43
  * React native cannot use unstable_batchedUpdates, it does not have any effect
35
44
  */
36
- static ExecutePendingBatches: import("lodash").DebouncedFunc<() => void>;
45
+ static ExecutePendingBatches: () => void;
37
46
  protected getActions: <IApi extends IGlobalStore.IActionCollectionResult<IState, IGlobalStore.IActionCollectionConfig<IState>>>() => IApi;
47
+ deleteAsyncStoreItem: () => Promise<void>;
38
48
  }
39
49
  export default GlobalStore;
40
50
  //# sourceMappingURL=GlobalStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStore.d.ts","sourceRoot":"","sources":["../src/GlobalStore.ts"],"names":[],"mappings":";AAKA,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAEnD,eAAO,MAAM,WAAW,0BAAuH,CAAC;AAEhJ,qBAAa,WAAW,CACtB,MAAM,EACN,QAAQ,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,EACrC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SAAS,CAAC,YAAY,6BAA8B,MAAM,KAAK,MAAM,aAAa,MAAM,IAAI,UAqB1F;IAEF,SAAS,CAAC,iBAAiB,6BAAoC,MAAM,KAAK,MAAM,MAC9E,QAAQ,MAAM,CAAC,CAAmF;IAEpG,SAAS,CAAC,+BAA+B,6BAAoC,MAAM,KAAK,MAAM,MAAI,QAAQ,MAAM,CAAC,CAK/G;IAEF,MAAM,CAAC,8BAA8B,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAM;IAE3D;;MAEE;IACF,MAAM,CAAC,qBAAqB,aAQtB;IAEN,SAAS,CAAC,UAAU,sHA0BlB;IAEK,oBAAoB,QAAa,QAAQ,IAAI,CAAC,CAIpD;CAEF;AAED,eAAe,WAAW,CAAC"}
@@ -1,21 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GlobalStore = exports.isPrimitive = void 0;
3
+ exports.GlobalStore = exports.debounce = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("react");
6
- const lodash_1 = require("lodash");
6
+ const json_storage_formatter_1 = require("json-storage-formatter");
7
7
  const async_storage_1 = (0, tslib_1.__importDefault)(require("@react-native-async-storage/async-storage"));
8
- const isPrimitive = (value) => (0, lodash_1.isNil)(value) || (0, lodash_1.isNumber)(value) || (0, lodash_1.isBoolean)(value) || (0, lodash_1.isString)(value) || typeof value === 'symbol';
9
- exports.isPrimitive = isPrimitive;
8
+ const debounce = (callback, wait = 300) => {
9
+ let timer;
10
+ return ((...args) => {
11
+ clearTimeout(timer);
12
+ timer = setTimeout(() => {
13
+ callback(...args);
14
+ }, wait);
15
+ });
16
+ };
17
+ exports.debounce = debounce;
10
18
  class GlobalStore {
11
- constructor(state, actions = null, persistStoreAs = null) {
19
+ constructor(state, actions = null, persistStoreAs = null,
20
+ /**
21
+ * This function can be used to format the data after it is loaded from the asyncStorage
22
+ */
23
+ onPersistStorageLoad = () => null) {
12
24
  this.state = state;
13
25
  this.actions = actions;
14
26
  this.persistStoreAs = persistStoreAs;
27
+ this.onPersistStorageLoad = onPersistStorageLoad;
15
28
  this.subscribers = [];
16
29
  this.storedStateItem = undefined;
17
30
  this.getAsyncStoreItemPromise = null;
18
- this.getStateCopy = () => Object.freeze((0, lodash_1.cloneDeep)(this.state));
31
+ this.getStateCopy = () => Object.freeze((0, json_storage_formatter_1.clone)(this.state));
19
32
  this.getHook = () => () => {
20
33
  const [value, setter] = (0, react_1.useState)(() => this.state);
21
34
  (0, react_1.useEffect)(() => {
@@ -81,6 +94,11 @@ class GlobalStore {
81
94
  return result;
82
95
  }) })), {});
83
96
  };
97
+ this.deleteAsyncStoreItem = () => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
98
+ if (!this.isPersistStore)
99
+ return;
100
+ yield async_storage_1.default.removeItem(this.persistStoreAs);
101
+ });
84
102
  }
85
103
  get isPersistStore() {
86
104
  return !!this.persistStoreAs;
@@ -88,32 +106,6 @@ class GlobalStore {
88
106
  get isStoredStateItemUpdated() {
89
107
  return this.storedStateItem !== undefined;
90
108
  }
91
- formatItemFromStore(obj) {
92
- const isArray = Array.isArray(obj);
93
- if (isArray) {
94
- return obj.map((item) => this.formatItemFromStore(item));
95
- }
96
- return Object.keys(obj).filter((key) => !key.includes('_type')).reduce((acumulator, key) => {
97
- const type = obj[`${key}_type`];
98
- const unformatedValue = obj[key];
99
- const isDateType = type === 'date';
100
- if (isDateType) {
101
- return Object.assign(Object.assign({}, acumulator), { [key]: new Date(unformatedValue) });
102
- }
103
- return Object.assign(Object.assign({}, acumulator), { [key]: (0, exports.isPrimitive)(unformatedValue) ? unformatedValue : this.formatItemFromStore(unformatedValue) });
104
- }, {});
105
- }
106
- formatToStore(obj) {
107
- const isArray = Array.isArray(obj);
108
- if (isArray) {
109
- return obj.map((item) => this.formatToStore(item));
110
- }
111
- return Object.keys(obj).reduce((acumulator, key) => {
112
- const value = obj[key];
113
- const isDatetime = value instanceof Date;
114
- return (Object.assign(Object.assign({}, acumulator), { [key]: (0, exports.isPrimitive)(value) || isDatetime ? value : this.formatToStore(value), [`${key}_type`]: isDatetime ? 'date' : typeof value }));
115
- }, {});
116
- }
117
109
  asyncStorageGetItem() {
118
110
  return async_storage_1.default.getItem(this.persistStoreAs);
119
111
  }
@@ -125,11 +117,13 @@ class GlobalStore {
125
117
  return this.getAsyncStoreItemPromise;
126
118
  this.getAsyncStoreItemPromise = new Promise((resolve) => {
127
119
  (() => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
120
+ var _a;
128
121
  const item = yield this.asyncStorageGetItem();
129
122
  if (item) {
130
- const value = JSON.parse(item);
131
- const primitive = (0, exports.isPrimitive)(value);
132
- const newState = primitive || Array.isArray(value) ? value : this.formatItemFromStore(value);
123
+ let value = JSON.parse(item);
124
+ /** This allow users to review what is been stored */
125
+ value = (_a = this.onPersistStorageLoad(value)) !== null && _a !== void 0 ? _a : value;
126
+ const newState = (0, json_storage_formatter_1.formatFromStore)(value);
133
127
  yield this.globalSetterAsync(newState);
134
128
  }
135
129
  resolve(this.state);
@@ -148,7 +142,7 @@ class GlobalStore {
148
142
  if (this.storedStateItem === this.state)
149
143
  return;
150
144
  this.storedStateItem = this.state;
151
- const valueToStore = (0, exports.isPrimitive)(this.state) ? this.state : this.formatToStore((0, lodash_1.cloneDeep)(this.state));
145
+ const valueToStore = (0, json_storage_formatter_1.formatToStore)(this.state);
152
146
  yield this.asyncStorageSetItem(JSON.stringify(valueToStore));
153
147
  });
154
148
  }
@@ -176,7 +170,7 @@ GlobalStore.ExecutePendingBatchesCallbacks = [];
176
170
  /**
177
171
  * React native cannot use unstable_batchedUpdates, it does not have any effect
178
172
  */
179
- GlobalStore.ExecutePendingBatches = (0, lodash_1.debounce)(() => {
173
+ GlobalStore.ExecutePendingBatches = (0, exports.debounce)(() => {
180
174
  GlobalStore.batchedUpdates.forEach(([execute]) => {
181
175
  execute();
182
176
  });
@@ -36,17 +36,21 @@ export declare type IHookResult<IState, IActions extends IActionCollectionConfig
36
36
  * this will disable the default return of the state-setter of the hook, and instead will return the API
37
37
  * @param {string} persistStoreAs - A name if you want to persist the state of the store in localstorage
38
38
  * */
39
- export interface IGlobalState<IState, IPersist extends string | null = null, IsPersist extends boolean = IPersist extends null ? false : true, IActions extends IActionCollectionConfig<IState> | null = null> {
39
+ export interface IGlobalState<IState, IPersist extends string | null = null, IActions extends IActionCollectionConfig<IState> | null = null> {
40
40
  persistStoreAs: IPersist;
41
41
  isPersistStore: boolean;
42
42
  /**
43
+ * This function can be used to format the data after it is loaded from the asyncStorage
44
+ */
45
+ onPersistStorageLoad: (obj: unknown) => (IState | null);
46
+ /**
43
47
  * Returns a global hook that will share information across components by subscribing them to a specific store.
44
48
  * @return [currentState, GlobalState.IHookResult<IState, IActions, IApi>, initialStatePersistStorage | null, isUpdatedPersistStorage | null]
45
49
  */
46
50
  getHook: <IApi extends IActions extends IActionCollectionResult<IState, IActions> ? IActionCollectionResult<IState, IActions> : null>() => () => [
47
51
  IState,
48
52
  IHookResult<IState, IActions, IApi>,
49
- IsPersist extends true ? boolean : null
53
+ IPersist extends null ? false : true extends true ? boolean : null
50
54
  ];
51
55
  /**
52
56
  * This is an access to the subscribers queue and to the current state of a specific store...
@@ -57,10 +61,6 @@ export interface IGlobalState<IState, IPersist extends string | null = null, IsP
57
61
  () => IPersist extends string ? Promise<IState> : IState,
58
62
  IHookResult<IState, IActions, IApi>
59
63
  ];
60
- }
61
- /**
62
- * @deprecated This interface name is deprecated, use instead IGlobalState
63
- */
64
- export interface IGlobalStateFactory<IState, IPersist extends string | null = null, IsPersist extends boolean = IPersist extends null ? false : true, IActions extends IActionCollectionConfig<IState> | null = null> extends IGlobalState<IState, IPersist, IsPersist, IActions> {
64
+ deleteAsyncStoreItem: () => Promise<void>;
65
65
  }
66
66
  //# sourceMappingURL=GlobalStoreTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalStoreTypes.d.ts","sourceRoot":"","sources":["../src/GlobalStoreTypes.ts"],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AAM,CAAC,GACrB,WAAW,CAAC,MAAM,CAAC,CAAC;AAExB;;;;;;;;;;;;IAYI;AACJ,MAAM,WAAW,YAAY,CAC3B,MAAM,EACN,QAAQ,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,EACrC,QAAQ,SAAS,uBAAuB,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI;IAG9D,cAAc,EAAE,QAAQ,CAAC;IAEzB,cAAc,EAAE,OAAO,CAAC;IAExB;;MAEE;IACF,oBAAoB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAExD;;;MAGE;IACF,OAAO,EAAE,CAAC,IAAI,SAAS,QAAQ,SAAS,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO,MAAM;QAC/I,MAAM;QACN,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;QACnC,QAAQ,SAAS,IAAI,GAAG,KAAK,GAAG,IAAI,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI;KACnE,CAAC;IAEF;;;;MAIE;IACF,gBAAgB,EAAE,CAAC,IAAI,SAAS,QAAQ,SAAS,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,OAAO;QAClJ,MAAM,QAAQ,SAAS,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM;QACxD,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC;KACpC,CAAC;IAEF,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-global-state-hooks",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "This is a package to easily handling global-state across your react-native-components No-redux",
5
5
  "main": "lib/GlobalStore.js",
6
6
  "files": [
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "homepage": "https://github.com/johnny-quesada-developer/react-native-global-state-hooks#readme",
42
42
  "devDependencies": {
43
+ "@react-native-async-storage/async-storage": "workspace:*",
43
44
  "@types/jest": "^26.0.17",
44
45
  "@types/lodash": "^4.14.165",
45
46
  "@types/react": "^17.0.0",
@@ -54,13 +55,16 @@
54
55
  "eslint-plugin-react": "^7.21.5",
55
56
  "eslint-plugin-react-hooks": "^4.2.0",
56
57
  "jest": "^26.6.3",
58
+ "react": "workspace:*",
57
59
  "react-test-renderer": "^17.0.1",
58
60
  "ts-jest": "^26.4.4",
59
61
  "typescript": "^4.1.2"
60
62
  },
61
63
  "peerDependencies": {
62
64
  "@react-native-async-storage/async-storage": "workspace:*",
63
- "lodash": "workspace:*",
64
65
  "react": "workspace:*"
66
+ },
67
+ "dependencies": {
68
+ "json-storage-formatter": "^1.0.0"
65
69
  }
66
70
  }