@middy/http-partial-response 3.0.2 → 3.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2022 Luciano Mammino, will Farrell and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
3
+ Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell) and the [Middy team](https://github.com/middyjs/middy/graphs/contributors)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  <a href="https://packagephobia.com/result?p=@middy/http-partial-response">
10
10
  <img src="https://packagephobia.com/badge?p=@middy/http-partial-response" alt="npm install size" style="max-width:100%;">
11
11
  </a>
12
- <a href="https://github.com/middyjs/middy/actions">
13
- <img src="https://github.com/middyjs/middy/workflows/Tests/badge.svg" alt="GitHub Actions test status badge" style="max-width:100%;">
12
+ <a href="https://github.com/middyjs/middy/actions/workflows/tests.yml">
13
+ <img src="https://github.com/middyjs/middy/actions/workflows/tests.yml/badge.svg?branch=main&event=push" alt="GitHub Actions CI status badge" style="max-width:100%;">
14
14
  </a>
15
15
  <br/>
16
16
  <a href="https://standardjs.com/">
@@ -33,6 +33,7 @@
33
33
  <img src="https://img.shields.io/badge/StackOverflow-[middy]-yellow" alt="Ask questions on StackOverflow" style="max-width:100%;">
34
34
  </a>
35
35
  </p>
36
+ <p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/http-partial-response">https://middy.js.org/docs/middlewares/http-partial-response</a></p>
36
37
  </div>
37
38
 
38
39
  Filtering the data returned in an object or JSON stringified response has never been so easy. Add the `httpPartialResponse` middleware to your middleware chain, specify a custom `filteringKeyName` if you want to and that's it. Any consumer of your API will be able to filter your JSON response by adding a querystring key with the fields to filter such as `fields=firstname,lastname`.
@@ -105,7 +106,7 @@ Everyone is very welcome to contribute to this repository. Feel free to [raise i
105
106
 
106
107
  ## License
107
108
 
108
- Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
109
+ Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
109
110
 
110
111
  <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
111
112
  <img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
package/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _jsonMask=_interopRequireDefault(require("json-mask"));var _util=require("@middy/util");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}const defaults={filteringKeyName:"fields"};const httpPartialResponseMiddleware=(opts={})=>{const options={...defaults,...opts};const{filteringKeyName}=options;const httpPartialResponseMiddlewareAfter=async request=>{const fields=request.event?.queryStringParameters?.[filteringKeyName];if(!fields)return;(0,_util).normalizeHttpResponse(request);const body=request.response.body;const bodyIsString=typeof body==="string";const parsedBody=(0,_util).jsonSafeParse(body);if(typeof parsedBody!=="object")return;const filteredBody=(0,_jsonMask).default(parsedBody,fields);request.response.body=bodyIsString?JSON.stringify(filteredBody):filteredBody};return{after:httpPartialResponseMiddlewareAfter}};var _default=httpPartialResponseMiddleware;exports.default=_default
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});module.exports=void 0;var _jsonMask=_interopRequireDefault(require("json-mask"));var _util=require("@middy/util");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}const defaults={filteringKeyName:"fields"};const httpPartialResponseMiddleware=(opts={})=>{const options={...defaults,...opts};const{filteringKeyName}=options;const httpPartialResponseMiddlewareAfter=async request=>{const fields=request.event?.queryStringParameters?.[filteringKeyName];if(!fields)return;(0,_util).normalizeHttpResponse(request);const body=request.response.body;const bodyIsString=typeof body==="string";const parsedBody=(0,_util).jsonSafeParse(body);if(typeof parsedBody!=="object")return;const filteredBody=(0,_jsonMask).default(parsedBody,fields);request.response.body=bodyIsString?JSON.stringify(filteredBody):filteredBody};return{after:httpPartialResponseMiddlewareAfter}};var _default=httpPartialResponseMiddleware;module.exports=_default
2
2
 
3
3
  //# sourceMappingURL=index.cjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-partial-response",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Http partial response middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -56,11 +56,11 @@
56
56
  },
57
57
  "homepage": "https://middy.js.org",
58
58
  "dependencies": {
59
- "@middy/util": "^3.0.2",
60
- "json-mask": "1.0.4"
59
+ "@middy/util": "3.0.3",
60
+ "json-mask": "2.0.0"
61
61
  },
62
- "gitHead": "983649b8359ea32a786e75dfc2953aeee8ec6052",
62
+ "gitHead": "ea9e5e8cce754d0c467c7dd3ac9a7601149efea2",
63
63
  "devDependencies": {
64
- "@middy/core": "^3.0.2"
64
+ "@middy/core": "3.0.3"
65
65
  }
66
66
  }