rez_core 4.0.216 → 4.0.218

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "4.0.216",
3
+ "version": "4.0.218",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -211,27 +211,33 @@ export class EntityJSONService extends EntityServiceImpl {
211
211
  }
212
212
 
213
213
  // 5. Merge linked attributes using saved filters
214
- for (const linkAttr of safeAttributes.linkedAttributes) {
215
- if (!linkAttr.applicable_entity_type || !linkAttr.applicable_attribute_key) continue;
216
-
217
- const mappingValue = mainData?.[linkAttr.parent_attribute_key || ''] ?? null;
218
- const value = await this.applyLinkedFilterUsingSavedFilter(
219
- linkAttr.applicable_entity_type,
220
- linkAttr.saved_filter_code,
221
- linkAttr.applicable_attribute_key,
222
- mappingValue,
223
- linkAttr.target_attribute_key || linkAttr.applicable_attribute_key,
224
- loggedInUser,
225
- entityId,
226
- );
227
-
228
- if (value !== null && value !== undefined) {
229
- const flatKey = attrMap[linkAttr.target_attribute_key || linkAttr.applicable_attribute_key]
230
- || (linkAttr.target_attribute_key || linkAttr.applicable_attribute_key);
231
- flatJson[flatKey] = value;
232
- }
233
- }
234
-
214
+ // 5. Merge linked attributes using saved filters
215
+ for (const linkAttr of safeAttributes.linkedAttributes) {
216
+ const childEntityType = linkAttr.fla_applicable_entity_type;
217
+ const childAttributeKey = linkAttr.attr_attribute_key;
218
+
219
+ if (!childEntityType || !childAttributeKey) continue;
220
+
221
+ // mappingValue can come from mainData or relatedData if you have parent key
222
+ const mappingValue = mainData?.[childAttributeKey] ?? null;
223
+
224
+ const value = await this.applyLinkedFilterUsingSavedFilter(
225
+ childEntityType,
226
+ linkAttr.saved_filter_code, // make sure this column exists in your query
227
+ childAttributeKey,
228
+ mappingValue,
229
+ childAttributeKey, // target attribute in flatJson
230
+ loggedInUser,
231
+ entityId
232
+ );
233
+
234
+ if (value !== null && value !== undefined) {
235
+ // Use attrMap if flat_json_key exists
236
+ const flatKey = attrMap[childAttributeKey] || childAttributeKey;
237
+ flatJson[flatKey] = value;
238
+ }
239
+ }
240
+
235
241
  // 6. Save JSON
236
242
  await this.dataSource.query(
237
243
  `INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)