@harperfast/harper-pro 5.0.0-beta.1 → 5.0.0-beta.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 (84) hide show
  1. package/core/.github/workflows/integration-tests.yml +7 -5
  2. package/core/components/componentLoader.ts +1 -1
  3. package/core/integrationTests/README.md +6 -6
  4. package/core/integrationTests/deploy/deploy-from-github.test.ts +2 -2
  5. package/core/integrationTests/deploy/deploy-from-source.test.ts +2 -2
  6. package/core/integrationTests/server/crash-replay.test.ts +3 -3
  7. package/core/integrationTests/server/operation-user-rbac.test.ts +2 -2
  8. package/core/integrationTests/server/operations-server.test.ts +4 -2
  9. package/core/integrationTests/server/storage-reclamation.test.ts +2 -2
  10. package/core/integrationTests/server/thread-management.test.ts +2 -2
  11. package/core/integrationTests/utils/README.md +84 -32
  12. package/core/integrationTests/utils/harperLifecycle.ts +19 -23
  13. package/core/package.json +15 -14
  14. package/core/resources/ResourceInterface.ts +1 -1
  15. package/core/resources/Table.ts +9 -5
  16. package/core/resources/search.ts +1 -1
  17. package/core/security/jsLoader.ts +23 -6
  18. package/core/security/keys.js +7 -7
  19. package/core/server/threads/manageThreads.js +3 -1
  20. package/core/unitTests/components/fixtures/testJSWithDeps/child-dir/typestrip.ts +2 -0
  21. package/core/unitTests/components/fixtures/testJSWithDeps/resources.js +3 -0
  22. package/core/unitTests/components/globalIsolation.test.js +1 -0
  23. package/core/unitTests/resources/query.test.js +16 -1
  24. package/core/utility/lmdb/commonUtility.js +21 -10
  25. package/dist/core/components/componentLoader.js +1 -1
  26. package/dist/core/components/componentLoader.js.map +1 -1
  27. package/dist/core/resources/Table.js +8 -3
  28. package/dist/core/resources/Table.js.map +1 -1
  29. package/dist/core/resources/search.js +1 -1
  30. package/dist/core/resources/search.js.map +1 -1
  31. package/dist/core/security/jsLoader.js +22 -7
  32. package/dist/core/security/jsLoader.js.map +1 -1
  33. package/dist/core/security/keys.js +7 -7
  34. package/dist/core/security/keys.js.map +1 -1
  35. package/dist/core/server/threads/manageThreads.js +3 -1
  36. package/dist/core/server/threads/manageThreads.js.map +1 -1
  37. package/dist/core/utility/lmdb/commonUtility.js +20 -13
  38. package/dist/core/utility/lmdb/commonUtility.js.map +1 -1
  39. package/dist/licensing/usageLicensing.js.map +1 -1
  40. package/dist/replication/knownNodes.js +5 -37
  41. package/dist/replication/knownNodes.js.map +1 -1
  42. package/dist/replication/nodeIdMapping.js +2 -35
  43. package/dist/replication/nodeIdMapping.js.map +1 -1
  44. package/dist/replication/replicationConnection.js +6 -3
  45. package/dist/replication/replicationConnection.js.map +1 -1
  46. package/dist/replication/replicator.js +3 -2
  47. package/dist/replication/replicator.js.map +1 -1
  48. package/dist/replication/setNode.js +1 -1
  49. package/dist/replication/setNode.js.map +1 -1
  50. package/dist/security/certificate.js.map +1 -1
  51. package/licensing/usageLicensing.ts +3 -2
  52. package/npm-shrinkwrap.json +1165 -1027
  53. package/package.json +15 -14
  54. package/replication/knownNodes.ts +3 -2
  55. package/replication/nodeIdMapping.ts +1 -1
  56. package/replication/replicationConnection.ts +17 -5
  57. package/replication/replicator.ts +7 -2
  58. package/replication/setNode.ts +1 -1
  59. package/security/certificate.ts +2 -1
  60. package/studio/web/assets/{index-C-GXfcup.js → index-C1G-Jo6n.js} +2 -2
  61. package/studio/web/assets/{index-C-GXfcup.js.map → index-C1G-Jo6n.js.map} +1 -1
  62. package/studio/web/assets/{index-PFlNdimM.js → index-D-CahN0-.js} +2 -2
  63. package/studio/web/assets/{index-PFlNdimM.js.map → index-D-CahN0-.js.map} +1 -1
  64. package/studio/web/assets/{index-BTgXJX9d.js → index-DxlZI0PX.js} +5 -5
  65. package/studio/web/assets/{index-BTgXJX9d.js.map → index-DxlZI0PX.js.map} +1 -1
  66. package/studio/web/assets/{index.lazy-C3TJZJ4o.js → index.lazy-BUXDDqq9.js} +2 -2
  67. package/studio/web/assets/{index.lazy-C3TJZJ4o.js.map → index.lazy-BUXDDqq9.js.map} +1 -1
  68. package/studio/web/assets/{profiler-DotzgiCJ.js → profiler-CU93QiSW.js} +2 -2
  69. package/studio/web/assets/{profiler-DotzgiCJ.js.map → profiler-CU93QiSW.js.map} +1 -1
  70. package/studio/web/assets/{react-redux-VxUEx_mU.js → react-redux-B8k9Ep7e.js} +2 -2
  71. package/studio/web/assets/{react-redux-VxUEx_mU.js.map → react-redux-B8k9Ep7e.js.map} +1 -1
  72. package/studio/web/assets/{startRecording-B_9J9Csd.js → startRecording-DFeBXGk6.js} +2 -2
  73. package/studio/web/assets/{startRecording-B_9J9Csd.js.map → startRecording-DFeBXGk6.js.map} +1 -1
  74. package/studio/web/index.html +1 -1
  75. package/core/resources/ResourceInterfaceV2.ts +0 -53
  76. package/core/resources/ResourceV2.ts +0 -67
  77. package/core/v1.d.ts +0 -39
  78. package/core/v1.js +0 -41
  79. package/core/v2.d.ts +0 -39
  80. package/core/v2.js +0 -41
  81. package/dist/core/resources/ResourceInterfaceV2.js +0 -3
  82. package/dist/core/resources/ResourceInterfaceV2.js.map +0 -1
  83. package/dist/core/resources/ResourceV2.js +0 -27
  84. package/dist/core/resources/ResourceV2.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harperfast/harper-pro",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "Harper is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.",
