@nxtedition/rocksdb 7.1.13 → 7.1.14

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.
Files changed (4) hide show
  1. package/binding.cc +1 -0
  2. package/index.js +2 -0
  3. package/package.json +1 -1
  4. package/util.h +14 -12
package/binding.cc CHANGED
@@ -696,6 +696,7 @@ NAPI_METHOD(db_open) {
696
696
  NAPI_STATUS_THROWS(GetProperty(env, options, "createIfMissing", dbOptions.create_if_missing));
697
697
  NAPI_STATUS_THROWS(GetProperty(env, options, "errorIfExists", dbOptions.error_if_exists));
698
698
  NAPI_STATUS_THROWS(GetProperty(env, options, "unorderedWrite", dbOptions.unordered_write));
699
+ NAPI_STATUS_THROWS(GetProperty(env, options, "pipelinedWrite", dbOptions.enable_pipelined_write));
699
700
 
700
701
  // TODO (feat): dbOptions.listeners
701
702
 
package/index.js CHANGED
@@ -311,7 +311,9 @@ class RocksLevel extends AbstractLevel {
311
311
  options = {
312
312
  since: options?.since ?? 0,
313
313
  keys: options?.keys ?? true,
314
+ keyEncoding: options?.keyEncoding,
314
315
  values: options?.values ?? true,
316
+ valueEncoding: options?.valueEncoding,
315
317
  data: options?.data ?? true,
316
318
  live: options?.live ?? false,
317
319
  column: options?.column ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "7.1.13",
3
+ "version": "7.1.14",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
package/util.h CHANGED
@@ -231,6 +231,17 @@ static napi_status GetProperty(napi_env env,
231
231
  const std::string_view& key,
232
232
  T& result,
233
233
  bool required = false) {
234
+ napi_valuetype objType;
235
+ NAPI_STATUS_RETURN(napi_typeof(env, obj, &objType));
236
+
237
+ if (objType == napi_undefined || objType == napi_null) {
238
+ return napi_ok;
239
+ }
240
+
241
+ if (objType != napi_object) {
242
+ return napi_invalid_arg;
243
+ }
244
+
234
245
  bool has = false;
235
246
  NAPI_STATUS_RETURN(napi_has_named_property(env, obj, key.data(), &has));
236
247
 
@@ -241,19 +252,10 @@ static napi_status GetProperty(napi_env env,
241
252
  napi_value value;
242
253
  NAPI_STATUS_RETURN(napi_get_named_property(env, obj, key.data(), &value));
243
254
 
244
- bool nully = false;
245
-
246
- napi_value nullVal;
247
- NAPI_STATUS_RETURN(napi_get_null(env, &nullVal));
248
- NAPI_STATUS_RETURN(napi_strict_equals(env, nullVal, value, &nully));
249
- if (nully) {
250
- return required ? napi_invalid_arg : napi_ok;
251
- }
255
+ napi_valuetype valueType;
256
+ NAPI_STATUS_RETURN(napi_typeof(env, value, &valueType));
252
257
 
253
- napi_value undefinedVal;
254
- NAPI_STATUS_RETURN(napi_get_undefined(env, &undefinedVal));
255
- NAPI_STATUS_RETURN(napi_strict_equals(env, undefinedVal, value, &nully));
256
- if (nully) {
258
+ if (valueType == napi_null || valueType == napi_undefined) {
257
259
  return required ? napi_invalid_arg : napi_ok;
258
260
  }
259
261