web_plsql 1.0.0 → 1.3.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.
- package/README.md +108 -13
- package/dist/chunk-DQk6qfdC.mjs +18 -0
- package/dist/frontend/assets/main-0oxRTIkL.js +147 -0
- package/dist/frontend/assets/main-0oxRTIkL.js.br +0 -0
- package/dist/frontend/assets/main-0oxRTIkL.js.gz +0 -0
- package/dist/frontend/assets/main-TYgLak6O.css +1 -0
- package/dist/frontend/assets/main-TYgLak6O.css.br +0 -0
- package/dist/frontend/assets/main-TYgLak6O.css.gz +0 -0
- package/dist/frontend/index.html +516 -0
- package/dist/frontend/index.html.br +0 -0
- package/dist/frontend/index.html.gz +0 -0
- package/dist/index.d.mts +646 -0
- package/dist/index.mjs +3548 -0
- package/dist/index.mjs.map +1 -0
- package/dist/oracledb-mock-Dn8aHtd7.mjs +68 -0
- package/dist/oracledb-mock-Dn8aHtd7.mjs.map +1 -0
- package/examples/config-apex.js +1 -1
- package/examples/config-docker.js +1 -2
- package/package.json +45 -32
- package/examples/config-native.js +0 -68
- package/src/admin/client/charts.ts +0 -299
- package/src/admin/client/main.js +0 -3
- package/src/admin/client/tailwind.css +0 -41
- package/src/admin/index.html +0 -315
- package/src/admin/js/api.ts +0 -95
- package/src/admin/js/app.ts +0 -306
- package/src/admin/js/eslint.config.js +0 -74
- package/src/admin/js/schemas.ts +0 -153
- package/src/admin/js/templates/config.ts +0 -146
- package/src/admin/js/templates/errorRow.ts +0 -18
- package/src/admin/js/templates/index.ts +0 -3
- package/src/admin/js/templates/poolCard.ts +0 -61
- package/src/admin/js/tsconfig.json +0 -24
- package/src/admin/js/types.ts +0 -223
- package/src/admin/js/ui/theme.ts +0 -93
- package/src/admin/js/ui/views.ts +0 -164
- package/src/admin/js/util/format.ts +0 -27
- package/src/admin/lib/assets/main-zpdhQ1gD.css +0 -1
- package/src/admin/lib/chart.bundle.js +0 -139
- package/src/admin/style.css +0 -1321
- package/src/bin/load-test.js +0 -202
- package/src/handler/handlerAdmin.js +0 -198
- package/src/handler/handlerLogger.js +0 -21
- package/src/handler/handlerMetrics.js +0 -68
- package/src/handler/handlerUpload.js +0 -26
- package/src/handler/plsql/cgi.js +0 -131
- package/src/handler/plsql/errorPage.js +0 -117
- package/src/handler/plsql/handlerPlSql.js +0 -90
- package/src/handler/plsql/parsePage.js +0 -213
- package/src/handler/plsql/procedure.js +0 -356
- package/src/handler/plsql/procedureError.js +0 -40
- package/src/handler/plsql/procedureNamed.js +0 -268
- package/src/handler/plsql/procedureSanitize.js +0 -262
- package/src/handler/plsql/procedureVariable.js +0 -54
- package/src/handler/plsql/request.js +0 -124
- package/src/handler/plsql/requestError.js +0 -23
- package/src/handler/plsql/sendResponse.js +0 -136
- package/src/handler/plsql/stream.js +0 -28
- package/src/handler/plsql/upload.js +0 -109
- package/src/index.js +0 -20
- package/src/server/config.js +0 -57
- package/src/server/connections.js +0 -40
- package/src/server/server.js +0 -289
- package/src/types.js +0 -150
- package/src/util/cache.js +0 -123
- package/src/util/errorToString.js +0 -24
- package/src/util/file.js +0 -91
- package/src/util/html.js +0 -53
- package/src/util/jsonLogger.js +0 -47
- package/src/util/oracle.js +0 -80
- package/src/util/shutdown.js +0 -44
- package/src/util/trace.js +0 -325
- package/src/util/type.js +0 -6
- package/src/util/util.js +0 -66
- package/src/version.js +0 -5
- package/types/handler/handlerAdmin.d.ts +0 -9
- package/types/handler/handlerLogger.d.ts +0 -2
- package/types/handler/handlerMetrics.d.ts +0 -25
- package/types/handler/handlerUpload.d.ts +0 -7
- package/types/handler/plsql/cgi.d.ts +0 -4
- package/types/handler/plsql/errorPage.d.ts +0 -11
- package/types/handler/plsql/handlerPlSql.d.ts +0 -13
- package/types/handler/plsql/parsePage.d.ts +0 -3
- package/types/handler/plsql/procedure.d.ts +0 -12
- package/types/handler/plsql/procedureError.d.ts +0 -23
- package/types/handler/plsql/procedureNamed.d.ts +0 -14
- package/types/handler/plsql/procedureSanitize.d.ts +0 -11
- package/types/handler/plsql/procedureVariable.d.ts +0 -10
- package/types/handler/plsql/request.d.ts +0 -9
- package/types/handler/plsql/requestError.d.ts +0 -8
- package/types/handler/plsql/sendResponse.d.ts +0 -6
- package/types/handler/plsql/upload.d.ts +0 -5
- package/types/index.d.ts +0 -11
- package/types/server/config.d.ts +0 -2
- package/types/server/server.d.ts +0 -74
- package/types/types.d.ts +0 -328
- package/types/util/cache.d.ts +0 -69
- package/types/util/errorToString.d.ts +0 -1
- package/types/util/file.d.ts +0 -6
- package/types/util/html.d.ts +0 -3
- package/types/util/jsonLogger.d.ts +0 -45
- package/types/util/oracle.d.ts +0 -5
- package/types/util/shutdown.d.ts +0 -2
- package/types/util/trace.d.ts +0 -22
- package/types/util/type.d.ts +0 -1
- package/types/util/util.d.ts +0 -3
- package/types/version.d.ts +0 -1
- /package/{src/admin/favicon.svg → dist/frontend/assets/favicon-mQAM4tVu.svg} +0 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import z$1, { z } from "zod";
|
|
2
|
+
import oracledb, { BindParameter, BindParameters, BindParameters as BindParameters$1, Connection, Connection as Connection$1, DbType, ExecuteOptions, Lob, Pool, Pool as Pool$1, Result, Result as Result$1 } from "oracledb";
|
|
3
|
+
import http from "node:http";
|
|
4
|
+
import https from "node:https";
|
|
5
|
+
import { Express, RequestHandler, Router } from "express";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
|
|
8
|
+
//#region src/backend/util/cache.d.ts
|
|
9
|
+
type cacheEntryType<T> = {
|
|
10
|
+
hitCount: number;
|
|
11
|
+
value: T;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Generic Cache class with LFU (Least Frequently Used) eviction policy.
|
|
15
|
+
*/
|
|
16
|
+
declare class Cache<T> {
|
|
17
|
+
cache: Map<string, cacheEntryType<T>>;
|
|
18
|
+
maxSize: number;
|
|
19
|
+
hits: number;
|
|
20
|
+
misses: number;
|
|
21
|
+
/**
|
|
22
|
+
* @param maxSize - Maximum number of entries in the cache.
|
|
23
|
+
*/
|
|
24
|
+
constructor(maxSize?: number);
|
|
25
|
+
/**
|
|
26
|
+
* Get an entry from the cache.
|
|
27
|
+
* @param key - The key.
|
|
28
|
+
* @returns The value or undefined if not found.
|
|
29
|
+
*/
|
|
30
|
+
get(key: string): T | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Set an entry in the cache.
|
|
33
|
+
* @param key - The key.
|
|
34
|
+
* @param value - The value.
|
|
35
|
+
*/
|
|
36
|
+
set(key: string, value: T): void;
|
|
37
|
+
/**
|
|
38
|
+
* Delete an entry from the cache.
|
|
39
|
+
* @param key - The key.
|
|
40
|
+
*/
|
|
41
|
+
delete(key: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Clear the cache.
|
|
44
|
+
*/
|
|
45
|
+
clear(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Prune the cache by removing the least frequently used entries.
|
|
48
|
+
* Removes 10% of the cache size.
|
|
49
|
+
*/
|
|
50
|
+
prune(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get the size of the cache.
|
|
53
|
+
* @returns The size.
|
|
54
|
+
*/
|
|
55
|
+
get size(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Get all keys in the cache.
|
|
58
|
+
* @returns The keys.
|
|
59
|
+
*/
|
|
60
|
+
keys(): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Get cache statistics.
|
|
63
|
+
* @returns The statistics.
|
|
64
|
+
*/
|
|
65
|
+
getStats(): {
|
|
66
|
+
size: number;
|
|
67
|
+
maxSize: number;
|
|
68
|
+
hits: number;
|
|
69
|
+
misses: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/backend/types.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Custom callback signature for manual transaction handling
|
|
76
|
+
*/
|
|
77
|
+
type transactionCallbackType = (connection: Connection, procedure: string) => void | Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Defines how transactions are handled after procedure execution
|
|
80
|
+
* 'commit': automatically commit
|
|
81
|
+
* 'rollback': automatically rollback
|
|
82
|
+
* callback: custom function for manual handling
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* Authentication callback signature.
|
|
86
|
+
* Returns the identity string on success, or null on failure.
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
type AuthCallback = (connectionPool: Pool, credentials: {
|
|
90
|
+
username: string;
|
|
91
|
+
password?: string | undefined;
|
|
92
|
+
}) => Promise<string | null>;
|
|
93
|
+
/**
|
|
94
|
+
* PL/SQL handler behavior configuration
|
|
95
|
+
*/
|
|
96
|
+
declare const z$configPlSqlHandlerType: z$1.ZodObject<{
|
|
97
|
+
/** Default procedure to execute if none specified */defaultPage: z$1.ZodString; /** Virtual path alias for procedures */
|
|
98
|
+
pathAlias: z$1.ZodOptional<z$1.ZodString>; /** Procedure name associated with the path alias */
|
|
99
|
+
pathAliasProcedure: z$1.ZodOptional<z$1.ZodString>; /** Database table used for file uploads/downloads */
|
|
100
|
+
documentTable: z$1.ZodString; /** List of pattern/procedure names excluded from execution */
|
|
101
|
+
exclusionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>; /** PL/SQL function called to validate requests */
|
|
102
|
+
requestValidationFunction: z$1.ZodOptional<z$1.ZodString>; /** Post-execution transaction behavior */
|
|
103
|
+
transactionMode: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodCustom<transactionCallbackType, transactionCallbackType>, z$1.ZodLiteral<"commit">, z$1.ZodLiteral<"rollback">, z$1.ZodUndefined, z$1.ZodNull]>>; /** Error reporting style */
|
|
104
|
+
errorStyle: z$1.ZodEnum<{
|
|
105
|
+
basic: "basic";
|
|
106
|
+
debug: "debug";
|
|
107
|
+
}>; /** Static CGI environment variables to be passed to the session */
|
|
108
|
+
cgi: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>; /** Authentication settings */
|
|
109
|
+
auth: z$1.ZodOptional<z$1.ZodObject<{
|
|
110
|
+
/** Authentication type */type: z$1.ZodLiteral<"basic">; /** Callback function to validate credentials */
|
|
111
|
+
callback: z$1.ZodCustom<AuthCallback, AuthCallback>; /** Authentication realm */
|
|
112
|
+
realm: z$1.ZodOptional<z$1.ZodString>;
|
|
113
|
+
}, z$1.core.$strict>>;
|
|
114
|
+
}, z$1.core.$strict>;
|
|
115
|
+
type configPlSqlHandlerType = z$1.infer<typeof z$configPlSqlHandlerType>;
|
|
116
|
+
/**
|
|
117
|
+
* Database connection configuration for a PL/SQL route
|
|
118
|
+
*/
|
|
119
|
+
declare const z$configPlSqlConfigType: z$1.ZodObject<{
|
|
120
|
+
/** URL route prefix for this database connection */route: z$1.ZodString; /** Database username */
|
|
121
|
+
user: z$1.ZodString; /** Database password */
|
|
122
|
+
password: z$1.ZodString; /** Oracle connection string (TNS or EZConnect) */
|
|
123
|
+
connectString: z$1.ZodString;
|
|
124
|
+
}, z$1.core.$strict>;
|
|
125
|
+
type configPlSqlConfigType = z$1.infer<typeof z$configPlSqlConfigType>;
|
|
126
|
+
/**
|
|
127
|
+
* Complete PL/SQL route configuration combining handler and connection settings
|
|
128
|
+
*/
|
|
129
|
+
type configPlSqlType = configPlSqlHandlerType & configPlSqlConfigType;
|
|
130
|
+
/**
|
|
131
|
+
* Root application configuration
|
|
132
|
+
*/
|
|
133
|
+
declare const z$configType: z$1.ZodObject<{
|
|
134
|
+
/** Server listening port */port: z$1.ZodNumber; /** Array of static file routes */
|
|
135
|
+
routeStatic: z$1.ZodArray<z$1.ZodObject<{
|
|
136
|
+
route: z$1.ZodString;
|
|
137
|
+
directoryPath: z$1.ZodString;
|
|
138
|
+
spaFallback: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
139
|
+
}, z$1.core.$strict>>; /** Array of PL/SQL routes */
|
|
140
|
+
routePlSql: z$1.ZodArray<z$1.ZodObject<{
|
|
141
|
+
/** URL route prefix for this database connection */route: z$1.ZodString; /** Database username */
|
|
142
|
+
user: z$1.ZodString; /** Database password */
|
|
143
|
+
password: z$1.ZodString; /** Oracle connection string (TNS or EZConnect) */
|
|
144
|
+
connectString: z$1.ZodString; /** Default procedure to execute if none specified */
|
|
145
|
+
defaultPage: z$1.ZodString; /** Virtual path alias for procedures */
|
|
146
|
+
pathAlias: z$1.ZodOptional<z$1.ZodString>; /** Procedure name associated with the path alias */
|
|
147
|
+
pathAliasProcedure: z$1.ZodOptional<z$1.ZodString>; /** Database table used for file uploads/downloads */
|
|
148
|
+
documentTable: z$1.ZodString; /** List of pattern/procedure names excluded from execution */
|
|
149
|
+
exclusionList: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>; /** PL/SQL function called to validate requests */
|
|
150
|
+
requestValidationFunction: z$1.ZodOptional<z$1.ZodString>; /** Post-execution transaction behavior */
|
|
151
|
+
transactionMode: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodCustom<transactionCallbackType, transactionCallbackType>, z$1.ZodLiteral<"commit">, z$1.ZodLiteral<"rollback">, z$1.ZodUndefined, z$1.ZodNull]>>; /** Error reporting style */
|
|
152
|
+
errorStyle: z$1.ZodEnum<{
|
|
153
|
+
basic: "basic";
|
|
154
|
+
debug: "debug";
|
|
155
|
+
}>; /** Static CGI environment variables to be passed to the session */
|
|
156
|
+
cgi: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>; /** Authentication settings */
|
|
157
|
+
auth: z$1.ZodOptional<z$1.ZodObject<{
|
|
158
|
+
/** Authentication type */type: z$1.ZodLiteral<"basic">; /** Callback function to validate credentials */
|
|
159
|
+
callback: z$1.ZodCustom<AuthCallback, AuthCallback>; /** Authentication realm */
|
|
160
|
+
realm: z$1.ZodOptional<z$1.ZodString>;
|
|
161
|
+
}, z$1.core.$strict>>;
|
|
162
|
+
}, z$1.core.$strict>>; /** Maximum allowed size for file uploads (bytes) */
|
|
163
|
+
uploadFileSizeLimit: z$1.ZodOptional<z$1.ZodNumber>; /** Path to the log file */
|
|
164
|
+
loggerFilename: z$1.ZodString; /** URL route prefix for the admin console */
|
|
165
|
+
adminRoute: z$1.ZodOptional<z$1.ZodString>; /** Username for admin console authentication */
|
|
166
|
+
adminUser: z$1.ZodOptional<z$1.ZodString>; /** Password for admin console authentication */
|
|
167
|
+
adminPassword: z$1.ZodOptional<z$1.ZodString>; /** Developer mode (skips frontend build check, enables CORS) */
|
|
168
|
+
devMode: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
169
|
+
}, z$1.core.$strict>;
|
|
170
|
+
type configType = z$1.infer<typeof z$configType>;
|
|
171
|
+
/**
|
|
172
|
+
* Mapping of PL/SQL procedure argument names to their database types
|
|
173
|
+
*/
|
|
174
|
+
type argsType = Record<string, string>;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/backend/util/oracledb-mock.d.ts
|
|
177
|
+
type ExecuteCallback = (sql: string, binds?: BindParameters) => Promise<Result<unknown>> | Result<unknown>;
|
|
178
|
+
/**
|
|
179
|
+
* Test utility: Set the callback for execute calls.
|
|
180
|
+
* @param cb - The callback
|
|
181
|
+
*/
|
|
182
|
+
declare const setExecuteCallback: (cb: ExecuteCallback | null) => void;
|
|
183
|
+
declare namespace oracledb_provider_d_exports {
|
|
184
|
+
export { BIND_IN, BIND_INOUT, BIND_OUT, BLOB, BUFFER, BindParameter, BindParameters$1 as BindParameters, CLOB, CURSOR, Connection$1 as Connection, DATE, DB_TYPE_CLOB, DB_TYPE_DATE, DB_TYPE_NUMBER, DB_TYPE_VARCHAR, DbType, ExecuteCallback, ExecuteOptions, Lob, NUMBER, Pool$1 as Pool, Result$1 as Result, STRING, createPool, setExecuteCallback };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Create a database pool.
|
|
188
|
+
* @param config - The pool attributes.
|
|
189
|
+
* @returns The pool.
|
|
190
|
+
*/
|
|
191
|
+
declare function createPool(config: oracledb.PoolAttributes): Promise<oracledb.Pool>;
|
|
192
|
+
declare const BIND_IN: number;
|
|
193
|
+
declare const BIND_OUT: number;
|
|
194
|
+
declare const BIND_INOUT: number;
|
|
195
|
+
declare const STRING: oracledb.DbType & {
|
|
196
|
+
num: 2001;
|
|
197
|
+
name: "DB_TYPE_VARCHAR";
|
|
198
|
+
columnTypeName: "VARCHAR2";
|
|
199
|
+
oraTypeNum: 1;
|
|
200
|
+
bufferSizeFactor: 4;
|
|
201
|
+
csfrm: oracledb.CSFRM_IMPLICIT;
|
|
202
|
+
};
|
|
203
|
+
declare const NUMBER: oracledb.DbType & {
|
|
204
|
+
num: 2010;
|
|
205
|
+
name: "DB_TYPE_NUMBER";
|
|
206
|
+
columnTypeName: "NUMBER";
|
|
207
|
+
oraTypeNum: 2;
|
|
208
|
+
bufferSizeFactor: 22;
|
|
209
|
+
};
|
|
210
|
+
declare const DATE: oracledb.DbType & {
|
|
211
|
+
num: 2012;
|
|
212
|
+
name: "DB_TYPE_TIMESTAMP";
|
|
213
|
+
columnTypeName: "TIMESTAMP";
|
|
214
|
+
oraTypeNum: 180;
|
|
215
|
+
bufferSizeFactor: 11;
|
|
216
|
+
};
|
|
217
|
+
declare const CURSOR: oracledb.DbType & {
|
|
218
|
+
num: 2021;
|
|
219
|
+
name: "DB_TYPE_CURSOR";
|
|
220
|
+
columnTypeName: "CURSOR";
|
|
221
|
+
oraTypeNum: 102;
|
|
222
|
+
bufferSizeFactor: 4;
|
|
223
|
+
};
|
|
224
|
+
declare const BUFFER: oracledb.DbType & {
|
|
225
|
+
num: 2006;
|
|
226
|
+
name: "DB_TYPE_RAW";
|
|
227
|
+
columnTypeName: "RAW";
|
|
228
|
+
oraTypeNum: 23;
|
|
229
|
+
bufferSizeFactor: 1;
|
|
230
|
+
};
|
|
231
|
+
declare const CLOB: oracledb.DbType & {
|
|
232
|
+
num: 2017;
|
|
233
|
+
name: "DB_TYPE_CLOB";
|
|
234
|
+
columnTypeName: "CLOB";
|
|
235
|
+
oraTypeNum: 112;
|
|
236
|
+
bufferSizeFactor: 112;
|
|
237
|
+
csfrm: oracledb.CSFRM_IMPLICIT;
|
|
238
|
+
};
|
|
239
|
+
declare const BLOB: oracledb.DbType & {
|
|
240
|
+
num: 2019;
|
|
241
|
+
name: "DB_TYPE_BLOB";
|
|
242
|
+
columnTypeName: "BLOB";
|
|
243
|
+
oraTypeNum: 113;
|
|
244
|
+
bufferSizeFactor: 112;
|
|
245
|
+
};
|
|
246
|
+
declare const DB_TYPE_VARCHAR: oracledb.DbType & {
|
|
247
|
+
num: 2001;
|
|
248
|
+
name: "DB_TYPE_VARCHAR";
|
|
249
|
+
columnTypeName: "VARCHAR2";
|
|
250
|
+
oraTypeNum: 1;
|
|
251
|
+
bufferSizeFactor: 4;
|
|
252
|
+
csfrm: oracledb.CSFRM_IMPLICIT;
|
|
253
|
+
};
|
|
254
|
+
declare const DB_TYPE_CLOB: oracledb.DbType & {
|
|
255
|
+
num: 2017;
|
|
256
|
+
name: "DB_TYPE_CLOB";
|
|
257
|
+
columnTypeName: "CLOB";
|
|
258
|
+
oraTypeNum: 112;
|
|
259
|
+
bufferSizeFactor: 112;
|
|
260
|
+
csfrm: oracledb.CSFRM_IMPLICIT;
|
|
261
|
+
};
|
|
262
|
+
declare const DB_TYPE_NUMBER: oracledb.DbType & {
|
|
263
|
+
num: 2010;
|
|
264
|
+
name: "DB_TYPE_NUMBER";
|
|
265
|
+
columnTypeName: "NUMBER";
|
|
266
|
+
oraTypeNum: 2;
|
|
267
|
+
bufferSizeFactor: 22;
|
|
268
|
+
};
|
|
269
|
+
declare const DB_TYPE_DATE: oracledb.DbType & {
|
|
270
|
+
num: 2011;
|
|
271
|
+
name: "DB_TYPE_DATE";
|
|
272
|
+
columnTypeName: "DATE";
|
|
273
|
+
oraTypeNum: 12;
|
|
274
|
+
bufferSizeFactor: 7;
|
|
275
|
+
};
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/backend/version.d.ts
|
|
278
|
+
declare global {
|
|
279
|
+
var __VERSION__: string;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Returns the current library version
|
|
283
|
+
* @returns {string} - Version.
|
|
284
|
+
*/
|
|
285
|
+
declare const getVersion: () => string;
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/backend/server/config.d.ts
|
|
288
|
+
/**
|
|
289
|
+
* Show configuration.
|
|
290
|
+
* @param config - The config.
|
|
291
|
+
*/
|
|
292
|
+
declare const showConfig: (config: configType) => void;
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/backend/server/server.d.ts
|
|
295
|
+
type webServer = {
|
|
296
|
+
config: configType;
|
|
297
|
+
connectionPools: Pool[];
|
|
298
|
+
app: Express;
|
|
299
|
+
server: http.Server | https.Server;
|
|
300
|
+
adminContext: AdminContext;
|
|
301
|
+
shutdown: () => Promise<void>;
|
|
302
|
+
};
|
|
303
|
+
type sslConfig = {
|
|
304
|
+
keyFilename: string;
|
|
305
|
+
certFilename: string;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Create HTTPS server.
|
|
309
|
+
* @param app - express application
|
|
310
|
+
* @param ssl - ssl configuration.
|
|
311
|
+
* @returns server
|
|
312
|
+
*/
|
|
313
|
+
declare const createServer: (app: Express, ssl?: sslConfig) => http.Server | https.Server;
|
|
314
|
+
/**
|
|
315
|
+
* Start server.
|
|
316
|
+
* @param config - The config.
|
|
317
|
+
* @param ssl - ssl configuration.
|
|
318
|
+
* @returns Promise resolving to the web server object.
|
|
319
|
+
*/
|
|
320
|
+
declare const startServer: (config: configType, ssl?: sslConfig) => Promise<webServer>;
|
|
321
|
+
/**
|
|
322
|
+
* Load configuration.
|
|
323
|
+
* @param filename - The configuration filename.
|
|
324
|
+
* @returns Promise.
|
|
325
|
+
*/
|
|
326
|
+
declare const loadConfig: (filename?: string) => configType;
|
|
327
|
+
/**
|
|
328
|
+
* Start server from config file.
|
|
329
|
+
* @param filename - The configuration filename.
|
|
330
|
+
* @param ssl - ssl configuration.
|
|
331
|
+
* @returns Promise resolving to the web server object.
|
|
332
|
+
*/
|
|
333
|
+
declare const startServerConfig: (filename?: string, ssl?: sslConfig) => Promise<webServer>;
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/backend/util/shutdown.d.ts
|
|
336
|
+
/**
|
|
337
|
+
* Install a shutdown handler.
|
|
338
|
+
* @param handler - Shutdown handler
|
|
339
|
+
*/
|
|
340
|
+
declare const installShutdown: (handler: () => Promise<void>) => void;
|
|
341
|
+
/**
|
|
342
|
+
* Force a shutdown.
|
|
343
|
+
*/
|
|
344
|
+
declare const forceShutdown: () => void;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/backend/util/statsManager.d.ts
|
|
347
|
+
type StatsConfig = {
|
|
348
|
+
intervalMs: number;
|
|
349
|
+
maxHistoryPoints: number;
|
|
350
|
+
sampleSystem: boolean;
|
|
351
|
+
samplePools: boolean;
|
|
352
|
+
percentilePrecision: number;
|
|
353
|
+
};
|
|
354
|
+
type CacheStats = {
|
|
355
|
+
size: number;
|
|
356
|
+
hits: number;
|
|
357
|
+
misses: number;
|
|
358
|
+
};
|
|
359
|
+
type PoolCacheSnapshot = {
|
|
360
|
+
procedureName: CacheStats;
|
|
361
|
+
argument: CacheStats;
|
|
362
|
+
};
|
|
363
|
+
type PoolSnapshot = {
|
|
364
|
+
name: string;
|
|
365
|
+
connectionsInUse: number;
|
|
366
|
+
connectionsOpen: number;
|
|
367
|
+
cache?: PoolCacheSnapshot;
|
|
368
|
+
};
|
|
369
|
+
type Bucket = {
|
|
370
|
+
timestamp: number;
|
|
371
|
+
requests: number;
|
|
372
|
+
errors: number;
|
|
373
|
+
durationMin: number;
|
|
374
|
+
durationMax: number;
|
|
375
|
+
durationAvg: number;
|
|
376
|
+
durationP95: number;
|
|
377
|
+
durationP99: number;
|
|
378
|
+
system: {
|
|
379
|
+
cpu: number;
|
|
380
|
+
heapUsed: number;
|
|
381
|
+
heapTotal: number;
|
|
382
|
+
rss: number;
|
|
383
|
+
external: number;
|
|
384
|
+
};
|
|
385
|
+
pools: PoolSnapshot[];
|
|
386
|
+
};
|
|
387
|
+
type CurrentBucket = {
|
|
388
|
+
count: number;
|
|
389
|
+
errors: number;
|
|
390
|
+
durationSum: number;
|
|
391
|
+
durationMin: number;
|
|
392
|
+
durationMax: number;
|
|
393
|
+
durations: number[];
|
|
394
|
+
};
|
|
395
|
+
type MemoryLifetime = {
|
|
396
|
+
heapUsedMax: number;
|
|
397
|
+
heapTotalMax: number;
|
|
398
|
+
rssMax: number;
|
|
399
|
+
externalMax: number;
|
|
400
|
+
};
|
|
401
|
+
type LifetimeStats = {
|
|
402
|
+
totalRequests: number;
|
|
403
|
+
totalErrors: number;
|
|
404
|
+
minDuration: number;
|
|
405
|
+
maxDuration: number;
|
|
406
|
+
totalDuration: number;
|
|
407
|
+
maxRequestsPerSecond: number;
|
|
408
|
+
memory: MemoryLifetime;
|
|
409
|
+
cpu: {
|
|
410
|
+
max: number;
|
|
411
|
+
userMax: number;
|
|
412
|
+
systemMax: number;
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
type StatsSummary = {
|
|
416
|
+
startTime: Date;
|
|
417
|
+
totalRequests: number;
|
|
418
|
+
totalErrors: number;
|
|
419
|
+
avgResponseTime: number;
|
|
420
|
+
minResponseTime: number;
|
|
421
|
+
maxResponseTime: number;
|
|
422
|
+
maxRequestsPerSecond: number;
|
|
423
|
+
maxMemory: MemoryLifetime;
|
|
424
|
+
cpu: {
|
|
425
|
+
max: number;
|
|
426
|
+
userMax: number;
|
|
427
|
+
systemMax: number;
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* Manager for statistical data collection and temporal bucketing.
|
|
432
|
+
*/
|
|
433
|
+
declare class StatsManager {
|
|
434
|
+
config: StatsConfig;
|
|
435
|
+
startTime: Date;
|
|
436
|
+
history: Bucket[];
|
|
437
|
+
lifetime: LifetimeStats;
|
|
438
|
+
_currentBucket: CurrentBucket;
|
|
439
|
+
_lastCpuTimes: {
|
|
440
|
+
user: number;
|
|
441
|
+
nice: number;
|
|
442
|
+
sys: number;
|
|
443
|
+
idle: number;
|
|
444
|
+
irq: number;
|
|
445
|
+
total: number;
|
|
446
|
+
};
|
|
447
|
+
_timer: NodeJS.Timeout | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* @param config - Configuration.
|
|
450
|
+
*/
|
|
451
|
+
constructor(config?: Partial<StatsConfig>);
|
|
452
|
+
/**
|
|
453
|
+
* Reset the current bucket accumulator.
|
|
454
|
+
*/
|
|
455
|
+
private _resetBucket;
|
|
456
|
+
/**
|
|
457
|
+
* Record a request event.
|
|
458
|
+
* @param duration - Duration in milliseconds.
|
|
459
|
+
* @param isError - Whether the request was an error.
|
|
460
|
+
*/
|
|
461
|
+
recordRequest(duration: number, isError?: boolean): void;
|
|
462
|
+
/**
|
|
463
|
+
* Get system CPU times.
|
|
464
|
+
* @returns System CPU times.
|
|
465
|
+
*/
|
|
466
|
+
private _getSystemCpuTimes;
|
|
467
|
+
/**
|
|
468
|
+
* Calculate CPU usage percentage since last call.
|
|
469
|
+
* @returns CPU usage percentage (0-100).
|
|
470
|
+
*/
|
|
471
|
+
private _calculateCpuUsage;
|
|
472
|
+
/**
|
|
473
|
+
* Rotate the current bucket into history and start a new one.
|
|
474
|
+
* @param poolSnapshots - Optional pool snapshots to include.
|
|
475
|
+
*/
|
|
476
|
+
rotateBucket(poolSnapshots?: PoolSnapshot[]): void;
|
|
477
|
+
/**
|
|
478
|
+
* Stop the background timer.
|
|
479
|
+
*/
|
|
480
|
+
stop(): void;
|
|
481
|
+
/**
|
|
482
|
+
* Get lifetime summary.
|
|
483
|
+
* @returns Summary.
|
|
484
|
+
*/
|
|
485
|
+
getSummary(): StatsSummary;
|
|
486
|
+
/**
|
|
487
|
+
* Get history buffer.
|
|
488
|
+
* @returns The history buffer.
|
|
489
|
+
*/
|
|
490
|
+
getHistory(): Bucket[];
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/backend/server/adminContext.d.ts
|
|
494
|
+
type PoolCacheEntry = {
|
|
495
|
+
poolName: string;
|
|
496
|
+
procedureNameCache: Cache<string>;
|
|
497
|
+
argumentCache: Cache<argsType>;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Admin Context Class
|
|
501
|
+
*/
|
|
502
|
+
declare class AdminContext {
|
|
503
|
+
readonly startTime: Date;
|
|
504
|
+
readonly config: configType;
|
|
505
|
+
readonly pools: Pool[];
|
|
506
|
+
readonly caches: PoolCacheEntry[];
|
|
507
|
+
readonly statsManager: StatsManager;
|
|
508
|
+
private _paused;
|
|
509
|
+
constructor(config: configType);
|
|
510
|
+
/**
|
|
511
|
+
* Register a PL/SQL handler with the admin context.
|
|
512
|
+
* @param route - The route for the handler.
|
|
513
|
+
* @param pool - The connection pool.
|
|
514
|
+
* @param procedureNameCache - The procedure name cache.
|
|
515
|
+
* @param argumentCache - The argument cache.
|
|
516
|
+
*/
|
|
517
|
+
registerHandler(route: string, pool: Pool, procedureNameCache: Cache<string>, argumentCache: Cache<argsType>): void;
|
|
518
|
+
get paused(): boolean;
|
|
519
|
+
setPaused(value: boolean): void;
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region src/backend/handler/plsql/handlerPlSql.d.ts
|
|
523
|
+
type WebPlSqlRequestHandler = RequestHandler & {
|
|
524
|
+
procedureNameCache: Cache<string>;
|
|
525
|
+
argumentCache: Cache<argsType>;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Express middleware.
|
|
529
|
+
*
|
|
530
|
+
* @param connectionPool - The connection pool.
|
|
531
|
+
* @param config - The configuration options.
|
|
532
|
+
* @param adminContext - Optional admin context for self-registration and stats tracking.
|
|
533
|
+
* @returns The handler.
|
|
534
|
+
*/
|
|
535
|
+
declare const handlerWebPlSql: (connectionPool: Pool, config: configPlSqlType, adminContext?: AdminContext) => WebPlSqlRequestHandler & {
|
|
536
|
+
procedureNameCache: Cache<string>;
|
|
537
|
+
argumentCache: Cache<argsType>;
|
|
538
|
+
};
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region src/backend/handler/handlerLogger.d.ts
|
|
541
|
+
/**
|
|
542
|
+
* Create the upload middleware.
|
|
543
|
+
* @param filename - Output filename.
|
|
544
|
+
* @returns Request handler.
|
|
545
|
+
*/
|
|
546
|
+
declare const handlerLogger: (filename: string) => RequestHandler;
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/backend/handler/handlerUpload.d.ts
|
|
549
|
+
/**
|
|
550
|
+
* Create the upload middleware.
|
|
551
|
+
* @param uploadFileSizeLimit - Maximum size of each uploaded file in bytes or no limit if omitted.
|
|
552
|
+
* @returns Request handler.
|
|
553
|
+
*/
|
|
554
|
+
declare const handlerUpload: (uploadFileSizeLimit?: number) => RequestHandler;
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region src/backend/handler/handlerAdmin.d.ts
|
|
557
|
+
/**
|
|
558
|
+
* Create admin API router
|
|
559
|
+
* @param adminContext - The admin context
|
|
560
|
+
* @returns Express router
|
|
561
|
+
*/
|
|
562
|
+
declare const createAdminRouter: (adminContext: AdminContext) => Router;
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/backend/handler/handlerAdminConsole.d.ts
|
|
565
|
+
type AdminConsoleConfig = {
|
|
566
|
+
/** Base route for the admin console (defaults to '/admin') */adminRoute?: string | undefined; /** Path to built admin frontend directory (optional - auto-detects if omitted) */
|
|
567
|
+
staticDir?: string | undefined; /** Optional username for basic auth */
|
|
568
|
+
user?: string | undefined; /** Optional password for basic auth */
|
|
569
|
+
password?: string | undefined; /** Skip static dir validation (for dev mode) */
|
|
570
|
+
devMode?: boolean | undefined;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Creates the admin console middleware.
|
|
574
|
+
* @param config - The admin console configuration.
|
|
575
|
+
* @param adminContext - The admin context.
|
|
576
|
+
* @returns The express request handler.
|
|
577
|
+
*/
|
|
578
|
+
declare const handlerAdminConsole: (config: AdminConsoleConfig, adminContext: AdminContext) => RequestHandler;
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/backend/handler/handlerSpaFallback.d.ts
|
|
581
|
+
/**
|
|
582
|
+
* Creates middleware that serves index.html for SPA routes.
|
|
583
|
+
*
|
|
584
|
+
* Handles React Router (createBrowserRouter), Vue Router, Angular Router, etc.
|
|
585
|
+
*
|
|
586
|
+
* **CRITICAL**: This middleware MUST be mounted AFTER express-static-gzip.
|
|
587
|
+
*
|
|
588
|
+
* Middleware order:
|
|
589
|
+
* 1. express-static-gzip → Serves actual files (CSS, JS, images)
|
|
590
|
+
* 2. handlerSpaFallback → Serves index.html for navigation requests
|
|
591
|
+
*
|
|
592
|
+
* @param directoryPath - Path to the static directory containing index.html
|
|
593
|
+
* @param _route - The route prefix (for debugging)
|
|
594
|
+
* @returns Express request handler
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```typescript
|
|
598
|
+
* app.use('/app', expressStaticGzip('./build'));
|
|
599
|
+
* app.use('/app', createSpaFallback('./build', '/app'));
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
declare const createSpaFallback: (directoryPath: string, _route: string) => RequestHandler;
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region src/backend/util/file.d.ts
|
|
605
|
+
/**
|
|
606
|
+
* Read file.
|
|
607
|
+
*
|
|
608
|
+
* @param filePath - File name.
|
|
609
|
+
* @returns The string.
|
|
610
|
+
*/
|
|
611
|
+
declare const readFileSyncUtf8: (filePath: string) => string;
|
|
612
|
+
/**
|
|
613
|
+
* Read file.
|
|
614
|
+
*
|
|
615
|
+
* @param filePath - File name.
|
|
616
|
+
* @returns The buffer.
|
|
617
|
+
*/
|
|
618
|
+
declare const readFile: (filePath: string) => Promise<Buffer>;
|
|
619
|
+
/**
|
|
620
|
+
* Remove file.
|
|
621
|
+
*
|
|
622
|
+
* @param filePath - File name.
|
|
623
|
+
*/
|
|
624
|
+
declare const removeFile: (filePath: string) => Promise<void>;
|
|
625
|
+
/**
|
|
626
|
+
* Load a json file.
|
|
627
|
+
*
|
|
628
|
+
* @param filePath - File name.
|
|
629
|
+
* @returns The json object.
|
|
630
|
+
*/
|
|
631
|
+
declare const getJsonFile: (filePath: string) => unknown;
|
|
632
|
+
/**
|
|
633
|
+
* Is this a directory.
|
|
634
|
+
* @param directoryPath - Directory name.
|
|
635
|
+
* @returns Return true if it is a directory.
|
|
636
|
+
*/
|
|
637
|
+
declare const isDirectory: (directoryPath: unknown) => Promise<boolean>;
|
|
638
|
+
/**
|
|
639
|
+
* Is this a file.
|
|
640
|
+
* @param filePath - File name.
|
|
641
|
+
* @returns Return true if it is a file.
|
|
642
|
+
*/
|
|
643
|
+
declare const isFile: (filePath: unknown) => Promise<boolean>;
|
|
644
|
+
//#endregion
|
|
645
|
+
export { type AdminConsoleConfig, AdminContext, type configPlSqlType, type configType, createAdminRouter, createServer, createSpaFallback, forceShutdown, getJsonFile, getVersion, handlerAdminConsole, handlerLogger, handlerUpload, handlerWebPlSql, installShutdown, isDirectory, isFile, loadConfig, oracledb_provider_d_exports as oracledb, readFile, readFileSyncUtf8, removeFile, showConfig, startServer, startServerConfig, z$configType };
|
|
646
|
+
//# sourceMappingURL=index.d.mts.map
|