data-primals-engine 1.3.4 → 1.4.0

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.
@@ -1,8 +1,12 @@
1
1
  import NodeCache from "node-cache";
2
2
  import path from "node:path";
3
3
  import {Worker} from 'worker_threads';
4
+ import {fileURLToPath} from "node:url";
4
5
  export const modelsCache = new NodeCache( { stdTTL: 100, checkperiod: 120 } );
5
6
 
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
6
10
  export const mongoDBWhitelist = [
7
11
  "$$NOW", "$in", "$eq", "$gt", "$gte", "$in", "$lt", "$lte", "$ne", "$nin", "$type", "$size",
8
12
  "$and", "$not", "$nor", "$or", "$regexMatch", "$find", "$elemMatch", "$filter", "$toString", "$toObjectId",
@@ -60,7 +64,7 @@ export function runImportExportWorker(action, payload) {
60
64
  */
61
65
  export function runCryptoWorkerTask(action, payload) {
62
66
  return new Promise((resolve, reject) => {
63
- const workerPath = path.resolve(process.cwd(), './src/workers/crypto-worker.js');
67
+ const workerPath = path.resolve(__dirname, '../../workers/crypto-worker.js');
64
68
  const worker = new Worker(workerPath);
65
69
 
66
70
  worker.postMessage({ action, payload });