@lark-apaas/devtool-kits 1.0.9 → 1.0.10
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 +27 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28744,6 +28744,25 @@ async function buildSourceMap(controllerFiles, processFile) {
|
|
|
28744
28744
|
return sourceMap;
|
|
28745
28745
|
}
|
|
28746
28746
|
__name(buildSourceMap, "buildSourceMap");
|
|
28747
|
+
function findSourceInfo(operationId, sourceMap) {
|
|
28748
|
+
const directMatch = sourceMap.get(operationId);
|
|
28749
|
+
if (directMatch) {
|
|
28750
|
+
return directMatch;
|
|
28751
|
+
}
|
|
28752
|
+
for (const [key, value] of sourceMap.entries()) {
|
|
28753
|
+
const [className, methodName] = key.split("_");
|
|
28754
|
+
if (!className || !methodName) continue;
|
|
28755
|
+
const camelCaseId = className.charAt(0).toLowerCase() + className.slice(1) + methodName.charAt(0).toUpperCase() + methodName.slice(1);
|
|
28756
|
+
if (operationId === camelCaseId) {
|
|
28757
|
+
return value;
|
|
28758
|
+
}
|
|
28759
|
+
if (operationId === methodName) {
|
|
28760
|
+
return value;
|
|
28761
|
+
}
|
|
28762
|
+
}
|
|
28763
|
+
return void 0;
|
|
28764
|
+
}
|
|
28765
|
+
__name(findSourceInfo, "findSourceInfo");
|
|
28747
28766
|
function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
28748
28767
|
let enhancedCount = 0;
|
|
28749
28768
|
if (!openapi.paths) {
|
|
@@ -28753,7 +28772,7 @@ function enhanceOpenApiPaths(openapi, sourceMap) {
|
|
|
28753
28772
|
if (!pathItem || typeof pathItem !== "object") continue;
|
|
28754
28773
|
for (const operation of Object.values(pathItem)) {
|
|
28755
28774
|
if (operation && typeof operation === "object" && "operationId" in operation) {
|
|
28756
|
-
const sourceInfo =
|
|
28775
|
+
const sourceInfo = findSourceInfo(operation.operationId, sourceMap);
|
|
28757
28776
|
if (sourceInfo) {
|
|
28758
28777
|
operation["x-source"] = {
|
|
28759
28778
|
file: sourceInfo.file,
|
|
@@ -28825,6 +28844,7 @@ __name(processControllerFile, "processControllerFile");
|
|
|
28825
28844
|
function extractControllerMetadata(sourceFile, filePath) {
|
|
28826
28845
|
const metadata = /* @__PURE__ */ new Map();
|
|
28827
28846
|
let controllerPath = "";
|
|
28847
|
+
let className = "";
|
|
28828
28848
|
function getDecorators(node) {
|
|
28829
28849
|
if ("modifiers" in node && Array.isArray(node.modifiers)) {
|
|
28830
28850
|
return node.modifiers.filter((mod) => mod.kind === import_typescript.default.SyntaxKind.Decorator);
|
|
@@ -28838,6 +28858,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28838
28858
|
function visit(node) {
|
|
28839
28859
|
if (import_typescript.default.isClassDeclaration(node)) {
|
|
28840
28860
|
const decorators = getDecorators(node);
|
|
28861
|
+
if (node.name) {
|
|
28862
|
+
className = node.name.getText(sourceFile);
|
|
28863
|
+
}
|
|
28841
28864
|
for (const decorator of decorators) {
|
|
28842
28865
|
if (import_typescript.default.isCallExpression(decorator.expression)) {
|
|
28843
28866
|
const expression = decorator.expression;
|
|
@@ -28882,8 +28905,9 @@ function extractControllerMetadata(sourceFile, filePath) {
|
|
|
28882
28905
|
}
|
|
28883
28906
|
}
|
|
28884
28907
|
}
|
|
28885
|
-
if (httpMethod && methodName) {
|
|
28886
|
-
|
|
28908
|
+
if (httpMethod && methodName && className) {
|
|
28909
|
+
const operationId = `${className}_${methodName}`;
|
|
28910
|
+
metadata.set(operationId, {
|
|
28887
28911
|
file: filePath,
|
|
28888
28912
|
line: line + 1,
|
|
28889
28913
|
method: httpMethod,
|