@lark-apaas/devtool-kits 1.0.6-alpha.1 → 1.0.6-alpha.3

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/dist/index.js CHANGED
@@ -28683,7 +28683,7 @@ __name(checkServiceHealth, "checkServiceHealth");
28683
28683
  function createHealthCheckRouter(options = {}) {
28684
28684
  const { targetPort = Number(process.env.SERVER_PORT) || 3e3, targetHost = "localhost", timeout = 2e3 } = options;
28685
28685
  const router = import_express.default.Router();
28686
- router.get("/", async (_req, res) => {
28686
+ router.get("/check", async (_req, res) => {
28687
28687
  try {
28688
28688
  const result = await checkServiceHealth(targetHost, targetPort, timeout);
28689
28689
  if (result.available) {
@@ -28718,7 +28718,7 @@ __name(createHealthCheckRouter, "createHealthCheckRouter");
28718
28718
  var HEALTH_CHECK_ROUTES = [
28719
28719
  {
28720
28720
  method: "GET",
28721
- path: "/",
28721
+ path: "/check",
28722
28722
  description: "Check if target service is healthy and available"
28723
28723
  }
28724
28724
  ];
@@ -28986,9 +28986,6 @@ function createOpenapiRouter(options, context) {
28986
28986
  const router = import_express2.default.Router();
28987
28987
  const handler = createOpenapiHandler(openapiFilePath, enableEnhancement, serverDir);
28988
28988
  router.get("/openapi.json", (req, res) => handler(req, res, context));
28989
- router.use((_req, _res, next) => {
28990
- next();
28991
- });
28992
28989
  return router;
28993
28990
  }
28994
28991
  __name(createOpenapiRouter, "createOpenapiRouter");
@@ -29005,7 +29002,7 @@ function createOpenapiMiddleware(options) {
29005
29002
  const { openapiFilePath, enableEnhancement = true, serverDir } = options;
29006
29003
  return {
29007
29004
  name: "openapi",
29008
- mountPath: "/dev",
29005
+ mountPath: "/dev/openapi.json",
29009
29006
  routes: OPENAPI_ROUTES,
29010
29007
  enabled: /* @__PURE__ */ __name((context) => context.isDev, "enabled"),
29011
29008
  createRouter: /* @__PURE__ */ __name((context) => {
@@ -29672,7 +29669,18 @@ async function registerRouteMiddleware(server, middleware, context) {
29672
29669
  }
29673
29670
  const router = middleware.createRouter(context);
29674
29671
  const fullMountPath = computeMountPath(context.basePath, middleware.mountPath);
29675
- server.use(fullMountPath, router);
29672
+ const wrappedRouter = /* @__PURE__ */ __name((req, res, next) => {
29673
+ console.log(`[Middleware] ${middleware.name} received request: ${req.method} ${req.url}`);
29674
+ router(req, res, (err) => {
29675
+ if (err) {
29676
+ console.log(`[Middleware] ${middleware.name} error:`, err);
29677
+ } else {
29678
+ console.log(`[Middleware] ${middleware.name} called next()`);
29679
+ }
29680
+ next(err);
29681
+ });
29682
+ }, "wrappedRouter");
29683
+ server.use(fullMountPath, wrappedRouter);
29676
29684
  logMiddlewareRegistration(middleware, fullMountPath);
29677
29685
  }
29678
29686
  __name(registerRouteMiddleware, "registerRouteMiddleware");