@harperfast/harper 5.0.1 → 5.0.3

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 (86) hide show
  1. package/bin/cliOperations.js +6 -4
  2. package/bin/copyDb.ts +208 -0
  3. package/bin/restart.js +8 -7
  4. package/bin/run.js +2 -1
  5. package/components/Application.ts +24 -9
  6. package/components/ApplicationScope.ts +2 -3
  7. package/components/componentLoader.ts +13 -2
  8. package/config/harperConfigEnvVars.ts +34 -0
  9. package/dist/bin/cliOperations.js +6 -4
  10. package/dist/bin/cliOperations.js.map +1 -1
  11. package/dist/bin/copyDb.d.ts +1 -0
  12. package/dist/bin/copyDb.js +197 -0
  13. package/dist/bin/copyDb.js.map +1 -1
  14. package/dist/bin/restart.js +8 -7
  15. package/dist/bin/restart.js.map +1 -1
  16. package/dist/bin/run.js +3 -1
  17. package/dist/bin/run.js.map +1 -1
  18. package/dist/components/Application.js +15 -5
  19. package/dist/components/Application.js.map +1 -1
  20. package/dist/components/ApplicationScope.d.ts +2 -2
  21. package/dist/components/ApplicationScope.js +2 -3
  22. package/dist/components/ApplicationScope.js.map +1 -1
  23. package/dist/components/componentLoader.js +11 -2
  24. package/dist/components/componentLoader.js.map +1 -1
  25. package/dist/config/harperConfigEnvVars.d.ts +16 -0
  26. package/dist/config/harperConfigEnvVars.js +33 -0
  27. package/dist/config/harperConfigEnvVars.js.map +1 -1
  28. package/dist/resources/DatabaseTransaction.js +17 -2
  29. package/dist/resources/DatabaseTransaction.js.map +1 -1
  30. package/dist/resources/RecordEncoder.d.ts +1 -1
  31. package/dist/resources/RecordEncoder.js +2 -2
  32. package/dist/resources/RecordEncoder.js.map +1 -1
  33. package/dist/resources/ResourceInterface.d.ts +1 -1
  34. package/dist/resources/RocksIndexStore.d.ts +14 -7
  35. package/dist/resources/RocksIndexStore.js +19 -12
  36. package/dist/resources/RocksIndexStore.js.map +1 -1
  37. package/dist/resources/Table.js +55 -29
  38. package/dist/resources/Table.js.map +1 -1
  39. package/dist/resources/analytics/write.js +7 -10
  40. package/dist/resources/analytics/write.js.map +1 -1
  41. package/dist/resources/databases.js +18 -14
  42. package/dist/resources/databases.js.map +1 -1
  43. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +2 -1
  44. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +38 -19
  45. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
  46. package/dist/security/certificateVerification/ocspVerification.js +1 -1
  47. package/dist/security/certificateVerification/ocspVerification.js.map +1 -1
  48. package/dist/security/jsLoader.js +54 -21
  49. package/dist/security/jsLoader.js.map +1 -1
  50. package/dist/security/keys.js +7 -7
  51. package/dist/security/keys.js.map +1 -1
  52. package/dist/security/user.js +9 -8
  53. package/dist/security/user.js.map +1 -1
  54. package/dist/server/itc/serverHandlers.js +0 -4
  55. package/dist/server/itc/serverHandlers.js.map +1 -1
  56. package/dist/utility/hdbTerms.d.ts +1 -0
  57. package/dist/utility/hdbTerms.js +1 -0
  58. package/dist/utility/hdbTerms.js.map +1 -1
  59. package/dist/utility/install/installer.js +11 -8
  60. package/dist/utility/install/installer.js.map +1 -1
  61. package/package.json +3 -3
  62. package/resources/DatabaseTransaction.ts +19 -2
  63. package/resources/RecordEncoder.ts +2 -2
  64. package/resources/ResourceInterface.ts +1 -1
  65. package/resources/RocksIndexStore.ts +20 -15
  66. package/resources/Table.ts +50 -25
  67. package/resources/analytics/write.ts +7 -10
  68. package/resources/databases.ts +29 -14
  69. package/resources/indexes/HierarchicalNavigableSmallWorld.ts +67 -30
  70. package/security/certificateVerification/ocspVerification.ts +1 -1
  71. package/security/jsLoader.ts +68 -22
  72. package/security/keys.js +7 -7
  73. package/security/user.ts +10 -8
  74. package/server/itc/serverHandlers.js +0 -4
  75. package/static/defaultConfig.yaml +1 -1
  76. package/studio/web/assets/{index-C0iJWrnF.js → index-CxTavHFE.js} +5 -5
  77. package/studio/web/assets/{index-C0iJWrnF.js.map → index-CxTavHFE.js.map} +1 -1
  78. package/studio/web/assets/{index.lazy-C647wC7n.js → index.lazy-CfiR1tvq.js} +2 -2
  79. package/studio/web/assets/{index.lazy-C647wC7n.js.map → index.lazy-CfiR1tvq.js.map} +1 -1
  80. package/studio/web/assets/{profile-BTS_ZjxV.js → profile-C-uokAal.js} +2 -2
  81. package/studio/web/assets/{profile-BTS_ZjxV.js.map → profile-C-uokAal.js.map} +1 -1
  82. package/studio/web/assets/{status-Dc-S5M23.js → status-D6xeT4ss.js} +2 -2
  83. package/studio/web/assets/{status-Dc-S5M23.js.map → status-D6xeT4ss.js.map} +1 -1
  84. package/studio/web/index.html +1 -1
  85. package/utility/hdbTerms.ts +1 -0
  86. package/utility/install/installer.js +14 -10
