@harperfast/harper-pro 5.0.23 → 5.0.24

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "harper",
3
- "version": "5.0.23",
3
+ "version": "5.0.24",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "harper",
9
- "version": "5.0.23",
9
+ "version": "5.0.24",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-s3": "^3.1012.0",
@@ -53,7 +53,7 @@
53
53
  "json-bigint-fixes": "1.1.0",
54
54
  "jsonata": "1.8.7",
55
55
  "jsonwebtoken": "9.0.3",
56
- "lmdb": "3.5.4",
56
+ "lmdb": "3.5.5",
57
57
  "lodash": "^4.17.23",
58
58
  "mathjs": "11.12.0",
59
59
  "micromatch": "^4.0.8",
@@ -2619,9 +2619,9 @@
2619
2619
  }
2620
2620
  },
2621
2621
  "node_modules/@lmdb/lmdb-darwin-arm64": {
2622
- "version": "3.5.4",
2623
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.5.4.tgz",
2624
- "integrity": "sha512-Kk4Kz3iyu1QiLsLZBS9Af1eSKUC8VR2T+/jyE2iAyuGw2VwK08pp5iTbZnXn6sWu0LogO/RFktMxOjiDA2sS3w==",
2622
+ "version": "3.5.5",
2623
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-3.5.5.tgz",
2624
+ "integrity": "sha512-hcSIUgSblRtwEuPzV/88cTbEPxaWfxVSrTaMIVUreyAA02ysE3S9tsiQdmT7KNmUaXlwgRGs+x+GaVDCuk7Prg==",
2625
2625
  "cpu": [
2626
2626
  "arm64"
2627
2627
  ],
@@ -2632,9 +2632,9 @@
2632
2632
  ]
2633
2633
  },
2634
2634
  "node_modules/@lmdb/lmdb-darwin-x64": {
2635
- "version": "3.5.4",
2636
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-3.5.4.tgz",
2637
- "integrity": "sha512-BEe5Rp3trn26oxoXOVL5HVDoiYmjUDwr8NRPkBOdUdCSBEorKI+7JrZLRKAdxO+G6cGQLgseXk0gR7qIQa7aGw==",
2635
+ "version": "3.5.5",
2636
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-3.5.5.tgz",
2637
+ "integrity": "sha512-cLlp9ypk3W9Hr4fuTYwg1kL2vPfz887v9NXiHQE1raSKtJ8/hnghekqUu62wUQdQPgThLV8Om+Ran08wWuM/3w==",
2638
2638
  "cpu": [
2639
2639
  "x64"
2640
2640
  ],
@@ -2645,9 +2645,9 @@
2645
2645
  ]
2646
2646
  },
2647
2647
  "node_modules/@lmdb/lmdb-linux-arm": {
2648
- "version": "3.5.4",
2649
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-3.5.4.tgz",
2650
- "integrity": "sha512-SGbFR7816uBcTHc2ZY4S6WyOkl9bICnzqTQd2Mv4V/j24cfds88xx2nC6cm/y8zGQL7Ds31YF/5NGxjgcdM5Hw==",
2648
+ "version": "3.5.5",
2649
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-3.5.5.tgz",
2650
+ "integrity": "sha512-eDeK9vZww0dIXlRCZa7pvbEXSUpUNIJKUs13FxDzazL8CRLDLggbeirm5m0hZvJcRgZzTYGESE8UUEBqHcdZ9Q==",
2651
2651
  "cpu": [
2652
2652
  "arm"
2653
2653
  ],
@@ -2658,9 +2658,9 @@
2658
2658
  ]
2659
2659
  },
2660
2660
  "node_modules/@lmdb/lmdb-linux-arm64": {
2661
- "version": "3.5.4",
2662
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-3.5.4.tgz",
2663
- "integrity": "sha512-cUXEengO8o60v1SWerJTH4/RH4U3+9jC0/4njp2Z9NdmvaGzhKsbRM2wpXuRYrN8tytsoJCg0SvWEWwHAwLbCA==",
2661
+ "version": "3.5.5",
2662
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-3.5.5.tgz",
2663
+ "integrity": "sha512-tn8KSYdvX5sietpuGyJJSXocvQQtWlenzquap/Mzr+wWx5jrjK5I3nEAIMFxvTtuMMrpPTGHGNuE/Hanh3o0EQ==",
2664
2664
  "cpu": [
2665
2665
  "arm64"
2666
2666
  ],
@@ -2671,9 +2671,9 @@
2671
2671
  ]
