@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 +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28703,7 +28703,7 @@ function matchesPathPattern(actualPath, pattern) {
|
|
|
28703
28703
|
const regex = pathPatternToRegex(normalizedPattern);
|
|
28704
28704
|
return regex.test(normalizedActual);
|
|
28705
28705
|
}
|
|
28706
|
-
return
|
|
28706
|
+
return false;
|
|
28707
28707
|
}
|
|
28708
28708
|
__name(matchesPathPattern, "matchesPathPattern");
|
|
28709
28709
|
function hasSpecialPatterns(pattern) {
|
|
@@ -28791,6 +28791,13 @@ function matchesPath(actualPath, pattern) {
|
|
|
28791
28791
|
return matchesPathPattern(actualPath, pattern);
|
|
28792
28792
|
}
|
|
28793
28793
|
__name(matchesPath, "matchesPath");
|
|
28794
|
+
function matchesMethod(actualMethod, expectedMethod) {
|
|
28795
|
+
if (!actualMethod || !expectedMethod) {
|
|
28796
|
+
return false;
|
|
28797
|
+
}
|
|
28798
|
+
return actualMethod.toUpperCase() === expectedMethod.toUpperCase();
|
|
28799
|
+
}
|
|
28800
|
+
__name(matchesMethod, "matchesMethod");
|
|
28794
28801
|
function serializeError(error) {
|
|
28795
28802
|
return error instanceof Error ? {
|
|
28796
28803
|
name: error.name,
|
|
@@ -28834,7 +28841,7 @@ async function readLogEntriesByTrace(filePath, traceId, limit) {
|
|
|
28834
28841
|
return matches;
|
|
28835
28842
|
}
|
|
28836
28843
|
__name(readLogEntriesByTrace, "readLogEntriesByTrace");
|
|
28837
|
-
async function readRecentTraceCalls(filePath, page, pageSize, pathFilter) {
|
|
28844
|
+
async function readRecentTraceCalls(filePath, page, pageSize, pathFilter, methodFilter) {
|
|
28838
28845
|
if (!await fileExists(filePath)) {
|
|
28839
28846
|
return void 0;
|
|
28840
28847
|
}
|
|
@@ -28871,7 +28878,9 @@ async function readRecentTraceCalls(filePath, page, pageSize, pathFilter) {
|
|
|
28871
28878
|
if (!builder.path && entry.path) {
|
|
28872
28879
|
builder.path = String(entry.path);
|
|
28873
28880
|
}
|
|
28874
|
-
const
|
|
28881
|
+
const pathMatches = !pathFilter || matchesPath(builder.path, pathFilter);
|
|
28882
|
+
const methodMatches = !methodFilter || matchesMethod(builder.method, methodFilter);
|
|
28883
|
+
const shouldInclude = pathMatches && methodMatches;
|
|
28875
28884
|
if (shouldInclude) {
|
|
28876
28885
|
completedCalls.push(builder);
|
|
28877
28886
|
}
|
|
@@ -29061,8 +29070,9 @@ function createGetRecentTracesHandler(logDir) {
|
|
|
29061
29070
|
const page = parsePositiveInt(req.query.page, 1);
|
|
29062
29071
|
const pageSize = parseLimit(req.query.pageSize, 10, 100);
|
|
29063
29072
|
const pathFilter = typeof req.query.path === "string" ? req.query.path.trim() : void 0;
|
|
29073
|
+
const methodFilter = typeof req.query.method === "string" ? req.query.method.trim().toUpperCase() : void 0;
|
|
29064
29074
|
try {
|
|
29065
|
-
const result = await readRecentTraceCalls(traceLogPath, page, pageSize, pathFilter);
|
|
29075
|
+
const result = await readRecentTraceCalls(traceLogPath, page, pageSize, pathFilter, methodFilter);
|
|
29066
29076
|
if (!result) {
|
|
29067
29077
|
return handleNotFound(res, traceLogPath);
|
|
29068
29078
|
}
|
|
@@ -29070,6 +29080,7 @@ function createGetRecentTracesHandler(logDir) {
|
|
|
29070
29080
|
file: getRelativePath(traceLogPath),
|
|
29071
29081
|
...result,
|
|
29072
29082
|
path: pathFilter || null,
|
|
29083
|
+
method: methodFilter || null,
|
|
29073
29084
|
count: result.calls.length
|
|
29074
29085
|
});
|
|
29075
29086
|
} catch (error) {
|
|
@@ -29126,7 +29137,7 @@ var DEV_LOGS_ROUTES = [
|
|
|
29126
29137
|
{
|
|
29127
29138
|
method: "GET",
|
|
29128
29139
|
path: "/trace/recent",
|
|
29129
|
-
description: "Get recent trace calls with pagination and optional path
|
|
29140
|
+
description: "Get recent trace calls with pagination and optional path/method filters"
|
|
29130
29141
|
},
|
|
29131
29142
|
{
|
|
29132
29143
|
method: "GET",
|