diff --git a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h index 545a0f6bced5af6a8672b848cbe62ddaa6b4180f..437ae6c61e1c564324f5923c760fface98572c47 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h @@ -40,6 +40,7 @@ public: void SetNative(std::shared_ptr& kvStore); void SetUvQueue(std::shared_ptr uvQueue); + void SetSchemaInfo(bool isSchemaStore); std::shared_ptr& GetNative(); static bool IsInstanceOf(napi_env env, napi_value obj, const std::string& storeId, napi_value constructor); @@ -57,14 +58,21 @@ public: static napi_value EnableSync(napi_env env, napi_callback_info info); static napi_value SetSyncRange(napi_env env, napi_callback_info info); +protected: + bool IsSchemaStore() const; + private: class DataObserver : public DistributedKv::KvStoreObserver, public JSObserver { public: - DataObserver(std::shared_ptr uvQueue, napi_value callback) : JSObserver(uvQueue, callback) {}; + DataObserver(std::shared_ptr uvQueue, napi_value callback, bool schema) + : JSObserver(uvQueue, callback), isSchema_(schema) {}; virtual ~DataObserver() = default; void OnChange(const DistributedKv::ChangeNotification& notification, std::shared_ptr snapshot) override; void OnChange(const DistributedKv::ChangeNotification& notification) override; + + private: + bool isSchema_ = false; }; class SyncObserver : public DistributedKv::KvStoreSyncCallback, public JSObserver { @@ -91,6 +99,7 @@ private: /* private non-static members */ std::shared_ptr kvStore_ = nullptr; std::string storeId_; + bool isSchemaStore_ = false; using Exec = std::function)>; static std::map onEventHandlers_; diff --git a/frameworks/jskitsimpl/distributeddata/include/js_kv_store_resultset.h b/frameworks/jskitsimpl/distributeddata/include/js_kv_store_resultset.h index 19d042a49bb3decee95b326d0b56b789c44dc2d2..b421c96e02cca33a365070e4c5c37928b27cd7be 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_kv_store_resultset.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_kv_store_resultset.h @@ -25,6 +25,7 @@ public: ~JsKVStoreResultSet() = default; void SetNative(std::shared_ptr& resultSet); + void SetSchema(bool isSchema); std::shared_ptr& GetNative(); static napi_value Constructor(napi_env env); @@ -45,6 +46,7 @@ private: static napi_value GetEntry(napi_env env, napi_callback_info info); std::shared_ptr resultSet_ = nullptr; + bool isSchema_ = false; }; } #endif // OHOS_KV_STORE_RESELTSET_H diff --git a/frameworks/jskitsimpl/distributeddata/include/js_util.h b/frameworks/jskitsimpl/distributeddata/include/js_util.h index e1c593439d6b230dfae870f85c1a21a34b8df5c3..69c9b6fde74e044740ea7f88d824728cd1463960 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_util.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_util.h @@ -108,24 +108,24 @@ public: static napi_status SetValue(napi_env env, const std::vector& in, napi_value& out); /* napi_value <-> ChangeNotification */ - static napi_status GetValue(napi_env env, napi_value in, ChangeNotification& out); - static napi_status SetValue(napi_env env, const ChangeNotification& in, napi_value& out); + static napi_status GetValue(napi_env env, napi_value in, ChangeNotification& out, bool hasSchema); + static napi_status SetValue(napi_env env, const ChangeNotification& in, napi_value& out, bool hasSchema); /* napi_value <-> Options */ static napi_status GetValue(napi_env env, napi_value in, Options& out); static napi_status SetValue(napi_env env, const Options& in, napi_value& out); /* napi_value <-> Entry */ - static napi_status GetValue(napi_env env, napi_value in, Entry& out); - static napi_status SetValue(napi_env env, const Entry& in, napi_value& out); + static napi_status GetValue(napi_env env, napi_value in, Entry& out, bool hasSchema); + static napi_status SetValue(napi_env env, const Entry& in, napi_value& out, bool hasSchema); /* napi_value <-> Options */ - static napi_status GetValue(napi_env env, napi_value in, std::list& out); - static napi_status SetValue(napi_env env, const std::list& in, napi_value& out); + static napi_status GetValue(napi_env env, napi_value in, std::list& out, bool hasSchema); + static napi_status SetValue(napi_env env, const std::list& in, napi_value& out, bool hasSchema); /* napi_value <-> std::vector */ - static napi_status GetValue(napi_env env, napi_value in, std::vector& out); - static napi_status SetValue(napi_env env, const std::vector& in, napi_value& out); + static napi_status GetValue(napi_env env, napi_value in, std::vector& out, bool hasSchema); + static napi_status SetValue(napi_env env, const std::vector& in, napi_value& out, bool hasSchema); /* napi_value <-> std::vector */ static napi_status GetValue(napi_env env, napi_value in, std::vector& out); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp index 15e513ff39b18620547a3a0bade600735fd437d9..14ac0dbed8c7b64ba2a9c9deaee4b53bdea3af5a 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp @@ -99,9 +99,10 @@ napi_value JsDeviceKVStore::Get(napi_env env, napi_callback_info info) OHOS::DistributedKv::Key key(deviceKey); OHOS::DistributedKv::Value value; auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); - Status status = kvStore->Get(deviceKey, value); + bool isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); + Status status = kvStore->Get(key, value); ZLOGD("kvStore->Get return %{public}d", status); - ctxt->value = JSUtil::Blob2VariantValue(value); + ctxt->value = isSchemaStore ? value.ToString() : JSUtil::Blob2VariantValue(value); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS(ctxt, "kvStore->Get() failed!"); }; @@ -207,7 +208,8 @@ napi_value JsDeviceKVStore::GetEntries(napi_env env, napi_callback_info info) CHECK_STATUS(ctxt, "kvStore->GetEntries() failed!"); }; auto output = [env, ctxt](napi_value& result) { - ctxt->status = JSUtil::SetValue(env, ctxt->entries, result); + auto isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); + ctxt->status = JSUtil::SetValue(env, ctxt->entries, result, isSchemaStore); CHECK_STATUS(ctxt, "output failed!"); }; return NapiQueue::AsyncWork(env, ctxt, std::string(__FUNCTION__), execute, output); @@ -264,6 +266,8 @@ napi_value JsDeviceKVStore::GetResultSet(napi_env env, napi_callback_info info) ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS(ctxt, "kvStore->GetResultSet() failed!"); ctxt->resultSet->SetNative(kvResultSet); + bool isSchema = reinterpret_cast(ctxt->native)->IsSchemaStore(); + ctxt->resultSet->SetSchema(isSchema); }; auto output = [env, ctxt](napi_value& result) { ctxt->status = napi_get_reference_value(env, ctxt->ref, &result); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp index 36eaf5ac25a9ad3b3edcb38ae90c9413b8d66bae..355b20f1b4a43cd199ef15e35729991575799589 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp @@ -131,6 +131,7 @@ napi_value JsKVManager::GetKVStore(napi_env env, napi_callback_info info) CHECK_STATUS(ctxt, "KVManager->GetSingleKvStore() failed!"); ctxt->kvStore->SetNative(kvStore); ctxt->kvStore->SetUvQueue(kvm->uvQueue_); + ctxt->kvStore->SetSchemaInfo(!ctxt->options.schema.empty()); }; auto output = [env, ctxt](napi_value& result) { ctxt->status = napi_get_reference_value(env, ctxt->ref, &result); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp index 8e1e034adf7a2779075eb08c59cbff78e5f60c04..03155e90e69deb12af3f8c20e077fa5459a6faff 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store.cpp @@ -106,7 +106,7 @@ napi_value JsKVStore::Put(napi_env env, napi_callback_info info) ZLOGD("KVStore::Put()"); struct PutContext : public ContextBase { std::string key; - std::vector value; + JSUtil::KvStoreVariant value; }; auto ctxt = std::make_shared(); @@ -116,17 +116,16 @@ napi_value JsKVStore::Put(napi_env env, napi_callback_info info) CHECK_ARGS(ctxt, argc == 2, "invalid arguments!"); ctxt->status = JSUtil::GetValue(env, argv[0], ctxt->key); CHECK_STATUS(ctxt, "invalid arg[0], i.e. invalid key!"); - JSUtil::KvStoreVariant vv; - ctxt->status = JSUtil::GetValue(env, argv[1], vv); + ctxt->status = JSUtil::GetValue(env, argv[1], ctxt->value); CHECK_STATUS(ctxt, "invalid arg[1], i.e. invalid value!"); - DistributedKv::Blob blob = JSUtil::VariantValue2Blob(vv); - ctxt->value = blob.Data(); }); auto execute = [ctxt]() { OHOS::DistributedKv::Key key(ctxt->key); - OHOS::DistributedKv::Value value(ctxt->value); + bool isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); auto& kvStore = reinterpret_cast(ctxt->native)->kvStore_; + OHOS::DistributedKv::Value value = isSchemaStore ? DistributedKv::Blob(std::get(ctxt->value)) + : JSUtil::VariantValue2Blob(ctxt->value); Status status = kvStore->Put(key, value); ZLOGD("kvStore->Put return %{public}d", status); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -236,7 +235,8 @@ napi_value JsKVStore::PutBatch(napi_env env, napi_callback_info info) ctxt->GetCbInfo(env, info, [env, ctxt](size_t argc, napi_value* argv) { // required 1 arguments :: CHECK_ARGS(ctxt, argc == 1, "invalid arguments!"); - ctxt->status = JSUtil::GetValue(env, argv[0], ctxt->entries); + auto isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); + ctxt->status = JSUtil::GetValue(env, argv[0], ctxt->entries, isSchemaStore); CHECK_STATUS(ctxt, "invalid arg[0], i.e. invalid entries!"); }); @@ -447,7 +447,7 @@ void JsKVStore::OnDataChange(napi_env env, size_t argc, napi_value* argv, std::s } } - ctxt->status = proxy->Subscribe(type, std::make_shared(proxy->uvQueue_, argv[1])); + ctxt->status = proxy->Subscribe(type, std::make_shared(proxy->uvQueue_, argv[1], proxy->IsSchemaStore())); CHECK_STATUS(ctxt, "Subscribe failed!"); } @@ -612,6 +612,16 @@ void JsKVStore::SetUvQueue(std::shared_ptr uvQueue) uvQueue_ = uvQueue; } +bool JsKVStore::IsSchemaStore() const +{ + return isSchemaStore_; +} + +void JsKVStore::SetSchemaInfo(bool isSchemaStore) +{ + isSchemaStore_ = isSchemaStore; +} + void JsKVStore::DataObserver::OnChange(const ChangeNotification ¬ification, std::shared_ptr snapshot) { @@ -627,10 +637,10 @@ void JsKVStore::DataObserver::OnChange(const ChangeNotification& notification) notification.GetDeleteEntries().size()); KvStoreObserver::OnChange(notification); - auto args = [notification](napi_env env, int& argc, napi_value* argv) { + auto args = [notification, isSchema = isSchema_](napi_env env, int& argc, napi_value* argv) { // generate 1 arguments for callback function. argc = 1; - JSUtil::SetValue(env, notification, argv[0]); + JSUtil::SetValue(env, notification, argv[0], isSchema); }; AsyncCall(args); } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp index c3c5e76ce064394615a91028b4f95123398c512e..82e5b719dbee665812eb522348cbfbbf7adc6434 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp @@ -262,13 +262,19 @@ napi_value JsKVStoreResultSet::GetEntry(napi_env env, napi_callback_info info) / DistributedKv::Entry entry; auto& resultSet = reinterpret_cast(ctxt->native)->resultSet_; + bool isSchema = reinterpret_cast(ctxt->native)->isSchema_; auto status = resultSet->GetEntry(entry); if (status != Status::SUCCESS) { return nullptr; } - ctxt->status = JSUtil::SetValue(env, entry, ctxt->output); + ctxt->status = JSUtil::SetValue(env, entry, ctxt->output, isSchema); NAPI_ASSERT(env, ctxt->status == napi_ok, "GetEntry failed!"); return ctxt->output; } + +void JsKVStoreResultSet::SetSchema(bool isSchema) +{ + isSchema_ = isSchema; +} } // \ No newline at end of file diff --git a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp index 71f2fc1f3a0ef0fd6b45e70a6c99f5223828589f..ea8274dd9e98f8d688d5fe08cb7ad655c692181f 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp @@ -87,9 +87,10 @@ napi_value JsSingleKVStore::Get(napi_env env, napi_callback_info info) OHOS::DistributedKv::Key key(ctxt->key); OHOS::DistributedKv::Value value; auto& kvStore = reinterpret_cast(ctxt->native)->GetNative(); + bool isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); Status status = kvStore->Get(key, value); ZLOGD("kvStore->Get return %{public}d", status); - ctxt->value = JSUtil::Blob2VariantValue(value); + ctxt->value = isSchemaStore ? value.ToString() : JSUtil::Blob2VariantValue(value); ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS(ctxt, "kvStore->Get() failed!"); }; @@ -172,7 +173,8 @@ napi_value JsSingleKVStore::GetEntries(napi_env env, napi_callback_info info) CHECK_STATUS(ctxt, "kvStore->GetEntries() failed"); }; auto output = [env, ctxt](napi_value& result) { - ctxt->status = JSUtil::SetValue(env, ctxt->entries, result); + auto isSchemaStore = reinterpret_cast(ctxt->native)->IsSchemaStore(); + ctxt->status = JSUtil::SetValue(env, ctxt->entries, result, isSchemaStore); CHECK_STATUS(ctxt, "output failed!"); }; return NapiQueue::AsyncWork(env, ctxt, std::string(__FUNCTION__), execute, output); @@ -223,6 +225,8 @@ napi_value JsSingleKVStore::GetResultSet(napi_env env, napi_callback_info info) ctxt->status = (status == Status::SUCCESS) ? napi_ok : napi_generic_failure; CHECK_STATUS(ctxt, "kvStore->GetResultSet() failed!"); ctxt->resultSet->SetNative(kvResultSet); + bool isSchema = reinterpret_cast(ctxt->native)->IsSchemaStore(); + ctxt->resultSet->SetSchema(isSchema); }; auto output = [env, ctxt](napi_value& result) { ctxt->status = napi_get_reference_value(env, ctxt->ref, &result); diff --git a/frameworks/jskitsimpl/distributeddata/src/js_util.cpp b/frameworks/jskitsimpl/distributeddata/src/js_util.cpp index 30addf604f08a3b3b678988e355c7665a02d3852..035ff0f5454811b320fe84854ea97c15216ef1ff 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_util.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_util.cpp @@ -178,6 +178,8 @@ JSUtil::KvStoreVariant JSUtil::Blob2VariantValue(const DistributedKv::Blob& blob } else if (data[0] == JSUtil::DOUBLE) { uint64_t tmp4dbl = be64toh(*reinterpret_cast(&(real[0]))); return JSUtil::KvStoreVariant(*reinterpret_cast((void*)(&tmp4dbl))); + } else if (data[0] == JSUtil::STRING) { + return JSUtil::KvStoreVariant(std::string(real.begin(), real.end())); } else { // for schema-db, if (data[0] == JSUtil::STRING), no beginning byte! return JSUtil::KvStoreVariant(std::string(data.begin(), data.end())); @@ -189,7 +191,7 @@ DistributedKv::Blob JSUtil::VariantValue2Blob(const JSUtil::KvStoreVariant& valu std::vector data; auto strValue = std::get_if(&value); if (strValue != nullptr) { - // for schema-db, string, no beginning byte! + data.push_back(JSUtil::STRING); data.assign((*strValue).begin(), (*strValue).end()); } auto u8ArrayValue = std::get_if>(&value); @@ -645,7 +647,7 @@ napi_status JSUtil::SetValue(napi_env env, const std::map DistributedKv::Entry */ -napi_status JSUtil::GetValue(napi_env env, napi_value in, DistributedKv::Entry& out) +napi_status JSUtil::GetValue(napi_env env, napi_value in, DistributedKv::Entry& out, bool hasSchema) { ZLOGD("napi_value -> DistributedKv::Entry "); napi_value propKey = nullptr; @@ -674,14 +676,18 @@ napi_status JSUtil::GetValue(napi_env env, napi_value in, DistributedKv::Entry& status = GetValue(env, propVValue, value); CHECK_RETURN((status == napi_ok), "no value of value.value", status); - out.value = JSUtil::VariantValue2Blob(value); + if (hasSchema) { + out.value = std::get(value); + } else { + out.value = JSUtil::VariantValue2Blob(value); + } if (type != out.value[0]) { ZLOGE("unmarch type[%{public}d] to value.type[%{public}d]", (int)type, (int)out.value[0]); } return status; } -napi_status JSUtil::SetValue(napi_env env, const DistributedKv::Entry& in, napi_value& out) +napi_status JSUtil::SetValue(napi_env env, const DistributedKv::Entry& in, napi_value& out, bool hasSchema) { ZLOGD("napi_value <- DistributedKv::Entry "); napi_status status = napi_create_object(env, &out); @@ -702,7 +708,11 @@ napi_status JSUtil::SetValue(napi_env env, const DistributedKv::Entry& in, napi_ napi_set_named_property(env, value, "type", vType); napi_value vValue = nullptr; - status = SetValue(env, Blob2VariantValue(in.value), vValue); // Blob + if (hasSchema) { + status = SetValue(env, in.value.ToString(), vValue); + } else { + status = SetValue(env, Blob2VariantValue(in.value), vValue); // Blob + } CHECK_RETURN((status == napi_ok), "invalid entry value", status); napi_set_named_property(env, value, "value", vValue); @@ -711,7 +721,7 @@ napi_status JSUtil::SetValue(napi_env env, const DistributedKv::Entry& in, napi_ } /* napi_value <-> std::list */ -napi_status JSUtil::GetValue(napi_env env, napi_value in, std::list& out) +napi_status JSUtil::GetValue(napi_env env, napi_value in, std::list& out, bool hasSchema) { ZLOGD("napi_value -> std::list "); bool isArray = false; @@ -729,13 +739,13 @@ napi_status JSUtil::GetValue(napi_env env, napi_value in, std::list& in, napi_value& out) +napi_status JSUtil::SetValue(napi_env env, const std::list& in, napi_value& out, bool hasSchema) { ZLOGD("napi_value <- std::list %{public}u", static_cast(in.size())); napi_status status = napi_create_array_with_length(env, in.size(), &out); @@ -743,14 +753,14 @@ napi_status JSUtil::SetValue(napi_env env, const std::list int index = 0; for (const auto& item : in) { napi_value entry = nullptr; - SetValue(env, item, entry); + SetValue(env, item, entry, hasSchema); napi_set_element(env, out, index++, entry); } return status; } /* napi_value <-> std::vector */ -napi_status JSUtil::GetValue(napi_env env, napi_value in, std::vector& out) +napi_status JSUtil::GetValue(napi_env env, napi_value in, std::vector& out, bool hasSchema) { out.clear(); ZLOGD("napi_value -> std::vector "); @@ -769,13 +779,13 @@ napi_status JSUtil::GetValue(napi_env env, napi_value in, std::vector& in, napi_value& out) +napi_status JSUtil::SetValue(napi_env env, const std::vector& in, napi_value& out, bool hasSchema) { ZLOGD("napi_value <- std::vector %{public}u", static_cast(in.size())); napi_status status = napi_create_array_with_length(env, in.size(), &out); @@ -783,7 +793,7 @@ napi_status JSUtil::SetValue(napi_env env, const std::vector DistributedKv::ChangeNotification */ -napi_status JSUtil::GetValue(napi_env env, napi_value in, DistributedKv::ChangeNotification& out) +napi_status JSUtil::GetValue(napi_env env, napi_value in, DistributedKv::ChangeNotification& out, bool hasSchema) { ZLOGD("napi_value -> DistributedKv::ChangeNotification "); (void)(env); (void)(in); (void)(out); + (void)(hasSchema); CHECK_RETURN(false, "DistributedKv::ChangeNotification from napi_value, unsupported!", napi_invalid_arg); return napi_invalid_arg; } -napi_status JSUtil::SetValue(napi_env env, const DistributedKv::ChangeNotification& in, napi_value& out) +napi_status JSUtil::SetValue(napi_env env, const DistributedKv::ChangeNotification& in, napi_value& out, bool hasSchema) { ZLOGD("napi_value <- DistributedKv::ChangeNotification "); napi_status status = napi_create_object(env, &out); @@ -853,19 +864,19 @@ napi_status JSUtil::SetValue(napi_env env, const DistributedKv::ChangeNotificati CHECK_RETURN((status == napi_ok), "set_named_property deviceId failed!", status); napi_value insertEntries = nullptr; - status = SetValue(env, in.GetInsertEntries(), insertEntries); + status = SetValue(env, in.GetInsertEntries(), insertEntries, hasSchema); CHECK_RETURN((status == napi_ok) || (insertEntries == nullptr), "GetInsertEntries failed!", status); status = napi_set_named_property(env, out, "insertEntries", insertEntries); CHECK_RETURN((status == napi_ok), "set_named_property insertEntries failed!", status); napi_value updateEntries = nullptr; - status = SetValue(env, in.GetUpdateEntries(), updateEntries); + status = SetValue(env, in.GetUpdateEntries(), updateEntries, hasSchema); CHECK_RETURN((status == napi_ok) || (updateEntries == nullptr), "GetUpdateEntries failed!", status); status = napi_set_named_property(env, out, "updateEntries", updateEntries); CHECK_RETURN((status == napi_ok), "set_named_property updateEntries failed!", status); napi_value deleteEntries = nullptr; - status = SetValue(env, in.GetDeleteEntries(), deleteEntries); + status = SetValue(env, in.GetDeleteEntries(), deleteEntries, hasSchema); CHECK_RETURN((status == napi_ok) || (deleteEntries == nullptr), "GetDeleteEntries failed!", status); status = napi_set_named_property(env, out, "deleteEntries", deleteEntries); CHECK_RETURN((status == napi_ok), "set_named_property deleteEntries failed!", status);