2672
2672
  },
2673
2673
  "node_modules/@lmdb/lmdb-linux-x64": {
2674
- "version": "3.5.4",
2675
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-3.5.4.tgz",
2676
- "integrity": "sha512-Gxq8jpgOWXwd0PUR+c9R2Ik1/uBnGd5GMIIzRRDqABCkvmjtC3KWcyhesV9jSPCz759isl0NlbsstZ2oyvk8lA==",
2674
+ "version": "3.5.5",
2675
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-3.5.5.tgz",
2676
+ "integrity": "sha512-o6VRcJjZ6Zc67MnymLEa3AtbYSreFzm6Um6LMHh4lkynlE5Qk/XUHXU2beTZBdB3QuZBiMoXO2gjPSgP0tYUKg==",
2677
2677
  "cpu": [
2678
2678
  "x64"
2679
2679
  ],
@@ -2684,9 +2684,9 @@
2684
2684
  ]
2685
2685
  },
2686
2686
  "node_modules/@lmdb/lmdb-win32-arm64": {
2687
- "version": "3.5.4",
2688
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-arm64/-/lmdb-win32-arm64-3.5.4.tgz",
2689
- "integrity": "sha512-pKv1DJ1bPZAaHkdFsSz5IDfUG8x9vntgquXF9/Dm2xuupcIe/EkLzylpoBxppFVK5vzbV561Dq26jNY2fIMA7g==",
2687
+ "version": "3.5.5",
2688
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-arm64/-/lmdb-win32-arm64-3.5.5.tgz",
2689
+ "integrity": "sha512-k0k/CwywhymTAJT7Uj5PdehH31Vem2ov/Jp0rn5McuJEHgzj7vbE0cmnByhjrQv+VeHLALI8wUZNicqwocPB4Q==",
2690
2690
  "cpu": [
2691
2691
  "arm64"
2692
2692
  ],
@@ -2697,9 +2697,9 @@
2697
2697
  ]
2698
2698
  },
2699
2699
  "node_modules/@lmdb/lmdb-win32-x64": {
2700
- "version": "3.5.4",
2701
- "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-3.5.4.tgz",
2702
- "integrity": "sha512-JF1BmLCm9kGEVZgYmJq43zeQVdHVgAJnTi/NURWEsy6L1ZrrlSmdltS+D17QN4LODwf+1LMXAA9auIZVXtWwzw==",
2700
+ "version": "3.5.5",
2701
+ "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-3.5.5.tgz",
2702
+ "integrity": "sha512-dkV3r04ro8MfhBaPj4ZsARy0LIP3sK+rm2LAuVe2QLCepBIpSzRx8p8RLWfRfkKV5YNyJ3c0NUJxGNMqtTB6Fg==",
2703
2703
  "cpu": [
2704
2704
  "x64"
2705
2705
  ],
@@ -7547,9 +7547,9 @@
7547
7547
  "license": "MIT"
7548
7548
  },
