@lark-apaas/devtool-kits 0.1.0-alpha.3 → 0.1.0-alpha.6

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.cjs CHANGED
@@ -28714,7 +28714,7 @@ function matchesPathPattern(actualPath, pattern) {
28714
28714
  const regex = pathPatternToRegex(normalizedPattern);
28715
28715
  return regex.test(normalizedActual);
28716
28716
  }
28717
- return normalizedActual.startsWith(normalizedPattern + "/") || normalizedActual === normalizedPattern;
28717
+ return false;
28718
28718
  }
28719
28719
  __name(matchesPathPattern, "matchesPathPattern");
28720
28720
  function hasSpecialPatterns(pattern) {
@@ -28802,6 +28802,13 @@ function matchesPath(actualPath, pattern) {
28802
28802
  return matchesPathPattern(actualPath, pattern);
28803
28803
  }
28804
28804
  __name(matchesPath, "matchesPath");
28805
+ function matchesMethod(actualMethod, expectedMethod) {
28806
+ if (!actualMethod || !expectedMethod) {
28807
+ return false;
28808
+ }
28809
+ return actualMethod.toUpperCase() === expectedMethod.toUpperCase();
28810
+ }
28811
+ __name(matchesMethod, "matchesMethod");
28805
28812
  function serializeError(error) {
28806
28813
  return error instanceof Error ? {
28807
28814
  name: error.name,
@@ -28845,7 +28852,7 @@ async function readLogEntriesByTrace(filePath, traceId, limit) {
28845
28852
  return matches;
28846
28853
  }
28847
28854
  __name(readLogEntriesByTrace, "readLogEntriesByTrace");
28848
- async function readRecentTraceCalls(filePath, page, pageSize, pathFilter) {
28855
+ async function readRecentTraceCalls(filePath, page, pageSize, pathFilter, methodFilter) {
28849
28856
  if (!await fileExists(filePath)) {
28850
28857
  return void 0;
28851
28858
  }
@@ -28882,7 +28889,9 @@ async function readRecentTraceCalls(filePath, page, pageSize, pathFilter) {
28882
28889
  if (!builder.path && entry.path) {
28883
28890
  builder.path = String(entry.path);
28884
28891
  }
28885
- const shouldInclude = !pathFilter || matchesPath(builder.path, pathFilter);
28892
+ const pathMatches = !pathFilter || matchesPath(builder.path, pathFilter);
28893
+ const methodMatches = !methodFilter || matchesMethod(builder.method, methodFilter);
28894
+ const shouldInclude = pathMatches && methodMatches;
28886
28895
  if (shouldInclude) {
28887
28896
  completedCalls.push(builder);
28888
28897
  }
@@ -29072,8 +29081,9 @@ function createGetRecentTracesHandler(logDir) {
29072
29081
  const page = parsePositiveInt(req.query.page, 1);
29073
29082
  const pageSize = parseLimit(req.query.pageSize, 10, 100);
29074
29083
  const pathFilter = typeof req.query.path === "string" ? req.query.path.trim() : void 0;
29084
+ const methodFilter = typeof req.query.method === "string" ? req.query.method.trim().toUpperCase() : void 0;
29075
29085
  try {
29076
- const result = await readRecentTraceCalls(traceLogPath, page, pageSize, pathFilter);
29086
+ const result = await readRecentTraceCalls(traceLogPath, page, pageSize, pathFilter, methodFilter);
29077
29087
  if (!result) {
29078
29088
  return handleNotFound(res, traceLogPath);
29079
29089
  }
@@ -29081,6 +29091,7 @@ function createGetRecentTracesHandler(logDir) {
29081
29091
  file: getRelativePath(traceLogPath),
29082
29092
  ...result,
29083
29093
  path: pathFilter || null,
29094
+ method: methodFilter || null,
29084
29095
  count: result.calls.length
29085
29096
  });
29086
29097
  } catch (error) {
@@ -29137,7 +29148,7 @@ var DEV_LOGS_ROUTES = [
29137
29148
  {
29138
29149
  method: "GET",
29139
29150
  path: "/trace/recent",
29140
- description: "Get recent trace calls with pagination and optional path filter"
29151
+ description: "Get recent trace calls with pagination and optional path/method filters"
29141
29152
  },
29142
29153
  {
29143
29154
  method: "GET",