@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/error.html CHANGED
@@ -160,13 +160,13 @@
160
160
  // 探测服务是否恢复
161
161
  async function probeService() {
162
162
  try {
163
- console.log('[Probe] 探测服务状态: /dev/health');
163
+ console.log('[Probe] 探测服务状态: /dev/health/check');
164
164
 
165
165
  // 使用 AbortController 实现超时控制
166
166
  const controller = new AbortController();
167
167
  const timeoutId = setTimeout(() => controller.abort(), PROBE_TIMEOUT);
168
168
 
169
- const response = await fetch(`${clientBasePath}/dev/health`, {
169
+ const response = await fetch(`${clientBasePath}/dev/health/check`, {
170
170
  method: 'GET',
171
171
  cache: 'no-cache',
172
172
  redirect: 'manual', // 不自动跟随重定向
package/dist/index.cjs CHANGED
@@ -28697,7 +28697,7 @@ __name(checkServiceHealth, "checkServiceHealth");
28697
28697
  function createHealthCheckRouter(options = {}) {
28698
28698
  const { targetPort = Number(process.env.SERVER_PORT) || 3e3, targetHost = "localhost", timeout = 2e3 } = options;
28699
28699
  const router = import_express.default.Router();
28700
- router.get("/", async (_req, res) => {
28700
+ router.get("/check", async (_req, res) => {
28701
28701
  try {
28702
28702
  const result = await checkServiceHealth(targetHost, targetPort, timeout);
28703
28703
  if (result.available) {
@@ -28732,7 +28732,7 @@ __name(createHealthCheckRouter, "createHealthCheckRouter");
28732
28732
  var HEALTH_CHECK_ROUTES = [
28733
28733
  {
28734
28734
  method: "GET",
28735
- path: "/",
28735
+ path: "/check",
28736
28736
  description: "Check if target service is healthy and available"
28737
28737
  }
28738
28738
  ];
@@ -29000,9 +29000,6 @@ function createOpenapiRouter(options, context) {
29000
29000
  const router = import_express2.default.Router();
29001
29001
  const handler = createOpenapiHandler(openapiFilePath, enableEnhancement, serverDir);
29002
29002
  router.get("/openapi.json", (req, res) => handler(req, res, context));
29003
- router.use((_req, _res, next) => {
29004
- next();
29005
- });
29006
29003
  return router;
29007
29004
  }
29008
29005
  __name(createOpenapiRouter, "createOpenapiRouter");
@@ -29019,7 +29016,7 @@ function createOpenapiMiddleware(options) {
29019
29016
  const { openapiFilePath, enableEnhancement = true, serverDir } = options;
29020
29017
  return {
29021
29018
  name: "openapi",
29022
- mountPath: "/dev",
29019
+ mountPath: "/dev/openapi.json",
29023
29020
  routes: OPENAPI_ROUTES,
29024
29021
  enabled: /* @__PURE__ */ __name((context) => context.isDev, "enabled"),
29025
29022
  createRouter: /* @__PURE__ */ __name((context) => {
@@ -29686,7 +29683,18 @@ async function registerRouteMiddleware(server, middleware, context) {
29686
29683
  }
29687
29684
  const router = middleware.createRouter(context);
29688
29685
  const fullMountPath = computeMountPath(context.basePath, middleware.mountPath);
29689
- server.use(fullMountPath, router);
29686
+ const wrappedRouter = /* @__PURE__ */ __name((req, res, next) => {
29687
+ console.log(`[Middleware] ${middleware.name} received request: ${req.method} ${req.url}`);
29688
+ router(req, res, (err) => {
29689
+ if (err) {
29690
+ console.log(`[Middleware] ${middleware.name} error:`, err);
29691
+ } else {
29692
+ console.log(`[Middleware] ${middleware.name} called next()`);
29693
+ }
29694
+ next(err);
29695
+ });
29696
+ }, "wrappedRouter");
29697
+ server.use(fullMountPath, wrappedRouter);
29690
29698
  logMiddlewareRegistration(middleware, fullMountPath);
29691
29699
  }
29692
29700
  __name(registerRouteMiddleware, "registerRouteMiddleware");