web_plsql 1.2.0 → 1.3.1

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 (119) hide show
  1. package/README.md +103 -8
  2. package/dist/chunk-DQk6qfdC.mjs +18 -0
  3. package/dist/frontend/assets/main-C8GKnEhz.js +147 -0
  4. package/dist/frontend/assets/main-C8GKnEhz.js.br +0 -0
  5. package/dist/frontend/assets/main-C8GKnEhz.js.gz +0 -0
  6. package/dist/frontend/assets/main-bU4x_yEW.css +1 -0
  7. package/dist/frontend/assets/main-bU4x_yEW.css.br +0 -0
  8. package/dist/frontend/assets/main-bU4x_yEW.css.gz +0 -0
  9. package/{src/admin → dist/frontend}/index.html +12 -25
  10. package/dist/frontend/index.html.br +0 -0
  11. package/dist/frontend/index.html.gz +0 -0
  12. package/dist/index.d.mts +646 -0
  13. package/dist/index.mjs +3559 -0
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/oracledb-mock-Dn8aHtd7.mjs +68 -0
  16. package/dist/oracledb-mock-Dn8aHtd7.mjs.map +1 -0
  17. package/examples/config-apex.js +1 -1
  18. package/examples/config-docker.js +1 -2
  19. package/package.json +48 -32
  20. package/examples/config-native.js +0 -68
  21. package/src/admin/client/charts.ts +0 -598
  22. package/src/admin/client/main.js +0 -3
  23. package/src/admin/client/tailwind.css +0 -41
  24. package/src/admin/js/api.ts +0 -170
  25. package/src/admin/js/app.ts +0 -614
  26. package/src/admin/js/eslint.config.js +0 -74
  27. package/src/admin/js/schemas.ts +0 -215
  28. package/src/admin/js/templates/config.ts +0 -147
  29. package/src/admin/js/templates/errorRow.ts +0 -21
  30. package/src/admin/js/templates/index.ts +0 -4
  31. package/src/admin/js/templates/poolCard.ts +0 -61
  32. package/src/admin/js/templates/traceRow.ts +0 -24
  33. package/src/admin/js/tsconfig.json +0 -24
  34. package/src/admin/js/types.ts +0 -336
  35. package/src/admin/js/ui/components.ts +0 -44
  36. package/src/admin/js/ui/table.ts +0 -173
  37. package/src/admin/js/ui/theme.ts +0 -93
  38. package/src/admin/js/ui/views.ts +0 -427
  39. package/src/admin/js/util/format.ts +0 -46
  40. package/src/admin/js/util/metrics.ts +0 -24
  41. package/src/admin/lib/chart.bundle.css +0 -1
  42. package/src/admin/lib/chart.bundle.js +0 -146
  43. package/src/admin/style.css +0 -1437
  44. package/src/bin/load-test.js +0 -202
  45. package/src/handler/handlerAdmin.js +0 -293
  46. package/src/handler/handlerLogger.js +0 -21
  47. package/src/handler/handlerUpload.js +0 -26
  48. package/src/handler/plsql/cgi.js +0 -131
  49. package/src/handler/plsql/errorPage.js +0 -113
  50. package/src/handler/plsql/handlerPlSql.js +0 -90
  51. package/src/handler/plsql/owaPageStream.js +0 -93
  52. package/src/handler/plsql/parsePage.js +0 -213
  53. package/src/handler/plsql/procedure.js +0 -426
  54. package/src/handler/plsql/procedureError.js +0 -40
  55. package/src/handler/plsql/procedureNamed.js +0 -282
  56. package/src/handler/plsql/procedureSanitize.js +0 -286
  57. package/src/handler/plsql/procedureVariable.js +0 -56
  58. package/src/handler/plsql/request.js +0 -124
  59. package/src/handler/plsql/requestError.js +0 -23
  60. package/src/handler/plsql/sendResponse.js +0 -174
  61. package/src/handler/plsql/stream.js +0 -28
  62. package/src/handler/plsql/upload.js +0 -109
  63. package/src/index.js +0 -19
  64. package/src/server/adminContext.js +0 -23
  65. package/src/server/config.js +0 -57
  66. package/src/server/connections.js +0 -40
  67. package/src/server/server.js +0 -304
  68. package/src/types.js +0 -150
  69. package/src/util/cache.js +0 -123
  70. package/src/util/errorToString.js +0 -24
  71. package/src/util/file.js +0 -91
  72. package/src/util/html.js +0 -53
  73. package/src/util/jsonLogger.js +0 -47
  74. package/src/util/oracle.js +0 -80
  75. package/src/util/shutdown.js +0 -44
  76. package/src/util/statsManager.js +0 -368
  77. package/src/util/trace.js +0 -326
  78. package/src/util/traceManager.js +0 -68
  79. package/src/util/type.js +0 -6
  80. package/src/util/util.js +0 -66
  81. package/src/version.js +0 -5
  82. package/types/admin/js/schemas.d.ts +0 -384
  83. package/types/admin/js/types.d.ts +0 -312
  84. package/types/handler/handlerAdmin.d.ts +0 -79
  85. package/types/handler/handlerLogger.d.ts +0 -2
  86. package/types/handler/handlerUpload.d.ts +0 -7
  87. package/types/handler/plsql/cgi.d.ts +0 -4
  88. package/types/handler/plsql/errorPage.d.ts +0 -11
  89. package/types/handler/plsql/handlerPlSql.d.ts +0 -13
  90. package/types/handler/plsql/owaPageStream.d.ts +0 -28
  91. package/types/handler/plsql/parsePage.d.ts +0 -3
  92. package/types/handler/plsql/procedure.d.ts +0 -13
  93. package/types/handler/plsql/procedureError.d.ts +0 -23
  94. package/types/handler/plsql/procedureNamed.d.ts +0 -14
  95. package/types/handler/plsql/procedureSanitize.d.ts +0 -11
  96. package/types/handler/plsql/procedureVariable.d.ts +0 -10
  97. package/types/handler/plsql/request.d.ts +0 -9
  98. package/types/handler/plsql/requestError.d.ts +0 -8
  99. package/types/handler/plsql/sendResponse.d.ts +0 -6
  100. package/types/handler/plsql/upload.d.ts +0 -5
  101. package/types/index.d.ts +0 -10
  102. package/types/server/adminContext.d.ts +0 -17
  103. package/types/server/config.d.ts +0 -2
  104. package/types/server/server.d.ts +0 -57
  105. package/types/types.d.ts +0 -328
  106. package/types/util/cache.d.ts +0 -69
  107. package/types/util/errorToString.d.ts +0 -1
  108. package/types/util/file.d.ts +0 -6
  109. package/types/util/html.d.ts +0 -3
  110. package/types/util/jsonLogger.d.ts +0 -45
  111. package/types/util/oracle.d.ts +0 -5
  112. package/types/util/shutdown.d.ts +0 -2
  113. package/types/util/statsManager.d.ts +0 -395
  114. package/types/util/trace.d.ts +0 -22
  115. package/types/util/traceManager.d.ts +0 -35
  116. package/types/util/type.d.ts +0 -1
  117. package/types/util/util.d.ts +0 -3
  118. package/types/version.d.ts +0 -1
  119. /package/{src/admin/favicon.svg → dist/frontend/assets/favicon-mQAM4tVu.svg} +0 -0
package/README.md CHANGED
@@ -59,10 +59,10 @@ Access the console at `http://localhost:<port>/admin` (e.g., `http://localhost:8
59
59
  # Configuration
60
60
 
61
61
  There are 2 options on how to use the web_plsql express middleware:
62
- - Use the predefined `startServer` api in `src/server.js` like in the `examples/config-native.js` example
63
- - Hand craft a new Express server using the `handlerWebPlSql` middleware in `src/handlerPlSql.js`
62
+ - Use the predefined `startServer` api in `dist/backend/index.js` like in the `examples/config-native.js` example
63
+ - Hand craft a new Express server using the `handlerWebPlSql` middleware in `dist/backend/index.js`
64
64
 
65
- ## Use the predefined `startServer`
65
+ ## Use the predefined `startServer` function
66
66
 
67
67
  The `startServer` api uses the following configuration object:
68
68
 
@@ -121,9 +121,104 @@ The `startServer` api uses the following configuration object:
121
121
  */
122
122
  ```
123
123
 
124
- ## Hand craft a new Express server using the `handlerWebPlSql` middleware
124
+ ## Hand Craft Express Server with Composable Middleware
125
125
 
126
- WIP
126
+ web_plsql exports composable middleware components that can be integrated into any Express application.
127
+
128
+ ### Complete Manual Setup
129
+
130
+ For full control over your Express application with PL/SQL routes and admin console:
131
+
132
+ ```typescript
133
+ import express from 'express';
134
+ import path from 'path';
135
+ import {
136
+ handlerWebPlSql,
137
+ handlerAdminConsole,
138
+ AdminContext,
139
+ oracledb,
140
+ type configType,
141
+ type PoolCacheEntry,
142
+ } from 'web_plsql';
143
+
144
+ (async () => {
145
+ const app = express();
146
+
147
+ // 1. Define configuration
148
+ const config: configType = {
149
+ port: 8080,
150
+ routeStatic: [],
151
+ routePlSql: [{
152
+ route: '/myapp',
153
+ user: 'sample',
154
+ password: 'sample',
155
+ connectString: 'localhost:1521/ORCL',
156
+ defaultPage: 'myapp.home',
157
+ documentTable: 'doctable',
158
+ errorStyle: 'debug',
159
+ }],
160
+ uploadFileSizeLimit: 50 * 1024 * 1024,
161
+ loggerFilename: 'access.log',
162
+ };
163
+
164
+ // 2. Create Oracle connection pool
165
+ const pool = await oracledb.createPool({
166
+ user: config.routePlSql[0].user,
167
+ password: config.routePlSql[0].password,
168
+ connectString: config.routePlSql[0].connectString,
169
+ });
170
+
171
+ // 3. Create PL/SQL handler
172
+ const plsqlHandler = handlerWebPlSql(pool, {
173
+ defaultPage: config.routePlSql[0].defaultPage,
174
+ documentTable: config.routePlSql[0].documentTable,
175
+ errorStyle: config.routePlSql[0].errorStyle,
176
+ });
177
+
178
+ // 4. Create AdminContext (required for admin console)
179
+ const caches: PoolCacheEntry[] = [{
180
+ poolName: config.routePlSql[0].route,
181
+ procedureNameCache: plsqlHandler.procedureNameCache,
182
+ argumentCache: plsqlHandler.argumentCache,
183
+ }];
184
+ const adminContext = new AdminContext(config, [pool], caches);
185
+
186
+ // 5. Mount PL/SQL handler with stats tracking
187
+ app.use(config.routePlSql[0].route, (req, res, next) => {
188
+ const start = process.hrtime();
189
+ res.on('finish', () => {
190
+ const [s, ns] = process.hrtime(start);
191
+ adminContext.statsManager.recordRequest(s * 1000 + ns / 1e6, res.statusCode >= 400);
192
+ });
193
+ plsqlHandler(req, res, next);
194
+ });
195
+
196
+ // 6. Mount admin console
197
+ app.use('/admin', handlerAdminConsole({
198
+ staticDir: path.join(__dirname, 'node_modules/web_plsql/dist/frontend'),
199
+ user: 'admin',
200
+ password: 'secret',
201
+ }, adminContext));
202
+
203
+ // 7. Start server
204
+ app.listen(config.port, () => {
205
+ console.log(`Server running on port ${config.port}`);
206
+ });
207
+ })();
208
+ ```
209
+
210
+ ### AdminContext Requirement
211
+
212
+ The admin console requires an `AdminContext` instance to be passed as the second argument to `handlerAdminConsole`.
213
+
214
+ **Using `startServer()` API:** `AdminContext` is managed automatically.
215
+
216
+ **Using custom Express app:** You must instantiate `AdminContext` and pass it to the handler.
217
+
218
+ ```typescript
219
+ const adminContext = new AdminContext(config, pools, caches);
220
+ app.use('/admin', handlerAdminConsole(config, adminContext));
221
+ ```
127
222
 
128
223
  # Compare with mod_plsql
129
224
 
@@ -180,7 +275,7 @@ The following mod_plsql DAD configuration translates to the configuration option
180
275
  }
181
276
  ```
182
277
 
183
- ## Create a custom Express application based on the default server implemented in `src/server.js`.
278
+ ## Create a custom Express application based on the default server implemented in `src/backend/server/server.ts`.
184
279
 
185
280
  ...
186
281
 
@@ -207,8 +302,8 @@ The following mod_plsql DAD configuration translates to the configuration option
207
302
  ## Features that are only available in web_plsql
208
303
  - The option `transactionModeType` specifies an optional transaction mode.
209
304
  "commit" this automatically commits any open transaction after each request. This is the defaults because this is what mod_plsql and ohs are doing.
210
- "rollback" this automatically rolles back any open transaction after each request.
211
- "transactionCallbackType" this allows to defined a custom handler as a JavaScript function.
305
+ "rollback" this automatically rolls back any open transaction after each request.
306
+ "transactionCallbackType" this allows defining a custom handler as a JavaScript function.
212
307
 
213
308
  ## Features that are planned to be available in web_plsql
214
309
  - Support for APEX 5 or greater.
@@ -0,0 +1,18 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!no_symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll as t };