@lark-apaas/devtool-kits 1.2.17-alpha.28 → 1.2.17-alpha.29

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
@@ -1894,10 +1894,8 @@ function parsePinoLog(line, source) {
1894
1894
  statusCode: pinoLog.status_code,
1895
1895
  durationMs: pinoLog.duration_ms,
1896
1896
  ip: pinoLog.ip,
1897
- pageRoute: pinoLog.page_route,
1898
1897
  requestBody: pinoLog.request_body,
1899
- responseBody: pinoLog.response_body,
1900
- queryParams: pinoLog.query_params
1898
+ responseBody: pinoLog.response_body
1901
1899
  },
1902
1900
  tags: [
1903
1901
  source
@@ -2801,10 +2799,8 @@ function parsePinoLog2(line, source) {
2801
2799
  statusCode: pinoLog.status_code,
2802
2800
  durationMs: pinoLog.duration_ms,
2803
2801
  ip: pinoLog.ip,
2804
- pageRoute: pinoLog.page_route,
2805
2802
  requestBody: pinoLog.request_body,
2806
- responseBody: pinoLog.response_body,
2807
- queryParams: pinoLog.query_params
2803
+ responseBody: pinoLog.response_body
2808
2804
  },
2809
2805
  tags: [
2810
2806
  source
@@ -3255,106 +3251,6 @@ function createSSEHandler(logDir, options = {}) {
3255
3251
  }
3256
3252
  __name(createSSEHandler, "createSSEHandler");
3257
3253
 
3258
- // src/middlewares/dev-logs/api-list-handler.ts
3259
- var SERVER_PORT = process.env.SERVER_PORT || "3000";
3260
- function extractModuleFromPath(path7) {
3261
- const segments = path7.split("/").filter(Boolean);
3262
- let startIndex = 0;
3263
- if (segments[0] === "api") {
3264
- startIndex = 1;
3265
- }
3266
- if (segments[startIndex]?.match(/^v\d+$/)) {
3267
- startIndex++;
3268
- }
3269
- const moduleName = segments[startIndex];
3270
- if (!moduleName || moduleName.startsWith(":")) {
3271
- return "default";
3272
- }
3273
- return moduleName;
3274
- }
3275
- __name(extractModuleFromPath, "extractModuleFromPath");
3276
- function generateRouteId(method, path7) {
3277
- const cleanPath = path7.replace(/[/:]/g, "_").replace(/^_+|_+$/g, "");
3278
- return `${method.toLowerCase()}_${cleanPath}`;
3279
- }
3280
- __name(generateRouteId, "generateRouteId");
3281
- function capitalize(str) {
3282
- return str.charAt(0).toUpperCase() + str.slice(1);
3283
- }
3284
- __name(capitalize, "capitalize");
3285
- function groupRoutesByModule(routes) {
3286
- const groupMap = /* @__PURE__ */ new Map();
3287
- routes.forEach((route) => {
3288
- const existing = groupMap.get(route.module) || [];
3289
- existing.push(route);
3290
- groupMap.set(route.module, existing);
3291
- });
3292
- const groups = [];
3293
- groupMap.forEach((apis, moduleName) => {
3294
- groups.push({
3295
- id: moduleName,
3296
- name: capitalize(moduleName),
3297
- apis: apis.sort((a, b) => a.path.localeCompare(b.path))
3298
- });
3299
- });
3300
- return groups.sort((a, b) => a.name.localeCompare(b.name));
3301
- }
3302
- __name(groupRoutesByModule, "groupRoutesByModule");
3303
- async function fetchRoutesFromBackend(basePath) {
3304
- const normalizedBasePath = basePath.replace(/\/+$/, "");
3305
- const url = `http://localhost:${SERVER_PORT}${normalizedBasePath}/api/__framework__/debug`;
3306
- const response = await fetch(url, {
3307
- method: "GET",
3308
- headers: {
3309
- "Accept": "application/json"
3310
- }
3311
- });
3312
- if (!response.ok) {
3313
- throw new Error(`Failed to fetch routes: ${response.status}`);
3314
- }
3315
- const data = await response.json();
3316
- const routeConfig = data["\u8DEF\u7531\u914D\u7F6E"];
3317
- if (!routeConfig || !routeConfig.routes || !Array.isArray(routeConfig.routes)) {
3318
- console.warn("[api-list] Invalid routes data:", routeConfig);
3319
- return [];
3320
- }
3321
- const debugRoutes = routeConfig.routes;
3322
- return debugRoutes.filter((route) => {
3323
- return route.path.includes("/api/") && !route.path.includes("__framework__") && !route.path.includes("__innerapi__") && !route.path.includes("/api/capability");
3324
- }).map((route) => {
3325
- const apiPathMatch = route.path.match(/\/api\/.*/);
3326
- const apiPath = apiPathMatch ? apiPathMatch[0] : route.path;
3327
- const method = route.method || "ALL";
3328
- return {
3329
- id: generateRouteId(method, apiPath),
3330
- path: apiPath,
3331
- method,
3332
- module: extractModuleFromPath(apiPath)
3333
- };
3334
- });
3335
- }
3336
- __name(fetchRoutesFromBackend, "fetchRoutesFromBackend");
3337
- function createApiListHandler() {
3338
- return async (_req, res) => {
3339
- try {
3340
- const basePath = process.env.CLIENT_BASE_PATH || "";
3341
- const routes = await fetchRoutesFromBackend(basePath);
3342
- const groups = groupRoutesByModule(routes);
3343
- res.json({
3344
- groups,
3345
- total: routes.length
3346
- });
3347
- } catch (error) {
3348
- console.error("[api-list] Failed to fetch routes:", error);
3349
- res.status(500).json({
3350
- error: "Failed to fetch routes",
3351
- message: error instanceof Error ? error.message : "Unknown error"
3352
- });
3353
- }
3354
- };
3355
- }
3356
- __name(createApiListHandler, "createApiListHandler");
3357
-
3358
3254
  // src/middlewares/dev-logs/router.ts
3359
3255
  function createDevLogRouter(options = {}) {
3360
3256
  const logDir = resolveLogDir(options.logDir);
@@ -3368,7 +3264,6 @@ function createDevLogRouter(options = {}) {
3368
3264
  router.get("/trace/trigger/:instanceID", createGetTriggerDetailHandler(logDir));
3369
3265
  router.get("/trace/capability/list", createGetCapabilityTraceListHandler(logDir));
3370
3266
  router.get("/health", createHealthCheckHandler());
3371
- router.get("/api-list", createApiListHandler());
3372
3267
  return router;
3373
3268
  }
3374
3269
  __name(createDevLogRouter, "createDevLogRouter");
@@ -3404,11 +3299,6 @@ var DEV_LOGS_ROUTES = [
3404
3299
  method: "GET",
3405
3300
  path: "/trace/trigger/:instanceID",
3406
3301
  description: "Get trigger detail (automation trigger) in trace.log by instanceID"
3407
- },
3408
- {
3409
- method: "GET",
3410
- path: "/api-list",
3411
- description: "Get all API routes grouped by module"
3412
3302
  }
3413
3303
  ];
3414
3304
  function createDevLogsMiddleware(options = {}) {
@@ -3525,11 +3415,21 @@ function handleError2(res, error, message = "Failed to collect logs") {
3525
3415
  __name(handleError2, "handleError");
3526
3416
 
3527
3417
  // src/middlewares/collect-logs/router.ts
3418
+ var DEFAULT_BODY_SIZE_LIMIT = "1mb";
3419
+ function getBodySizeLimit() {
3420
+ return process.env.BODY_SIZE_LIMIT || DEFAULT_BODY_SIZE_LIMIT;
3421
+ }
3422
+ __name(getBodySizeLimit, "getBodySizeLimit");
3528
3423
  function createDevLogRouter2(options = {}) {
3529
3424
  const logDir = resolveLogDir2(options.logDir);
3530
3425
  const router = express3.Router();
3531
- router.post("/collect", express3.json(), collectLogsHandler(logDir, options.fileName || "client.log"));
3532
- router.post("/collect-batch", express3.json(), collectLogsBatchHandler(logDir, options.fileName || "client.log"));
3426
+ const bodyLimit = getBodySizeLimit();
3427
+ router.post("/collect", express3.json({
3428
+ limit: bodyLimit
3429
+ }), collectLogsHandler(logDir, options.fileName || "client.log"));
3430
+ router.post("/collect-batch", express3.json({
3431
+ limit: bodyLimit
3432
+ }), collectLogsBatchHandler(logDir, options.fileName || "client.log"));
3533
3433
  return router;
3534
3434
  }
3535
3435
  __name(createDevLogRouter2, "createDevLogRouter");