7549
7549
  "node_modules/lmdb": {
7550
- "version": "3.5.4",
7551
- "resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.5.4.tgz",
7552
- "integrity": "sha512-9FKQA6G1MMtqNxfxvSBNXD/axeG2QRjYbNh0/ykRL5xYcRbCm2vXq7B9bhc7nSuKdHzr8/BHIwfPuYYH1UsXXw==",
7550
+ "version": "3.5.5",
7551
+ "resolved": "https://registry.npmjs.org/lmdb/-/lmdb-3.5.5.tgz",
7552
+ "integrity": "sha512-e2q1RtHdJoDaQQNMJ55wJnD5BqpvzoJIEL3NBxfZXNBjYxY0QjCh3RSL/sqmi+y9l97cERdO4WwGFfYYVft1fA==",
7553
7553
  "hasInstallScript": true,
7554
7554
  "license": "MIT",
7555
7555
  "dependencies": {
@@ -7564,13 +7564,13 @@
7564
7564
  "download-lmdb-prebuilds": "bin/download-prebuilds.js"
7565
7565
  },
7566
7566
  "optionalDependencies": {
7567
- "@lmdb/lmdb-darwin-arm64": "3.5.4",
7568
- "@lmdb/lmdb-darwin-x64": "3.5.4",
7569
- "@lmdb/lmdb-linux-arm": "3.5.4",
7570
- "@lmdb/lmdb-linux-arm64": "3.5.4",
7571
- "@lmdb/lmdb-linux-x64": "3.5.4",
7572
- "@lmdb/lmdb-win32-arm64": "3.5.4",
7573
- "@lmdb/lmdb-win32-x64": "3.5.4"
7567
+ "@lmdb/lmdb-darwin-arm64": "3.5.5",
7568
+ "@lmdb/lmdb-darwin-x64": "3.5.5",
7569
+ "@lmdb/lmdb-linux-arm": "3.5.5",
7570
+ "@lmdb/lmdb-linux-arm64": "3.5.5",
7571
+ "@lmdb/lmdb-linux-x64": "3.5.5",
7572
+ "@lmdb/lmdb-win32-arm64": "3.5.5",
7573
+ "@lmdb/lmdb-win32-x64": "3.5.5"
7574
7574
  }
7575
7575
  },
