rez_core 3.1.90 → 3.1.92

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.
@@ -92,7 +92,7 @@ export class FieldMapperService extends EntityServiceImpl {
92
92
  const fieldMappers =
93
93
  await this.fieldMapperRepository.findByMapperId(mapper_id);
94
94
 
95
- const result: Record<string, any> = {};
95
+ const result = new Map<string, any>();
96
96
  const inMemory: Record<string, Record<string, any>> = {}; // cache for entity lookups
97
97
 
98
98
  for (const field of fieldMappers) {
@@ -179,7 +179,7 @@ export class FieldMapperService extends EntityServiceImpl {
179
179
  }
180
180
 
181
181
  // Add to result
182
- result[field.source_attribute] = value;
182
+ result.set(field.source_attribute, value);
183
183
  }
184
184
  }
185
185
 
@@ -4,7 +4,6 @@ import { WorkflowAutomationService } from './workflow-automation.service';
4
4
  import { FilterEvaluatorService } from '../../filter/service/filter-evaluator.service';
5
5
  import { Action } from '../interface/action.interface';
6
6
  import { DataSource } from 'typeorm';
7
- import { LoggingService } from 'src/utils/service/loggingUtil.service';
8
7
 
9
8
  @Injectable()
10
9
  export class WorkflowAutomationEngineService {
@@ -15,16 +14,12 @@ export class WorkflowAutomationEngineService {
15
14
  private readonly wfService: WorkflowAutomationService,
16
15
  private readonly filterEvaluator: FilterEvaluatorService,
17
16
  private readonly dataSource: DataSource,
18
- @Inject() protected readonly loggingService: LoggingService,
19
17
  ) {}
20
18
 
21
19
  registerAction(actionName: string, actionInstance: Action) {
22
20
  this.actions.set(actionName, actionInstance);
23
- this.loggingService.log(
24
- 'info',
25
- 'WorkflowAutomationEngine',
26
- 'registerAction',
27
- `Registered action ${actionName}`,
21
+ console.log(
22
+ `⚙️ [WorkflowAutomationEngine] Registered action: ${actionName}`,
28
23
  );
29
24
  }
30
25
 
@@ -39,12 +34,9 @@ export class WorkflowAutomationEngineService {
39
34
  user: any,
40
35
  preUpdateStates?: Record<number, boolean> | null,
41
36
  ) {
42
- this.loggingService.log(
43
- 'info',
44
- 'WorkflowAutomationEngine',
45
- 'handleEntityEvent',
46
- `Handling entity event: ${eventType} for entityType: ${entityType}`,
47
- [newEntity?.id, preUpdateStates],
37
+ console.log(
38
+ `🟢 [WorkflowAutomationEngine] Handling entity event: ${eventType} for entityType: ${entityType}`,
39
+ { entityId: newEntity?.id, preUpdateStates },
48
40
  );
49
41
 
50
42
  const workflows = await this.wfService.getActiveRules(
@@ -76,22 +68,17 @@ export class WorkflowAutomationEngineService {
76
68
  }
77
69
 
78
70
  // 🔍 Log Step 1 result
79
- this.loggingService.log(
80
- 'debug',
81
- 'WorkflowAutomationEngine',
82
- 'handleEntityEvent',
83
- `Step 1 - Trigger matched`,
84
- [wf.id, triggerMatched],
71
+ console.log(
72
+ `🧩 [WorkflowAutomationEngine] Step 1 - Trigger matched for WF ${wf.id}: ${triggerMatched}`,
85
73
  );
86
74
 
87
75
  if (!triggerMatched) continue;
88
76
 
89
77
  // Step 2️⃣ Final criteria evaluation
90
-
91
78
  const entityIdToUse =
92
- wf.mapped_entity_type === wf.applicable_entity_type
93
- ? newEntity.id
94
- : newEntity.parent_id;
79
+ wf.mapped_entity_type === wf.applicable_entity_type
80
+ ? newEntity.id
81
+ : newEntity.parent_id;
95
82
 
96
83
  const criteriaMatched = await this.filterEvaluator.evaluateCriteria(
97
84
  wf.mapped_entity_type,
@@ -101,12 +88,8 @@ export class WorkflowAutomationEngineService {
101
88
  );
102
89
 
103
90
  // 🔍 Log Step 2 result
104
- this.loggingService.log(
105
- 'debug',
106
- 'WorkflowAutomationEngine',
107
- 'handleEntityEvent',
108
- `Step 2 - Criteria matched`,
109
- [wf.id, criteriaMatched],
91
+ console.log(
92
+ `⚖️ [WorkflowAutomationEngine] Step 2 - Criteria matched for WF ${wf.id}: ${criteriaMatched}`,
110
93
  );
111
94
 
112
95
  if (!criteriaMatched) continue;
@@ -127,11 +110,8 @@ export class WorkflowAutomationEngineService {
127
110
  );
128
111
 
129
112
  if (!actions.length) {
130
- this.loggingService.log(
131
- 'warn',
132
- 'WorkflowAutomationEngine',
133
- 'executeActions',
134
- `No actions found for workflow ${workflow_automation_id}`,
113
+ console.warn(
114
+ `⚠️ [WorkflowAutomationEngine] No actions found for workflow ${workflow_automation_id}`,
135
115
  );
136
116
  return;
137
117
  }
@@ -145,11 +125,8 @@ export class WorkflowAutomationEngineService {
145
125
  );
146
126
 
147
127
  if (!category?.action_decorator) {
148
- this.loggingService.log(
149
- 'warn',
150
- 'WorkflowAutomationEngine',
151
- 'executeActions',
152
- `No action_decorator found for category_id=${action.action_category_id}`,
128
+ console.warn(
129
+ `⚠️ [WorkflowAutomationEngine] No action_decorator found for category_id=${action.action_category_id}`,
153
130
  );
154
131
  continue;
155
132
  }
@@ -160,21 +137,14 @@ export class WorkflowAutomationEngineService {
160
137
  const impl = this.actions.get(decorator);
161
138
 
162
139
  if (!impl) {
163
- this.loggingService.log(
164
- 'warn',
165
- 'WorkflowAutomationEngine',
166
- 'executeActions',
167
- `No implementation found for action: ${decorator}`,
140
+ console.warn(
141
+ `⚠️ [WorkflowAutomationEngine] No implementation found for action: ${decorator}`,
168
142
  );
169
143
  continue;
170
144
  }
171
145
 
172
- this.loggingService.log(
173
- 'info',
174
- 'WorkflowAutomationEngine',
175
- 'executeActions',
176
- `Executing action ${decorator} for entity ${entity.id}`,
177
- [workflow_automation_id],
146
+ console.log(
147
+ `🚀 [WorkflowAutomationEngine] Executing action "${decorator}" for entity ${entity.id} (WF ${workflow_automation_id})`,
178
148
  );
179
149
 
180
150
  // 4️ Execute action with required context
@@ -184,20 +154,13 @@ export class WorkflowAutomationEngineService {
184
154
  config: action.payload, // from cr_wf_action table
185
155
  });
186
156
 
187
- this.loggingService.log(
188
- 'info',
189
- 'WorkflowAutomationEngine',
190
- 'executeActions',
191
- `Action ${decorator} executed successfully`,
192
- [workflow_automation_id],
157
+ console.log(
158
+ `✅ [WorkflowAutomationEngine] Action "${decorator}" executed successfully (WF ${workflow_automation_id})`,
193
159
  );
194
160
  } catch (err) {
195
- this.loggingService.log(
196
- 'error',
197
- 'WorkflowAutomationEngine',
198
- 'executeActions',
199
- `Error executing action (category_id=${action.action_category_id})`,
200
- [err],
161
+ console.error(
162
+ `❌ [WorkflowAutomationEngine] Error executing action (category_id=${action.action_category_id}):`,
163
+ err,
201
164
  );
202
165
  }
203
166
  }