@bifravst/http-api-mock 1.1.5 → 1.1.7
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 -1
- package/cdk/http-api-mock.ts +14 -2
- package/dist/cdk/http-api-mock.js +12 -2
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -21,7 +21,6 @@ npx @bifravst/http-api-mock
|
|
|
21
21
|
{
|
|
22
22
|
"stackName": "http-api-mock-69c2c4b9",
|
|
23
23
|
"responsesTableName": "http-api-mock-69c2c4b9-httpapimockresponses562FCFC7-C80OCULJKYFE",
|
|
24
|
-
"httpapimockapiEndpointF8DBD534": "https://liv73h149l.execute-api.eu-west-1.amazonaws.com/prod/",
|
|
25
24
|
"apiURL": "https://liv73h149l.execute-api.eu-west-1.amazonaws.com/prod/",
|
|
26
25
|
"requestsTableName": "http-api-mock-69c2c4b9-httpapimockrequests2216D487-608PM7EHETW4"
|
|
27
26
|
}
|
package/cdk/http-api-mock.ts
CHANGED
|
@@ -2,20 +2,30 @@ import { packLayer } from '@bifravst/aws-cdk-lambda-helpers/layer'
|
|
|
2
2
|
import { packLambdaFromPath } from '@bifravst/aws-cdk-lambda-helpers'
|
|
3
3
|
import { HTTPAPIMockApp } from './App.js'
|
|
4
4
|
import { fromEnv } from '@nordicsemiconductor/from-env'
|
|
5
|
-
import path
|
|
5
|
+
import path from 'node:path'
|
|
6
6
|
import { fileURLToPath } from 'node:url'
|
|
7
|
+
import fs from 'node:fs/promises'
|
|
8
|
+
import os from 'node:os'
|
|
7
9
|
|
|
8
10
|
const { stackName } = fromEnv({ stackName: 'HTTP_API_MOCK_STACK_NAME' })(
|
|
9
11
|
process.env,
|
|
10
12
|
)
|
|
11
13
|
|
|
14
|
+
const baseDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
15
|
+
const distDir = await fs.mkdtemp(path.join(os.tmpdir(), 'temp-'))
|
|
16
|
+
const lambdasDir = path.join(distDir, 'lambdas')
|
|
17
|
+
await fs.mkdir(lambdasDir)
|
|
18
|
+
const layersDir = path.join(distDir, 'layers')
|
|
19
|
+
await fs.mkdir(layersDir)
|
|
20
|
+
|
|
12
21
|
new HTTPAPIMockApp(stackName, {
|
|
13
22
|
lambdaSources: {
|
|
14
23
|
httpApiMock: await packLambdaFromPath(
|
|
15
24
|
'httpApiMock',
|
|
16
25
|
'cdk/resources/http-api-mock-lambda.ts',
|
|
17
26
|
undefined,
|
|
18
|
-
|
|
27
|
+
baseDir,
|
|
28
|
+
lambdasDir,
|
|
19
29
|
),
|
|
20
30
|
},
|
|
21
31
|
layer: await packLayer({
|
|
@@ -25,5 +35,7 @@ new HTTPAPIMockApp(stackName, {
|
|
|
25
35
|
'@nordicsemiconductor/from-env',
|
|
26
36
|
'@hello.nrfcloud.com/lambda-helpers',
|
|
27
37
|
],
|
|
38
|
+
baseDir,
|
|
39
|
+
distDir: layersDir,
|
|
28
40
|
}),
|
|
29
41
|
})
|
|
@@ -2,12 +2,20 @@ import { packLayer } from '@bifravst/aws-cdk-lambda-helpers/layer';
|
|
|
2
2
|
import { packLambdaFromPath } from '@bifravst/aws-cdk-lambda-helpers';
|
|
3
3
|
import { HTTPAPIMockApp } from './App.js';
|
|
4
4
|
import { fromEnv } from '@nordicsemiconductor/from-env';
|
|
5
|
-
import path
|
|
5
|
+
import path from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import fs from 'node:fs/promises';
|
|
8
|
+
import os from 'node:os';
|
|
7
9
|
const { stackName } = fromEnv({ stackName: 'HTTP_API_MOCK_STACK_NAME' })(process.env);
|
|
10
|
+
const baseDir = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
const distDir = await fs.mkdtemp(path.join(os.tmpdir(), 'temp-'));
|
|
12
|
+
const lambdasDir = path.join(distDir, 'lambdas');
|
|
13
|
+
await fs.mkdir(lambdasDir);
|
|
14
|
+
const layersDir = path.join(distDir, 'layers');
|
|
15
|
+
await fs.mkdir(layersDir);
|
|
8
16
|
new HTTPAPIMockApp(stackName, {
|
|
9
17
|
lambdaSources: {
|
|
10
|
-
httpApiMock: await packLambdaFromPath('httpApiMock', 'cdk/resources/http-api-mock-lambda.ts', undefined,
|
|
18
|
+
httpApiMock: await packLambdaFromPath('httpApiMock', 'cdk/resources/http-api-mock-lambda.ts', undefined, baseDir, lambdasDir),
|
|
11
19
|
},
|
|
12
20
|
layer: await packLayer({
|
|
13
21
|
id: 'testResources',
|
|
@@ -16,5 +24,7 @@ new HTTPAPIMockApp(stackName, {
|
|
|
16
24
|
'@nordicsemiconductor/from-env',
|
|
17
25
|
'@hello.nrfcloud.com/lambda-helpers',
|
|
18
26
|
],
|
|
27
|
+
baseDir,
|
|
28
|
+
distDir: layersDir,
|
|
19
29
|
}),
|
|
20
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifravst/http-api-mock",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Helper functions for AWS lambdas written in TypeScript.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./*": {
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
84
|
"files": [
|
|
85
|
-
"package-lock.json",
|
|
86
85
|
"dist/cdk",
|
|
87
86
|
"dist/src",
|
|
88
87
|
"cdk",
|
|
@@ -95,7 +94,6 @@
|
|
|
95
94
|
"peerDependencies": {
|
|
96
95
|
"@aws-sdk/client-cloudformation": "^3.552.0",
|
|
97
96
|
"@aws-sdk/client-sts": "^3.552.0",
|
|
98
|
-
"@bifravst/aws-cdk-lambda-helpers": "^1.2.8",
|
|
99
97
|
"@bifravst/run": "^1.2.0",
|
|
100
98
|
"@nordicsemiconductor/cloudformation-helpers": "^9.0.3",
|
|
101
99
|
"aws-cdk-lib": "^2.137.0",
|
|
@@ -104,9 +102,10 @@
|
|
|
104
102
|
"tsx": "^4.7.2"
|
|
105
103
|
},
|
|
106
104
|
"dependencies": {
|
|
107
|
-
"@aws-sdk/client-dynamodb": "3.552.0",
|
|
108
|
-
"@aws-sdk/util-dynamodb": "3.552.0",
|
|
109
|
-
"@
|
|
110
|
-
"@
|
|
105
|
+
"@aws-sdk/client-dynamodb": "^3.552.0",
|
|
106
|
+
"@aws-sdk/util-dynamodb": "^3.552.0",
|
|
107
|
+
"@bifravst/aws-cdk-lambda-helpers": "^1.4.0",
|
|
108
|
+
"@hello.nrfcloud.com/lambda-helpers": "^1.0.1",
|
|
109
|
+
"@nordicsemiconductor/from-env": "^3.0.1"
|
|
111
110
|
}
|
|
112
111
|
}
|