@aws-sdk/middleware-websocket 3.714.0 → 3.723.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/dist-cjs/index.js CHANGED
@@ -77,7 +77,13 @@ var getEventSigningTransformStream = /* @__PURE__ */ __name((initialSignature, m
77
77
  }, "getEventSigningTransformStream");
78
78
 
79
79
  // src/EventStreamPayloadHandler.ts
80
- var _EventStreamPayloadHandler = class _EventStreamPayloadHandler {
80
+ var EventStreamPayloadHandler = class {
81
+ static {
82
+ __name(this, "EventStreamPayloadHandler");
83
+ }
84
+ messageSigner;
85
+ eventStreamCodec;
86
+ systemClockOffsetProvider;
81
87
  constructor(options) {
82
88
  this.messageSigner = options.messageSigner;
83
89
  this.eventStreamCodec = new import_eventstream_codec.EventStreamCodec(options.utf8Encoder, options.utf8Decoder);
@@ -111,8 +117,6 @@ var _EventStreamPayloadHandler = class _EventStreamPayloadHandler {
111
117
  return result;
112
118
  }
113
119
  };
114
- __name(_EventStreamPayloadHandler, "EventStreamPayloadHandler");
115
- var EventStreamPayloadHandler = _EventStreamPayloadHandler;
116
120
 
117
121
  // src/eventstream-payload-handler-provider.ts
118
122
  var eventStreamPayloadHandlerProvider = /* @__PURE__ */ __name((options) => new EventStreamPayloadHandler(options), "eventStreamPayloadHandlerProvider");
@@ -139,9 +143,8 @@ var injectSessionIdMiddlewareOptions = {
139
143
  // src/middleware-websocket-endpoint.ts
140
144
  var import_protocol_http = require("@smithy/protocol-http");
141
145
  var websocketEndpointMiddleware = /* @__PURE__ */ __name((config, options) => (next) => (args) => {
142
- var _a, _b;
143
146
  const { request } = args;
144
- if (import_protocol_http.HttpRequest.isInstance(request) && ((_b = (_a = config.requestHandler.metadata) == null ? void 0 : _a.handlerProtocol) == null ? void 0 : _b.toLowerCase().includes("websocket"))) {
147
+ if (import_protocol_http.HttpRequest.isInstance(request) && config.requestHandler.metadata?.handlerProtocol?.toLowerCase().includes("websocket")) {
145
148
  request.protocol = "wss:";
146
149
  request.method = "GET";
147
150
  request.path = `${request.path}-websocket`;
@@ -184,7 +187,11 @@ var getWebSocketPlugin = /* @__PURE__ */ __name((config, options) => ({
184
187
  var isWebSocketRequest = /* @__PURE__ */ __name((request) => request.protocol === "ws:" || request.protocol === "wss:", "isWebSocketRequest");
185
188
 
186
189
  // src/WebsocketSignatureV4.ts
187
- var _WebsocketSignatureV4 = class _WebsocketSignatureV4 {
190
+ var WebsocketSignatureV4 = class {
191
+ static {
192
+ __name(this, "WebsocketSignatureV4");
193
+ }
194
+ signer;
188
195
  constructor(options) {
189
196
  this.signer = options.signer;
190
197
  }
@@ -214,8 +221,6 @@ var _WebsocketSignatureV4 = class _WebsocketSignatureV4 {
214
221
  }
215
222
  }
216
223
  };
217
- __name(_WebsocketSignatureV4, "WebsocketSignatureV4");
218
- var WebsocketSignatureV4 = _WebsocketSignatureV4;
219
224
 
220
225
  // src/websocket-configuration.ts
221
226
  var resolveWebSocketConfig = /* @__PURE__ */ __name((input) => ({
@@ -236,27 +241,23 @@ var import_eventstream_serde_browser = require("@smithy/eventstream-serde-browse
236
241
  var import_fetch_http_handler = require("@smithy/fetch-http-handler");
237
242
 
238
243
  var DEFAULT_WS_CONNECTION_TIMEOUT_MS = 2e3;
239
- var _WebSocketFetchHandler = class _WebSocketFetchHandler {
240
- constructor(options, httpHandler = new import_fetch_http_handler.FetchHttpHandler()) {
241
- this.metadata = {
242
- handlerProtocol: "websocket/h1.1"
243
- };
244
- this.sockets = {};
245
- this.httpHandler = httpHandler;
246
- if (typeof options === "function") {
247
- this.config = {};
248
- this.configPromise = options().then((opts) => this.config = opts ?? {});
249
- } else {
250
- this.config = options ?? {};
251
- this.configPromise = Promise.resolve(this.config);
252
- }
244
+ var WebSocketFetchHandler = class _WebSocketFetchHandler {
245
+ static {
246
+ __name(this, "WebSocketFetchHandler");
253
247
  }
248
+ metadata = {
249
+ handlerProtocol: "websocket/h1.1"
250
+ };
251
+ config;
252
+ configPromise;
253
+ httpHandler;
254
+ sockets = {};
254
255
  /**
255
256
  * @returns the input if it is an HttpHandler of any class,
256
257
  * or instantiates a new instance of this handler.
257
258
  */
258
259
  static create(instanceOrOptions, httpHandler = new import_fetch_http_handler.FetchHttpHandler()) {
259
- if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") {
260
+ if (typeof instanceOrOptions?.handle === "function") {
260
261
  return instanceOrOptions;
261
262
  }
262
263
  return new _WebSocketFetchHandler(
@@ -264,6 +265,16 @@ var _WebSocketFetchHandler = class _WebSocketFetchHandler {
264
265
  httpHandler
265
266
  );
266
267
  }
268
+ constructor(options, httpHandler = new import_fetch_http_handler.FetchHttpHandler()) {
269
+ this.httpHandler = httpHandler;
270
+ if (typeof options === "function") {
271
+ this.config = {};
272
+ this.configPromise = options().then((opts) => this.config = opts ?? {});
273
+ } else {
274
+ this.config = options ?? {};
275
+ this.configPromise = Promise.resolve(this.config);
276
+ }
277
+ }
267
278
  /**
268
279
  * Destroys the WebSocketHandler.
269
280
  * Closes all sockets from the socket pool.
@@ -392,8 +403,6 @@ var _WebSocketFetchHandler = class _WebSocketFetchHandler {
392
403
  return outputStream;
393
404
  }
394
405
  };
395
- __name(_WebSocketFetchHandler, "WebSocketFetchHandler");
396
- var WebSocketFetchHandler = _WebSocketFetchHandler;
397
406
  var getIterator = /* @__PURE__ */ __name((stream) => {
398
407
  if (stream[Symbol.asyncIterator]) {
399
408
  return stream;
@@ -1,6 +1,9 @@
1
1
  import { EventStreamCodec } from "@smithy/eventstream-codec";
2
2
  import { getEventSigningTransformStream } from "./get-event-signing-stream";
3
3
  export class EventStreamPayloadHandler {
4
+ messageSigner;
5
+ eventStreamCodec;
6
+ systemClockOffsetProvider;
4
7
  constructor(options) {
5
8
  this.messageSigner = options.messageSigner;
6
9
  this.eventStreamCodec = new EventStreamCodec(options.utf8Encoder, options.utf8Decoder);
@@ -1,6 +1,7 @@
1
1
  import { HttpRequest } from "@smithy/protocol-http";
2
2
  import { isWebSocketRequest } from "./utils";
3
3
  export class WebsocketSignatureV4 {
4
+ signer;
4
5
  constructor(options) {
5
6
  this.signer = options.signer;
6
7
  }
@@ -5,6 +5,13 @@ import { HttpResponse } from "@smithy/protocol-http";
5
5
  import { isWebSocketRequest } from "./utils";
6
6
  const DEFAULT_WS_CONNECTION_TIMEOUT_MS = 2000;
7
7
  export class WebSocketFetchHandler {
8
+ metadata = {
9
+ handlerProtocol: "websocket/h1.1",
10
+ };
11
+ config;
12
+ configPromise;
13
+ httpHandler;
14
+ sockets = {};
8
15
  static create(instanceOrOptions, httpHandler = new FetchHttpHandler()) {
9
16
  if (typeof instanceOrOptions?.handle === "function") {
10
17
  return instanceOrOptions;
@@ -12,10 +19,6 @@ export class WebSocketFetchHandler {
12
19
  return new WebSocketFetchHandler(instanceOrOptions, httpHandler);
13
20
  }
14
21
  constructor(options, httpHandler = new FetchHttpHandler()) {
15
- this.metadata = {
16
- handlerProtocol: "websocket/h1.1",
17
- };
18
- this.sockets = {};
19
22
  this.httpHandler = httpHandler;
20
23
  if (typeof options === "function") {
21
24
  this.config = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-websocket",
3
- "version": "3.714.0",
3
+ "version": "3.723.0",
4
4
  "main": "./dist-cjs/index.js",
5
5
  "module": "./dist-es/index.js",
6
6
  "types": "./dist-types/index.d.ts",
@@ -23,15 +23,15 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@aws-sdk/types": "3.714.0",
27
- "@aws-sdk/util-format-url": "3.714.0",
28
- "@smithy/eventstream-codec": "^3.1.10",
29
- "@smithy/eventstream-serde-browser": "^3.0.14",
30
- "@smithy/fetch-http-handler": "^4.1.2",
31
- "@smithy/protocol-http": "^4.1.8",
32
- "@smithy/signature-v4": "^4.2.4",
33
- "@smithy/types": "^3.7.2",
34
- "@smithy/util-hex-encoding": "^3.0.0",
26
+ "@aws-sdk/types": "3.723.0",
27
+ "@aws-sdk/util-format-url": "3.723.0",
28
+ "@smithy/eventstream-codec": "^4.0.0",
29
+ "@smithy/eventstream-serde-browser": "^4.0.0",
30
+ "@smithy/fetch-http-handler": "^5.0.0",
31
+ "@smithy/protocol-http": "^5.0.0",
32
+ "@smithy/signature-v4": "^5.0.0",
33
+ "@smithy/types": "^4.0.0",
34
+ "@smithy/util-hex-encoding": "^4.0.0",
35
35
  "tslib": "^2.6.2"
36
36
  },
37
37
  "devDependencies": {
@@ -40,7 +40,7 @@
40
40
  "downlevel-dts": "0.10.1",
41
41
  "mock-socket": "9.1.5",
42
42
  "rimraf": "3.0.2",
43
- "typescript": "~4.9.5",
43
+ "typescript": "~5.2.2",
44
44
  "vitest-websocket-mock": "0.2.3",
45
45
  "web-streams-polyfill": "3.2.1"
46
46
  },