@aws-sdk/middleware-websocket
Advanced tools
+15
-8
@@ -67,2 +67,6 @@ 'use strict'; | ||
| request.body = placeHolderStream.readable; | ||
| const match = (headers?.authorization ?? "").match(/Signature=(\w+)$/); | ||
| const priorSignature = (match ?? [])[1] ?? (query && query["X-Amz-Signature"]) ?? ""; | ||
| const signingStream = getEventSigningTransformStream(priorSignature, await this.messageSigner(), this.eventStreamCodec, this.systemClockOffsetProvider); | ||
| payload.pipeThrough(signingStream).pipeThrough(placeHolderStream); | ||
| let result; | ||
@@ -73,10 +77,8 @@ try { | ||
| catch (e) { | ||
| request.body.cancel(); | ||
| const p = payload.cancel?.(); | ||
| if (p instanceof Promise) { | ||
| p.catch(() => { }); | ||
| } | ||
| throw e; | ||
| } | ||
| const match = (headers["authorization"] || "").match(/Signature=([\w]+)$/); | ||
| const priorSignature = (match || [])[1] || (query && query["X-Amz-Signature"]) || ""; | ||
| const signingStream = getEventSigningTransformStream(priorSignature, await this.messageSigner(), this.eventStreamCodec, this.systemClockOffsetProvider); | ||
| const signedPayload = payload.pipeThrough(signingStream); | ||
| signedPayload.pipeThrough(placeHolderStream); | ||
| return result; | ||
@@ -315,4 +317,9 @@ } | ||
| try { | ||
| for await (const inputChunk of data) { | ||
| socket.send(inputChunk); | ||
| for await (const chunk of data) { | ||
| if (socket.readyState >= WebSocket.CLOSING) { | ||
| break; | ||
| } | ||
| else { | ||
| socket.send(chunk); | ||
| } | ||
| } | ||
@@ -319,0 +326,0 @@ } |
@@ -20,2 +20,6 @@ import { EventStreamCodec } from "@smithy/eventstream-codec"; | ||
| request.body = placeHolderStream.readable; | ||
| const match = (headers?.authorization ?? "").match(/Signature=(\w+)$/); | ||
| const priorSignature = (match ?? [])[1] ?? (query && query["X-Amz-Signature"]) ?? ""; | ||
| const signingStream = getEventSigningTransformStream(priorSignature, await this.messageSigner(), this.eventStreamCodec, this.systemClockOffsetProvider); | ||
| payload.pipeThrough(signingStream).pipeThrough(placeHolderStream); | ||
| let result; | ||
@@ -26,12 +30,10 @@ try { | ||
| catch (e) { | ||
| request.body.cancel(); | ||
| const p = payload.cancel?.(); | ||
| if (p instanceof Promise) { | ||
| p.catch(() => { }); | ||
| } | ||
| throw e; | ||
| } | ||
| const match = (headers["authorization"] || "").match(/Signature=([\w]+)$/); | ||
| const priorSignature = (match || [])[1] || (query && query["X-Amz-Signature"]) || ""; | ||
| const signingStream = getEventSigningTransformStream(priorSignature, await this.messageSigner(), this.eventStreamCodec, this.systemClockOffsetProvider); | ||
| const signedPayload = payload.pipeThrough(signingStream); | ||
| signedPayload.pipeThrough(placeHolderStream); | ||
| return result; | ||
| } | ||
| } |
@@ -135,4 +135,9 @@ import { formatUrl } from "@aws-sdk/util-format-url"; | ||
| try { | ||
| for await (const inputChunk of data) { | ||
| socket.send(inputChunk); | ||
| for await (const chunk of data) { | ||
| if (socket.readyState >= WebSocket.CLOSING) { | ||
| break; | ||
| } | ||
| else { | ||
| socket.send(chunk); | ||
| } | ||
| } | ||
@@ -139,0 +144,0 @@ } |
| import { EventStreamPayloadHandlerProvider } from "@smithy/types"; | ||
| /** NodeJS event stream utils provider */ | ||
| /** | ||
| * @internal | ||
| */ | ||
| export declare const eventStreamPayloadHandlerProvider: EventStreamPayloadHandlerProvider; |
| import { Decoder, Encoder, EventStreamPayloadHandler as IEventStreamPayloadHandler, FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput, HandlerExecutionContext, MessageSigner, MetadataBearer, Provider } from "@smithy/types"; | ||
| /** | ||
| * @internal | ||
| */ | ||
| export interface EventStreamPayloadHandlerOptions { | ||
@@ -14,2 +17,4 @@ messageSigner: Provider<MessageSigner>; | ||
| * 4. Sign the payload after payload stream starting to flow. | ||
| * | ||
| * @internal | ||
| */ | ||
@@ -16,0 +21,0 @@ export declare class EventStreamPayloadHandler implements IEventStreamPayloadHandler { |
+2
-3
| { | ||
| "name": "@aws-sdk/middleware-websocket", | ||
| "version": "3.972.3", | ||
| "version": "3.972.4", | ||
| "main": "./dist-cjs/index.js", | ||
@@ -45,4 +45,3 @@ "module": "./dist-es/index.js", | ||
| "typescript": "~5.8.3", | ||
| "vitest-websocket-mock": "0.2.3", | ||
| "web-streams-polyfill": "3.2.1" | ||
| "vitest-websocket-mock": "0.2.3" | ||
| }, | ||
@@ -49,0 +48,0 @@ "engines": { |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
52163
0.77%7
-12.5%1001
2.14%0
-100%