@aws-sdk/eventstream-handler-node 3.118.1 → 3.127.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/CHANGELOG.md +24 -0
- package/dist-cjs/EventSigningStream.js +4 -9
- package/dist-cjs/EventStreamPayloadHandler.js +3 -3
- package/dist-es/EventSigningStream.js +4 -10
- package/dist-es/EventStreamPayloadHandler.js +3 -3
- package/dist-types/EventSigningStream.d.ts +3 -3
- package/dist-types/EventStreamPayloadHandler.d.ts +1 -1
- package/dist-types/ts3.4/EventSigningStream.d.ts +3 -3
- package/dist-types/ts3.4/EventStreamPayloadHandler.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.127.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.126.0...v3.127.0) (2022-07-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/eventstream-handler-node
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.123.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.122.0...v3.123.0) (2022-07-05)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @aws-sdk/eventstream-handler-node
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.120.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.119.0...v3.120.0) (2022-06-29)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @aws-sdk/eventstream-handler-node
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [3.118.1](https://github.com/aws/aws-sdk-js-v3/compare/v3.118.0...v3.118.1) (2022-06-27)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @aws-sdk/eventstream-handler-node
|
|
@@ -5,19 +5,14 @@ const stream_1 = require("stream");
|
|
|
5
5
|
class EventSigningStream extends stream_1.Transform {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
super({
|
|
8
|
+
autoDestroy: true,
|
|
8
9
|
readableObjectMode: true,
|
|
9
10
|
writableObjectMode: true,
|
|
10
11
|
...options,
|
|
11
12
|
});
|
|
12
13
|
this.priorSignature = options.priorSignature;
|
|
13
14
|
this.eventSigner = options.eventSigner;
|
|
14
|
-
this.
|
|
15
|
-
this.on("error", () => {
|
|
16
|
-
this.destroy();
|
|
17
|
-
});
|
|
18
|
-
this.on("end", () => {
|
|
19
|
-
this.destroy();
|
|
20
|
-
});
|
|
15
|
+
this.eventStreamCodec = options.eventStreamCodec;
|
|
21
16
|
}
|
|
22
17
|
async _transform(chunk, encoding, callback) {
|
|
23
18
|
try {
|
|
@@ -27,13 +22,13 @@ class EventSigningStream extends stream_1.Transform {
|
|
|
27
22
|
};
|
|
28
23
|
const signature = await this.eventSigner.sign({
|
|
29
24
|
payload: chunk,
|
|
30
|
-
headers: this.
|
|
25
|
+
headers: this.eventStreamCodec.formatHeaders(dateHeader),
|
|
31
26
|
}, {
|
|
32
27
|
priorSignature: this.priorSignature,
|
|
33
28
|
signingDate: now,
|
|
34
29
|
});
|
|
35
30
|
this.priorSignature = signature;
|
|
36
|
-
const serializedSigned = this.
|
|
31
|
+
const serializedSigned = this.eventStreamCodec.encode({
|
|
37
32
|
headers: {
|
|
38
33
|
...dateHeader,
|
|
39
34
|
":chunk-signature": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventStreamPayloadHandler = void 0;
|
|
4
|
-
const
|
|
4
|
+
const eventstream_codec_1 = require("@aws-sdk/eventstream-codec");
|
|
5
5
|
const stream_1 = require("stream");
|
|
6
6
|
const EventSigningStream_1 = require("./EventSigningStream");
|
|
7
7
|
class EventStreamPayloadHandler {
|
|
8
8
|
constructor(options) {
|
|
9
9
|
this.eventSigner = options.eventSigner;
|
|
10
|
-
this.
|
|
10
|
+
this.eventStreamCodec = new eventstream_codec_1.EventStreamCodec(options.utf8Encoder, options.utf8Decoder);
|
|
11
11
|
}
|
|
12
12
|
async handle(next, args, context = {}) {
|
|
13
13
|
const request = args.request;
|
|
@@ -31,7 +31,7 @@ class EventStreamPayloadHandler {
|
|
|
31
31
|
const priorSignature = (match || [])[1];
|
|
32
32
|
const signingStream = new EventSigningStream_1.EventSigningStream({
|
|
33
33
|
priorSignature,
|
|
34
|
-
|
|
34
|
+
eventStreamCodec: this.eventStreamCodec,
|
|
35
35
|
eventSigner: await this.eventSigner(),
|
|
36
36
|
});
|
|
37
37
|
(0, stream_1.pipeline)(payloadStream, signingStream, request.body, (err) => {
|
|
@@ -3,16 +3,10 @@ import { Transform } from "stream";
|
|
|
3
3
|
var EventSigningStream = (function (_super) {
|
|
4
4
|
__extends(EventSigningStream, _super);
|
|
5
5
|
function EventSigningStream(options) {
|
|
6
|
-
var _this = _super.call(this, __assign({ readableObjectMode: true, writableObjectMode: true }, options)) || this;
|
|
6
|
+
var _this = _super.call(this, __assign({ autoDestroy: true, readableObjectMode: true, writableObjectMode: true }, options)) || this;
|
|
7
7
|
_this.priorSignature = options.priorSignature;
|
|
8
8
|
_this.eventSigner = options.eventSigner;
|
|
9
|
-
_this.
|
|
10
|
-
_this.on("error", function () {
|
|
11
|
-
_this.destroy();
|
|
12
|
-
});
|
|
13
|
-
_this.on("end", function () {
|
|
14
|
-
_this.destroy();
|
|
15
|
-
});
|
|
9
|
+
_this.eventStreamCodec = options.eventStreamCodec;
|
|
16
10
|
return _this;
|
|
17
11
|
}
|
|
18
12
|
EventSigningStream.prototype._transform = function (chunk, encoding, callback) {
|
|
@@ -28,7 +22,7 @@ var EventSigningStream = (function (_super) {
|
|
|
28
22
|
};
|
|
29
23
|
return [4, this.eventSigner.sign({
|
|
30
24
|
payload: chunk,
|
|
31
|
-
headers: this.
|
|
25
|
+
headers: this.eventStreamCodec.formatHeaders(dateHeader),
|
|
32
26
|
}, {
|
|
33
27
|
priorSignature: this.priorSignature,
|
|
34
28
|
signingDate: now,
|
|
@@ -36,7 +30,7 @@ var EventSigningStream = (function (_super) {
|
|
|
36
30
|
case 1:
|
|
37
31
|
signature = _a.sent();
|
|
38
32
|
this.priorSignature = signature;
|
|
39
|
-
serializedSigned = this.
|
|
33
|
+
serializedSigned = this.eventStreamCodec.encode({
|
|
40
34
|
headers: __assign(__assign({}, dateHeader), { ":chunk-signature": {
|
|
41
35
|
type: "binary",
|
|
42
36
|
value: getSignatureBinary(signature),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { EventStreamCodec } from "@aws-sdk/eventstream-codec";
|
|
3
3
|
import { PassThrough, pipeline, Readable } from "stream";
|
|
4
4
|
import { EventSigningStream } from "./EventSigningStream";
|
|
5
5
|
var EventStreamPayloadHandler = (function () {
|
|
6
6
|
function EventStreamPayloadHandler(options) {
|
|
7
7
|
this.eventSigner = options.eventSigner;
|
|
8
|
-
this.
|
|
8
|
+
this.eventStreamCodec = new EventStreamCodec(options.utf8Encoder, options.utf8Decoder);
|
|
9
9
|
}
|
|
10
10
|
EventStreamPayloadHandler.prototype.handle = function (next, args, context) {
|
|
11
11
|
if (context === void 0) { context = {}; }
|
|
@@ -41,7 +41,7 @@ var EventStreamPayloadHandler = (function () {
|
|
|
41
41
|
_a = EventSigningStream.bind;
|
|
42
42
|
_b = {
|
|
43
43
|
priorSignature: priorSignature,
|
|
44
|
-
|
|
44
|
+
eventStreamCodec: this.eventStreamCodec
|
|
45
45
|
};
|
|
46
46
|
return [4, this.eventSigner()];
|
|
47
47
|
case 5:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { EventStreamCodec } from "@aws-sdk/eventstream-codec";
|
|
3
3
|
import { EventSigner } from "@aws-sdk/types";
|
|
4
4
|
import { Transform, TransformCallback, TransformOptions } from "stream";
|
|
5
5
|
export interface EventSigningStreamOptions extends TransformOptions {
|
|
6
6
|
priorSignature: string;
|
|
7
7
|
eventSigner: EventSigner;
|
|
8
|
-
|
|
8
|
+
eventStreamCodec: EventStreamCodec;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* A transform stream that signs the eventstream
|
|
@@ -13,7 +13,7 @@ export interface EventSigningStreamOptions extends TransformOptions {
|
|
|
13
13
|
export declare class EventSigningStream extends Transform {
|
|
14
14
|
private priorSignature;
|
|
15
15
|
private eventSigner;
|
|
16
|
-
private
|
|
16
|
+
private eventStreamCodec;
|
|
17
17
|
constructor(options: EventSigningStreamOptions);
|
|
18
18
|
_transform(chunk: Uint8Array, encoding: string, callback: TransformCallback): Promise<void>;
|
|
19
19
|
}
|
|
@@ -13,7 +13,7 @@ export interface EventStreamPayloadHandlerOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class EventStreamPayloadHandler implements IEventStreamPayloadHandler {
|
|
15
15
|
private readonly eventSigner;
|
|
16
|
-
private readonly
|
|
16
|
+
private readonly eventStreamCodec;
|
|
17
17
|
constructor(options: EventStreamPayloadHandlerOptions);
|
|
18
18
|
handle<T extends MetadataBearer>(next: FinalizeHandler<any, T>, args: FinalizeHandlerArguments<any>, context?: HandlerExecutionContext): Promise<FinalizeHandlerOutput<T>>;
|
|
19
19
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { EventStreamCodec } from "@aws-sdk/eventstream-codec";
|
|
3
3
|
import { EventSigner } from "@aws-sdk/types";
|
|
4
4
|
import { Transform, TransformCallback, TransformOptions } from "stream";
|
|
5
5
|
export interface EventSigningStreamOptions extends TransformOptions {
|
|
6
6
|
priorSignature: string;
|
|
7
7
|
eventSigner: EventSigner;
|
|
8
|
-
|
|
8
|
+
eventStreamCodec: EventStreamCodec;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export declare class EventSigningStream extends Transform {
|
|
12
12
|
private priorSignature;
|
|
13
13
|
private eventSigner;
|
|
14
|
-
private
|
|
14
|
+
private eventStreamCodec;
|
|
15
15
|
constructor(options: EventSigningStreamOptions);
|
|
16
16
|
_transform(chunk: Uint8Array, encoding: string, callback: TransformCallback): Promise<void>;
|
|
17
17
|
}
|
|
@@ -7,7 +7,7 @@ export interface EventStreamPayloadHandlerOptions {
|
|
|
7
7
|
|
|
8
8
|
export declare class EventStreamPayloadHandler implements IEventStreamPayloadHandler {
|
|
9
9
|
private readonly eventSigner;
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly eventStreamCodec;
|
|
11
11
|
constructor(options: EventStreamPayloadHandlerOptions);
|
|
12
12
|
handle<T extends MetadataBearer>(next: FinalizeHandler<any, T>, args: FinalizeHandlerArguments<any>, context?: HandlerExecutionContext): Promise<FinalizeHandlerOutput<T>>;
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/eventstream-handler-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.127.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aws-sdk/eventstream-
|
|
23
|
-
"@aws-sdk/types": "3.
|
|
22
|
+
"@aws-sdk/eventstream-codec": "3.127.0",
|
|
23
|
+
"@aws-sdk/types": "3.127.0",
|
|
24
24
|
"tslib": "^2.3.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@aws-sdk/util-utf8-node": "3.109.0",
|
|
28
28
|
"@tsconfig/recommended": "1.0.1",
|
|
29
|
-
"@types/node": "^
|
|
29
|
+
"@types/node": "^12.0.0",
|
|
30
30
|
"concurrently": "7.0.0",
|
|
31
31
|
"downlevel-dts": "0.7.0",
|
|
32
32
|
"rimraf": "3.0.2",
|