@fto-consult/expo-ui 6.37.3 → 6.37.4
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/node_modules/.package-lock.json +26218 -26188
- package/node_modules/@react-native-async-storage/async-storage/LICENSE +21 -0
- package/node_modules/@react-native-async-storage/async-storage/README.md +27 -0
- package/node_modules/@react-native-async-storage/async-storage/RNCAsyncStorage.podspec +19 -0
- package/node_modules/@react-native-async-storage/async-storage/android/build.gradle +142 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/AndroidManifest.xml +6 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncLocalStorageUtil.java +178 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageErrorUtil.java +45 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageExpoMigration.java +154 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java +424 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java +58 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/ReactDatabaseSupplier.java +163 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/SerialExecutor.java +40 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpers.kt +86 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/ErrorHelpers.kt +39 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageModule.kt +90 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/next/StorageSupplier.kt +161 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/test/java/com/reactnativecommunity/asyncstorage/next/ArgumentHelpersTest.kt +93 -0
- package/node_modules/@react-native-async-storage/async-storage/android/src/test/java/com/reactnativecommunity/asyncstorage/next/StorageTest.kt +141 -0
- package/node_modules/@react-native-async-storage/async-storage/android/testresults.gradle +38 -0
- package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.h +51 -0
- package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.m +898 -0
- package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorage.xcodeproj/project.pbxproj +283 -0
- package/node_modules/@react-native-async-storage/async-storage/ios/RNCAsyncStorageDelegate.h +73 -0
- package/node_modules/@react-native-async-storage/async-storage/jest/async-storage-mock.d.ts +9 -0
- package/node_modules/@react-native-async-storage/async-storage/jest/async-storage-mock.js +109 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js +164 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.native.js +366 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.native.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js +30 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/helpers.js +69 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/helpers.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/hooks.js +44 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/hooks.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/index.js +22 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/index.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/shouldFallbackToLegacyNativeModule.js +39 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/shouldFallbackToLegacyNativeModule.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/types.js +2 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/types.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js +153 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.native.js +348 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.native.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/RCTAsyncStorage.js +20 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/RCTAsyncStorage.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/helpers.js +56 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/helpers.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/hooks.js +34 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/hooks.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/index.js +4 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/index.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/shouldFallbackToLegacyNativeModule.js +31 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/shouldFallbackToLegacyNativeModule.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/types.js +2 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/module/types.js.map +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/AsyncStorage.d.ts +10 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/AsyncStorage.native.d.ts +16 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/RCTAsyncStorage.d.ts +2 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/helpers.d.ts +5 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/hooks.d.ts +2 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/index.d.ts +4 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/shouldFallbackToLegacyNativeModule.d.ts +1 -0
- package/node_modules/@react-native-async-storage/async-storage/lib/typescript/types.d.ts +113 -0
- package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/project.pbxproj +385 -0
- package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/xcshareddata/xcschemes/RNCAsyncStorage-macOS.xcscheme +67 -0
- package/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/xcshareddata/xcschemes/RNCAsyncStorage.xcscheme +67 -0
- package/node_modules/@react-native-async-storage/async-storage/package.json +197 -0
- package/node_modules/@react-native-async-storage/async-storage/src/AsyncStorage.native.ts +356 -0
- package/node_modules/@react-native-async-storage/async-storage/src/AsyncStorage.ts +173 -0
- package/node_modules/@react-native-async-storage/async-storage/src/RCTAsyncStorage.ts +28 -0
- package/node_modules/@react-native-async-storage/async-storage/src/helpers.ts +74 -0
- package/node_modules/@react-native-async-storage/async-storage/src/hooks.ts +11 -0
- package/node_modules/@react-native-async-storage/async-storage/src/index.ts +7 -0
- package/node_modules/@react-native-async-storage/async-storage/src/shouldFallbackToLegacyNativeModule.ts +34 -0
- package/node_modules/@react-native-async-storage/async-storage/src/types.ts +155 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/PropertySheet.props +16 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/ReactNativeAsyncStorage.vcxproj +172 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/ReactNativeAsyncStorage.vcxproj.filters +34 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage/packages.config +4 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage.sln +172 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/PropertySheet.props +16 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/ReactNativeAsyncStorage61.vcxproj +157 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/ReactNativeAsyncStorage61.vcxproj.filters +34 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61/packages.config +4 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage61.sln +195 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/ReactNativeAsyncStorage62.sln +192 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/DBStorage.cpp +599 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/DBStorage.h +162 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/RNCAsyncStorage.h +118 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactNativeAsyncStorage.def +3 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.cpp +20 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.h +23 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.idl +7 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/pch.cpp +3 -0
- package/node_modules/@react-native-async-storage/async-storage/windows/code/pch.h +15 -0
- package/node_modules/merge-options/index.d.ts +2 -0
- package/node_modules/merge-options/index.js +171 -0
- package/node_modules/merge-options/index.mjs +8 -0
- package/node_modules/merge-options/license +21 -0
- package/node_modules/merge-options/node_modules/is-plain-obj/index.d.ts +29 -0
- package/node_modules/merge-options/node_modules/is-plain-obj/index.js +10 -0
- package/node_modules/merge-options/node_modules/is-plain-obj/license +9 -0
- package/node_modules/merge-options/node_modules/is-plain-obj/package.json +38 -0
- package/node_modules/merge-options/node_modules/is-plain-obj/readme.md +54 -0
- package/node_modules/merge-options/package.json +59 -0
- package/node_modules/merge-options/readme.md +130 -0
- package/package.json +131 -130
package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.native.js
ADDED
@@ -0,0 +1,366 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _helpers = require("./helpers");
|
9
|
+
|
10
|
+
var _RCTAsyncStorage = _interopRequireDefault(require("./RCTAsyncStorage"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
16
|
+
*
|
17
|
+
* This source code is licensed under the MIT license found in the
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
19
|
+
*/
|
20
|
+
if (!_RCTAsyncStorage.default) {
|
21
|
+
throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
|
22
|
+
|
23
|
+
To fix this issue try these steps:
|
24
|
+
|
25
|
+
• Rebuild and restart the app.
|
26
|
+
|
27
|
+
• Run the packager with \`--reset-cache\` flag.
|
28
|
+
|
29
|
+
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
|
30
|
+
|
31
|
+
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
|
32
|
+
|
33
|
+
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/async-storage/issues
|
34
|
+
`);
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value
|
38
|
+
* storage system that is global to the app. It should be used instead of
|
39
|
+
* LocalStorage.
|
40
|
+
*
|
41
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api
|
42
|
+
*/
|
43
|
+
|
44
|
+
|
45
|
+
const AsyncStorage = (() => {
|
46
|
+
let _getRequests = [];
|
47
|
+
let _getKeys = [];
|
48
|
+
let _immediate = null;
|
49
|
+
return {
|
50
|
+
/**
|
51
|
+
* Fetches an item for a `key` and invokes a callback upon completion.
|
52
|
+
*
|
53
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#getitem
|
54
|
+
*/
|
55
|
+
getItem: (key, callback) => {
|
56
|
+
return new Promise((resolve, reject) => {
|
57
|
+
(0, _helpers.checkValidInput)(key);
|
58
|
+
|
59
|
+
_RCTAsyncStorage.default.multiGet([key], (errors, result) => {
|
60
|
+
var _result$;
|
61
|
+
|
62
|
+
// Unpack result to get value from [[key,value]]
|
63
|
+
const value = result !== null && result !== void 0 && (_result$ = result[0]) !== null && _result$ !== void 0 && _result$[1] ? result[0][1] : null;
|
64
|
+
const errs = (0, _helpers.convertErrors)(errors);
|
65
|
+
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0], value);
|
66
|
+
|
67
|
+
if (errs) {
|
68
|
+
reject(errs[0]);
|
69
|
+
} else {
|
70
|
+
resolve(value);
|
71
|
+
}
|
72
|
+
});
|
73
|
+
});
|
74
|
+
},
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Sets the value for a `key` and invokes a callback upon completion.
|
78
|
+
*
|
79
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#setitem
|
80
|
+
*/
|
81
|
+
setItem: (key, value, callback) => {
|
82
|
+
return new Promise((resolve, reject) => {
|
83
|
+
(0, _helpers.checkValidInput)(key, value);
|
84
|
+
|
85
|
+
_RCTAsyncStorage.default.multiSet([[key, value]], errors => {
|
86
|
+
const errs = (0, _helpers.convertErrors)(errors);
|
87
|
+
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
|
88
|
+
|
89
|
+
if (errs) {
|
90
|
+
reject(errs[0]);
|
91
|
+
} else {
|
92
|
+
resolve();
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
},
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Removes an item for a `key` and invokes a callback upon completion.
|
100
|
+
*
|
101
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#removeitem
|
102
|
+
*/
|
103
|
+
removeItem: (key, callback) => {
|
104
|
+
return new Promise((resolve, reject) => {
|
105
|
+
(0, _helpers.checkValidInput)(key);
|
106
|
+
|
107
|
+
_RCTAsyncStorage.default.multiRemove([key], errors => {
|
108
|
+
const errs = (0, _helpers.convertErrors)(errors);
|
109
|
+
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
|
110
|
+
|
111
|
+
if (errs) {
|
112
|
+
reject(errs[0]);
|
113
|
+
} else {
|
114
|
+
resolve();
|
115
|
+
}
|
116
|
+
});
|
117
|
+
});
|
118
|
+
},
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Merges an existing `key` value with an input value, assuming both values
|
122
|
+
* are stringified JSON.
|
123
|
+
*
|
124
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#mergeitem
|
125
|
+
*/
|
126
|
+
mergeItem: (key, value, callback) => {
|
127
|
+
return new Promise((resolve, reject) => {
|
128
|
+
(0, _helpers.checkValidInput)(key, value);
|
129
|
+
|
130
|
+
_RCTAsyncStorage.default.multiMerge([[key, value]], errors => {
|
131
|
+
const errs = (0, _helpers.convertErrors)(errors);
|
132
|
+
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
|
133
|
+
|
134
|
+
if (errs) {
|
135
|
+
reject(errs[0]);
|
136
|
+
} else {
|
137
|
+
resolve();
|
138
|
+
}
|
139
|
+
});
|
140
|
+
});
|
141
|
+
},
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably
|
145
|
+
* don't want to call this; use `removeItem` or `multiRemove` to clear only
|
146
|
+
* your app's keys.
|
147
|
+
*
|
148
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#clear
|
149
|
+
*/
|
150
|
+
clear: callback => {
|
151
|
+
return new Promise((resolve, reject) => {
|
152
|
+
_RCTAsyncStorage.default.clear(error => {
|
153
|
+
const err = (0, _helpers.convertError)(error);
|
154
|
+
callback === null || callback === void 0 ? void 0 : callback(err);
|
155
|
+
|
156
|
+
if (err) {
|
157
|
+
reject(err);
|
158
|
+
} else {
|
159
|
+
resolve();
|
160
|
+
}
|
161
|
+
});
|
162
|
+
});
|
163
|
+
},
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Gets *all* keys known to your app; for all callers, libraries, etc.
|
167
|
+
*
|
168
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#getallkeys
|
169
|
+
*/
|
170
|
+
getAllKeys: callback => {
|
171
|
+
return new Promise((resolve, reject) => {
|
172
|
+
_RCTAsyncStorage.default.getAllKeys((error, keys) => {
|
173
|
+
const err = (0, _helpers.convertError)(error);
|
174
|
+
callback === null || callback === void 0 ? void 0 : callback(err, keys);
|
175
|
+
|
176
|
+
if (keys) {
|
177
|
+
resolve(keys);
|
178
|
+
} else {
|
179
|
+
reject(err);
|
180
|
+
}
|
181
|
+
});
|
182
|
+
});
|
183
|
+
},
|
184
|
+
|
185
|
+
/**
|
186
|
+
* The following batched functions are useful for executing a lot of
|
187
|
+
* operations at once, allowing for native optimizations and provide the
|
188
|
+
* convenience of a single callback after all operations are complete.
|
189
|
+
*
|
190
|
+
* These functions return arrays of errors, potentially one for every key.
|
191
|
+
* For key-specific errors, the Error object will have a key property to
|
192
|
+
* indicate which key caused the error.
|
193
|
+
*/
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Flushes any pending requests using a single batch call to get the data.
|
197
|
+
*
|
198
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#flushgetrequests
|
199
|
+
* */
|
200
|
+
flushGetRequests: () => {
|
201
|
+
const getRequests = _getRequests;
|
202
|
+
const getKeys = _getKeys;
|
203
|
+
_getRequests = [];
|
204
|
+
_getKeys = [];
|
205
|
+
|
206
|
+
_RCTAsyncStorage.default.multiGet(getKeys, (errors, result) => {
|
207
|
+
// Even though the runtime complexity of this is theoretically worse vs if we used a map,
|
208
|
+
// it's much, much faster in practice for the data sets we deal with (we avoid
|
209
|
+
// allocating result pair arrays). This was heavily benchmarked.
|
210
|
+
//
|
211
|
+
// Is there a way to avoid using the map but fix the bug in this breaking test?
|
212
|
+
// https://github.com/facebook/react-native/commit/8dd8ad76579d7feef34c014d387bf02065692264
|
213
|
+
const map = {};
|
214
|
+
result === null || result === void 0 ? void 0 : result.forEach(_ref => {
|
215
|
+
let [key, value] = _ref;
|
216
|
+
map[key] = value;
|
217
|
+
return value;
|
218
|
+
});
|
219
|
+
const reqLength = getRequests.length;
|
220
|
+
/**
|
221
|
+
* As mentioned few lines above, this method could be called with the array of potential error,
|
222
|
+
* in case of anything goes wrong. The problem is, if any of the batched calls fails
|
223
|
+
* the rest of them would fail too, but the error would be consumed by just one. The rest
|
224
|
+
* would simply return `undefined` as their result, rendering false negatives.
|
225
|
+
*
|
226
|
+
* In order to avoid this situation, in case of any call failing,
|
227
|
+
* the rest of them will be rejected as well (with the same error).
|
228
|
+
*/
|
229
|
+
|
230
|
+
const errorList = (0, _helpers.convertErrors)(errors);
|
231
|
+
const error = errorList !== null && errorList !== void 0 && errorList.length ? errorList[0] : null;
|
232
|
+
|
233
|
+
for (let i = 0; i < reqLength; i++) {
|
234
|
+
var _request$callback2, _request$resolve;
|
235
|
+
|
236
|
+
const request = getRequests[i];
|
237
|
+
|
238
|
+
if (error) {
|
239
|
+
var _request$callback, _request$reject;
|
240
|
+
|
241
|
+
(_request$callback = request.callback) === null || _request$callback === void 0 ? void 0 : _request$callback.call(request, errorList);
|
242
|
+
(_request$reject = request.reject) === null || _request$reject === void 0 ? void 0 : _request$reject.call(request, error);
|
243
|
+
continue;
|
244
|
+
}
|
245
|
+
|
246
|
+
const requestResult = request.keys.map(key => [key, map[key]]);
|
247
|
+
(_request$callback2 = request.callback) === null || _request$callback2 === void 0 ? void 0 : _request$callback2.call(request, null, requestResult);
|
248
|
+
(_request$resolve = request.resolve) === null || _request$resolve === void 0 ? void 0 : _request$resolve.call(request, requestResult);
|
249
|
+
}
|
250
|
+
});
|
251
|
+
},
|
252
|
+
|
253
|
+
/**
|
254
|
+
* This allows you to batch the fetching of items given an array of `key`
|
255
|
+
* inputs. Your callback will be invoked with an array of corresponding
|
256
|
+
* key-value pairs found.
|
257
|
+
*
|
258
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#multiget
|
259
|
+
*/
|
260
|
+
multiGet: (keys, callback) => {
|
261
|
+
if (!_immediate) {
|
262
|
+
_immediate = setImmediate(() => {
|
263
|
+
_immediate = null;
|
264
|
+
AsyncStorage.flushGetRequests();
|
265
|
+
});
|
266
|
+
}
|
267
|
+
|
268
|
+
const getRequest = {
|
269
|
+
keys: keys,
|
270
|
+
callback: callback,
|
271
|
+
// do we need this?
|
272
|
+
keyIndex: _getKeys.length,
|
273
|
+
resolve: null,
|
274
|
+
reject: null
|
275
|
+
};
|
276
|
+
const promiseResult = new Promise((resolve, reject) => {
|
277
|
+
getRequest.resolve = resolve;
|
278
|
+
getRequest.reject = reject;
|
279
|
+
});
|
280
|
+
|
281
|
+
_getRequests.push(getRequest); // avoid fetching duplicates
|
282
|
+
|
283
|
+
|
284
|
+
keys.forEach(key => {
|
285
|
+
if (_getKeys.indexOf(key) === -1) {
|
286
|
+
_getKeys.push(key);
|
287
|
+
}
|
288
|
+
});
|
289
|
+
return promiseResult;
|
290
|
+
},
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Use this as a batch operation for storing multiple key-value pairs. When
|
294
|
+
* the operation completes you'll get a single callback with any errors.
|
295
|
+
*
|
296
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#multiset
|
297
|
+
*/
|
298
|
+
multiSet: (keyValuePairs, callback) => {
|
299
|
+
(0, _helpers.checkValidArgs)(keyValuePairs, callback);
|
300
|
+
return new Promise((resolve, reject) => {
|
301
|
+
keyValuePairs.forEach(_ref2 => {
|
302
|
+
let [key, value] = _ref2;
|
303
|
+
(0, _helpers.checkValidInput)(key, value);
|
304
|
+
});
|
305
|
+
|
306
|
+
_RCTAsyncStorage.default.multiSet(keyValuePairs, errors => {
|
307
|
+
const error = (0, _helpers.convertErrors)(errors);
|
308
|
+
callback === null || callback === void 0 ? void 0 : callback(error);
|
309
|
+
|
310
|
+
if (error) {
|
311
|
+
reject(error);
|
312
|
+
} else {
|
313
|
+
resolve();
|
314
|
+
}
|
315
|
+
});
|
316
|
+
});
|
317
|
+
},
|
318
|
+
|
319
|
+
/**
|
320
|
+
* Call this to batch the deletion of all keys in the `keys` array.
|
321
|
+
*
|
322
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#multiremove
|
323
|
+
*/
|
324
|
+
multiRemove: (keys, callback) => {
|
325
|
+
return new Promise((resolve, reject) => {
|
326
|
+
keys.forEach(key => (0, _helpers.checkValidInput)(key));
|
327
|
+
|
328
|
+
_RCTAsyncStorage.default.multiRemove(keys, errors => {
|
329
|
+
const error = (0, _helpers.convertErrors)(errors);
|
330
|
+
callback === null || callback === void 0 ? void 0 : callback(error);
|
331
|
+
|
332
|
+
if (error) {
|
333
|
+
reject(error);
|
334
|
+
} else {
|
335
|
+
resolve();
|
336
|
+
}
|
337
|
+
});
|
338
|
+
});
|
339
|
+
},
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Batch operation to merge in existing and new values for a given set of
|
343
|
+
* keys. This assumes that the values are stringified JSON.
|
344
|
+
*
|
345
|
+
* See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge
|
346
|
+
*/
|
347
|
+
multiMerge: (keyValuePairs, callback) => {
|
348
|
+
return new Promise((resolve, reject) => {
|
349
|
+
_RCTAsyncStorage.default.multiMerge(keyValuePairs, errors => {
|
350
|
+
const error = (0, _helpers.convertErrors)(errors);
|
351
|
+
callback === null || callback === void 0 ? void 0 : callback(error);
|
352
|
+
|
353
|
+
if (error) {
|
354
|
+
reject(error);
|
355
|
+
} else {
|
356
|
+
resolve();
|
357
|
+
}
|
358
|
+
});
|
359
|
+
});
|
360
|
+
}
|
361
|
+
};
|
362
|
+
})();
|
363
|
+
|
364
|
+
var _default = AsyncStorage;
|
365
|
+
exports.default = _default;
|
366
|
+
//# sourceMappingURL=AsyncStorage.native.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["RCTAsyncStorage","Error","AsyncStorage","_getRequests","_getKeys","_immediate","getItem","key","callback","Promise","resolve","reject","checkValidInput","multiGet","errors","result","value","errs","convertErrors","setItem","multiSet","removeItem","multiRemove","mergeItem","multiMerge","clear","error","err","convertError","getAllKeys","keys","flushGetRequests","getRequests","getKeys","map","forEach","reqLength","length","errorList","i","request","requestResult","setImmediate","getRequest","keyIndex","promiseResult","push","indexOf","keyValuePairs","checkValidArgs"],"sources":["AsyncStorage.native.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n checkValidArgs,\n checkValidInput,\n convertError,\n convertErrors,\n} from './helpers';\nimport RCTAsyncStorage from './RCTAsyncStorage';\nimport type {\n AsyncStorageStatic,\n ErrorLike,\n KeyValuePair,\n MultiRequest,\n} from './types';\n\nif (!RCTAsyncStorage) {\n throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.\n\nTo fix this issue try these steps:\n\n • Rebuild and restart the app.\n\n • Run the packager with \\`--reset-cache\\` flag.\n\n • If you are using CocoaPods on iOS, run \\`pod install\\` in the \\`ios\\` directory and then rebuild and re-run the app.\n\n • If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest\n\nIf none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-async-storage/async-storage/issues\n`);\n}\n\n/**\n * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value\n * storage system that is global to the app. It should be used instead of\n * LocalStorage.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api\n */\nconst AsyncStorage = ((): AsyncStorageStatic => {\n let _getRequests: MultiRequest[] = [];\n let _getKeys: string[] = [];\n let _immediate: ReturnType<typeof setImmediate> | null = null;\n\n return {\n /**\n * Fetches an item for a `key` and invokes a callback upon completion.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#getitem\n */\n getItem: (key, callback) => {\n return new Promise((resolve, reject) => {\n checkValidInput(key);\n RCTAsyncStorage.multiGet(\n [key],\n (errors?: ErrorLike[], result?: string[][]) => {\n // Unpack result to get value from [[key,value]]\n const value = result?.[0]?.[1] ? result[0][1] : null;\n const errs = convertErrors(errors);\n callback?.(errs?.[0], value);\n if (errs) {\n reject(errs[0]);\n } else {\n resolve(value);\n }\n }\n );\n });\n },\n\n /**\n * Sets the value for a `key` and invokes a callback upon completion.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#setitem\n */\n setItem: (key, value, callback) => {\n return new Promise((resolve, reject) => {\n checkValidInput(key, value);\n RCTAsyncStorage.multiSet([[key, value]], (errors?: ErrorLike[]) => {\n const errs = convertErrors(errors);\n callback?.(errs?.[0]);\n if (errs) {\n reject(errs[0]);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Removes an item for a `key` and invokes a callback upon completion.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#removeitem\n */\n removeItem: (key, callback) => {\n return new Promise((resolve, reject) => {\n checkValidInput(key);\n RCTAsyncStorage.multiRemove([key], (errors?: ErrorLike[]) => {\n const errs = convertErrors(errors);\n callback?.(errs?.[0]);\n if (errs) {\n reject(errs[0]);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Merges an existing `key` value with an input value, assuming both values\n * are stringified JSON.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#mergeitem\n */\n mergeItem: (key, value, callback) => {\n return new Promise((resolve, reject) => {\n checkValidInput(key, value);\n RCTAsyncStorage.multiMerge([[key, value]], (errors?: ErrorLike[]) => {\n const errs = convertErrors(errors);\n callback?.(errs?.[0]);\n if (errs) {\n reject(errs[0]);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably\n * don't want to call this; use `removeItem` or `multiRemove` to clear only\n * your app's keys.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#clear\n */\n clear: (callback) => {\n return new Promise((resolve, reject) => {\n RCTAsyncStorage.clear((error?: ErrorLike) => {\n const err = convertError(error);\n callback?.(err);\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Gets *all* keys known to your app; for all callers, libraries, etc.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#getallkeys\n */\n getAllKeys: (callback) => {\n return new Promise((resolve, reject) => {\n RCTAsyncStorage.getAllKeys((error?: ErrorLike, keys?: string[]) => {\n const err = convertError(error);\n callback?.(err, keys);\n if (keys) {\n resolve(keys);\n } else {\n reject(err);\n }\n });\n });\n },\n\n /**\n * The following batched functions are useful for executing a lot of\n * operations at once, allowing for native optimizations and provide the\n * convenience of a single callback after all operations are complete.\n *\n * These functions return arrays of errors, potentially one for every key.\n * For key-specific errors, the Error object will have a key property to\n * indicate which key caused the error.\n */\n\n /**\n * Flushes any pending requests using a single batch call to get the data.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#flushgetrequests\n * */\n flushGetRequests: () => {\n const getRequests = _getRequests;\n const getKeys = _getKeys;\n\n _getRequests = [];\n _getKeys = [];\n\n RCTAsyncStorage.multiGet(\n getKeys,\n (errors?: ErrorLike[], result?: string[][]) => {\n // Even though the runtime complexity of this is theoretically worse vs if we used a map,\n // it's much, much faster in practice for the data sets we deal with (we avoid\n // allocating result pair arrays). This was heavily benchmarked.\n //\n // Is there a way to avoid using the map but fix the bug in this breaking test?\n // https://github.com/facebook/react-native/commit/8dd8ad76579d7feef34c014d387bf02065692264\n const map: Record<string, string> = {};\n result?.forEach(([key, value]) => {\n map[key] = value;\n return value;\n });\n const reqLength = getRequests.length;\n\n /**\n * As mentioned few lines above, this method could be called with the array of potential error,\n * in case of anything goes wrong. The problem is, if any of the batched calls fails\n * the rest of them would fail too, but the error would be consumed by just one. The rest\n * would simply return `undefined` as their result, rendering false negatives.\n *\n * In order to avoid this situation, in case of any call failing,\n * the rest of them will be rejected as well (with the same error).\n */\n const errorList = convertErrors(errors);\n const error = errorList?.length ? errorList[0] : null;\n\n for (let i = 0; i < reqLength; i++) {\n const request = getRequests[i];\n if (error) {\n request.callback?.(errorList);\n request.reject?.(error);\n continue;\n }\n const requestResult = request.keys.map<KeyValuePair>((key) => [\n key,\n map[key],\n ]);\n request.callback?.(null, requestResult);\n request.resolve?.(requestResult);\n }\n }\n );\n },\n\n /**\n * This allows you to batch the fetching of items given an array of `key`\n * inputs. Your callback will be invoked with an array of corresponding\n * key-value pairs found.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#multiget\n */\n multiGet: (keys, callback) => {\n if (!_immediate) {\n _immediate = setImmediate(() => {\n _immediate = null;\n AsyncStorage.flushGetRequests();\n });\n }\n\n const getRequest: MultiRequest = {\n keys: keys,\n callback: callback,\n // do we need this?\n keyIndex: _getKeys.length,\n resolve: null as any,\n reject: null as any,\n };\n\n const promiseResult = new Promise<readonly KeyValuePair[]>(\n (resolve, reject) => {\n getRequest.resolve = resolve;\n getRequest.reject = reject;\n }\n );\n\n _getRequests.push(getRequest);\n // avoid fetching duplicates\n keys.forEach((key) => {\n if (_getKeys.indexOf(key) === -1) {\n _getKeys.push(key);\n }\n });\n\n return promiseResult;\n },\n\n /**\n * Use this as a batch operation for storing multiple key-value pairs. When\n * the operation completes you'll get a single callback with any errors.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#multiset\n */\n multiSet: (keyValuePairs, callback) => {\n checkValidArgs(keyValuePairs, callback);\n return new Promise((resolve, reject) => {\n keyValuePairs.forEach(([key, value]) => {\n checkValidInput(key, value);\n });\n\n RCTAsyncStorage.multiSet(keyValuePairs, (errors?: ErrorLike[]) => {\n const error = convertErrors(errors);\n callback?.(error);\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Call this to batch the deletion of all keys in the `keys` array.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#multiremove\n */\n multiRemove: (keys, callback) => {\n return new Promise((resolve, reject) => {\n keys.forEach((key) => checkValidInput(key));\n\n RCTAsyncStorage.multiRemove(keys, (errors?: ErrorLike[]) => {\n const error = convertErrors(errors);\n callback?.(error);\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n },\n\n /**\n * Batch operation to merge in existing and new values for a given set of\n * keys. This assumes that the values are stringified JSON.\n *\n * See https://react-native-async-storage.github.io/async-storage/docs/api#multimerge\n */\n multiMerge: (keyValuePairs, callback) => {\n return new Promise((resolve, reject) => {\n RCTAsyncStorage.multiMerge(keyValuePairs, (errors?: ErrorLike[]) => {\n const error = convertErrors(errors);\n callback?.(error);\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n },\n };\n})();\n\nexport default AsyncStorage;\n"],"mappings":";;;;;;;AAOA;;AAMA;;;;AAbA;AACA;AACA;AACA;AACA;AACA;AAgBA,IAAI,CAACA,wBAAL,EAAsB;EACpB,MAAM,IAAIC,KAAJ,CAAW;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAbQ,CAAN;AAcD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,YAAY,GAAG,CAAC,MAA0B;EAC9C,IAAIC,YAA4B,GAAG,EAAnC;EACA,IAAIC,QAAkB,GAAG,EAAzB;EACA,IAAIC,UAAkD,GAAG,IAAzD;EAEA,OAAO;IACL;AACJ;AACA;AACA;AACA;IACIC,OAAO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,KAA6B;MACvC,OAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAUC,MAAV,KAAqB;QACtCX,wBAAA,CAAgBwB,UAAhB,CAA2BwB,aAA3B,EAA2ClC,MAAD,IAA0B;UAClE,MAAMY,KAAK,GAAG,IAAAR,sBAAA,EAAcJ,MAAd,CAAd;UACAN,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGkB,KAAH,CAAR;;UACA,IAAIA,KAAJ,EAAW;YACTf,MAAM,CAACe,KAAD,CAAN;UACD,CAFD,MAEO;YACLhB,OAAO;UACR;QACF,CARD;MASD,CAVM,CAAP;IAWD;EA7SI,CAAP;AA+SD,CApToB,GAArB;;eAsTeR,Y"}
|
package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
|
10
|
+
var _shouldFallbackToLegacyNativeModule = require("./shouldFallbackToLegacyNativeModule");
|
11
|
+
|
12
|
+
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
|
13
|
+
// TurboModuleRegistry falls back to NativeModules so we don't have to try go
|
14
|
+
// assign NativeModules' counterparts if TurboModuleRegistry would resolve
|
15
|
+
// with undefined.
|
16
|
+
let RCTAsyncStorage = _reactNative.TurboModuleRegistry ? _reactNative.TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows
|
17
|
+
_reactNative.TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('RNCAsyncStorage') : _reactNative.NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows
|
18
|
+
_reactNative.NativeModules['RNC_AsyncSQLiteDBStorage'] || _reactNative.NativeModules['RNCAsyncStorage'];
|
19
|
+
|
20
|
+
if (!RCTAsyncStorage && (0, _shouldFallbackToLegacyNativeModule.shouldFallbackToLegacyNativeModule)()) {
|
21
|
+
if (_reactNative.TurboModuleRegistry) {
|
22
|
+
RCTAsyncStorage = _reactNative.TurboModuleRegistry.get('AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('AsyncLocalStorage');
|
23
|
+
} else {
|
24
|
+
RCTAsyncStorage = _reactNative.NativeModules['AsyncSQLiteDBStorage'] || _reactNative.NativeModules['AsyncLocalStorage'];
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
var _default = RCTAsyncStorage;
|
29
|
+
exports.default = _default;
|
30
|
+
//# sourceMappingURL=RCTAsyncStorage.js.map
|
package/node_modules/@react-native-async-storage/async-storage/lib/commonjs/RCTAsyncStorage.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["RCTAsyncStorage","TurboModuleRegistry","get","NativeModules","shouldFallbackToLegacyNativeModule"],"sources":["RCTAsyncStorage.ts"],"sourcesContent":["// @ts-ignore Module '\"react-native\"' has no exported member 'TurboModuleRegistry'.\nimport { NativeModules, TurboModuleRegistry } from 'react-native';\nimport { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule';\n\n// TurboModuleRegistry falls back to NativeModules so we don't have to try go\n// assign NativeModules' counterparts if TurboModuleRegistry would resolve\n// with undefined.\nlet RCTAsyncStorage = TurboModuleRegistry\n ? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows\n TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') ||\n TurboModuleRegistry.get('RNCAsyncStorage')\n : NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows\n NativeModules['RNC_AsyncSQLiteDBStorage'] ||\n NativeModules['RNCAsyncStorage'];\n\nif (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) {\n if (TurboModuleRegistry) {\n RCTAsyncStorage =\n TurboModuleRegistry.get('AsyncSQLiteDBStorage') ||\n TurboModuleRegistry.get('AsyncLocalStorage');\n } else {\n RCTAsyncStorage =\n NativeModules['AsyncSQLiteDBStorage'] ||\n NativeModules['AsyncLocalStorage'];\n }\n}\n\nexport default RCTAsyncStorage;\n"],"mappings":";;;;;;;AACA;;AACA;;AAFA;AAIA;AACA;AACA;AACA,IAAIA,eAAe,GAAGC,gCAAA,GAClBA,gCAAA,CAAoBC,GAApB,CAAwB,sBAAxB,KAAmD;AACnDD,gCAAA,CAAoBC,GAApB,CAAwB,0BAAxB,CADA,IAEAD,gCAAA,CAAoBC,GAApB,CAAwB,iBAAxB,CAHkB,GAIlBC,0BAAA,CAAc,sBAAd,KAAyC;AACzCA,0BAAA,CAAc,0BAAd,CADA,IAEAA,0BAAA,CAAc,iBAAd,CANJ;;AAQA,IAAI,CAACH,eAAD,IAAoB,IAAAI,sEAAA,GAAxB,EAA8D;EAC5D,IAAIH,gCAAJ,EAAyB;IACvBD,eAAe,GACbC,gCAAA,CAAoBC,GAApB,CAAwB,sBAAxB,KACAD,gCAAA,CAAoBC,GAApB,CAAwB,mBAAxB,CAFF;EAGD,CAJD,MAIO;IACLF,eAAe,GACbG,0BAAA,CAAc,sBAAd,KACAA,0BAAA,CAAc,mBAAd,CAFF;EAGD;AACF;;eAEcH,e"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.checkValidArgs = checkValidArgs;
|
7
|
+
exports.checkValidInput = checkValidInput;
|
8
|
+
exports.convertError = convertError;
|
9
|
+
exports.convertErrors = convertErrors;
|
10
|
+
|
11
|
+
function checkValidArgs(keyValuePairs, callback) {
|
12
|
+
if (!Array.isArray(keyValuePairs) || keyValuePairs.length === 0 || !Array.isArray(keyValuePairs[0])) {
|
13
|
+
throw new Error('[AsyncStorage] Expected array of key-value pairs as first argument to multiSet');
|
14
|
+
}
|
15
|
+
|
16
|
+
if (callback && typeof callback !== 'function') {
|
17
|
+
if (Array.isArray(callback)) {
|
18
|
+
throw new Error('[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?');
|
19
|
+
}
|
20
|
+
|
21
|
+
throw new Error('[AsyncStorage] Expected function as second argument to multiSet');
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
function checkValidInput() {
|
26
|
+
for (var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++) {
|
27
|
+
input[_key] = arguments[_key];
|
28
|
+
}
|
29
|
+
|
30
|
+
const [key, value] = input;
|
31
|
+
|
32
|
+
if (typeof key !== 'string') {
|
33
|
+
console.warn(`[AsyncStorage] Using ${typeof key} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\nKey passed: ${key}\n`);
|
34
|
+
}
|
35
|
+
|
36
|
+
if (input.length > 1 && typeof value !== 'string') {
|
37
|
+
if (value == null) {
|
38
|
+
throw new Error(`[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .removeItem method instead.\nPassed value: ${value}\nPassed key: ${key}\n`);
|
39
|
+
} else {
|
40
|
+
console.warn(`[AsyncStorage] The value for key "${key}" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\nPassed value: ${value}\nPassed key: ${key}\n`);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
function convertError(error) {
|
46
|
+
if (!error) {
|
47
|
+
return null;
|
48
|
+
}
|
49
|
+
|
50
|
+
const out = new Error(error.message);
|
51
|
+
out.key = error.key;
|
52
|
+
return out;
|
53
|
+
}
|
54
|
+
|
55
|
+
function convertErrors(errs) {
|
56
|
+
const errors = ensureArray(errs);
|
57
|
+
return errors ? errors.map(e => convertError(e)) : null;
|
58
|
+
}
|
59
|
+
|
60
|
+
function ensureArray(e) {
|
61
|
+
if (Array.isArray(e)) {
|
62
|
+
return e.length === 0 ? null : e;
|
63
|
+
} else if (e) {
|
64
|
+
return [e];
|
65
|
+
} else {
|
66
|
+
return null;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["checkValidArgs","keyValuePairs","callback","Array","isArray","length","Error","checkValidInput","input","key","value","console","warn","convertError","error","out","message","convertErrors","errs","errors","ensureArray","map","e"],"sources":["helpers.ts"],"sourcesContent":["import type { ErrorLike } from './types';\n\nexport function checkValidArgs(keyValuePairs: unknown[], callback: unknown) {\n if (\n !Array.isArray(keyValuePairs) ||\n keyValuePairs.length === 0 ||\n !Array.isArray(keyValuePairs[0])\n ) {\n throw new Error(\n '[AsyncStorage] Expected array of key-value pairs as first argument to multiSet'\n );\n }\n\n if (callback && typeof callback !== 'function') {\n if (Array.isArray(callback)) {\n throw new Error(\n '[AsyncStorage] Expected function as second argument to multiSet. Did you forget to wrap key-value pairs in an array for the first argument?'\n );\n }\n\n throw new Error(\n '[AsyncStorage] Expected function as second argument to multiSet'\n );\n }\n}\n\nexport function checkValidInput(...input: unknown[]) {\n const [key, value] = input;\n\n if (typeof key !== 'string') {\n console.warn(\n `[AsyncStorage] Using ${typeof key} type for key is not supported. This can lead to unexpected behavior/errors. Use string instead.\\nKey passed: ${key}\\n`\n );\n }\n\n if (input.length > 1 && typeof value !== 'string') {\n if (value == null) {\n throw new Error(\n `[AsyncStorage] Passing null/undefined as value is not supported. If you want to remove value, Use .removeItem method instead.\\nPassed value: ${value}\\nPassed key: ${key}\\n`\n );\n } else {\n console.warn(\n `[AsyncStorage] The value for key \"${key}\" is not a string. This can lead to unexpected behavior/errors. Consider stringifying it.\\nPassed value: ${value}\\nPassed key: ${key}\\n`\n );\n }\n }\n}\n\nexport function convertError(error?: ErrorLike): Error | null {\n if (!error) {\n return null;\n }\n\n const out = new Error(error.message);\n (out as any).key = error.key;\n return out;\n}\n\nexport function convertErrors(\n errs?: ErrorLike[]\n): ReadonlyArray<Error | null> | null {\n const errors = ensureArray(errs);\n return errors ? errors.map((e) => convertError(e)) : null;\n}\n\nfunction ensureArray(e?: ErrorLike | ErrorLike[]): ErrorLike[] | null {\n if (Array.isArray(e)) {\n return e.length === 0 ? null : e;\n } else if (e) {\n return [e];\n } else {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;AAEO,SAASA,cAAT,CAAwBC,aAAxB,EAAkDC,QAAlD,EAAqE;EAC1E,IACE,CAACC,KAAK,CAACC,OAAN,CAAcH,aAAd,CAAD,IACAA,aAAa,CAACI,MAAd,KAAyB,CADzB,IAEA,CAACF,KAAK,CAACC,OAAN,CAAcH,aAAa,CAAC,CAAD,CAA3B,CAHH,EAIE;IACA,MAAM,IAAIK,KAAJ,CACJ,gFADI,CAAN;EAGD;;EAED,IAAIJ,QAAQ,IAAI,OAAOA,QAAP,KAAoB,UAApC,EAAgD;IAC9C,IAAIC,KAAK,CAACC,OAAN,CAAcF,QAAd,CAAJ,EAA6B;MAC3B,MAAM,IAAII,KAAJ,CACJ,6IADI,CAAN;IAGD;;IAED,MAAM,IAAIA,KAAJ,CACJ,iEADI,CAAN;EAGD;AACF;;AAEM,SAASC,eAAT,GAA8C;EAAA,kCAAlBC,KAAkB;IAAlBA,KAAkB;EAAA;;EACnD,MAAM,CAACC,GAAD,EAAMC,KAAN,IAAeF,KAArB;;EAEA,IAAI,OAAOC,GAAP,KAAe,QAAnB,EAA6B;IAC3BE,OAAO,CAACC,IAAR,CACG,wBAAuB,OAAOH,GAAI,iHAAgHA,GAAI,IADzJ;EAGD;;EAED,IAAID,KAAK,CAACH,MAAN,GAAe,CAAf,IAAoB,OAAOK,KAAP,KAAiB,QAAzC,EAAmD;IACjD,IAAIA,KAAK,IAAI,IAAb,EAAmB;MACjB,MAAM,IAAIJ,KAAJ,CACH,gJAA+II,KAAM,iBAAgBD,GAAI,IADtK,CAAN;IAGD,CAJD,MAIO;MACLE,OAAO,CAACC,IAAR,CACG,qCAAoCH,GAAI,4GAA2GC,KAAM,iBAAgBD,GAAI,IADhL;IAGD;EACF;AACF;;AAEM,SAASI,YAAT,CAAsBC,KAAtB,EAAuD;EAC5D,IAAI,CAACA,KAAL,EAAY;IACV,OAAO,IAAP;EACD;;EAED,MAAMC,GAAG,GAAG,IAAIT,KAAJ,CAAUQ,KAAK,CAACE,OAAhB,CAAZ;EACCD,GAAD,CAAaN,GAAb,GAAmBK,KAAK,CAACL,GAAzB;EACA,OAAOM,GAAP;AACD;;AAEM,SAASE,aAAT,CACLC,IADK,EAE+B;EACpC,MAAMC,MAAM,GAAGC,WAAW,CAACF,IAAD,CAA1B;EACA,OAAOC,MAAM,GAAGA,MAAM,CAACE,GAAP,CAAYC,CAAD,IAAOT,YAAY,CAACS,CAAD,CAA9B,CAAH,GAAwC,IAArD;AACD;;AAED,SAASF,WAAT,CAAqBE,CAArB,EAAsE;EACpE,IAAInB,KAAK,CAACC,OAAN,CAAckB,CAAd,CAAJ,EAAsB;IACpB,OAAOA,CAAC,CAACjB,MAAF,KAAa,CAAb,GAAiB,IAAjB,GAAwBiB,CAA/B;EACD,CAFD,MAEO,IAAIA,CAAJ,EAAO;IACZ,OAAO,CAACA,CAAD,CAAP;EACD,CAFM,MAEA;IACL,OAAO,IAAP;EACD;AACF"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useAsyncStorage = useAsyncStorage;
|
7
|
+
|
8
|
+
var _AsyncStorage = _interopRequireDefault(require("./AsyncStorage"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
function useAsyncStorage(key) {
|
13
|
+
return {
|
14
|
+
getItem: function () {
|
15
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
16
|
+
args[_key] = arguments[_key];
|
17
|
+
}
|
18
|
+
|
19
|
+
return _AsyncStorage.default.getItem(key, ...args);
|
20
|
+
},
|
21
|
+
setItem: function () {
|
22
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
23
|
+
args[_key2] = arguments[_key2];
|
24
|
+
}
|
25
|
+
|
26
|
+
return _AsyncStorage.default.setItem(key, ...args);
|
27
|
+
},
|
28
|
+
mergeItem: function () {
|
29
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
30
|
+
args[_key3] = arguments[_key3];
|
31
|
+
}
|
32
|
+
|
33
|
+
return _AsyncStorage.default.mergeItem(key, ...args);
|
34
|
+
},
|
35
|
+
removeItem: function () {
|
36
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
37
|
+
args[_key4] = arguments[_key4];
|
38
|
+
}
|
39
|
+
|
40
|
+
return _AsyncStorage.default.removeItem(key, ...args);
|
41
|
+
}
|
42
|
+
};
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=hooks.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["useAsyncStorage","key","getItem","args","AsyncStorage","setItem","mergeItem","removeItem"],"sources":["hooks.ts"],"sourcesContent":["import AsyncStorage from './AsyncStorage';\nimport type { AsyncStorageHook } from './types';\n\nexport function useAsyncStorage(key: string): AsyncStorageHook {\n return {\n getItem: (...args) => AsyncStorage.getItem(key, ...args),\n setItem: (...args) => AsyncStorage.setItem(key, ...args),\n mergeItem: (...args) => AsyncStorage.mergeItem(key, ...args),\n removeItem: (...args) => AsyncStorage.removeItem(key, ...args),\n };\n}\n"],"mappings":";;;;;;;AAAA;;;;AAGO,SAASA,eAAT,CAAyBC,GAAzB,EAAwD;EAC7D,OAAO;IACLC,OAAO,EAAE;MAAA,kCAAIC,IAAJ;QAAIA,IAAJ;MAAA;;MAAA,OAAaC,qBAAA,CAAaF,OAAb,CAAqBD,GAArB,EAA0B,GAAGE,IAA7B,CAAb;IAAA,CADJ;IAELE,OAAO,EAAE;MAAA,mCAAIF,IAAJ;QAAIA,IAAJ;MAAA;;MAAA,OAAaC,qBAAA,CAAaC,OAAb,CAAqBJ,GAArB,EAA0B,GAAGE,IAA7B,CAAb;IAAA,CAFJ;IAGLG,SAAS,EAAE;MAAA,mCAAIH,IAAJ;QAAIA,IAAJ;MAAA;;MAAA,OAAaC,qBAAA,CAAaE,SAAb,CAAuBL,GAAvB,EAA4B,GAAGE,IAA/B,CAAb;IAAA,CAHN;IAILI,UAAU,EAAE;MAAA,mCAAIJ,IAAJ;QAAIA,IAAJ;MAAA;;MAAA,OAAaC,qBAAA,CAAaG,UAAb,CAAwBN,GAAxB,EAA6B,GAAGE,IAAhC,CAAb;IAAA;EAJP,CAAP;AAMD"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
Object.defineProperty(exports, "useAsyncStorage", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function () {
|
10
|
+
return _hooks.useAsyncStorage;
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
var _AsyncStorage = _interopRequireDefault(require("./AsyncStorage"));
|
15
|
+
|
16
|
+
var _hooks = require("./hooks");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
+
|
20
|
+
var _default = _AsyncStorage.default;
|
21
|
+
exports.default = _default;
|
22
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["AsyncStorage"],"sources":["index.ts"],"sourcesContent":["import AsyncStorage from './AsyncStorage';\n\nexport { useAsyncStorage } from './hooks';\n\nexport type { AsyncStorageStatic } from './types';\n\nexport default AsyncStorage;\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA;;;;eAIeA,qB"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.shouldFallbackToLegacyNativeModule = shouldFallbackToLegacyNativeModule;
|
7
|
+
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
|
10
|
+
function shouldFallbackToLegacyNativeModule() {
|
11
|
+
var _NativeModules$Native, _NativeModules$Native2;
|
12
|
+
|
13
|
+
const expoConstants = (_NativeModules$Native = _reactNative.NativeModules['NativeUnimoduleProxy']) === null || _NativeModules$Native === void 0 ? void 0 : (_NativeModules$Native2 = _NativeModules$Native.modulesConstants) === null || _NativeModules$Native2 === void 0 ? void 0 : _NativeModules$Native2.ExponentConstants;
|
14
|
+
|
15
|
+
if (expoConstants) {
|
16
|
+
/**
|
17
|
+
* In SDK <= 39, appOwnership is defined in managed apps but executionEnvironment is not.
|
18
|
+
* In bare React Native apps using expo-constants, appOwnership is never defined, so
|
19
|
+
* isLegacySdkVersion will be false in that context.
|
20
|
+
*/
|
21
|
+
const isLegacySdkVersion = expoConstants.appOwnership && !expoConstants.executionEnvironment;
|
22
|
+
/**
|
23
|
+
* Expo managed apps don't include the @react-native-async-storage/async-storage
|
24
|
+
* native modules yet, but the API interface is the same, so we can use the version
|
25
|
+
* exported from React Native still.
|
26
|
+
*
|
27
|
+
* If in future releases (eg: @react-native-async-storage/async-storage >= 2.0.0) this
|
28
|
+
* will likely not be valid anymore, and the package will need to be included in the Expo SDK
|
29
|
+
* to continue to work.
|
30
|
+
*/
|
31
|
+
|
32
|
+
if (isLegacySdkVersion || ['storeClient', 'standalone'].includes(expoConstants.executionEnvironment)) {
|
33
|
+
return true;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=shouldFallbackToLegacyNativeModule.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["shouldFallbackToLegacyNativeModule","expoConstants","NativeModules","modulesConstants","ExponentConstants","isLegacySdkVersion","appOwnership","executionEnvironment","includes"],"sources":["shouldFallbackToLegacyNativeModule.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\n\nexport function shouldFallbackToLegacyNativeModule(): boolean {\n const expoConstants =\n NativeModules['NativeUnimoduleProxy']?.modulesConstants?.ExponentConstants;\n\n if (expoConstants) {\n /**\n * In SDK <= 39, appOwnership is defined in managed apps but executionEnvironment is not.\n * In bare React Native apps using expo-constants, appOwnership is never defined, so\n * isLegacySdkVersion will be false in that context.\n */\n const isLegacySdkVersion =\n expoConstants.appOwnership && !expoConstants.executionEnvironment;\n\n /**\n * Expo managed apps don't include the @react-native-async-storage/async-storage\n * native modules yet, but the API interface is the same, so we can use the version\n * exported from React Native still.\n *\n * If in future releases (eg: @react-native-async-storage/async-storage >= 2.0.0) this\n * will likely not be valid anymore, and the package will need to be included in the Expo SDK\n * to continue to work.\n */\n if (\n isLegacySdkVersion ||\n ['storeClient', 'standalone'].includes(expoConstants.executionEnvironment)\n ) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAAA;;AAEO,SAASA,kCAAT,GAAuD;EAAA;;EAC5D,MAAMC,aAAa,4BACjBC,0BAAA,CAAc,sBAAd,CADiB,oFACjB,sBAAuCC,gBADtB,2DACjB,uBAAyDC,iBAD3D;;EAGA,IAAIH,aAAJ,EAAmB;IACjB;AACJ;AACA;AACA;AACA;IACI,MAAMI,kBAAkB,GACtBJ,aAAa,CAACK,YAAd,IAA8B,CAACL,aAAa,CAACM,oBAD/C;IAGA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACI,IACEF,kBAAkB,IAClB,CAAC,aAAD,EAAgB,YAAhB,EAA8BG,QAA9B,CAAuCP,aAAa,CAACM,oBAArD,CAFF,EAGE;MACA,OAAO,IAAP;IACD;EACF;;EAED,OAAO,KAAP;AACD"}
|