@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.cjs CHANGED
@@ -1238,9 +1238,10 @@ const MAX_KEY_SIZE = 1024 * 1024;
1238
1238
  const SAVE_BUFFER_SIZE = 8192;
1239
1239
  /**
1240
1240
  * Normalizes the public `compression` option into the primitive fields the
1241
- * native layer expects. When `option` is omitted, returns an empty object and
1242
- * lets the native layer apply the default (LZ4 when the build supports it, else
1243
- * RocksDB's own default). Throws a `TypeError` for a malformed option and an
1241
+ * native layer expects. When `option` is omitted, or is an object without an
1242
+ * `algorithm`, returns an empty object and lets the native layer apply the
1243
+ * default (LZ4 when the build supports it, else RocksDB's own default).
1244
+ * Throws a `TypeError` for a malformed option and an
1244
1245
  * `Error` for an algorithm that isn't supported by this build.
1245
1246
  */
1246
1247
  function normalizeCompression(option) {
@@ -1248,7 +1249,11 @@ function normalizeCompression(option) {
1248
1249
  let algorithm;
1249
1250
  let level;
1250
1251
  if (typeof option === "string") algorithm = option;
1251
- else if (typeof option === "object" && option.algorithm !== void 0) {
1252
+ else if (typeof option === "object" && !Array.isArray(option)) {
1253
+ if (option.algorithm === void 0 || option.algorithm === null) {
1254
+ if (option.level !== void 0 && option.level !== null) throw new TypeError("Compression level cannot be specified without an algorithm");
1255
+ return {};
1256
+ }
1252
1257
  algorithm = option.algorithm;
1253
1258
  if (option.level !== void 0 && option.level !== null) {
1254
1259
  const raw = option.level;
@@ -3037,7 +3042,7 @@ function loadLastPosition(transactionLog, readUncommitted) {
3037
3042
  //#region src/index.ts
3038
3043
  const versions = {
3039
3044
  rocksdb: version,
3040
- "rocksdb-js": "2.6.0"
3045
+ "rocksdb-js": "2.6.1"
3041
3046
  };
3042
3047
 
3043
3048
  //#endregion