pg-functions 1.0.0

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -0
  3. package/dist/PgConnection.d.ts +12 -0
  4. package/dist/PgConnection.d.ts.map +1 -0
  5. package/dist/PgConnection.js +39 -0
  6. package/dist/PgConnection.js.map +1 -0
  7. package/dist/context.d.ts +4 -0
  8. package/dist/context.d.ts.map +1 -0
  9. package/dist/context.js +18 -0
  10. package/dist/context.js.map +1 -0
  11. package/dist/enum/SqlMode.enum.d.ts +5 -0
  12. package/dist/enum/SqlMode.enum.d.ts.map +1 -0
  13. package/dist/enum/SqlMode.enum.js +9 -0
  14. package/dist/enum/SqlMode.enum.js.map +1 -0
  15. package/dist/functions/PgFunction.d.ts +8 -0
  16. package/dist/functions/PgFunction.d.ts.map +1 -0
  17. package/dist/functions/PgFunction.js +54 -0
  18. package/dist/functions/PgFunction.js.map +1 -0
  19. package/dist/functions/PgFunctionBase.d.ts +11 -0
  20. package/dist/functions/PgFunctionBase.d.ts.map +1 -0
  21. package/dist/functions/PgFunctionBase.js +23 -0
  22. package/dist/functions/PgFunctionBase.js.map +1 -0
  23. package/dist/functions/PgFunctionTransactional.d.ts +9 -0
  24. package/dist/functions/PgFunctionTransactional.d.ts.map +1 -0
  25. package/dist/functions/PgFunctionTransactional.js +28 -0
  26. package/dist/functions/PgFunctionTransactional.js.map +1 -0
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +23 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/interfaces/Base.d.ts +4 -0
  32. package/dist/interfaces/Base.d.ts.map +1 -0
  33. package/dist/interfaces/Base.js +3 -0
  34. package/dist/interfaces/Base.js.map +1 -0
  35. package/dist/interfaces/Common.d.ts +5 -0
  36. package/dist/interfaces/Common.d.ts.map +1 -0
  37. package/dist/interfaces/Common.js +3 -0
  38. package/dist/interfaces/Common.js.map +1 -0
  39. package/dist/interfaces/ILogger.d.ts +6 -0
  40. package/dist/interfaces/ILogger.d.ts.map +1 -0
  41. package/dist/interfaces/ILogger.js +3 -0
  42. package/dist/interfaces/ILogger.js.map +1 -0
  43. package/dist/interfaces/Transactional.d.ts +6 -0
  44. package/dist/interfaces/Transactional.d.ts.map +1 -0
  45. package/dist/interfaces/Transactional.js +3 -0
  46. package/dist/interfaces/Transactional.js.map +1 -0
  47. package/dist/utils/index.d.ts +4 -0
  48. package/dist/utils/index.d.ts.map +1 -0
  49. package/dist/utils/index.js +14 -0
  50. package/dist/utils/index.js.map +1 -0
  51. package/dist/utils/logger.d.ts +10 -0
  52. package/dist/utils/logger.d.ts.map +1 -0
  53. package/dist/utils/logger.js +28 -0
  54. package/dist/utils/logger.js.map +1 -0
  55. package/package.json +29 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2025 mauricio.basta
