@nlabs/arkhamjs-storage-native 3.26.1 → 3.28.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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://opensource.org/licenses/MIT)
9
9
  [![Chat](https://img.shields.io/discord/446122412715802649.svg)](https://discord.gg/Ttgev58)
10
10
 
11
- ### Installation
11
+ ## Installation
12
12
 
13
13
  Using [npm](https://www.npmjs.com/):
14
14
 
@@ -16,12 +16,6 @@ Using [npm](https://www.npmjs.com/):
16
16
  npm install --save @nlabs/arkhamjs-storage-native
17
17
  ```
18
18
 
19
- or
20
-
21
- ```shell
22
- yarn add @nlabs/arkhamjs-storage-native
23
- ```
24
-
25
- #### Documentation
19
+ ## Documentation
26
20
 
27
21
  For detailed [Documentation](https://arkhamjs.io) and additional options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlabs/arkhamjs-storage-native",
3
- "version": "3.26.1",
3
+ "version": "3.28.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,34 +31,33 @@
31
31
  "url": "https://github.com/nitrogenlabs/arkhamjs/issues"
32
32
  },
33
33
  "scripts": {
34
- "build": "lex compile -r",
34
+ "build": "lex compile --remove",
35
35
  "clean": "lex clean",
36
- "deploy": "lex build -r && s3-deploy './lib/static/**' --cwd './lib/static/' --region us-east-1 --bucket arkhamjs.io/versions --gzip",
36
+ "deploy": "lex build --remove && s3-deploy './lib/static/**' --cwd './lib/static/' --region us-east-1 --bucket arkhamjs.io/versions --gzip",
37
37
  "lint": "eslint ./src --ext .ts,.tsx",
38
38
  "prepublishOnly": "npm run build",
39
- "pretest": "npm run lint",
40
39
  "publish:major": "npm version major && npm publish",
41
40
  "publish:minor": "npm version minor && npm publish",
42
41
  "publish:patch": "npm version patch && npm publish",
43
- "test": "lex test -s ./jest.setup.js",
44
- "update": "lex update -i"
42
+ "pretest": "npm run lint",
43
+ "test": "lex test",
44
+ "update": "npm-check-updates --interactive"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@nlabs/arkhamjs": "^3.23",
48
48
  "react": "^18.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@nlabs/arkhamjs": "^3.25.0",
52
- "@types/jest": "^29.5.1",
53
- "@types/node": "^20.2.1",
54
- "@types/react-native": "^0.72.0",
55
- "eslint": "^8.40.0",
51
+ "@nlabs/arkhamjs": "^3.26.2",
52
+ "@types/jest": "^29.5.14",
53
+ "@types/node": "^22.13.1",
54
+ "eslint": "^9.19.0",
56
55
  "eslint-config-styleguidejs": "^3.2.1",
57
56
  "lodash": "^4.17.21",
58
- "typescript": "^5.0.4"
57
+ "typescript": "^5.7.3"
59
58
  },
60
59
  "gitHead": "fc371e1e28fe0ae35d40d29a217d5f0e990ec32a",
61
60
  "dependencies": {
62
- "@react-native-async-storage/async-storage": "^1.18.1"
61
+ "@react-native-async-storage/async-storage": "^2.1.1"
63
62
  }
64
63
  }
@@ -1,122 +0,0 @@
1
-
2
- const isObject = (obj) => typeof obj === 'object' && !Array.isArray(obj);
3
-
4
- const deepMergeInto = (oldObject, newObject) => {
5
- const newKeys = Object.keys(newObject);
6
- const mergedObject = oldObject;
7
-
8
- newKeys.forEach((key) => {
9
- const oldValue = mergedObject[key];
10
- const newValue = newObject[key];
11
-
12
- if(isObject(oldValue) && isObject(newValue)) {
13
- mergedObject[key] = deepMergeInto(oldValue, newValue);
14
- } else {
15
- mergedObject[key] = newValue;
16
- }
17
- });
18
-
19
- return mergedObject;
20
- };
21
-
22
- const mock = {
23
- clear: jest.fn(async (callback) => {
24
- mock.storage = {};
25
-
26
- if(callback) {
27
- callback(null);
28
- }
29
-
30
- return null;
31
- }),
32
- flushGetRequests: jest.fn(),
33
- getAllKeys: jest.fn(),
34
- getItem: jest.fn(
35
- async (key: string, callback) => {
36
- const getResult = await mock.multiGet([key], undefined);
37
-
38
- const result = getResult[0] ? getResult[0][1] : null;
39
-
40
-
41
- if(callback) {
42
- callback(null, result);
43
- }
44
-
45
- return result;
46
- },
47
- ),
48
- mergeItem: jest.fn(
49
- (key: string, value: string, callback) =>
50
- mock.multiMerge([[key, value]], callback),
51
- ),
52
- multiGet: jest.fn(async (keys: string[], callback) => {
53
- const values = keys.map((key) => [
54
- key,
55
- mock.storage[key] || null
56
- ]);
57
-
58
- if(callback) {
59
- callback(null, values);
60
- }
61
-
62
- return values;
63
- }),
64
- multiMerge: jest.fn(async (keyValuePairs: any[][], callback) => {
65
- keyValuePairs.forEach((keyValue) => {
66
- const key = keyValue[0];
67
- const value = JSON.parse(keyValue[1]);
68
- const oldValue = JSON.parse(mock.storage[key]);
69
- const processedValue = JSON.stringify(deepMergeInto(oldValue, value));
70
-
71
- mock.storage[key] = processedValue;
72
- });
73
-
74
- if(callback) {
75
- callback(null);
76
- }
77
-
78
- return null;
79
- }),
80
- multiRemove: jest.fn(async (keys: string[], callback) => {
81
- keys.forEach((key) => {
82
- if(mock.storage[key]) {
83
- delete mock.storage[key];
84
- }
85
- });
86
-
87
- if(callback) {
88
- callback(null);
89
- }
90
-
91
- return null;
92
- }),
93
- multiSet: jest.fn(async (keyValuePairs: any[][], callback) => {
94
- keyValuePairs.forEach((keyValue) => {
95
- const key = keyValue[0];
96
- const value = keyValue[1];
97
-
98
- mock.storage[key] = value;
99
- });
100
-
101
- if(callback) {
102
- callback(null);
103
- }
104
-
105
- return null;
106
- }),
107
- removeItem: jest.fn((key: string, callback) => mock.multiRemove([key], callback)),
108
- setItem: jest.fn(
109
- async (key: string, value: string, callback) => {
110
- const setResult = await mock.multiSet([[key, value]], undefined);
111
-
112
- if(callback) {
113
- callback(setResult);
114
- }
115
-
116
- return setResult;
117
- },
118
- ),
119
- storage: {}
120
- };
121
-
122
- export default mock;
package/jest.setup.js DELETED
@@ -1,3 +0,0 @@
1
- import mockAsyncStorage from './__mocks__/@react-native-community/asyncStorage';
2
-
3
- jest.mock('@react-native-community/async-storage', () => mockAsyncStorage);