web_plsql 0.5.1 → 0.6.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 (96) hide show
  1. package/README.md +124 -111
  2. package/examples/server_apex.js +28 -0
  3. package/examples/server_sample.js +30 -0
  4. package/examples/sql/{doc_table.sql → doctable.sql} +1 -1
  5. package/examples/sql/install.sql +6 -9
  6. package/examples/sql/sample_package.sql +27 -0
  7. package/examples/sql/sample_package_body.sql +245 -0
  8. package/examples/static/sample.css +11 -10
  9. package/package.json +90 -83
  10. package/src/cgi.js +127 -0
  11. package/src/error.js +24 -0
  12. package/src/errorPage.js +296 -0
  13. package/src/file.js +77 -0
  14. package/src/handlerLogger.js +21 -0
  15. package/src/handlerMetrics.js +46 -0
  16. package/src/handlerPlSql.js +65 -0
  17. package/src/handlerUpload.js +32 -0
  18. package/src/index.js +17 -0
  19. package/src/oracle.js +80 -0
  20. package/src/parsePage.js +193 -0
  21. package/src/procedure.js +260 -0
  22. package/src/procedureError.js +40 -0
  23. package/src/procedureNamed.js +233 -0
  24. package/src/procedureSanitize.js +215 -0
  25. package/src/procedureVariable.js +57 -0
  26. package/src/request.js +103 -0
  27. package/src/{requestError.ts → requestError.js} +8 -4
  28. package/src/sendResponse.js +104 -0
  29. package/src/server.js +106 -0
  30. package/src/shutdown.js +53 -0
  31. package/src/stream.js +28 -0
  32. package/src/trace.js +74 -0
  33. package/src/tty.js +48 -0
  34. package/src/types.js +146 -0
  35. package/src/upload.js +92 -0
  36. package/src/version.js +23 -0
  37. package/types/cgi.d.ts +4 -0
  38. package/types/error.d.ts +1 -0
  39. package/types/errorPage.d.ts +10 -0
  40. package/types/file.d.ts +5 -0
  41. package/types/handlerLogger.d.ts +2 -0
  42. package/types/handlerMetrics.d.ts +4 -0
  43. package/types/handlerPlSql.d.ts +8 -0
  44. package/types/handlerUpload.d.ts +7 -0
  45. package/types/index.d.ts +10 -0
  46. package/types/oracle.d.ts +5 -0
  47. package/types/parsePage.d.ts +3 -0
  48. package/types/procedure.d.ts +10 -0
  49. package/types/procedureError.d.ts +23 -0
  50. package/types/procedureNamed.d.ts +14 -0
  51. package/types/procedureSanitize.d.ts +14 -0
  52. package/types/procedureVariable.d.ts +9 -0
  53. package/types/request.d.ts +7 -0
  54. package/types/requestError.d.ts +8 -0
  55. package/types/sendResponse.d.ts +4 -0
  56. package/types/server.d.ts +7 -0
  57. package/types/shutdown.d.ts +2 -0
  58. package/types/stream.d.ts +1 -0
  59. package/types/trace.d.ts +5 -0
  60. package/types/tty.d.ts +4 -0
  61. package/types/types.d.ts +251 -0
  62. package/types/upload.d.ts +5 -0
  63. package/types/version.d.ts +7 -0
  64. package/.editorconfig +0 -8
  65. package/.eslintignore +0 -3
  66. package/.eslintrc.js +0 -347
  67. package/CHANGELOG.md +0 -133
  68. package/examples/apex.js +0 -70
  69. package/examples/credentials.js +0 -22
  70. package/examples/oracledb_example.js +0 -30
  71. package/examples/sample.js +0 -101
  72. package/examples/sql/sample.pkb +0 -223
  73. package/examples/sql/sample.pks +0 -24
  74. package/jest.config.js +0 -207
  75. package/src/cgi.ts +0 -95
  76. package/src/config.ts +0 -97
  77. package/src/errorPage.ts +0 -286
  78. package/src/fileUpload.ts +0 -126
  79. package/src/index.ts +0 -65
  80. package/src/page.ts +0 -275
  81. package/src/procedure.ts +0 -360
  82. package/src/procedureError.ts +0 -27
  83. package/src/request.ts +0 -139
  84. package/src/stream.ts +0 -26
  85. package/src/trace.ts +0 -194
  86. package/test/.eslintrc.json +0 -5
  87. package/test/__tests__/cgi.ts +0 -96
  88. package/test/__tests__/config.ts +0 -41
  89. package/test/__tests__/errorPage.ts +0 -101
  90. package/test/__tests__/oracledb_mock.ts +0 -98
  91. package/test/__tests__/server.ts +0 -495
  92. package/test/__tests__/stream.ts +0 -21
  93. package/test/mock/oracledb.ts +0 -85
  94. package/test/static/static.html +0 -1
  95. package/tsconfig.json +0 -24
  96. package/tsconfig.src.json +0 -23
