@fto-consult/expo-ui 6.37.3 → 6.37.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +0 -1
- package/node_modules/.package-lock.json +26218 -26188
- package/node_modules/@fto-consult/common/babel.config.alias.js +18 -1
- package/node_modules/@fto-consult/common/package.json +1 -1
- 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/src/components/Chart/appexChart/appexChart.html +23 -23
@@ -0,0 +1,162 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include <optional>
|
6
|
+
|
7
|
+
#include <winsqlite/winsqlite3.h>
|
8
|
+
|
9
|
+
#include "NativeModules.h"
|
10
|
+
|
11
|
+
struct DBStorage {
|
12
|
+
// To pass KeyValue pairs in the native module API.
|
13
|
+
// It has custom ReadValue and WriteValue to read/write to/from JSON.
|
14
|
+
struct KeyValue {
|
15
|
+
std::string Key;
|
16
|
+
std::string Value;
|
17
|
+
};
|
18
|
+
|
19
|
+
// An Error object for the native module API.
|
20
|
+
// It has a custom WriteValue to write to JSON.
|
21
|
+
struct Error {
|
22
|
+
std::string Message;
|
23
|
+
};
|
24
|
+
|
25
|
+
// An error list shared between Promise and DBTask.
|
26
|
+
struct ErrorManager {
|
27
|
+
std::nullopt_t AddError(std::string &&message) noexcept;
|
28
|
+
bool HasErrors() const noexcept;
|
29
|
+
const std::vector<Error> &GetErrorList() const noexcept;
|
30
|
+
Error GetCombinedError() const noexcept;
|
31
|
+
|
32
|
+
private:
|
33
|
+
std::vector<Error> m_errors;
|
34
|
+
};
|
35
|
+
|
36
|
+
// Ensure that only one result onResolve or onReject callback is called once.
|
37
|
+
template <typename TOnResolve, typename TOnReject>
|
38
|
+
struct Promise {
|
39
|
+
|
40
|
+
Promise(TOnResolve &&onResolve, TOnReject &&onReject) noexcept
|
41
|
+
: m_onResolve(std::move(onResolve)), m_onReject(std::move(onReject))
|
42
|
+
{
|
43
|
+
}
|
44
|
+
|
45
|
+
~Promise()
|
46
|
+
{
|
47
|
+
Reject();
|
48
|
+
}
|
49
|
+
|
50
|
+
Promise(const Promise &other) = delete;
|
51
|
+
Promise &operator=(const Promise &other) = delete;
|
52
|
+
|
53
|
+
ErrorManager &GetErrorManager() noexcept
|
54
|
+
{
|
55
|
+
return m_errorManager;
|
56
|
+
}
|
57
|
+
|
58
|
+
template <typename TValue>
|
59
|
+
void Resolve(const TValue &value) noexcept
|
60
|
+
{
|
61
|
+
Complete([&] { m_onResolve(value); });
|
62
|
+
}
|
63
|
+
|
64
|
+
void Reject() noexcept
|
65
|
+
{
|
66
|
+
Complete([&] {
|
67
|
+
// Ensure that we have at least one error on rejection.
|
68
|
+
if (!m_errorManager.HasErrors()) {
|
69
|
+
m_errorManager.AddError("Promise is rejected.");
|
70
|
+
}
|
71
|
+
m_onReject(m_errorManager);
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
template <typename TValue>
|
76
|
+
void ResolveOrReject(const std::optional<TValue> &value) noexcept
|
77
|
+
{
|
78
|
+
if (value) {
|
79
|
+
Resolve(*value);
|
80
|
+
} else {
|
81
|
+
Reject();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
private:
|
86
|
+
template <typename Fn>
|
87
|
+
void Complete(Fn &&fn)
|
88
|
+
{
|
89
|
+
if (m_isCompleted.test_and_set() == false) {
|
90
|
+
fn();
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
private:
|
95
|
+
ErrorManager m_errorManager;
|
96
|
+
std::atomic_flag m_isCompleted = ATOMIC_FLAG_INIT;
|
97
|
+
TOnResolve m_onResolve;
|
98
|
+
TOnReject m_onReject;
|
99
|
+
};
|
100
|
+
|
101
|
+
// An asynchronous task that run in a background thread.
|
102
|
+
struct DBTask {
|
103
|
+
DBTask(ErrorManager &errorManager,
|
104
|
+
std::function<void(DBTask &task, sqlite3 *db)> &&onRun) noexcept;
|
105
|
+
|
106
|
+
DBTask() = default;
|
107
|
+
DBTask(const DBTask &) = delete;
|
108
|
+
DBTask &operator=(const DBTask &) = delete;
|
109
|
+
|
110
|
+
void Run(DBStorage &storage, sqlite3 *db) noexcept;
|
111
|
+
void Cancel() noexcept;
|
112
|
+
|
113
|
+
std::optional<std::vector<KeyValue>>
|
114
|
+
MultiGet(sqlite3 *db, const std::vector<std::string> &keys) noexcept;
|
115
|
+
std::optional<bool> MultiSet(sqlite3 *db, const std::vector<KeyValue> &keyValues) noexcept;
|
116
|
+
std::optional<bool> MultiMerge(sqlite3 *db,
|
117
|
+
const std::vector<KeyValue> &keyValues) noexcept;
|
118
|
+
std::optional<bool> MultiRemove(sqlite3 *db, const std::vector<std::string> &keys) noexcept;
|
119
|
+
std::optional<std::vector<std::string>> GetAllKeys(sqlite3 *db) noexcept;
|
120
|
+
std::optional<bool> RemoveAll(sqlite3 *db) noexcept;
|
121
|
+
|
122
|
+
private:
|
123
|
+
std::function<void(DBTask &task, sqlite3 *db)> m_onRun;
|
124
|
+
ErrorManager &m_errorManager;
|
125
|
+
};
|
126
|
+
|
127
|
+
using DatabasePtr = std::unique_ptr<sqlite3, decltype(&sqlite3_close)>;
|
128
|
+
|
129
|
+
std::optional<sqlite3 *> InitializeStorage(ErrorManager &errorManager) noexcept;
|
130
|
+
~DBStorage();
|
131
|
+
|
132
|
+
template <typename TOnResolve, typename TOnReject>
|
133
|
+
static auto CreatePromise(TOnResolve &&onResolve, TOnReject &&onReject) noexcept
|
134
|
+
{
|
135
|
+
using PromiseType = Promise<std::decay_t<TOnResolve>, std::decay_t<TOnReject>>;
|
136
|
+
return std::make_shared<PromiseType>(std::forward<TOnResolve>(onResolve),
|
137
|
+
std::forward<TOnReject>(onReject));
|
138
|
+
}
|
139
|
+
|
140
|
+
void AddTask(ErrorManager &errorManager,
|
141
|
+
std::function<void(DBTask &task, sqlite3 *db)> &&onRun) noexcept;
|
142
|
+
|
143
|
+
winrt::Windows::Foundation::IAsyncAction RunTasks() noexcept;
|
144
|
+
|
145
|
+
private:
|
146
|
+
static constexpr auto s_dbPathProperty = L"React-Native-Community-Async-Storage-Database-Path";
|
147
|
+
|
148
|
+
DatabasePtr m_db{nullptr, &sqlite3_close};
|
149
|
+
winrt::slim_mutex m_lock;
|
150
|
+
winrt::slim_condition_variable m_cv;
|
151
|
+
winrt::Windows::Foundation::IAsyncAction m_action{nullptr};
|
152
|
+
std::vector<std::unique_ptr<DBTask>> m_tasks;
|
153
|
+
};
|
154
|
+
|
155
|
+
void ReadValue(const winrt::Microsoft::ReactNative::IJSValueReader &reader,
|
156
|
+
/*out*/ DBStorage::KeyValue &value) noexcept;
|
157
|
+
|
158
|
+
void WriteValue(const winrt::Microsoft::ReactNative::IJSValueWriter &writer,
|
159
|
+
const DBStorage::KeyValue &value) noexcept;
|
160
|
+
|
161
|
+
void WriteValue(const winrt::Microsoft::ReactNative::IJSValueWriter &writer,
|
162
|
+
const DBStorage::Error &value) noexcept;
|
@@ -0,0 +1,118 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "DBStorage.h"
|
6
|
+
#include "NativeModules.h"
|
7
|
+
|
8
|
+
namespace winrt::ReactNativeAsyncStorage::implementation
|
9
|
+
{
|
10
|
+
REACT_MODULE(RNCAsyncStorage)
|
11
|
+
struct RNCAsyncStorage {
|
12
|
+
|
13
|
+
REACT_METHOD(multiGet)
|
14
|
+
void multiGet(
|
15
|
+
std::vector<std::string> &&keys,
|
16
|
+
std::function<void(const std::vector<DBStorage::Error> &errors,
|
17
|
+
const std::vector<DBStorage::KeyValue> &result)> &&callback) noexcept
|
18
|
+
{
|
19
|
+
auto promise = DBStorage::CreatePromise(
|
20
|
+
[callback](const std::vector<DBStorage::KeyValue> &result) {
|
21
|
+
callback({}, result);
|
22
|
+
},
|
23
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
24
|
+
callback(errorManager.GetErrorList(), {});
|
25
|
+
});
|
26
|
+
m_dbStorage.AddTask(
|
27
|
+
promise->GetErrorManager(),
|
28
|
+
[promise, keys = std::move(keys)](DBStorage::DBTask &task, sqlite3 *db) noexcept {
|
29
|
+
promise->ResolveOrReject(task.MultiGet(db, keys));
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
33
|
+
REACT_METHOD(multiSet)
|
34
|
+
void multiSet(
|
35
|
+
std::vector<DBStorage::KeyValue> &&keyValues,
|
36
|
+
std::function<void(const std::vector<DBStorage::Error> &errors)> &&callback) noexcept
|
37
|
+
{
|
38
|
+
auto promise =
|
39
|
+
DBStorage::CreatePromise([callback](bool /*value*/) { callback({}); },
|
40
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
41
|
+
callback(errorManager.GetErrorList());
|
42
|
+
});
|
43
|
+
m_dbStorage.AddTask(promise->GetErrorManager(),
|
44
|
+
[promise, keyValues = std::move(keyValues)](DBStorage::DBTask &task,
|
45
|
+
sqlite3 *db) noexcept {
|
46
|
+
promise->ResolveOrReject(task.MultiSet(db, keyValues));
|
47
|
+
});
|
48
|
+
}
|
49
|
+
|
50
|
+
REACT_METHOD(multiMerge)
|
51
|
+
void multiMerge(
|
52
|
+
std::vector<DBStorage::KeyValue> &&keyValues,
|
53
|
+
std::function<void(const std::vector<DBStorage::Error> &errors)> &&callback) noexcept
|
54
|
+
{
|
55
|
+
auto promise =
|
56
|
+
DBStorage::CreatePromise([callback](bool /*value*/) { callback({}); },
|
57
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
58
|
+
callback(errorManager.GetErrorList());
|
59
|
+
});
|
60
|
+
m_dbStorage.AddTask(promise->GetErrorManager(),
|
61
|
+
[promise, keyValues = std::move(keyValues)](DBStorage::DBTask &task,
|
62
|
+
sqlite3 *db) noexcept {
|
63
|
+
promise->ResolveOrReject(task.MultiMerge(db, keyValues));
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
REACT_METHOD(multiRemove)
|
68
|
+
void multiRemove(
|
69
|
+
std::vector<std::string> &&keys,
|
70
|
+
std::function<void(const std::vector<DBStorage::Error> &errors)> &&callback) noexcept
|
71
|
+
{
|
72
|
+
auto promise =
|
73
|
+
DBStorage::CreatePromise([callback](bool /*value*/) { callback({}); },
|
74
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
75
|
+
callback(errorManager.GetErrorList());
|
76
|
+
});
|
77
|
+
m_dbStorage.AddTask(
|
78
|
+
promise->GetErrorManager(),
|
79
|
+
[promise, keys = std::move(keys)](DBStorage::DBTask &task, sqlite3 *db) noexcept {
|
80
|
+
promise->ResolveOrReject(task.MultiRemove(db, keys));
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
REACT_METHOD(getAllKeys)
|
85
|
+
void
|
86
|
+
getAllKeys(std::function<void(const std::optional<DBStorage::Error> &error,
|
87
|
+
const std::vector<std::string> &keys)> &&callback) noexcept
|
88
|
+
{
|
89
|
+
auto promise = DBStorage::CreatePromise(
|
90
|
+
[callback](const std::vector<std::string> &keys) { callback(std::nullopt, keys); },
|
91
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
92
|
+
callback(errorManager.GetCombinedError(), {});
|
93
|
+
});
|
94
|
+
m_dbStorage.AddTask(promise->GetErrorManager(),
|
95
|
+
[promise](DBStorage::DBTask &task, sqlite3 *db) noexcept {
|
96
|
+
promise->ResolveOrReject(task.GetAllKeys(db));
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
REACT_METHOD(clear)
|
101
|
+
void
|
102
|
+
clear(std::function<void(const std::optional<DBStorage::Error> &error)> &&callback) noexcept
|
103
|
+
{
|
104
|
+
auto promise =
|
105
|
+
DBStorage::CreatePromise([callback](bool /*value*/) { callback(std::nullopt); },
|
106
|
+
[callback](const DBStorage::ErrorManager &errorManager) {
|
107
|
+
callback(errorManager.GetCombinedError());
|
108
|
+
});
|
109
|
+
m_dbStorage.AddTask(promise->GetErrorManager(),
|
110
|
+
[promise](DBStorage::DBTask &task, sqlite3 *db) noexcept {
|
111
|
+
promise->ResolveOrReject(task.RemoveAll(db));
|
112
|
+
});
|
113
|
+
}
|
114
|
+
|
115
|
+
private:
|
116
|
+
DBStorage m_dbStorage;
|
117
|
+
};
|
118
|
+
} // namespace winrt::ReactNativeAsyncStorage::implementation
|
package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.cpp
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
#include "pch.h"
|
4
|
+
|
5
|
+
#include "ReactPackageProvider.h"
|
6
|
+
|
7
|
+
#include "RNCAsyncStorage.h"
|
8
|
+
#include "ReactPackageProvider.g.cpp"
|
9
|
+
|
10
|
+
using namespace winrt::Microsoft::ReactNative;
|
11
|
+
|
12
|
+
namespace winrt::ReactNativeAsyncStorage::implementation
|
13
|
+
{
|
14
|
+
|
15
|
+
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept
|
16
|
+
{
|
17
|
+
AddAttributedModules(packageBuilder);
|
18
|
+
}
|
19
|
+
|
20
|
+
} // namespace winrt::ReactNativeAsyncStorage::implementation
|
package/node_modules/@react-native-async-storage/async-storage/windows/code/ReactPackageProvider.h
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#include "ReactPackageProvider.g.h"
|
6
|
+
|
7
|
+
using namespace winrt::Microsoft::ReactNative;
|
8
|
+
|
9
|
+
namespace winrt::ReactNativeAsyncStorage::implementation
|
10
|
+
{
|
11
|
+
struct ReactPackageProvider : ReactPackageProviderT<ReactPackageProvider> {
|
12
|
+
ReactPackageProvider() = default;
|
13
|
+
|
14
|
+
void CreatePackage(IReactPackageBuilder const &packageBuilder) noexcept;
|
15
|
+
};
|
16
|
+
} // namespace winrt::ReactNativeAsyncStorage::implementation
|
17
|
+
|
18
|
+
namespace winrt::ReactNativeAsyncStorage::factory_implementation
|
19
|
+
{
|
20
|
+
struct ReactPackageProvider
|
21
|
+
: ReactPackageProviderT<ReactPackageProvider, implementation::ReactPackageProvider> {
|
22
|
+
};
|
23
|
+
} // namespace winrt::ReactNativeAsyncStorage::factory_implementation
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT License.
|
3
|
+
#pragma once
|
4
|
+
|
5
|
+
#define NOMINMAX
|
6
|
+
|
7
|
+
#include <functional>
|
8
|
+
#include <unknwn.h>
|
9
|
+
|
10
|
+
#include <winrt/Microsoft.ReactNative.h>
|
11
|
+
#include <winrt/Windows.ApplicationModel.Core.h>
|
12
|
+
#include <winrt/Windows.Data.Json.h>
|
13
|
+
#include <winrt/Windows.Foundation.Collections.h>
|
14
|
+
#include <winrt/Windows.Foundation.h>
|
15
|
+
#include <winrt/Windows.Storage.h>
|
@@ -0,0 +1,171 @@
|
|
1
|
+
'use strict';
|
2
|
+
const isOptionObject = require('is-plain-obj');
|
3
|
+
|
4
|
+
const {hasOwnProperty} = Object.prototype;
|
5
|
+
const {propertyIsEnumerable} = Object;
|
6
|
+
const defineProperty = (object, name, value) => Object.defineProperty(object, name, {
|
7
|
+
value,
|
8
|
+
writable: true,
|
9
|
+
enumerable: true,
|
10
|
+
configurable: true
|
11
|
+
});
|
12
|
+
|
13
|
+
const globalThis = this;
|
14
|
+
const defaultMergeOptions = {
|
15
|
+
concatArrays: false,
|
16
|
+
ignoreUndefined: false
|
17
|
+
};
|
18
|
+
|
19
|
+
const getEnumerableOwnPropertyKeys = value => {
|
20
|
+
const keys = [];
|
21
|
+
|
22
|
+
for (const key in value) {
|
23
|
+
if (hasOwnProperty.call(value, key)) {
|
24
|
+
keys.push(key);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
/* istanbul ignore else */
|
29
|
+
if (Object.getOwnPropertySymbols) {
|
30
|
+
const symbols = Object.getOwnPropertySymbols(value);
|
31
|
+
|
32
|
+
for (const symbol of symbols) {
|
33
|
+
if (propertyIsEnumerable.call(value, symbol)) {
|
34
|
+
keys.push(symbol);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
return keys;
|
40
|
+
};
|
41
|
+
|
42
|
+
function clone(value) {
|
43
|
+
if (Array.isArray(value)) {
|
44
|
+
return cloneArray(value);
|
45
|
+
}
|
46
|
+
|
47
|
+
if (isOptionObject(value)) {
|
48
|
+
return cloneOptionObject(value);
|
49
|
+
}
|
50
|
+
|
51
|
+
return value;
|
52
|
+
}
|
53
|
+
|
54
|
+
function cloneArray(array) {
|
55
|
+
const result = array.slice(0, 0);
|
56
|
+
|
57
|
+
getEnumerableOwnPropertyKeys(array).forEach(key => {
|
58
|
+
defineProperty(result, key, clone(array[key]));
|
59
|
+
});
|
60
|
+
|
61
|
+
return result;
|
62
|
+
}
|
63
|
+
|
64
|
+
function cloneOptionObject(object) {
|
65
|
+
const result = Object.getPrototypeOf(object) === null ? Object.create(null) : {};
|
66
|
+
|
67
|
+
getEnumerableOwnPropertyKeys(object).forEach(key => {
|
68
|
+
defineProperty(result, key, clone(object[key]));
|
69
|
+
});
|
70
|
+
|
71
|
+
return result;
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* @param {*} merged already cloned
|
76
|
+
* @param {*} source something to merge
|
77
|
+
* @param {string[]} keys keys to merge
|
78
|
+
* @param {Object} config Config Object
|
79
|
+
* @returns {*} cloned Object
|
80
|
+
*/
|
81
|
+
const mergeKeys = (merged, source, keys, config) => {
|
82
|
+
keys.forEach(key => {
|
83
|
+
if (typeof source[key] === 'undefined' && config.ignoreUndefined) {
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
|
87
|
+
// Do not recurse into prototype chain of merged
|
88
|
+
if (key in merged && merged[key] !== Object.getPrototypeOf(merged)) {
|
89
|
+
defineProperty(merged, key, merge(merged[key], source[key], config));
|
90
|
+
} else {
|
91
|
+
defineProperty(merged, key, clone(source[key]));
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
return merged;
|
96
|
+
};
|
97
|
+
|
98
|
+
/**
|
99
|
+
* @param {*} merged already cloned
|
100
|
+
* @param {*} source something to merge
|
101
|
+
* @param {Object} config Config Object
|
102
|
+
* @returns {*} cloned Object
|
103
|
+
*
|
104
|
+
* see [Array.prototype.concat ( ...arguments )](http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat)
|
105
|
+
*/
|
106
|
+
const concatArrays = (merged, source, config) => {
|
107
|
+
let result = merged.slice(0, 0);
|
108
|
+
let resultIndex = 0;
|
109
|
+
|
110
|
+
[merged, source].forEach(array => {
|
111
|
+
const indices = [];
|
112
|
+
|
113
|
+
// `result.concat(array)` with cloning
|
114
|
+
for (let k = 0; k < array.length; k++) {
|
115
|
+
if (!hasOwnProperty.call(array, k)) {
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
|
119
|
+
indices.push(String(k));
|
120
|
+
|
121
|
+
if (array === merged) {
|
122
|
+
// Already cloned
|
123
|
+
defineProperty(result, resultIndex++, array[k]);
|
124
|
+
} else {
|
125
|
+
defineProperty(result, resultIndex++, clone(array[k]));
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
// Merge non-index keys
|
130
|
+
result = mergeKeys(result, array, getEnumerableOwnPropertyKeys(array).filter(key => !indices.includes(key)), config);
|
131
|
+
});
|
132
|
+
|
133
|
+
return result;
|
134
|
+
};
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @param {*} merged already cloned
|
138
|
+
* @param {*} source something to merge
|
139
|
+
* @param {Object} config Config Object
|
140
|
+
* @returns {*} cloned Object
|
141
|
+
*/
|
142
|
+
function merge(merged, source, config) {
|
143
|
+
if (config.concatArrays && Array.isArray(merged) && Array.isArray(source)) {
|
144
|
+
return concatArrays(merged, source, config);
|
145
|
+
}
|
146
|
+
|
147
|
+
if (!isOptionObject(source) || !isOptionObject(merged)) {
|
148
|
+
return clone(source);
|
149
|
+
}
|
150
|
+
|
151
|
+
return mergeKeys(merged, source, getEnumerableOwnPropertyKeys(source), config);
|
152
|
+
}
|
153
|
+
|
154
|
+
module.exports = function (...options) {
|
155
|
+
const config = merge(clone(defaultMergeOptions), (this !== globalThis && this) || {}, defaultMergeOptions);
|
156
|
+
let merged = {_: {}};
|
157
|
+
|
158
|
+
for (const option of options) {
|
159
|
+
if (option === undefined) {
|
160
|
+
continue;
|
161
|
+
}
|
162
|
+
|
163
|
+
if (!isOptionObject(option)) {
|
164
|
+
throw new TypeError('`' + option + '` is not an Option Object');
|
165
|
+
}
|
166
|
+
|
167
|
+
merged = merge(merged, {_: option}, config);
|
168
|
+
}
|
169
|
+
|
170
|
+
return merged._;
|
171
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) Michael Mayer <michael@schnittstabil.de>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
Check if a value is a plain object.
|
3
|
+
|
4
|
+
An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
5
|
+
|
6
|
+
@example
|
7
|
+
```
|
8
|
+
import isPlainObject = require('is-plain-obj');
|
9
|
+
|
10
|
+
isPlainObject({foo: 'bar'});
|
11
|
+
//=> true
|
12
|
+
|
13
|
+
isPlainObject(new Object());
|
14
|
+
//=> true
|
15
|
+
|
16
|
+
isPlainObject(Object.create(null));
|
17
|
+
//=> true
|
18
|
+
|
19
|
+
isPlainObject([1, 2, 3]);
|
20
|
+
//=> false
|
21
|
+
|
22
|
+
class Unicorn {}
|
23
|
+
isPlainObject(new Unicorn());
|
24
|
+
//=> false
|
25
|
+
```
|
26
|
+
*/
|
27
|
+
declare function isPlainObj(value: unknown): value is object;
|
28
|
+
|
29
|
+
export = isPlainObj;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"name": "is-plain-obj",
|
3
|
+
"version": "2.1.0",
|
4
|
+
"description": "Check if a value is a plain object",
|
5
|
+
"license": "MIT",
|
6
|
+
"repository": "sindresorhus/is-plain-obj",
|
7
|
+
"author": {
|
8
|
+
"name": "Sindre Sorhus",
|
9
|
+
"email": "sindresorhus@gmail.com",
|
10
|
+
"url": "sindresorhus.com"
|
11
|
+
},
|
12
|
+
"engines": {
|
13
|
+
"node": ">=8"
|
14
|
+
},
|
15
|
+
"scripts": {
|
16
|
+
"test": "xo && ava && tsd"
|
17
|
+
},
|
18
|
+
"files": [
|
19
|
+
"index.js",
|
20
|
+
"index.d.ts"
|
21
|
+
],
|
22
|
+
"keywords": [
|
23
|
+
"object",
|
24
|
+
"is",
|
25
|
+
"check",
|
26
|
+
"test",
|
27
|
+
"type",
|
28
|
+
"plain",
|
29
|
+
"vanilla",
|
30
|
+
"pure",
|
31
|
+
"simple"
|
32
|
+
],
|
33
|
+
"devDependencies": {
|
34
|
+
"ava": "^1.4.1",
|
35
|
+
"tsd": "^0.7.2",
|
36
|
+
"xo": "^0.24.0"
|
37
|
+
}
|
38
|
+
}
|