@mostajs/orm 1.3.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 (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -490,6 +490,58 @@ DB_SCHEMA_STRATEGY=update # in .env
490
490
  | `DB_CACHE_ENABLED` | `false` | Query result cache |
491
491
  | `DB_CACHE_TTL` | `300` | Cache TTL in seconds |
492
492
 
493
+ | `MOSTA_BRIDGE_AUTOSTART` | `true` | JDBC bridge auto-start: `true`, `false`, `detect` |
494
+ | `MOSTA_BRIDGE_PORT_BASE` | `8765` | First bridge HTTP port |
495
+ | `MOSTA_BRIDGE_PORT_INCREMENT` | `true` | Auto-increment ports for multiple bridges |
496
+ | `MOSTA_JAR_DIR` | auto-detect | Directory for JDBC JAR files |
497
+ | `MOSTA_BRIDGE_JAVA` | auto-detect | Path to MostaJdbcBridge.java |
498
+ | `MOSTA_BRIDGE_MAX_RETRIES` | `3` | Max bridge start attempts before giving up |
499
+ | `MOSTA_BRIDGE_TIMEOUT` | `15000` | Bridge health check timeout (ms) |
500
+
501
+ ---
502
+
503
+ ## JDBC Bridge & JAR Upload
504
+
505
+ MostaORM includes a universal JDBC bridge for databases without npm drivers (HyperSQL, Oracle, DB2, SAP HANA, Sybase). The bridge is a Java HTTP server (`MostaJdbcBridge.java`) that translates HTTP requests into JDBC calls.
506
+
507
+ ### JAR Management API
508
+
509
+ MostaORM exports functions for managing JDBC driver JARs:
510
+
511
+ ```typescript
512
+ import {
513
+ saveJarFile, // Save an uploaded JAR to jar_files/
514
+ deleteJarFile, // Delete a JAR from jar_files/
515
+ listJarFiles, // List all JARs with dialect detection
516
+ getJdbcDialectStatus, // Status of each JDBC dialect (JAR present?)
517
+ detectDialectFromJar, // Detect dialect from JAR filename
518
+ } from '@mostajs/orm'
519
+ ```
520
+
521
+ ### Next.js Route (via @mostajs/setup)
522
+
523
+ ```typescript
524
+ // src/app/api/setup/upload-jar/route.ts
525
+ import { createUploadJarHandlers } from '@mostajs/setup/api/upload-jar'
526
+
527
+ const { GET, POST, DELETE } = createUploadJarHandlers()
528
+ export { GET, POST, DELETE }
529
+ ```
530
+
531
+ - **GET** — list JARs and JDBC dialect status
532
+ - **POST** — upload a `.jar` file (multipart/form-data, field `jar`)
533
+ - **DELETE** — remove a JAR (`{ "fileName": "hsqldb-2.7.2.jar" }`)
534
+
535
+ ### BridgeManager (multi-bridge)
536
+
537
+ ```typescript
538
+ import { BridgeManager } from '@mostajs/orm'
539
+
540
+ const manager = BridgeManager.getInstance()
541
+ // Bridges are managed automatically by the dialect's connect()
542
+ // Multiple bridges can run simultaneously on incrementing ports
543
+ ```
544
+
493
545
  ---
494
546
 
495
547
  ## Complete Example — Blog API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/orm",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Hibernate-inspired multi-dialect ORM for Node.js/TypeScript — One API, 13 databases, zero lock-in",
5
5
  "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
6
  "license": "MIT",