@middy/http-partial-response 4.0.0-alpha.4 → 4.0.1
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 +0 -68
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -36,74 +36,6 @@
|
|
|
36
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>
|
|
37
37
|
</div>
|
|
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`.
|
|
40
|
-
|
|
41
|
-
This middleware is based on the awesome `json-mask` package written by [Yuriy Nemtsov](https://github.com/nemtsov)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
## Install
|
|
45
|
-
|
|
46
|
-
To install this middleware you can use NPM:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npm install --save @middy/http-partial-response
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
## Options
|
|
54
|
-
None
|
|
55
|
-
|
|
56
|
-
## Sample usage
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
import middy from '@middy/core'
|
|
60
|
-
import httpPartialResponse from '@middy/http-partial-response'
|
|
61
|
-
|
|
62
|
-
const handler = middy((event, context) => {
|
|
63
|
-
const response = {
|
|
64
|
-
statusCode: 200,
|
|
65
|
-
body: {
|
|
66
|
-
firstname: 'John',
|
|
67
|
-
lastname: 'Doe',
|
|
68
|
-
gender: 'male',
|
|
69
|
-
age: 30,
|
|
70
|
-
address: {
|
|
71
|
-
street: 'Avenue des Champs-Élysées',
|
|
72
|
-
city: 'Paris'
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return response
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
handler.use(httpPartialResponse())
|
|
81
|
-
|
|
82
|
-
const event = {
|
|
83
|
-
queryStringParameters: {
|
|
84
|
-
fields: 'firstname,lastname'
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
handler(event, {}, (_, response) => {
|
|
89
|
-
expect(response.body).toEqual({
|
|
90
|
-
firstname: 'John',
|
|
91
|
-
lastname: 'Doe'
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## Middy documentation and examples
|
|
98
|
-
|
|
99
|
-
For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
## Contributing
|
|
103
|
-
|
|
104
|
-
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).
|
|
105
|
-
|
|
106
|
-
|
|
107
39
|
## License
|
|
108
40
|
|
|
109
41
|
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).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-partial-response",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Http partial response middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
},
|
|
64
64
|
"homepage": "https://middy.js.org",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@middy/util": "4.0.
|
|
66
|
+
"@middy/util": "4.0.1",
|
|
67
67
|
"json-mask": "2.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "c5ece2bfbb0d607dcdea5685bf194a6cc19acc8d",
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@middy/core": "4.0.
|
|
71
|
+
"@middy/core": "4.0.1"
|
|
72
72
|
}
|
|
73
73
|
}
|