package/src/trace.js ADDED
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Trace utilities
3
+ */
4
+
5
+ import * as rotatingFileStream from 'rotating-file-stream';
6
+ import express from 'express';
7
+ import util from 'node:util';
8
+
9
+ /**
10
+ * Return a string representation of the value.
11
+ *
12
+ * @param {unknown} value - Any value.
13
+ * @param {number | null} depth - Specifies the number of times to recurse while formatting object..
14
+ * @returns {string} - The string representation.
15
+ */
16
+ export const inspect = (value, depth = null) => util.inspect(value, {showHidden: false, depth, colors: false});
17
+
18
+ /**
19
+ * Log text to the console and to a file.
20
+ *
21
+ * @param {string} text - Text to log.
22
+ * @returns {void}
23
+ */
24
+ export const logToFile = (text) => {
25
+ const fs = rotatingFileStream.createStream('trace.log', {
26
+ size: '10M', // rotate every 10 MegaBytes written
27
+ interval: '1d', // rotate daily
28
+ maxFiles: 10, // maximum number of rotated files to keep
29
+ compress: 'gzip', // compress rotated files
30
+ });
31
+
32
+ fs.write(text);
33
+ fs.end();
34
+ };
35
+
36
+ /**
37
+ * Return a string representation of the request.
38
+ *
39
+ * @param {express.Request} req - express.Request.
40
+ * @param {boolean} simple - Set to false to see all public properties of the request.
41
+ * @returns {string} - The string representation.
42
+ */
43
+ export const inspectRequest = (req, simple = true) => {
44
+ /** @type {Record<string, unknown>} */
45
+ const requestData = {};
46
+
47
+ Object.keys(req)
48
+ .filter((prop) =>
49
+ simple ? ['originalUrl', 'params', 'query', 'url', 'method', 'body', 'files', 'secret', 'cookies'].includes(prop) : !prop.startsWith('_'),
50
+ )
51
+ .forEach((prop) => {
52
+ requestData[prop] = req[/** @type {keyof import('express').Request} */ (prop)];
53
+ });
54
+
55
+ return inspect(requestData);
56
+ };
57
+
58
+ /**
59
+ * Get a block.
60
+ * @param {string} title - The name.
61
+ * @param {string} body - The name.
62
+ * @returns {string} - The text.
63
+ */
64
+ export const getBlock = (title, body) => {
65
+ const SEPARATOR = '-'.repeat(30);
66
+
67
+ return `\n${SEPARATOR}${title.toUpperCase()}${SEPARATOR}\n${body}`;
68
+ };
69
+
70
+ /**
71
+ * Get a timestamp
72
+ * @returns {string} - The timestamp.
73
+ */
74
+ export const getTimestamp = () => new Date().toISOString();
package/src/tty.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Write to stdout.
3
+ * @param {string} text - text to write.
4
+ * @returns {void}
5
+ */
6
+ export const write = (text) => {
7
+ if (process.stdout.isTTY) {
8
+ process.stdout.write(text);
9
+ }
10
+ };
11
+
12
+ /**
13
+ * Write to stdout with new line.
14
+ * @param {string} text - text to write.
15
+ * @returns {void}
16
+ */
17
+ export const writeNewLine = (text = '') => {
18
+ if (process.stdout.isTTY) {
19
+ process.stdout.write(`${text}\n`);
20
+ }
21
+ };
22
+
23
+ /**
24
+ * Write to stdout after erasing line.
25
+ * @param {string} text - text to write.
26
+ * @returns {void}
27
+ */
28
+ export const writeAfterEraseLine = (text) => {
29
+ if (process.stdout.isTTY) {
30
+ process.stdout.clearLine(0);
31
+ process.stdout.cursorTo(0);
32
+ process.stdout.write(text);
33
+ }
34
+ };
35
+
36
+ /**
37
+ * Write to stdout starting a column.
38
+ * @param {string} text - text to write.
39
+ * @param {number} column - column.
40
+ * @returns {void}
41
+ */
42
+ export const writeStartingOnColumn = (text, column) => {
43
+ if (process.stdout.isTTY) {
44
+ process.stdout.cursorTo(column);
45
+ process.stdout.clearLine(1);
46
+ process.stdout.write(text);
47
+ }
48
+ };
package/src/types.js ADDED
@@ -0,0 +1,146 @@
1
+ import z from 'zod';
2
+
3
+ /**
4
+ * @typedef {import('oracledb').BindParameter} BindParameter
5
+ */
6
+
7
+ /**
8
+ * @typedef {'basic' | 'debug'} errorStyleType
9
+ */
10
+ export const z$errorStyleType = z.enum(['basic', 'debug']);
11
+
12
+ /**
13
+ * @typedef {object} configStaticType
14
+ * @property {string} route - The Static route path.
15
+ * @property {string} directoryPath - The Static directory.
16
+ */
17
+ export const z$configStaticType = z
18
+ .object({
19
+ route: z.string(),
20
+ directoryPath: z.string(),
21
+ })
22
+ .strict();
23
+
24
+ /**
25
+ * @typedef {object} configPlSqlHandlerType
26
+ * @property {string} defaultPage - The default page.
27
+ * @property {string} [pathAlias] - The path alias.
28
+ * @property {string} [pathAliasProcedure] - The path alias.
29
+ * @property {string} documentTable - The document table.
30
+ * @property {string[]} [exclusionList] - The exclusion list.
31
+ * @property {string} [requestValidationFunction] - The request validation function.
32
+ * @property {Record<string, string>} [cgi] - The additional CGI.
33
+ * @property {errorStyleType} errorStyle - The error style.
34
+ */
35
+ export const z$configPlSqlHandlerType = z
36
+ .object({
37
+ defaultPage: z.string(),
38
+ pathAlias: z.string().optional(),
39
+ pathAliasProcedure: z.string().optional(),
40
+ documentTable: z.string(),
41
+ exclusionList: z.array(z.string()).optional(),
42
+ requestValidationFunction: z.string().optional(),
43
+ errorStyle: z$errorStyleType,
44
+ })
45
+ .strict();
46
+
47
+ /**
48
+ * @typedef {object} configPlSqlConfigType
49
+ * @property {string} route - The PL/SQL route path.
50
+ * @property {string} user - The Oracle username.
51
+ * @property {string} password - The Oracle password.
52
+ * @property {string} connectString - The Oracle connect string.
53
+ */
54
+ export const z$configPlSqlConfigType = z
55
+ .object({
56
+ route: z.string(),
57
+ user: z.string(),
58
+ password: z.string(),
59
+ connectString: z.string(),
60
+ })
61
+ .strict();
62
+
63
+ /**
64
+ * @typedef {configPlSqlHandlerType & configPlSqlConfigType} configPlSqlType
65
+ */
66
+ export const z$configPlSqlType = z$configPlSqlHandlerType.merge(z$configPlSqlConfigType);
67
+
68
+ /**
69
+ * @typedef {object} configType
70
+ * @property {number} port - The server port number.
71
+ * @property {configStaticType[]} routeStatic - The static routes.
72
+ * @property {configPlSqlType[]} routePlSql - The PL/SQL routes.
73
+ * @property {string} loggerFilename - name of the request logger filename or '' if not required.
74
+ * @property {boolean} monitorConsole - Enable console status monitor.
75
+ */
76
+ export const z$configType = z
77
+ .object({
78
+ port: z.number(),
79
+ routeStatic: z.array(z$configStaticType),
80
+ routePlSql: z.array(z$configPlSqlType),
81
+ loggerFilename: z.string(),
82
+ monitorConsole: z.boolean(),
83
+ })
84
+ .strict();
85
+
86
+ /**
87
+ * Environment variables as string key-value pairs
88
+ * @typedef {Record<string, string>} environmentType
89
+ */
90
+
91
+ /**
92
+ * Oracle database bind parameter configuration
93
+ * @typedef {Record<string, BindParameter>} BindParameterConfig
94
+ */
95
+
96
+ /**
97
+ * Arguments object with string or string array values
98
+ * @typedef {Record<string, string | string[]>} argObjType
99
+ */
100
+
101
+ /**
102
+ * File upload metadata
103
+ * @typedef {object} fileUploadType
104
+ * @property {string} fieldname - The field value.
105
+ * @property {string} originalname - The filename.
106
+ * @property {string} encoding - The encoding.
107
+ * @property {string} mimetype - The mimetype.
108
+ * @property {string} filename - The filename.
109
+ * @property {string} path - The path.
110
+ * @property {number} size - The size.
111
+ */
112
+
113
+ /**
114
+ * @typedef {object} cookieType
115
+ * @property {string} name - The name of the cookie.
116
+ * @property {string} value - The value of the cookie.
117
+ * @property {string} [path] - The path of the cookie.
118
+ * @property {string} [domain] - The domain of the cookie.
119
+ * @property {string} [secure] - The secure flag.
120
+ * @property {Date} [expires] - The expiration date.
121
+ * @property {boolean} [httpOnly] - The httpOnly flag.
122
+ */
123
+
124
+ /**
125
+ * @typedef {object} pageType - The page.
126
+ * @property {string} body - The body of the page.
127
+ * @property {object} head - The head of the page.
128
+ * @property {cookieType[]} head.cookies - The cookies.
129
+ * @property {string} [head.contentType] - The content type.
130
+ * @property {number} [head.contentLength] - The content length.
131
+ * @property {number} [head.statusCode] - The status code.
132
+ * @property {string} [head.statusDescription] - The status description.
133
+ * @property {string} [head.redirectLocation] - The redirect location.
134
+ * @property {Record<string, string>} head.otherHeaders - The other headers.
135
+ * @property {string} [head.server] - The server.
136
+ * @property {object} file - The file.
137
+ * @property {string | null} file.fileType - The file type.
138
+ * @property {number | null} file.fileSize - The file size.
139
+ * @property {Buffer | null} file.fileBlob - The file blob.
140
+ */
141
+
142
+ /**
143
+ * @typedef {object} metricsType - The metrics.
144
+ * @property {number} totalRequests - The total number of requests.
145
+ * @property {number} requestsInLastInterval - The number of requests in the last second.
146
+ */
package/src/upload.js ADDED
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Process file uploads
3
+ */
4
+
5
+ // eslint-disable @typescript-eslint/no-unused-vars
6
+
7
+ import debugModule from 'debug';
8
+ const debug = debugModule('webplsql:fileUpload');
9
+
10
+ import {readFile, removeFile} from './file.js';
11
+ import oracledb from 'oracledb';
12
+ import z from 'zod';
13
+
14
+ /**
15
+ * @typedef {import('express').Request} Request
16
+ * @typedef {import('oracledb').Connection} Connection
17
+ * @typedef {import('./types.js').fileUploadType} fileUploadType
18
+ */
19
+
20
+ /**
21
+ * Get the files
22
+ *
23
+ * @param {Request} req - The req object represents the HTTP request.
24
+ * @returns {fileUploadType[]} - Promise that resolves with an array of files to be uploaded.
25
+ */
26
+ export const getFiles = (req) => {
27
+ /** @type {fileUploadType[]} */
28
+ const files = [];
29
+
30
+ if (!('files' in req)) {
31
+ return files;
32
+ }
33
+
34
+ if (typeof req.files === 'object' && req.files !== null && Object.keys(req.files).length === 0) {
35
+ return files;
36
+ }
37
+
38
+ debug('req.files=', req.files);
39
+
40
+ // validate
41
+ const reqFiles = z
42
+ .object({
43
+ fieldname: z.string(),
44
+ originalname: z.string(),
45
+ encoding: z.string(),
46
+ mimetype: z.string(),
47
+ destination: z.string(),
48
+ filename: z.string(),
49
+ path: z.string(),
50
+ size: z.number(),
51
+ })
52
+ .array()
53
+ .parse(req.files);
54
+
55
+ return reqFiles;
56
+ };
57
+
58
+ /**
59
+ * Upload the given file and return a promise.
60
+ *
61
+ * @param {fileUploadType} file - The file to upload.
62
+ * @param {string} doctable - The file to upload.
63
+ * @param {Connection} databaseConnection - The file to upload.
64
+ * @returns {Promise<void>} - Promise that resolves when uploaded.
65
+ */
66
+ export const uploadFile = async (file, doctable, databaseConnection) => {
67
+ /* istanbul ignore next */
68
+ if (typeof doctable !== 'string' || doctable.length === 0) {
69
+ throw new Error(`Unable to upload file "${file.filename}" because the option ""doctable" has not been defined`);
70
+ }
71
+
72
+ const blobContent = await readFile(file.path);
73
+ const sql = `INSERT INTO ${doctable} (name, mime_type, doc_size, dad_charset, last_updated, content_type, blob_content) VALUES (:name, :mime_type, :doc_size, 'ascii', SYSDATE, 'BLOB', :blob_content)`;
74
+ const bind = {
75
+ name: file.filename,
76
+ mime_type: file.mimetype,
77
+ doc_size: file.size,
78
+ blob_content: {
79
+ val: blobContent,
80
+ type: oracledb.BUFFER,
81
+ },
82
+ };
83
+
84
+ try {
85
+ await databaseConnection.execute(sql, bind, {autoCommit: true});
86
+ } catch (err) {
87
+ throw new Error(`Unable to insert file "${file.filename}"}`);
88
+ }
89
+
90
+ // remove the file
91
+ await removeFile(file.path);
92
+ };
package/src/version.js ADDED
@@ -0,0 +1,23 @@
1
+ import {fileURLToPath} from 'node:url';
2
+ import {dirname, join} from 'node:path';
3
+ import {getJsonFile} from './file.js';
4
+
5
+ /**
6
+ * @typedef {object} PackageJSON
7
+ * @property {string} [version] - The package version.
8
+ */
9
+
10
+ /**
11
+ * Retrieves the version from package.json.
12
+ *
13
+ * @returns {string} The version number of the package.
14
+ */
15
+ export const getPackageVersion = () => {
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+ const packageJsonPath = join(__dirname, '../package.json');
19
+
20
+ const pkg = /** @type {PackageJSON} */ (getJsonFile(packageJsonPath));
21
+
22
+ return typeof pkg.version === 'string' ? pkg.version : '';
23
+ };
package/types/cgi.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export function getCGI(req: Request, doctable: string, cgi: environmentType): environmentType;
2
+ export type Request = import("express").Request;
3
+ export type environmentType = import("./types.js").environmentType;
4
+ export type configPlSqlType = import("./types.js").configPlSqlType;
@@ -0,0 +1 @@
1
+ export function errorToString(error: unknown): string;
@@ -0,0 +1,10 @@
1
+ export function errorPage(req: Request, res: Response, options: configPlSqlHandlerType, error: unknown): void;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
5
+ export type environmentType = import("./types.js").environmentType;
6
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
7
+ export type outputType = {
8
+ html: string;
9
+ text: string;
10
+ };
@@ -0,0 +1,5 @@
1
+ export function readFile(filePath: string): Promise<Buffer>;
2
+ export function removeFile(filePath: string): Promise<void>;
3
+ export function getJsonFile(filePath: string): unknown;
4
+ export function isDirectory(directoryPath: unknown): Promise<boolean>;
5
+ export function isFile(filePath: unknown): Promise<boolean>;
@@ -0,0 +1,2 @@
1
+ export function handlerLogger(filename: string): RequestHandler;
2
+ export type RequestHandler = import("express").RequestHandler;
@@ -0,0 +1,4 @@
1
+ export function initMetrics(): metricsType;
2
+ export function handlerMetrics(metrics: metricsType): RequestHandler;
3
+ export type RequestHandler = import("express").RequestHandler;
4
+ export type metricsType = import("./types.js").metricsType;
@@ -0,0 +1,8 @@
1
+ export function handlerWebPlSql(connectionPool: Pool, config: configPlSqlHandlerType): RequestHandler;
2
+ export type RequestHandler = import("express").RequestHandler;
3
+ export type Request = import("express").Request;
4
+ export type Response = import("express").Response;
5
+ export type NextFunction = import("express").NextFunction;
6
+ export type Pool = import("oracledb").Pool;
7
+ export type environmentType = import("./types.js").environmentType;
8
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
@@ -0,0 +1,7 @@
1
+ export function handlerUpload(): RequestHandler;
2
+ export type RequestHandler = import("express").RequestHandler;
3
+ export type Response = import("express").Response;
4
+ export type NextFunction = import("express").NextFunction;
5
+ export type Pool = import("oracledb").Pool;
6
+ export type environmentType = import("./types.js").environmentType;
7
+ export type configType = import("./types.js").configType;
@@ -0,0 +1,10 @@
1
+ export { startServer } from "./server.js";
2
+ export * from "./shutdown.js";
3
+ export * from "./oracle.js";
4
+ export * from "./file.js";
5
+ export * from "./tty.js";
6
+ export * from "./version.js";
7
+ export { handlerWebPlSql } from "./handlerPlSql.js";
8
+ export { handlerLogger } from "./handlerLogger.js";
9
+ export { handlerUpload } from "./handlerUpload.js";
10
+ export { initMetrics, handlerMetrics } from "./handlerMetrics.js";
@@ -0,0 +1,5 @@
1
+ export function connectionValid(connectionPool: Pool): Promise<boolean>;
2
+ export function poolCreate(user: string, password: string, connectString: string, poolMin?: number, poolMax?: number): Promise<Pool>;
3
+ export function poolClose(pool: Pool): Promise<void>;
4
+ export function poolsClose(pools: Pool[]): Promise<void>;
5
+ export type Pool = import("oracledb").Pool;
@@ -0,0 +1,3 @@
1
+ export function parsePage(text: string): pageType;
2
+ export type pageType = import("./types.js").pageType;
3
+ export type cookieType = import("./types.js").cookieType;
@@ -0,0 +1,10 @@
1
+ export function invokeProcedure(req: Request, res: Response, argObj: argObjType, cgiObj: environmentType, filesToUpload: fileUploadType[], options: configPlSqlHandlerType, databaseConnection: Connection): Promise<void>;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type Connection = import("oracledb").Connection;
5
+ export type Result = import("oracledb").Result<unknown>;
6
+ export type argObjType = import("./types.js").argObjType;
7
+ export type fileUploadType = import("./types.js").fileUploadType;
8
+ export type environmentType = import("./types.js").environmentType;
9
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
10
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @typedef {import('./types.js').environmentType} environmentType
3
+ * @typedef {import('./types.js').BindParameterConfig} BindParameterConfig
4
+ */
5
+ export class ProcedureError extends Error {
6
+ /**
7
+ * @param {string} message - The error message.
8
+ * @param {environmentType} environment - The environment.
9
+ * @param {string} sql - The SQL to execute.
10
+ * @param {BindParameterConfig} bind - The bind parameters.
11
+ */
12
+ constructor(message: string, environment: environmentType, sql: string, bind: BindParameterConfig);
13
+ /** @type {Date} */
14
+ timestamp: Date;
15
+ /** @type {environmentType} */
16
+ environment: environmentType;
17
+ /** @type {string} */
18
+ sql: string;
19
+ /** @type {BindParameterConfig} */
20
+ bind: BindParameterConfig;
21
+ }
22
+ export type environmentType = import("./types.js").environmentType;
23
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
@@ -0,0 +1,14 @@
1
+ export function getProcedureNamed(procName: string, argObj: argObjType, databaseConnection: Connection, options: configPlSqlHandlerType): Promise<{
2
+ sql: string;
3
+ bind: BindParameterConfig;
4
+ }>;
5
+ export type argsType = Record<string, string>;
6
+ export type cacheEntryType = {
7
+ hitCount: number;
8
+ args: argsType;
9
+ };
10
+ export type Connection = import("oracledb").Connection;
11
+ export type Result = import("oracledb").Result<unknown>;
12
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
13
+ export type argObjType = import("./types.js").argObjType;
14
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
@@ -0,0 +1,14 @@
1
+ export function sanitizeProcName(procName: string, databaseConnection: Connection, options: configPlSqlHandlerType): Promise<string>;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type Connection = import("oracledb").Connection;
5
+ export type Result = import("oracledb").Result<unknown>;
6
+ export type argObjType = import("./types.js").argObjType;
7
+ export type fileUploadType = import("./types.js").fileUploadType;
8
+ export type environmentType = import("./types.js").environmentType;
9
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
10
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
11
+ export type cacheEntryType = {
12
+ hitCount: number;
13
+ valid: boolean;
14
+ };
@@ -0,0 +1,9 @@
1
+ export function getProcedureVariable(procName: string, argObj: argObjType, databaseConnection: Connection, options: configPlSqlHandlerType): Promise<{
2
+ sql: string;
3
+ bind: BindParameterConfig;
4
+ }>;
5
+ export type Connection = import("oracledb").Connection;
6
+ export type Result = import("oracledb").Result<unknown>;
7
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
8
+ export type argObjType = import("./types.js").argObjType;
9
+ export type BindParameterConfig = import("./types.js").BindParameterConfig;
@@ -0,0 +1,7 @@
1
+ export function processRequest(req: Request, res: Response, options: configPlSqlHandlerType, connectionPool: Pool): Promise<void>;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type Pool = import("oracledb").Pool;
5
+ export type Connection = import("oracledb").Connection;
6
+ export type argObjType = import("./types.js").argObjType;
7
+ export type configPlSqlHandlerType = import("./types.js").configPlSqlHandlerType;
@@ -0,0 +1,8 @@
1
+ export class RequestError extends Error {
2
+ /**
3
+ * @param {string} message - The error message.
4
+ */
5
+ constructor(message: string);
6
+ /** @type {Date} */
7
+ timestamp: Date;
8
+ }
@@ -0,0 +1,4 @@
1
+ export function sendResponse(req: Request, res: Response, page: pageType): void;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type pageType = import("./types.js").pageType;
@@ -0,0 +1,7 @@
1
+ export function startServer(config: configType): Promise<void>;
2
+ export type Request = import("express").Request;
3
+ export type Response = import("express").Response;
4
+ export type NextFunction = import("express").NextFunction;
5
+ export type Pool = import("oracledb").Pool;
6
+ export type environmentType = import("./types.js").environmentType;
7
+ export type configType = import("./types.js").configType;
@@ -0,0 +1,2 @@
1
+ export function installShutdown(handler: () => Promise<void>): void;
2
+ export function forceShutdown(): void;
@@ -0,0 +1 @@
1
+ export function streamToBuffer(readable: stream.Readable): Promise<Buffer>;
@@ -0,0 +1,5 @@
1
+ export function inspect(value: unknown, depth?: number | null): string;
2
+ export function logToFile(text: string): void;
3
+ export function inspectRequest(req: express.Request, simple?: boolean): string;
4
+ export function getBlock(title: string, body: string): string;
5
+ export function getTimestamp(): string;
package/types/tty.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export function write(text: string): void;
2
+ export function writeNewLine(text?: string): void;
3
+ export function writeAfterEraseLine(text: string): void;
4
+ export function writeStartingOnColumn(text: string, column: number): void;