@whotracksme/reporting 7.0.0 → 7.1.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# v7.1.0 (Mon May 19 2025)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Support for filtering out redundant signals [#159](https://github.com/whotracksme/webextension-packages/pull/159) ([@philipp-classen](https://github.com/philipp-classen))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
1
13
|
# v7.0.0 (Mon May 19 2025)
|
|
2
14
|
|
|
3
15
|
#### 💥 Breaking Change
|
package/package.json
CHANGED
|
@@ -319,6 +319,18 @@ export default class SearchExtractor {
|
|
|
319
319
|
messages.push({ body, deduplicateBy });
|
|
320
320
|
}
|
|
321
321
|
logger.debug('Found the following messages:', messages);
|
|
322
|
-
|
|
322
|
+
|
|
323
|
+
const filteredMessages = messages.filter((msg) => {
|
|
324
|
+
const { omitIfExistsAny = [] } = output[msg.body.action];
|
|
325
|
+
const isRedundant = omitIfExistsAny.some((action) =>
|
|
326
|
+
messages.some((x) => x.body.action === action),
|
|
327
|
+
);
|
|
328
|
+
return !isRedundant;
|
|
329
|
+
});
|
|
330
|
+
if (messages.length !== filteredMessages.length) {
|
|
331
|
+
logger.debug('Remaining messages after filtering:', filteredMessages);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return filteredMessages;
|
|
323
335
|
}
|
|
324
336
|
}
|
|
@@ -398,6 +398,84 @@ describe('#SearchExtractor', function () {
|
|
|
398
398
|
.with.property('isPermanentError');
|
|
399
399
|
});
|
|
400
400
|
|
|
401
|
+
it('should omit messages that are marked as being redundant', function () {
|
|
402
|
+
runScenario({
|
|
403
|
+
url: 'http://example.test/x?q=some-query',
|
|
404
|
+
query: 'some-query',
|
|
405
|
+
category: 'example-test',
|
|
406
|
+
ctry: 'de',
|
|
407
|
+
html: `
|
|
408
|
+
<!DOCTYPE html>
|
|
409
|
+
<html>
|
|
410
|
+
<head>
|
|
411
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
412
|
+
<title>Test page</title>
|
|
413
|
+
<
|
|
414
|
+
</head>
|
|
415
|
+
<body>
|
|
416
|
+
<a id="rellink" href="/foo?bar=42"></a>
|
|
417
|
+
</body>
|
|
418
|
+
</html>`,
|
|
419
|
+
patterns: {
|
|
420
|
+
'example-test': {
|
|
421
|
+
input: {
|
|
422
|
+
'html body': {
|
|
423
|
+
first: {
|
|
424
|
+
rellink: {
|
|
425
|
+
select: '#rellink',
|
|
426
|
+
attr: 'href',
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
output: {
|
|
432
|
+
'test-action': {
|
|
433
|
+
fields: [
|
|
434
|
+
{
|
|
435
|
+
key: 'rellink',
|
|
436
|
+
source: 'html body',
|
|
437
|
+
},
|
|
438
|
+
],
|
|
439
|
+
},
|
|
440
|
+
'redundant-test-action': {
|
|
441
|
+
fields: [
|
|
442
|
+
{
|
|
443
|
+
key: 'rellink',
|
|
444
|
+
source: 'html body',
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
omitIfExistsAny: ['test-action'], // exists, so it should be omitted
|
|
448
|
+
},
|
|
449
|
+
'non-redundant-test-action': {
|
|
450
|
+
fields: [
|
|
451
|
+
{
|
|
452
|
+
key: 'rellink',
|
|
453
|
+
source: 'html body',
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
omitIfExistsAny: ['some-message-that-does-not-exist'],
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
mustContain: [
|
|
462
|
+
{
|
|
463
|
+
action: 'test-action',
|
|
464
|
+
payload: {
|
|
465
|
+
rellink: 'http://example.test/foo?bar=42',
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
action: 'non-redundant-test-action',
|
|
470
|
+
payload: {
|
|
471
|
+
rellink: 'http://example.test/foo?bar=42',
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
],
|
|
475
|
+
mustNotContain: [{ action: 'redundant-test-action' }],
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
|
|
401
479
|
describe('during preprocessing', function () {
|
|
402
480
|
it('should support removing an inner div', function () {
|
|
403
481
|
runScenario({
|