test-entity-library-asm 1.3.4 → 1.3.5

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { DataSource } from 'typeorm';
2
2
  export declare function createDataBaseSource(): DataSource;
3
3
  export declare function showEntity(entityName: string): Promise<any>;
4
- export declare function callStoredProcedure(storedProcedure: string): Promise<any>;
4
+ export declare function callStoredProcedure(storedProcedure: any): Promise<any>;
package/dist/index.js CHANGED
@@ -89,9 +89,11 @@ function showEntity(entityName) {
89
89
  exports.showEntity = showEntity;
90
90
  function callStoredProcedure(storedProcedure) {
91
91
  return __awaiter(this, void 0, void 0, function () {
92
+ var result, error_1;
92
93
  return __generator(this, function (_a) {
93
94
  switch (_a.label) {
94
95
  case 0:
96
+ _a.trys.push([0, 4, , 5]);
95
97
  if (!!connection) return [3 /*break*/, 2];
96
98
  connection = createDataBaseSource();
97
99
  return [4 /*yield*/, connection.initialize()];
@@ -99,7 +101,14 @@ function callStoredProcedure(storedProcedure) {
99
101
  _a.sent();
100
102
  _a.label = 2;
101
103
  case 2: return [4 /*yield*/, connection.query("CALL ".concat(storedProcedure))];
102
- case 3: return [2 /*return*/, _a.sent()];
104
+ case 3:
105
+ result = _a.sent();
106
+ return [2 /*return*/, result];
107
+ case 4:
108
+ error_1 = _a.sent();
109
+ console.error('Error calling stored procedure:', error_1);
110
+ throw error_1;
111
+ case 5: return [2 /*return*/];
103
112
  }
104
113
  });
105
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "test-entity-library-asm",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Entidades de ejemplo para una base de datos",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -44,11 +44,17 @@ export async function showEntity(entityName: string): Promise<any> {
44
44
  return connection.getRepository(entityName)
45
45
  }
46
46
 
47
- export async function callStoredProcedure(storedProcedure: string) {
48
- if (!connection) {
49
- connection = createDataBaseSource()
50
- await connection.initialize()
51
- }
47
+ export async function callStoredProcedure(storedProcedure: any) {
48
+ try {
49
+ if (!connection) {
50
+ connection = createDataBaseSource()
51
+ await connection.initialize()
52
+ }
52
53
 
53
- return await connection.query(`CALL ${storedProcedure}`)
54
+ const result = await connection.query(`CALL ${storedProcedure}`)
55
+ return result
56
+ } catch (error) {
57
+ console.error('Error calling stored procedure:', error)
58
+ throw error
59
+ }
54
60
  }