@harperfast/harper-pro 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 (91) hide show
  1. package/analytics/profile.ts +47 -0
  2. package/core/bin/cliOperations.js +6 -4
  3. package/core/bin/copyDb.ts +208 -0
  4. package/core/bin/restart.js +8 -7
  5. package/core/bin/run.js +2 -1
  6. package/core/components/Application.ts +24 -9
  7. package/core/components/ApplicationScope.ts +2 -3
  8. package/core/components/componentLoader.ts +13 -2
  9. package/core/config/harperConfigEnvVars.ts +34 -0
  10. package/core/resources/DatabaseTransaction.ts +19 -2
  11. package/core/resources/RecordEncoder.ts +2 -2
  12. package/core/resources/ResourceInterface.ts +1 -1
  13. package/core/resources/RocksIndexStore.ts +20 -15
  14. package/core/resources/Table.ts +50 -25
  15. package/core/resources/analytics/write.ts +7 -10
  16. package/core/resources/databases.ts +29 -14
  17. package/core/resources/indexes/HierarchicalNavigableSmallWorld.ts +67 -30
  18. package/core/security/certificateVerification/ocspVerification.ts +1 -1
  19. package/core/security/jsLoader.ts +68 -22
  20. package/core/security/keys.js +7 -7
  21. package/core/security/user.ts +10 -8
  22. package/core/server/itc/serverHandlers.js +0 -4
  23. package/core/static/defaultConfig.yaml +1 -1
  24. package/core/utility/hdbTerms.ts +1 -0
  25. package/core/utility/install/installer.js +14 -10
  26. package/dist/analytics/profile.js +47 -0
  27. package/dist/analytics/profile.js.map +1 -1
  28. package/dist/cloneNode/cloneNode.js +5 -5
  29. package/dist/cloneNode/cloneNode.js.map +1 -1
  30. package/dist/core/bin/cliOperations.js +6 -4
  31. package/dist/core/bin/cliOperations.js.map +1 -1
  32. package/dist/core/bin/copyDb.js +197 -0
  33. package/dist/core/bin/copyDb.js.map +1 -1
  34. package/dist/core/bin/restart.js +8 -7
  35. package/dist/core/bin/restart.js.map +1 -1
  36. package/dist/core/bin/run.js +3 -1
  37. package/dist/core/bin/run.js.map +1 -1
  38. package/dist/core/components/Application.js +15 -5
  39. package/dist/core/components/Application.js.map +1 -1
  40. package/dist/core/components/ApplicationScope.js +2 -3
  41. package/dist/core/components/ApplicationScope.js.map +1 -1
  42. package/dist/core/components/componentLoader.js +11 -2
  43. package/dist/core/components/componentLoader.js.map +1 -1
  44. package/dist/core/config/harperConfigEnvVars.js +33 -0
  45. package/dist/core/config/harperConfigEnvVars.js.map +1 -1
  46. package/dist/core/resources/DatabaseTransaction.js +17 -2
  47. package/dist/core/resources/DatabaseTransaction.js.map +1 -1
  48. package/dist/core/resources/RecordEncoder.js +2 -2
  49. package/dist/core/resources/RecordEncoder.js.map +1 -1
  50. package/dist/core/resources/RocksIndexStore.js +19 -12
  51. package/dist/core/resources/RocksIndexStore.js.map +1 -1
  52. package/dist/core/resources/Table.js +55 -29
  53. package/dist/core/resources/Table.js.map +1 -1
  54. package/dist/core/resources/analytics/write.js +7 -10
  55. package/dist/core/resources/analytics/write.js.map +1 -1
  56. package/dist/core/resources/databases.js +18 -14
  57. package/dist/core/resources/databases.js.map +1 -1
  58. package/dist/core/resources/indexes/HierarchicalNavigableSmallWorld.js +38 -19
  59. package/dist/core/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
  60. package/dist/core/security/certificateVerification/ocspVerification.js +1 -1
  61. package/dist/core/security/certificateVerification/ocspVerification.js.map +1 -1
  62. package/dist/core/security/jsLoader.js +54 -21
  63. package/dist/core/security/jsLoader.js.map +1 -1
  64. package/dist/core/security/keys.js +7 -7
  65. package/dist/core/security/keys.js.map +1 -1
  66. package/dist/core/security/user.js +9 -8
  67. package/dist/core/security/user.js.map +1 -1
  68. package/dist/core/server/itc/serverHandlers.js +0 -4
  69. package/dist/core/server/itc/serverHandlers.js.map +1 -1
  70. package/dist/core/utility/hdbTerms.js +1 -0
  71. package/dist/core/utility/hdbTerms.js.map +1 -1
  72. package/dist/core/utility/install/installer.js +11 -8
  73. package/dist/core/utility/install/installer.js.map +1 -1
  74. package/dist/replication/setNode.js +5 -2
  75. package/dist/replication/setNode.js.map +1 -1
  76. package/dist/security/certificate.js +28 -6
  77. package/dist/security/certificate.js.map +1 -1
  78. package/npm-shrinkwrap.json +2 -2
  79. package/package.json +1 -1
  80. package/replication/setNode.ts +5 -2
  81. package/security/certificate.ts +28 -6
  82. package/static/defaultConfig.yaml +1 -1
  83. package/studio/web/assets/{index-C0iJWrnF.js → index-CxTavHFE.js} +5 -5
  84. package/studio/web/assets/{index-C0iJWrnF.js.map → index-CxTavHFE.js.map} +1 -1
  85. package/studio/web/assets/{index.lazy-C647wC7n.js → index.lazy-CfiR1tvq.js} +2 -2
  86. package/studio/web/assets/{index.lazy-C647wC7n.js.map → index.lazy-CfiR1tvq.js.map} +1 -1
  87. package/studio/web/assets/{profile-BTS_ZjxV.js → profile-C-uokAal.js} +2 -2
  88. package/studio/web/assets/{profile-BTS_ZjxV.js.map → profile-C-uokAal.js.map} +1 -1
  89. package/studio/web/assets/{status-Dc-S5M23.js → status-D6xeT4ss.js} +2 -2
  90. package/studio/web/assets/{status-Dc-S5M23.js.map → status-D6xeT4ss.js.map} +1 -1
  91. package/studio/web/index.html +1 -1
