@lde/pipeline-console-reporter 0.6.1 → 0.7.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.
|
@@ -6,11 +6,11 @@ export declare class ConsoleReporter implements ProgressReporter {
|
|
|
6
6
|
private datasetStartTime;
|
|
7
7
|
private datasetTotal;
|
|
8
8
|
private datasetIndex;
|
|
9
|
-
private analysisResults;
|
|
10
9
|
pipelineStart(_name: string): void;
|
|
11
10
|
datasetsSelected(count: number, duration: number): void;
|
|
12
11
|
datasetStart(dataset: Dataset): void;
|
|
13
|
-
|
|
12
|
+
distributionProbed(result: DistributionAnalysisResult): void;
|
|
13
|
+
importFailed(_distribution: Distribution, error: string): void;
|
|
14
14
|
distributionSelected(_dataset: Dataset, distribution: Distribution, importedFrom?: Distribution, importDuration?: number): void;
|
|
15
15
|
stageStart(stage: string): void;
|
|
16
16
|
stageProgress(update: {
|
|
@@ -26,7 +26,6 @@ export declare class ConsoleReporter implements ProgressReporter {
|
|
|
26
26
|
stageSkipped(_stage: string, reason: string): void;
|
|
27
27
|
datasetComplete(_dataset: Dataset): void;
|
|
28
28
|
datasetSkipped(_dataset: Dataset, reason: string): void;
|
|
29
|
-
private printAnalysisResults;
|
|
30
29
|
pipelineComplete(result: {
|
|
31
30
|
duration: number;
|
|
32
31
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleReporter.d.ts","sourceRoot":"","sources":["../src/consoleReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAUvB,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,YAAY,CAAC,CAAM;IAC3B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CA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,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAQ/C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQlD,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAUxC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQvD,gBAAgB,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAOrD"}
|
package/dist/consoleReporter.js
CHANGED
|
@@ -11,7 +11,6 @@ export class ConsoleReporter {
|
|
|
11
11
|
datasetStartTime = 0;
|
|
12
12
|
datasetTotal = 0;
|
|
13
13
|
datasetIndex = 0;
|
|
14
|
-
analysisResults = [];
|
|
15
14
|
pipelineStart(_name) {
|
|
16
15
|
this.stageSpinner = ora({
|
|
17
16
|
discardStdin: false,
|
|
@@ -21,7 +20,7 @@ export class ConsoleReporter {
|
|
|
21
20
|
datasetsSelected(count, duration) {
|
|
22
21
|
this.datasetTotal = count;
|
|
23
22
|
if (this.stageSpinner) {
|
|
24
|
-
this.stageSpinner.text = `Selected datasets: found ${chalk.bold(count)} datasets in ${chalk.bold(prettyMilliseconds(duration))}`;
|
|
23
|
+
this.stageSpinner.text = `Selected datasets: found ${chalk.bold(count)} ${count === 1 ? 'dataset' : 'datasets'} in ${chalk.bold(prettyMilliseconds(duration))}`;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
datasetStart(dataset) {
|
|
@@ -29,17 +28,52 @@ export class ConsoleReporter {
|
|
|
29
28
|
this.stageSpinner = undefined;
|
|
30
29
|
this.datasetStartTime = Date.now();
|
|
31
30
|
this.datasetIndex++;
|
|
32
|
-
const counter = this.datasetTotal
|
|
31
|
+
const counter = this.datasetTotal > 1
|
|
33
32
|
? ` ${chalk.dim(`[${this.datasetIndex}/${this.datasetTotal}]`)}`
|
|
34
33
|
: '';
|
|
35
34
|
console.info();
|
|
36
35
|
console.info(`Dataset ${chalk.bold(dataset.iri.toString())}${counter}`);
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
distributionProbed(result) {
|
|
38
|
+
const url = result.distribution.accessUrl.toString();
|
|
39
|
+
const typeLabel = result.type === 'sparql'
|
|
40
|
+
? 'SPARQL endpoint'
|
|
41
|
+
: result.type === 'data-dump'
|
|
42
|
+
? 'Data dump'
|
|
43
|
+
: 'Network error';
|
|
44
|
+
const s = ora({ discardStdin: false });
|
|
45
|
+
if (result.available) {
|
|
46
|
+
const detail = result.statusCode !== undefined ? ` (HTTP ${result.statusCode})` : '';
|
|
47
|
+
s.start(`${typeLabel} ${url}${detail}`);
|
|
48
|
+
s.succeed();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const detail = result.error
|
|
52
|
+
? ` (${result.error})`
|
|
53
|
+
: result.statusCode !== undefined
|
|
54
|
+
? ` (HTTP ${result.statusCode})`
|
|
55
|
+
: '';
|
|
56
|
+
s.start(`${typeLabel} ${url}${detail}`);
|
|
57
|
+
s.fail();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
importFailed(_distribution, error) {
|
|
61
|
+
const s = ora({ discardStdin: false });
|
|
62
|
+
s.start(`Import failed: ${error}`);
|
|
63
|
+
s.fail();
|
|
40
64
|
}
|
|
41
65
|
distributionSelected(_dataset, distribution, importedFrom, importDuration) {
|
|
42
|
-
|
|
66
|
+
const s = ora({ discardStdin: false });
|
|
67
|
+
if (importedFrom) {
|
|
68
|
+
const duration = importDuration !== undefined
|
|
69
|
+
? ` in ${chalk.bold(prettyMilliseconds(importDuration))}`
|
|
70
|
+
: '';
|
|
71
|
+
s.start(`Imported ${importedFrom.accessUrl.toString()} (to ${distribution.accessUrl.toString()})${duration}`);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
s.start(`${distribution.accessUrl.toString()} ${chalk.dim('(selected)')}`);
|
|
75
|
+
}
|
|
76
|
+
s.succeed();
|
|
43
77
|
}
|
|
44
78
|
stageStart(stage) {
|
|
45
79
|
this.stageStartTime = Date.now();
|
|
@@ -81,59 +115,12 @@ export class ConsoleReporter {
|
|
|
81
115
|
s.succeed();
|
|
82
116
|
}
|
|
83
117
|
datasetSkipped(_dataset, reason) {
|
|
84
|
-
this.printAnalysisResults();
|
|
85
118
|
const s = ora({
|
|
86
119
|
discardStdin: false,
|
|
87
120
|
text: `Skipped: ${chalk.red(reason)}`,
|
|
88
121
|
}).start();
|
|
89
122
|
s.fail();
|
|
90
123
|
}
|
|
91
|
-
printAnalysisResults(selected, importedFrom, importDuration) {
|
|
92
|
-
// Match by selected distribution URL, or by importedFrom URL (when a data
|
|
93
|
-
// dump was imported to a local SPARQL endpoint, the selected distribution
|
|
94
|
-
// is the local endpoint which doesn't appear in probe results).
|
|
95
|
-
const selectedUrl = selected?.accessUrl.toString();
|
|
96
|
-
const importedFromUrl = importedFrom?.accessUrl.toString();
|
|
97
|
-
for (const result of this.analysisResults) {
|
|
98
|
-
const resultUrl = result.distribution.accessUrl.toString();
|
|
99
|
-
const isSelected = selected &&
|
|
100
|
-
(resultUrl === selectedUrl || resultUrl === importedFromUrl);
|
|
101
|
-
const typeLabel = result.type === 'sparql'
|
|
102
|
-
? 'SPARQL endpoint'
|
|
103
|
-
: result.type === 'data-dump'
|
|
104
|
-
? 'Data dump'
|
|
105
|
-
: 'Network error';
|
|
106
|
-
const url = resultUrl;
|
|
107
|
-
const s = ora({ discardStdin: false });
|
|
108
|
-
if (isSelected) {
|
|
109
|
-
if (importedFrom) {
|
|
110
|
-
const duration = importDuration !== undefined
|
|
111
|
-
? ` in ${chalk.bold(prettyMilliseconds(importDuration))}`
|
|
112
|
-
: '';
|
|
113
|
-
s.start(`Imported ${url} (to ${selectedUrl})${duration}`);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
s.start(`${typeLabel} ${url} ${chalk.dim('(selected)')}`);
|
|
117
|
-
}
|
|
118
|
-
s.succeed();
|
|
119
|
-
}
|
|
120
|
-
else if (result.available) {
|
|
121
|
-
const detail = result.statusCode !== undefined ? ` (HTTP ${result.statusCode})` : '';
|
|
122
|
-
s.start(`${typeLabel} ${url}${detail}`);
|
|
123
|
-
s.succeed();
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
const detail = result.error
|
|
127
|
-
? ` (${result.error})`
|
|
128
|
-
: result.statusCode !== undefined
|
|
129
|
-
? ` (HTTP ${result.statusCode})`
|
|
130
|
-
: '';
|
|
131
|
-
s.start(`${typeLabel} ${url}${detail}`);
|
|
132
|
-
s.fail();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
this.analysisResults = [];
|
|
136
|
-
}
|
|
137
124
|
pipelineComplete(result) {
|
|
138
125
|
console.info(`\nPipeline completed in ${chalk.bold(prettyMilliseconds(result.duration))}`);
|
|
139
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/pipeline-console-reporter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Console progress reporter for @lde/pipeline",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/ldelements/lde.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@lde/dataset": "0.7.1",
|
|
28
|
-
"@lde/pipeline": "0.
|
|
28
|
+
"@lde/pipeline": "0.18.0",
|
|
29
29
|
"chalk": "^5.4.1",
|
|
30
30
|
"ora": "^9.3.0",
|
|
31
31
|
"pretty-ms": "^9.3.0",
|