vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • Reference
  • Classes
  • Query
  • Type Aliases
  • DiffFilesProvider()
  • GetAuthHeader()
  • GraphSelectionState
  • HasSkills()
  • HostContextsMap
  • HostContextsMapResult
  • Insights
  • LeveledInsights
  • LicenseInsights
  • ParsedSelectorToken
  • ParserFn()
  • ParserState
  • QueryOptions
  • QueryPart<N>
  • 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:239

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:295

Parameters
ParameterType
__namedParametersQueryOptions
Returns

Query

Methods

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

Defined in: index.ts:503

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:603

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:257

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:272

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>

HasSkills()

TypeScript
type HasSkills = (node) => Promise<boolean>;

Defined in: types.ts:53

Whether an installed package ships agent skills; for :skills. Keeps fs out of this package.

Parameters

ParameterType
nodeNodeLike

Returns

Promise<boolean>


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:140

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:187

Type declaration

NameType
criticalboolean
highboolean
lowboolean
mediumboolean

LicenseInsights

TypeScript
type LicenseInsights = object;

Defined in: types.ts:176

Type declaration

NameType
ambiguousboolean
copyleftboolean
exceptionboolean
miscboolean
noneboolean
restrictedboolean
unknownboolean
unlicensedboolean

ParsedSelectorToken

TypeScript
type ParsedSelectorToken = PostcssNode & object;

Defined in: types.ts:204

Type declaration

NameType
tokenstring

ParserFn()

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

Defined in: types.ts:202

Parameters

ParameterType
optParserState

Returns

Promise<ParserState>


ParserState

TypeScript
type ParserState = object;

Defined in: types.ts:67

Type declaration

NameTypeDescription
cancellable() => Promise<void>-
collectGraphSelectionState-
commentstring-
currentPostcssNode-
diffFiles?DiffFilesProvider-
getAuthHeader?GetAuthHeader-
hasSkills?HasSkills-
hostContexts?HostContextsMap-
importersSet<NodeLike>-
initialGraphSelectionState-
loose?boolean-
next?PostcssNode-
part?Pick<QueryPart, "name" | "patterns">set by :skill(), read and cleared by walk()
partialGraphSelectionState-
parts?QueryPart<NodeLike>[]one entry per top-level selector, only when opted in
partSelectors?ReadonlySet<PartPseudoName>part selectors this consumer allows
prev?PostcssNode-
result?NodeLike[]-
retriesnumber-
scopeIDs?DepID[]-
securityArchive| SecurityArchiveLike | undefined-
signalAbortSignal-
specificitySpecificity-
walkParserFn-

QueryOptions

TypeScript
type QueryOptions = object;

Defined in: index.ts:172

Type declaration

NameTypeDescription
diffFiles?DiffFilesProvider-
edgesSet<EdgeLike>-
getAuthHeader?GetAuthHeader-
hasSkills?HasSkillsfor :skills; unset: :skills throws
hostContexts?HostContextsMap-
importersSet<NodeLike>-
nodesSet<NodeLike>-
partSelectors?readonly PartPseudoName[]part selectors to allow, e.g. ['skill']; others throw
retries?number-
securityArchive| SecurityArchiveLike | undefined-

QueryPart<N>

TypeScript
type QueryPart<N> = object;

Defined in: types.ts:60

One top-level selector of a query and the nodes it matched. name and patterns are set when it ends in a part selector, e.g. #a:skill(x, y*).

Type Parameters

Type ParameterDefault type
NQueryResponseNode

Type declaration

NameTypeDescription
name?PartPseudoName-
nodesN[]-
patterns?string[]as typed, * = glob; for matching only, never paths

QueryResponse

TypeScript
type QueryResponse = object;

Defined in: types.ts:97

Type declaration

NameTypeDescription
commentstring-
edgesQueryResponseEdge[]-
importersQueryResponseNode[]-
nodesQueryResponseNode[]-
parts?QueryPart[]one entry per top-level selector, only with partSelectors and a non-empty query
specificitySpecificity-

QueryResponseEdge

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

Defined in: types.ts:110

Type declaration

NameType
fromQueryResponseNode
to?QueryResponseNode

QueryResponseNode

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

Defined in: types.ts:115

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:41

Type declaration

NameType
scopeIDs?DepID[]
signalAbortSignal

SeverityInsights

TypeScript
type SeverityInsights = LeveledInsights;

Defined in: types.ts:194


Specificity

TypeScript
type Specificity = object;

Defined in: types.ts:22

Type declaration

NameType
commonCounternumber
idCounternumber

SquatInsights

TypeScript
type SquatInsights = object;

Defined in: types.ts:197

Type declaration

NameType
criticalboolean
mediumboolean

VulnInsights

TypeScript
type VulnInsights = LeveledInsights;

Defined in: types.ts:195

Functions

walk()

TypeScript
function walk(state): Promise<ParserState>

Defined in: index.ts:109

Parameters

ParameterType
stateParserState

Returns

Promise<ParserState>


Previous@vltpkg/queryNext@vltpkg/registry-client

On this page

  • Classes
  • Query
  • Type Aliases
  • DiffFilesProvider()
  • GetAuthHeader()
  • GraphSelectionState
  • HasSkills()
  • HostContextsMap
  • HostContextsMapResult
  • Insights
  • LeveledInsights
  • LicenseInsights
  • ParsedSelectorToken
  • ParserFn()
  • ParserState
  • QueryOptions
  • QueryPart<N>
  • 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