2
+
3
+ Permission is hereby granted, free
4
+ of charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # pg-functions
2
+
3
+ Abstracción para ejecución de funciones PL/pgSQL desde Node.js con [`pg`](https://www.npmjs.com/package/pg).
4
+
5
+ ## Características
6
+
7
+ - Ejecución de funciones PL/pgSQL de forma tipada.
8
+ - Transacciones automáticas (`PgFunction`) o manuales (`PgFunctionTransactional`).
9
+ - Tipado con genéricos para resultados (`<T>`).
10
+ - Inyección de opcional de logger (compatible con `pino`, `console`, etc.).
11
+ - Basado en el `Pool` del proyecto consumidor.
12
+
13
+
14
+ ## Instalación
15
+
16
+ ```bash
17
+ pnpm add pg-functions
18
+ ```
19
+
20
+ ## Configuración
21
+
22
+ ``` ts
23
+ import { Pool } from 'pg';
24
+ import { registerPool } from 'pg-functions';
25
+
26
+ registerPool(new Pool({/* ... */}))
27
+ ```
28
+
29
+ ## Uso
30
+
31
+ ### 1. Crear una función PL/pgSQL en base de datos
32
+ ```sql
33
+ CREATE OR REPLACE FUNCTION fn_obtener_roles_usuario()
34
+ RETURNS TABLE (id INTEGER, nombre VARCHAR)
35
+ LANGUAGE plpgsql
36
+ AS $$
37
+ BEGIN
38
+ RETURN QUERY
39
+ SELECT "ID_ROL_USUARIO" AS id, "N_ROL_USUARIO" AS nombre
40
+ FROM "T_ROLES_USUARIO"
41
+ ORDER BY "ID_ROL_USUARIO";
42
+ END;
43
+ $$;
44
+ ```
45
+
46
+ ### 2. Consumir la función desde Node.js
47
+ ```ts
48
+ import { PgFunction } from 'pg-functions';
49
+
50
+ type RolRecord = {
51
+ id: number;
52
+ nombre: string;
53
+ };
54
+
55
+ export const obtenerRoles = async (): Promise<RolRecord[] | null> => {
56
+ const func = new PgFunction<RolRecord>('fn_obtener_roles_usuario', []);
57
+ return await func.execute();
58
+ };
59
+ ```
60
+
61
+ # Opcional: Logger personalizado
62
+
63
+ ```ts
64
+ import { setLogger } from 'pg-functions';
65
+ import pino from 'pino';
66
+
67
+ setLogger(pino({ level: 'info' }));
68
+ ```
69
+
70
+ # API
71
+
72
+ | Clase | Descripción |
73
+ | ---------------------------- | ---------------------------------------------------------- |
74
+ | `PgFunction<T>` | Ejecuta funciones PL/pgSQL con control transaccional automático (`BEGIN`, `COMMIT`, `ROLLBACK`, `RELEASE`). Ideal para operaciones simples que deben ser atómicas |
75
+ | `PgFunctionTransactional<T>` | Ejecuta funciones dentro de una transacción controlada manualmente. El desarrollador debe encargarse de realizar `commit()`, `rollback()` y `release()` usando la conexión provista. Útil cuando se deben encadenar múltiples funciones en una misma transacción |
76
+ | `PgConnection` | Wrapper de `PoolClient` con manejo de transacciones y logs |
77
+ | `registerPool()` | Registra el `Pool` global del proyecto |
78
+ | `setLogger()` | Define un logger personalizado |
@@ -0,0 +1,12 @@
1
+ import { PoolClient, QueryResult } from "pg";
2
+ export declare class PgConnection {
3
+ private readonly connection;
4
+ constructor(connection: PoolClient);
5
+ get raw(): PoolClient;
6
+ query(sql: string, params?: any[]): Promise<QueryResult<any> | null>;
7
+ begin(): Promise<void>;
8
+ commit(): Promise<void>;
9
+ rollback(): Promise<void>;
10
+ release(): void;
11
+ }
12
+ //# sourceMappingURL=PgConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgConnection.d.ts","sourceRoot":"","sources":["../src/PgConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAG7C,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAInD,IAAI,GAAG,IAAI,UAAU,CAEpB;IAEK,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAUxE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAKvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAK/B,OAAO,IAAI,IAAI;CAIhB"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PgConnection = void 0;
4
+ const utils_1 = require("./utils");
5
+ class PgConnection {
6
+ constructor(connection) {
7
+ this.connection = connection;
8
+ (0, utils_1.getLogger)().info(`Acquired DB connection for function execution.`);
9
+ }
10
+ get raw() {
11
+ return this.connection;
12
+ }
13
+ async query(sql, params = []) {
14
+ (0, utils_1.getLogger)().info(`Executing ${sql} with args: ${JSON.stringify(params)}`);
15
+ const result = await this.connection.query(sql, params);
16
+ if (result.rowCount === 0) {
17
+ (0, utils_1.getLogger)().info(`Function returned no rows.`);
18
+ return null;
19
+ }
20
+ return result;
21
+ }
22
+ async begin() {
23
+ await this.connection.query("BEGIN");
24
+ }
25
+ async commit() {
26
+ await this.connection.query("COMMIT");
27
+ (0, utils_1.getLogger)().info(`Function executed successfully.`);
28
+ }
29
+ async rollback() {
30
+ await this.connection.query("ROLLBACK");
31
+ (0, utils_1.getLogger)().error('Error during function execution. Rolled back transaction.');
32
+ }
33
+ release() {
34
+ this.connection.release();
35
+ (0, utils_1.getLogger)().info(`Connection released.`);
36
+ }
37
+ }
38
+ exports.PgConnection = PgConnection;
39
+ //# sourceMappingURL=PgConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgConnection.js","sourceRoot":"","sources":["../src/PgConnection.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AAEpC,MAAa,YAAY;IACvB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QACjD,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,UAAU,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAW,EAAE,SAAgB,EAAE;QACzC,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,aAAa,GAAG,eAAe,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACxD,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAA;IACrD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACrC,IAAA,iBAAS,GAAE,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAA;IAClF,CAAC;IAED,OAAO;QACL,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;QACzB,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IAC1C,CAAC;CACF;AArCD,oCAqCC"}
@@ -0,0 +1,4 @@
1
+ import type { Pool } from 'pg';
2
+ export declare function registerPool(pool: Pool): void;
3
+ export declare function getPool(): Pool;
4
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI/B,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAK7C;AAED,wBAAgB,OAAO,IAAI,IAAI,CAK9B"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerPool = registerPool;
4
+ exports.getPool = getPool;
5
+ let appPool;
6
+ function registerPool(pool) {
7
+ if (appPool) {
8
+ throw new Error('pg-functions: Ya existe un pool registrado. Solo se permite un pool por aplicación.');
9
+ }
10
+ appPool = pool;
11
+ }
12
+ function getPool() {
13
+ if (!appPool) {
14
+ throw new Error('pg-functions: No se ha registrado un pool. Asegúrate de llamar a registerPool antes de usar getPool.');
15
+ }
16
+ return appPool;
17
+ }
18
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAIA,oCAKC;AAED,0BAKC;AAdD,IAAI,OAAyB,CAAC;AAE9B,SAAgB,YAAY,CAAC,IAAU;IACrC,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAED,SAAgB,OAAO;IACrB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAC;IAC1H,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare enum SqlMode {
2
+ DEFAULT = "DEFAULT",
3
+ SCALAR = "SCALAR"
4
+ }
5
+ //# sourceMappingURL=SqlMode.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlMode.enum.d.ts","sourceRoot":"","sources":["../../src/enum/SqlMode.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;CACpB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SqlMode = void 0;
4
+ var SqlMode;
5
+ (function (SqlMode) {
6
+ SqlMode["DEFAULT"] = "DEFAULT";
7
+ SqlMode["SCALAR"] = "SCALAR";
8
+ })(SqlMode || (exports.SqlMode = SqlMode = {}));
9
+ //# sourceMappingURL=SqlMode.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlMode.enum.js","sourceRoot":"","sources":["../../src/enum/SqlMode.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,8BAAmB,CAAA;IACnB,4BAAiB,CAAA;AACrB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB"}
@@ -0,0 +1,8 @@
1
+ import { Common } from "../interfaces/Common";
2
+ import { PgFunctionBase } from "./PgFunctionBase";
3
+ export declare class PgFunction<T> extends PgFunctionBase implements Common<T> {
4
+ constructor(funtionName: string, functionArgs: any[]);
5
+ execute(): Promise<T[] | null>;
6
+ executeScalar(): Promise<T | null>;
7
+ }
8
+ //# sourceMappingURL=PgFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunction.d.ts","sourceRoot":"","sources":["../../src/functions/PgFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,UAAU,CAAC,CAAC,CAAE,SAAQ,cAAe,YAAW,MAAM,CAAC,CAAC,CAAC;gBACxD,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE;IAI9C,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;IAmB9B,aAAa,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAuBzC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PgFunction = void 0;
4
+ const PgFunctionBase_1 = require("./PgFunctionBase");
5
+ const context_1 = require("../context");
6
+ const PgConnection_1 = require("../PgConnection");
7
+ const SqlMode_enum_1 = require("../enum/SqlMode.enum");
8
+ class PgFunction extends PgFunctionBase_1.PgFunctionBase {
9
+ constructor(funtionName, functionArgs) {
10
+ super(funtionName, functionArgs);
11
+ }
12
+ async execute() {
13
+ const connection = new PgConnection_1.PgConnection(await (0, context_1.getPool)().connect());
14
+ try {
15
+ await connection.begin();
16
+ const result = await connection.query(this.sql(), super.getfunctionArgs());
17
+ if (!result) {
18
+ return null;
19
+ }
20
+ await connection.commit();
21
+ return result.rows;
22
+ }
23
+ catch (error) {
24
+ await connection.rollback();
25
+ throw error;
26
+ }
27
+ finally {
28
+ connection.release();
29
+ }
30
+ }
31
+ async executeScalar() {
32
+ const connection = new PgConnection_1.PgConnection(await (0, context_1.getPool)().connect());
33
+ try {
34
+ await connection.begin();
35
+ const result = await connection.query(this.sql(SqlMode_enum_1.SqlMode.SCALAR), super.getfunctionArgs());
36
+ if (!result) {
37
+ return null;
38
+ }
39
+ const row = result.rows[0];
40
+ const value = Object.values(row)[0];
41
+ await connection.commit();
42
+ return value;
43
+ }
44
+ catch (error) {
45
+ await connection.rollback();
46
+ throw error;
47
+ }
48
+ finally {
49
+ connection.release();
50
+ }
51
+ }
52
+ }
53
+ exports.PgFunction = PgFunction;
54
+ //# sourceMappingURL=PgFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunction.js","sourceRoot":"","sources":["../../src/functions/PgFunction.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAClD,wCAAoC;AACpC,kDAA+C;AAC/C,uDAA+C;AAE/C,MAAa,UAAc,SAAQ,+BAAc;IAC/C,YAAY,WAAmB,EAAE,YAAmB;QAChD,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,UAAU,GAAG,IAAI,2BAAY,CAAC,MAAM,IAAA,iBAAO,GAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QAC9D,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;YACxB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;YAC1E,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAA;YACb,CAAC;YAED,MAAM,UAAU,CAAC,MAAM,EAAE,CAAA;YACzB,OAAO,MAAM,CAAC,IAAW,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAA;YAC3B,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,OAAO,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,UAAU,GAAG,IAAI,2BAAY,CAAC,MAAM,IAAA,iBAAO,GAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QAC9D,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;YACxB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;YACxF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAEpC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAA;YACzB,OAAO,KAAU,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAA;YAC3B,MAAM,KAAK,CAAA;QACb,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,OAAO,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CAGF;AA/CD,gCA+CC"}
@@ -0,0 +1,11 @@
1
+ import { SqlMode } from "../enum/SqlMode.enum";
2
+ import { Base } from "../interfaces/Base";
3
+ export declare abstract class PgFunctionBase implements Base {
4
+ private readonly functionName;
5
+ private readonly functionArgs;
6
+ constructor(functionName: string, functionArgs: any[]);
7
+ sql(mode?: SqlMode): string;
8
+ getPlaceHolders(): string;
9
+ getfunctionArgs(): string[];
10
+ }
11
+ //# sourceMappingURL=PgFunctionBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunctionBase.d.ts","sourceRoot":"","sources":["../../src/functions/PgFunctionBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,8BAAsB,cAAe,YAAW,IAAI;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAO;gBAExB,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE;IAKrD,GAAG,CAAC,IAAI,GAAE,OAAyB,GAAG,MAAM;IAM5C,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM,EAAE;CAG9B"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PgFunctionBase = void 0;
4
+ const SqlMode_enum_1 = require("../enum/SqlMode.enum");
5
+ class PgFunctionBase {
6
+ constructor(functionName, functionArgs) {
7
+ this.functionName = functionName;
8
+ this.functionArgs = functionArgs;
9
+ }
10
+ sql(mode = SqlMode_enum_1.SqlMode.DEFAULT) {
11
+ const prefix = mode === SqlMode_enum_1.SqlMode.SCALAR ? 'SELECT' : 'SELECT * FROM';
12
+ const suffix = mode === SqlMode_enum_1.SqlMode.SCALAR ? ' AS result' : '';
13
+ return `${prefix} ${this.functionName}(${this.getPlaceHolders()})${suffix};`;
14
+ }
15
+ getPlaceHolders() {
16
+ return this.functionArgs.length ? this.functionArgs.map((_, i) => `$${i + 1}`).join(', ') : '';
17
+ }
18
+ getfunctionArgs() {
19
+ return this.functionArgs;
20
+ }
21
+ }
22
+ exports.PgFunctionBase = PgFunctionBase;
23
+ //# sourceMappingURL=PgFunctionBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunctionBase.js","sourceRoot":"","sources":["../../src/functions/PgFunctionBase.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAG9C,MAAsB,cAAc;IAIhC,YAAY,YAAoB,EAAE,YAAmB;QACjD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACpC,CAAC;IAED,GAAG,CAAC,OAAgB,sBAAO,CAAC,OAAO;QAC/B,MAAM,MAAM,GAAG,IAAI,KAAK,sBAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAA;QACnE,MAAM,MAAM,GAAG,IAAI,KAAK,sBAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1D,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,eAAe,EAAE,IAAI,MAAM,GAAG,CAAA;IAChF,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAClG,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,YAAY,CAAA;IAC5B,CAAC;CACJ;AAtBD,wCAsBC"}
@@ -0,0 +1,9 @@
1
+ import { PgFunctionBase } from "./PgFunctionBase";
2
+ import { Transactional } from "../interfaces/Transactional";
3
+ import { PgConnection } from "PgConnection";
4
+ export declare class PgFunctionTransactional<T = any> extends PgFunctionBase implements Transactional<T> {
5
+ constructor(functionName: string, functionArgs: any[]);
6
+ execute(connection: PgConnection): Promise<T[] | null>;
7
+ executeScalar(connection: PgConnection): Promise<T | null>;
8
+ }
9
+ //# sourceMappingURL=PgFunctionTransactional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunctionTransactional.d.ts","sourceRoot":"","sources":["../../src/functions/PgFunctionTransactional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,qBAAa,uBAAuB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,cAAe,YAAW,aAAa,CAAC,CAAC,CAAC;gBAClF,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE;IAI/C,OAAO,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;IAStD,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAWjE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PgFunctionTransactional = void 0;
4
+ const PgFunctionBase_1 = require("./PgFunctionBase");
5
+ const SqlMode_enum_1 = require("../enum/SqlMode.enum");
6
+ class PgFunctionTransactional extends PgFunctionBase_1.PgFunctionBase {
7
+ constructor(functionName, functionArgs) {
8
+ super(functionName, functionArgs);
9
+ }
10
+ async execute(connection) {
11
+ const result = await connection.query(this.sql(), this.getfunctionArgs());
12
+ if (!result) {
13
+ return null;
14
+ }
15
+ return result.rows;
16
+ }
17
+ async executeScalar(connection) {
18
+ const result = await connection.query(this.sql(SqlMode_enum_1.SqlMode.SCALAR), this.getfunctionArgs());
19
+ if (!result) {
20
+ return null;
21
+ }
22
+ const row = result.rows[0];
23
+ const value = Object.values(row)[0];
24
+ return value;
25
+ }
26
+ }
27
+ exports.PgFunctionTransactional = PgFunctionTransactional;
28
+ //# sourceMappingURL=PgFunctionTransactional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgFunctionTransactional.js","sourceRoot":"","sources":["../../src/functions/PgFunctionTransactional.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAElD,uDAA+C;AAG/C,MAAa,uBAAiC,SAAQ,+BAAc;IAClE,YAAY,YAAoB,EAAE,YAAmB;QACjD,KAAK,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,UAAwB;QACpC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QAC1E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,MAAM,CAAC,IAAW,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,UAAwB;QAC1C,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;QACxF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QAChB,CAAC;QAEC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE3B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACnC,OAAO,KAAU,CAAA;IACnB,CAAC;CACF;AAzBD,0DAyBC"}
@@ -0,0 +1,7 @@
1
+ export * from "./PgConnection";
2
+ export * from "./context";
3
+ export * from "./functions/PgFunction";
4
+ export * from "./functions/PgFunctionTransactional";
5
+ export * from "./utils/logger";
6
+ export * from "./utils";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,wBAAwB,CAAA;AACtC,cAAc,qCAAqC,CAAA;AACnD,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./PgConnection"), exports);
18
+ __exportStar(require("./context"), exports);
19
+ __exportStar(require("./functions/PgFunction"), exports);
20
+ __exportStar(require("./functions/PgFunctionTransactional"), exports);
21
+ __exportStar(require("./utils/logger"), exports);
22
+ __exportStar(require("./utils"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B;AAC9B,4CAAyB;AACzB,yDAAsC;AACtC,sEAAmD;AACnD,iDAA8B;AAC9B,0CAAuB"}
@@ -0,0 +1,4 @@
1
+ export interface Base {
2
+ sql(): string;
3
+ }
4
+ //# sourceMappingURL=Base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/interfaces/Base.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACjB,GAAG,IAAI,MAAM,CAAC;CACjB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../src/interfaces/Base.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export interface Common<T> {
2
+ executeScalar(): Promise<T | null>;
3
+ execute(): Promise<T[] | null>;
4
+ }
5
+ //# sourceMappingURL=Common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../../src/interfaces/Common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM,CAAC,CAAC;IACrB,aAAa,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Common.js","sourceRoot":"","sources":["../../src/interfaces/Common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface ILogger {
2
+ info(message: string, ...args: any[]): void;
3
+ warn(message: string, ...args: any[]): void;
4
+ error(message: string, ...args: any[]): void;
5
+ }
6
+ //# sourceMappingURL=ILogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogger.d.ts","sourceRoot":"","sources":["../../src/interfaces/ILogger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IAEtB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC9C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ILogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/interfaces/ILogger.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { PgConnection } from "PgConnection";
2
+ export interface Transactional<T> {
3
+ executeScalar(connection: PgConnection): Promise<T | null>;
4
+ execute(connection: PgConnection): Promise<T[] | null>;
5
+ }
6
+ //# sourceMappingURL=Transactional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transactional.d.ts","sourceRoot":"","sources":["../../src/interfaces/Transactional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,aAAa,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3D,OAAO,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;CACxD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Transactional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transactional.js","sourceRoot":"","sources":["../../src/interfaces/Transactional.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { ILogger } from "../interfaces/ILogger";
2
+ export declare const setLogger: (customLogger: ILogger) => void;
3
+ export declare const getLogger: () => ILogger;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKhD,eAAO,MAAM,SAAS,GAAI,cAAc,OAAO,SAE9C,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,OAE5B,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLogger = exports.setLogger = void 0;
4
+ const logger_1 = require("./logger");
5
+ let globalLogger = new logger_1.ConsoleLogger();
6
+ const setLogger = (customLogger) => {
7
+ globalLogger = customLogger;
8
+ };
9
+ exports.setLogger = setLogger;
10
+ const getLogger = () => {
11
+ return globalLogger;
12
+ };
13
+ exports.getLogger = getLogger;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AACA,qCAAyC;AAEzC,IAAI,YAAY,GAAY,IAAI,sBAAa,EAAE,CAAA;AAExC,MAAM,SAAS,GAAG,CAAC,YAAqB,EAAE,EAAE;IACjD,YAAY,GAAG,YAAY,CAAC;AAC9B,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,SAAS,GAAG,GAAY,EAAE;IACrC,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
@@ -0,0 +1,10 @@
1
+ import { ILogger } from '../interfaces/ILogger';
2
+ export declare class ConsoleLogger implements ILogger {
3
+ private logger;
4
+ constructor(customLogger?: ILogger);
5
+ private formatMessage;
6
+ info(message: string, ...args: any[]): void;
7
+ warn(message: string, ...args: any[]): void;
8
+ error(message: string, ...args: any[]): void;
9
+ }
10
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,qBAAa,aAAc,YAAW,OAAO;IAC3C,OAAO,CAAC,MAAM,CAAS;gBACX,YAAY,CAAC,EAAE,OAAO;IAMlC,OAAO,CAAC,aAAa;IAIrB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAG3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAG3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAG7C"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ConsoleLogger = void 0;
7
+ const pino_1 = __importDefault(require("pino"));
8
+ class ConsoleLogger {
9
+ constructor(customLogger) {
10
+ this.logger = customLogger || (0, pino_1.default)({
11
+ level: process.env.PG_FUNCTIONS_LOG_LEVEL || 'info'
12
+ });
13
+ }
14
+ formatMessage(message) {
15
+ return `pg-functions: ${message}`;
16
+ }
17
+ info(message, ...args) {
18
+ this.logger.info(this.formatMessage(message), ...args);
19
+ }
20
+ warn(message, ...args) {
21
+ this.logger.warn(this.formatMessage(message), ...args);
22
+ }
23
+ error(message, ...args) {
24
+ this.logger.error(this.formatMessage(message), ...args);
25
+ }
26
+ }
27
+ exports.ConsoleLogger = ConsoleLogger;
28
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;;;;AACA,gDAAwB;AAExB,MAAa,aAAa;IAExB,YAAY,YAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,YAAY,IAAI,IAAA,cAAI,EAAC;YACjC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,MAAM;SACpD,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,OAAe;QACnC,OAAO,iBAAiB,OAAO,EAAE,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,GAAG,IAAW;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,GAAG,IAAW;QAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,GAAG,IAAW;QACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;CACF;AArBD,sCAqBC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "pg-functions",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "build": "tsc"
13
+ },
14
+ "peerDependencies": {
15
+ "pg": "^8.0.0"
16
+ },
17
+ "devDependencies": {
18
+ "@types/node": "^20.0.0",
19
+ "@types/pg": "^8.0.0",
20
+ "pg": "^8.0.0",
21
+ "typescript": "^5.0.0"
22
+ },
23
+ "keywords": [],
24
+ "author": "mfbasta",
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "pino": "^9.7.0"
28
+ }
29
+ }