@middy/ws-response 7.1.1 → 7.1.3
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 +17 -0
- package/index.d.ts +3 -1
- package/index.js +4 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -30,6 +30,23 @@
|
|
|
30
30
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/ws-response">https://middy.js.org/docs/middlewares/ws-response</a></p>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install --save @middy/ws-response @aws-sdk/client-apigatewaymanagementapi
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Documentation and examples
|
|
41
|
+
|
|
42
|
+
For documentation and examples, refer to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org/docs/middlewares/ws-response).
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Contributing
|
|
46
|
+
|
|
47
|
+
Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
|
|
48
|
+
|
|
49
|
+
|
|
33
50
|
## License
|
|
34
51
|
|
|
35
52
|
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface Options<
|
|
|
21
21
|
| "disablePrefetch"
|
|
22
22
|
> {}
|
|
23
23
|
|
|
24
|
-
declare function wsResponse(
|
|
24
|
+
declare function wsResponse(
|
|
25
|
+
options?: Options,
|
|
26
|
+
): middy.MiddlewareObj<unknown, unknown, Error>;
|
|
25
27
|
|
|
26
28
|
export default wsResponse;
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const defaults = {
|
|
|
20
20
|
disablePrefetch: false,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const wsResponseMiddleware = (opts) => {
|
|
23
|
+
const wsResponseMiddleware = (opts = {}) => {
|
|
24
24
|
const options = { ...defaults, ...opts };
|
|
25
25
|
|
|
26
26
|
let client;
|
|
@@ -33,11 +33,12 @@ const wsResponseMiddleware = (opts) => {
|
|
|
33
33
|
|
|
34
34
|
if (!normalizedResponse.ConnectionId) return;
|
|
35
35
|
|
|
36
|
-
if (
|
|
37
|
-
options.awsClientOptions.endpoint
|
|
36
|
+
if (request.event.requestContext) {
|
|
37
|
+
options.awsClientOptions.endpoint ??= `https://${
|
|
38
38
|
request.event.requestContext.domainName
|
|
39
39
|
}/${request.event.requestContext.stage}`;
|
|
40
40
|
}
|
|
41
|
+
|
|
41
42
|
if (!client) {
|
|
42
43
|
client = await createClient(options, request);
|
|
43
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ws-response",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"description": "WebSocket response handling middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"url": "https://github.com/sponsors/willfarrell"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@middy/util": "7.1.
|
|
68
|
+
"@middy/util": "7.1.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.0.0"
|
|
@@ -77,9 +77,9 @@
|
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.0.0",
|
|
80
|
-
"@middy/core": "7.1.
|
|
80
|
+
"@middy/core": "7.1.3",
|
|
81
81
|
"@types/aws-lambda": "^8.0.0",
|
|
82
|
+
"@types/node": "^22.0.0",
|
|
82
83
|
"aws-xray-sdk": "^3.3.3"
|
|
83
|
-
}
|
|
84
|
-
"gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
|
|
84
|
+
}
|
|
85
85
|
}
|