5
5
  "keywords": [
6
6
  "database",
@@ -71,16 +71,16 @@
71
71
  "cluster:hostname:latest": "pushd utility/dev && docker compose -f docker-compose.hostname.yml --project-directory ../.. pull && docker compose -f docker-compose.hostname.yml --project-directory ../.. up; popd"
72
72
  },
73
73
  "dependencies": {
74
- "@aws-sdk/client-s3": "3.964.0",
74
+ "@aws-sdk/client-s3": "^3.1012.0",
75
75
  "@aws-sdk/lib-storage": "3.964.0",
76
76
  "@datadog/pprof": "^5.11.1",
77
77
  "@endo/static-module-record": "^1.1.2",
78
- "@fastify/autoload": "5.10.0",
79
- "@fastify/compress": "~6.5.0",
80
- "@fastify/cors": "~9.0.1",
81
- "@fastify/static": "~7.0.4",
78
+ "@fastify/autoload": "^6.3.1",
79
+ "@fastify/compress": "^8.3.1",
80
+ "@fastify/cors": "^11.2.0",
81
+ "@fastify/static": "^9.0.0",
82
82
  "@harperfast/extended-iterable": "^1.0.1",
83
- "@harperfast/rocksdb-js": "^0.1.11",
83
+ "@harperfast/rocksdb-js": "^0.1.12",
84
84
  "@turf/area": "6.5.0",
85
85
  "@turf/boolean-contains": "6.5.0",
86
86
  "@turf/boolean-disjoint": "6.5.0",
@@ -91,6 +91,7 @@
91
91
  "@turf/helpers": "6.5.0",
92
92
  "@turf/length": "6.5.0",
93
93
  "alasql": "4.6.6",
94
+ "amaro": "^1.1.8",
94
95
  "argon2": "0.44.0",
95
96
  "asn1js": "3.0.7",
96
97
  "cbor-x": "1.6.4",
@@ -101,8 +102,8 @@
101
102
  "dotenv": "^16.4.7",
102
103
  "easy-ocsp": "1.2.2",
103
104
  "fast-glob": "3.3.3",
104
- "fastify": "~4.29.0",
105
- "fastify-plugin": "~4.5.1",
105
+ "fastify": "^5.8.2",
106
+ "fastify-plugin": "^5.1.0",
106
107
  "fs-extra": "11.3.3",
107
108
  "graphql": "^16.10.0",
108
109
  "graphql-http": "^1.22.4",
@@ -116,7 +117,7 @@
116
117
  "jsonata": "1.8.7",
117
118
  "jsonwebtoken": "9.0.3",
118
119
  "lmdb": "3.5.2",
119
- "lodash": "4.17.21",
120
+ "lodash": "^4.17.23",
120
121
  "mathjs": "11.12.0",
121
122
  "micromatch": "^4.0.8",
122
123
  "minimist": "1.2.8",
@@ -144,8 +145,8 @@
144
145
  "ses": "^1.14.0",
145
146
  "stream-chain": "2.2.5",
146
147
  "stream-json": "1.9.1",
147
- "systeminformation": "5.27.11",
148
- "tar-fs": "3.0.9",
148
+ "systeminformation": "^5.31.4",
149
+ "tar-fs": "^3.1.2",
149
150
  "ulidx": "0.5.0",
150
151
  "uuid": "11.1.0",
151
152
  "validate.js": "0.13.1",
@@ -171,7 +172,7 @@
171
172
  "globals": "^16.5.0",
172
173
  "intercept-stdout": "0.1.2",
173
174
  "mkcert": "^3.2.0",
174
- "mocha": "^11.7.4",
175
+ "mocha": "^11.7.5",
175
176
  "mqtt": "~4.3.8",
176
177
  "oxlint": "^1.31.0",
177
178
  "prettier": "~3.7.3",
@@ -182,7 +183,7 @@
182
183
  "tsx": "^4.20.6",
183
184
  "typescript": "^5.8.2",
184
185
  "typescript-eslint": "^8.45.0",
185
- "undici": "^7.16.0",
186
+ "undici": "^7.24.4",
186
187
  "why-is-node-still-running": "^1.0.0"
187
188
  }