@@ -110,11 +110,33 @@ export async function signCertificate(req) {
110
110
  }
111
111
 
112
112
  export async function createCsr() {
113
- const rep = await getReplicationCert();
114
- const opsCert = pki.certificateFromPem(rep.options.cert);
115
- const opsPrivateKey = pki.privateKeyFromPem(rep.options.key);
113
+ // The CSR should always use the self-signed HarperDB cert (RSA), even when
114
+ // the active replication cert is a non-RSA cert (e.g. Let's Encrypt EC).
115
+ const certificateTable = getCertTable();
116
+ const privateKeys: Map<string, string> = getPrivateKeys();
117
+ let opsCert, opsPrivateKey, certName, privateKeyName;
118
+ for await (const cert of certificateTable.search([])) {
119
+ if (cert.is_self_signed && !cert.is_authority) {
120
+ const key = privateKeys.get(cert.private_key_name);
121
+ if (key) {
122
+ opsCert = pki.certificateFromPem(cert.certificate);
123
+ opsPrivateKey = pki.privateKeyFromPem(key);
124
+ certName = cert.name;
125
+ privateKeyName = cert.private_key_name;
126
+ break;
127
+ }
128
+ }
129
+ }
130
+ if (!opsCert || !opsPrivateKey) {
131
+ // Fall back to the replication cert (original behavior)
132
+ const rep = await getReplicationCert();
133
+ opsCert = pki.certificateFromPem(rep.options.cert);
134
+ opsPrivateKey = pki.privateKeyFromPem(rep.options.key);
135
+ certName = rep.name;
136
+ privateKeyName = rep.options.key_file;
137
+ }
116
138
 
117
- logger.info?.('Creating CSR with cert named:', rep.name);
139
+ logger.info?.('Creating CSR with cert named:', certName);
118
140
 
119
141
  const csr = pki.createCertificationRequest();
120
142
  csr.publicKey = opsCert.publicKey;
@@ -143,11 +165,11 @@ export async function createCsr() {
143
165
 
144
166
  csr.sign(opsPrivateKey);
145
167
 
146
- return forge.pki.certificationRequestToPem(csr);
168
+ return { pem: forge.pki.certificationRequestToPem(csr), privateKeyName };
147
169
  }
148
170
 
149
171
  export async function getReplicationCert() {
150
- const SNICallback = createTLSSelector('operations-api');
172
+ const SNICallback = createTLSSelector('replication');
151
173
  const secureTarget = {
152
174
  secureContexts: null,
153
175
  setSecureContext: () => {},
@@ -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: