bulltrackers-module 1.0.225 → 1.0.226

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,36 +1,41 @@
1
1
  /**
2
2
  * FILENAME: computation-system/helpers/computation_worker.js
3
3
  * PURPOSE: Consumes computation tasks from Pub/Sub and executes them.
4
- * UPDATED: Correctly points to layers/index.js and wraps it for the ManifestBuilder.
4
+ * UPDATED: Fixed import source. Points to actual Calculations package, not layers.
5
5
  */
6
6
 
7
7
  const { runDateComputation, groupByPass } = require('../WorkflowOrchestrator.js');
8
8
  const { getManifest } = require('../topology/ManifestLoader');
9
9
 
10
- // 1. IMPORT CALCULATIONS
11
- // User confirmation: Calculations are barrel-loaded into layers/index.js
12
- const rawLayers = require('../layers/index');
10
+ // 1. IMPORT CALCULATIONS (CORRECTED)
11
+ // We import the specific package containing your strategies (gem, pyro, core, etc.)
12
+ // Adjust the require path if you are using a local relative path instead of node_modules.
13
+ let calculationPackage;
14
+ try {
15
+ // Primary: Try to load from the installed npm package
16
+ calculationPackage = require('aiden-shared-calculations-unified');
17
+ } catch (e) {
18
+ console.error("FATAL: Could not load 'aiden-shared-calculations-unified'. Ensure it is installed or linked.");
19
+ throw e;
20
+ }
21
+
13
22
 
14
- // 2. PREPARE FOR MANIFEST
15
- // The ManifestBuilder expects a structure like: { packageName: { CalculationClass, ... } }
16
- // Since layers/index.js returns a flat object, we wrap it in a 'core' group here.
17
- const calculations = {
18
- core: rawLayers
19
- };
23
+ // The package exports { calculations: { ... }, utils: { ... } }
24
+ // We only need the 'calculations' object (which contains the folder-grouped classes)
25
+ const calculations = calculationPackage.calculations;
20
26
 
21
27
  /**
22
28
  * Handles a single Pub/Sub message for a computation task.
23
29
  * Supports both Gen 1 (Message) and Gen 2 (CloudEvent) formats.
24
- * * @param {object} message - The Pub/Sub message payload.
30
+ * @param {object} message - The Pub/Sub message payload.
25
31
  * @param {object} config - System configuration (must include activeProductLines).
26
32
  * @param {object} dependencies - System dependencies (logger, db, etc.).
27
33
  */
28
34
  async function handleComputationTask(message, config, dependencies) {
29
35
  const { logger } = dependencies;
30
36
 
31
- // 3. LAZY LOAD MANIFEST
32
- // This ensures we only build the manifest when we actually receive a task.
33
- // We pass our wrapped 'calculations' object here.
37
+ // 2. LAZY LOAD MANIFEST
38
+ // We pass the CORRECT 'calculations' object here (e.g. { core: {...}, pyro: {...} })
34
39
  let computationManifest;
35
40
  try {
36
41
  computationManifest = getManifest(
@@ -43,7 +48,7 @@ async function handleComputationTask(message, config, dependencies) {
43
48
  return;
44
49
  }
45
50
 
46
- // 4. PARSE PUB/SUB MESSAGE
51
+ // 3. PARSE PUB/SUB MESSAGE
47
52
  let data;
48
53
  try {
49
54
  if (message.data && message.data.message && message.data.message.data) {
@@ -62,7 +67,7 @@ async function handleComputationTask(message, config, dependencies) {
62
67
  return;
63
68
  }
64
69
 
65
- // 5. EXECUTE TASK
70
+ // 4. EXECUTE TASK
66
71
  try {
67
72
  if (!data || data.action !== 'RUN_COMPUTATION_DATE') {
68
73
  if (data) logger.log('WARN', `[Worker] Unknown or missing action: ${data?.action}. Ignoring.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.225",
3
+ "version": "1.0.226",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [