@lde/pipeline 0.42.1 → 0.44.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.
@@ -1,56 +0,0 @@
1
- /**
2
- * Combine several {@link ProgressReporter}s into one that forwards every
3
- * lifecycle call to each child that implements it. Lets a single run be
4
- * observed by more than one reporter – e.g. a console reporter alongside a
5
- * verdict-collecting one.
6
- *
7
- * Each method is dispatched to the children in array order; a child that does
8
- * not implement a given (optional) method is skipped for that call.
9
- *
10
- * Internal to the package: not re-exported from `index.ts`. {@link Pipeline}
11
- * uses it to normalise a `reporter` array into the single reporter its call
12
- * sites expect, so the broader API need not grow a new public symbol.
13
- */
14
- export function combineReporters(reporters) {
15
- const forward = (method, ...args) => {
16
- for (const reporter of reporters) {
17
- // Cast to the concrete signature for `method`: indexing by a generic key
18
- // yields a union of method types TS won't call directly, even though the
19
- // arguments are correlated.
20
- const handler = reporter[method];
21
- // Every method is optional; notify only the children that implement it.
22
- // Invoke through `call` so a class-based reporter keeps its `this`: a bare
23
- // `handler?.(...)` would drop the receiver and break methods that touch
24
- // instance state (e.g. ConsoleReporter’s spinner).
25
- handler?.call(reporter, ...args);
26
- }
27
- };
28
- // Listing every method explicitly (rather than a Proxy) keeps the forwarding
29
- // type-safe: typing the result as `Required<ProgressReporter>` forces a new
30
- // entry here whenever the interface grows, so a forgotten method fails to
31
- // compile instead of silently going unforwarded.
32
- const combined = {
33
- pipelineStart: (...args) => forward('pipelineStart', ...args),
34
- datasetsSelected: (...args) => forward('datasetsSelected', ...args),
35
- selectionEmpty: (...args) => forward('selectionEmpty', ...args),
36
- datasetStart: (...args) => forward('datasetStart', ...args),
37
- distributionProbed: (...args) => forward('distributionProbed', ...args),
38
- importStarted: (...args) => forward('importStarted', ...args),
39
- importFailed: (...args) => forward('importFailed', ...args),
40
- distributionValidated: (...args) => forward('distributionValidated', ...args),
41
- distributionSelected: (...args) => forward('distributionSelected', ...args),
42
- stageStart: (...args) => forward('stageStart', ...args),
43
- stageProgress: (...args) => forward('stageProgress', ...args),
44
- stageComplete: (...args) => forward('stageComplete', ...args),
45
- stageFailed: (...args) => forward('stageFailed', ...args),
46
- stageSkipped: (...args) => forward('stageSkipped', ...args),
47
- datasetValidated: (...args) => forward('datasetValidated', ...args),
48
- datasetComplete: (...args) => forward('datasetComplete', ...args),
49
- datasetSkipped: (...args) => forward('datasetSkipped', ...args),
50
- itemsRejected: (...args) => forward('itemsRejected', ...args),
51
- pipelineComplete: (...args) => forward('pipelineComplete', ...args),
52
- timeoutTightened: (...args) => forward('timeoutTightened', ...args),
53
- timeoutRelaxed: (...args) => forward('timeoutRelaxed', ...args),
54
- };
55
- return combined;
56
- }
@@ -1,124 +0,0 @@
1
- import type { Dataset, Distribution } from '@lde/dataset';
2
- import type { ValidityVerdict } from '@lde/distribution-health';
3
- import type { ValidationReport } from './validator.js';
4
- import type { ImportDetails } from './distribution/resolver.js';
5
- import type { TimeoutTransitionEvent } from './sparql/timeoutPolicy.js';
6
- export interface DistributionAnalysisResult {
7
- distribution: Distribution;
8
- type: 'sparql' | 'data-dump' | 'network-error';
9
- available: boolean;
10
- statusCode?: number;
11
- error?: string;
12
- warnings: string[];
13
- /**
14
- * The source-change fingerprint observed for this distribution, or `null`
15
- * when none could be established (e.g. a live SPARQL endpoint). The shared
16
- * key against which a validity verdict's `validatedFingerprint` is matched,
17
- * so a consumer can record it on the reachability rail. Always populated by
18
- * the pipeline; optional so consumers constructing the result need not set it.
19
- */
20
- fingerprint?: string | null;
21
- }
22
- /**
23
- * Items a writer left out of a dataset’s output instead of failing the
24
- * dataset – documents a destination refused, say – reported once per
25
- * (dataset, target) as the writer finalizes the dataset.
26
- */
27
- export interface ItemsRejected {
28
- /** The part of the destination that refused them, e.g. a search index’s
29
- * type name. */
30
- readonly target: string;
31
- /** Items the dataset wrote to {@link target}, the rejected ones included. */
32
- readonly written: number;
33
- /** Items left out. */
34
- readonly rejected: number;
35
- /** Why, most frequent first: each distinct reason, how many items it
36
- * rejected, and the ids of a few of them. Bounded by the writer, so a
37
- * reason that varies per item cannot grow it without limit. */
38
- readonly reasons: readonly RejectionReason[];
39
- }
40
- /** One reason a writer rejected items, in {@link ItemsRejected.reasons}. */
41
- export interface RejectionReason {
42
- readonly reason: string;
43
- readonly count: number;
44
- /** Ids of some of the items rejected for this reason. */
45
- readonly examples: readonly string[];
46
- }
47
- export interface ProgressReporter {
48
- pipelineStart?(name: string): void;
49
- datasetsSelected?(count: number, duration: number): void;
50
- /**
51
- * Called when the run is abandoned because the selection was empty – no
52
- * commit, destination unchanged. Distinct from a completed run that indexed
53
- * nothing: the writers were told to abort, so nothing was swept or swapped.
54
- */
55
- selectionEmpty?(reason: string): void;
56
- datasetStart?(dataset: Dataset): void;
57
- /** Called each time a single distribution probe completes. */
58
- distributionProbed?(result: DistributionAnalysisResult): void;
59
- /** Called when a data-dump import begins. */
60
- importStarted?(): void;
61
- /** Called when importing a distribution fails. */
62
- importFailed?(distribution: Distribution, error: string): void;
63
- /**
64
- * Called with the RDF-validity verdict for a distribution the pipeline
65
- * attempted, whether valid or invalid, and even when the dataset is
66
- * otherwise skipped (no summary produced). The verdict is a plain
67
- * TypeScript value; consumers decide how (and whether) to record it as RDF.
68
- */
69
- distributionValidated?(distribution: Distribution, verdict: ValidityVerdict): void;
70
- /** Called when a dataset’s source is resolved; `imported` is set when the
71
- * source serves an imported data dump. */
72
- distributionSelected?(dataset: Dataset, distribution: Distribution, imported?: ImportDetails): void;
73
- stageStart?(stage: string): void;
74
- stageProgress?(update: {
75
- itemsProcessed: number;
76
- quadsGenerated: number;
77
- memoryUsageBytes: number;
78
- heapUsedBytes: number;
79
- }): void;
80
- stageComplete?(stage: string, result: {
81
- itemsProcessed: number;
82
- quadsGenerated: number;
83
- duration: number;
84
- }): void;
85
- stageFailed?(stage: string, error: Error): void;
86
- stageSkipped?(stage: string, reason: string): void;
87
- /**
88
- * Called once per (dataset, validator) pair after all stages for a dataset
89
- * have run. Fires regardless of whether any stage actually invoked
90
- * `validate()` – the report reflects the validator’s accumulated state.
91
- * When no stage produced data, the report typically carries
92
- * `quadsValidated: 0` and `conforms: true` (the SHACL vacuous-truth
93
- * default); consumers that want to distinguish ‘not tested’ from ‘tested
94
- * and passed’ can read `quadsValidated`.
95
- */
96
- datasetValidated?(dataset: Dataset, report: ValidationReport): void;
97
- datasetComplete?(dataset: Dataset, result: {
98
- memoryUsageBytes: number;
99
- heapUsedBytes: number;
100
- }): void;
101
- datasetSkipped?(dataset: Dataset, reason: string): void;
102
- /**
103
- * Called when a writer leaves some of a dataset’s items out rather than
104
- * failing the dataset ({@link RunContext.itemsRejected}).
105
- */
106
- itemsRejected?(dataset: Dataset, rejection: ItemsRejected): void;
107
- pipelineComplete?(result: {
108
- duration: number;
109
- memoryUsageBytes: number;
110
- heapUsedBytes: number;
111
- }): void;
112
- /**
113
- * Called when a {@link TimeoutPolicy} tightens the budget for an
114
- * endpoint after a run of consecutive timeouts. Lets operators
115
- * distinguish a fast-failed stage from an unexpected speedup.
116
- */
117
- timeoutTightened?(event: TimeoutTransitionEvent): void;
118
- /**
119
- * Called when a {@link TimeoutPolicy} relaxes the budget back to the
120
- * default after a successful request on a previously-tightened endpoint.
121
- */
122
- timeoutRelaxed?(event: TimeoutTransitionEvent): void;
123
- }
124
- //# sourceMappingURL=progressReporter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progressReporter.d.ts","sourceRoot":"","sources":["../src/progressReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExE,MAAM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