Classes
Query
Defined in: index.ts:204
The Query class is used to search the graph for nodes and edges using the Dependency Selector Syntax (DSS).
Constructors
new Query()
new Query(__namedParameters): QueryDefined in: index.ts:257
Parameters
__namedParameters
Returns
Methods
search()
search(query, __namedParameters): Promise<QueryResponse>Defined in: index.ts:454
Search the graph for nodes and edges that match the given query.
Parameters
query
string
__namedParameters
Returns
Promise<QueryResponse>
getQueryTokens()
static getQueryTokens(query): ParsedSelectorToken[]Defined in: index.ts:546
Parses a query string in order to retrieve an array of tokens.
Parameters
query
string
Returns
hasSecuritySelectors()
static hasSecuritySelectors(query): booleanDefined in: index.ts:219
Helper method to determine if a given query string is using any of the known security selectors. This is useful so that operations can skip hydrating the security archive if it’s not needed.
Parameters
query
string
Returns
boolean
specificitySort()
static specificitySort(responses): QueryResponse[]Defined in: index.ts:234
Sorts an array of QueryResponse objects by specificity. Objects with higher idCounter values come first, if idCounter values are equal, then objects with higher commonCounter values come first. Otherwise, the original order is preserved.
Parameters
responses
Returns
Type Aliases
DiffFilesProvider()
type DiffFilesProvider = (commitish) => Set<string>Defined in: types.ts:37
Callback that returns changed file paths for a given commitish reference. Used by the :diff() pseudo selector. The returned paths should be relative to the project root.
Parameters
commitish
string
Returns
Set<string>
GraphSelectionState
type GraphSelectionState = objectDefined in: types.ts:27
Type declaration
edges
edges: Set<EdgeLike>nodes
nodes: Set<NodeLike>HostContextsMap
type HostContextsMap = Map< string, () => Promise<HostContextsMapResult>>Defined in: types.ts:17
HostContextsMapResult
type HostContextsMapResult = objectDefined in: types.ts:9
Type declaration
edges
edges: EdgeLike[];initialEdges
initialEdges: EdgeLike[];initialNodes
initialNodes: NodeLike[];nodes
nodes: NodeLike[];securityArchive
securityArchive: | SecurityArchiveLike | undefined;Insights
type Insights = objectDefined in: types.ts:99
Type declaration
abandoned?
optional abandoned: boolean;confused?
optional confused: boolean;cve?
optional cve: `CVE-${string}`[];cwe?
optional cwe: `CWE-${string}`[];debug?
optional debug: boolean;deprecated?
optional deprecated: boolean;dynamic?
optional dynamic: boolean;entropic?
optional entropic: boolean;env?
optional env: boolean;eval?
optional eval: boolean;fs?
optional fs: boolean;license?
optional license: LicenseInsights;malware?
optional malware: MalwareInsights;minified?
optional minified: boolean;native?
optional native: boolean;network?
optional network: boolean;obfuscated?
optional obfuscated: boolean;scanned
scanned: booleanscore?
optional score: PackageScore;scripts?
optional scripts: boolean;severity?
optional severity: SeverityInsights;shell?
optional shell: boolean;shrinkwrap?
optional shrinkwrap: boolean;squat?
optional squat: SquatInsights;suspicious?
optional suspicious: boolean;tracker?
optional tracker: boolean;trivial?
optional trivial: boolean;undesirable?
optional undesirable: boolean;unknown?
optional unknown: boolean;unmaintained?
optional unmaintained: boolean;unpopular?
optional unpopular: boolean;unstable?
optional unstable: boolean;LeveledInsights
type LeveledInsights = objectDefined in: types.ts:145
Type declaration
critical
critical: booleanhigh
high: booleanlow
low: booleanmedium
medium: booleanLicenseInsights
type LicenseInsights = objectDefined in: types.ts:134
Type declaration
ambiguous
ambiguous: booleancopyleft
copyleft: booleanexception
exception: booleanmisc
misc: booleannone
none: booleanrestricted
restricted: booleanunknown
unknown: booleanunlicensed
unlicensed: booleanMalwareInsights
type MalwareInsights = LeveledInsightsDefined in: types.ts:152
ParsedSelectorToken
type ParsedSelectorToken = PostcssNode & objectDefined in: types.ts:162
Type declaration
token
token: stringParserFn()
type ParserFn = (opt) => Promise<ParserState>Defined in: types.ts:160
Parameters
opt
Returns
Promise<ParserState>
ParserState
type ParserState = objectDefined in: types.ts:39
Type declaration
cancellable()
cancellable: () => Promise<void>Returns
Promise<void>
collect
collect: GraphSelectionStatecomment
comment: stringcurrent
current: PostcssNodediffFiles?
optional diffFiles: DiffFilesProvider;hostContexts?
optional hostContexts: HostContextsMap;importers
importers: Set<NodeLike>initial
initial: GraphSelectionStateloose?
optional loose: boolean;next?
optional next: PostcssNode;partial
partial: GraphSelectionStateprev?
optional prev: PostcssNode;result?
optional result: NodeLike[];retries
retries: numberscopeIDs?
optional scopeIDs: DepID[];securityArchive
securityArchive: | SecurityArchiveLike | undefined;signal
signal: AbortSignalspecificity
specificity: Specificitywalk
walk: ParserFnQueryOptions
type QueryOptions = objectDefined in: index.ts:144
Type declaration
diffFiles?
optional diffFiles: DiffFilesProvider;edges
edges: Set<EdgeLike>hostContexts?
optional hostContexts: HostContextsMap;importers
importers: Set<NodeLike>nodes
nodes: Set<NodeLike>retries?
optional retries: number;securityArchive
securityArchive: | SecurityArchiveLike | undefined;QueryResponse
type QueryResponse = objectDefined in: types.ts:61
Type declaration
comment
comment: stringedges
edges: QueryResponseEdge[];importers
importers: QueryResponseNode[];nodes
nodes: QueryResponseNode[];specificity
specificity: SpecificityQueryResponseEdge
type QueryResponseEdge = Omit<EdgeLike, 'from' | 'to'> & objectDefined in: types.ts:69
Type declaration
from
from: QueryResponseNodeto?
optional to: QueryResponseNode;QueryResponseNode
type QueryResponseNode = Omit<NodeLike, 'edgesIn' | 'edgesOut'> & objectDefined in: types.ts:74
Type declaration
edgesIn
edgesIn: Set<QueryResponseEdge>edgesOut
edgesOut: Map<string, QueryResponseEdge>insights
insights: InsightstoJSON()
toJSON: () => Pick< QueryResponseNode, | 'id' | 'name' | 'version' | 'location' | 'importer' | 'manifest' | 'projectRoot' | 'integrity' | 'resolved' | 'dev' | 'optional' | 'insights' | 'confused' >Returns
Pick<QueryResponseNode, | "id" |
"name" | "version" | "location" | "importer" |
"manifest" | "projectRoot" | "integrity" | "resolved" |
"dev" | "optional" | "insights" | "confused">
SearchOptions
type SearchOptions = objectDefined in: index.ts:36
Type declaration
scopeIDs?
optional scopeIDs: DepID[];signal
signal: AbortSignalSeverityInsights
type SeverityInsights = LeveledInsightsDefined in: types.ts:153
Specificity
type Specificity = objectDefined in: types.ts:22
Type declaration
commonCounter
commonCounter: numberidCounter
idCounter: numberSquatInsights
type SquatInsights = objectDefined in: types.ts:155
Type declaration
critical
critical: booleanmedium
medium: booleanFunctions
walk()
function walk(state): Promise<ParserState>Defined in: index.ts:86
Parameters
state
Returns
Promise<ParserState>