vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • Reference
  • Classes
  • Query
  • Type Aliases
  • DiffFilesProvider()
  • GetAuthHeader()
  • GraphSelectionState
  • HostContextsMap
  • HostContextsMapResult
  • Insights
  • LeveledInsights
  • LicenseInsights
  • ParsedSelectorToken
  • ParserFn()
  • ParserState
  • QueryOptions
  • QueryResponse
  • QueryResponseEdge
  • QueryResponseNode
  • SearchOptions
  • SeverityInsights
  • Specificity
  • SquatInsights
  • VulnInsights
  • Functions
  • walk()
  1. Client
  2. /
  3. API Reference
  4. /
  5. @vltpkg/query
  6. /
  7. Reference

Reference

Classes

Query

Defined in: index.ts:222

The Query class is used to search the graph for nodes and edges using the Dependency Selector Syntax (DSS).

Constructors

new Query()
TypeScript
new Query(__namedParameters): Query

Defined in: index.ts:276

Parameters
ParameterType
__namedParametersQueryOptions
Returns

Query

Methods

search()
TypeScript
search(query, __namedParameters): Promise<QueryResponse>

Defined in: index.ts:480

Search the graph for nodes and edges that match the given query.

Parameters
ParameterType
querystring
__namedParametersSearchOptions
Returns

Promise<QueryResponse>

getQueryTokens()
TypeScript
static getQueryTokens(query): ParsedSelectorToken[]

Defined in: index.ts:573

Parses a query string in order to retrieve an array of tokens.

Parameters
ParameterType
querystring
Returns

ParsedSelectorToken[]

hasSecuritySelectors()
TypeScript
static hasSecuritySelectors(query): boolean

Defined in: index.ts:238

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
ParameterType
querystring
Returns

boolean

specificitySort()
TypeScript
static specificitySort(responses): QueryResponse[]

Defined in: index.ts:253

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
ParameterType
responsesQueryResponse[]
Returns

QueryResponse[]

Type Aliases

DiffFilesProvider()

TypeScript
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

ParameterType
commitishstring

Returns

Set<string>


GetAuthHeader()

TypeScript
type GetAuthHeader = (url) => Promise<string | undefined>;

Defined in: types.ts:45

Callback that returns the authorization header value to use when fetching data from a registry URL, e.g. by the :outdated() pseudo selector. Keeps the browser-safe query package free of any direct keychain / registry-client dependency.

Parameters

ParameterType
urlstring

Returns

Promise<string | undefined>


GraphSelectionState

TypeScript
type GraphSelectionState = object;

Defined in: types.ts:27

Type declaration

NameType
edgesSet<EdgeLike>
nodesSet<NodeLike>

HostContextsMap

TypeScript
type HostContextsMap = Map<string, () => Promise<HostContextsMapResult>>;

Defined in: types.ts:17


HostContextsMapResult

TypeScript
type HostContextsMapResult = object;

Defined in: types.ts:9

Type declaration

NameType
edgesEdgeLike[]
initialEdgesEdgeLike[]
initialNodesNodeLike[]
nodesNodeLike[]
securityArchive| SecurityArchiveLike | undefined

Insights

TypeScript
type Insights = object;

Defined in: types.ts:110

Type declaration

NameType
abandoned?boolean
confused?boolean
cve?`CVE-${string}`[]
cwe?`CWE-${string}`[]
debug?boolean
deprecated?boolean
dynamic?boolean
entropic?boolean
env?boolean
eval?boolean
fs?boolean
license?LicenseInsights
malware?boolean
minified?boolean
native?boolean
network?boolean
obfuscated?boolean
scannedboolean
score?PackageScore
scripts?boolean
severity?SeverityInsights
shell?boolean
shrinkwrap?boolean
squat?SquatInsights
suspicious?boolean
tracker?boolean
trivial?boolean
undesirable?boolean
unknown?boolean
unmaintained?boolean
unpopular?boolean
unstable?boolean
vuln?VulnInsights

LeveledInsights

TypeScript
type LeveledInsights = object;

Defined in: types.ts:157

Type declaration

NameType
criticalboolean
highboolean
lowboolean
mediumboolean

LicenseInsights

TypeScript
type LicenseInsights = object;

