@rsdk/core 5.7.0-next.5 → 5.7.0-next.6
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.
|
@@ -5,7 +5,7 @@ import type { ITransport } from '../types';
|
|
|
5
5
|
* Mostly used in global enhancers to decide: "to work of not to work"
|
|
6
6
|
*/
|
|
7
7
|
export declare class ProtocolDetector {
|
|
8
|
-
private transports;
|
|
8
|
+
private readonly transports;
|
|
9
9
|
constructor(transports: ITransport[]);
|
|
10
10
|
/**
|
|
11
11
|
* Detects transport's protocol by ArgumentHost (context)
|
|
@@ -24,7 +24,10 @@ class ProtocolDetector {
|
|
|
24
24
|
return this.getProtocol(context) === protocol;
|
|
25
25
|
}
|
|
26
26
|
getTransport(context) {
|
|
27
|
-
|
|
27
|
+
// NOTE: for support node 16.x
|
|
28
|
+
// .findLast() alternative from lodash but faster
|
|
29
|
+
const transports = this.transports.filter((x) => x.matchByContext(context));
|
|
30
|
+
return transports.at(-1);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
exports.ProtocolDetector = ProtocolDetector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.detector.js","sourceRoot":"","sources":["../../src/transport/protocol.detector.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"protocol.detector.js","sourceRoot":"","sources":["../../src/transport/protocol.detector.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,MAAa,gBAAgB;IACE;IAA7B,YAA6B,UAAwB;QAAxB,eAAU,GAAV,UAAU,CAAc;IAAG,CAAC;IAEzD;;OAEG;IACH,WAAW,CAAC,OAAsB;QAChC,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,OAAsB,EAAE,QAAgB;QACpD,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;IAChD,CAAC;IAEO,YAAY,CAAC,OAAsB;QACzC,8BAA8B;QAC9B,iDAAiD;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAE5E,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;CACF;AAzBD,4CAyBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/core",
|
|
3
|
-
"version": "5.7.0-next.
|
|
3
|
+
"version": "5.7.0-next.6",
|
|
4
4
|
"description": "Nestjs based microservice chassis",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"optional": true
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "287622c55e8717861544f0be502bb37a6b19bbfb"
|
|
53
53
|
}
|
|
@@ -7,7 +7,7 @@ import type { ITransport } from '../types';
|
|
|
7
7
|
* Mostly used in global enhancers to decide: "to work of not to work"
|
|
8
8
|
*/
|
|
9
9
|
export class ProtocolDetector {
|
|
10
|
-
constructor(private transports: ITransport[]) {}
|
|
10
|
+
constructor(private readonly transports: ITransport[]) {}
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Detects transport's protocol by ArgumentHost (context)
|
|
@@ -25,6 +25,10 @@ export class ProtocolDetector {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
private getTransport(context: ArgumentsHost): ITransport | undefined {
|
|
28
|
-
|
|
28
|
+
// NOTE: for support node 16.x
|
|
29
|
+
// .findLast() alternative from lodash but faster
|
|
30
|
+
const transports = this.transports.filter((x) => x.matchByContext(context));
|
|
31
|
+
|
|
32
|
+
return transports.at(-1);
|
|
29
33
|
}
|
|
30
34
|
}
|