@eltjs/elt 0.3.3 → 0.3.4
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/README.md +1 -0
- package/dist/core/copy.d.ts +1 -1
- package/dist/core/copy.js +12 -4
- package/dist/core/pipeline.js +2 -3
- package/dist/state/sync-history.js +3 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -810,6 +810,7 @@ try {
|
|
|
810
810
|
```
|
|
811
811
|
|
|
812
812
|
- `PipelineError` is an `AggregateError`. `errors` holds each failure. `results` holds the committed `count` and `deleted` of each copy beside its `failures`, in the order of the connections, then of the copies. Each failure has its `partition`, `error` and [`failureType`](#failure-types).
|
|
813
|
+
- The `message` of `PipelineError`, and the error that `passError` gives the sync history, names each distinct failure message once, with each copy and partition that failed with it. Thus a store that refuses five streams gives its remedy once: `The following copies did not load completely: calls, contacts: Turn on … Full Disk Access.; notes: The store is corrupt.`
|
|
813
814
|
- A failure after rows committed, such as a checkpoint that the store could not save or a cleanup error after the publication, shows in the same way, with the committed counts. It does not mean a rollback.
|
|
814
815
|
- A count of zero also covers an empty input that committed.
|
|
815
816
|
- A `PipelineError` holds only failures that the sync history recorded. A pass that could not run, such as a pass whose sync history the pipeline could not write, is recorded nowhere. Thus `run()` rejects with that error itself, after each other pass ends.
|
package/dist/core/copy.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type CopyOutcome<Target extends DestinationTarget> = CopyResult<Target> &
|
|
|
14
14
|
readonly failures: readonly LoadFailure[];
|
|
15
15
|
readonly cancelled: boolean;
|
|
16
16
|
};
|
|
17
|
-
export declare function describeFailures<Target extends DestinationTarget>(
|
|
17
|
+
export declare function describeFailures<Target extends DestinationTarget>(outcomes: readonly CopyOutcome<Target>[]): string;
|
|
18
18
|
export declare class Copy<Target extends DestinationTarget> {
|
|
19
19
|
readonly configuration: CopyConfiguration;
|
|
20
20
|
readonly to: Target;
|
package/dist/core/copy.js
CHANGED
|
@@ -2,10 +2,18 @@ import { errorMessage } from '../state/sync-history.js';
|
|
|
2
2
|
import { CopyConfiguration } from './copy-configuration.js';
|
|
3
3
|
import { FileTransfer } from './file-transfer.js';
|
|
4
4
|
import { Target as DestinationTarget } from './target.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
// What did not load, naming each distinct failure message once with every
|
|
6
|
+
// copy and partition it failed, in order of first appearance, as a log
|
|
7
|
+
// aggregator folds repeated lines: a store that refuses five streams gives
|
|
8
|
+
// its remedy once.
|
|
9
|
+
export function describeFailures(outcomes) {
|
|
10
|
+
const failed = new Map();
|
|
11
|
+
for (const { copy, failures } of outcomes)
|
|
12
|
+
for (const { partition, error } of failures)
|
|
13
|
+
failed
|
|
14
|
+
.getOrInsertComputed(errorMessage(error), () => [])
|
|
15
|
+
.push(`${copy.id ?? copy.from.name}${partition === null ? '' : ` ${JSON.stringify(partition)}`}`);
|
|
16
|
+
return `The following copies did not load completely: ${Array.from(failed, ([message, copies]) => `${copies.join(', ')}: ${message}`).join('; ')}`;
|
|
9
17
|
}
|
|
10
18
|
// One configured transfer from a source stream to a destination declaration.
|
|
11
19
|
export class Copy {
|
package/dist/core/pipeline.js
CHANGED
|
@@ -33,9 +33,8 @@ export class PipelineError extends AggregateError {
|
|
|
33
33
|
name = 'PipelineError';
|
|
34
34
|
results;
|
|
35
35
|
constructor(results) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
super(errors, `The following copies did not load completely: ${incomplete.map(describeFailures).join('; ')}`, { cause: errors[0] });
|
|
36
|
+
const errors = results.flatMap(({ failures }) => failures.map(({ error }) => error));
|
|
37
|
+
super(errors, describeFailures(results), { cause: errors[0] });
|
|
39
38
|
this.results = Object.freeze([...results]);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -73,8 +73,7 @@ export function passFailureType(outcomes) {
|
|
|
73
73
|
}
|
|
74
74
|
// What did not load in a pass, or null when every copy loaded completely.
|
|
75
75
|
export function passError(outcomes) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return `The following copies did not load completely: ${incomplete.map(describeFailures).join('; ')}`;
|
|
76
|
+
return outcomes.some(({ failures }) => failures.length > 0)
|
|
77
|
+
? describeFailures(outcomes)
|
|
78
|
+
: null;
|
|
80
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eltjs/elt",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "A pipeline that copies the data of apps and services into stores that SQL can read: sources, streams, checkpoints, watches and derived datasets.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|