@harperfast/harper-pro 5.0.6 → 5.0.7
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.
- package/core/bin/status.js +2 -2
- package/core/bin/stop.js +6 -5
- package/core/components/EntryHandler.ts +2 -4
- package/core/components/Scope.ts +1 -1
- package/core/components/componentLoader.ts +4 -11
- package/core/components/requestRestart.ts +2 -17
- package/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js +25 -0
- package/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +34 -0
- package/core/package-lock.json +63 -971
- package/core/resources/DatabaseTransaction.ts +3 -8
- package/core/resources/Table.ts +17 -12
- package/core/resources/databases.ts +2 -2
- package/core/resources/graphql.ts +165 -163
- package/core/resources/indexes/HierarchicalNavigableSmallWorld.ts +3 -14
- package/core/resources/indexes/vector.ts +0 -17
- package/core/resources/loadEnv.ts +16 -20
- package/core/resources/login.ts +3 -4
- package/core/resources/roles.ts +65 -60
- package/core/security/auth.ts +14 -15
- package/core/security/jsLoader.ts +2 -14
- package/core/server/REST.ts +11 -10
- package/core/server/fastifyRoutes.ts +29 -30
- package/core/server/graphqlQuerying.ts +3 -4
- package/core/server/http.ts +1 -175
- package/core/server/mqtt.ts +2 -8
- package/core/server/serverHelpers/serverUtilities.ts +5 -2
- package/core/server/threads/threadServer.js +2 -30
- package/core/server/throttle.ts +0 -18
- package/core/utility/environment/environmentManager.js +4 -10
- package/core/utility/environment/systemInformation.js +355 -0
- package/core/utility/hdbTerms.ts +0 -1
- package/core/utility/operation_authorization.js +5 -2
- package/dist/core/bin/status.js +2 -2
- package/dist/core/bin/status.js.map +1 -1
- package/dist/core/bin/stop.js +5 -5
- package/dist/core/bin/stop.js.map +1 -1
- package/dist/core/components/EntryHandler.js +2 -4
- package/dist/core/components/EntryHandler.js.map +1 -1
- package/dist/core/components/Scope.js +1 -1
- package/dist/core/components/Scope.js.map +1 -1
- package/dist/core/components/componentLoader.js +3 -11
- package/dist/core/components/componentLoader.js.map +1 -1
- package/dist/core/components/requestRestart.js +1 -12
- package/dist/core/components/requestRestart.js.map +1 -1
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js +24 -0
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js.map +1 -0
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +19 -18
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js.map +1 -1
- package/dist/core/resources/DatabaseTransaction.js +1 -6
- package/dist/core/resources/DatabaseTransaction.js.map +1 -1
- package/dist/core/resources/Table.js +18 -14
- package/dist/core/resources/Table.js.map +1 -1
- package/dist/core/resources/databases.js +1 -2
- package/dist/core/resources/databases.js.map +1 -1
- package/dist/core/resources/graphql.js +176 -176
- package/dist/core/resources/graphql.js.map +1 -1
- package/dist/core/resources/indexes/HierarchicalNavigableSmallWorld.js +2 -14
- package/dist/core/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/core/resources/indexes/vector.js +0 -14
- package/dist/core/resources/indexes/vector.js.map +1 -1
- package/dist/core/resources/loadEnv.js +17 -20
- package/dist/core/resources/loadEnv.js.map +1 -1
- package/dist/core/resources/login.js +4 -4
- package/dist/core/resources/login.js.map +1 -1
- package/dist/core/resources/roles.js +68 -64
- package/dist/core/resources/roles.js.map +1 -1
- package/dist/core/security/auth.js +15 -17
- package/dist/core/security/auth.js.map +1 -1
- package/dist/core/security/jsLoader.js +2 -16
- package/dist/core/security/jsLoader.js.map +1 -1
- package/dist/core/server/REST.js +11 -11
- package/dist/core/server/REST.js.map +1 -1
- package/dist/core/server/fastifyRoutes.js +29 -30
- package/dist/core/server/fastifyRoutes.js.map +1 -1
- package/dist/core/server/graphqlQuerying.js +4 -5
- package/dist/core/server/graphqlQuerying.js.map +1 -1
- package/dist/core/server/http.js +0 -179
- package/dist/core/server/http.js.map +1 -1
- package/dist/core/server/mqtt.js +3 -5
- package/dist/core/server/mqtt.js.map +1 -1
- package/dist/core/server/serverHelpers/serverUtilities.js +2 -2
- package/dist/core/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/core/server/threads/threadServer.js +2 -26
- package/dist/core/server/threads/threadServer.js.map +1 -1
- package/dist/core/server/throttle.js +0 -17
- package/dist/core/server/throttle.js.map +1 -1
- package/dist/core/utility/environment/environmentManager.js +4 -9
- package/dist/core/utility/environment/environmentManager.js.map +1 -1
- package/dist/core/utility/environment/systemInformation.js +219 -359
- package/dist/core/utility/environment/systemInformation.js.map +1 -1
- package/dist/core/utility/hdbTerms.js +0 -1
- package/dist/core/utility/hdbTerms.js.map +1 -1
- package/dist/core/utility/operation_authorization.js +2 -2
- package/dist/core/utility/operation_authorization.js.map +1 -1
- package/npm-shrinkwrap.json +54 -974
- package/package.json +1 -2
- package/studio/web/assets/{index-qbLPhOzw.js → index-C0And10y.js} +2 -2
- package/studio/web/assets/{index-qbLPhOzw.js.map → index-C0And10y.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/core/dataLayer/harperBridge/TableSizeObject.ts +0 -35
- package/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.ts +0 -24
- package/core/utility/environment/systemInformation.ts +0 -698
- package/dist/core/dataLayer/harperBridge/TableSizeObject.js +0 -32
- package/dist/core/dataLayer/harperBridge/TableSizeObject.js.map +0 -1
package/core/bin/status.js
CHANGED
|
@@ -6,7 +6,7 @@ const YAML = require('yaml');
|
|
|
6
6
|
|
|
7
7
|
const hdbTerms = require('../utility/hdbTerms.ts');
|
|
8
8
|
const hdbLog = require('../utility/logging/harper_logger.js');
|
|
9
|
-
const
|
|
9
|
+
const sysInfo = require('../utility/environment/systemInformation.js');
|
|
10
10
|
const envMgr = require('../utility/environment/environmentManager.js');
|
|
11
11
|
const installation = require('../utility/installation.ts');
|
|
12
12
|
envMgr.initSync();
|
|
@@ -51,7 +51,7 @@ async function status() {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// Check the saved pid against any running hdb processes
|
|
54
|
-
const hdbSysInfo = await
|
|
54
|
+
const hdbSysInfo = await sysInfo.getHDBProcessInfo();
|
|
55
55
|
for (const proc of hdbSysInfo.core) {
|
|
56
56
|
if (proc.pid === hdbPid) {
|
|
57
57
|
status.harperdb.status = STATUSES.RUNNING;
|
package/core/bin/stop.js
CHANGED
|
@@ -4,7 +4,7 @@ const hdbLogger = require('../utility/logging/harper_logger.js');
|
|
|
4
4
|
const util = require('util');
|
|
5
5
|
const childProcess = require('child_process');
|
|
6
6
|
const exec = util.promisify(childProcess.exec);
|
|
7
|
-
const
|
|
7
|
+
const sysInfo = require('../utility/environment/systemInformation.js');
|
|
8
8
|
|
|
9
9
|
const STOP_MSG = 'Stopping Harper Pro.';
|
|
10
10
|
|
|
@@ -14,8 +14,9 @@ async function stop() {
|
|
|
14
14
|
console.log(STOP_MSG);
|
|
15
15
|
hdbLogger.notify(STOP_MSG);
|
|
16
16
|
|
|
17
|
-
const processes = await
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const processes = await sysInfo.getHDBProcessInfo();
|
|
18
|
+
|
|
19
|
+
processes.core.forEach((p) => {
|
|
20
|
+
exec(`kill ${p.pid}`);
|
|
21
|
+
});
|
|
21
22
|
}
|
|
@@ -189,14 +189,12 @@ export class EntryHandler extends EventEmitter<EntryHandlerEventMap> {
|
|
|
189
189
|
.watch(this.#component.commonPatternBase, {
|
|
190
190
|
cwd: this.#component.directory,
|
|
191
191
|
persistent: false,
|
|
192
|
-
followSymlinks: false,
|
|
193
192
|
ignored: (path) => {
|
|
194
193
|
const normalizedPath = path.replace(/\\/g, '/');
|
|
195
194
|
const normalizedBases = allowedBases.map((base) => base.replace(/\\/g, '/'));
|
|
196
195
|
return (
|
|
197
|
-
normalizedPath.
|
|
198
|
-
(
|
|
199
|
-
normalizedBases.every((base) => !normalizedPath.startsWith(base)))
|
|
196
|
+
normalizedPath !== this.#component.directory.replace(/\\/g, '/') &&
|
|
197
|
+
normalizedBases.every((base) => !normalizedPath.startsWith(base))
|
|
200
198
|
);
|
|
201
199
|
},
|
|
202
200
|
})
|
package/core/components/Scope.ts
CHANGED
|
@@ -63,7 +63,7 @@ export class Scope extends EventEmitter<ScopeEventsMap> {
|
|
|
63
63
|
this.#pluginName = pluginName;
|
|
64
64
|
this.#directory = directory;
|
|
65
65
|
this.#configFilePath = configFilePath;
|
|
66
|
-
this.#logger = loggerWithTag(this.#appName);
|
|
66
|
+
this.#logger = logger || loggerWithTag(this.#appName);
|
|
67
67
|
|
|
68
68
|
this.databaseEvents = databaseEventsEmitter;
|
|
69
69
|
this.applicationScope = applicationScope;
|
|
@@ -17,8 +17,7 @@ import * as staticFiles from '../server/static.ts';
|
|
|
17
17
|
import * as loadEnv from '../resources/loadEnv.ts';
|
|
18
18
|
import harperLogger from '../utility/logging/harper_logger.js';
|
|
19
19
|
import * as dataLoader from '../resources/dataLoader.ts';
|
|
20
|
-
import {
|
|
21
|
-
import { resetRestartNeeded, subscribeToRestartRequests } from './requestRestart.ts';
|
|
20
|
+
import { watchDir, getWorkerIndex } from '../server/threads/manageThreads.js';
|
|
22
21
|
import { scopedImport } from '../security/jsLoader.ts';
|
|
23
22
|
import { server } from '../server/Server.ts';
|
|
24
23
|
import { Resources } from '../resources/Resources.ts';
|
|
@@ -516,16 +515,10 @@ export async function loadComponent(
|
|
|
516
515
|
}
|
|
517
516
|
|
|
518
517
|
compName = parentCompName;
|
|
518
|
+
// Auto restart threads on changes to any app folder. TODO: Make this configurable
|
|
519
519
|
if (isMainThread && !watchesSetup && autoReload) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (debounceTimer) clearTimeout(debounceTimer);
|
|
523
|
-
debounceTimer = setTimeout(async () => {
|
|
524
|
-
debounceTimer = null;
|
|
525
|
-
resetRestartNeeded();
|
|
526
|
-
await loadComponentDirectories();
|
|
527
|
-
restartWorkers();
|
|
528
|
-
}, 500);
|
|
520
|
+
watchDir(componentDirectory, async () => {
|
|
521
|
+
return loadComponentDirectories(); // return the promise
|
|
529
522
|
});
|
|
530
523
|
}
|
|
531
524
|
if ((config.extensionModule || config.pluginModule) && (!isMainThread || config.runOnMainThread)) {
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { Status } from '../server/status/index.ts';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
notify(): void;
|
|
5
|
-
cancel(): void;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
let restartArrayBuffer: NotifyingArrayBuffer;
|
|
3
|
+
let restartArrayBuffer: ArrayBuffer;
|
|
9
4
|
let restartNeededArray: Uint8Array;
|
|
10
|
-
let onRestartRequestedCallback: (() => void) | null = null;
|
|
11
5
|
|
|
12
6
|
function ensureInitialized() {
|
|
13
7
|
if (!restartArrayBuffer) {
|
|
14
|
-
restartArrayBuffer = Status.primaryStore.getUserSharedBuffer('restart-needed', new ArrayBuffer(1)
|
|
15
|
-
callback: () => onRestartRequestedCallback?.(),
|
|
16
|
-
}) as NotifyingArrayBuffer;
|
|
8
|
+
restartArrayBuffer = Status.primaryStore.getUserSharedBuffer('restart-needed', new ArrayBuffer(1));
|
|
17
9
|
restartNeededArray = new Uint8Array(restartArrayBuffer);
|
|
18
10
|
}
|
|
19
11
|
}
|
|
@@ -21,7 +13,6 @@ function ensureInitialized() {
|
|
|
21
13
|
export function requestRestart() {
|
|
22
14
|
ensureInitialized();
|
|
23
15
|
restartNeededArray[0] = 1;
|
|
24
|
-
restartArrayBuffer.notify();
|
|
25
16
|
}
|
|
26
17
|
|
|
27
18
|
export function restartNeeded() {
|
|
@@ -33,9 +24,3 @@ export function resetRestartNeeded() {
|
|
|
33
24
|
ensureInitialized();
|
|
34
25
|
restartNeededArray[0] = 0;
|
|
35
26
|
}
|
|
36
|
-
|
|
37
|
-
export function subscribeToRestartRequests(callback: () => void) {
|
|
38
|
-
ensureInitialized();
|
|
39
|
-
if (onRestartRequestedCallback) throw new Error('A restart-request subscriber is already registered');
|
|
40
|
-
onRestartRequestedCallback = callback;
|
|
41
|
-
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* represents the table size entry for a table
|
|
5
|
+
*/
|
|
6
|
+
class TableSizeObject {
|
|
7
|
+
/**
|
|
8
|
+
* @param {String} schema
|
|
9
|
+
* @param {String} table
|
|
10
|
+
* @param {Number} tableSize - data size of the table in bytes
|
|
11
|
+
* @param {Number} recordCount - number of entries in the table
|
|
12
|
+
* @param {Number} transactionLogSize - number of entries in the transaction log
|
|
13
|
+
* @param {Number} transactionLogRecordCount - data size of the transaction log in bytes
|
|
14
|
+
*/
|
|
15
|
+
constructor(schema, table, tableSize = 0, recordCount = 0, transactionLogSize = 0, transactionLogRecordCount = 0) {
|
|
16
|
+
this.schema = schema;
|
|
17
|
+
this.table = table;
|
|
18
|
+
this.table_size = tableSize;
|
|
19
|
+
this.record_count = recordCount;
|
|
20
|
+
this.transaction_log_size = transactionLogSize;
|
|
21
|
+
this.transaction_log_record_count = transactionLogRecordCount;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = TableSizeObject;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const TableSizeObject = require('./TableSizeObject.js');
|
|
4
|
+
const log = require('../../../../utility/logging/harper_logger.js');
|
|
5
|
+
const { getDatabases } = require('../../../../resources/databases.ts');
|
|
6
|
+
|
|
7
|
+
module.exports = lmdbGetTableSize;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* calculates the number of entries & data size in bytes for a table & its transaction log
|
|
11
|
+
* @param tableObject
|
|
12
|
+
* @returns {Promise<TableSizeObject>}
|
|
13
|
+
*/
|
|
14
|
+
async function lmdbGetTableSize(tableObject) {
|
|
15
|
+
let tableStats = new TableSizeObject();
|
|
16
|
+
try {
|
|
17
|
+
//get the table record count
|
|
18
|
+
let table = getDatabases()[tableObject.schema]?.[tableObject.name];
|
|
19
|
+
|
|
20
|
+
let dbiStat = table.primaryStore.getStats();
|
|
21
|
+
|
|
22
|
+
//get the txn log record count
|
|
23
|
+
let txnDbiStat = table.auditStore?.getStats();
|
|
24
|
+
|
|
25
|
+
tableStats.schema = tableObject.schema;
|
|
26
|
+
tableStats.table = tableObject.name;
|
|
27
|
+
tableStats.record_count = dbiStat.entryCount;
|
|
28
|
+
tableStats.transaction_log_record_count = txnDbiStat.entryCount;
|
|
29
|
+
} catch (e) {
|
|
30
|
+
log.warn(`unable to stat table dbi due to ${e}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return tableStats;
|
|
34
|
+
}
|