@spytecgps/lambda-utils 2.3.16 → 2.3.17
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/index.js +14 -5
- package/dist/types.d.ts +3 -0
- package/dist/wrappers/response.d.ts +1 -1
- package/package.json +2 -2
- package/dist/logger/index.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var dayjs = require('dayjs');
|
|
|
5
5
|
var timezone = require('dayjs/plugin/timezone');
|
|
6
6
|
var utc = require('dayjs/plugin/utc');
|
|
7
7
|
var Joi = require('joi');
|
|
8
|
-
var qs = require('qs');
|
|
9
8
|
var rawMiddy = require('@middy/core');
|
|
10
9
|
var httpErrorHandler = require('@middy/http-error-handler');
|
|
11
10
|
var httpResponseSerializer = require('@middy/http-response-serializer');
|
|
@@ -32,7 +31,16 @@ function _interopNamespaceDefault(e) {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
var Joi__namespace = /*#__PURE__*/_interopNamespaceDefault(Joi);
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
var stringify = require('./stringify');
|
|
36
|
+
var parse = require('./parse');
|
|
37
|
+
var formats = require('./formats');
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
formats: formats,
|
|
41
|
+
parse: parse,
|
|
42
|
+
stringify: stringify
|
|
43
|
+
};
|
|
36
44
|
|
|
37
45
|
dayjs.extend(utc);
|
|
38
46
|
dayjs.extend(timezone);
|
|
@@ -64,7 +72,7 @@ const urlEncoded = Joi__namespace.extend((joi) => {
|
|
|
64
72
|
type: 'object',
|
|
65
73
|
base: joi.object(),
|
|
66
74
|
coerce(value) {
|
|
67
|
-
return { value:
|
|
75
|
+
return { value: undefined(value) };
|
|
68
76
|
},
|
|
69
77
|
};
|
|
70
78
|
});
|
|
@@ -86,7 +94,7 @@ const SpytecJoi = Joi__namespace.extend((joi) => ({
|
|
|
86
94
|
type: 'urlEncodedObject',
|
|
87
95
|
base: joi.object(),
|
|
88
96
|
coerce(value) {
|
|
89
|
-
return { value:
|
|
97
|
+
return { value: undefined(value) };
|
|
90
98
|
},
|
|
91
99
|
}), (joi) => ({
|
|
92
100
|
type: 'jsonObject',
|
|
@@ -270,11 +278,12 @@ const buildResponseBody = (statusCode, message, data) => {
|
|
|
270
278
|
result: typeof data !== 'undefined' ? data : undefined,
|
|
271
279
|
};
|
|
272
280
|
};
|
|
273
|
-
const buildProxyResult = ({ statusCode = 200, message = 'ok', data, headers = {}, rawResult = false, stringifyBody = true, }) => {
|
|
281
|
+
const buildProxyResult = ({ statusCode = 200, message = 'ok', data, headers = {}, multiValueHeaders = {}, rawResult = false, stringifyBody = true, }) => {
|
|
274
282
|
const resp = rawResult ? data : buildResponseBody(statusCode, message, data);
|
|
275
283
|
const body = stringifyBody ? resp && JSON.stringify(resp) : data;
|
|
276
284
|
return {
|
|
277
285
|
headers: { ...baseHeaders, ...headers },
|
|
286
|
+
multiValueHeaders,
|
|
278
287
|
statusCode,
|
|
279
288
|
body,
|
|
280
289
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare const buildResponseBody: <T>(statusCode: number, message: string,
|
|
|
5
5
|
message: string;
|
|
6
6
|
result: T | undefined;
|
|
7
7
|
};
|
|
8
|
-
export declare const buildProxyResult: <R>({ statusCode, message, data, headers, rawResult, stringifyBody, }: HandlerResponse<R>) => APIGatewayProxyResult;
|
|
8
|
+
export declare const buildProxyResult: <R>({ statusCode, message, data, headers, multiValueHeaders, rawResult, stringifyBody, }: HandlerResponse<R>) => APIGatewayProxyResult;
|
package/package.json
CHANGED
package/dist/logger/index.d.ts
DELETED