@carlosdiazz/lottodiz-shared 3.1.6 → 3.1.8
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.
|
@@ -4,7 +4,7 @@ import { CreatePosByTemporaryCodeInterface, CreateTemporaryCodeInterface } from
|
|
|
4
4
|
import { ResponseInterface } from "../common";
|
|
5
5
|
export interface TemporaryCodeResolverInterface {
|
|
6
6
|
create(dto: CreateTemporaryCodeInterface, user?: UserInterface): Promise<TemporaryCodeInterface>;
|
|
7
|
-
findOne(id:
|
|
7
|
+
findOne(id: string, user?: UserInterface): Promise<TemporaryCodeInterface>;
|
|
8
8
|
findOneByCode(code: string, user?: UserInterface): Promise<TemporaryCodeInterface>;
|
|
9
9
|
createPosCodeByTemporaryCode(dto: CreatePosByTemporaryCodeInterface, user?: UserInterface): Promise<ResponseInterface>;
|
|
10
10
|
createPosMonitorByTemporyCode(dto: CreatePosByTemporaryCodeInterface, user?: UserInterface): Promise<ResponseInterface>;
|
|
@@ -3,6 +3,13 @@ interface NatsTlsEnv {
|
|
|
3
3
|
NATS_USER: string;
|
|
4
4
|
NATS_PASSWORD: string;
|
|
5
5
|
NATS_CA_PATH?: string;
|
|
6
|
+
NATS_CLIENT_CERT_PATH?: string;
|
|
7
|
+
NATS_CLIENT_KEY_PATH?: string;
|
|
8
|
+
}
|
|
9
|
+
interface NatsTlsOptions {
|
|
10
|
+
ca: any[];
|
|
11
|
+
cert?: any;
|
|
12
|
+
key?: any;
|
|
6
13
|
}
|
|
7
14
|
interface NatsOptionsResult {
|
|
8
15
|
servers: string[];
|
|
@@ -10,13 +17,13 @@ interface NatsOptionsResult {
|
|
|
10
17
|
pass: string;
|
|
11
18
|
queue?: string;
|
|
12
19
|
timeout?: number;
|
|
13
|
-
tls?:
|
|
14
|
-
ca: any[];
|
|
15
|
-
};
|
|
20
|
+
tls?: NatsTlsOptions;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
|
-
* Construye las opciones de conexión NATS con soporte TLS condicional.
|
|
19
|
-
* Si NATS_CA_PATH está definido, lee el certificado CA y agrega la configuración TLS.
|
|
23
|
+
* Construye las opciones de conexión NATS con soporte TLS y mTLS condicional.
|
|
24
|
+
* - Si NATS_CA_PATH está definido, lee el certificado CA y agrega la configuración TLS.
|
|
25
|
+
* - Si NATS_CLIENT_CERT_PATH y NATS_CLIENT_KEY_PATH están definidos, agrega el certificado
|
|
26
|
+
* y la clave del cliente para mTLS (verify: true en el servidor NATS).
|
|
20
27
|
*/
|
|
21
28
|
export declare function buildNatsOptions(env: NatsTlsEnv, extra?: {
|
|
22
29
|
queue?: string;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildNatsOptions = buildNatsOptions;
|
|
4
4
|
/**
|
|
5
|
-
* Construye las opciones de conexión NATS con soporte TLS condicional.
|
|
6
|
-
* Si NATS_CA_PATH está definido, lee el certificado CA y agrega la configuración TLS.
|
|
5
|
+
* Construye las opciones de conexión NATS con soporte TLS y mTLS condicional.
|
|
6
|
+
* - Si NATS_CA_PATH está definido, lee el certificado CA y agrega la configuración TLS.
|
|
7
|
+
* - Si NATS_CLIENT_CERT_PATH y NATS_CLIENT_KEY_PATH están definidos, agrega el certificado
|
|
8
|
+
* y la clave del cliente para mTLS (verify: true en el servidor NATS).
|
|
7
9
|
*/
|
|
8
10
|
function buildNatsOptions(env, extra) {
|
|
9
11
|
const options = {
|
|
@@ -20,9 +22,14 @@ function buildNatsOptions(env, extra) {
|
|
|
20
22
|
if (env.NATS_CA_PATH) {
|
|
21
23
|
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
22
24
|
const fs = require("fs");
|
|
23
|
-
|
|
25
|
+
const tls = {
|
|
24
26
|
ca: [fs.readFileSync(env.NATS_CA_PATH)],
|
|
25
27
|
};
|
|
28
|
+
if (env.NATS_CLIENT_CERT_PATH && env.NATS_CLIENT_KEY_PATH) {
|
|
29
|
+
tls.cert = fs.readFileSync(env.NATS_CLIENT_CERT_PATH);
|
|
30
|
+
tls.key = fs.readFileSync(env.NATS_CLIENT_KEY_PATH);
|
|
31
|
+
}
|
|
32
|
+
options.tls = tls;
|
|
26
33
|
}
|
|
27
34
|
return options;
|
|
28
35
|
}
|