@bifravst/http-api-mock 1.4.77 → 1.4.79
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.
|
@@ -68,7 +68,9 @@ export const handler = async (
|
|
|
68
68
|
},
|
|
69
69
|
}),
|
|
70
70
|
)
|
|
71
|
-
console.debug(
|
|
71
|
+
console.debug(
|
|
72
|
+
`Found response items beginning with same path: ${Items?.length}`,
|
|
73
|
+
)
|
|
72
74
|
// use newest response first
|
|
73
75
|
const itemsByTimestampDesc = (Items ?? [])
|
|
74
76
|
.map((Item) => unmarshall(Item))
|
|
@@ -76,7 +78,8 @@ export const handler = async (
|
|
|
76
78
|
|
|
77
79
|
let res: APIGatewayProxyResult | undefined
|
|
78
80
|
for (const objItem of itemsByTimestampDesc) {
|
|
79
|
-
const hasExpectedQueryParams =
|
|
81
|
+
const hasExpectedQueryParams =
|
|
82
|
+
'queryParams' in objItem || query !== undefined
|
|
80
83
|
const matchedQueryParams = hasExpectedQueryParams
|
|
81
84
|
? checkMatchingQueryParams(
|
|
82
85
|
event.queryStringParameters,
|
|
@@ -85,6 +88,8 @@ export const handler = async (
|
|
|
85
88
|
: true
|
|
86
89
|
if (matchedQueryParams === false) continue
|
|
87
90
|
|
|
91
|
+
console.debug(`Matched response`, JSON.stringify({ response: objItem }))
|
|
92
|
+
|
|
88
93
|
if (
|
|
89
94
|
objItem?.methodPathQuery !== undefined &&
|
|
90
95
|
objItem?.timestamp !== undefined &&
|
|
@@ -40,19 +40,20 @@ export const handler = async (event, context) => {
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
}));
|
|
43
|
-
console.debug(`Found response items: ${Items?.length}`);
|
|
43
|
+
console.debug(`Found response items beginning with same path: ${Items?.length}`);
|
|
44
44
|
// use newest response first
|
|
45
45
|
const itemsByTimestampDesc = (Items ?? [])
|
|
46
46
|
.map((Item) => unmarshall(Item))
|
|
47
47
|
.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
48
48
|
let res;
|
|
49
49
|
for (const objItem of itemsByTimestampDesc) {
|
|
50
|
-
const hasExpectedQueryParams = 'queryParams' in objItem;
|
|
50
|
+
const hasExpectedQueryParams = 'queryParams' in objItem || query !== undefined;
|
|
51
51
|
const matchedQueryParams = hasExpectedQueryParams
|
|
52
52
|
? checkMatchingQueryParams(event.queryStringParameters, objItem.queryParams)
|
|
53
53
|
: true;
|
|
54
54
|
if (matchedQueryParams === false)
|
|
55
55
|
continue;
|
|
56
|
+
console.debug(`Matched response`, JSON.stringify({ response: objItem }));
|
|
56
57
|
if (objItem?.methodPathQuery !== undefined &&
|
|
57
58
|
objItem?.timestamp !== undefined &&
|
|
58
59
|
objItem?.keep !== true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifravst/http-api-mock",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.79",
|
|
4
4
|
"description": "Helper functions for AWS lambdas written in TypeScript.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": {
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"aws-cdk-lib": "^2.144.0",
|
|
91
91
|
"cdk": "^2.144.0",
|
|
92
92
|
"chalk": "^5.3.0",
|
|
93
|
-
"tsx": "^4.
|
|
93
|
+
"tsx": "^4.12.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@bifravst/eslint-config-typescript": "6.1.2",
|
|
97
|
-
"@bifravst/prettier-config": "1.0.
|
|
97
|
+
"@bifravst/prettier-config": "1.0.2",
|
|
98
98
|
"@commitlint/config-conventional": "19.2.2",
|
|
99
99
|
"@types/aws-lambda": "8.10.138",
|
|
100
100
|
"@types/node": "20.14.2",
|