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 +1 -7
- package/examples/config-native.js +3 -5
- package/package.json +1 -1
- package/src/handler/plsql/request.js +1 -1
- package/src/types.js +1 -1
- package/types/types.d.ts +2 -2
package/README.md
CHANGED
|
@@ -58,13 +58,7 @@ The `startServer` api uses the following configuration object:
|
|
|
58
58
|
*/
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* @
|
|
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 "${
|
|
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
|
@@ -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(
|
|
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 {(
|
|
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 {(
|
|
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 = (
|
|
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
|
/**
|