@goldstack/utils-aws-http-api-local 0.3.44 → 0.3.46
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.
|
@@ -15,10 +15,11 @@ export interface LocalHttpAPIOptions {
|
|
|
15
15
|
port: string;
|
|
16
16
|
routesDir: string;
|
|
17
17
|
cors?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Maps routes to local directories
|
|
20
|
-
*/
|
|
21
18
|
staticRoutes?: StaticRoutes;
|
|
19
|
+
versionTimestamp?: {
|
|
20
|
+
value: string;
|
|
21
|
+
path: string;
|
|
22
|
+
};
|
|
22
23
|
}
|
|
23
24
|
export interface StartServerResult {
|
|
24
25
|
shutdown: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilsAwsHttpApiLocal.d.ts","sourceRoot":"","sources":["../../src/utilsAwsHttpApiLocal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAoB,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"utilsAwsHttpApiLocal.d.ts","sourceRoot":"","sources":["../../src/utilsAwsHttpApiLocal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAoB,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI7E,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,YACb,mBAAmB,KAC3B,OAAO,CAAC,iBAAiB,CAqD3B,CAAC"}
|
|
@@ -8,6 +8,7 @@ const express_1 = __importDefault(require("express"));
|
|
|
8
8
|
const cors_1 = __importDefault(require("cors"));
|
|
9
9
|
const utils_aws_lambda_1 = require("@goldstack/utils-aws-lambda");
|
|
10
10
|
const expressRoutes_1 = require("./expressRoutes");
|
|
11
|
+
const assert_1 = __importDefault(require("assert"));
|
|
11
12
|
const startServer = async (options) => {
|
|
12
13
|
const app = (0, express_1.default)();
|
|
13
14
|
app.use(express_1.default.json());
|
|
@@ -15,7 +16,12 @@ const startServer = async (options) => {
|
|
|
15
16
|
app.use((0, cors_1.default)({ origin: options.cors, credentials: true }));
|
|
16
17
|
}
|
|
17
18
|
const lambdaConfig = (0, utils_aws_lambda_1.readLambdaConfig)(options.routesDir);
|
|
18
|
-
|
|
19
|
+
if (options.versionTimestamp) {
|
|
20
|
+
app.get(options.versionTimestamp.path, (req, res) => {
|
|
21
|
+
(0, assert_1.default)(options.versionTimestamp);
|
|
22
|
+
res.send(options.versionTimestamp.value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
19
25
|
if (options.staticRoutes) {
|
|
20
26
|
Object.entries(options.staticRoutes).forEach((e) => {
|
|
21
27
|
if (typeof e[1] === 'string') {
|
|
@@ -27,15 +33,15 @@ const startServer = async (options) => {
|
|
|
27
33
|
}
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
|
-
(0, expressRoutes_1.injectRoutes)({
|
|
31
|
-
app: app,
|
|
32
|
-
lambdaConfigs: lambdaConfig,
|
|
33
|
-
});
|
|
34
36
|
const result = await new Promise((resolve) => {
|
|
35
37
|
const server = app.listen(parseInt(options.port), function () {
|
|
36
38
|
resolve(server);
|
|
37
39
|
});
|
|
38
40
|
});
|
|
41
|
+
(0, expressRoutes_1.injectRoutes)({
|
|
42
|
+
app: app,
|
|
43
|
+
lambdaConfigs: lambdaConfig,
|
|
44
|
+
});
|
|
39
45
|
return {
|
|
40
46
|
server: result,
|
|
41
47
|
lambdaConfig: lambdaConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilsAwsHttpApiLocal.js","sourceRoot":"","sources":["../../src/utilsAwsHttpApiLocal.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,gDAAwB;AAGxB,kEAA6E;AAC7E,mDAA+C;
|
|
1
|
+
{"version":3,"file":"utilsAwsHttpApiLocal.js","sourceRoot":"","sources":["../../src/utilsAwsHttpApiLocal.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,gDAAwB;AAGxB,kEAA6E;AAC7E,mDAA+C;AAC/C,oDAA4B;AAiCrB,MAAM,WAAW,GAAG,KAAK,EAC9B,OAA4B,EACA,EAAE;IAC9B,MAAM,GAAG,GAAwB,IAAA,iBAAO,GAAE,CAAC;IAC3C,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,EAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,YAAY,GAAG,IAAA,mCAAgB,EAAC,OAAO,CAAC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E,GAAG;QACR,aAAa,EAAE,YAAY;KAC5B,CAAC,CAAC;IAEH,OAAO;QACL,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,YAAY;QAC1B,QAAQ,EAAE,GAAkB,EAAE;YAC5B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACnB,IAAI,GAAG,EAAE,CAAC;wBACR,MAAM,CAAC,GAAG,CAAC,CAAC;wBACZ,OAAO;oBACT,CAAC;oBACD,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAvDW,QAAA,WAAW,eAuDtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/utils-aws-http-api-local",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.46",
|
|
4
4
|
"description": "Starts a local AWS HTTP API for testing",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -45,23 +45,23 @@
|
|
|
45
45
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@goldstack/utils-aws-lambda": "0.3.
|
|
49
|
-
"@types/aws-lambda": "^8.10.
|
|
48
|
+
"@goldstack/utils-aws-lambda": "0.3.38",
|
|
49
|
+
"@types/aws-lambda": "^8.10.146",
|
|
50
50
|
"cookie": "^0.4.1",
|
|
51
51
|
"cors": "^2.8.5",
|
|
52
52
|
"express": "4.19.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@goldstack/utils-git": "0.2.
|
|
56
|
-
"@swc/core": "^1.
|
|
55
|
+
"@goldstack/utils-git": "0.2.12",
|
|
56
|
+
"@swc/core": "^1.10.1",
|
|
57
57
|
"@swc/jest": "^0.2.37",
|
|
58
|
-
"@types/cookie": "^0",
|
|
59
|
-
"@types/express": "^
|
|
58
|
+
"@types/cookie": "^1.0.0",
|
|
59
|
+
"@types/express": "^5.0.0",
|
|
60
60
|
"@types/jest": "^29.5.14",
|
|
61
|
-
"@types/node": "^22.10.
|
|
62
|
-
"@types/node-fetch": "2",
|
|
61
|
+
"@types/node": "^22.10.2",
|
|
62
|
+
"@types/node-fetch": "^2.6.12",
|
|
63
63
|
"find-free-ports": "^3.1.1",
|
|
64
|
-
"jest": "^29.
|
|
64
|
+
"jest": "^29.7.0",
|
|
65
65
|
"node-fetch": "2.6.7",
|
|
66
66
|
"rimraf": "^3.0.2",
|
|
67
67
|
"typescript": "^5.7.2"
|