Classes
Query
Defined in: index.ts:202
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): Query
Defined in: index.ts:254
Parameters
__namedParameters
Returns
Methods
search()
search(query, __namedParameters): Promise<QueryResponse>
Defined in: index.ts:449
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:540
Parses a query string in order to retrieve an array of tokens.
Parameters
query
string
Returns
hasSecuritySelectors()
static hasSecuritySelectors(query): boolean
Defined in: index.ts:216
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:231
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
GraphSelectionState
type GraphSelectionState = object
Defined 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 = object
Defined 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 = object
Defined in: types.ts:91
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: boolean
score?
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 = object
Defined in: types.ts:137
Type declaration
critical
critical: boolean
high
high: boolean
low
low: boolean
medium
medium: boolean
LicenseInsights
type LicenseInsights = object
Defined in: types.ts:126
Type declaration
ambiguous
ambiguous: boolean
copyleft
copyleft: boolean
exception
exception: boolean
misc
misc: boolean
none
none: boolean
restricted
restricted: boolean
unknown
unknown: boolean
unlicensed
unlicensed: boolean
MalwareInsights
type MalwareInsights = LeveledInsights
Defined in: types.ts:144
ParsedSelectorToken
type ParsedSelectorToken = PostcssNode & object
Defined in: types.ts:154
Type declaration
token
token: string
ParserFn()
type ParserFn = (opt) => Promise<ParserState>
Defined in: types.ts:152
Parameters
opt
Returns
Promise
<ParserState
>
ParserState
type ParserState = object
Defined in: types.ts:32
Type declaration
cancellable()
cancellable: () => Promise<void>
Returns
Promise
<void
>
collect
collect: GraphSelectionState
comment
comment: string
current
current: PostcssNode
hostContexts?
optional hostContexts: HostContextsMap;
importers
importers: Set<NodeLike>
initial
initial: GraphSelectionState
loose?
optional loose: boolean;
next?
optional next: PostcssNode;
partial
partial: GraphSelectionState
prev?
optional prev: PostcssNode;
result?
optional result: NodeLike[];
retries
retries: number
scopeIDs?
optional scopeIDs: DepID[];
securityArchive
securityArchive: | SecurityArchiveLike | undefined;
signal
signal: AbortSignal
specificity
specificity: Specificity
walk
walk: ParserFn
QueryOptions
type QueryOptions = object
Defined in: index.ts:143
Type declaration
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 = object
Defined in: types.ts:53
Type declaration
comment
comment: string
edges
edges: QueryResponseEdge[];
importers
importers: QueryResponseNode[];
nodes
nodes: QueryResponseNode[];
specificity
specificity: Specificity
QueryResponseEdge
type QueryResponseEdge = Omit<EdgeLike, 'from' | 'to'> & object
Defined in: types.ts:61
Type declaration
from
from: QueryResponseNode
to?
optional to: QueryResponseNode;
QueryResponseNode
type QueryResponseNode = Omit<NodeLike, 'edgesIn' | 'edgesOut'> & object
Defined in: types.ts:66
Type declaration
edgesIn
edgesIn: Set<QueryResponseEdge>
edgesOut
edgesOut: Map<string, QueryResponseEdge>
insights
insights: Insights
toJSON()
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 = object
Defined in: index.ts:35
Type declaration
scopeIDs?
optional scopeIDs: DepID[];
signal
signal: AbortSignal
SeverityInsights
type SeverityInsights = LeveledInsights
Defined in: types.ts:145
Specificity
type Specificity = object
Defined in: types.ts:22
Type declaration
commonCounter
commonCounter: number
idCounter
idCounter: number
SquatInsights
type SquatInsights = object
Defined in: types.ts:147
Type declaration
critical
critical: boolean
medium
medium: boolean
Functions
walk()
function walk(state): Promise<ParserState>
Defined in: index.ts:85
Parameters
state
Returns
Promise
<ParserState
>