web_plsql 0.14.1 → 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.1",
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
@@ -23,7 +23,7 @@ export const z$configStaticType = z.strictObject({
23
23
  });
24
24
 
25
25
  /**
26
- * @typedef {(req: Request, connection: Connection) => void | Promise<void>} transactionCallbackType
26
+ * @typedef {(connection: Connection, procedure: string) => void | Promise<void>} transactionCallbackType
27
27
  * @typedef {'commit' | 'rollback' | transactionCallbackType | undefined | null} transactionModeType
28
28
  */
29
29
 
package/types/types.d.ts CHANGED
@@ -21,7 +21,7 @@ export const z$configStaticType: z.ZodObject<{
21
21
  directoryPath: z.ZodString;
22
22
  }, z.core.$strict>;
23
23
  /**
24
- * @typedef {(req: Request, connection: Connection) => void | Promise<void>} transactionCallbackType
24
+ * @typedef {(connection: Connection, procedure: string) => void | Promise<void>} transactionCallbackType
25
25
  * @typedef {'commit' | 'rollback' | transactionCallbackType | undefined | null} transactionModeType
26
26
  */
27
27
  /**
@@ -132,7 +132,7 @@ export type configStaticType = {
132
132
  */
133
133
  directoryPath: string;
134
134
  };
135
- export type transactionCallbackType = (req: Request, connection: Connection) => void | Promise<void>;
135
+ export type transactionCallbackType = (connection: Connection, procedure: string) => void | Promise<void>;
136
136
  export type transactionModeType = "commit" | "rollback" | transactionCallbackType | undefined | null;
137
137
  export type configPlSqlHandlerType = {
138
138
  /**