@smithy/core 3.29.4 → 3.29.5
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-cjs/submodules/serde/index.js +11 -1
- package/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js +11 -1
- package/dist-types/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +9 -4
- package/dist-types/ts3.4/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +9 -4
- package/package.json +1 -1
|
@@ -1006,6 +1006,7 @@ let ChecksumStream$1 = class ChecksumStream extends Readable {
|
|
|
1006
1006
|
this.source.on("data", this.onSourceData);
|
|
1007
1007
|
this.source.on("end", this.onSourceEnd);
|
|
1008
1008
|
this.source.on("error", this.onSourceError);
|
|
1009
|
+
this.source.on("close", this.onSourceClose);
|
|
1009
1010
|
this.source.pause();
|
|
1010
1011
|
}
|
|
1011
1012
|
onSourceData = (chunk) => {
|
|
@@ -1045,10 +1046,19 @@ let ChecksumStream$1 = class ChecksumStream extends Readable {
|
|
|
1045
1046
|
onSourceError = (error) => {
|
|
1046
1047
|
this.destroy(error);
|
|
1047
1048
|
};
|
|
1048
|
-
|
|
1049
|
+
onSourceClose = () => {
|
|
1050
|
+
if (!this.destroyed && !this.source.readableEnded) {
|
|
1051
|
+
this.destroy(new Error("Connection lost or stream closed before all data was received."));
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
_read(_size) {
|
|
1049
1055
|
this.source.resume();
|
|
1050
1056
|
}
|
|
1051
1057
|
_destroy(error, callback) {
|
|
1058
|
+
this.source?.removeListener("data", this.onSourceData);
|
|
1059
|
+
this.source?.removeListener("end", this.onSourceEnd);
|
|
1060
|
+
this.source?.removeListener("error", this.onSourceError);
|
|
1061
|
+
this.source?.removeListener("close", this.onSourceClose);
|
|
1052
1062
|
this.source?.destroy();
|
|
1053
1063
|
callback(error);
|
|
1054
1064
|
}
|
|
@@ -19,6 +19,7 @@ export class ChecksumStream extends Readable {
|
|
|
19
19
|
this.source.on("data", this.onSourceData);
|
|
20
20
|
this.source.on("end", this.onSourceEnd);
|
|
21
21
|
this.source.on("error", this.onSourceError);
|
|
22
|
+
this.source.on("close", this.onSourceClose);
|
|
22
23
|
this.source.pause();
|
|
23
24
|
}
|
|
24
25
|
onSourceData = (chunk) => {
|
|
@@ -58,10 +59,19 @@ export class ChecksumStream extends Readable {
|
|
|
58
59
|
onSourceError = (error) => {
|
|
59
60
|
this.destroy(error);
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
+
onSourceClose = () => {
|
|
63
|
+
if (!this.destroyed && !this.source.readableEnded) {
|
|
64
|
+
this.destroy(new Error("Connection lost or stream closed before all data was received."));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
_read(_size) {
|
|
62
68
|
this.source.resume();
|
|
63
69
|
}
|
|
64
70
|
_destroy(error, callback) {
|
|
71
|
+
this.source?.removeListener("data", this.onSourceData);
|
|
72
|
+
this.source?.removeListener("end", this.onSourceEnd);
|
|
73
|
+
this.source?.removeListener("error", this.onSourceError);
|
|
74
|
+
this.source?.removeListener("close", this.onSourceClose);
|
|
65
75
|
this.source?.destroy();
|
|
66
76
|
callback(error);
|
|
67
77
|
}
|
|
@@ -40,11 +40,11 @@ export interface ChecksumStreamInit<T extends Readable | ReadableStream> {
|
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
42
|
export declare class ChecksumStream extends Readable {
|
|
43
|
-
private expectedChecksum;
|
|
44
|
-
private checksumSourceLocation;
|
|
43
|
+
private readonly expectedChecksum;
|
|
44
|
+
private readonly checksumSourceLocation;
|
|
45
45
|
private checksum;
|
|
46
46
|
private source;
|
|
47
|
-
private base64Encoder;
|
|
47
|
+
private readonly base64Encoder;
|
|
48
48
|
constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }: ChecksumStreamInit<Readable>);
|
|
49
49
|
/**
|
|
50
50
|
* Update the checksum and forward each source chunk to the readable side,
|
|
@@ -59,12 +59,17 @@ export declare class ChecksumStream extends Readable {
|
|
|
59
59
|
* Surface source errors on this stream.
|
|
60
60
|
*/
|
|
61
61
|
private onSourceError;
|
|
62
|
+
/**
|
|
63
|
+
* If the source stream closes without having ended,
|
|
64
|
+
* this is considered an error.
|
|
65
|
+
*/
|
|
66
|
+
private onSourceClose;
|
|
62
67
|
/**
|
|
63
68
|
* Resume the source so it flows at the rate this stream is consumed.
|
|
64
69
|
* Do not call this directly.
|
|
65
70
|
* @internal
|
|
66
71
|
*/
|
|
67
|
-
_read(
|
|
72
|
+
_read(_size: number): void;
|
|
68
73
|
/**
|
|
69
74
|
* Destroy the upstream source for cleanup so it is not left dangling, then
|
|
70
75
|
* complete this stream's destruction. The error is intentionally not forwarded
|
|
@@ -40,11 +40,11 @@ export interface ChecksumStreamInit<T extends Readable | ReadableStream> {
|
|
|
40
40
|
* @internal
|
|
41
41
|
*/
|
|
42
42
|
export declare class ChecksumStream extends Readable {
|
|
43
|
-
private expectedChecksum;
|
|
44
|
-
private checksumSourceLocation;
|
|
43
|
+
private readonly expectedChecksum;
|
|
44
|
+
private readonly checksumSourceLocation;
|
|
45
45
|
private checksum;
|
|
46
46
|
private source;
|
|
47
|
-
private base64Encoder;
|
|
47
|
+
private readonly base64Encoder;
|
|
48
48
|
constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }: ChecksumStreamInit<Readable>);
|
|
49
49
|
/**
|
|
50
50
|
* Update the checksum and forward each source chunk to the readable side,
|
|
@@ -59,12 +59,17 @@ export declare class ChecksumStream extends Readable {
|
|
|
59
59
|
* Surface source errors on this stream.
|
|
60
60
|
*/
|
|
61
61
|
private onSourceError;
|
|
62
|
+
/**
|
|
63
|
+
* If the source stream closes without having ended,
|
|
64
|
+
* this is considered an error.
|
|
65
|
+
*/
|
|
66
|
+
private onSourceClose;
|
|
62
67
|
/**
|
|
63
68
|
* Resume the source so it flows at the rate this stream is consumed.
|
|
64
69
|
* Do not call this directly.
|
|
65
70
|
* @internal
|
|
66
71
|
*/
|
|
67
|
-
_read(
|
|
72
|
+
_read(_size: number): void;
|
|
68
73
|
/**
|
|
69
74
|
* Destroy the upstream source for cleanup so it is not left dangling, then
|
|
70
75
|
* complete this stream's destruction. The error is intentionally not forwarded
|