188
189
  }
@@ -10,7 +10,7 @@ import { isMainThread } from 'worker_threads';
10
10
  import { ClientError } from '../core/utility/errors/hdbError.js';
11
11
  import env from '../core/utility/environment/environmentManager.js';
12
12
  import { CONFIG_PARAMS } from '../core/utility/hdbTerms.ts';
13
- import * as logger from '../core/utility/logging/logger.ts';
13
+ import { logger } from '../core/utility/logging/logger.ts';
14
14
 
15
15
  let hdbNodeTable;
16
16
  server.nodes = [];
@@ -110,7 +110,7 @@ export function subscribeToNodeUpdates(listener: (node: any, id: string) => void
110
110
  server.shards = new Map();
111
111
 
112
112
  for (let entry of getHDBNodeTable().primaryStore.getRange({})) {
113
- const { value: node } = entry;
113
+ const { value: node, key } = entry;
114
114
  server.nodes.push(node);
115
115
  if (node.shard != undefined) {
116
116
  let nodesForShard = server.shards.get(node.shard);
@@ -119,6 +119,7 @@ export function subscribeToNodeUpdates(listener: (node: any, id: string) => void
119
119
  }
120
120
  nodesForShard.push(node);
121
121
  }
122
+ listener(node, key);
122
123
  }
123
124
  logger.debug?.(
124
125
  'Known nodes at startup',
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This module is responsible for managing the mapping of node/host names to node ids.
3
3
  */
4
- import * as logger from '../core/utility/logging/logger.ts';
4
+ import { logger } from '../core/utility/logging/logger.ts';
5
5
  import { lastTimeInAuditStore } from './replicator.ts';
6
6
  import { getThisNodeName } from '../core/server/nodeName.ts';
7
7
  import { pack, unpack } from 'msgpackr';
@@ -1,3 +1,4 @@
1
+ import type { Logger } from '../core/utility/logging/logger.ts';
1
2
  import {
2
3
  getDatabases,
3
4
  databases,
@@ -51,7 +52,7 @@ import {
51
52
  } from '../core/resources/blob.ts';
52
53
  import { PassThrough } from 'node:stream';
53
54
  import { getLastVersion } from 'lmdb';
54
- const logger = forComponent('replication').conditional;
55
+ const logger = forComponent('replication').conditional as Logger;
55
56
 
56
57
  // these are the codes we use for the different commands
57
58
  const SUBSCRIPTION_REQUEST = 129;
@@ -121,10 +122,9 @@ export async function createWebSocket(
121
122
  if (url == null) {
122
123
  throw new TypeError(`Invalid URL: Expected a string URL for node "${node_name}" but received ${url}`);
123
124
  }
124
-
125
125
  if (url.includes('wss://')) {
126
126
  if (!secureContexts) {
127
- const SNICallback = createTLSSelector('operations-api');
127
+ const SNICallback = createTLSSelector('replication');
128
128
  const secureTarget = {
129
129
  secureContexts: null,
130
130
  };
@@ -133,10 +133,22 @@ export async function createWebSocket(
133
133
  }
134
134
  secureContext = secureContexts.get(node_name);
135
135
  if (secureContext) {
136
- logger.debug?.('Creating web socket for URL', url, 'with certificate named:', secureContext.name);
136
+ logger.debug?.(
137
+ 'Creating web socket for URL',
138
+ url,
139
+ 'with certificate named:',
140
+ secureContext.name,
141
+ 'is_self_signed',
142
+ secureContext.is_self_signed
143
+ );
137
144
  }
138
145
  if (!secureContext && rejectUnauthorized !== false) {
139
- throw new Error('Unable to find a valid certificate to use for replication to connect to ' + url);
146
+ throw new Error(
147
+ 'Unable to find a valid certificate to use for replication to connect to ' +
148
+ url +
149
+ ' available:' +
150
+ Array.from(secureContexts.keys())
151
+ );
140
152
  }
141
153
  }
142
154
  const headers = {};
@@ -150,7 +150,11 @@ export function start(options) {
150
150
  } else {
151
151
  logger.error(
152
152
  `Incoming client connection from ${request.peerCertificate?.subjectaltname ?? request.ip} did not have valid certificate, you may need turn on enableRootCAs in the config if you are using a publicly signed certificate, or add the CA to the server's trusted CAs`,
153
- authorizationError
153
+ authorizationError,
154
+ 'certificate issuer',
155
+ request.peerCertificate.issuer,
156
+ 'did not match any available CAs',
157
+ Array.from(Array.from(wsServers[0].secureContexts.values())[0].options.availableCAs.keys())
154
158
  );
155
159
  }
156
160
  }
@@ -265,6 +269,7 @@ export function start(options) {
265
269
  export function monitorNodeCAs(listener: () => void) {
266
270
  let lastCaCount = 0;
267
271
  subscribeToNodeUpdates((node) => {
272
+ logger.debug('Adding node CA', node?.ca?.slice(0, 60));
268
273
  if (node?.ca) {
269
274
  // we only care about nodes that have a CA
270
275
  replicationCertificateAuthorities.add(node.ca);
@@ -639,7 +644,7 @@ export function lastTimeInAuditStore(auditStore: Database) {
639
644
 
640
645
  export async function replicateOperation(req) {
641
646
  const response = { message: '' };
642
- if (req.replicated) {
647
+ if (req.replicated !== false) {
643
648
  req.replicated = false; // don't send a replicated flag to the nodes we are sending to
644
649
  logger.trace?.(
645
650
  'Replicating operation',
@@ -153,7 +153,7 @@ export async function setNode(req: any) {
153
153
  if (targetNodeResponse.certificate) {
154
154
  await setCertTable({
155
155
  name: getThisNodeName(),
156
- uses: ['https', 'operations', 'wss'],
156
+ uses: ['https', 'operations', 'wss', 'replication'],
157
157
  certificate: targetNodeResponse.certificate,
158
158
  private_key_name: rep?.options?.key_file,
159
159
  is_authority: false,
@@ -1,3 +1,4 @@
1
+ import type { Logger } from '../core/utility/logging/logger.ts';
1
2
  import Joi from 'joi';
2
3
  import forge from 'node-forge';
3
4
  import { access, constants, readFile, writeFile, unlink } from 'node:fs/promises';
@@ -25,7 +26,7 @@ import { server } from '../core/server/Server.ts';
25
26
  import { replicateOperation } from '../replication/replicator.ts';
26
27
 
27
28
  const { forComponent } = harperLogger;
28
- const logger = forComponent('certificate').conditional;
29
+ const logger = forComponent('certificate').conditional as Logger;
29
30
  const pki = forge.pki;
30
31
  const CERT_VALIDITY_DAYS = 3650;
31
32