web_plsql 1.3.2 → 1.5.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 +102 -166
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/frontend/assets/main-B5q2ur8E.js +147 -0
- package/dist/frontend/assets/main-B5q2ur8E.js.br +0 -0
- package/dist/frontend/assets/main-B5q2ur8E.js.gz +0 -0
- package/dist/frontend/assets/main-CoERzZAr.css +1 -0
- package/dist/frontend/assets/main-CoERzZAr.css.br +0 -0
- package/dist/frontend/assets/main-CoERzZAr.css.gz +0 -0
- package/dist/frontend/index.html +2 -2
- package/dist/frontend/index.html.br +0 -0
- package/dist/frontend/index.html.gz +0 -0
- package/dist/index.d.mts +25 -12
- package/dist/index.mjs +34 -180
- package/dist/index.mjs.map +1 -1
- package/dist/{oracledb-mock-Dn8aHtd7.mjs → oracledb-mock-Cya43xKB.mjs} +3 -4
- package/dist/oracledb-mock-Cya43xKB.mjs.map +1 -0
- package/package.json +45 -48
- package/dist/chunk-DQk6qfdC.mjs +0 -18
- package/dist/frontend/assets/main-D2PlS0b8.js +0 -147
- package/dist/frontend/assets/main-D2PlS0b8.js.br +0 -0
- package/dist/frontend/assets/main-D2PlS0b8.js.gz +0 -0
- package/dist/frontend/assets/main-bU4x_yEW.css +0 -1
- package/dist/frontend/assets/main-bU4x_yEW.css.br +0 -0
- package/dist/frontend/assets/main-bU4x_yEW.css.gz +0 -0
- package/dist/oracledb-mock-Dn8aHtd7.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
2
|
-
import { n as setExecuteCallback } from "./oracledb-mock-
|
|
1
|
+
import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
|
|
2
|
+
import { n as setExecuteCallback } from "./oracledb-mock-Cya43xKB.mjs";
|
|
3
3
|
import z$1, { z } from "zod";
|
|
4
4
|
import oracledb from "oracledb";
|
|
5
5
|
import debugModule from "debug";
|
|
@@ -20,7 +20,6 @@ import path from "node:path";
|
|
|
20
20
|
import morgan from "morgan";
|
|
21
21
|
import multer from "multer";
|
|
22
22
|
import readline from "node:readline";
|
|
23
|
-
|
|
24
23
|
//#region src/common/configStaticSchema.ts
|
|
25
24
|
/**
|
|
26
25
|
* Configuration for serving static files
|
|
@@ -30,7 +29,6 @@ const configStaticSchema = z$1.strictObject({
|
|
|
30
29
|
directoryPath: z$1.string(),
|
|
31
30
|
spaFallback: z$1.boolean().optional()
|
|
32
31
|
});
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
33
|
//#region src/common/procedureTraceEntry.ts
|
|
36
34
|
const procedureTraceEntrySchema = z.strictObject({
|
|
@@ -58,7 +56,6 @@ const procedureTraceEntrySchema = z.strictObject({
|
|
|
58
56
|
cgi: z.record(z.string(), z.string()).optional(),
|
|
59
57
|
error: z.string().optional()
|
|
60
58
|
});
|
|
61
|
-
|
|
62
59
|
//#endregion
|
|
63
60
|
//#region src/common/logEntrySchema.ts
|
|
64
61
|
/**
|
|
@@ -86,7 +83,6 @@ const logEntrySchema = z.strictObject({
|
|
|
86
83
|
environment: z.record(z.string(), z.string()).optional()
|
|
87
84
|
}).optional()
|
|
88
85
|
});
|
|
89
|
-
|
|
90
86
|
//#endregion
|
|
91
87
|
//#region src/backend/types.ts
|
|
92
88
|
/**
|
|
@@ -111,11 +107,14 @@ const transactionModeSchema = z$1.union([
|
|
|
111
107
|
/**
|
|
112
108
|
* Authentication configuration for a PL/SQL route
|
|
113
109
|
*/
|
|
114
|
-
const z$authSchema = z$1.strictObject({
|
|
110
|
+
const z$authSchema = z$1.union([z$1.strictObject({
|
|
115
111
|
type: z$1.literal("basic"),
|
|
116
112
|
callback: z$1.custom((val) => typeof val === "function", { message: "Invalid auth callback" }),
|
|
117
113
|
realm: z$1.string().optional()
|
|
118
|
-
})
|
|
114
|
+
}), z$1.strictObject({
|
|
115
|
+
type: z$1.literal("custom"),
|
|
116
|
+
callback: z$1.custom((val) => typeof val === "function", { message: "Invalid auth callback" })
|
|
117
|
+
})]);
|
|
119
118
|
/**
|
|
120
119
|
* PL/SQL handler behavior configuration
|
|
121
120
|
*/
|
|
@@ -156,9 +155,9 @@ const z$configType = z$1.strictObject({
|
|
|
156
155
|
adminRoute: z$1.string().optional(),
|
|
157
156
|
adminUser: z$1.string().optional(),
|
|
158
157
|
adminPassword: z$1.string().optional(),
|
|
159
|
-
devMode: z$1.boolean().optional()
|
|
158
|
+
devMode: z$1.boolean().optional(),
|
|
159
|
+
setupExtensions: z$1.custom((val) => typeof val === "function", { message: "Invalid setupExtensions callback" }).optional()
|
|
160
160
|
});
|
|
161
|
-
|
|
162
161
|
//#endregion
|
|
163
162
|
//#region src/backend/util/oracledb-provider.ts
|
|
164
163
|
var oracledb_provider_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -186,7 +185,7 @@ const USE_MOCK = process.env.MOCK_ORACLE === "true";
|
|
|
186
185
|
* @returns The pool.
|
|
187
186
|
*/
|
|
188
187
|
async function createPool(config) {
|
|
189
|
-
if (USE_MOCK) return (await import("./oracledb-mock-
|
|
188
|
+
if (USE_MOCK) return (await import("./oracledb-mock-Cya43xKB.mjs").then((n) => n.t)).createPool(config);
|
|
190
189
|
return await oracledb.createPool(config);
|
|
191
190
|
}
|
|
192
191
|
const BIND_IN = oracledb.BIND_IN;
|
|
@@ -203,16 +202,14 @@ const DB_TYPE_VARCHAR = oracledb.DB_TYPE_VARCHAR;
|
|
|
203
202
|
const DB_TYPE_CLOB = oracledb.DB_TYPE_CLOB;
|
|
204
203
|
const DB_TYPE_NUMBER = oracledb.DB_TYPE_NUMBER;
|
|
205
204
|
const DB_TYPE_DATE = oracledb.DB_TYPE_DATE;
|
|
206
|
-
|
|
207
205
|
//#endregion
|
|
208
206
|
//#region src/backend/version.ts
|
|
209
207
|
globalThis.__VERSION__ ??= "**development**";
|
|
210
208
|
/**
|
|
211
209
|
* Returns the current library version
|
|
212
|
-
* @returns
|
|
210
|
+
* @returns Version.
|
|
213
211
|
*/
|
|
214
|
-
const getVersion = () => "1.
|
|
215
|
-
|
|
212
|
+
const getVersion = () => "1.5.0";
|
|
216
213
|
//#endregion
|
|
217
214
|
//#region src/backend/server/config.ts
|
|
218
215
|
const paddedLine = (title, value) => {
|
|
@@ -263,7 +260,6 @@ const showConfig = (config) => {
|
|
|
263
260
|
}
|
|
264
261
|
console.log(LINE);
|
|
265
262
|
};
|
|
266
|
-
|
|
267
263
|
//#endregion
|
|
268
264
|
//#region src/backend/server/server.ts
|
|
269
265
|
const debug$14 = debugModule("webplsql:server");
|
|
@@ -337,6 +333,7 @@ const startServer = async (config, ssl) => {
|
|
|
337
333
|
});
|
|
338
334
|
}
|
|
339
335
|
if (internalConfig.loggerFilename.length > 0) app.use(handlerLogger(internalConfig.loggerFilename));
|
|
336
|
+
if (internalConfig.setupExtensions) await internalConfig.setupExtensions(app, adminContext.pools);
|
|
340
337
|
for (const i of internalConfig.routeStatic) {
|
|
341
338
|
app.use(i.route, expressStaticGzip(i.directoryPath, {
|
|
342
339
|
enableBrotli: true,
|
|
@@ -406,7 +403,6 @@ const loadConfig = (filename = "config.json") => z$configType.parse(getJsonFile(
|
|
|
406
403
|
* @returns Promise resolving to the web server object.
|
|
407
404
|
*/
|
|
408
405
|
const startServerConfig = async (filename = "config.json", ssl) => startServer(loadConfig(filename), ssl);
|
|
409
|
-
|
|
410
406
|
//#endregion
|
|
411
407
|
//#region src/backend/util/shutdown.ts
|
|
412
408
|
const debug$13 = debugModule("webplsql:shutdown");
|
|
@@ -453,7 +449,6 @@ const forceShutdown = () => {
|
|
|
453
449
|
debug$13("forceShutdown");
|
|
454
450
|
process.kill(process.pid, "SIGTERM");
|
|
455
451
|
};
|
|
456
|
-
|
|
457
452
|
//#endregion
|
|
458
453
|
//#region src/common/constants.ts
|
|
459
454
|
/**
|
|
@@ -560,27 +555,6 @@ const OWA_STREAM_CHUNK_SIZE = 1e3;
|
|
|
560
555
|
*/
|
|
561
556
|
const OWA_STREAM_BUFFER_SIZE = 16384;
|
|
562
557
|
/**
|
|
563
|
-
* OWA_RESOLVED_NAME_MAX_LEN = 400
|
|
564
|
-
*
|
|
565
|
-
* Purpose: Maximum string length for resolved Oracle procedure canonical names.
|
|
566
|
-
* Canonical format: SCHEMA.PACKAGE.PROCEDURE or SCHEMA.PROCEDURE.
|
|
567
|
-
*
|
|
568
|
-
* Used By:
|
|
569
|
-
* - resolveProcedureName() function for dbms_utility.name_resolve output
|
|
570
|
-
* - Procedure name resolution SQL at procedureSanitize.js:46-76
|
|
571
|
-
*
|
|
572
|
-
* Related Values:
|
|
573
|
-
* - dbms_utility.name_resolve context = 1 (procedure/function resolution)
|
|
574
|
-
* - Oracle identifier limits: Schema (128) + Package (128) + Procedure (128) + 2 dots = ~386
|
|
575
|
-
* - 400 provides comfortable headroom
|
|
576
|
-
*
|
|
577
|
-
* Implications:
|
|
578
|
-
* - Oracle object names: 30 bytes for most, extended to 128 in some contexts
|
|
579
|
-
* - Canonical name: schema.package.procedure (max ~128+1+128+1+128 = 386)
|
|
580
|
-
* - 400 is safe upper bound with margin
|
|
581
|
-
*/
|
|
582
|
-
const OWA_RESOLVED_NAME_MAX_LEN = 400;
|
|
583
|
-
/**
|
|
584
558
|
* STATS_INTERVAL_MS = 5000
|
|
585
559
|
*
|
|
586
560
|
* Purpose: Duration of each statistical bucket in milliseconds.
|
|
@@ -645,107 +619,6 @@ const MAX_HISTORY_BUCKETS = 1e3;
|
|
|
645
619
|
* - Under heavy load, older samples are discarded (FIFO)
|
|
646
620
|
*/
|
|
647
621
|
const MAX_PERCENTILE_SAMPLES = 1e3;
|
|
648
|
-
/**
|
|
649
|
-
* SHUTDOWN_GRACE_DELAY_MS = 100
|
|
650
|
-
*
|
|
651
|
-
* Purpose: Delay between initiating server shutdown and forced termination.
|
|
652
|
-
*
|
|
653
|
-
* Used By: POST /api/server/stop handler only
|
|
654
|
-
*
|
|
655
|
-
* Related Values:
|
|
656
|
-
* - forceShutdown() at src/util/shutdown.js
|
|
657
|
-
* - SIGTERM/SIGINT handlers at shutdown.js
|
|
658
|
-
*
|
|
659
|
-
* Implications:
|
|
660
|
-
* - Allows graceful completion of in-flight requests
|
|
661
|
-
* - Gives Express middleware time to send final responses
|
|
662
|
-
* - 100ms is short; may be insufficient under heavy load
|
|
663
|
-
* - Consider making configurable for high-traffic deployments
|
|
664
|
-
*/
|
|
665
|
-
const SHUTDOWN_GRACE_DELAY_MS = 100;
|
|
666
|
-
/**
|
|
667
|
-
* TRACE_LOG_ROTATION_SIZE = '10M'
|
|
668
|
-
*
|
|
669
|
-
* Purpose: Log file size threshold triggering trace log rotation (10 Megabytes).
|
|
670
|
-
*
|
|
671
|
-
* Used By: rotating-file-stream library for 'trace.log'
|
|
672
|
-
*
|
|
673
|
-
* Related Values:
|
|
674
|
-
* - TRACE_LOG_ROTATION_INTERVAL ('1d'): Also triggers rotation
|
|
675
|
-
* - TRACE_LOG_MAX_ROTATED_FILES (10): Maximum retained files
|
|
676
|
-
*
|
|
677
|
-
* Implications:
|
|
678
|
-
* - When either size OR time threshold is reached, rotation occurs
|
|
679
|
-
* - Combined with daily rotation: ~10MB/day minimum
|
|
680
|
-
* - gzip compression reduces rotated file size by ~70-90%
|
|
681
|
-
*/
|
|
682
|
-
const TRACE_LOG_ROTATION_SIZE = "10M";
|
|
683
|
-
/**
|
|
684
|
-
* TRACE_LOG_ROTATION_INTERVAL = '1d'
|
|
685
|
-
*
|
|
686
|
-
* Purpose: Time-based trace log rotation trigger (daily).
|
|
687
|
-
*
|
|
688
|
-
* Used By: rotating-file-stream library for 'trace.log'
|
|
689
|
-
*
|
|
690
|
-
* Implications:
|
|
691
|
-
* - Guarantees at least one rotation per day
|
|
692
|
-
* - Midnight-based or 24h from first write
|
|
693
|
-
*/
|
|
694
|
-
const TRACE_LOG_ROTATION_INTERVAL = "1d";
|
|
695
|
-
/**
|
|
696
|
-
* TRACE_LOG_MAX_ROTATED_FILES = 10
|
|
697
|
-
*
|
|
698
|
-
* Purpose: Maximum number of rotated trace log files to retain.
|
|
699
|
-
*
|
|
700
|
-
* Used By: rotating-file-stream library for 'trace.log'
|
|
701
|
-
*
|
|
702
|
-
* Implications:
|
|
703
|
-
* - When exceeded, oldest rotated file is deleted
|
|
704
|
-
* - Maximum: ~10 files × 10MB = ~100MB (compressed: ~10-30MB)
|
|
705
|
-
*/
|
|
706
|
-
const TRACE_LOG_MAX_ROTATED_FILES = 10;
|
|
707
|
-
/**
|
|
708
|
-
* JSON_LOG_ROTATION_SIZE = '10M'
|
|
709
|
-
*
|
|
710
|
-
* Purpose: Log file size threshold triggering JSON error log rotation (10 Megabytes).
|
|
711
|
-
*
|
|
712
|
-
* Used By: rotating-file-stream library for 'error.json.log'
|
|
713
|
-
*
|
|
714
|
-
* Related Values:
|
|
715
|
-
* - JSON_LOG_ROTATION_INTERVAL ('1d'): Also triggers rotation
|
|
716
|
-
* - JSON_LOG_MAX_ROTATED_FILES (10): Maximum retained files
|
|
717
|
-
*
|
|
718
|
-
* Implications:
|
|
719
|
-
* - When either size OR time threshold is reached, rotation occurs
|
|
720
|
-
* - Combined with daily rotation: ~10MB/day minimum
|
|
721
|
-
* - gzip compression reduces rotated file size by ~70-90%
|
|
722
|
-
*/
|
|
723
|
-
const JSON_LOG_ROTATION_SIZE = "10M";
|
|
724
|
-
/**
|
|
725
|
-
* JSON_LOG_ROTATION_INTERVAL = '1d'
|
|
726
|
-
*
|
|
727
|
-
* Purpose: Time-based JSON error log rotation trigger (daily).
|
|
728
|
-
*
|
|
729
|
-
* Used By: rotating-file-stream library for 'error.json.log'
|
|
730
|
-
*
|
|
731
|
-
* Implications:
|
|
732
|
-
* - Guarantees at least one rotation per day
|
|
733
|
-
* - Midnight-based or 24h from first write
|
|
734
|
-
*/
|
|
735
|
-
const JSON_LOG_ROTATION_INTERVAL = "1d";
|
|
736
|
-
/**
|
|
737
|
-
* JSON_LOG_MAX_ROTATED_FILES = 10
|
|
738
|
-
*
|
|
739
|
-
* Purpose: Maximum number of rotated JSON error log files to retain.
|
|
740
|
-
*
|
|
741
|
-
* Used By: rotating-file-stream library for 'error.json.log'
|
|
742
|
-
*
|
|
743
|
-
* Implications:
|
|
744
|
-
* - When exceeded, oldest rotated file is deleted
|
|
745
|
-
* - Maximum: ~10 files × 10MB = ~100MB (compressed: ~10-30MB)
|
|
746
|
-
*/
|
|
747
|
-
const JSON_LOG_MAX_ROTATED_FILES = 10;
|
|
748
|
-
|
|
749
622
|
//#endregion
|
|
750
623
|
//#region src/backend/util/statsManager.ts
|
|
751
624
|
const debug$12 = debugModule("webplsql:statsManager");
|
|
@@ -977,7 +850,6 @@ var StatsManager = class {
|
|
|
977
850
|
return this.history;
|
|
978
851
|
}
|
|
979
852
|
};
|
|
980
|
-
|
|
981
853
|
//#endregion
|
|
982
854
|
//#region src/backend/server/adminContext.ts
|
|
983
855
|
/**
|
|
@@ -1020,7 +892,6 @@ var AdminContext = class {
|
|
|
1020
892
|
this._paused = value;
|
|
1021
893
|
}
|
|
1022
894
|
};
|
|
1023
|
-
|
|
1024
895
|
//#endregion
|
|
1025
896
|
//#region src/backend/util/file.ts
|
|
1026
897
|
/**
|
|
@@ -1097,7 +968,6 @@ const isFile = async (filePath) => {
|
|
|
1097
968
|
return false;
|
|
1098
969
|
}
|
|
1099
970
|
};
|
|
1100
|
-
|
|
1101
971
|
//#endregion
|
|
1102
972
|
//#region src/backend/util/html.ts
|
|
1103
973
|
/**
|
|
@@ -1145,7 +1015,6 @@ ${body}
|
|
|
1145
1015
|
</body>
|
|
1146
1016
|
</html>
|
|
1147
1017
|
`;
|
|
1148
|
-
|
|
1149
1018
|
//#endregion
|
|
1150
1019
|
//#region src/backend/util/trace.ts
|
|
1151
1020
|
/**
|
|
@@ -1219,9 +1088,9 @@ const toTable = (head, body) => {
|
|
|
1219
1088
|
*/
|
|
1220
1089
|
const logToFile = (text) => {
|
|
1221
1090
|
const fs = rotatingFileStream.createStream("trace.log", {
|
|
1222
|
-
size:
|
|
1223
|
-
interval:
|
|
1224
|
-
maxFiles:
|
|
1091
|
+
size: "10M",
|
|
1092
|
+
interval: "1d",
|
|
1093
|
+
maxFiles: 10,
|
|
1225
1094
|
compress: "gzip"
|
|
1226
1095
|
});
|
|
1227
1096
|
fs.write(text);
|
|
@@ -1425,7 +1294,6 @@ const warningMessage = (para) => {
|
|
|
1425
1294
|
logToFile(text);
|
|
1426
1295
|
console.warn(text);
|
|
1427
1296
|
};
|
|
1428
|
-
|
|
1429
1297
|
//#endregion
|
|
1430
1298
|
//#region src/backend/util/errorToString.ts
|
|
1431
1299
|
/**
|
|
@@ -1443,7 +1311,6 @@ const errorToString = (error) => {
|
|
|
1443
1311
|
return parts.join("\n");
|
|
1444
1312
|
} else return inspect(error);
|
|
1445
1313
|
};
|
|
1446
|
-
|
|
1447
1314
|
//#endregion
|
|
1448
1315
|
//#region src/backend/handler/plsql/upload.ts
|
|
1449
1316
|
const debug$11 = debugModule("webplsql:fileUpload");
|
|
@@ -1516,7 +1383,6 @@ const uploadFile = async (file, doctable, databaseConnection) => {
|
|
|
1516
1383
|
throw new Error(`Unable to remove file "${file.filename}".\n${errorToString(err)}`);
|
|
1517
1384
|
}
|
|
1518
1385
|
};
|
|
1519
|
-
|
|
1520
1386
|
//#endregion
|
|
1521
1387
|
//#region src/backend/handler/plsql/procedureVariable.ts
|
|
1522
1388
|
const debug$10 = debugModule("webplsql:procedureVariable");
|
|
@@ -1559,7 +1425,6 @@ const getProcedureVariable = (_req, procName, argObj) => {
|
|
|
1559
1425
|
}
|
|
1560
1426
|
};
|
|
1561
1427
|
};
|
|
1562
|
-
|
|
1563
1428
|
//#endregion
|
|
1564
1429
|
//#region src/backend/handler/plsql/requestError.ts
|
|
1565
1430
|
var RequestError = class RequestError extends Error {
|
|
@@ -1573,7 +1438,6 @@ var RequestError = class RequestError extends Error {
|
|
|
1573
1438
|
this.timestamp = /* @__PURE__ */ new Date();
|
|
1574
1439
|
}
|
|
1575
1440
|
};
|
|
1576
|
-
|
|
1577
1441
|
//#endregion
|
|
1578
1442
|
//#region src/backend/util/util.ts
|
|
1579
1443
|
/**
|
|
@@ -1587,7 +1451,6 @@ const stringToNumber = (value) => {
|
|
|
1587
1451
|
if (typeof value !== "string" || !/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:E[+-]?\d+)?$/i.test(value)) return null;
|
|
1588
1452
|
return Number(value);
|
|
1589
1453
|
};
|
|
1590
|
-
|
|
1591
1454
|
//#endregion
|
|
1592
1455
|
//#region src/backend/handler/plsql/procedureNamed.ts
|
|
1593
1456
|
const debug$9 = debugModule("webplsql:procedureNamed");
|
|
@@ -1818,7 +1681,6 @@ const getProcedureNamed = async (req, procName, argObj, databaseConnection, argu
|
|
|
1818
1681
|
bind: bindings
|
|
1819
1682
|
};
|
|
1820
1683
|
};
|
|
1821
|
-
|
|
1822
1684
|
//#endregion
|
|
1823
1685
|
//#region src/backend/handler/plsql/parsePage.ts
|
|
1824
1686
|
const debug$8 = debugModule("webplsql:parsePage");
|
|
@@ -1951,7 +1813,6 @@ const tryDecodeDate = (value) => {
|
|
|
1951
1813
|
if (Number.isNaN(result.getTime())) return null;
|
|
1952
1814
|
return result;
|
|
1953
1815
|
};
|
|
1954
|
-
|
|
1955
1816
|
//#endregion
|
|
1956
1817
|
//#region src/backend/handler/plsql/sendResponse.ts
|
|
1957
1818
|
const debug$7 = debugModule("webplsql:sendResponse");
|
|
@@ -2057,7 +1918,6 @@ const sendResponse = async (_req, res, page) => {
|
|
|
2057
1918
|
});
|
|
2058
1919
|
else res.send(page.body);
|
|
2059
1920
|
};
|
|
2060
|
-
|
|
2061
1921
|
//#endregion
|
|
2062
1922
|
//#region src/backend/handler/plsql/procedureError.ts
|
|
2063
1923
|
var ProcedureError = class ProcedureError extends Error {
|
|
@@ -2080,7 +1940,6 @@ var ProcedureError = class ProcedureError extends Error {
|
|
|
2080
1940
|
this.bind = bind;
|
|
2081
1941
|
}
|
|
2082
1942
|
};
|
|
2083
|
-
|
|
2084
1943
|
//#endregion
|
|
2085
1944
|
//#region src/backend/util/cache.ts
|
|
2086
1945
|
/**
|
|
@@ -2179,7 +2038,6 @@ var Cache = class {
|
|
|
2179
2038
|
};
|
|
2180
2039
|
}
|
|
2181
2040
|
};
|
|
2182
|
-
|
|
2183
2041
|
//#endregion
|
|
2184
2042
|
//#region src/backend/handler/plsql/procedureSanitize.ts
|
|
2185
2043
|
const debug$6 = debugModule("webplsql:procedureSanitize");
|
|
@@ -2250,7 +2108,7 @@ const resolveProcedureName = async (procName, databaseConnection, procedureNameC
|
|
|
2250
2108
|
resolved: {
|
|
2251
2109
|
dir: BIND_OUT,
|
|
2252
2110
|
type: STRING,
|
|
2253
|
-
maxSize:
|
|
2111
|
+
maxSize: 400
|
|
2254
2112
|
}
|
|
2255
2113
|
};
|
|
2256
2114
|
try {
|
|
@@ -2388,7 +2246,6 @@ const requestValidationFunction = async (procName, validationFunction, databaseC
|
|
|
2388
2246
|
validationFunctionCache.set(key, { valid });
|
|
2389
2247
|
return valid;
|
|
2390
2248
|
};
|
|
2391
|
-
|
|
2392
2249
|
//#endregion
|
|
2393
2250
|
//#region src/backend/handler/plsql/owaPageStream.ts
|
|
2394
2251
|
const debug$5 = debugModule("webplsql:owaPageStream");
|
|
@@ -2458,7 +2315,6 @@ var OWAPageStream = class extends Readable {
|
|
|
2458
2315
|
if (content && content.length > 0) this.push(content);
|
|
2459
2316
|
}
|
|
2460
2317
|
};
|
|
2461
|
-
|
|
2462
2318
|
//#endregion
|
|
2463
2319
|
//#region src/backend/util/traceManager.ts
|
|
2464
2320
|
var TraceManager = class {
|
|
@@ -2511,7 +2367,6 @@ var TraceManager = class {
|
|
|
2511
2367
|
}
|
|
2512
2368
|
};
|
|
2513
2369
|
const traceManager = new TraceManager();
|
|
2514
|
-
|
|
2515
2370
|
//#endregion
|
|
2516
2371
|
//#region src/backend/handler/plsql/procedure.ts
|
|
2517
2372
|
const debug$4 = debugModule("webplsql:procedure");
|
|
@@ -2810,7 +2665,6 @@ const invokeProcedure = async (req, res, argObj, cgiObj, filesToUpload, options,
|
|
|
2810
2665
|
}
|
|
2811
2666
|
debug$4("invokeProcedure: end");
|
|
2812
2667
|
};
|
|
2813
|
-
|
|
2814
2668
|
//#endregion
|
|
2815
2669
|
//#region src/backend/handler/plsql/cgi.ts
|
|
2816
2670
|
const debug$3 = debugModule("webplsql:cgi");
|
|
@@ -2915,7 +2769,6 @@ const getCGI = (req, doctable, cgi, authenticatedUser = null) => {
|
|
|
2915
2769
|
};
|
|
2916
2770
|
return Object.assign({}, DEFAULT_CGI, CGI, cgi);
|
|
2917
2771
|
};
|
|
2918
|
-
|
|
2919
2772
|
//#endregion
|
|
2920
2773
|
//#region src/backend/util/type.ts
|
|
2921
2774
|
/**
|
|
@@ -2924,7 +2777,6 @@ const getCGI = (req, doctable, cgi, authenticatedUser = null) => {
|
|
|
2924
2777
|
* @returns True if the value is a string or an array of strings
|
|
2925
2778
|
*/
|
|
2926
2779
|
const isStringOrArrayOfString = (value) => typeof value === "string" || Array.isArray(value) && value.every((element) => typeof element === "string");
|
|
2927
|
-
|
|
2928
2780
|
//#endregion
|
|
2929
2781
|
//#region src/backend/handler/plsql/request.ts
|
|
2930
2782
|
const debug$2 = debugModule("webplsql:request");
|
|
@@ -3001,16 +2853,15 @@ const processRequest = async (req, res, options, connectionPool, procedureNameCa
|
|
|
3001
2853
|
}
|
|
3002
2854
|
debug$2("processRequest: EXIT");
|
|
3003
2855
|
};
|
|
3004
|
-
|
|
3005
2856
|
//#endregion
|
|
3006
2857
|
//#region src/backend/util/jsonLogger.ts
|
|
3007
2858
|
var JsonLogger = class {
|
|
3008
2859
|
stream;
|
|
3009
2860
|
constructor(filename = "error.json.log") {
|
|
3010
2861
|
this.stream = rotatingFileStream.createStream(filename, {
|
|
3011
|
-
size:
|
|
3012
|
-
interval:
|
|
3013
|
-
maxFiles:
|
|
2862
|
+
size: "10M",
|
|
2863
|
+
interval: "1d",
|
|
2864
|
+
maxFiles: 10,
|
|
3014
2865
|
compress: "gzip"
|
|
3015
2866
|
});
|
|
3016
2867
|
}
|
|
@@ -3035,7 +2886,6 @@ var JsonLogger = class {
|
|
|
3035
2886
|
}
|
|
3036
2887
|
};
|
|
3037
2888
|
const jsonLogger = new JsonLogger();
|
|
3038
|
-
|
|
3039
2889
|
//#endregion
|
|
3040
2890
|
//#region src/backend/handler/plsql/errorPage.ts
|
|
3041
2891
|
/**
|
|
@@ -3102,10 +2952,13 @@ const errorPage = (req, res, options, error) => {
|
|
|
3102
2952
|
}
|
|
3103
2953
|
});
|
|
3104
2954
|
console.error(text);
|
|
2955
|
+
if (res.headersSent) {
|
|
2956
|
+
console.warn("errorPage: Response headers already sent. Cannot show error page.");
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
3105
2959
|
if (options.errorStyle === "basic") res.status(404).send("Page not found");
|
|
3106
2960
|
else res.status(404).send(getHtmlPage(html));
|
|
3107
2961
|
};
|
|
3108
|
-
|
|
3109
2962
|
//#endregion
|
|
3110
2963
|
//#region src/backend/handler/plsql/handlerPlSql.ts
|
|
3111
2964
|
const debug$1 = debugModule("webplsql:handlerPlSql");
|
|
@@ -3125,16 +2978,22 @@ const requestHandler = async (req, res, _next, connectionPool, options, procedur
|
|
|
3125
2978
|
if (options.auth?.type === "basic") {
|
|
3126
2979
|
const b64auth = (req.headers.authorization ?? "").split(" ")[1] ?? "";
|
|
3127
2980
|
const [login, password] = Buffer.from(b64auth, "base64").toString().split(":");
|
|
3128
|
-
if (login) authenticatedUser = await options.auth.callback(
|
|
2981
|
+
if (login) authenticatedUser = await options.auth.callback({
|
|
3129
2982
|
username: login,
|
|
3130
2983
|
password
|
|
3131
|
-
});
|
|
2984
|
+
}, connectionPool);
|
|
3132
2985
|
if (authenticatedUser === null) {
|
|
3133
2986
|
const realm = options.auth.realm ?? "PL/SQL Gateway";
|
|
3134
2987
|
res.set("WWW-Authenticate", `Basic realm="${realm}"`);
|
|
3135
2988
|
res.status(401).send("Authentication required.");
|
|
3136
2989
|
return;
|
|
3137
2990
|
}
|
|
2991
|
+
} else if (options.auth?.type === "custom") {
|
|
2992
|
+
authenticatedUser = await options.auth.callback(req, connectionPool);
|
|
2993
|
+
if (authenticatedUser === null) {
|
|
2994
|
+
res.status(401).send("Authentication required.");
|
|
2995
|
+
return;
|
|
2996
|
+
}
|
|
3138
2997
|
}
|
|
3139
2998
|
if (typeof req.params.name !== "string" || req.params.name.length === 0) if (typeof options.defaultPage === "string" && options.defaultPage.length > 0) {
|
|
3140
2999
|
const newUrl = url.resolve(`${req.originalUrl}/${options.defaultPage}`, "");
|
|
@@ -3171,7 +3030,6 @@ const handlerWebPlSql = (connectionPool, config, adminContext) => {
|
|
|
3171
3030
|
handler.argumentCache = argumentCache;
|
|
3172
3031
|
return handler;
|
|
3173
3032
|
};
|
|
3174
|
-
|
|
3175
3033
|
//#endregion
|
|
3176
3034
|
//#region src/backend/handler/handlerLogger.ts
|
|
3177
3035
|
const debug = debugModule("webplsql:handlerLogger");
|
|
@@ -3184,7 +3042,6 @@ const handlerLogger = (filename) => {
|
|
|
3184
3042
|
debug("register");
|
|
3185
3043
|
return morgan("combined", { stream: fs.createWriteStream(path.join(process.cwd(), filename), { flags: "a" }) });
|
|
3186
3044
|
};
|
|
3187
|
-
|
|
3188
3045
|
//#endregion
|
|
3189
3046
|
//#region src/backend/handler/handlerUpload.ts
|
|
3190
3047
|
/**
|
|
@@ -3198,7 +3055,6 @@ const handlerUpload = (uploadFileSizeLimit) => {
|
|
|
3198
3055
|
limits: { fileSize: uploadFileSizeLimit }
|
|
3199
3056
|
}).any();
|
|
3200
3057
|
};
|
|
3201
|
-
|
|
3202
3058
|
//#endregion
|
|
3203
3059
|
//#region src/backend/handler/handlerAdmin.ts
|
|
3204
3060
|
const version = () => getVersion();
|
|
@@ -3382,7 +3238,7 @@ const createAdminRouter = (adminContext) => {
|
|
|
3382
3238
|
res.json({ message: "Server shutting down..." });
|
|
3383
3239
|
setTimeout(() => {
|
|
3384
3240
|
forceShutdown();
|
|
3385
|
-
},
|
|
3241
|
+
}, 100);
|
|
3386
3242
|
break;
|
|
3387
3243
|
case "pause":
|
|
3388
3244
|
adminContext.setPaused(true);
|
|
@@ -3434,7 +3290,6 @@ const createAdminRouter = (adminContext) => {
|
|
|
3434
3290
|
});
|
|
3435
3291
|
return router;
|
|
3436
3292
|
};
|
|
3437
|
-
|
|
3438
3293
|
//#endregion
|
|
3439
3294
|
//#region src/backend/handler/handlerAdminConsole.ts
|
|
3440
3295
|
/**
|
|
@@ -3534,7 +3389,6 @@ const handlerAdminConsole = (config, adminContext) => {
|
|
|
3534
3389
|
}));
|
|
3535
3390
|
return router;
|
|
3536
3391
|
};
|
|
3537
|
-
|
|
3538
3392
|
//#endregion
|
|
3539
3393
|
//#region src/backend/handler/handlerSpaFallback.ts
|
|
3540
3394
|
/**
|
|
@@ -3569,7 +3423,7 @@ const createSpaFallback = (directoryPath, _route) => {
|
|
|
3569
3423
|
});
|
|
3570
3424
|
};
|
|
3571
3425
|
};
|
|
3572
|
-
|
|
3573
3426
|
//#endregion
|
|
3574
3427
|
export { AdminContext, createAdminRouter, createServer, createSpaFallback, forceShutdown, getJsonFile, getVersion, handlerAdminConsole, handlerLogger, handlerUpload, handlerWebPlSql, installShutdown, isDirectory, isFile, loadConfig, oracledb_provider_exports as oracledb, readFile, readFileSyncUtf8, removeFile, showConfig, startServer, startServerConfig, z$configType };
|
|
3428
|
+
|
|
3575
3429
|
//# sourceMappingURL=index.mjs.map
|