web_plsql 0.14.0 → 0.14.2

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/README.md CHANGED
@@ -58,13 +58,7 @@ The `startServer` api uses the following configuration object:
58
58
  */
59
59
 
60
60
  /**
61
- * @callback transactionCallbackType
62
- * @param {Request} req - Incoming request object.
63
- * @param {import('oracledb').Connection} connection - Active database connection pool.
64
- * @returns {void | Promise<void>}
65
- */
66
-
67
- /**
61
+ * @typedef {(connection: Connection, procedure: string) => void | Promise<void>} transactionCallbackType
68
62
  * @typedef {'commit' | 'rollback' | transactionCallbackType | undefined | null} transactionModeType
69
63
  */
70
64
 
@@ -55,14 +55,12 @@ void startServer({
55
55
  requestValidationFunction: 'sample_pkg.request_validation_function', // PlsqlRequestValidationFunction
56
56
  pathAlias: 'myalias', // PlsqlPathAlias
57
57
  pathAliasProcedure: 'sample_pkg.page_path_alias', // PlsqlPathAliasProcedure
58
- transactionMode: 'commit',
59
- /*
60
- transactionMode: async (req, connection) => {
58
+ //transactionMode: 'commit',
59
+ transactionMode: async (connection, procedure) => {
61
60
  if (await hasOpenTransaction(connection)) {
62
- console.log(`We detected an open transaction in "${req.originalUrl}"`);
61
+ console.log(`We detected an open transaction in "${procedure}"`);
63
62
  }
64
63
  },
65
- */
66
64
  errorStyle: 'debug', // PlsqlErrorStyle
67
65
  },
68
66
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web_plsql",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "author": "Dieter Oberkofler <dieter.oberkofler@gmail.com>",
5
5
  "license": "MIT",
6
6
  "description": "The Express Middleware for Oracle PL/SQL",
@@ -68,7 +68,7 @@ export const processRequest = async (req, res, options, connectionPool) => {
68
68
  await connection.rollback();
69
69
  } else if (typeof options.transactionMode === 'function') {
70
70
  debug('transactionMode: callback');
71
- const result = options.transactionMode(req, connection);
71
+ const result = options.transactionMode(connection, req.params.name);
72
72
  debug('transactionMode: callback restult', result);
73
73
  if (result && typeof result.then === 'function') {
74
74
  await result;
package/src/types.js CHANGED
@@ -2,6 +2,7 @@ import z from 'zod';
2
2
 
3
3
  /**
4
4
  * @typedef {import('oracledb').BindParameter} BindParameter
5
+ * @typedef {import('oracledb').Connection} Connection
5
6
  * @typedef {import('express').CookieOptions} CookieOptions
6
7
  * @typedef {import('express').Request} Request
7
8
  */
@@ -22,13 +23,7 @@ export const z$configStaticType = z.strictObject({
22
23
  });
23
24
 
24
25
  /**
25
- * @callback transactionCallbackType
26
- * @param {Request} req - Incoming request object.
27
- * @param {import('oracledb').Connection} connection - Active database connection pool.
28
- * @returns {void | Promise<void>}
29
- */
30
-
31
- /**
26
+ * @typedef {(connection: Connection, procedure: string) => void | Promise<void>} transactionCallbackType
32
27
  * @typedef {'commit' | 'rollback' | transactionCallbackType | undefined | null} transactionModeType
33
28
  */
34
29
 
package/types/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * @typedef {import('oracledb').BindParameter} BindParameter
3
+ * @typedef {import('oracledb').Connection} Connection
3
4
  * @typedef {import('express').CookieOptions} CookieOptions
4
5
  * @typedef {import('express').Request} Request
5
6
  */
@@ -20,12 +21,7 @@ export const z$configStaticType: z.ZodObject<{
20
21
  directoryPath: z.ZodString;
21
22
  }, z.core.$strict>;
22
23
  /**
23
- * @callback transactionCallbackType
24
- * @param {Request} req - Incoming request object.
25
- * @param {import('oracledb').Connection} connection - Active database connection pool.
26
- * @returns {void | Promise<void>}
27
- */
28
- /**
24
+ * @typedef {(connection: Connection, procedure: string) => void | Promise<void>} transactionCallbackType
29
25
  * @typedef {'commit' | 'rollback' | transactionCallbackType | undefined | null} transactionModeType
30
26
  */
31
27
  /**
@@ -122,6 +118,7 @@ export const z$configType: z.ZodObject<{
122
118
  loggerFilename: z.ZodString;
123
119
  }, z.core.$strict>;
124
120
  export type BindParameter = import("oracledb").BindParameter;
121
+ export type Connection = import("oracledb").Connection;
125
122
  export type CookieOptions = import("express").CookieOptions;
126
123
  export type Request = import("express").Request;
127
124
  export type errorStyleType = "basic" | "debug";
@@ -135,7 +132,7 @@ export type configStaticType = {
135
132
  */
136
133
  directoryPath: string;
137
134
  };
138
- export type transactionCallbackType = (req: Request, connection: import("oracledb").Connection) => void | Promise<void>;
135
+ export type transactionCallbackType = (connection: Connection, procedure: string) => void | Promise<void>;
139
136
  export type transactionModeType = "commit" | "rollback" | transactionCallbackType | undefined | null;
140
137
  export type configPlSqlHandlerType = {
141
138
  /**