7576
7576
  "node_modules/lmdb/node_modules/node-addon-api": {
@@ -1441,6 +1441,7 @@ export function makeTable(options) {
1441
1441
  const lmdbTransaction = txnForContext({ transaction: new DatabaseTransaction() });
1442
1442
  let transaction = lmdbTransaction.getReadTxn();
1443
1443
  let options = { transaction };
1444
+ let committed = false;
1444
1445
  try {
1445
1446
  if (hasSourceGet || audit) {
1446
1447
  if (!existingRecord) return;
@@ -1460,19 +1461,30 @@ export function makeTable(options) {
1460
1461
  primaryStore.ifVersion?.(id, existingVersion, () => {
1461
1462
  updateIndices(id, existingRecord, null);
1462
1463
  });
1463
- return removeEntry(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1464
+ removeEntry(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1464
1465
  } else {
1465
1466
  updateIndices(id, existingRecord, null, options);
1466
- return removeEntry(primaryStore, entry ?? primaryStore.getEntry(id), options);
1467
+ removeEntry(primaryStore, entry ?? primaryStore.getEntry(id), options);
1467
1468
  }
1468
- } finally {
1469
+ committed = true;
1469
1470
  if (primaryStore.ifVersion) {
1470
1471
  // LMDB: committing the wrapper calls doneReadTxn(), removing it from trackedTxns
1471
1472
  return lmdbTransaction.commit();
1472
1473
  }
1473
1474
  // RocksDB: eviction writes went directly into the raw transaction via options;
1474
- // commit it directly, as DatabaseTransaction.commit() would abort it (no tracked writes)
1475
- return transaction?.commit();
1475
+ // commit it directly, as DatabaseTransaction.commit() would abort it (no tracked writes).
1476
+ // Wrap in Promise.resolve so callers can rely on a thenable return regardless of engine.
1477
+ return Promise.resolve((transaction as any).commit());
1478
+ } finally {
1479
+ if (!committed) {
1480
+ // Skip path or thrown error: abort instead of committing so we don't apply
1481
+ // partial work and the txn handle is released.
1482
+ if (primaryStore.ifVersion) {
1483
+ (lmdbTransaction as any).abort?.();
1484
+ } else {
1485
+ (transaction as any)?.abort?.();
1486
+ }
1487
+ }
1476
1488
  }
1477
1489
  }
1478
1490
  /**
@@ -4459,7 +4471,7 @@ export function makeTable(options) {
4459
4471
  const { key, value: record, version, expiresAt, metadataFlags } = entry;
4460
4472
  // if there is no auditing cleanup and we are tracking deletion, need to do cleanup of
4461
4473
  // these deletion entries (LMDB audit cleanup has its own scheduled job for this)
4462
- let resolution: Promise<void>;
4474
+ let resolution: Promise<void> | undefined;
4463
4475
  if (record === null && removeDeletedRecords && version + auditRetention < Date.now()) {
4464
4476
  // make sure it is still deleted when we do the removal
4465
4477
  resolution = removeEntry(primaryStore, entry, version);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { promises: fsProm, createReadStream, createWriteStream } = require('fs');
3
+ const { promises: fsProm, createReadStream, createWriteStream, mkdirSync } = require('fs');
4
4
  const { createGzip } = require('zlib');
5
5
  const { promisify } = require('util');
6
6
  const { pipeline } = require('stream');
@@ -17,8 +17,6 @@ const { onStorageReclamation } = require('../../server/storageReclamation.ts');
17
17
  const LOG_AUDIT_INTERVAL = 60000;
18
18
  const INT_SIZE_UNDEFINED_MSG =
19
19
  "'interval' and 'maxSize' are both undefined, to enable logging rotation at least one of these values must be defined in harperdb-config.yaml";
20
- const PATH_UNDEFINED_MSG =
21
- "'logging.rotation.path' is undefined, to enable logging rotation set this value in harperdb-config.yaml";
22
20
 
23
21
  let lastRotationTime;
24
22
  let setIntervalId;
@@ -47,8 +45,9 @@ function logRotator({ logger, maxSize, interval, retention, enabled, path: rotat
47
45
  }
48
46
 
49
47
  if (!rotatedLogDir) {
50
- throw new Error(PATH_UNDEFINED_MSG);
48
+ rotatedLogDir = path.join(path.dirname(logger.path), 'rotated');
51
49
  }
50
+ mkdirSync(rotatedLogDir, { recursive: true });
52
51
 
53
52
  // Convert maxSize param to bytes.
54
53
  let maxBytes;
@@ -1332,6 +1332,7 @@ function makeTable(options) {
1332
1332
  const lmdbTransaction = txnForContext({ transaction: new DatabaseTransaction_ts_1.DatabaseTransaction() });
1333
1333
  let transaction = lmdbTransaction.getReadTxn();
1334
1334
  let options = { transaction };
1335
+ let committed = false;
1335
1336
  try {
1336
1337
  if (hasSourceGet || audit) {
1337
1338
  if (!existingRecord)
@@ -1355,21 +1356,33 @@ function makeTable(options) {
1355
1356
  primaryStore.ifVersion?.(id, existingVersion, () => {
1356
1357
  updateIndices(id, existingRecord, null);
1357
1358
  });
1358
- return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1359
+ (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1359
1360
  }
1360
1361
  else {
1361
1362
  updateIndices(id, existingRecord, null, options);
1362
- return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), options);
1363
+ (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), options);
1363
1364
  }
1364
- }
1365
- finally {
1365
+ committed = true;
1366
1366
  if (primaryStore.ifVersion) {
1367
1367
  // LMDB: committing the wrapper calls doneReadTxn(), removing it from trackedTxns
1368
1368
  return lmdbTransaction.commit();
1369
1369
  }
1370
1370
  // RocksDB: eviction writes went directly into the raw transaction via options;
1371
- // commit it directly, as DatabaseTransaction.commit() would abort it (no tracked writes)
1372
- return transaction?.commit();
1371
+ // commit it directly, as DatabaseTransaction.commit() would abort it (no tracked writes).
1372
+ // Wrap in Promise.resolve so callers can rely on a thenable return regardless of engine.
1373
+ return Promise.resolve(transaction.commit());
1374
+ }
1375
+ finally {
1376
+ if (!committed) {
1377
+ // Skip path or thrown error: abort instead of committing so we don't apply
1378
+ // partial work and the txn handle is released.
1379
+ if (primaryStore.ifVersion) {
1380
+ lmdbTransaction.abort?.();
1381
+ }
1382
+ else {
1383
+ transaction?.abort?.();
1384
+ }
1385
+ }
1373
1386
  }
1374
1387
  }
1375
1388
  /**