@@ -3,12 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RocksIndexStore = void 0;
4
4
  const rocksdb_js_1 = require("@harperfast/rocksdb-js");
5
5
  const ordered_binary_1 = require("ordered-binary");
6
- class RocksIndexStore extends rocksdb_js_1.Store {
6
+ /**
7
+ * A specialized RocksDB-based index store that maintains indexed references to primary keys.
8
+ * This store uses composite keys consisting of indexed values and primary keys, enabling
9
+ * efficient range queries over indexed data. The actual data values are stored as null since
10
+ * this is purely an index structure pointing to primary records elsewhere. This extends
11
+ * RocksDatabase rather than a store because it actually alters the interface
12
+ */
13
+ class RocksIndexStore extends rocksdb_js_1.RocksDatabase {
7
14
  /**
8
15
  * Get all entries matching the range
9
16
  * @param options
10
17
  */
11
- getRange(context, options) {
18
+ getRange(options) {
12
19
  let { start, end, exclusiveStart, inclusiveEnd, reverse } = options;
13
20
  if ((reverse ? !exclusiveStart : exclusiveStart) && start !== undefined) {
14
21
  start = [start, ordered_binary_1.MAXIMUM_KEY];
@@ -17,7 +24,7 @@ class RocksIndexStore extends rocksdb_js_1.Store {
17
24
  end = [end, ordered_binary_1.MAXIMUM_KEY];
18
25
  }
19
26
  const translatedOptions = { ...options, start, end };
20
- return super.getRange(context, translatedOptions).map(({ key }) => {
27
+ return super.getRange(translatedOptions).map(({ key }) => {
21
28
  return { key: key[0], value: key.length > 2 ? key.slice(1) : key[1] };
22
29
  });
23
30
  }
@@ -27,17 +34,17 @@ class RocksIndexStore extends rocksdb_js_1.Store {
27
34
  * @param primaryKey
28
35
  * @param txnId
29
36
  */
30
- put(context, indexedValue, primaryKey, options) {
31
- return super.putSync(context, [indexedValue, primaryKey], null, options);
37
+ put(indexedValue, primaryKey, options) {
38
+ return super.putSync([indexedValue, primaryKey], null, options);
32
39
  }
33
- putSync(context, indexedValue, primaryKey, options) {
34
- return super.putSync(context, [indexedValue, primaryKey], null, options);
40
+ putSync(indexedValue, primaryKey, options) {
41
+ return super.putSync([indexedValue, primaryKey], null, options);
35
42
  }
36
- remove(context, indexedValue, primaryKey, options) {
37
- return super.removeSync(context, [indexedValue, primaryKey], options);
43
+ remove(indexedValue, primaryKey, options) {
44
+ return super.removeSync([indexedValue, primaryKey], options);
38
45
  }
39
- removeSync(context, indexedValue, primaryKey, options) {
40
- super.removeSync(context, [indexedValue, primaryKey], options);
46
+ removeSync(indexedValue, primaryKey, options) {
47
+ super.removeSync([indexedValue, primaryKey], options);
41
48
  }
42
49
  }
43
50
  exports.RocksIndexStore = RocksIndexStore;
@@ -46,7 +53,7 @@ exports.RocksIndexStore = RocksIndexStore;
46
53
  * classes.
47
54
  */
48
55
  rocksdb_js_1.DBI.prototype.getValuesCount = function getValuesCount(indexedValue) {
49
- if (this.store instanceof RocksIndexStore) {
56
+ if (this instanceof RocksIndexStore) {
50
57
  return this.store.getCount(this._context, { start: indexedValue, end: [indexedValue, ordered_binary_1.MAXIMUM_KEY] });
51
58
  }
52
59
  throw new Error('getValuesCount is only supported if dupSort=true');
@@ -1 +1 @@
1
- {"version":3,"file":"RocksIndexStore.js","sourceRoot":"","sources":["../../resources/RocksIndexStore.ts"],"names":[],"mappings":";;;AAAA,uDAOgC;AAEhC,mDAA6C;AAS7C,MAAa,eAAgB,SAAQ,kBAAK;IACz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O,CAAC,CAAC;IAC9D,CAAC;IAED,UAAU,CAAC,YAAiB,EAAE,UAAc,EAAE,OAA4B;QACzE,KAAK,CAAC,UAAU,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACD;AAxCD,0CAwCC;AAED;;;GAGG;AACH,gBAAG,CAAC,SAAS,CAAC,cAAc,GAAG,SAAS,cAAc,CAAC,YAAiB;IACvE,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,4BAAW,CAAC,EAAE,CAAC,CAAC;IACtG,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;AACrE,CAAC,CAAC"}
@@ -1320,27 +1320,41 @@ function makeTable(options) {
1320
1320
  */
1321
1321
  static evict(id, existingRecord, existingVersion) {
1322
1322
  let entry;
1323
- if (hasSourceGet || audit) {
1324
- if (!existingRecord)
1325
- return;
1326
- entry = primaryStore.getEntry(id);
1327
- if (!entry || !existingRecord)
1328
- return;
1329
- if (entry.version !== existingVersion)
1330
- return;
1323
+ let transaction = txnForContext({ transaction: new DatabaseTransaction_ts_1.DatabaseTransaction() }).getReadTxn();
1324
+ let options = { transaction };
1325
+ try {
1326
+ if (hasSourceGet || audit) {
1327
+ if (!existingRecord)
1328
+ return;
1329
+ entry = primaryStore.getEntry(id, options);
1330
+ if (!entry || !existingRecord)
1331
+ return;
1332
+ if (entry.version !== existingVersion)
1333
+ return;
1334
+ }
1335
+ if (hasSourceGet) {
1336
+ // if there is a resolution in-progress, abandon the eviction
1337
+ if (primaryStore.hasLock(id, entry.version))
1338
+ return;
1339
+ }
1340
+ // evictions never go in the audit log, so we can not record a deletion entry for the eviction
1341
+ // as there is no corresponding audit entry and it would never get cleaned up. So we must simply
1342
+ // removed the entry entirely, but first cleanup indices
1343
+ if (primaryStore.ifVersion) {
1344
+ // lmdb
1345
+ primaryStore.ifVersion?.(id, existingVersion, () => {
1346
+ updateIndices(id, existingRecord, null);
1347
+ });
1348
+ return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1349
+ }
1350
+ else {
1351
+ updateIndices(id, existingRecord, null, options);
1352
+ return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), options);
1353
+ }
1331
1354
  }
1332
- if (hasSourceGet) {
1333
- // if there is a resolution in-progress, abandon the eviction
1334
- if (primaryStore.hasLock(id, entry.version))
1335
- return;
1355
+ finally {
1356
+ return transaction.commit();
1336
1357
  }
1337
- primaryStore.ifVersion?.(id, existingVersion, () => {
1338
- updateIndices(id, existingRecord, null);
1339
- });
1340
- // evictions never go in the audit log, so we can not record a deletion entry for the eviction
1341
- // as there is no corresponding audit entry and it would never get cleaned up. So we must simply
1342
- // removed the entry entirely
1343
- return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
1344
1358
  }
1345
1359
  /**
1346
1360
  * This is intended to acquire a lock on a record from the whole cluster.
@@ -1798,10 +1812,10 @@ function makeTable(options) {
1798
1812
  context.lastModified = existingEntry.version;
1799
1813
  TableResource._updateResource(this, existingEntry);
1800
1814
  }
1801
- if (precedesExistingVersion(txnTime, existingEntry, options?.nodeId) <= 0)
1802
- return; // a newer record exists locally
1803
- updateIndices(id, existingRecord);
1804
- logger_ts_1.logger.trace?.(`Deleting record with id: ${id}, txn timestamp: ${new Date(txnTime).toISOString()}`);
1815
+ if (precedesExistingVersion(txnTime, existingEntry, options?.nodeId) < 0) {
1816
+ return;
1817
+ } // a newer record exists locally
1818
+ updateIndices(id, existingRecord, null, transaction && { transaction });
1805
1819
  if (audit || trackDeletes) {
1806
1820
  updateRecord(id, null, existingEntry, txnTime, 0, audit, {
1807
1821
  user: context?.user,
@@ -2071,7 +2085,9 @@ function makeTable(options) {
2071
2085
  return (entryA, entryB) => {
2072
2086
  const a = getAttributeValue(entryA, order.attribute, context);
2073
2087
  const b = getAttributeValue(entryB, order.attribute, context);
2074
- const diff = descending ? (0, ordered_binary_1.compareKeys)(b, a) : (0, ordered_binary_1.compareKeys)(a, b);
2088
+ const diff = descending
2089
+ ? (0, ordered_binary_1.compareKeys)(convertToComparableKeys(b), convertToComparableKeys(a))
2090
+ : (0, ordered_binary_1.compareKeys)(convertToComparableKeys(a), convertToComparableKeys(b));
2075
2091
  if (diff === 0)
2076
2092
  return nextComparator?.(entryA, entryB) || 0;
2077
2093
  return diff;
@@ -3309,6 +3325,7 @@ function makeTable(options) {
3309
3325
  // determine what index values need to be removed and added
3310
3326
  let valuesToAdd = (0, commonUtility_js_1.getIndexedValues)(value, indexNulls);
3311
3327
  let valuesToRemove = (0, commonUtility_js_1.getIndexedValues)(existingValue, indexNulls);
3328
+ let isLMDB = !!index.prefetch;
3312
3329
  if (valuesToRemove?.length > 0) {
3313
3330
  // put this in a conditional so we can do a faster version for new records
3314
3331
  // determine the changes/diff from new values and old values
@@ -3326,19 +3343,19 @@ function makeTable(options) {
3326
3343
  })
3327
3344
  : [];
3328
3345
  valuesToRemove = Array.from(setToRemove);
3329
- if ((valuesToRemove.length > 0 || valuesToAdd.length > 0) && LMDB_PREFETCH_WRITES) {
3346
+ if (isLMDB && (valuesToRemove.length > 0 || valuesToAdd.length > 0) && LMDB_PREFETCH_WRITES) {
3330
3347
  // prefetch any values that have been removed or added
3331
3348
  const valuesToPrefetch = valuesToRemove.concat(valuesToAdd).map((v) => ({ key: v, value: id }));
3332
- index.prefetch?.(valuesToPrefetch, noop);
3349
+ index.prefetch(valuesToPrefetch, noop);
3333
3350
  }
3334
3351
  //if the update cleared out the attribute value we need to delete it from the index
3335
3352
  for (let i = 0, l = valuesToRemove.length; i < l; i++) {
3336
3353
  index.remove(valuesToRemove[i], id, options);
3337
3354
  }
3338
3355
  }
3339
- else if (valuesToAdd?.length > 0 && LMDB_PREFETCH_WRITES) {
3356
+ else if (isLMDB && valuesToAdd?.length > 0 && LMDB_PREFETCH_WRITES) {
3340
3357
  // no old values, just new
3341
- index.prefetch?.(valuesToAdd.map((v) => ({ key: v, value: id })), noop);
3358
+ index.prefetch(valuesToAdd.map((v) => ({ key: v, value: id })), noop);
3342
3359
  }
3343
3360
  if (valuesToAdd) {
3344
3361
  for (let i = 0, l = valuesToAdd.length; i < l; i++) {
@@ -3947,7 +3964,7 @@ function makeTable(options) {
3947
3964
  // don't do anything if the version has changed
3948
3965
  return;
3949
3966
  }
3950
- updateIndices(id, existingRecord, updatedRecord);
3967
+ updateIndices(id, existingRecord, updatedRecord, transaction && { transaction });
3951
3968
  if (updatedRecord) {
3952
3969
  if (existingEntry) {
3953
3970
  context.previousResidency = TableResource.getResidencyRecord(existingEntry.residencyId);
@@ -4386,4 +4403,13 @@ function hasOtherProcesses(store) {
4386
4403
  return +line.match(/\d+/)?.[0] != pid;
4387
4404
  });
4388
4405
  }
4406
+ function convertToComparableKeys(a) {
4407
+ if (a instanceof Date) {
4408
+ return a.getTime();
4409
+ }
4410
+ if (Array.isArray(a)) {
4411
+ return a.map(convertToComparableKeys);
4412
+ }
4413
+ return a;
4414
+ }
4389
4415
  //# sourceMappingURL=Table.js.map