@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
package/security/keys.js CHANGED
@@ -125,7 +125,7 @@ function getCertTable() {
125
125
  }
126
126
 
127
127
  async function getReplicationCert() {
128
- const SNICallback = createTLSSelector('operations-api');
128
+ const SNICallback = createTLSSelector('replication');
129
129
  const secureTarget = {
130
130
  secureContexts: null,
131
131
  setSecureContext: (_ctx) => {},
@@ -238,7 +238,7 @@ function loadCertificates() {
238
238
 
239
239
  promise = certificateTable.put({
240
240
  name: certCn,
241
- uses: config.uses ?? ['https', ...(configKey.includes('operations') ? ['operations'] : [])],
241
+ uses: config.uses ?? [configKey.includes('operations') ? ['operations-api'] : []],
242
242
  ciphers: config.ciphers,
243
243
  certificate: certificatePem,
244
244
  private_key_name,
@@ -351,7 +351,7 @@ function certExtensions() {
351
351
  async function createCertificateTable(cert, caCert) {
352
352
  await setCertTable({
353
353
  name: getThisNodeName(),
354
- uses: ['https', 'wss'],
354
+ uses: ['replication'],
355
355
  certificate: cert,
356
356
  private_key_name: 'privateKey.pem',
357
357
  is_authority: false,
@@ -360,7 +360,7 @@ async function createCertificateTable(cert, caCert) {
360
360
 
361
361
  await setCertTable({
362
362
  name: caCert.subject.getField('CN').value,
363
- uses: ['https', 'wss'],
363
+ uses: [],
364
364
  certificate: pki.certificateToPem(caCert),
365
365
  private_key_name: 'privateKey.pem',
366
366
  is_authority: true,
@@ -600,7 +600,7 @@ async function reviewSelfSignedCert() {
600
600
 
601
601
  await setCertTable({
602
602
  name: hdbCa.subject.getField('CN').value,
603
- uses: ['https'],
603
+ uses: [],
604
604
  certificate: pki.certificateToPem(hdbCa),
605
605
  private_key_name: keyName,
606
606
  is_authority: true,
@@ -621,7 +621,7 @@ async function reviewSelfSignedCert() {
621
621
  const newPublicCert = await generateCertificates(pki.privateKeyFromPem(caAndKey.private_key), publicKey, hdbCa);
622
622
  await setCertTable({
623
623
  name: certName,
624
- uses: ['https', 'operations', 'wss'],
624
+ uses: ['replication'],
625
625
  certificate: newPublicCert,
626
626
  is_authority: false,
627
627
  private_key_name: caAndKey.ca.private_key_name,
@@ -755,7 +755,7 @@ function createTLSSelector(type, mtlsOptions) {
755
755
  }
756
756
  let quality = cert.is_self_signed ? 1 : 3;
757
757
  // prefer operations certificates for operations API
758
- if (cert.uses?.includes(type)) quality += 1;
758
+ if (cert.uses?.includes(type)) quality += 3;
759
759
 
760
760
  const private_key = getPrivateKeyByName(cert.private_key_name);
761
761
 
package/security/user.ts CHANGED
@@ -258,14 +258,16 @@ async function userInfo(body): Promise<string | User> {
258
258
  }
259
259
 
260
260
  let user = _.cloneDeep(body.hdb_user);
261
- let roleData = await search.searchByHash({
262
- schema: 'system',
263
- table: 'hdb_role',
264
- hash_values: [user.role.id],
265
- get_attributes: ['*'],
266
- });
261
+ let roleData =
262
+ user.role &&
263
+ (await search.searchByHash({
264
+ schema: 'system',
265
+ table: 'hdb_role',
266
+ hash_values: [user.role.id],
267
+ get_attributes: ['*'],
268
+ }));
267
269
 
268
- user.role = roleData[0];
270
+ user.role = roleData?.[0];
269
271
  delete user.password;
270
272
  delete user.refresh_token;
271
273
  delete user.hash;
@@ -429,7 +431,7 @@ async function getSuperUser(): Promise<User | undefined> {
429
431
  await setUsersWithRolesCache();
430
432
  }
431
433
  for (let [, user] of usersWithRolesMap) {
432
- if (user.role.role === 'super_user') return user;
434
+ if (user.role?.role === 'super_user') return user;
433
435
  }
434
436
  }
435
437
 
@@ -46,10 +46,6 @@ async function schemaHandler(event) {
46
46
  */
47
47
  async function syncSchemaMetadata(msg) {
48
48
  try {
49
- // reset current read transactions to ensure that we are getting the very latest data
50
- harperBridge.resetReadTxn(hdbTerms.SYSTEM_SCHEMA_NAME, hdbTerms.SYSTEM_TABLE_NAMES.TABLE_TABLE_NAME);
51
- harperBridge.resetReadTxn(hdbTerms.SYSTEM_SCHEMA_NAME, hdbTerms.SYSTEM_TABLE_NAMES.ATTRIBUTE_TABLE_NAME);
52
- harperBridge.resetReadTxn(hdbTerms.SYSTEM_SCHEMA_NAME, hdbTerms.SYSTEM_TABLE_NAMES.SCHEMA_TABLE_NAME);
53
49
  // TODO: Eventually should indicate which database/table changed so we don't have to scan everything
54
50
  let databases = resetDatabases();
55
51
  if (msg.table && msg.database)
@@ -24,7 +24,7 @@ analytics:
24
24
  aggregatePeriod: 60
25
25
  replicate: false
26
26
  applications:
27
- lockdown: freeze
27
+ lockdown: freeze-after-load
28
28
  moduleLoader: vm
29
29
  dependencyLoader: auto
30
30
  allowedSpawnCommands: