You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@react-native-async-storage/async-storage

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.18.2 to 1.19.3

android/src/javaPackage/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java

4

jest/async-storage-mock.js

@@ -1,4 +0,2 @@

/**
* @format
*/
/* eslint-disable no-undef */

@@ -5,0 +3,0 @@ const merge = require('merge-options').bind({

@@ -7,7 +7,4 @@ "use strict";

exports.default = void 0;
var _mergeOptions = _interopRequireDefault(require("merge-options"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -20,3 +17,5 @@ * Copyright (c) Nicolas Gallagher.

*/
// @ts-ignore Cannot find module 'merge-options' or its corresponding type declarations
const merge = _mergeOptions.default.bind({

@@ -26,6 +25,4 @@ concatArrays: true,

});
function mergeLocalStorageItem(key, value) {
const oldValue = window.localStorage.getItem(key);
if (oldValue) {

@@ -40,3 +37,2 @@ const oldObject = JSON.parse(oldValue);

}
function createPromise(getValue, callback) {

@@ -54,3 +50,2 @@ return new Promise((resolve, reject) => {

}
function createPromiseAll(promises, callback, processResult) {

@@ -66,3 +61,2 @@ return Promise.all(promises).then(result => {

}
const AsyncStorage = {

@@ -75,3 +69,2 @@ /**

},
/**

@@ -83,3 +76,2 @@ * Sets `value` for `key`.

},
/**

@@ -91,3 +83,2 @@ * Removes a `key`

},
/**

@@ -99,3 +90,2 @@ * Merges existing value with input value, assuming they are stringified JSON.

},
/**

@@ -107,3 +97,2 @@ * Erases *all* AsyncStorage for the domain.

},
/**

@@ -116,3 +105,2 @@ * Gets *all* keys known to the app, for all callers, libraries, etc.

const keys = [];
for (let i = 0; i < numberOfKeys; i += 1) {

@@ -122,7 +110,5 @@ const key = window.localStorage.key(i) || '';

}
return keys;
}, callback);
},
/**

@@ -132,3 +118,2 @@ * (stub) Flushes any pending requests using a single batch call to get the data.

flushGetRequests: () => undefined,
/**

@@ -142,8 +127,5 @@ * multiGet resolves to an array of key-value pair arrays that matches the

const promises = keys.map(key => AsyncStorage.getItem(key));
const processResult = result => result.map((value, i) => [keys[i], value]);
return createPromiseAll(promises, callback, processResult);
},
/**

@@ -157,3 +139,2 @@ * Takes an array of key-value array pairs.

},
/**

@@ -166,3 +147,2 @@ * Delete all the keys in the `keys` array.

},
/**

@@ -169,0 +149,0 @@ * Takes an array of key-value array pairs and merges them with existing

@@ -7,9 +7,5 @@ "use strict";

exports.default = void 0;
var _helpers = require("./helpers");
var _RCTAsyncStorage = _interopRequireDefault(require("./RCTAsyncStorage"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -21,2 +17,3 @@ * Copyright (c) Facebook, Inc. and its affiliates.

*/
if (!_RCTAsyncStorage.default) {

@@ -27,13 +24,16 @@ throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

• Rebuild and restart the app.
• Uninstall, rebuild and restart the app.
• Run the packager with \`--reset-cache\` flag.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory, then rebuild and re-run the app.
• 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
• Make sure your project's \`package.json\` depends on \`@react-native-async-storage/async-storage\`, even if you only depend on it indirectly through other dependencies. CLI only autolinks native modules found in your \`package.json\`.
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
• If this happens while testing with Jest, check out how to integrate AsyncStorage here: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
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
`);
}
/**

@@ -46,4 +46,2 @@ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value

*/
const AsyncStorage = (() => {

@@ -62,6 +60,4 @@ let _getRequests = [];

(0, _helpers.checkValidInput)(key);
_RCTAsyncStorage.default.multiGet([key], (errors, result) => {
var _result$;
// Unpack result to get value from [[key,value]]

@@ -71,3 +67,2 @@ const value = result !== null && result !== void 0 && (_result$ = result[0]) !== null && _result$ !== void 0 && _result$[1] ? result[0][1] : null;

callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0], value);
if (errs) {

@@ -81,3 +76,2 @@ reject(errs[0]);

},
/**

@@ -91,7 +85,5 @@ * Sets the value for a `key` and invokes a callback upon completion.

(0, _helpers.checkValidInput)(key, value);
_RCTAsyncStorage.default.multiSet([[key, value]], errors => {
const errs = (0, _helpers.convertErrors)(errors);
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -105,3 +97,2 @@ reject(errs[0]);

},
/**

@@ -115,7 +106,5 @@ * Removes an item for a `key` and invokes a callback upon completion.

(0, _helpers.checkValidInput)(key);
_RCTAsyncStorage.default.multiRemove([key], errors => {
const errs = (0, _helpers.convertErrors)(errors);
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -129,3 +118,2 @@ reject(errs[0]);

},
/**

@@ -140,7 +128,5 @@ * Merges an existing `key` value with an input value, assuming both values

(0, _helpers.checkValidInput)(key, value);
_RCTAsyncStorage.default.multiMerge([[key, value]], errors => {
const errs = (0, _helpers.convertErrors)(errors);
callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -154,3 +140,2 @@ reject(errs[0]);

},
/**

@@ -168,3 +153,2 @@ * Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably

callback === null || callback === void 0 ? void 0 : callback(err);
if (err) {

@@ -178,3 +162,2 @@ reject(err);

},
/**

@@ -190,3 +173,2 @@ * Gets *all* keys known to your app; for all callers, libraries, etc.

callback === null || callback === void 0 ? void 0 : callback(err, keys);
if (keys) {

@@ -200,3 +182,2 @@ resolve(keys);

},
/**

@@ -222,3 +203,2 @@ * The following batched functions are useful for executing a lot of

_getKeys = [];
_RCTAsyncStorage.default.multiGet(getKeys, (errors, result) => {

@@ -238,2 +218,3 @@ // Even though the runtime complexity of this is theoretically worse vs if we used a map,

const reqLength = getRequests.length;
/**

@@ -248,14 +229,9 @@ * As mentioned few lines above, this method could be called with the array of potential error,

*/
const errorList = (0, _helpers.convertErrors)(errors);
const error = errorList !== null && errorList !== void 0 && errorList.length ? errorList[0] : null;
for (let i = 0; i < reqLength; i++) {
var _request$callback2, _request$resolve;
const request = getRequests[i];
if (error) {
var _request$callback, _request$reject;
(_request$callback = request.callback) === null || _request$callback === void 0 ? void 0 : _request$callback.call(request, errorList);

@@ -265,3 +241,2 @@ (_request$reject = request.reject) === null || _request$reject === void 0 ? void 0 : _request$reject.call(request, error);

}
const requestResult = request.keys.map(key => [key, map[key]]);

@@ -273,3 +248,2 @@ (_request$callback2 = request.callback) === null || _request$callback2 === void 0 ? void 0 : _request$callback2.call(request, null, requestResult);

},
/**

@@ -289,3 +263,2 @@ * This allows you to batch the fetching of items given an array of `key`

}
const getRequest = {

@@ -303,6 +276,4 @@ keys: keys,

});
_getRequests.push(getRequest); // avoid fetching duplicates
_getRequests.push(getRequest);
// avoid fetching duplicates
keys.forEach(key => {

@@ -315,3 +286,2 @@ if (_getKeys.indexOf(key) === -1) {

},
/**

@@ -330,7 +300,5 @@ * Use this as a batch operation for storing multiple key-value pairs. When

});
_RCTAsyncStorage.default.multiSet(keyValuePairs, errors => {
const error = (0, _helpers.convertErrors)(errors);
callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -344,3 +312,2 @@ reject(error);

},
/**

@@ -354,7 +321,5 @@ * Call this to batch the deletion of all keys in the `keys` array.

keys.forEach(key => (0, _helpers.checkValidInput)(key));
_RCTAsyncStorage.default.multiRemove(keys, errors => {
const error = (0, _helpers.convertErrors)(errors);
callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -368,3 +333,2 @@ reject(error);

},
/**

@@ -381,3 +345,2 @@ * Batch operation to merge in existing and new values for a given set of

callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -393,5 +356,4 @@ reject(error);

})();
var _default = AsyncStorage;
exports.default = _default;
//# sourceMappingURL=AsyncStorage.native.js.map

@@ -10,3 +10,2 @@ "use strict";

exports.convertErrors = convertErrors;
function checkValidArgs(keyValuePairs, callback) {

@@ -16,3 +15,2 @@ if (!Array.isArray(keyValuePairs) || keyValuePairs.length === 0 || !Array.isArray(keyValuePairs[0])) {

}
if (callback && typeof callback !== 'function') {

@@ -22,7 +20,5 @@ if (Array.isArray(callback)) {

}
throw new Error('[AsyncStorage] Expected function as second argument to multiSet');
}
}
function checkValidInput() {

@@ -32,9 +28,6 @@ for (var _len = arguments.length, input = new Array(_len), _key = 0; _key < _len; _key++) {

}
const [key, value] = input;
if (typeof key !== 'string') {
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`);
}
if (input.length > 1 && typeof value !== 'string') {

@@ -48,3 +41,2 @@ if (value == null) {

}
function convertError(error) {

@@ -54,3 +46,2 @@ if (!error) {

}
const out = new Error(error.message);

@@ -60,3 +51,2 @@ out.key = error.key;

}
function convertErrors(errs) {

@@ -66,3 +56,2 @@ const errors = ensureArray(errs);

}
function ensureArray(e) {

@@ -69,0 +58,0 @@ if (Array.isArray(e)) {

@@ -7,7 +7,4 @@ "use strict";

exports.useAsyncStorage = useAsyncStorage;
var _AsyncStorage = _interopRequireDefault(require("./AsyncStorage"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function useAsyncStorage(key) {

@@ -19,3 +16,2 @@ return {

}
return _AsyncStorage.default.getItem(key, ...args);

@@ -27,3 +23,2 @@ },

}
return _AsyncStorage.default.setItem(key, ...args);

@@ -35,3 +30,2 @@ },

}
return _AsyncStorage.default.mergeItem(key, ...args);

@@ -43,3 +37,2 @@ },

}
return _AsyncStorage.default.removeItem(key, ...args);

@@ -46,0 +39,0 @@ }

@@ -13,11 +13,7 @@ "use strict";

});
var _AsyncStorage = _interopRequireDefault(require("./AsyncStorage"));
var _hooks = require("./hooks");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = _AsyncStorage.default;
exports.default = _default;
//# sourceMappingURL=index.js.map

@@ -7,15 +7,14 @@ "use strict";

exports.default = void 0;
var _reactNative = require("react-native");
var _shouldFallbackToLegacyNativeModule = require("./shouldFallbackToLegacyNativeModule");
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
// TurboModuleRegistry falls back to NativeModules so we don't have to try go
// assign NativeModules' counterparts if TurboModuleRegistry would resolve
// with undefined.
let RCTAsyncStorage = _reactNative.TurboModuleRegistry ? _reactNative.TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows
_reactNative.TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('RNCAsyncStorage') : _reactNative.NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows
let RCTAsyncStorage = _reactNative.TurboModuleRegistry ? _reactNative.TurboModuleRegistry.get('PlatformLocalStorage') ||
// Support for external modules, like react-native-windows
_reactNative.TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || _reactNative.TurboModuleRegistry.get('RNCAsyncStorage') : _reactNative.NativeModules['PlatformLocalStorage'] ||
// Support for external modules, like react-native-windows
_reactNative.NativeModules['RNC_AsyncSQLiteDBStorage'] || _reactNative.NativeModules['RNCAsyncStorage'];
if (!RCTAsyncStorage && (0, _shouldFallbackToLegacyNativeModule.shouldFallbackToLegacyNativeModule)()) {

@@ -28,5 +27,4 @@ if (_reactNative.TurboModuleRegistry) {

}
var _default = RCTAsyncStorage;
exports.default = _default;
//# sourceMappingURL=RCTAsyncStorage.js.map

@@ -7,10 +7,6 @@ "use strict";

exports.shouldFallbackToLegacyNativeModule = shouldFallbackToLegacyNativeModule;
var _reactNative = require("react-native");
function shouldFallbackToLegacyNativeModule() {
var _NativeModules$Native, _NativeModules$Native2;
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;
if (expoConstants) {

@@ -23,2 +19,3 @@ /**

const isLegacySdkVersion = expoConstants.appOwnership && !expoConstants.executionEnvironment;
/**

@@ -33,3 +30,2 @@ * Expo managed apps don't include the @react-native-async-storage/async-storage

*/
if (isLegacySdkVersion || ['storeClient', 'standalone'].includes(expoConstants.executionEnvironment)) {

@@ -39,5 +35,4 @@ return true;

}
return false;
}
//# sourceMappingURL=shouldFallbackToLegacyNativeModule.js.map

@@ -8,2 +8,3 @@ /**

*/
// @ts-ignore Cannot find module 'merge-options' or its corresponding type declarations

@@ -15,6 +16,4 @@ import mergeOptions from 'merge-options';

});
function mergeLocalStorageItem(key, value) {
const oldValue = window.localStorage.getItem(key);
if (oldValue) {

@@ -29,3 +28,2 @@ const oldObject = JSON.parse(oldValue);

}
function createPromise(getValue, callback) {

@@ -43,3 +41,2 @@ return new Promise((resolve, reject) => {

}
function createPromiseAll(promises, callback, processResult) {

@@ -55,3 +52,2 @@ return Promise.all(promises).then(result => {

}
const AsyncStorage = {

@@ -64,3 +60,2 @@ /**

},
/**

@@ -72,3 +67,2 @@ * Sets `value` for `key`.

},
/**

@@ -80,3 +74,2 @@ * Removes a `key`

},
/**

@@ -88,3 +81,2 @@ * Merges existing value with input value, assuming they are stringified JSON.

},
/**

@@ -96,3 +88,2 @@ * Erases *all* AsyncStorage for the domain.

},
/**

@@ -105,3 +96,2 @@ * Gets *all* keys known to the app, for all callers, libraries, etc.

const keys = [];
for (let i = 0; i < numberOfKeys; i += 1) {

@@ -111,7 +101,5 @@ const key = window.localStorage.key(i) || '';

}
return keys;
}, callback);
},
/**

@@ -121,3 +109,2 @@ * (stub) Flushes any pending requests using a single batch call to get the data.

flushGetRequests: () => undefined,
/**

@@ -131,8 +118,5 @@ * multiGet resolves to an array of key-value pair arrays that matches the

const promises = keys.map(key => AsyncStorage.getItem(key));
const processResult = result => result.map((value, i) => [keys[i], value]);
return createPromiseAll(promises, callback, processResult);
},
/**

@@ -146,3 +130,2 @@ * Takes an array of key-value array pairs.

},
/**

@@ -155,3 +138,2 @@ * Delete all the keys in the `keys` array.

},
/**

@@ -158,0 +140,0 @@ * Takes an array of key-value array pairs and merges them with existing

@@ -7,5 +7,5 @@ /**

*/
import { checkValidArgs, checkValidInput, convertError, convertErrors } from './helpers';
import RCTAsyncStorage from './RCTAsyncStorage';
if (!RCTAsyncStorage) {

@@ -16,13 +16,16 @@ throw new Error(`[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

• Rebuild and restart the app.
• Uninstall, rebuild and restart the app.
• Run the packager with \`--reset-cache\` flag.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory, then rebuild and re-run the app.
• 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
• Make sure your project's \`package.json\` depends on \`@react-native-async-storage/async-storage\`, even if you only depend on it indirectly through other dependencies. CLI only autolinks native modules found in your \`package.json\`.
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
• If this happens while testing with Jest, check out how to integrate AsyncStorage here: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
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
`);
}
/**

@@ -35,4 +38,2 @@ * `AsyncStorage` is a simple, unencrypted, asynchronous, persistent, key-value

*/
const AsyncStorage = (() => {

@@ -53,3 +54,2 @@ let _getRequests = [];

var _result$;
// Unpack result to get value from [[key,value]]

@@ -59,3 +59,2 @@ const value = result !== null && result !== void 0 && (_result$ = result[0]) !== null && _result$ !== void 0 && _result$[1] ? result[0][1] : null;

callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0], value);
if (errs) {

@@ -69,3 +68,2 @@ reject(errs[0]);

},
/**

@@ -82,3 +80,2 @@ * Sets the value for a `key` and invokes a callback upon completion.

callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -92,3 +89,2 @@ reject(errs[0]);

},
/**

@@ -105,3 +101,2 @@ * Removes an item for a `key` and invokes a callback upon completion.

callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -115,3 +110,2 @@ reject(errs[0]);

},
/**

@@ -129,3 +123,2 @@ * Merges an existing `key` value with an input value, assuming both values

callback === null || callback === void 0 ? void 0 : callback(errs === null || errs === void 0 ? void 0 : errs[0]);
if (errs) {

@@ -139,3 +132,2 @@ reject(errs[0]);

},
/**

@@ -153,3 +145,2 @@ * Erases *all* `AsyncStorage` for all clients, libraries, etc. You probably

callback === null || callback === void 0 ? void 0 : callback(err);
if (err) {

@@ -163,3 +154,2 @@ reject(err);

},
/**

@@ -175,3 +165,2 @@ * Gets *all* keys known to your app; for all callers, libraries, etc.

callback === null || callback === void 0 ? void 0 : callback(err, keys);
if (keys) {

@@ -185,3 +174,2 @@ resolve(keys);

},
/**

@@ -221,2 +209,3 @@ * The following batched functions are useful for executing a lot of

const reqLength = getRequests.length;
/**

@@ -231,14 +220,9 @@ * As mentioned few lines above, this method could be called with the array of potential error,

*/
const errorList = convertErrors(errors);
const error = errorList !== null && errorList !== void 0 && errorList.length ? errorList[0] : null;
for (let i = 0; i < reqLength; i++) {
var _request$callback2, _request$resolve;
const request = getRequests[i];
if (error) {
var _request$callback, _request$reject;
(_request$callback = request.callback) === null || _request$callback === void 0 ? void 0 : _request$callback.call(request, errorList);

@@ -248,3 +232,2 @@ (_request$reject = request.reject) === null || _request$reject === void 0 ? void 0 : _request$reject.call(request, error);

}
const requestResult = request.keys.map(key => [key, map[key]]);

@@ -256,3 +239,2 @@ (_request$callback2 = request.callback) === null || _request$callback2 === void 0 ? void 0 : _request$callback2.call(request, null, requestResult);

},
/**

@@ -272,3 +254,2 @@ * This allows you to batch the fetching of items given an array of `key`

}
const getRequest = {

@@ -286,6 +267,4 @@ keys: keys,

});
_getRequests.push(getRequest); // avoid fetching duplicates
_getRequests.push(getRequest);
// avoid fetching duplicates
keys.forEach(key => {

@@ -298,3 +277,2 @@ if (_getKeys.indexOf(key) === -1) {

},
/**

@@ -316,3 +294,2 @@ * Use this as a batch operation for storing multiple key-value pairs. When

callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -326,3 +303,2 @@ reject(error);

},
/**

@@ -339,3 +315,2 @@ * Call this to batch the deletion of all keys in the `keys` array.

callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -349,3 +324,2 @@ reject(error);

},
/**

@@ -362,3 +336,2 @@ * Batch operation to merge in existing and new values for a given set of

callback === null || callback === void 0 ? void 0 : callback(error);
if (error) {

@@ -374,4 +347,3 @@ reject(error);

})();
export default AsyncStorage;
//# sourceMappingURL=AsyncStorage.native.js.map

@@ -5,3 +5,2 @@ export function checkValidArgs(keyValuePairs, callback) {

}
if (callback && typeof callback !== 'function') {

@@ -11,3 +10,2 @@ if (Array.isArray(callback)) {

}
throw new Error('[AsyncStorage] Expected function as second argument to multiSet');

@@ -20,9 +18,6 @@ }

}
const [key, value] = input;
if (typeof key !== 'string') {
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`);
}
if (input.length > 1 && typeof value !== 'string') {

@@ -40,3 +35,2 @@ if (value == null) {

}
const out = new Error(error.message);

@@ -50,3 +44,2 @@ out.key = error.key;

}
function ensureArray(e) {

@@ -53,0 +46,0 @@ if (Array.isArray(e)) {

@@ -8,3 +8,2 @@ import AsyncStorage from './AsyncStorage';

}
return AsyncStorage.getItem(key, ...args);

@@ -16,3 +15,2 @@ },

}
return AsyncStorage.setItem(key, ...args);

@@ -24,3 +22,2 @@ },

}
return AsyncStorage.mergeItem(key, ...args);

@@ -32,3 +29,2 @@ },

}
return AsyncStorage.removeItem(key, ...args);

@@ -35,0 +31,0 @@ }

// @ts-ignore Module '"react-native"' has no exported member 'TurboModuleRegistry'.
import { NativeModules, TurboModuleRegistry } from 'react-native';
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule'; // TurboModuleRegistry falls back to NativeModules so we don't have to try go
import { shouldFallbackToLegacyNativeModule } from './shouldFallbackToLegacyNativeModule';
// TurboModuleRegistry falls back to NativeModules so we don't have to try go
// assign NativeModules' counterparts if TurboModuleRegistry would resolve
// with undefined.
let RCTAsyncStorage = TurboModuleRegistry ? TurboModuleRegistry.get('PlatformLocalStorage') || // Support for external modules, like react-native-windows
TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || TurboModuleRegistry.get('RNCAsyncStorage') : NativeModules['PlatformLocalStorage'] || // Support for external modules, like react-native-windows
let RCTAsyncStorage = TurboModuleRegistry ? TurboModuleRegistry.get('PlatformLocalStorage') ||
// Support for external modules, like react-native-windows
TurboModuleRegistry.get('RNC_AsyncSQLiteDBStorage') || TurboModuleRegistry.get('RNCAsyncStorage') : NativeModules['PlatformLocalStorage'] ||
// Support for external modules, like react-native-windows
NativeModules['RNC_AsyncSQLiteDBStorage'] || NativeModules['RNCAsyncStorage'];
if (!RCTAsyncStorage && shouldFallbackToLegacyNativeModule()) {

@@ -18,4 +20,3 @@ if (TurboModuleRegistry) {

}
export default RCTAsyncStorage;
//# sourceMappingURL=RCTAsyncStorage.js.map
import { NativeModules } from 'react-native';
export function shouldFallbackToLegacyNativeModule() {
var _NativeModules$Native, _NativeModules$Native2;
const expoConstants = (_NativeModules$Native = NativeModules['NativeUnimoduleProxy']) === null || _NativeModules$Native === void 0 ? void 0 : (_NativeModules$Native2 = _NativeModules$Native.modulesConstants) === null || _NativeModules$Native2 === void 0 ? void 0 : _NativeModules$Native2.ExponentConstants;
if (expoConstants) {

@@ -14,2 +12,3 @@ /**

const isLegacySdkVersion = expoConstants.appOwnership && !expoConstants.executionEnvironment;
/**

@@ -24,3 +23,2 @@ * Expo managed apps don't include the @react-native-async-storage/async-storage

*/
if (isLegacySdkVersion || ['storeClient', 'standalone'].includes(expoConstants.executionEnvironment)) {

@@ -30,5 +28,4 @@ return true;

}
return false;
}
//# sourceMappingURL=shouldFallbackToLegacyNativeModule.js.map

@@ -1,11 +0,11 @@

export declare type ErrorLike = {
export type ErrorLike = {
message: string;
key: string;
};
export declare type Callback = (error?: Error | null) => void;
export declare type CallbackWithResult<T> = (error?: Error | null, result?: T | null) => void;
export declare type KeyValuePair = [string, string | null];
export declare type MultiCallback = (errors?: readonly (Error | null)[] | null) => void;
export declare type MultiGetCallback = (errors?: readonly (Error | null)[] | null, result?: readonly KeyValuePair[]) => void;
export declare type MultiRequest = {
export type Callback = (error?: Error | null) => void;
export type CallbackWithResult<T> = (error?: Error | null, result?: T | null) => void;
export type KeyValuePair = [string, string | null];
export type MultiCallback = (errors?: readonly (Error | null)[] | null) => void;
export type MultiGetCallback = (errors?: readonly (Error | null)[] | null, result?: readonly KeyValuePair[]) => void;
export type MultiRequest = {
keys: readonly string[];

@@ -17,3 +17,3 @@ callback?: MultiGetCallback;

};
export declare type AsyncStorageHook = {
export type AsyncStorageHook = {
getItem: (callback?: CallbackWithResult<string>) => Promise<string | null>;

@@ -31,3 +31,3 @@ setItem: (value: string, callback?: Callback) => Promise<void>;

*/
export declare type AsyncStorageStatic = {
export type AsyncStorageStatic = {
/**

@@ -34,0 +34,0 @@ * Fetches an item for a `key` and invokes a callback upon completion.

{
"name": "@react-native-async-storage/async-storage",
"version": "1.18.2",
"version": "1.19.3",
"description": "Asynchronous, persistent, key-value storage system for React Native.",

@@ -46,5 +46,5 @@ "main": "lib/commonjs/index.js",

"start:android": "react-native run-android",
"start:ios": "react-native run-ios --project-path example/ios",
"start:ios": "react-native run-ios",
"start:macos": "react-native run-macos --project-path example/macos --scheme AsyncStorageExample",
"start:web": "expo start:web",
"start:web": "expo start --web",
"start:windows": "install-windows-test-app -p example/windows && react-native run-windows --root example --logging --no-packager --no-telemetry",

@@ -56,8 +56,8 @@ "build:e2e:android": "scripts/android_e2e.sh 'build'",

"bundle:ios": "scripts/ios_e2e.sh 'bundle'",
"bundle:macos": "react-native bundle --entry-file index.ts --platform macos --bundle-output example/index.macos.jsbundle",
"bundle:macos": "react-native bundle --entry-file index.ts --platform macos --dev false --bundle-output example/index.macos.jsbundle",
"test": "concurrently -n lint,ts yarn:test:lint yarn:test:ts",
"test:lint": "eslint src/**/*.ts example/**/*.ts jest/*.js",
"test:ts": "tsc --project tsconfig.all.json",
"test:e2e:android": "detox test -c android.emu.release --maxConcurrency 1",
"test:e2e:ios": "detox test -c ios.sim.release --maxConcurrency 1",
"test:ts": "tsc",
"test:e2e:android": "scripts/android_e2e.sh 'test'",
"test:e2e:ios": "scripts/ios_e2e.sh 'test'",
"test:e2e:macos": "scripts/macos_e2e.sh 'test'"

@@ -72,4 +72,4 @@ },

"devDependencies": {
"@babel/core": "^7.12.0",
"@babel/preset-env": "^7.1.6",
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@react-native-community/eslint-config": "^3.0.0",

@@ -79,75 +79,40 @@ "@semantic-release/changelog": "^6.0.0",

"@types/lodash": "^4.14.184",
"@types/react": "^17.0.0",
"@types/react-native": "^0.68.0",
"@types/mocha": "^10.0.1",
"@types/react": "^18.0.0",
"@wdio/appium-service": "^8.11.2",
"@wdio/cli": "^8.11.2",
"@wdio/local-runner": "^8.11.2",
"@wdio/mocha-framework": "^8.11.0",
"@wdio/spec-reporter": "^8.11.2",
"appium": "2.0.0-rc.3",
"appium-uiautomator2-driver": "^2.26.2",
"appium-xcuitest-driver": "^4.32.5",
"concurrently": "^6.4.0",
"detox": "^19.4.5",
"eslint": "^8.0.0",
"expo": "^45.0.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.1",
"eslint-plugin-wdio": "^8.8.7",
"expo": "^48.0.0",
"lodash": "^4.17.21",
"prettier": "^2.5.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "^0.68.0",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-native": "^0.71.0",
"react-native-builder-bob": "^0.18.0",
"react-native-macos": "^0.68.0",
"react-native-test-app": "^2.3.10",
"react-native-web": "^0.17.0",
"react-native-windows": "^0.68.0",
"react-test-renderer": "17.0.2",
"react-native-codegen": "^0.71.5",
"react-native-macos": "^0.71.0",
"react-native-test-app": "^2.5.8",
"react-native-web": "~0.18.10",
"react-native-windows": "^0.71.0",
"react-test-renderer": "18.2.0",
"semantic-release": "^19.0.0",
"typescript": "^4.5.0"
"typescript": "^4.9.4",
"webdriverio": "^8.11.2"
},
"packageManager": "yarn@3.4.1",
"resolutions": {
"body-parser/qs": "^6.7.3",
"find-babel-config/json5": "^2.1.1",
"npm/chalk": "^4.1.2"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./example/jest.setup.js"
]
},
"detox": {
"test-runner": "jest",
"runner-config": "example/e2e/config.json",
"configurations": {
"ios.sim.release": {
"binaryPath": "example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app",
"type": "ios.simulator",
"device": {
"type": "iPhone 13"
}
},
"android.emu.release": {
"binaryPath": "example/android/app/build/outputs/apk/release/app-release.apk",
"testBinaryPath": "example/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk",
"type": "android.emulator",
"device": {
"avdName": "E2E_API_30",
"utilBinaryPaths": [
"/var/tmp/test-butler.apk"
]
}
},
"android.emu.release.next": {
"binaryPath": "example/android/app/build/outputs/apk/next/app-next.apk",
"testBinaryPath": "example/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk",
"type": "android.emulator",
"device": {
"avdName": "E2E_API_30",
"utilBinaryPaths": [
"/var/tmp/test-butler.apk"
]
}
}
}
},
"eslintConfig": {
"root": true,
"plugins": [
"wdio"
],
"extends": [
"@react-native-community",
"plugin:jest/recommended"
"plugin:wdio/recommended"
],

@@ -176,3 +141,8 @@ "rules": {

"module",
"typescript"
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]

@@ -182,3 +152,3 @@ },

"branches": [
"master"
"main"
],

@@ -202,3 +172,11 @@ "plugins": [

]
},
"codegenConfig": {
"name": "rnasyncstorage",
"type": "modules",
"jsSrcsDir": "./src",
"android": {
"javaPackageName": "com.reactnativecommunity.asyncstorage"
}
}
}

@@ -27,11 +27,13 @@ /**

• Rebuild and restart the app.
• Uninstall, rebuild and restart the app.
• Run the packager with \`--reset-cache\` flag.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory and then rebuild and re-run the app.
• If you are using CocoaPods on iOS, run \`pod install\` in the \`ios\` directory, then rebuild and re-run the app.
• 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
• Make sure your project's \`package.json\` depends on \`@react-native-async-storage/async-storage\`, even if you only depend on it indirectly through other dependencies. CLI only autolinks native modules found in your \`package.json\`.
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
• If this happens while testing with Jest, check out how to integrate AsyncStorage here: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
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
`);

@@ -38,0 +40,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc