@lde/pipeline 0.42.1 → 0.43.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/dist/combineReporters.d.ts.map +1 -1
- package/dist/combineReporters.js +1 -0
- package/dist/pipeline.d.ts +2 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +18 -6
- package/dist/progressReporter.d.ts +33 -0
- package/dist/progressReporter.d.ts.map +1 -1
- package/dist/stage.d.ts +11 -0
- package/dist/stage.d.ts.map +1 -1
- package/dist/stage.js +6 -0
- package/dist/unreadValueTally.d.ts +17 -0
- package/dist/unreadValueTally.d.ts.map +1 -0
- package/dist/unreadValueTally.js +32 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combineReporters.d.ts","sourceRoot":"","sources":["../src/combineReporters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAU9D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,gBAAgB,EAAE,GACrC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"combineReporters.d.ts","sourceRoot":"","sources":["../src/combineReporters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAU9D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,gBAAgB,EAAE,GACrC,gBAAgB,CAiDlB"}
|
package/dist/combineReporters.js
CHANGED
|
@@ -48,6 +48,7 @@ export function combineReporters(reporters) {
|
|
|
48
48
|
datasetComplete: (...args) => forward('datasetComplete', ...args),
|
|
49
49
|
datasetSkipped: (...args) => forward('datasetSkipped', ...args),
|
|
50
50
|
itemsRejected: (...args) => forward('itemsRejected', ...args),
|
|
51
|
+
valuesUnread: (...args) => forward('valuesUnread', ...args),
|
|
51
52
|
pipelineComplete: (...args) => forward('pipelineComplete', ...args),
|
|
52
53
|
timeoutTightened: (...args) => forward('timeoutTightened', ...args),
|
|
53
54
|
timeoutRelaxed: (...args) => forward('timeoutRelaxed', ...args),
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -166,7 +166,8 @@ export declare class Pipeline<Out = Quad> {
|
|
|
166
166
|
* Run every top-level stage against one distribution, catching and reporting
|
|
167
167
|
* per-stage failures so one failing stage does not abort the rest. Returns
|
|
168
168
|
* whether any stage hard-failed – the signal the reactive dump fallback
|
|
169
|
-
* reacts to
|
|
169
|
+
* reacts to – and what the stages could not read, which belongs to this
|
|
170
|
+
* attempt alone.
|
|
170
171
|
*/
|
|
171
172
|
private runStages;
|
|
172
173
|
/**
|
package/dist/pipeline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EAKV,MAAM,EACP,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,oBAAoB,EAI1B,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAW7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAE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AAQ,CAAC,eAAe,CAAC,CAAS;gBAE9B,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC;IA6DnC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAmFZ,cAAc;IAoP5B,+EAA+E;YACjE,aAAa;YAyBb,gBAAgB;IAa9B,OAAO,CAAE,aAAa;IAStB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;;;;;OAQG;IACH,OAAO,CAAC,0BAA0B;IA2BlC;;;;;;OAMG;YACW,SAAS;IAyCvB;;;OAGG;YACW,QAAQ;IA6CtB,2EAA2E;YAC7D,eAAe;YAqBf,QAAQ;YA8EP,SAAS;CAczB"}
|
package/dist/pipeline.js
CHANGED
|
@@ -11,6 +11,7 @@ import { NetworkError, SparqlProbeResult, } from '@lde/distribution-probe';
|
|
|
11
11
|
import { importOutcomeToVerdict, probeResultToVerdict, } from '@lde/distribution-health';
|
|
12
12
|
import { NotSupported } from './sparql/reader.js';
|
|
13
13
|
import { combineReporters } from './combineReporters.js';
|
|
14
|
+
import { UnreadValueTally } from './unreadValueTally.js';
|
|
14
15
|
import { ConstantTimeoutPolicy, } from './sparql/timeoutPolicy.js';
|
|
15
16
|
/**
|
|
16
17
|
* Why a run was abandoned rather than committed: its selector produced no
|
|
@@ -447,8 +448,11 @@ export class Pipeline {
|
|
|
447
448
|
onRelax: (event) => this.reporter?.timeoutRelaxed?.(event),
|
|
448
449
|
});
|
|
449
450
|
let stageFailed = false;
|
|
451
|
+
// What the kept attempt’s stages could not read, reported once the dataset
|
|
452
|
+
// completes.
|
|
453
|
+
let unread;
|
|
450
454
|
try {
|
|
451
|
-
stageFailed = await this.runStages(dataset, resolved.distribution, timeout, runWriter, context);
|
|
455
|
+
({ stageFailed, unread } = await this.runStages(dataset, resolved.distribution, timeout, runWriter, context));
|
|
452
456
|
// Reactive fallback: an endpoint that passed probing but could not serve
|
|
453
457
|
// the analysis stages is empirically incapable. Switch to the dataset’s
|
|
454
458
|
// data dump and re-run all stages locally, discarding the
|
|
@@ -484,7 +488,7 @@ export class Pipeline {
|
|
|
484
488
|
// Discard the endpoint-sourced partial output before the re-run so
|
|
485
489
|
// the dump-sourced stats replace it rather than appending to it.
|
|
486
490
|
await runWriter.reset?.(dataset);
|
|
487
|
-
stageFailed = await this.runStages(dataset, fallback.distribution, timeout, runWriter, context);
|
|
491
|
+
({ stageFailed, unread } = await this.runStages(dataset, fallback.distribution, timeout, runWriter, context));
|
|
488
492
|
// Adopt the dump’s fingerprint only once the re-run has succeeded.
|
|
489
493
|
// If the reset or the re-run throws, or a stage fails against the
|
|
490
494
|
// dump, the dataset is recorded ‘failed’ under the endpoint’s
|
|
@@ -525,6 +529,11 @@ export class Pipeline {
|
|
|
525
529
|
// A dataset whose stages threw produced incomplete output; record it as
|
|
526
530
|
// ‘failed’ rather than freezing a broken result under a ‘success’ record.
|
|
527
531
|
await this.recordOutcome(dataset, fingerprint, stageFailed ? 'failed' : 'success');
|
|
532
|
+
if (!stageFailed && unread !== undefined) {
|
|
533
|
+
for (const entry of unread.entries()) {
|
|
534
|
+
this.reporter?.valuesUnread?.(dataset, entry);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
528
537
|
const datasetMemory = process.memoryUsage();
|
|
529
538
|
this.reporter?.datasetComplete?.(dataset, {
|
|
530
539
|
memoryUsageBytes: datasetMemory.rss,
|
|
@@ -609,9 +618,11 @@ export class Pipeline {
|
|
|
609
618
|
* Run every top-level stage against one distribution, catching and reporting
|
|
610
619
|
* per-stage failures so one failing stage does not abort the rest. Returns
|
|
611
620
|
* whether any stage hard-failed – the signal the reactive dump fallback
|
|
612
|
-
* reacts to
|
|
621
|
+
* reacts to – and what the stages could not read, which belongs to this
|
|
622
|
+
* attempt alone.
|
|
613
623
|
*/
|
|
614
624
|
async runStages(dataset, distribution, timeout, runWriter, context) {
|
|
625
|
+
const unread = new UnreadValueTally();
|
|
615
626
|
let stageFailed = false;
|
|
616
627
|
for (const stage of this.stages) {
|
|
617
628
|
try {
|
|
@@ -619,7 +630,7 @@ export class Pipeline {
|
|
|
619
630
|
await this.runChain(dataset, distribution, stage, runWriter, context, timeout);
|
|
620
631
|
}
|
|
621
632
|
else {
|
|
622
|
-
await this.runStage(dataset, distribution, stage, this.stageWriter(runWriter, stage.name), timeout);
|
|
633
|
+
await this.runStage(dataset, distribution, stage, this.stageWriter(runWriter, stage.name), timeout, unread);
|
|
623
634
|
}
|
|
624
635
|
}
|
|
625
636
|
catch (error) {
|
|
@@ -627,13 +638,13 @@ export class Pipeline {
|
|
|
627
638
|
this.reporter?.stageFailed?.(stage.name, error instanceof Error ? error : new Error(String(error)));
|
|
628
639
|
}
|
|
629
640
|
}
|
|
630
|
-
return stageFailed;
|
|
641
|
+
return { stageFailed, unread };
|
|
631
642
|
}
|
|
632
643
|
/**
|
|
633
644
|
* Run a stage with reporting and return whether it was supported.
|
|
634
645
|
* Returns `true` if the stage produced results, `false` if NotSupported.
|
|
635
646
|
*/
|
|
636
|
-
async runStage(dataset, distribution, stage, writer, timeout) {
|
|
647
|
+
async runStage(dataset, distribution, stage, writer, timeout, unread) {
|
|
637
648
|
this.reporter?.stageStart?.(stage.name);
|
|
638
649
|
const stageStart = Date.now();
|
|
639
650
|
let itemsProcessed = 0;
|
|
@@ -651,6 +662,7 @@ export class Pipeline {
|
|
|
651
662
|
});
|
|
652
663
|
},
|
|
653
664
|
timeout,
|
|
665
|
+
valueUnread: unread && ((target, field, value) => unread.add(target, field, value)),
|
|
654
666
|
});
|
|
655
667
|
if (result instanceof NotSupported) {
|
|
656
668
|
this.reporter?.stageSkipped?.(stage.name, result.message);
|
|
@@ -44,6 +44,32 @@ export interface RejectionReason {
|
|
|
44
44
|
/** Ids of some of the items rejected for this reason. */
|
|
45
45
|
readonly examples: readonly string[];
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Values a stage read from a dataset but could not interpret – an integer
|
|
49
|
+
* field over `onbekend`, a date over `Z.j` – and so left out of the items it
|
|
50
|
+
* produced, reported once per (dataset, target, field) when the dataset
|
|
51
|
+
* completes. The item itself is still produced; only the value is missing.
|
|
52
|
+
*/
|
|
53
|
+
export interface ValuesUnread {
|
|
54
|
+
/** The kind of item the values were read for, e.g. a search type’s name. */
|
|
55
|
+
readonly target: string;
|
|
56
|
+
/** The field that could not read them; dotted for a nested field. */
|
|
57
|
+
readonly field: string;
|
|
58
|
+
/** How many values the field left out. */
|
|
59
|
+
readonly unread: number;
|
|
60
|
+
/** A few of them, each a distinct value. Bounded, so a field that rejects
|
|
61
|
+
* every value cannot grow the report with the data. */
|
|
62
|
+
readonly examples: readonly UnreadValue[];
|
|
63
|
+
}
|
|
64
|
+
/** One value a stage could not read, in {@link ValuesUnread.examples}. */
|
|
65
|
+
export interface UnreadValue {
|
|
66
|
+
/** What the value was read from, as the stage names it – for a search
|
|
67
|
+
* document, the node it was projected from, which a publisher can look up
|
|
68
|
+
* even where the document is keyed on something else. */
|
|
69
|
+
readonly id: string;
|
|
70
|
+
/** The value as the source stated it. */
|
|
71
|
+
readonly value: string;
|
|
72
|
+
}
|
|
47
73
|
export interface ProgressReporter {
|
|
48
74
|
pipelineStart?(name: string): void;
|
|
49
75
|
datasetsSelected?(count: number, duration: number): void;
|
|
@@ -104,6 +130,13 @@ export interface ProgressReporter {
|
|
|
104
130
|
* failing the dataset ({@link RunContext.itemsRejected}).
|
|
105
131
|
*/
|
|
106
132
|
itemsRejected?(dataset: Dataset, rejection: ItemsRejected): void;
|
|
133
|
+
/**
|
|
134
|
+
* Called once per (target, field) that left values out of a dataset’s items
|
|
135
|
+
* ({@link BatchContext.valueUnread}), just before {@link datasetComplete}.
|
|
136
|
+
* Not called for a dataset whose stages or write failed: nothing of it is
|
|
137
|
+
* kept, so neither is what it could not read.
|
|
138
|
+
*/
|
|
139
|
+
valuesUnread?(dataset: Dataset, unread: ValuesUnread): void;
|
|
107
140
|
pipelineComplete?(result: {
|
|
108
141
|
duration: number;
|
|
109
142
|
memoryUsageBytes: number;
|
|
@@ -1 +1 @@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,CAAC;IACR,WAAW,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACnD;;;;;;;;OAQG;IACH,gBAAgB,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpE,eAAe,CAAC,CACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAC1D,IAAI,CAAC;IACR,cAAc,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD;;;OAGG;IACH,aAAa,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IACjE;;;;;OAKG;IACH,YAAY,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5D,gBAAgB,CAAC,CAAC,MAAM,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI,CAAC;IACT;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACvD;;;OAGG;IACH,cAAc,CAAC,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACtD"}
|
package/dist/stage.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { NotSupported } from './sparql/reader.js';
|
|
|
5
5
|
import type { TimeoutPolicy } from './sparql/timeoutPolicy.js';
|
|
6
6
|
import type { Validator } from './validator.js';
|
|
7
7
|
import type { DatasetWriter } from './writer/writer.js';
|
|
8
|
+
import type { UnreadValue } from './progressReporter.js';
|
|
8
9
|
/**
|
|
9
10
|
* Transforms a quad stream, given the context of its extension point.
|
|
10
11
|
*
|
|
@@ -42,6 +43,13 @@ export type BatchTransform<Out> = (quads: readonly Quad[], context: BatchContext
|
|
|
42
43
|
*/
|
|
43
44
|
export interface BatchContext extends ReaderContext {
|
|
44
45
|
bindings: readonly VariableBindings[];
|
|
46
|
+
/**
|
|
47
|
+
* Report a value the transform could not read and so left out of the item
|
|
48
|
+
* it produced – an integer field over `onbekend`, say. The pipeline tallies
|
|
49
|
+
* them per (`target`, `field`) and reports them when the dataset completes
|
|
50
|
+
* ({@link ProgressReporter.valuesUnread}).
|
|
51
|
+
*/
|
|
52
|
+
valueUnread(target: string, field: string, unread: UnreadValue): void;
|
|
45
53
|
}
|
|
46
54
|
/**
|
|
47
55
|
* An {@link Reader} with zero or more {@link QuadTransform}s attached as data.
|
|
@@ -166,6 +174,9 @@ export interface RunOptions {
|
|
|
166
174
|
* stages within one dataset.
|
|
167
175
|
*/
|
|
168
176
|
timeout?: TimeoutPolicy;
|
|
177
|
+
/** Receives what a {@link BatchTransform} reports through
|
|
178
|
+
* {@link BatchContext.valueUnread}; dropped when absent. */
|
|
179
|
+
valueUnread?: BatchContext['valueUnread'];
|
|
169
180
|
}
|
|
170
181
|
/** Options accepted by {@link ItemSelector.select}. */
|
|
171
182
|
export interface SelectOptions {
|
package/dist/stage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../src/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,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AAC,EAAE,UAAU,GACnB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAgF/B;;;;OAIG;IACH,OAAO,CAAC,cAAc;YAMR,eAAe;IAkL7B;;;OAGG;YACW,cAAc;YAqBd,OAAO;IA6BrB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CAiBxB;AAiDD,2GAA2G;AAC3G,MAAM,WAAW,YAAY;IAC3B,MAAM,CACJ,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACpC"}
|
package/dist/stage.js
CHANGED
|
@@ -212,6 +212,7 @@ export class Stage {
|
|
|
212
212
|
distribution,
|
|
213
213
|
stage: this.name,
|
|
214
214
|
bindings,
|
|
215
|
+
valueUnread: options?.valueUnread ?? ignoreUnreadValue,
|
|
215
216
|
})
|
|
216
217
|
: acceptedQuads;
|
|
217
218
|
for await (const item of items) {
|
|
@@ -349,3 +350,8 @@ async function* countQuads(stream, onCount) {
|
|
|
349
350
|
}
|
|
350
351
|
onCount(count);
|
|
351
352
|
}
|
|
353
|
+
/** The {@link BatchContext.valueUnread} a stage run without a receiver hands
|
|
354
|
+
* its transform. */
|
|
355
|
+
function ignoreUnreadValue() {
|
|
356
|
+
// Nobody asked for the report, so there is nothing to tally.
|
|
357
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { UnreadValue, ValuesUnread } from './progressReporter.js';
|
|
2
|
+
/**
|
|
3
|
+
* The values a dataset’s stages could not read, tallied per (target, field)
|
|
4
|
+
* for {@link ProgressReporter.valuesUnread}. Bounded by the schema, not the
|
|
5
|
+
* data: one entry per field that rejected anything, each holding a count and
|
|
6
|
+
* at most {@link MAX_EXAMPLES} distinct examples.
|
|
7
|
+
*
|
|
8
|
+
* Internal to the package: {@link Pipeline} keeps one per dataset.
|
|
9
|
+
*/
|
|
10
|
+
export declare class UnreadValueTally {
|
|
11
|
+
private readonly byField;
|
|
12
|
+
/** Count one value `field` of `target` could not read. */
|
|
13
|
+
add(target: string, field: string, unread: UnreadValue): void;
|
|
14
|
+
/** Every field that left values out, in the order it first did. */
|
|
15
|
+
entries(): readonly ValuesUnread[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=unreadValueTally.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadValueTally.d.ts","sourceRoot":"","sources":["../src/unreadValueTally.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAKvE;;;;;;;GAOG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;IAEJ,0DAA0D;IAC1D,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAiB7D,mEAAmE;IACnE,OAAO,IAAI,SAAS,YAAY,EAAE;CAGnC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Distinct examples kept per (target, field). */
|
|
2
|
+
const MAX_EXAMPLES = 5;
|
|
3
|
+
/**
|
|
4
|
+
* The values a dataset’s stages could not read, tallied per (target, field)
|
|
5
|
+
* for {@link ProgressReporter.valuesUnread}. Bounded by the schema, not the
|
|
6
|
+
* data: one entry per field that rejected anything, each holding a count and
|
|
7
|
+
* at most {@link MAX_EXAMPLES} distinct examples.
|
|
8
|
+
*
|
|
9
|
+
* Internal to the package: {@link Pipeline} keeps one per dataset.
|
|
10
|
+
*/
|
|
11
|
+
export class UnreadValueTally {
|
|
12
|
+
byField = new Map();
|
|
13
|
+
/** Count one value `field` of `target` could not read. */
|
|
14
|
+
add(target, field, unread) {
|
|
15
|
+
// A JSON key cannot collide the way a separator-joined one could.
|
|
16
|
+
const key = JSON.stringify([target, field]);
|
|
17
|
+
let entry = this.byField.get(key);
|
|
18
|
+
if (entry === undefined) {
|
|
19
|
+
entry = { target, field, unread: 0, examples: [] };
|
|
20
|
+
this.byField.set(key, entry);
|
|
21
|
+
}
|
|
22
|
+
entry.unread++;
|
|
23
|
+
if (entry.examples.length < MAX_EXAMPLES &&
|
|
24
|
+
!entry.examples.some((example) => example.value === unread.value)) {
|
|
25
|
+
entry.examples.push(unread);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Every field that left values out, in the order it first did. */
|
|
29
|
+
entries() {
|
|
30
|
+
return [...this.byField.values()];
|
|
31
|
+
}
|
|
32
|
+
}
|