fpavon-ee-shared 1.0.33 → 1.0.35
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,10 +4,7 @@ export declare function executeQuery(query: string, params?: Record<string, any>
|
|
|
4
4
|
export declare function getConnectionForTransaction(): Promise<sql.ConnectionPool>;
|
|
5
5
|
interface SqlParam {
|
|
6
6
|
value: any;
|
|
7
|
-
type:
|
|
8
|
-
type: sql.ISqlType;
|
|
9
|
-
length?: number;
|
|
10
|
-
};
|
|
7
|
+
type: any;
|
|
11
8
|
}
|
|
12
9
|
export declare function executeQueryWithParams(query: string, params: Record<string, SqlParam>): Promise<any>;
|
|
13
10
|
export {};
|
|
@@ -46,7 +46,7 @@ function executeQuery(query, params) {
|
|
|
46
46
|
resolve(result);
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
|
49
|
-
console.error("
|
|
49
|
+
console.error("Error connection.sql.executeQuery: ", error);
|
|
50
50
|
reject(error);
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
@@ -73,10 +73,9 @@ function executeQueryWithParams(query, params) {
|
|
|
73
73
|
try {
|
|
74
74
|
const pool = yield mssql_1.default.connect(conexion);
|
|
75
75
|
const request = pool.request();
|
|
76
|
-
// Agrega parámetros si se proporcionan
|
|
77
76
|
if (params) {
|
|
78
77
|
Object.entries(params).forEach(([key, param]) => {
|
|
79
|
-
//
|
|
78
|
+
// LLamada correcta: request.input(nombre, tipo_o_tipo_con_longitud, valor)
|
|
80
79
|
request.input(key, param.type, param.value);
|
|
81
80
|
});
|
|
82
81
|
}
|
|
@@ -84,7 +83,7 @@ function executeQueryWithParams(query, params) {
|
|
|
84
83
|
resolve(result);
|
|
85
84
|
}
|
|
86
85
|
catch (error) {
|
|
87
|
-
console.error("
|
|
86
|
+
console.error("Error connection.sql.executeQueryWithParams: ", error);
|
|
88
87
|
reject(error);
|
|
89
88
|
}
|
|
90
89
|
}));
|
|
@@ -34,7 +34,7 @@ export function executeQuery(query: string, params?: Record<string, any>): Promi
|
|
|
34
34
|
const result = await request.query(query);
|
|
35
35
|
resolve(result);
|
|
36
36
|
} catch (error) {
|
|
37
|
-
console.error("
|
|
37
|
+
console.error("Error connection.sql.executeQuery: ", error);
|
|
38
38
|
reject(error);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -52,10 +52,11 @@ export async function getConnectionForTransaction(): Promise<sql.ConnectionPool>
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
//
|
|
55
|
+
// 1. Simplificar la interfaz: El 'type' debe ser el objeto/función/clase SQL
|
|
56
56
|
interface SqlParam {
|
|
57
57
|
value: any;
|
|
58
|
-
|
|
58
|
+
// Esto es lo que devuelve sql.NVarChar(255) o sql.NVarChar.
|
|
59
|
+
type: any; // Usar 'any' aquí simplifica, aunque 'mssql.ISqlType' o 'IField' sería más preciso
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export async function executeQueryWithParams(query: string, params: Record<string, SqlParam>): Promise<any> {
|
|
@@ -65,10 +66,9 @@ export async function executeQueryWithParams(query: string, params: Record<strin
|
|
|
65
66
|
const pool = await sql.connect(conexion);
|
|
66
67
|
const request = pool.request();
|
|
67
68
|
|
|
68
|
-
// Agrega parámetros si se proporcionan
|
|
69
69
|
if (params) {
|
|
70
70
|
Object.entries(params).forEach(([key, param]) => {
|
|
71
|
-
//
|
|
71
|
+
// LLamada correcta: request.input(nombre, tipo_o_tipo_con_longitud, valor)
|
|
72
72
|
request.input(key, param.type, param.value);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -76,8 +76,8 @@ export async function executeQueryWithParams(query: string, params: Record<strin
|
|
|
76
76
|
const result = await request.query(query);
|
|
77
77
|
resolve(result);
|
|
78
78
|
} catch (error) {
|
|
79
|
-
console.error("
|
|
79
|
+
console.error("Error connection.sql.executeQueryWithParams: ", error);
|
|
80
80
|
reject(error);
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
}
|
|
83
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fpavon-ee-shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "Carpeta compartida entre servicios de Expediente Electronico",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"jsonwebtoken": "^9.0.2",
|
|
22
22
|
"moment": "^2.30.1",
|
|
23
23
|
"morgan-body": "^2.6.9",
|
|
24
|
-
"mssql": "^10.0.2",
|
|
25
24
|
"multiparty": "^4.2.3",
|
|
26
25
|
"node-cron": "^3.0.3",
|
|
27
26
|
"node-dependency-injection": "^3.1.2",
|
|
@@ -35,6 +34,9 @@
|
|
|
35
34
|
"ts-jest": "^29.1.2",
|
|
36
35
|
"typescript": "^5.3.3"
|
|
37
36
|
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"mssql": "^10.0.2"
|
|
39
|
+
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@types/jest": "^29.5.12",
|
|
40
42
|
"@types/jsonwebtoken": "^9.0.10",
|