driftdetect-core 0.4.0 → 0.4.2
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/boundaries/boundary-scanner.d.ts +76 -0
- package/dist/boundaries/boundary-scanner.d.ts.map +1 -0
- package/dist/boundaries/boundary-scanner.js +801 -0
- package/dist/boundaries/boundary-scanner.js.map +1 -0
- package/dist/boundaries/data-access-learner.d.ts +126 -0
- package/dist/boundaries/data-access-learner.d.ts.map +1 -0
- package/dist/boundaries/data-access-learner.js +486 -0
- package/dist/boundaries/data-access-learner.js.map +1 -0
- package/dist/boundaries/index.d.ts +6 -0
- package/dist/boundaries/index.d.ts.map +1 -1
- package/dist/boundaries/index.js +6 -0
- package/dist/boundaries/index.js.map +1 -1
- package/dist/boundaries/security-prioritizer.d.ts +118 -0
- package/dist/boundaries/security-prioritizer.d.ts.map +1 -0
- package/dist/boundaries/security-prioritizer.js +316 -0
- package/dist/boundaries/security-prioritizer.js.map +1 -0
- package/dist/call-graph/analysis/coverage-analyzer.d.ts +201 -0
- package/dist/call-graph/analysis/coverage-analyzer.d.ts.map +1 -0
- package/dist/call-graph/analysis/coverage-analyzer.js +553 -0
- package/dist/call-graph/analysis/coverage-analyzer.js.map +1 -0
- package/dist/call-graph/analysis/dead-code-detector.d.ts +145 -0
- package/dist/call-graph/analysis/dead-code-detector.d.ts.map +1 -0
- package/dist/call-graph/analysis/dead-code-detector.js +391 -0
- package/dist/call-graph/analysis/dead-code-detector.js.map +1 -0
- package/dist/call-graph/analysis/graph-builder.d.ts +142 -0
- package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -0
- package/dist/call-graph/analysis/graph-builder.js +624 -0
- package/dist/call-graph/analysis/graph-builder.js.map +1 -0
- package/dist/call-graph/analysis/impact-analyzer.d.ts +150 -0
- package/dist/call-graph/analysis/impact-analyzer.d.ts.map +1 -0
- package/dist/call-graph/analysis/impact-analyzer.js +329 -0
- package/dist/call-graph/analysis/impact-analyzer.js.map +1 -0
- package/dist/call-graph/analysis/index.d.ts +11 -0
- package/dist/call-graph/analysis/index.d.ts.map +1 -0
- package/dist/call-graph/analysis/index.js +9 -0
- package/dist/call-graph/analysis/index.js.map +1 -0
- package/dist/call-graph/analysis/path-finder.d.ts +117 -0
- package/dist/call-graph/analysis/path-finder.d.ts.map +1 -0
- package/dist/call-graph/analysis/path-finder.js +360 -0
- package/dist/call-graph/analysis/path-finder.js.map +1 -0
- package/dist/call-graph/analysis/reachability.d.ts +56 -0
- package/dist/call-graph/analysis/reachability.d.ts.map +1 -0
- package/dist/call-graph/analysis/reachability.js +357 -0
- package/dist/call-graph/analysis/reachability.js.map +1 -0
- package/dist/call-graph/demo.d.ts +11 -0
- package/dist/call-graph/demo.d.ts.map +1 -0
- package/dist/call-graph/demo.js +339 -0
- package/dist/call-graph/demo.js.map +1 -0
- package/dist/call-graph/enrichment/enrichment-engine.d.ts +126 -0
- package/dist/call-graph/enrichment/enrichment-engine.d.ts.map +1 -0
- package/dist/call-graph/enrichment/enrichment-engine.js +760 -0
- package/dist/call-graph/enrichment/enrichment-engine.js.map +1 -0
- package/dist/call-graph/enrichment/impact-scorer.d.ts +59 -0
- package/dist/call-graph/enrichment/impact-scorer.d.ts.map +1 -0
- package/dist/call-graph/enrichment/impact-scorer.js +328 -0
- package/dist/call-graph/enrichment/impact-scorer.js.map +1 -0
- package/dist/call-graph/enrichment/index.d.ts +12 -0
- package/dist/call-graph/enrichment/index.d.ts.map +1 -0
- package/dist/call-graph/enrichment/index.js +15 -0
- package/dist/call-graph/enrichment/index.js.map +1 -0
- package/dist/call-graph/enrichment/remediation-generator.d.ts +41 -0
- package/dist/call-graph/enrichment/remediation-generator.d.ts.map +1 -0
- package/dist/call-graph/enrichment/remediation-generator.js +609 -0
- package/dist/call-graph/enrichment/remediation-generator.js.map +1 -0
- package/dist/call-graph/enrichment/sensitivity-classifier.d.ts +71 -0
- package/dist/call-graph/enrichment/sensitivity-classifier.d.ts.map +1 -0
- package/dist/call-graph/enrichment/sensitivity-classifier.js +454 -0
- package/dist/call-graph/enrichment/sensitivity-classifier.js.map +1 -0
- package/dist/call-graph/enrichment/types.d.ts +402 -0
- package/dist/call-graph/enrichment/types.d.ts.map +1 -0
- package/dist/call-graph/enrichment/types.js +9 -0
- package/dist/call-graph/enrichment/types.js.map +1 -0
- package/dist/call-graph/extractors/base-extractor.d.ts +112 -0
- package/dist/call-graph/extractors/base-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/base-extractor.js +140 -0
- package/dist/call-graph/extractors/base-extractor.js.map +1 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts +76 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.js +387 -0
- package/dist/call-graph/extractors/csharp-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/csharp-extractor.d.ts +87 -0
- package/dist/call-graph/extractors/csharp-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/csharp-extractor.js +470 -0
- package/dist/call-graph/extractors/csharp-extractor.js.map +1 -0
- package/dist/call-graph/extractors/data-access-extractor.d.ts +76 -0
- package/dist/call-graph/extractors/data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/data-access-extractor.js +234 -0
- package/dist/call-graph/extractors/data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/index.d.ts +26 -0
- package/dist/call-graph/extractors/index.d.ts.map +1 -0
- package/dist/call-graph/extractors/index.js +36 -0
- package/dist/call-graph/extractors/index.js.map +1 -0
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts +101 -0
- package/dist/call-graph/extractors/java-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/java-data-access-extractor.js +611 -0
- package/dist/call-graph/extractors/java-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/java-extractor.d.ts +87 -0
- package/dist/call-graph/extractors/java-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/java-extractor.js +510 -0
- package/dist/call-graph/extractors/java-extractor.js.map +1 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts +93 -0
- package/dist/call-graph/extractors/php-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/php-data-access-extractor.js +589 -0
- package/dist/call-graph/extractors/php-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/php-extractor.d.ts +104 -0
- package/dist/call-graph/extractors/php-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/php-extractor.js +619 -0
- package/dist/call-graph/extractors/php-extractor.js.map +1 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts +90 -0
- package/dist/call-graph/extractors/python-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/python-data-access-extractor.js +537 -0
- package/dist/call-graph/extractors/python-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/python-extractor.d.ts +98 -0
- package/dist/call-graph/extractors/python-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/python-extractor.js +681 -0
- package/dist/call-graph/extractors/python-extractor.js.map +1 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts +91 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts.map +1 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.js +498 -0
- package/dist/call-graph/extractors/semantic-data-access-scanner.js.map +1 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts +122 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.js +788 -0
- package/dist/call-graph/extractors/typescript-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/typescript-extractor.d.ts +145 -0
- package/dist/call-graph/extractors/typescript-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/typescript-extractor.js +904 -0
- package/dist/call-graph/extractors/typescript-extractor.js.map +1 -0
- package/dist/call-graph/index.d.ts +127 -0
- package/dist/call-graph/index.d.ts.map +1 -0
- package/dist/call-graph/index.js +247 -0
- package/dist/call-graph/index.js.map +1 -0
- package/dist/call-graph/store/call-graph-store.d.ts +70 -0
- package/dist/call-graph/store/call-graph-store.d.ts.map +1 -0
- package/dist/call-graph/store/call-graph-store.js +210 -0
- package/dist/call-graph/store/call-graph-store.js.map +1 -0
- package/dist/call-graph/store/index.d.ts +7 -0
- package/dist/call-graph/store/index.d.ts.map +1 -0
- package/dist/call-graph/store/index.js +7 -0
- package/dist/call-graph/store/index.js.map +1 -0
- package/dist/call-graph/types.d.ts +376 -0
- package/dist/call-graph/types.d.ts.map +1 -0
- package/dist/call-graph/types.js +8 -0
- package/dist/call-graph/types.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/lake/callgraph-shard-store.d.ts +168 -0
- package/dist/lake/callgraph-shard-store.d.ts.map +1 -0
- package/dist/lake/callgraph-shard-store.js +466 -0
- package/dist/lake/callgraph-shard-store.js.map +1 -0
- package/dist/lake/examples-store.d.ts +127 -0
- package/dist/lake/examples-store.d.ts.map +1 -0
- package/dist/lake/examples-store.js +389 -0
- package/dist/lake/examples-store.js.map +1 -0
- package/dist/lake/index-store.d.ts +82 -0
- package/dist/lake/index-store.d.ts.map +1 -0
- package/dist/lake/index-store.js +359 -0
- package/dist/lake/index-store.js.map +1 -0
- package/dist/lake/index.d.ts +93 -0
- package/dist/lake/index.d.ts.map +1 -0
- package/dist/lake/index.js +138 -0
- package/dist/lake/index.js.map +1 -0
- package/dist/lake/lake.bak/index-store.d.ts +82 -0
- package/dist/lake/lake.bak/index-store.d.ts.map +1 -0
- package/dist/lake/lake.bak/index-store.js +357 -0
- package/dist/lake/lake.bak/index-store.js.map +1 -0
- package/dist/lake/lake.bak/index.d.ts +81 -0
- package/dist/lake/lake.bak/index.d.ts.map +1 -0
- package/dist/lake/lake.bak/index.js +114 -0
- package/dist/lake/lake.bak/index.js.map +1 -0
- package/dist/lake/lake.bak/manifest-store.d.ts +51 -0
- package/dist/lake/lake.bak/manifest-store.d.ts.map +1 -0
- package/dist/lake/lake.bak/manifest-store.js +347 -0
- package/dist/lake/lake.bak/manifest-store.js.map +1 -0
- package/dist/lake/lake.bak/query-engine.d.ts +112 -0
- package/dist/lake/lake.bak/query-engine.d.ts.map +1 -0
- package/dist/lake/lake.bak/query-engine.js +370 -0
- package/dist/lake/lake.bak/query-engine.js.map +1 -0
- package/dist/lake/lake.bak/types.d.ts +428 -0
- package/dist/lake/lake.bak/types.d.ts.map +1 -0
- package/dist/lake/lake.bak/types.js +46 -0
- package/dist/lake/lake.bak/types.js.map +1 -0
- package/dist/lake/lake.bak/view-materializer.d.ts +70 -0
- package/dist/lake/lake.bak/view-materializer.d.ts.map +1 -0
- package/dist/lake/lake.bak/view-materializer.js +314 -0
- package/dist/lake/lake.bak/view-materializer.js.map +1 -0
- package/dist/lake/lake.bak/view-store.d.ts +57 -0
- package/dist/lake/lake.bak/view-store.d.ts.map +1 -0
- package/dist/lake/lake.bak/view-store.js +348 -0
- package/dist/lake/lake.bak/view-store.js.map +1 -0
- package/dist/lake/manifest-store.d.ts +51 -0
- package/dist/lake/manifest-store.d.ts.map +1 -0
- package/dist/lake/manifest-store.js +348 -0
- package/dist/lake/manifest-store.js.map +1 -0
- package/dist/lake/pattern-shard-store.d.ts +87 -0
- package/dist/lake/pattern-shard-store.d.ts.map +1 -0
- package/dist/lake/pattern-shard-store.js +347 -0
- package/dist/lake/pattern-shard-store.js.map +1 -0
- package/dist/lake/query-engine.d.ts +124 -0
- package/dist/lake/query-engine.d.ts.map +1 -0
- package/dist/lake/query-engine.js +453 -0
- package/dist/lake/query-engine.js.map +1 -0
- package/dist/lake/security-shard-store.d.ts +156 -0
- package/dist/lake/security-shard-store.d.ts.map +1 -0
- package/dist/lake/security-shard-store.js +498 -0
- package/dist/lake/security-shard-store.js.map +1 -0
- package/dist/lake/types.d.ts +428 -0
- package/dist/lake/types.d.ts.map +1 -0
- package/dist/lake/types.js +46 -0
- package/dist/lake/types.js.map +1 -0
- package/dist/lake/view-materializer.d.ts +70 -0
- package/dist/lake/view-materializer.d.ts.map +1 -0
- package/dist/lake/view-materializer.js +314 -0
- package/dist/lake/view-materializer.js.map +1 -0
- package/dist/lake/view-store.d.ts +57 -0
- package/dist/lake/view-store.d.ts.map +1 -0
- package/dist/lake/view-store.js +348 -0
- package/dist/lake/view-store.js.map +1 -0
- package/dist/parsers/tree-sitter/index.d.ts +1 -0
- package/dist/parsers/tree-sitter/index.d.ts.map +1 -1
- package/dist/parsers/tree-sitter/index.js +4 -0
- package/dist/parsers/tree-sitter/index.js.map +1 -1
- package/dist/parsers/tree-sitter/typescript-loader.d.ts +58 -0
- package/dist/parsers/tree-sitter/typescript-loader.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/typescript-loader.js +250 -0
- package/dist/parsers/tree-sitter/typescript-loader.js.map +1 -0
- package/dist/store/project-config.d.ts +154 -0
- package/dist/store/project-config.d.ts.map +1 -0
- package/dist/store/project-config.js +235 -0
- package/dist/store/project-config.js.map +1 -0
- package/dist/store/project-registry.d.ts +241 -0
- package/dist/store/project-registry.d.ts.map +1 -0
- package/dist/store/project-registry.js +557 -0
- package/dist/store/project-registry.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enrichment Engine Types
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade types for security finding enrichment.
|
|
5
|
+
* Transforms raw vulnerability findings into actionable intelligence
|
|
6
|
+
* by connecting them to their actual data impact through call graph analysis.
|
|
7
|
+
*/
|
|
8
|
+
import type { DataAccessPoint, SensitiveField, SensitivityType, DataOperation } from '../../boundaries/types.js';
|
|
9
|
+
import type { CallPathNode } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Severity levels following CVSS-like classification
|
|
12
|
+
*/
|
|
13
|
+
export type FindingSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
14
|
+
/**
|
|
15
|
+
* Finding categories aligned with CWE/OWASP
|
|
16
|
+
*/
|
|
17
|
+
export type FindingCategory = 'injection' | 'broken-auth' | 'sensitive-exposure' | 'xxe' | 'broken-access' | 'misconfig' | 'xss' | 'deserialization' | 'components' | 'logging' | 'ssrf' | 'other';
|
|
18
|
+
/**
|
|
19
|
+
* A security finding from any scanner (SAST, DAST, SCA, etc.)
|
|
20
|
+
* Designed to be scanner-agnostic - can ingest from Semgrep, CodeQL, Snyk, etc.
|
|
21
|
+
*/
|
|
22
|
+
export interface SecurityFinding {
|
|
23
|
+
/** Unique finding identifier */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Rule/check that triggered this finding */
|
|
26
|
+
ruleId: string;
|
|
27
|
+
/** Human-readable title */
|
|
28
|
+
title: string;
|
|
29
|
+
/** Detailed description */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Finding category */
|
|
32
|
+
category: FindingCategory;
|
|
33
|
+
/** Severity level */
|
|
34
|
+
severity: FindingSeverity;
|
|
35
|
+
/** Source file */
|
|
36
|
+
file: string;
|
|
37
|
+
/** Line number */
|
|
38
|
+
line: number;
|
|
39
|
+
/** Column number */
|
|
40
|
+
column?: number | undefined;
|
|
41
|
+
/** End line (for multi-line findings) */
|
|
42
|
+
endLine?: number | undefined;
|
|
43
|
+
/** End column */
|
|
44
|
+
endColumn?: number | undefined;
|
|
45
|
+
/** Code snippet at the finding location */
|
|
46
|
+
snippet?: string | undefined;
|
|
47
|
+
/** CWE identifiers */
|
|
48
|
+
cwe?: string[] | undefined;
|
|
49
|
+
/** OWASP category */
|
|
50
|
+
owasp?: string[] | undefined;
|
|
51
|
+
/** CVE if applicable (for dependency vulnerabilities) */
|
|
52
|
+
cve?: string | undefined;
|
|
53
|
+
/** CVSS score if available */
|
|
54
|
+
cvss?: number | undefined;
|
|
55
|
+
/** Scanner that produced this finding */
|
|
56
|
+
scanner?: string | undefined;
|
|
57
|
+
/** Scanner-specific metadata */
|
|
58
|
+
metadata?: Record<string, unknown> | undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Classification of data sensitivity for impact scoring
|
|
62
|
+
*/
|
|
63
|
+
export interface DataSensitivityProfile {
|
|
64
|
+
/** Sensitivity type */
|
|
65
|
+
type: SensitivityType;
|
|
66
|
+
/** Regulatory implications */
|
|
67
|
+
regulations: DataRegulation[];
|
|
68
|
+
/** Base impact score (0-100) */
|
|
69
|
+
baseScore: number;
|
|
70
|
+
/** Description of why this is sensitive */
|
|
71
|
+
rationale: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Regulatory frameworks that may apply
|
|
75
|
+
*/
|
|
76
|
+
export type DataRegulation = 'gdpr' | 'ccpa' | 'hipaa' | 'pci-dss' | 'sox' | 'ferpa' | 'glba' | 'coppa' | 'lgpd' | 'pipeda';
|
|
77
|
+
/**
|
|
78
|
+
* A single data access that can be reached from a vulnerability
|
|
79
|
+
*/
|
|
80
|
+
export interface ReachableData {
|
|
81
|
+
/** The data access point */
|
|
82
|
+
access: DataAccessPoint;
|
|
83
|
+
/** Call path from vulnerability to this access */
|
|
84
|
+
callPath: CallPathNode[];
|
|
85
|
+
/** Depth in call graph */
|
|
86
|
+
depth: number;
|
|
87
|
+
/** Sensitive fields accessed */
|
|
88
|
+
sensitiveFields: SensitiveField[];
|
|
89
|
+
/** Operations performed */
|
|
90
|
+
operations: DataOperation[];
|
|
91
|
+
/** Impact score for this specific access (0-100) */
|
|
92
|
+
impactScore: number;
|
|
93
|
+
/** Why this access matters */
|
|
94
|
+
impactRationale: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Aggregated data impact from a vulnerability
|
|
98
|
+
*/
|
|
99
|
+
export interface DataImpact {
|
|
100
|
+
/** All tables that can be reached */
|
|
101
|
+
tables: string[];
|
|
102
|
+
/** All sensitive fields that can be reached */
|
|
103
|
+
sensitiveFields: SensitiveFieldImpact[];
|
|
104
|
+
/** Detailed reachable data with paths */
|
|
105
|
+
reachableData: ReachableData[];
|
|
106
|
+
/** Maximum call depth to reach data */
|
|
107
|
+
maxDepth: number;
|
|
108
|
+
/** Total functions in attack surface */
|
|
109
|
+
attackSurfaceSize: number;
|
|
110
|
+
/** Regulatory implications */
|
|
111
|
+
regulations: DataRegulation[];
|
|
112
|
+
/** Overall data impact score (0-100) */
|
|
113
|
+
score: number;
|
|
114
|
+
/** Impact classification */
|
|
115
|
+
classification: ImpactClassification;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Sensitive field with impact analysis
|
|
119
|
+
*/
|
|
120
|
+
export interface SensitiveFieldImpact {
|
|
121
|
+
/** Field information */
|
|
122
|
+
field: SensitiveField;
|
|
123
|
+
/** Number of paths to reach this field */
|
|
124
|
+
pathCount: number;
|
|
125
|
+
/** Shortest path depth */
|
|
126
|
+
shortestPath: number;
|
|
127
|
+
/** Operations that can be performed */
|
|
128
|
+
operations: DataOperation[];
|
|
129
|
+
/** Regulatory implications for this field */
|
|
130
|
+
regulations: DataRegulation[];
|
|
131
|
+
/** Impact score for this field (0-100) */
|
|
132
|
+
impactScore: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Impact classification levels
|
|
136
|
+
*/
|
|
137
|
+
export type ImpactClassification = 'catastrophic' | 'severe' | 'significant' | 'moderate' | 'minimal' | 'none';
|
|
138
|
+
/**
|
|
139
|
+
* Blast radius - what else could be affected by exploiting this vulnerability
|
|
140
|
+
*/
|
|
141
|
+
export interface BlastRadius {
|
|
142
|
+
/** Entry points that can reach this vulnerability */
|
|
143
|
+
entryPoints: EntryPointInfo[];
|
|
144
|
+
/** Other vulnerabilities that share code paths */
|
|
145
|
+
relatedVulnerabilities: string[];
|
|
146
|
+
/** Functions in the blast radius */
|
|
147
|
+
affectedFunctions: AffectedFunction[];
|
|
148
|
+
/** Total lines of code in blast radius */
|
|
149
|
+
linesOfCode: number;
|
|
150
|
+
/** Blast radius score (0-100) */
|
|
151
|
+
score: number;
|
|
152
|
+
/** Classification */
|
|
153
|
+
classification: BlastRadiusClassification;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Entry point information
|
|
157
|
+
*/
|
|
158
|
+
export interface EntryPointInfo {
|
|
159
|
+
/** Function ID */
|
|
160
|
+
functionId: string;
|
|
161
|
+
/** Function name */
|
|
162
|
+
name: string;
|
|
163
|
+
/** File path */
|
|
164
|
+
file: string;
|
|
165
|
+
/** Line number */
|
|
166
|
+
line: number;
|
|
167
|
+
/** Entry point type */
|
|
168
|
+
type: EntryPointType;
|
|
169
|
+
/** Is this publicly accessible? */
|
|
170
|
+
isPublic: boolean;
|
|
171
|
+
/** Authentication required? */
|
|
172
|
+
requiresAuth: boolean;
|
|
173
|
+
/** Path to vulnerability */
|
|
174
|
+
pathToVulnerability: CallPathNode[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Entry point types
|
|
178
|
+
*/
|
|
179
|
+
export type EntryPointType = 'api-endpoint' | 'web-route' | 'message-handler' | 'scheduled-job' | 'cli-command' | 'exported-function' | 'main';
|
|
180
|
+
/**
|
|
181
|
+
* A function affected by the vulnerability
|
|
182
|
+
*/
|
|
183
|
+
export interface AffectedFunction {
|
|
184
|
+
/** Function ID */
|
|
185
|
+
functionId: string;
|
|
186
|
+
/** Function name */
|
|
187
|
+
name: string;
|
|
188
|
+
/** File path */
|
|
189
|
+
file: string;
|
|
190
|
+
/** Line number */
|
|
191
|
+
line: number;
|
|
192
|
+
/** How this function is affected */
|
|
193
|
+
affectedBy: 'direct' | 'caller' | 'callee';
|
|
194
|
+
/** Distance from vulnerability */
|
|
195
|
+
distance: number;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Blast radius classification
|
|
199
|
+
*/
|
|
200
|
+
export type BlastRadiusClassification = 'critical' | 'high' | 'medium' | 'low' | 'contained';
|
|
201
|
+
/**
|
|
202
|
+
* Priority score components
|
|
203
|
+
*/
|
|
204
|
+
export interface PriorityScore {
|
|
205
|
+
/** Overall priority score (0-100) */
|
|
206
|
+
overall: number;
|
|
207
|
+
/** Severity component */
|
|
208
|
+
severityScore: number;
|
|
209
|
+
/** Data impact component */
|
|
210
|
+
dataImpactScore: number;
|
|
211
|
+
/** Blast radius component */
|
|
212
|
+
blastRadiusScore: number;
|
|
213
|
+
/** Exploitability component */
|
|
214
|
+
exploitabilityScore: number;
|
|
215
|
+
/** Priority tier */
|
|
216
|
+
tier: PriorityTier;
|
|
217
|
+
/** Factors that increased priority */
|
|
218
|
+
increasingFactors: string[];
|
|
219
|
+
/** Factors that decreased priority */
|
|
220
|
+
decreasingFactors: string[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Priority tiers for remediation
|
|
224
|
+
*/
|
|
225
|
+
export type PriorityTier = 'P0' | 'P1' | 'P2' | 'P3' | 'P4';
|
|
226
|
+
/**
|
|
227
|
+
* Remediation guidance
|
|
228
|
+
*/
|
|
229
|
+
export interface RemediationGuidance {
|
|
230
|
+
/** Short summary of what to fix */
|
|
231
|
+
summary: string;
|
|
232
|
+
/** Detailed steps */
|
|
233
|
+
steps: RemediationStep[];
|
|
234
|
+
/** Code examples */
|
|
235
|
+
codeExamples: CodeExample[];
|
|
236
|
+
/** Estimated effort */
|
|
237
|
+
effort: RemediationEffort;
|
|
238
|
+
/** Related documentation */
|
|
239
|
+
references: Reference[];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* A remediation step
|
|
243
|
+
*/
|
|
244
|
+
export interface RemediationStep {
|
|
245
|
+
/** Step number */
|
|
246
|
+
order: number;
|
|
247
|
+
/** Step description */
|
|
248
|
+
description: string;
|
|
249
|
+
/** File to modify (if applicable) */
|
|
250
|
+
file?: string | undefined;
|
|
251
|
+
/** Line to modify (if applicable) */
|
|
252
|
+
line?: number | undefined;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Code example for remediation
|
|
256
|
+
*/
|
|
257
|
+
export interface CodeExample {
|
|
258
|
+
/** Description of the example */
|
|
259
|
+
description: string;
|
|
260
|
+
/** Language */
|
|
261
|
+
language: string;
|
|
262
|
+
/** The vulnerable code */
|
|
263
|
+
vulnerable: string;
|
|
264
|
+
/** The fixed code */
|
|
265
|
+
fixed: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Remediation effort estimate
|
|
269
|
+
*/
|
|
270
|
+
export interface RemediationEffort {
|
|
271
|
+
/** Estimated time */
|
|
272
|
+
time: 'minutes' | 'hours' | 'days' | 'weeks';
|
|
273
|
+
/** Complexity */
|
|
274
|
+
complexity: 'trivial' | 'simple' | 'moderate' | 'complex' | 'architectural';
|
|
275
|
+
/** Risk of regression */
|
|
276
|
+
regressionRisk: 'low' | 'medium' | 'high';
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Reference documentation
|
|
280
|
+
*/
|
|
281
|
+
export interface Reference {
|
|
282
|
+
/** Reference title */
|
|
283
|
+
title: string;
|
|
284
|
+
/** URL */
|
|
285
|
+
url: string;
|
|
286
|
+
/** Reference type */
|
|
287
|
+
type: 'documentation' | 'cwe' | 'owasp' | 'blog' | 'advisory';
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The fully enriched security finding
|
|
291
|
+
*/
|
|
292
|
+
export interface EnrichedFinding {
|
|
293
|
+
/** Original finding */
|
|
294
|
+
finding: SecurityFinding;
|
|
295
|
+
/** Data impact analysis */
|
|
296
|
+
dataImpact: DataImpact;
|
|
297
|
+
/** Blast radius analysis */
|
|
298
|
+
blastRadius: BlastRadius;
|
|
299
|
+
/** Priority score */
|
|
300
|
+
priority: PriorityScore;
|
|
301
|
+
/** Remediation guidance */
|
|
302
|
+
remediation: RemediationGuidance;
|
|
303
|
+
/** Enrichment metadata */
|
|
304
|
+
enrichment: EnrichmentMetadata;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Metadata about the enrichment process
|
|
308
|
+
*/
|
|
309
|
+
export interface EnrichmentMetadata {
|
|
310
|
+
/** When enrichment was performed */
|
|
311
|
+
enrichedAt: string;
|
|
312
|
+
/** Enrichment engine version */
|
|
313
|
+
engineVersion: string;
|
|
314
|
+
/** Call graph version used */
|
|
315
|
+
callGraphVersion: string;
|
|
316
|
+
/** Confidence in the enrichment (0-1) */
|
|
317
|
+
confidence: number;
|
|
318
|
+
/** Warnings or limitations */
|
|
319
|
+
warnings: string[];
|
|
320
|
+
/** Processing time in ms */
|
|
321
|
+
processingTimeMs: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Options for batch enrichment
|
|
325
|
+
*/
|
|
326
|
+
export interface EnrichmentOptions {
|
|
327
|
+
/** Maximum call depth to traverse */
|
|
328
|
+
maxDepth?: number | undefined;
|
|
329
|
+
/** Include unresolved calls in analysis */
|
|
330
|
+
includeUnresolved?: boolean | undefined;
|
|
331
|
+
/** Minimum confidence for data access */
|
|
332
|
+
minConfidence?: number | undefined;
|
|
333
|
+
/** Custom sensitivity mappings */
|
|
334
|
+
sensitivityOverrides?: Record<string, SensitivityType> | undefined;
|
|
335
|
+
/** Custom regulation mappings */
|
|
336
|
+
regulationOverrides?: Record<string, DataRegulation[]> | undefined;
|
|
337
|
+
/** Skip blast radius analysis (faster) */
|
|
338
|
+
skipBlastRadius?: boolean | undefined;
|
|
339
|
+
/** Skip remediation guidance (faster) */
|
|
340
|
+
skipRemediation?: boolean | undefined;
|
|
341
|
+
/** Parallel processing limit */
|
|
342
|
+
parallelLimit?: number | undefined;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Result of batch enrichment
|
|
346
|
+
*/
|
|
347
|
+
export interface EnrichmentResult {
|
|
348
|
+
/** Enriched findings */
|
|
349
|
+
findings: EnrichedFinding[];
|
|
350
|
+
/** Summary statistics */
|
|
351
|
+
summary: EnrichmentSummary;
|
|
352
|
+
/** Processing metadata */
|
|
353
|
+
metadata: BatchMetadata;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Summary of enrichment results
|
|
357
|
+
*/
|
|
358
|
+
export interface EnrichmentSummary {
|
|
359
|
+
/** Total findings processed */
|
|
360
|
+
totalFindings: number;
|
|
361
|
+
/** Findings by priority tier */
|
|
362
|
+
byPriority: Record<PriorityTier, number>;
|
|
363
|
+
/** Findings by impact classification */
|
|
364
|
+
byImpact: Record<ImpactClassification, number>;
|
|
365
|
+
/** Findings by category */
|
|
366
|
+
byCategory: Record<FindingCategory, number>;
|
|
367
|
+
/** Total sensitive fields at risk */
|
|
368
|
+
sensitiveFieldsAtRisk: number;
|
|
369
|
+
/** Total tables at risk */
|
|
370
|
+
tablesAtRisk: number;
|
|
371
|
+
/** Regulations implicated */
|
|
372
|
+
regulationsImplicated: DataRegulation[];
|
|
373
|
+
/** Top priority findings */
|
|
374
|
+
topPriority: EnrichedFinding[];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Batch processing metadata
|
|
378
|
+
*/
|
|
379
|
+
export interface BatchMetadata {
|
|
380
|
+
/** Processing start time */
|
|
381
|
+
startedAt: string;
|
|
382
|
+
/** Processing end time */
|
|
383
|
+
completedAt: string;
|
|
384
|
+
/** Total processing time in ms */
|
|
385
|
+
totalTimeMs: number;
|
|
386
|
+
/** Average time per finding in ms */
|
|
387
|
+
avgTimePerFindingMs: number;
|
|
388
|
+
/** Findings that failed enrichment */
|
|
389
|
+
failures: EnrichmentFailure[];
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Enrichment failure information
|
|
393
|
+
*/
|
|
394
|
+
export interface EnrichmentFailure {
|
|
395
|
+
/** Finding ID */
|
|
396
|
+
findingId: string;
|
|
397
|
+
/** Error message */
|
|
398
|
+
error: string;
|
|
399
|
+
/** Error type */
|
|
400
|
+
type: 'not-found' | 'parse-error' | 'timeout' | 'unknown';
|
|
401
|
+
}
|
|
402
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../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,iBAAiB;IAChC,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB;IACjB,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAAC;CAC3D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enrichment Engine Types
|
|
3
|
+
*
|
|
4
|
+
* Enterprise-grade types for security finding enrichment.
|
|
5
|
+
* Transforms raw vulnerability findings into actionable intelligence
|
|
6
|
+
* by connecting them to their actual data impact through call graph analysis.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/call-graph/enrichment/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Call Graph Extractor
|
|
3
|
+
*
|
|
4
|
+
* Abstract base class for language-specific extractors.
|
|
5
|
+
* Provides common utilities and defines the extraction interface.
|
|
6
|
+
*/
|
|
7
|
+
import type { CallGraphLanguage, FileExtractionResult, FunctionExtraction, CallExtraction, ImportExtraction, ExportExtraction, ClassExtraction, ParameterInfo } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Abstract base class for call graph extractors
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BaseCallGraphExtractor {
|
|
12
|
+
/** Language this extractor handles */
|
|
13
|
+
abstract readonly language: CallGraphLanguage;
|
|
14
|
+
/** File extensions this extractor handles */
|
|
15
|
+
abstract readonly extensions: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Extract functions, calls, imports, and exports from source code
|
|
18
|
+
*/
|
|
19
|
+
abstract extract(source: string, filePath: string): FileExtractionResult;
|
|
20
|
+
/**
|
|
21
|
+
* Check if this extractor can handle a file
|
|
22
|
+
*/
|
|
23
|
+
canHandle(filePath: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get file extension
|
|
26
|
+
*/
|
|
27
|
+
protected getExtension(filePath: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a unique function ID
|
|
30
|
+
*/
|
|
31
|
+
protected generateFunctionId(file: string, name: string, line: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Create an empty extraction result
|
|
34
|
+
*/
|
|
35
|
+
protected createEmptyResult(file: string): FileExtractionResult;
|
|
36
|
+
/**
|
|
37
|
+
* Create a function extraction
|
|
38
|
+
*/
|
|
39
|
+
protected createFunction(opts: {
|
|
40
|
+
name: string;
|
|
41
|
+
qualifiedName?: string;
|
|
42
|
+
startLine: number;
|
|
43
|
+
endLine: number;
|
|
44
|
+
startColumn?: number;
|
|
45
|
+
endColumn?: number;
|
|
46
|
+
parameters?: ParameterInfo[];
|
|
47
|
+
returnType?: string | undefined;
|
|
48
|
+
isMethod?: boolean;
|
|
49
|
+
isStatic?: boolean;
|
|
50
|
+
isExported?: boolean;
|
|
51
|
+
isConstructor?: boolean;
|
|
52
|
+
isAsync?: boolean;
|
|
53
|
+
className?: string | undefined;
|
|
54
|
+
moduleName?: string | undefined;
|
|
55
|
+
decorators?: string[];
|
|
56
|
+
bodyStartLine?: number;
|
|
57
|
+
bodyEndLine?: number;
|
|
58
|
+
}): FunctionExtraction;
|
|
59
|
+
/**
|
|
60
|
+
* Create a call extraction
|
|
61
|
+
*/
|
|
62
|
+
protected createCall(opts: {
|
|
63
|
+
calleeName: string;
|
|
64
|
+
receiver?: string | undefined;
|
|
65
|
+
fullExpression?: string;
|
|
66
|
+
line: number;
|
|
67
|
+
column?: number;
|
|
68
|
+
argumentCount?: number;
|
|
69
|
+
isMethodCall?: boolean;
|
|
70
|
+
isConstructorCall?: boolean;
|
|
71
|
+
}): CallExtraction;
|
|
72
|
+
/**
|
|
73
|
+
* Create an import extraction
|
|
74
|
+
*/
|
|
75
|
+
protected createImport(opts: {
|
|
76
|
+
source: string;
|
|
77
|
+
names: Array<{
|
|
78
|
+
imported: string;
|
|
79
|
+
local?: string;
|
|
80
|
+
isDefault?: boolean;
|
|
81
|
+
isNamespace?: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
line: number;
|
|
84
|
+
isTypeOnly?: boolean;
|
|
85
|
+
}): ImportExtraction;
|
|
86
|
+
/**
|
|
87
|
+
* Create an export extraction
|
|
88
|
+
*/
|
|
89
|
+
protected createExport(opts: {
|
|
90
|
+
name: string;
|
|
91
|
+
isDefault?: boolean;
|
|
92
|
+
isReExport?: boolean;
|
|
93
|
+
source?: string | undefined;
|
|
94
|
+
line: number;
|
|
95
|
+
}): ExportExtraction;
|
|
96
|
+
/**
|
|
97
|
+
* Create a class extraction
|
|
98
|
+
*/
|
|
99
|
+
protected createClass(opts: {
|
|
100
|
+
name: string;
|
|
101
|
+
startLine: number;
|
|
102
|
+
endLine: number;
|
|
103
|
+
baseClasses?: string[];
|
|
104
|
+
methods?: string[];
|
|
105
|
+
isExported?: boolean;
|
|
106
|
+
}): ClassExtraction;
|
|
107
|
+
/**
|
|
108
|
+
* Parse parameter string into ParameterInfo
|
|
109
|
+
*/
|
|
110
|
+
protected parseParameter(name: string, type?: string, hasDefault?: boolean, isRest?: boolean): ParameterInfo;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=base-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-extractor.d.ts","sourceRoot":"","sources":["../../../src/call-graph/extractors/base-extractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACd,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,8BAAsB,sBAAsB;IAC1C,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,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C;QACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,GAAG,eAAe;IAWnB;;OAEG;IACH,SAAS,CAAC,cAAc,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,UAAQ,EAClB,MAAM,UAAQ,GACb,aAAa;CAGjB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Call Graph Extractor
|
|
3
|
+
*
|
|
4
|
+
* Abstract base class for language-specific extractors.
|
|
5
|
+
* Provides common utilities and defines the extraction interface.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Abstract base class for call graph extractors
|
|
9
|
+
*/
|
|
10
|
+
export class BaseCallGraphExtractor {
|
|
11
|
+
/**
|
|
12
|
+
* Check if this extractor can handle a file
|
|
13
|
+
*/
|
|
14
|
+
canHandle(filePath) {
|
|
15
|
+
const ext = this.getExtension(filePath);
|
|
16
|
+
return this.extensions.includes(ext);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get file extension
|
|
20
|
+
*/
|
|
21
|
+
getExtension(filePath) {
|
|
22
|
+
const lastDot = filePath.lastIndexOf('.');
|
|
23
|
+
return lastDot >= 0 ? filePath.slice(lastDot) : '';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generate a unique function ID
|
|
27
|
+
*/
|
|
28
|
+
generateFunctionId(file, name, line) {
|
|
29
|
+
return `${file}:${name}:${line}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create an empty extraction result
|
|
33
|
+
*/
|
|
34
|
+
createEmptyResult(file) {
|
|
35
|
+
return {
|
|
36
|
+
file,
|
|
37
|
+
language: this.language,
|
|
38
|
+
functions: [],
|
|
39
|
+
calls: [],
|
|
40
|
+
imports: [],
|
|
41
|
+
exports: [],
|
|
42
|
+
classes: [],
|
|
43
|
+
errors: [],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a function extraction
|
|
48
|
+
*/
|
|
49
|
+
createFunction(opts) {
|
|
50
|
+
// Use provided qualifiedName or compute from className/moduleName
|
|
51
|
+
const qualifiedName = opts.qualifiedName ?? (opts.className
|
|
52
|
+
? `${opts.className}.${opts.name}`
|
|
53
|
+
: opts.moduleName
|
|
54
|
+
? `${opts.moduleName}.${opts.name}`
|
|
55
|
+
: opts.name);
|
|
56
|
+
return {
|
|
57
|
+
name: opts.name,
|
|
58
|
+
qualifiedName,
|
|
59
|
+
startLine: opts.startLine,
|
|
60
|
+
endLine: opts.endLine,
|
|
61
|
+
startColumn: opts.startColumn ?? 0,
|
|
62
|
+
endColumn: opts.endColumn ?? 0,
|
|
63
|
+
parameters: opts.parameters ?? [],
|
|
64
|
+
returnType: opts.returnType,
|
|
65
|
+
isMethod: opts.isMethod ?? false,
|
|
66
|
+
isStatic: opts.isStatic ?? false,
|
|
67
|
+
isExported: opts.isExported ?? false,
|
|
68
|
+
isConstructor: opts.isConstructor ?? false,
|
|
69
|
+
isAsync: opts.isAsync ?? false,
|
|
70
|
+
className: opts.className,
|
|
71
|
+
moduleName: opts.moduleName,
|
|
72
|
+
decorators: opts.decorators ?? [],
|
|
73
|
+
bodyStartLine: opts.bodyStartLine ?? opts.startLine,
|
|
74
|
+
bodyEndLine: opts.bodyEndLine ?? opts.endLine,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a call extraction
|
|
79
|
+
*/
|
|
80
|
+
createCall(opts) {
|
|
81
|
+
return {
|
|
82
|
+
calleeName: opts.calleeName,
|
|
83
|
+
receiver: opts.receiver,
|
|
84
|
+
fullExpression: opts.fullExpression ?? opts.calleeName,
|
|
85
|
+
line: opts.line,
|
|
86
|
+
column: opts.column ?? 0,
|
|
87
|
+
argumentCount: opts.argumentCount ?? 0,
|
|
88
|
+
isMethodCall: opts.isMethodCall ?? !!opts.receiver,
|
|
89
|
+
isConstructorCall: opts.isConstructorCall ?? false,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create an import extraction
|
|
94
|
+
*/
|
|
95
|
+
createImport(opts) {
|
|
96
|
+
return {
|
|
97
|
+
source: opts.source,
|
|
98
|
+
names: opts.names.map((n) => ({
|
|
99
|
+
imported: n.imported,
|
|
100
|
+
local: n.local ?? n.imported,
|
|
101
|
+
isDefault: n.isDefault ?? false,
|
|
102
|
+
isNamespace: n.isNamespace ?? false,
|
|
103
|
+
})),
|
|
104
|
+
line: opts.line,
|
|
105
|
+
isTypeOnly: opts.isTypeOnly ?? false,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create an export extraction
|
|
110
|
+
*/
|
|
111
|
+
createExport(opts) {
|
|
112
|
+
return {
|
|
113
|
+
name: opts.name,
|
|
114
|
+
isDefault: opts.isDefault ?? false,
|
|
115
|
+
isReExport: opts.isReExport ?? false,
|
|
116
|
+
source: opts.source,
|
|
117
|
+
line: opts.line,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a class extraction
|
|
122
|
+
*/
|
|
123
|
+
createClass(opts) {
|
|
124
|
+
return {
|
|
125
|
+
name: opts.name,
|
|
126
|
+
startLine: opts.startLine,
|
|
127
|
+
endLine: opts.endLine,
|
|
128
|
+
baseClasses: opts.baseClasses ?? [],
|
|
129
|
+
methods: opts.methods ?? [],
|
|
130
|
+
isExported: opts.isExported ?? false,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Parse parameter string into ParameterInfo
|
|
135
|
+
*/
|
|
136
|
+
parseParameter(name, type, hasDefault = false, isRest = false) {
|
|
137
|
+
return { name, type, hasDefault, isRest };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=base-extractor.js.map
|