@middy/http-partial-response 6.1.6 → 6.2.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.
Files changed (3) hide show
  1. package/index.d.ts +4 -4
  2. package/index.js +24 -24
  3. package/package.json +70 -73
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import middy from '@middy/core'
1
+ import type middy from "@middy/core";
2
2
 
3
3
  interface Options {
4
- filteringKeyName?: string
4
+ filteringKeyName?: string;
5
5
  }
6
6
 
7
- declare function httpPartialResponse (options?: Options): middy.MiddlewareObj
7
+ declare function httpPartialResponse(options?: Options): middy.MiddlewareObj;
8
8
 
9
- export default httpPartialResponse
9
+ export default httpPartialResponse;
package/index.js CHANGED
@@ -1,34 +1,34 @@
1
- import mask from 'json-mask'
2
- import { normalizeHttpResponse, jsonSafeParse } from '@middy/util'
1
+ import { jsonSafeParse, normalizeHttpResponse } from "@middy/util";
2
+ import mask from "json-mask";
3
3
 
4
4
  const defaults = {
5
- filteringKeyName: 'fields'
6
- }
5
+ filteringKeyName: "fields",
6
+ };
7
7
 
8
8
  const httpPartialResponseMiddleware = (opts = {}) => {
9
- const options = { ...defaults, ...opts }
10
- const { filteringKeyName } = options
9
+ const options = { ...defaults, ...opts };
10
+ const { filteringKeyName } = options;
11
11
 
12
- const httpPartialResponseMiddlewareAfter = async (request) => {
13
- const fields = request.event?.queryStringParameters?.[filteringKeyName]
14
- if (!fields) return
12
+ const httpPartialResponseMiddlewareAfter = async (request) => {
13
+ const fields = request.event?.queryStringParameters?.[filteringKeyName];
14
+ if (!fields) return;
15
15
 
16
- normalizeHttpResponse(request)
17
- const body = request.response.body
18
- const bodyIsString = typeof body === 'string'
16
+ normalizeHttpResponse(request);
17
+ const body = request.response.body;
18
+ const bodyIsString = typeof body === "string";
19
19
 
20
- const parsedBody = jsonSafeParse(body)
21
- if (typeof parsedBody !== 'object') return
20
+ const parsedBody = jsonSafeParse(body);
21
+ if (typeof parsedBody !== "object") return;
22
22
 
23
- const filteredBody = mask(parsedBody, fields)
23
+ const filteredBody = mask(parsedBody, fields);
24
24
 
25
- request.response.body = bodyIsString
26
- ? JSON.stringify(filteredBody)
27
- : filteredBody
28
- }
25
+ request.response.body = bodyIsString
26
+ ? JSON.stringify(filteredBody)
27
+ : filteredBody;
28
+ };
29
29
 
30
- return {
31
- after: httpPartialResponseMiddlewareAfter
32
- }
33
- }
34
- export default httpPartialResponseMiddleware
30
+ return {
31
+ after: httpPartialResponseMiddlewareAfter,
32
+ };
33
+ };
34
+ export default httpPartialResponseMiddleware;
package/package.json CHANGED
@@ -1,75 +1,72 @@
1
1
  {
2
- "name": "@middy/http-partial-response",
3
- "version": "6.1.6",
4
- "description": "Http partial response middleware for the middy framework",
5
- "type": "module",
6
- "engines": {
7
- "node": ">=20"
8
- },
9
- "engineStrict": true,
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "module": "./index.js",
14
- "exports": {
15
- ".": {
16
- "import": {
17
- "types": "./index.d.ts",
18
- "default": "./index.js"
19
- },
20
- "require": {
21
- "default": "./index.js"
22
- }
23
- }
24
- },
25
- "types": "index.d.ts",
26
- "files": [
27
- "index.js",
28
- "index.d.ts"
29
- ],
30
- "scripts": {
31
- "test": "npm run test:unit && npm run test:fuzz",
32
- "test:unit": "node --test __tests__/index.js",
33
- "test:fuzz": "node --test __tests__/fuzz.js",
34
- "test:benchmark": "node __benchmarks__/index.js"
35
- },
36
- "license": "MIT",
37
- "keywords": [
38
- "Lambda",
39
- "Middleware",
40
- "Serverless",
41
- "Framework",
42
- "AWS",
43
- "AWS Lambda",
44
- "Middy",
45
- "HTTP",
46
- "API",
47
- "Partial",
48
- "Partial Response"
49
- ],
50
- "author": {
51
- "name": "Middy contributors",
52
- "url": "https://github.com/middyjs/middy/graphs/contributors"
53
- },
54
- "repository": {
55
- "type": "git",
56
- "url": "git+https://github.com/middyjs/middy.git",
57
- "directory": "packages/http-partial-response"
58
- },
59
- "bugs": {
60
- "url": "https://github.com/middyjs/middy/issues"
61
- },
62
- "homepage": "https://middy.js.org",
63
- "funding": {
64
- "type": "github",
65
- "url": "https://github.com/sponsors/willfarrell"
66
- },
67
- "dependencies": {
68
- "@middy/util": "6.1.6",
69
- "json-mask": "2.0.0"
70
- },
71
- "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431",
72
- "devDependencies": {
73
- "@middy/core": "6.1.6"
74
- }
2
+ "name": "@middy/http-partial-response",
3
+ "version": "6.2.0",
4
+ "description": "Http partial response middleware for the middy framework",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=20"
8
+ },
9
+ "engineStrict": true,
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "module": "./index.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./index.d.ts",
18
+ "default": "./index.js"
19
+ },
20
+ "require": {
21
+ "default": "./index.js"
22
+ }
23
+ }
24
+ },
25
+ "types": "index.d.ts",
26
+ "files": ["index.js", "index.d.ts"],
27
+ "scripts": {
28
+ "test": "npm run test:unit && npm run test:fuzz",
29
+ "test:unit": "node --test",
30
+ "test:fuzz": "node --test index.fuzz.js",
31
+ "test:perf": "node --test index.perf.js"
32
+ },
33
+ "license": "MIT",
34
+ "keywords": [
35
+ "Lambda",
36
+ "Middleware",
37
+ "Serverless",
38
+ "Framework",
39
+ "AWS",
40
+ "AWS Lambda",
41
+ "Middy",
42
+ "HTTP",
43
+ "API",
44
+ "Partial",
45
+ "Partial Response"
46
+ ],
47
+ "author": {
48
+ "name": "Middy contributors",
49
+ "url": "https://github.com/middyjs/middy/graphs/contributors"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/middyjs/middy.git",
54
+ "directory": "packages/http-partial-response"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/middyjs/middy/issues"
58
+ },
59
+ "homepage": "https://middy.js.org",
60
+ "funding": {
61
+ "type": "github",
62
+ "url": "https://github.com/sponsors/willfarrell"
63
+ },
64
+ "dependencies": {
65
+ "@middy/util": "6.2.0",
66
+ "json-mask": "2.0.0"
67
+ },
68
+ "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431",
69
+ "devDependencies": {
70
+ "@middy/core": "6.2.0"
71
+ }
75
72
  }