api-tests-coverage 1.0.0
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/README.md +703 -0
- package/config.yaml.example +227 -0
- package/dist/action/src/index.d.ts +2 -0
- package/dist/action/src/index.d.ts.map +1 -0
- package/dist/action/src/index.js +349 -0
- package/dist/action/src/prComment.d.ts +34 -0
- package/dist/action/src/prComment.d.ts.map +1 -0
- package/dist/action/src/prComment.js +146 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts +36 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts.map +1 -0
- package/dist/src/ast/astAnalysisOrchestrator.js +123 -0
- package/dist/src/ast/astTypes.d.ts +105 -0
- package/dist/src/ast/astTypes.d.ts.map +1 -0
- package/dist/src/ast/astTypes.js +9 -0
- package/dist/src/ast/languageAnalyzer.d.ts +46 -0
- package/dist/src/ast/languageAnalyzer.d.ts.map +1 -0
- package/dist/src/ast/languageAnalyzer.js +9 -0
- package/dist/src/ast/languageCapabilities.d.ts +24 -0
- package/dist/src/ast/languageCapabilities.d.ts.map +1 -0
- package/dist/src/ast/languageCapabilities.js +92 -0
- package/dist/src/ast/parseFile.d.ts +16 -0
- package/dist/src/ast/parseFile.d.ts.map +1 -0
- package/dist/src/ast/parseFile.js +65 -0
- package/dist/src/ast/parserRegistry.d.ts +39 -0
- package/dist/src/ast/parserRegistry.d.ts.map +1 -0
- package/dist/src/ast/parserRegistry.js +66 -0
- package/dist/src/buildSummary.d.ts +26 -0
- package/dist/src/buildSummary.d.ts.map +1 -0
- package/dist/src/buildSummary.js +193 -0
- package/dist/src/businessCoverage.d.ts +68 -0
- package/dist/src/businessCoverage.d.ts.map +1 -0
- package/dist/src/businessCoverage.js +290 -0
- package/dist/src/compatibilityCoverage.d.ts +83 -0
- package/dist/src/compatibilityCoverage.d.ts.map +1 -0
- package/dist/src/compatibilityCoverage.js +501 -0
- package/dist/src/config/defaultConfig.d.ts +9 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -0
- package/dist/src/config/defaultConfig.js +97 -0
- package/dist/src/config/index.d.ts +12 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +37 -0
- package/dist/src/config/loadConfig.d.ts +29 -0
- package/dist/src/config/loadConfig.d.ts.map +1 -0
- package/dist/src/config/loadConfig.js +135 -0
- package/dist/src/config/mergeConfig.d.ts +15 -0
- package/dist/src/config/mergeConfig.d.ts.map +1 -0
- package/dist/src/config/mergeConfig.js +57 -0
- package/dist/src/config/schema.d.ts +15 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +30 -0
- package/dist/src/config/types.d.ts +175 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +9 -0
- package/dist/src/config/validateConfig.d.ts +22 -0
- package/dist/src/config/validateConfig.d.ts.map +1 -0
- package/dist/src/config/validateConfig.js +171 -0
- package/dist/src/config.d.ts +168 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +204 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts +67 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/callGraph.js +275 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts +23 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.js +394 -0
- package/dist/src/coverage/deep-analysis/index.d.ts +17 -0
- package/dist/src/coverage/deep-analysis/index.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/index.js +63 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts +60 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.js +121 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts +36 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.js +92 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts +55 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.js +152 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts +70 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.js +152 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts +80 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.js +216 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts +71 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.js +226 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts +58 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/symbolTable.js +230 -0
- package/dist/src/coverage/deep-analysis/types.d.ts +122 -0
- package/dist/src/coverage/deep-analysis/types.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/types.js +21 -0
- package/dist/src/discovery/fileClassifier.d.ts +50 -0
- package/dist/src/discovery/fileClassifier.d.ts.map +1 -0
- package/dist/src/discovery/fileClassifier.js +238 -0
- package/dist/src/discovery/projectDiscovery.d.ts +66 -0
- package/dist/src/discovery/projectDiscovery.d.ts.map +1 -0
- package/dist/src/discovery/projectDiscovery.js +287 -0
- package/dist/src/endpointCoverage.d.ts +70 -0
- package/dist/src/endpointCoverage.d.ts.map +1 -0
- package/dist/src/endpointCoverage.js +381 -0
- package/dist/src/errorCoverage.d.ts +93 -0
- package/dist/src/errorCoverage.d.ts.map +1 -0
- package/dist/src/errorCoverage.js +698 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +1441 -0
- package/dist/src/inference/businessRuleInference.d.ts +63 -0
- package/dist/src/inference/businessRuleInference.d.ts.map +1 -0
- package/dist/src/inference/businessRuleInference.js +268 -0
- package/dist/src/inference/integrationFlowInference.d.ts +56 -0
- package/dist/src/inference/integrationFlowInference.d.ts.map +1 -0
- package/dist/src/inference/integrationFlowInference.js +266 -0
- package/dist/src/integrationCoverage.d.ts +72 -0
- package/dist/src/integrationCoverage.d.ts.map +1 -0
- package/dist/src/integrationCoverage.js +317 -0
- package/dist/src/intelligence/index.d.ts +20 -0
- package/dist/src/intelligence/index.d.ts.map +1 -0
- package/dist/src/intelligence/index.js +105 -0
- package/dist/src/intelligence/linkageEngine.d.ts +20 -0
- package/dist/src/intelligence/linkageEngine.d.ts.map +1 -0
- package/dist/src/intelligence/linkageEngine.js +522 -0
- package/dist/src/intelligence/markdownReporter.d.ts +12 -0
- package/dist/src/intelligence/markdownReporter.d.ts.map +1 -0
- package/dist/src/intelligence/markdownReporter.js +265 -0
- package/dist/src/intelligence/riskScoring.d.ts +53 -0
- package/dist/src/intelligence/riskScoring.d.ts.map +1 -0
- package/dist/src/intelligence/riskScoring.js +181 -0
- package/dist/src/intelligence/types.d.ts +121 -0
- package/dist/src/intelligence/types.d.ts.map +1 -0
- package/dist/src/intelligence/types.js +8 -0
- package/dist/src/languageDetection.d.ts +100 -0
- package/dist/src/languageDetection.d.ts.map +1 -0
- package/dist/src/languageDetection.js +349 -0
- package/dist/src/languages/java/index.d.ts +16 -0
- package/dist/src/languages/java/index.d.ts.map +1 -0
- package/dist/src/languages/java/index.js +103 -0
- package/dist/src/languages/java/parser.d.ts +7 -0
- package/dist/src/languages/java/parser.d.ts.map +1 -0
- package/dist/src/languages/java/parser.js +50 -0
- package/dist/src/languages/java/semanticBuilder.d.ts +21 -0
- package/dist/src/languages/java/semanticBuilder.d.ts.map +1 -0
- package/dist/src/languages/java/semanticBuilder.js +358 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts +20 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/annotationExtractor.js +94 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts +18 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/assertionResolver.js +150 -0
- package/dist/src/languages/javascript/callResolver.d.ts +23 -0
- package/dist/src/languages/javascript/callResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/callResolver.js +236 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts +23 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.js +205 -0
- package/dist/src/languages/javascript/index.d.ts +20 -0
- package/dist/src/languages/javascript/index.d.ts.map +1 -0
- package/dist/src/languages/javascript/index.js +136 -0
- package/dist/src/languages/javascript/parser.d.ts +14 -0
- package/dist/src/languages/javascript/parser.d.ts.map +1 -0
- package/dist/src/languages/javascript/parser.js +38 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts +31 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/symbolResolver.js +183 -0
- package/dist/src/languages/kotlin/index.d.ts +16 -0
- package/dist/src/languages/kotlin/index.d.ts.map +1 -0
- package/dist/src/languages/kotlin/index.js +151 -0
- package/dist/src/languages/kotlin/parser.d.ts +11 -0
- package/dist/src/languages/kotlin/parser.d.ts.map +1 -0
- package/dist/src/languages/kotlin/parser.js +74 -0
- package/dist/src/languages/python/index.d.ts +15 -0
- package/dist/src/languages/python/index.d.ts.map +1 -0
- package/dist/src/languages/python/index.js +293 -0
- package/dist/src/languages/ruby/index.d.ts +15 -0
- package/dist/src/languages/ruby/index.d.ts.map +1 -0
- package/dist/src/languages/ruby/index.js +274 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts +43 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts.map +1 -0
- package/dist/src/languages/shared/treeSitterUtils.js +100 -0
- package/dist/src/languages/typescript/index.d.ts +14 -0
- package/dist/src/languages/typescript/index.d.ts.map +1 -0
- package/dist/src/languages/typescript/index.js +25 -0
- package/dist/src/lib/index.d.ts +228 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +486 -0
- package/dist/src/mcp/client/index.d.ts +37 -0
- package/dist/src/mcp/client/index.d.ts.map +1 -0
- package/dist/src/mcp/client/index.js +235 -0
- package/dist/src/mcp/config.d.ts +50 -0
- package/dist/src/mcp/config.d.ts.map +1 -0
- package/dist/src/mcp/config.js +125 -0
- package/dist/src/mcp/events.d.ts +24 -0
- package/dist/src/mcp/events.d.ts.map +1 -0
- package/dist/src/mcp/events.js +48 -0
- package/dist/src/mcp/fallback/index.d.ts +50 -0
- package/dist/src/mcp/fallback/index.d.ts.map +1 -0
- package/dist/src/mcp/fallback/index.js +216 -0
- package/dist/src/mcp/index.d.ts +67 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +212 -0
- package/dist/src/mcp/normalizer.d.ts +21 -0
- package/dist/src/mcp/normalizer.d.ts.map +1 -0
- package/dist/src/mcp/normalizer.js +99 -0
- package/dist/src/mcp/prompts/index.d.ts +86 -0
- package/dist/src/mcp/prompts/index.d.ts.map +1 -0
- package/dist/src/mcp/prompts/index.js +304 -0
- package/dist/src/mcp/templates/index.d.ts +35 -0
- package/dist/src/mcp/templates/index.d.ts.map +1 -0
- package/dist/src/mcp/templates/index.js +143 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts +47 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts.map +1 -0
- package/dist/src/mcp/testing/mock-server/index.js +157 -0
- package/dist/src/mcp/types.d.ts +127 -0
- package/dist/src/mcp/types.d.ts.map +1 -0
- package/dist/src/mcp/types.js +8 -0
- package/dist/src/observability.d.ts +138 -0
- package/dist/src/observability.d.ts.map +1 -0
- package/dist/src/observability.js +519 -0
- package/dist/src/parameterCoverage.d.ts +75 -0
- package/dist/src/parameterCoverage.d.ts.map +1 -0
- package/dist/src/parameterCoverage.js +629 -0
- package/dist/src/perfResilienceCoverage.d.ts +155 -0
- package/dist/src/perfResilienceCoverage.d.ts.map +1 -0
- package/dist/src/perfResilienceCoverage.js +670 -0
- package/dist/src/pluginLoader.d.ts +51 -0
- package/dist/src/pluginLoader.d.ts.map +1 -0
- package/dist/src/pluginLoader.js +72 -0
- package/dist/src/publishing.d.ts +63 -0
- package/dist/src/publishing.d.ts.map +1 -0
- package/dist/src/publishing.js +379 -0
- package/dist/src/qualityGate.d.ts +58 -0
- package/dist/src/qualityGate.d.ts.map +1 -0
- package/dist/src/qualityGate.js +118 -0
- package/dist/src/reporting.d.ts +41 -0
- package/dist/src/reporting.d.ts.map +1 -0
- package/dist/src/reporting.js +278 -0
- package/dist/src/screenshots.d.ts +71 -0
- package/dist/src/screenshots.d.ts.map +1 -0
- package/dist/src/screenshots.js +141 -0
- package/dist/src/security/gate/index.d.ts +11 -0
- package/dist/src/security/gate/index.d.ts.map +1 -0
- package/dist/src/security/gate/index.js +65 -0
- package/dist/src/security/index.d.ts +30 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +342 -0
- package/dist/src/security/normalizers/semgrep.d.ts +10 -0
- package/dist/src/security/normalizers/semgrep.d.ts.map +1 -0
- package/dist/src/security/normalizers/semgrep.js +104 -0
- package/dist/src/security/normalizers/trivy.d.ts +10 -0
- package/dist/src/security/normalizers/trivy.d.ts.map +1 -0
- package/dist/src/security/normalizers/trivy.js +78 -0
- package/dist/src/security/normalizers/zap.d.ts +10 -0
- package/dist/src/security/normalizers/zap.d.ts.map +1 -0
- package/dist/src/security/normalizers/zap.js +104 -0
- package/dist/src/security/scanners/semgrep.d.ts +6 -0
- package/dist/src/security/scanners/semgrep.d.ts.map +1 -0
- package/dist/src/security/scanners/semgrep.js +125 -0
- package/dist/src/security/scanners/trivy.d.ts +6 -0
- package/dist/src/security/scanners/trivy.d.ts.map +1 -0
- package/dist/src/security/scanners/trivy.js +115 -0
- package/dist/src/security/scanners/zap.d.ts +6 -0
- package/dist/src/security/scanners/zap.d.ts.map +1 -0
- package/dist/src/security/scanners/zap.js +135 -0
- package/dist/src/security/types.d.ts +146 -0
- package/dist/src/security/types.d.ts.map +1 -0
- package/dist/src/security/types.js +6 -0
- package/dist/src/securityCoverage.d.ts +116 -0
- package/dist/src/securityCoverage.d.ts.map +1 -0
- package/dist/src/securityCoverage.js +725 -0
- package/dist/src/summary/buildSummary.d.ts +28 -0
- package/dist/src/summary/buildSummary.d.ts.map +1 -0
- package/dist/src/summary/buildSummary.js +257 -0
- package/dist/src/summary/evaluateMetrics.d.ts +31 -0
- package/dist/src/summary/evaluateMetrics.d.ts.map +1 -0
- package/dist/src/summary/evaluateMetrics.js +118 -0
- package/dist/src/summary/index.d.ts +10 -0
- package/dist/src/summary/index.d.ts.map +1 -0
- package/dist/src/summary/index.js +22 -0
- package/dist/src/summary/markdownRenderer.d.ts +139 -0
- package/dist/src/summary/markdownRenderer.d.ts.map +1 -0
- package/dist/src/summary/markdownRenderer.js +459 -0
- package/dist/src/summary/prSummary.d.ts +24 -0
- package/dist/src/summary/prSummary.d.ts.map +1 -0
- package/dist/src/summary/prSummary.js +233 -0
- package/dist/src/summary/summaryTypes.d.ts +35 -0
- package/dist/src/summary/summaryTypes.d.ts.map +1 -0
- package/dist/src/summary/summaryTypes.js +27 -0
- package/package.json +84 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deep Code Analysis — Method Chain Resolution
|
|
4
|
+
*
|
|
5
|
+
* Traces method calls to helper/wrapper functions within the same file,
|
|
6
|
+
* following the call graph up to a configurable depth.
|
|
7
|
+
*
|
|
8
|
+
* Also detects builder-style method chains that resolve to HTTP calls.
|
|
9
|
+
*
|
|
10
|
+
* Supported patterns:
|
|
11
|
+
*
|
|
12
|
+
* TypeScript/JavaScript:
|
|
13
|
+
* function getUsers(client) { return client.get('/users'); }
|
|
14
|
+
* getUsers(apiClient); → GET /users
|
|
15
|
+
*
|
|
16
|
+
* Java:
|
|
17
|
+
* private Response fetchUser(String id) { return api.get("/users/" + id); }
|
|
18
|
+
* fetchUser(userId); → GET /users/{id}
|
|
19
|
+
*
|
|
20
|
+
* Python:
|
|
21
|
+
* def fetch_customer(customer_id): return client.get(build_path(customer_id))
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.resolveWrapperCall = resolveWrapperCall;
|
|
25
|
+
exports.resolveHelperReturnPath = resolveHelperReturnPath;
|
|
26
|
+
exports.extractPythonHelperCallsInHttpArgs = extractPythonHelperCallsInHttpArgs;
|
|
27
|
+
exports.extractJsHelperCallsInHttpArgs = extractJsHelperCallsInHttpArgs;
|
|
28
|
+
exports.extractJavaHelperCallsInHttpArgs = extractJavaHelperCallsInHttpArgs;
|
|
29
|
+
const resolvePaths_1 = require("./resolvePaths");
|
|
30
|
+
const resolveConstants_1 = require("./resolveConstants");
|
|
31
|
+
// ─── Wrapper method resolution ────────────────────────────────────────────────
|
|
32
|
+
/**
|
|
33
|
+
* Given a function call expression like `getUsers(apiClient)`, look up the
|
|
34
|
+
* callee in the call graph, recurse into its body (up to maxDepth), and return
|
|
35
|
+
* any HTTP calls found inside.
|
|
36
|
+
*/
|
|
37
|
+
function resolveWrapperCall(callee, graph, table, sourceFile, sourceLanguage, maxDepth, currentDepth = 0) {
|
|
38
|
+
if (currentDepth >= maxDepth)
|
|
39
|
+
return [];
|
|
40
|
+
const node = graph.get(callee);
|
|
41
|
+
if (!node)
|
|
42
|
+
return [];
|
|
43
|
+
const results = [];
|
|
44
|
+
// Direct HTTP calls found inside this function body
|
|
45
|
+
for (const { method, path } of node.directHttpCalls) {
|
|
46
|
+
const normalized = (0, resolvePaths_1.normalizePathToTemplate)(path);
|
|
47
|
+
results.push({
|
|
48
|
+
method,
|
|
49
|
+
path,
|
|
50
|
+
normalizedPath: normalized !== path ? normalized : undefined,
|
|
51
|
+
sourceFile,
|
|
52
|
+
sourceLanguage,
|
|
53
|
+
resolutionType: 'wrapper-method',
|
|
54
|
+
confidence: 'high',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// HTTP calls found by resolving the return value as a path
|
|
58
|
+
if (node.returnValue) {
|
|
59
|
+
// If the function returns a path string, it may be used inside a call
|
|
60
|
+
// that's resolved by the caller. Nothing to add here directly.
|
|
61
|
+
}
|
|
62
|
+
// Recurse into called local functions
|
|
63
|
+
for (const calledName of node.calls) {
|
|
64
|
+
const nested = resolveWrapperCall(calledName, graph, table, sourceFile, sourceLanguage, maxDepth, currentDepth + 1);
|
|
65
|
+
for (const call of nested) {
|
|
66
|
+
results.push({ ...call, resolutionType: 'wrapper-method', confidence: currentDepth === 0 ? 'high' : 'medium' });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve the path returned by a helper function when it is passed as the
|
|
73
|
+
* argument to an HTTP call.
|
|
74
|
+
*
|
|
75
|
+
* Example: client.get(getUserPath(userId))
|
|
76
|
+
* → getUserPath is in the call graph, returns `/users/${userId}`
|
|
77
|
+
* → normalized: /users/{id}
|
|
78
|
+
*/
|
|
79
|
+
function resolveHelperReturnPath(calleeName, graph, table, maxDepth, currentDepth = 0) {
|
|
80
|
+
if (currentDepth >= maxDepth)
|
|
81
|
+
return undefined;
|
|
82
|
+
const node = graph.get(calleeName);
|
|
83
|
+
if (!node)
|
|
84
|
+
return undefined;
|
|
85
|
+
// Direct return value
|
|
86
|
+
if (node.returnValue !== undefined) {
|
|
87
|
+
// Resolve any constants in the return value
|
|
88
|
+
const resolved = (0, resolveConstants_1.resolveToken)(node.returnValue, table);
|
|
89
|
+
return resolved !== null && resolved !== void 0 ? resolved : node.returnValue;
|
|
90
|
+
}
|
|
91
|
+
// If the function body contains a template literal return
|
|
92
|
+
const templateReturn = /return\s+`([^`]+)`/.exec(node.body);
|
|
93
|
+
if (templateReturn) {
|
|
94
|
+
return templateReturn[1];
|
|
95
|
+
}
|
|
96
|
+
// Recurse: if this function itself calls another helper that returns a path
|
|
97
|
+
for (const called of node.calls) {
|
|
98
|
+
const nested = resolveHelperReturnPath(called, graph, table, maxDepth, currentDepth + 1);
|
|
99
|
+
if (nested !== undefined)
|
|
100
|
+
return nested;
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
// ─── Python path builder detection ───────────────────────────────────────────
|
|
105
|
+
/**
|
|
106
|
+
* Detect calls to local helper functions inside HTTP call argument positions
|
|
107
|
+
* in Python source.
|
|
108
|
+
*
|
|
109
|
+
* Example:
|
|
110
|
+
* client.get(build_customer_path(customer_id))
|
|
111
|
+
* → extracts 'build_customer_path' as a path-builder call
|
|
112
|
+
*/
|
|
113
|
+
function extractPythonHelperCallsInHttpArgs(content) {
|
|
114
|
+
const calls = [];
|
|
115
|
+
// Pattern: .get(helper_name(...) or requests.get(helper_name(...))
|
|
116
|
+
const pattern = /\b(?:client|self\.client|requests|httpx)\.(get|post|put|patch|delete|head|options)\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\(/gi;
|
|
117
|
+
let m;
|
|
118
|
+
while ((m = pattern.exec(content)) !== null) {
|
|
119
|
+
calls.push({ method: m[1].toUpperCase(), helperName: m[2] });
|
|
120
|
+
}
|
|
121
|
+
return calls;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Detect calls to local helper functions inside HTTP call argument positions
|
|
125
|
+
* in TypeScript/JavaScript source.
|
|
126
|
+
*
|
|
127
|
+
* Example:
|
|
128
|
+
* client.get(getUserPath(userId))
|
|
129
|
+
*/
|
|
130
|
+
function extractJsHelperCallsInHttpArgs(content) {
|
|
131
|
+
const calls = [];
|
|
132
|
+
const pattern = /\.(get|post|put|patch|delete|head|options)\s*\(\s*([A-Za-z_$][A-Za-z0-9_$]*)\s*\(/gi;
|
|
133
|
+
let m;
|
|
134
|
+
while ((m = pattern.exec(content)) !== null) {
|
|
135
|
+
calls.push({ method: m[1].toUpperCase(), helperName: m[2] });
|
|
136
|
+
}
|
|
137
|
+
return calls;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Detect calls to local helper functions inside HTTP call argument positions
|
|
141
|
+
* in Java/Kotlin source.
|
|
142
|
+
*/
|
|
143
|
+
function extractJavaHelperCallsInHttpArgs(content) {
|
|
144
|
+
const calls = [];
|
|
145
|
+
// api.get(userPath(id)) or client.get(buildPath(id))
|
|
146
|
+
const pattern = /\.(get|post|put|patch|delete|head|options)\s*\(\s*([a-z][A-Za-z0-9_]*)\s*\(/gi;
|
|
147
|
+
let m;
|
|
148
|
+
while ((m = pattern.exec(content)) !== null) {
|
|
149
|
+
calls.push({ method: m[1].toUpperCase(), helperName: m[2] });
|
|
150
|
+
}
|
|
151
|
+
return calls;
|
|
152
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep Code Analysis — Path Resolution and Normalization
|
|
3
|
+
*
|
|
4
|
+
* Resolves endpoint paths built from:
|
|
5
|
+
* - Template literals: `${BASE}/users/${id}`
|
|
6
|
+
* - String concatenation: BASE + "/users/" + id
|
|
7
|
+
* - Java/Kotlin string concatenation: BASE + "/users/" + id
|
|
8
|
+
* - Python f-strings: f"{BASE}/users/{user_id}"
|
|
9
|
+
* - Ruby interpolation: "#{BASE}/users/#{id}"
|
|
10
|
+
*
|
|
11
|
+
* Also normalizes concrete paths or partially concrete paths to OpenAPI-style
|
|
12
|
+
* path templates: /users/123 → /users/{id}
|
|
13
|
+
*/
|
|
14
|
+
import type { SymbolTable } from './types';
|
|
15
|
+
/**
|
|
16
|
+
* Attempt to resolve a JavaScript/TypeScript template literal to a partial or
|
|
17
|
+
* complete path string.
|
|
18
|
+
*
|
|
19
|
+
* Input: `${BASE_URL}/users/${userId}`
|
|
20
|
+
* Output: /users/${userId} (if BASE_URL is known) or
|
|
21
|
+
* /users/{userId} (normalized)
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveTemplateLiteral(template: string, table: SymbolTable): string;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a string concatenation expression like:
|
|
26
|
+
* BASE + "/users/" + id
|
|
27
|
+
* BASE_URL + RESOURCE_PATH
|
|
28
|
+
*
|
|
29
|
+
* Splits on `+` and resolves each token, then joins.
|
|
30
|
+
* Tokens that cannot be resolved are treated as path parameters.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveStringConcatenation(expr: string, table: SymbolTable): string;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a Java string concatenation (also uses + operator).
|
|
35
|
+
* Functionally identical to resolveStringConcatenation but handles Java
|
|
36
|
+
* specific quoted strings (double quotes only).
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveJavaConcatenation(expr: string, table: SymbolTable): string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a Python f-string: f"{BASE_URL}/users/{user_id}"
|
|
41
|
+
*
|
|
42
|
+
* Input (without the f prefix and outer quotes): {BASE_URL}/users/{user_id}
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolvePythonFString(template: string, table: SymbolTable): string;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a Ruby string interpolation: "#{BASE_URL}/users/#{id}"
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveRubyInterpolation(template: string, table: SymbolTable): string;
|
|
49
|
+
/**
|
|
50
|
+
* Normalize a concrete or partially-concrete path to an OpenAPI path template.
|
|
51
|
+
*
|
|
52
|
+
* Rules:
|
|
53
|
+
* - UUID-like segments → {id}
|
|
54
|
+
* - Purely numeric IDs → {id}
|
|
55
|
+
* - Variable-looking segments like {variable} are kept as-is
|
|
56
|
+
* - Short alpha-numeric slugs that look like IDs (>= 8 hex chars) → {id}
|
|
57
|
+
*
|
|
58
|
+
* Examples:
|
|
59
|
+
* /users/123 → /users/{id}
|
|
60
|
+
* /users/abc-def-456 → /users/{id}
|
|
61
|
+
* /users/123/orders/9 → /users/{id}/orders/{id}
|
|
62
|
+
* /accounts/{accountId} → /accounts/{accountId} (already a template)
|
|
63
|
+
*/
|
|
64
|
+
export declare function normalizePathToTemplate(rawPath: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Detect and extract template literals that may contain a path.
|
|
67
|
+
* Returns all template literal strings found in the content that look path-like.
|
|
68
|
+
*/
|
|
69
|
+
export declare function extractTemplateLiterals(content: string): string[];
|
|
70
|
+
/**
|
|
71
|
+
* Detect and extract Python f-string paths.
|
|
72
|
+
* Returns the inner template strings.
|
|
73
|
+
*/
|
|
74
|
+
export declare function extractPythonFStrings(content: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Strip the scheme and host from a fully qualified URL, returning just the path.
|
|
77
|
+
* If the input already looks like a path or a template variable, return it unchanged.
|
|
78
|
+
*/
|
|
79
|
+
export declare function stripUrlBase(value: string): string;
|
|
80
|
+
//# sourceMappingURL=resolvePaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePaths.d.ts","sourceRoot":"","sources":["../../../../src/coverage/deep-analysis/resolvePaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK3C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAWnF;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAwBnF;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAsBjF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAQjF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAQrF;AAID;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB/D;AAID;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAWjE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ/D;AAID;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQlD"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deep Code Analysis — Path Resolution and Normalization
|
|
4
|
+
*
|
|
5
|
+
* Resolves endpoint paths built from:
|
|
6
|
+
* - Template literals: `${BASE}/users/${id}`
|
|
7
|
+
* - String concatenation: BASE + "/users/" + id
|
|
8
|
+
* - Java/Kotlin string concatenation: BASE + "/users/" + id
|
|
9
|
+
* - Python f-strings: f"{BASE}/users/{user_id}"
|
|
10
|
+
* - Ruby interpolation: "#{BASE}/users/#{id}"
|
|
11
|
+
*
|
|
12
|
+
* Also normalizes concrete paths or partially concrete paths to OpenAPI-style
|
|
13
|
+
* path templates: /users/123 → /users/{id}
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.resolveTemplateLiteral = resolveTemplateLiteral;
|
|
17
|
+
exports.resolveStringConcatenation = resolveStringConcatenation;
|
|
18
|
+
exports.resolveJavaConcatenation = resolveJavaConcatenation;
|
|
19
|
+
exports.resolvePythonFString = resolvePythonFString;
|
|
20
|
+
exports.resolveRubyInterpolation = resolveRubyInterpolation;
|
|
21
|
+
exports.normalizePathToTemplate = normalizePathToTemplate;
|
|
22
|
+
exports.extractTemplateLiterals = extractTemplateLiterals;
|
|
23
|
+
exports.extractPythonFStrings = extractPythonFStrings;
|
|
24
|
+
exports.stripUrlBase = stripUrlBase;
|
|
25
|
+
const resolveConstants_1 = require("./resolveConstants");
|
|
26
|
+
// ─── Template literal resolution (TypeScript/JavaScript) ──────────────────────
|
|
27
|
+
/**
|
|
28
|
+
* Attempt to resolve a JavaScript/TypeScript template literal to a partial or
|
|
29
|
+
* complete path string.
|
|
30
|
+
*
|
|
31
|
+
* Input: `${BASE_URL}/users/${userId}`
|
|
32
|
+
* Output: /users/${userId} (if BASE_URL is known) or
|
|
33
|
+
* /users/{userId} (normalized)
|
|
34
|
+
*/
|
|
35
|
+
function resolveTemplateLiteral(template, table) {
|
|
36
|
+
// Replace ${IDENTIFIER} with their resolved value or a path parameter placeholder
|
|
37
|
+
return template.replace(/\$\{([^}]+)\}/g, (_match, expr) => {
|
|
38
|
+
const resolved = (0, resolveConstants_1.resolveToken)(expr.trim(), table);
|
|
39
|
+
if (resolved !== undefined) {
|
|
40
|
+
// If it resolved to a URL base, strip the scheme+host
|
|
41
|
+
return stripUrlBase(resolved);
|
|
42
|
+
}
|
|
43
|
+
// Unknown identifer — treat as a path parameter
|
|
44
|
+
return `{${expr.trim()}}`;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a string concatenation expression like:
|
|
49
|
+
* BASE + "/users/" + id
|
|
50
|
+
* BASE_URL + RESOURCE_PATH
|
|
51
|
+
*
|
|
52
|
+
* Splits on `+` and resolves each token, then joins.
|
|
53
|
+
* Tokens that cannot be resolved are treated as path parameters.
|
|
54
|
+
*/
|
|
55
|
+
function resolveStringConcatenation(expr, table) {
|
|
56
|
+
const fragments = expr.split(/\s*\+\s*/);
|
|
57
|
+
const parts = [];
|
|
58
|
+
for (const frag of fragments) {
|
|
59
|
+
const trimmed = frag.trim();
|
|
60
|
+
if (!trimmed)
|
|
61
|
+
continue;
|
|
62
|
+
// Quoted literal
|
|
63
|
+
if (/^['"`]/.test(trimmed)) {
|
|
64
|
+
parts.push(trimmed.slice(1, -1));
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const resolved = (0, resolveConstants_1.resolveToken)(trimmed, table);
|
|
68
|
+
if (resolved !== undefined) {
|
|
69
|
+
parts.push(stripUrlBase(resolved));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Identifier with unknown value → path parameter
|
|
73
|
+
parts.push(`{${trimmed}}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return parts.join('');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Resolve a Java string concatenation (also uses + operator).
|
|
80
|
+
* Functionally identical to resolveStringConcatenation but handles Java
|
|
81
|
+
* specific quoted strings (double quotes only).
|
|
82
|
+
*/
|
|
83
|
+
function resolveJavaConcatenation(expr, table) {
|
|
84
|
+
const fragments = expr.split(/\s*\+\s*/);
|
|
85
|
+
const parts = [];
|
|
86
|
+
for (const frag of fragments) {
|
|
87
|
+
const trimmed = frag.trim();
|
|
88
|
+
if (!trimmed)
|
|
89
|
+
continue;
|
|
90
|
+
if (/^"[^"]*"$/.test(trimmed)) {
|
|
91
|
+
parts.push(trimmed.slice(1, -1));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const resolved = (0, resolveConstants_1.resolveToken)(trimmed, table);
|
|
95
|
+
if (resolved !== undefined) {
|
|
96
|
+
parts.push(stripUrlBase(resolved));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
parts.push(`{${trimmed}}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return parts.join('');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Resolve a Python f-string: f"{BASE_URL}/users/{user_id}"
|
|
106
|
+
*
|
|
107
|
+
* Input (without the f prefix and outer quotes): {BASE_URL}/users/{user_id}
|
|
108
|
+
*/
|
|
109
|
+
function resolvePythonFString(template, table) {
|
|
110
|
+
return template.replace(/\{([^}]+)\}/g, (_match, expr) => {
|
|
111
|
+
const resolved = (0, resolveConstants_1.resolveToken)(expr.trim(), table);
|
|
112
|
+
if (resolved !== undefined) {
|
|
113
|
+
return stripUrlBase(resolved);
|
|
114
|
+
}
|
|
115
|
+
return `{${expr.trim()}}`;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Resolve a Ruby string interpolation: "#{BASE_URL}/users/#{id}"
|
|
120
|
+
*/
|
|
121
|
+
function resolveRubyInterpolation(template, table) {
|
|
122
|
+
return template.replace(/#\{([^}]+)\}/g, (_match, expr) => {
|
|
123
|
+
const resolved = (0, resolveConstants_1.resolveToken)(expr.trim(), table);
|
|
124
|
+
if (resolved !== undefined) {
|
|
125
|
+
return stripUrlBase(resolved);
|
|
126
|
+
}
|
|
127
|
+
return `{${expr.trim()}}`;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// ─── Path normalization ───────────────────────────────────────────────────────
|
|
131
|
+
/**
|
|
132
|
+
* Normalize a concrete or partially-concrete path to an OpenAPI path template.
|
|
133
|
+
*
|
|
134
|
+
* Rules:
|
|
135
|
+
* - UUID-like segments → {id}
|
|
136
|
+
* - Purely numeric IDs → {id}
|
|
137
|
+
* - Variable-looking segments like {variable} are kept as-is
|
|
138
|
+
* - Short alpha-numeric slugs that look like IDs (>= 8 hex chars) → {id}
|
|
139
|
+
*
|
|
140
|
+
* Examples:
|
|
141
|
+
* /users/123 → /users/{id}
|
|
142
|
+
* /users/abc-def-456 → /users/{id}
|
|
143
|
+
* /users/123/orders/9 → /users/{id}/orders/{id}
|
|
144
|
+
* /accounts/{accountId} → /accounts/{accountId} (already a template)
|
|
145
|
+
*/
|
|
146
|
+
function normalizePathToTemplate(rawPath) {
|
|
147
|
+
return rawPath
|
|
148
|
+
.split('/')
|
|
149
|
+
.map((segment) => {
|
|
150
|
+
if (!segment)
|
|
151
|
+
return segment;
|
|
152
|
+
// Already a template parameter
|
|
153
|
+
if (/^\{.+\}$/.test(segment))
|
|
154
|
+
return segment;
|
|
155
|
+
// Purely numeric
|
|
156
|
+
if (/^\d+$/.test(segment))
|
|
157
|
+
return '{id}';
|
|
158
|
+
// UUID
|
|
159
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(segment))
|
|
160
|
+
return '{id}';
|
|
161
|
+
// Long hex / alphanumeric slug (>= 8 chars, looks like an ID, not a resource word)
|
|
162
|
+
if (/^[0-9a-f]{8,}$/i.test(segment) && !/^[a-z]+$/i.test(segment))
|
|
163
|
+
return '{id}';
|
|
164
|
+
// Mixed alphanumeric that looks like a slug: abc-123, def_456
|
|
165
|
+
if (/^[a-z0-9]+-[a-z0-9-]+$/i.test(segment) && /\d/.test(segment))
|
|
166
|
+
return '{id}';
|
|
167
|
+
return segment;
|
|
168
|
+
})
|
|
169
|
+
.join('/');
|
|
170
|
+
}
|
|
171
|
+
// ─── Extraction helpers ───────────────────────────────────────────────────────
|
|
172
|
+
/**
|
|
173
|
+
* Detect and extract template literals that may contain a path.
|
|
174
|
+
* Returns all template literal strings found in the content that look path-like.
|
|
175
|
+
*/
|
|
176
|
+
function extractTemplateLiterals(content) {
|
|
177
|
+
const results = [];
|
|
178
|
+
// Template literals that contain at least one /
|
|
179
|
+
const pattern = /`([^`]*\/[^`]*)`/g;
|
|
180
|
+
let m;
|
|
181
|
+
while ((m = pattern.exec(content)) !== null) {
|
|
182
|
+
if (!m[1].includes('\n')) {
|
|
183
|
+
results.push(m[1]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return results;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Detect and extract Python f-string paths.
|
|
190
|
+
* Returns the inner template strings.
|
|
191
|
+
*/
|
|
192
|
+
function extractPythonFStrings(content) {
|
|
193
|
+
const results = [];
|
|
194
|
+
const pattern = /f['"]([^'"]*\/[^'"]*)['"]/g;
|
|
195
|
+
let m;
|
|
196
|
+
while ((m = pattern.exec(content)) !== null) {
|
|
197
|
+
results.push(m[1]);
|
|
198
|
+
}
|
|
199
|
+
return results;
|
|
200
|
+
}
|
|
201
|
+
// ─── Utility ──────────────────────────────────────────────────────────────────
|
|
202
|
+
/**
|
|
203
|
+
* Strip the scheme and host from a fully qualified URL, returning just the path.
|
|
204
|
+
* If the input already looks like a path or a template variable, return it unchanged.
|
|
205
|
+
*/
|
|
206
|
+
function stripUrlBase(value) {
|
|
207
|
+
if (value.startsWith('/') || value.startsWith('{'))
|
|
208
|
+
return value;
|
|
209
|
+
try {
|
|
210
|
+
const url = new URL(value);
|
|
211
|
+
return url.pathname;
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep Code Analysis — Request Object and Builder Pattern Resolution
|
|
3
|
+
*
|
|
4
|
+
* Detects and resolves HTTP calls that are hidden inside request object
|
|
5
|
+
* construction or builder patterns.
|
|
6
|
+
*
|
|
7
|
+
* Supported patterns:
|
|
8
|
+
*
|
|
9
|
+
* TypeScript/JavaScript:
|
|
10
|
+
* const request = new ApiRequest('GET', '/users');
|
|
11
|
+
* client.execute(request);
|
|
12
|
+
*
|
|
13
|
+
* Java:
|
|
14
|
+
* Request req = Request.builder().method(GET).path("/users").build();
|
|
15
|
+
* client.execute(req);
|
|
16
|
+
*
|
|
17
|
+
* Kotlin:
|
|
18
|
+
* val req = RequestBuilder().get().path("/users").build()
|
|
19
|
+
* api.execute(req)
|
|
20
|
+
*
|
|
21
|
+
* Python:
|
|
22
|
+
* request = ApiRequest(method='GET', path='/users')
|
|
23
|
+
* client.execute(request)
|
|
24
|
+
*/
|
|
25
|
+
import type { SymbolTable } from './types';
|
|
26
|
+
export interface RequestObjectCall {
|
|
27
|
+
method: string;
|
|
28
|
+
path: string;
|
|
29
|
+
normalizedPath?: string;
|
|
30
|
+
confidence: 'high' | 'medium' | 'low';
|
|
31
|
+
pattern: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract HTTP calls from TypeScript/JavaScript request object and builder patterns.
|
|
35
|
+
*
|
|
36
|
+
* Detects:
|
|
37
|
+
* new ApiRequest('GET', '/users')
|
|
38
|
+
* new Request({ method: 'GET', url: '/users' })
|
|
39
|
+
* ApiRequest.create({ method: 'get', path: '/users' })
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractJsRequestBuilders(content: string, table: SymbolTable): RequestObjectCall[];
|
|
42
|
+
/**
|
|
43
|
+
* Extract HTTP calls from Java builder patterns.
|
|
44
|
+
*
|
|
45
|
+
* Detects:
|
|
46
|
+
* Request.builder().method(HttpMethod.GET).path("/users").build()
|
|
47
|
+
* new HttpRequest.Builder().uri("/users").method("GET", ...).build()
|
|
48
|
+
* MockMvcRequestBuilders.get("/users")
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractJavaRequestBuilders(content: string, table: SymbolTable): RequestObjectCall[];
|
|
51
|
+
/**
|
|
52
|
+
* Extract HTTP calls from Kotlin builder patterns.
|
|
53
|
+
*
|
|
54
|
+
* Detects:
|
|
55
|
+
* RequestBuilder().get().path("/users").build()
|
|
56
|
+
* val req = RequestBuilder().method("GET").path("/users").build()
|
|
57
|
+
*/
|
|
58
|
+
export declare function extractKotlinRequestBuilders(content: string, table: SymbolTable): RequestObjectCall[];
|
|
59
|
+
/**
|
|
60
|
+
* Extract HTTP calls from Python request object patterns.
|
|
61
|
+
*
|
|
62
|
+
* Detects:
|
|
63
|
+
* ApiRequest(method='GET', path='/users')
|
|
64
|
+
* requests.Request('GET', '/users')
|
|
65
|
+
*/
|
|
66
|
+
export declare function extractPythonRequestBuilders(content: string, table: SymbolTable): RequestObjectCall[];
|
|
67
|
+
/**
|
|
68
|
+
* Extract request builder / request object HTTP calls for any supported language.
|
|
69
|
+
*/
|
|
70
|
+
export declare function extractRequestBuilders(content: string, language: string, table: SymbolTable): RequestObjectCall[];
|
|
71
|
+
//# sourceMappingURL=resolveRequestWrappers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRequestWrappers.d.ts","sourceRoot":"","sources":["../../../../src/coverage/deep-analysis/resolveRequestWrappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAID;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,iBAAiB,EAAE,CAkDrB;AAID;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,iBAAiB,EAAE,CAmCrB;AAID;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,iBAAiB,EAAE,CAmCrB;AAID;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,iBAAiB,EAAE,CAmCrB;AAID;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,WAAW,GACjB,iBAAiB,EAAE,CAarB"}
|