@harperfast/rocksdb-js 2.6.0 → 2.6.1

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/dist/index.mjs CHANGED
@@ -1213,9 +1213,10 @@ const MAX_KEY_SIZE = 1024 * 1024;
1213
1213
  const SAVE_BUFFER_SIZE = 8192;
1214
1214
  /**
1215
1215
  * Normalizes the public `compression` option into the primitive fields the
1216
- * native layer expects. When `option` is omitted, returns an empty object and
1217
- * lets the native layer apply the default (LZ4 when the build supports it, else
1218
- * RocksDB's own default). Throws a `TypeError` for a malformed option and an
1216
+ * native layer expects. When `option` is omitted, or is an object without an
1217
+ * `algorithm`, returns an empty object and lets the native layer apply the
1218
+ * default (LZ4 when the build supports it, else RocksDB's own default).
1219
+ * Throws a `TypeError` for a malformed option and an
1219
1220
  * `Error` for an algorithm that isn't supported by this build.
1220
1221
  */
1221
1222
  function normalizeCompression(option) {
@@ -1223,7 +1224,11 @@ function normalizeCompression(option) {
1223
1224
  let algorithm;
1224
1225
  let level;
1225
1226
  if (typeof option === "string") algorithm = option;
1226
- else if (typeof option === "object" && option.algorithm !== void 0) {
1227
+ else if (typeof option === "object" && !Array.isArray(option)) {
1228
+ if (option.algorithm === void 0 || option.algorithm === null) {
1229
+ if (option.level !== void 0 && option.level !== null) throw new TypeError("Compression level cannot be specified without an algorithm");
1230
+ return {};
1231
+ }
1227
1232
  algorithm = option.algorithm;
1228
1233
  if (option.level !== void 0 && option.level !== null) {
1229
1234
  const raw = option.level;
@@ -3012,7 +3017,7 @@ function loadLastPosition(transactionLog, readUncommitted) {
3012
3017
  //#region src/index.ts
3013
3018
  const versions = {
3014
3019
  rocksdb: version,
3015
- "rocksdb-js": "2.6.0"
3020
+ "rocksdb-js": "2.6.1"
3016
3021
  };
3017
3022
 
3018
3023
  //#endregion