@bifravst/http-api-mock 2.0.124 → 2.0.125
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.
|
@@ -17,8 +17,8 @@ import type { Construct } from 'constructs'
|
|
|
17
17
|
|
|
18
18
|
export class HttpApiMock extends Resource {
|
|
19
19
|
public readonly api: ApiGateway.RestApi
|
|
20
|
-
public readonly requestsTable: DynamoDB.
|
|
21
|
-
public readonly responsesTable: DynamoDB.
|
|
20
|
+
public readonly requestsTable: DynamoDB.Table
|
|
21
|
+
public readonly responsesTable: DynamoDB.Table
|
|
22
22
|
|
|
23
23
|
public constructor(
|
|
24
24
|
parent: Construct,
|
|
@@ -49,6 +49,14 @@ export class HttpApiMock extends Resource {
|
|
|
49
49
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
50
50
|
timeToLiveAttribute: 'ttl',
|
|
51
51
|
})
|
|
52
|
+
this.requestsTable.addGlobalSecondaryIndex({
|
|
53
|
+
indexName: 'methodPathQuery',
|
|
54
|
+
partitionKey: {
|
|
55
|
+
name: 'methodPathQuery',
|
|
56
|
+
type: DynamoDB.AttributeType.STRING,
|
|
57
|
+
},
|
|
58
|
+
projectionType: DynamoDB.ProjectionType.ALL,
|
|
59
|
+
})
|
|
52
60
|
|
|
53
61
|
// This table will store optional responses to be sent
|
|
54
62
|
this.responsesTable = new DynamoDB.Table(this, 'responses', {
|
|
@@ -65,6 +73,14 @@ export class HttpApiMock extends Resource {
|
|
|
65
73
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
66
74
|
timeToLiveAttribute: 'ttl',
|
|
67
75
|
})
|
|
76
|
+
this.responsesTable.addGlobalSecondaryIndex({
|
|
77
|
+
indexName: 'methodPathQuery',
|
|
78
|
+
partitionKey: {
|
|
79
|
+
name: 'methodPathQuery',
|
|
80
|
+
type: DynamoDB.AttributeType.STRING,
|
|
81
|
+
},
|
|
82
|
+
projectionType: DynamoDB.ProjectionType.ALL,
|
|
83
|
+
})
|
|
68
84
|
|
|
69
85
|
// This lambda will publish all requests made to the API Gateway in the queue
|
|
70
86
|
const lambda = new Lambda.Function(this, 'Lambda', {
|
|
@@ -3,8 +3,8 @@ import { aws_apigateway as ApiGateway, aws_dynamodb as DynamoDB, aws_lambda as L
|
|
|
3
3
|
import type { Construct } from 'constructs';
|
|
4
4
|
export declare class HttpApiMock extends Resource {
|
|
5
5
|
readonly api: ApiGateway.RestApi;
|
|
6
|
-
readonly requestsTable: DynamoDB.
|
|
7
|
-
readonly responsesTable: DynamoDB.
|
|
6
|
+
readonly requestsTable: DynamoDB.Table;
|
|
7
|
+
readonly responsesTable: DynamoDB.Table;
|
|
8
8
|
constructor(parent: Construct, { lambdaSources, layers, }: {
|
|
9
9
|
lambdaSources: {
|
|
10
10
|
httpApiMock: PackedLambda;
|
|
@@ -21,6 +21,14 @@ export class HttpApiMock extends Resource {
|
|
|
21
21
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
22
22
|
timeToLiveAttribute: 'ttl',
|
|
23
23
|
});
|
|
24
|
+
this.requestsTable.addGlobalSecondaryIndex({
|
|
25
|
+
indexName: 'methodPathQuery',
|
|
26
|
+
partitionKey: {
|
|
27
|
+
name: 'methodPathQuery',
|
|
28
|
+
type: DynamoDB.AttributeType.STRING,
|
|
29
|
+
},
|
|
30
|
+
projectionType: DynamoDB.ProjectionType.ALL,
|
|
31
|
+
});
|
|
24
32
|
// This table will store optional responses to be sent
|
|
25
33
|
this.responsesTable = new DynamoDB.Table(this, 'responses', {
|
|
26
34
|
billingMode: DynamoDB.BillingMode.PAY_PER_REQUEST,
|
|
@@ -36,6 +44,14 @@ export class HttpApiMock extends Resource {
|
|
|
36
44
|
removalPolicy: RemovalPolicy.DESTROY,
|
|
37
45
|
timeToLiveAttribute: 'ttl',
|
|
38
46
|
});
|
|
47
|
+
this.responsesTable.addGlobalSecondaryIndex({
|
|
48
|
+
indexName: 'methodPathQuery',
|
|
49
|
+
partitionKey: {
|
|
50
|
+
name: 'methodPathQuery',
|
|
51
|
+
type: DynamoDB.AttributeType.STRING,
|
|
52
|
+
},
|
|
53
|
+
projectionType: DynamoDB.ProjectionType.ALL,
|
|
54
|
+
});
|
|
39
55
|
// This lambda will publish all requests made to the API Gateway in the queue
|
|
40
56
|
const lambda = new Lambda.Function(this, 'Lambda', {
|
|
41
57
|
description: 'Mocks a HTTP API and stores all requests in SQS for inspection, and optionally replies with enqued responses',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifravst/http-api-mock",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.125",
|
|
4
4
|
"description": "Helper functions for AWS lambdas written in TypeScript.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"tsx": "^4.19.1"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@bifravst/eslint-config-typescript": "6.1.
|
|
96
|
+
"@bifravst/eslint-config-typescript": "6.1.16",
|
|
97
97
|
"@bifravst/prettier-config": "1.1.0",
|
|
98
98
|
"@commitlint/config-conventional": "19.5.0",
|
|
99
99
|
"@types/aws-lambda": "8.10.145",
|