vibe-gx 4.0.0 → 4.1.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 +1 -1
- package/package.json +1 -1
- package/vibe.d.ts +30 -0
- package/vibe.js +1 -1
package/README.md
CHANGED
|
@@ -428,7 +428,7 @@ process.on("SIGTERM", () => dbPool.close());
|
|
|
428
428
|
Use any Express middleware with the adapter:
|
|
429
429
|
|
|
430
430
|
```javascript
|
|
431
|
-
import { adapt } from "vibe-gx
|
|
431
|
+
import vibe, { adapt } from "vibe-gx";
|
|
432
432
|
import cors from "cors";
|
|
433
433
|
import helmet from "helmet";
|
|
434
434
|
import compression from "compression";
|
package/package.json
CHANGED
package/vibe.d.ts
CHANGED
|
@@ -560,3 +560,33 @@ export function parseJsonStream(
|
|
|
560
560
|
onEnd?: () => void,
|
|
561
561
|
onError?: (err: Error) => void,
|
|
562
562
|
): void;
|
|
563
|
+
|
|
564
|
+
// ==========================================
|
|
565
|
+
// Express Middleware Adapter
|
|
566
|
+
// ==========================================
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Adapt an Express-style middleware to work as a Vibe interceptor.
|
|
570
|
+
* @param mw - Express middleware function (req, res, next)
|
|
571
|
+
* @returns Vibe-compatible interceptor
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
* import { adapt } from "vibe-gx";
|
|
575
|
+
* import cors from "cors";
|
|
576
|
+
* import cookieParser from "cookie-parser";
|
|
577
|
+
*
|
|
578
|
+
* app.plugin(adapt(cors()));
|
|
579
|
+
* app.plugin(adapt(cookieParser()));
|
|
580
|
+
*/
|
|
581
|
+
export function adapt(
|
|
582
|
+
mw: (req: any, res: any, next: (err?: any) => void) => void,
|
|
583
|
+
): Interceptor;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Adapt multiple Express middlewares at once.
|
|
587
|
+
* @param middlewares - Express middleware functions
|
|
588
|
+
* @returns Array of Vibe-compatible interceptors
|
|
589
|
+
*/
|
|
590
|
+
export function adaptAll(
|
|
591
|
+
...middlewares: Array<(req: any, res: any, next: (err?: any) => void) => void>
|
|
592
|
+
): Interceptor[];
|