@pristine-ts/express 0.0.380 → 0.0.382
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/lib/cjs/mappers/request-event.mapper.js +2 -1
- package/dist/lib/cjs/mappers/request-event.mapper.js.map +1 -1
- package/dist/lib/cjs/mappers/request.mapper.js +3 -1
- package/dist/lib/cjs/mappers/request.mapper.js.map +1 -1
- package/dist/lib/esm/mappers/request-event.mapper.js +2 -1
- package/dist/lib/esm/mappers/request-event.mapper.js.map +1 -1
- package/dist/lib/esm/mappers/request.mapper.js +3 -1
- package/dist/lib/esm/mappers/request.mapper.js.map +1 -1
- package/package.json +5 -5
|
@@ -26,10 +26,11 @@ let RequestEventMapper = class RequestEventMapper {
|
|
|
26
26
|
return executionContext.keyname === core_1.ExecutionContextKeynameEnum.Express;
|
|
27
27
|
}
|
|
28
28
|
map(rawEvent, executionContext) {
|
|
29
|
+
const request = this.requestMapper.map(rawEvent);
|
|
29
30
|
return {
|
|
30
31
|
executionOrder: "sequential",
|
|
31
32
|
events: [
|
|
32
|
-
new core_1.Event("EXPRESS_REQUEST",
|
|
33
|
+
new core_1.Event("EXPRESS_REQUEST", request, request.id)
|
|
33
34
|
]
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-event.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request-event.mapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAM2B;AAC3B,gDAA0F;AAC1F,sEAA+D;AAC/D,uCAAoC;AACpC,qDAA+C;AAE/C,uDAAiD;AAK1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YAA6B,aAA4B,EAAmB,cAA8B;QAA7E,kBAAa,GAAb,aAAa,CAAe;QAAmB,mBAAc,GAAd,cAAc,CAAgB;IAC1G,CAAC;IAED,eAAe,CAAC,QAAa,EAAE,gBAAgD;QAC3E,mDAAmD;QACnD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kCAA2B,CAAC,OAAO,IAAI,QAAQ,YAAY,iBAAQ,CAAC;IAC5G,CAAC;CAEJ,CAAA;AA3BY,gDAAkB;6BAAlB,kBAAkB;IAH9B,IAAA,qBAAY,EAAC,6CAAoB,CAAC;IAClC,IAAA,YAAG,EAAC,iCAAwB,CAAC,WAAW,CAAC;IACzC,IAAA,qBAAU,GAAE;qCAEmC,8BAAa,EAAmC,gCAAc;GADjG,kBAAkB,CA2B9B"}
|
|
@@ -14,6 +14,7 @@ const tsyringe_1 = require("tsyringe");
|
|
|
14
14
|
const http_headers_mapper_1 = require("./http-headers.mapper");
|
|
15
15
|
const method_mapper_1 = require("./method.mapper");
|
|
16
16
|
const common_1 = require("@pristine-ts/common");
|
|
17
|
+
const uuid_1 = require("uuid");
|
|
17
18
|
let RequestMapper = class RequestMapper {
|
|
18
19
|
constructor(httpHeadersMapper, methodMapper) {
|
|
19
20
|
this.httpHeadersMapper = httpHeadersMapper;
|
|
@@ -24,7 +25,8 @@ let RequestMapper = class RequestMapper {
|
|
|
24
25
|
* @param expressRequest The http expressRequest from express.
|
|
25
26
|
*/
|
|
26
27
|
map(expressRequest) {
|
|
27
|
-
const
|
|
28
|
+
const requestId = expressRequest.header("x-pristine-request-id");
|
|
29
|
+
const request = new common_1.Request(this.methodMapper.map(expressRequest.method), expressRequest.url, requestId !== null && requestId !== void 0 ? requestId : (0, uuid_1.v4)());
|
|
28
30
|
request.setHeaders(this.httpHeadersMapper.map(expressRequest.headers));
|
|
29
31
|
request.body = expressRequest.body;
|
|
30
32
|
request.rawBody = expressRequest.body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request.mapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoC;
|
|
1
|
+
{"version":3,"file":"request.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request.mapper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoC;AAEpC,+DAAwD;AACxD,mDAA6C;AAC7C,gDAA4C;AAC5C,+BAAkC;AAG3B,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YAA6B,iBAAoC,EACpC,YAA0B;QAD1B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,iBAAY,GAAZ,YAAY,CAAc;IACvD,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,cAA8B;QAChC,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAA;QAE9D,MAAM,OAAO,GAAG,IAAI,gBAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,GAAG,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAA,SAAM,GAAE,CAAC,CAAC;QACrH,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;QACnC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC;QAEtC,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AAnBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,qBAAU,GAAE;qCAEuC,uCAAiB;QACtB,4BAAY;GAF9C,aAAa,CAmBzB"}
|
|
@@ -23,10 +23,11 @@ let RequestEventMapper = class RequestEventMapper {
|
|
|
23
23
|
return executionContext.keyname === ExecutionContextKeynameEnum.Express;
|
|
24
24
|
}
|
|
25
25
|
map(rawEvent, executionContext) {
|
|
26
|
+
const request = this.requestMapper.map(rawEvent);
|
|
26
27
|
return {
|
|
27
28
|
executionOrder: "sequential",
|
|
28
29
|
events: [
|
|
29
|
-
new Event("EXPRESS_REQUEST",
|
|
30
|
+
new Event("EXPRESS_REQUEST", request, request.id)
|
|
30
31
|
]
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-event.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request-event.mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,KAAK,EAIL,2BAA2B,EAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAK1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YAA6B,aAA4B,EAAmB,cAA8B;QAA7E,kBAAa,GAAb,aAAa,CAAe;QAAmB,mBAAc,GAAd,cAAc,CAAgB;IAC1G,CAAC;IAED,eAAe,CAAC,QAAa,EAAE,gBAAgD;QAC3E,mDAAmD;QACnD,OAAO,gBAAgB,CAAC,OAAO,KAAK,2BAA2B,CAAC,OAAO,CAAC;IAC5E,CAAC;IAED,GAAG,CAAC,QAAa,EAAE,gBAAgD;QAC/D,OAAO;YACH,cAAc,EAAE,YAAY;YAC5B,MAAM,EAAE;gBACJ,IAAI,KAAK,CAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"request-event.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request-event.mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,KAAK,EAIL,2BAA2B,EAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAE,wBAAwB,EAAE,GAAG,EAAC,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC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@ -11,6 +11,7 @@ import { injectable } from "tsyringe";
|
|
|
11
11
|
import { HttpHeadersMapper } from "./http-headers.mapper";
|
|
12
12
|
import { MethodMapper } from "./method.mapper";
|
|
13
13
|
import { Request } from "@pristine-ts/common";
|
|
14
|
+
import { v4 as uuidv4 } from "uuid";
|
|
14
15
|
let RequestMapper = class RequestMapper {
|
|
15
16
|
constructor(httpHeadersMapper, methodMapper) {
|
|
16
17
|
this.httpHeadersMapper = httpHeadersMapper;
|
|
@@ -21,7 +22,8 @@ let RequestMapper = class RequestMapper {
|
|
|
21
22
|
* @param expressRequest The http expressRequest from express.
|
|
22
23
|
*/
|
|
23
24
|
map(expressRequest) {
|
|
24
|
-
const
|
|
25
|
+
const requestId = expressRequest.header("x-pristine-request-id");
|
|
26
|
+
const request = new Request(this.methodMapper.map(expressRequest.method), expressRequest.url, requestId !== null && requestId !== void 0 ? requestId : uuidv4());
|
|
25
27
|
request.setHeaders(this.httpHeadersMapper.map(expressRequest.headers));
|
|
26
28
|
request.body = expressRequest.body;
|
|
27
29
|
request.rawBody = expressRequest.body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request.mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"request.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/request.mapper.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAG3B,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB,YAA6B,iBAAoC,EACpC,YAA0B;QAD1B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,iBAAY,GAAZ,YAAY,CAAc;IACvD,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,cAA8B;QAChC,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAA;QAE9D,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,GAAG,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,MAAM,EAAE,CAAC,CAAC;QACrH,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;QACnC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC;QAEtC,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AAnBY,aAAa;IADzB,UAAU,EAAE;qCAEuC,iBAAiB;QACtB,YAAY;GAF9C,aAAa,CAmBzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/express",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.382",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/express.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/express.module.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pristine-ts/common": "^0.0.
|
|
24
|
-
"@pristine-ts/core": "^0.0.
|
|
25
|
-
"@pristine-ts/networking": "^0.0.
|
|
23
|
+
"@pristine-ts/common": "^0.0.382",
|
|
24
|
+
"@pristine-ts/core": "^0.0.382",
|
|
25
|
+
"@pristine-ts/networking": "^0.0.382",
|
|
26
26
|
"@types/express": "^4.17.20",
|
|
27
27
|
"express": "^4.18.2",
|
|
28
28
|
"reflect-metadata": "^0.1.13"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"src/*.{js,ts}"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "60f9360327f638c94ef263625921dfd5d20e6fec"
|
|
65
65
|
}
|