Defined in: types.ts:146

Type declaration

NameType
ambiguousboolean
copyleftboolean
exceptionboolean
miscboolean
noneboolean
restrictedboolean
unknownboolean
unlicensedboolean

ParsedSelectorToken

TypeScript
type ParsedSelectorToken = PostcssNode & object;

Defined in: types.ts:174

Type declaration

NameType
tokenstring

ParserFn()

TypeScript
type ParserFn = (opt) => Promise<ParserState>;

Defined in: types.ts:172

Parameters

ParameterType
optParserState

Returns

Promise<ParserState>


ParserState

TypeScript
type ParserState = object;

Defined in: types.ts:49

Type declaration

NameType
cancellable() => Promise<void>
collectGraphSelectionState
commentstring
currentPostcssNode
diffFiles?DiffFilesProvider
getAuthHeader?GetAuthHeader
hostContexts?HostContextsMap
importersSet<NodeLike>
initialGraphSelectionState
loose?boolean
next?PostcssNode
partialGraphSelectionState
prev?PostcssNode
result?NodeLike[]
retriesnumber
scopeIDs?DepID[]
securityArchive| SecurityArchiveLike | undefined
signalAbortSignal
specificitySpecificity
walkParserFn

QueryOptions

TypeScript
type QueryOptions = object;

Defined in: index.ts:159

Type declaration

NameType
diffFiles?DiffFilesProvider
edgesSet<EdgeLike>
getAuthHeader?GetAuthHeader
hostContexts?HostContextsMap
importersSet<NodeLike>
nodesSet<NodeLike>
retries?number
securityArchive| SecurityArchiveLike | undefined

QueryResponse

TypeScript
type QueryResponse = object;

Defined in: types.ts:72

Type declaration

NameType
commentstring
edgesQueryResponseEdge[]
importersQueryResponseNode[]
nodesQueryResponseNode[]
specificitySpecificity

QueryResponseEdge

TypeScript
type QueryResponseEdge = Omit<EdgeLike, "from" | "to"> & object;

Defined in: types.ts:80

Type declaration

NameType
fromQueryResponseNode
to?QueryResponseNode

QueryResponseNode

TypeScript
type QueryResponseNode = Omit<NodeLike, "edgesIn" | "edgesOut"> & object;

Defined in: types.ts:85

Type declaration

NameType
edgesInSet<QueryResponseEdge>
edgesOutMap<string, QueryResponseEdge>
insightsInsights
toJSON() => Pick<QueryResponseNode, | "id" | "name" | "version" | "location" | "importer" | "manifest" | "projectRoot" | "integrity" | "resolved" | "dev" | "optional" | "insights" | "confused">

SearchOptions

TypeScript
type SearchOptions = object;

Defined in: index.ts:37

Type declaration

NameType
scopeIDs?DepID[]
signalAbortSignal

SeverityInsights

TypeScript
type SeverityInsights = LeveledInsights;

Defined in: types.ts:164


Specificity

TypeScript
type Specificity = object;

Defined in: types.ts:22

Type declaration

NameType
commonCounternumber
idCounternumber

SquatInsights

TypeScript
type SquatInsights = object;

Defined in: types.ts:167

Type declaration

NameType
criticalboolean
mediumboolean

VulnInsights

TypeScript
type VulnInsights = LeveledInsights;

Defined in: types.ts:165

Functions

walk()

TypeScript
function walk(state): Promise<ParserState>

Defined in: index.ts:103

Parameters

ParameterType
stateParserState

Returns

Promise<ParserState>


Previous@vltpkg/queryNext@vltpkg/registry-client

On this page

  • Classes
  • Query
  • Type Aliases
  • DiffFilesProvider()
  • GetAuthHeader()
  • GraphSelectionState
  • HostContextsMap
  • HostContextsMapResult
  • Insights
  • LeveledInsights
  • LicenseInsights
  • ParsedSelectorToken
  • ParserFn()
  • ParserState
  • QueryOptions
  • QueryResponse
  • QueryResponseEdge
  • QueryResponseNode
  • SearchOptions
  • SeverityInsights
  • Specificity
  • SquatInsights
  • VulnInsights
  • Functions
  • walk()

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now