@factorypure/client-helpers 1.1.11 → 1.1.13

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -527,15 +527,18 @@ export class FilterEngine {
527
527
  globalScrapeOptions,
528
528
  };
529
529
  const filterResults = this.evaluateResult(context);
530
- const visibilityState = this.calculateVisibility(filterResults);
530
+ // Merge with existing filter_results from batch processing (duplicates, search exclusions, etc.)
531
+ const existingFilterResults = result.filter_results || [];
532
+ const allFilterResults = [...existingFilterResults, ...filterResults];
533
+ const visibilityState = this.calculateVisibility(allFilterResults);
531
534
  // Populate new fields
532
- result.filter_results = filterResults;
535
+ result.filter_results = allFilterResults;
533
536
  result.visibility_state = visibilityState;
534
537
  // Maintain backward compatibility with old fields
535
- result.hide_reasons = filterResults
538
+ result.hide_reasons = allFilterResults
536
539
  .filter((fr) => fr.severity === FilterSeverity.BLOCK || fr.severity === FilterSeverity.WARNING)
537
540
  .map((fr) => fr.message);
538
- result.hide_override_reasons = filterResults.filter((fr) => fr.metadata?.isOverride).map((fr) => fr.message);
541
+ result.hide_override_reasons = allFilterResults.filter((fr) => fr.metadata?.isOverride).map((fr) => fr.message);
539
542
  result.ignore_result = visibilityState === VisibilityState.HIDDEN;
540
543
  return result;
541
544
  });
@@ -1353,20 +1356,17 @@ function handleDuplicatesV2(results) {
1353
1356
  else {
1354
1357
  const existingItem = filteredUniqueResultsMap[key];
1355
1358
  if (new Date(item.created_at) > new Date(existingItem.created_at)) {
1356
- // Mark old item as duplicate
1357
- const foundResult = results.find((res) => res.id === existingItem.id);
1358
- if (foundResult) {
1359
- if (!foundResult.filter_results) {
1360
- foundResult.filter_results = [];
1361
- }
1362
- foundResult.filter_results.push({
1363
- ruleId: 'duplicate',
1364
- severity: FilterSeverity.BLOCK,
1365
- message: HIDE_REASONS.DUPLICATE,
1366
- metadata: { key },
1367
- timestamp: new Date().toISOString(),
1368
- });
1359
+ // Mark old item as duplicate (existingItem is already a reference to the object in results array)
1360
+ if (!existingItem.filter_results) {
1361
+ existingItem.filter_results = [];
1369
1362
  }
1363
+ existingItem.filter_results.push({
1364
+ ruleId: 'duplicate',
1365
+ severity: FilterSeverity.BLOCK,
1366
+ message: HIDE_REASONS.DUPLICATE,
1367
+ metadata: { key },
1368
+ timestamp: new Date().toISOString(),
1369
+ });
1370
1370
  filteredUniqueResultsMap[key] = item;
1371
1371
  }
1372
1372
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorypure/client-helpers",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",