query-registry
- Version 2.6.0
- Published
- 404 kB
- 5 dependencies
- MIT license
Install
npm i query-registry
yarn add query-registry
pnpm add query-registry
Overview
This package exports several functions to query the npm registry (or one of its mirrors) through one of its endpoints.
Example 1
Get the metadata for the npm registry:
import { getRegistryMetadata } from 'query-registry';
(async () => { const metadata = await getRegistryMetadata();
// Output: 'registry' console.log(metadata.db_name);})();
Example 2
Get the latest manifest for package query-registry
from the npm registry:
import { getPackageManifest } from 'query-registry';
(async () => { const manifest = await getPackageManifest({ name: 'query-registry' });
// Output: 'query-registry' console.log(manifest.name);})();
Example 3
Get the abbreviated packument for package query-registry
from the npm registry:
import { getAbbreviatedPackument } from 'query-registry';
(async () => { const packument = await getAbbreviatedPackument({ name: 'query-registry' });
// Output: 'query-registry' console.log(manifest.name);})();
Example 4
Get the weekly downloads for package query-registry
from the npm registry:
import { getPackageDownloads } from 'query-registry';
(async () => { const downloads = await getPackageDownloads({ name: 'query-registry' });
// Output: 'query-registry' console.log(downloads.package);
// Output: 'number' console.log(typeof downloads.downloads);})();
Example 5
Get the search results for text query query-registry
from the npm registry:
import { searchPackages } from 'query-registry';
(async () => { const results = await searchPackages({ query: { text: 'query-registry' } });
// Output: 'query-registry' console.log(results.objects[0].package.name);})();
Example 6
Enable debug messages by setting the DEBUG
environment variable to query-registry
(available only in non production environments):
$ DEBUG="query-registry"
Index
Variables
Functions
Classes
Interfaces
PackageJSON
- author
- bin
- browser
- bugs
- bundledDependencies
- bundleDependencies
- config
- contributors
- cpu
- dependencies
- deprecated
- description
- devDependencies
- directories
- engines
- exports
- files
- homepage
- keywords
- license
- licenseText
- main
- maintainers
- man
- module
- name
- optionalDependencies
- os
- peerDependencies
- private
- publishConfig
- readme
- readmeFilename
- repository
- scripts
- source
- types
- typings
- version
Type Aliases
Variables
variable cloudflareRegistry
const cloudflareRegistry: string;
npm registry mirror by Cloudflare
Remarks
This registry has CORS enabled and can be used to retrieve package manifests and packuments in the browser.
See Also
variable InvalidPackageNameError
const InvalidPackageNameError: any;
InvalidPackageNameError
is thrown when the name of a package is not valid according to the npm registry naming rules.The
instanceof
operator can be used to check for this error.See Also
variable InvalidPackageVersionError
const InvalidPackageVersionError: any;
InvalidPackageVersionError
is thrown when a package's version does not exist.The
instanceof
operator can be used to check for this error.
variable npmRegistry
const npmRegistry: string;
npm registry
See Also
variable npmRegistryDownloadsAPI
const npmRegistryDownloadsAPI: string;
Downloads API for the npm registry
See Also
variable npmRegistryMirrors
const npmRegistryMirrors: string[];
Mirrors of the npm registry.
See Also
variable yarnRegistry
const yarnRegistry: string;
npm registry mirror by Yarn
See Also
Functions
function getAbbreviatedPackument
getAbbreviatedPackument: ({ name, registry, mirrors, cached,}: { name: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<AbbreviatedPackument>;
getAbbreviatedPackument
returns the abbreviated packument (package document) containing only the metadata necessary to install a package present on the registry.Parameter name
package name
Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Remarks
To get all the metadata (full packument) about a package see getPackument.
Example 1
Get the abbreviated packument for package
query-registry
from the npm registry:import { getAbbreviatedPackument } from 'query-registry';(async () => {const packument = await getAbbreviatedPackument({ name: 'query-registry' });// Output: 'query-registry'console.log(packument.name);})();See Also
function getDailyPackageDownloads
getDailyPackageDownloads: ({ name, period: rawDownloadPeriod, registryDownloadsAPI, cached,}: { name: string; period?: DownloadPeriod; registryDownloadsAPI?: string; cached?: boolean;}) => Promise<DailyPackageDownloads>;
getDailyPackageDownloads
returns the number of downloads for a package for each day in a given time period.Parameter name
package name
Parameter period
time period in which downloads happened (default:
last-week
)Parameter registryDownloadsAPI
URL of the registry's downloads API (default: npm registry)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the day by day weekly downloads for package
query-registry
from the npm registry:import { getDailyPackageDownloads } from 'query-registry';(async () => {const downloads = await getDailyPackageDownloads({ name: 'query-registry' });// Output: 'query-registry'console.log(downloads.package);// Output: 'number'console.log(typeof downloads.downloads[0].downloads);})();Example 2
Get the day by day monthly downloads for package
query-registry
from the npm registry:import { getDailyPackageDownloads } from 'query-registry';(async () => {const downloads = await getDailyPackageDownloads({ name: 'query-registry', period: 'last-month' });// Output: 'query-registry'console.log(downloads.package);// Output: 'number'console.log(typeof downloads.downloads[0].downloads);})();See Also
function getDailyRegistryDownloads
getDailyRegistryDownloads: ({ period: rawDownloadPeriod, registryDownloadsAPI, cached,}?: { period?: DownloadPeriod; registryDownloadsAPI?: string; cached?: boolean;}) => Promise<DailyRegistryDownloads>;
getDailyRegistryDownloads
returns the number of downloads for all registry packages for each day in a given time period.Parameter period
time period in which downloads happened (default:
last-week
)Parameter registryDownloadsAPI
URL of the registry's downloads API (default: npm registry)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the day by day weekly downloads for the npm registry:
import { getDailyRegistryDownloads } from 'query-registry';(async () => {const downloads = await getDailyRegistryDownloads();// Output: 'number'console.log(typeof downloads.downloads[0].downloads);})();Example 2
Get the day by day monthly downloads for the npm registry:
import { getDailyRegistryDownloads } from 'query-registry';(async () => {const downloads = await getDailyRegistryDownloads({ period: 'last-month' });// Output: 'number'console.log(typeof downloads.downloads[0].downloads);})();See Also
function getPackageDownloads
getPackageDownloads: ({ name, period: rawDownloadPeriod, registryDownloadsAPI, cached,}: { name: string; period?: DownloadPeriod; registryDownloadsAPI?: string; cached?: boolean;}) => Promise<PackageDownloads>;
getPackageDownloads
returns the number of downloads for a package in a given time period.Parameter name
package name
Parameter period
time period in which downloads happened (default:
last-week
)Parameter registryDownloadsAPI
URL of the registry's downloads API (default: npm registry)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the weekly downloads for package
query-registry
from the npm registry:import { getPackageDownloads } from 'query-registry';(async () => {const downloads = await getPackageDownloads({ name: 'query-registry' });// Output: 'query-registry'console.log(downloads.package);// Output: 'number'console.log(typeof downloads.downloads);})();Example 2
Get the monthly downloads for package
query-registry
from the npm registry:import { getPackageDownloads } from 'query-registry';(async () => {const downloads = await getPackageDownloads({ name: 'query-registry', period: 'last-month' });// Output: 'query-registry'console.log(downloads.package);// Output: 'number'console.log(typeof downloads.downloads);})();See Also
function getPackageManifest
getPackageManifest: ({ name, version, registry, mirrors, cached,}: { name: string; version?: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<PackageManifest>;
getPackageManifest
returns the manifest describing a specific version of a package.Parameter name
package name
Parameter version
package version (default:
latest
)Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the latest manifest for package
query-registry
from the npm registry:import { getPackageManifest } from 'query-registry';(async () => {const manifest = await getPackageManifest({ name: 'query-registry' });// Output: 'query-registry'console.log(manifest.name);})();Example 2
Get the manifest for package
query-registry@1.0.0
from the npm registry:import { getPackageManifest } from 'query-registry';(async () => {const manifest = await getPackageManifest({ name: 'query-registry', version: '1.0.0' });// Output: 'query-registry'console.log(manifest.name);// Output: '1.0.0'console.log(manifest.version);})();See Also
function getPackument
getPackument: ({ name, registry, mirrors, cached,}: { name: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<Packument>;
getPackument
returns the packument (package document) containing all the metadata about a package present on the registry.Parameter name
package name
Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the packument for package
query-registry
from the npm registry:import { getPackument } from 'query-registry';(async () => {const packument = await getPackument({ name: 'query-registry' });// Output: 'query-registry'console.log(packument.name);})();See Also
function getRawAbbreviatedPackument
getRawAbbreviatedPackument: ({ name, registry, mirrors, cached,}: { name: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<RawAbbreviatedPackument>;
getRawAbbreviatedPackument
returns the abbreviated packument (package document) containing only the metadata necessary to install a package present on the registry.Note: the abbreviated packument is returned as retrieved from the registry.
Parameter name
package name
Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the abbreviated packument for package
query-registry
from the npm registry:import { getRawAbbreviatedPackument } from 'query-registry';(async () => {const packument = await getRawAbbreviatedPackument({ name: 'query-registry' });// Output: 'query-registry'console.log(packument.name);})();See Also
function getRawPackageManifest
getRawPackageManifest: ({ name, version, registry, mirrors, cached,}: { name: string; version?: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<RawPackageManifest>;
getRawPackageManifest
returns the manifest describing a specific version of a package.Note: the manifest is returned as retrieved from the registry.
Parameter name
package name
Parameter version
package version (default:
latest
)Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the latest manifest for package
query-registry
from the npm registry:import { getRawPackageManifest } from 'query-registry';(async () => {const manifest = await getRawPackageManifest({ name: 'query-registry' });// Output: 'query-registry'console.log(manifest.name);})();Example 2
Get the manifest for package
query-registry@1.0.0
from the npm registry:import { getRawPackageManifest } from 'query-registry';(async () => {const manifest = await getRawPackageManifest({ name: 'query-registry', version: '1.0.0' });// Output: 'query-registry'console.log(manifest.name);// Output: '1.0.0'console.log(manifest.version);})();See Also
function getRawPackument
getRawPackument: ({ name, registry, mirrors, cached,}: { name: string; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<RawPackument>;
getRawPackument
returns the packument (package document) containing all the metadata about a package present on the registry.Note: the packument is returned as retrieved from the registry.
Parameter name
package name
Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the packument for package
query-registry
from the npm registry:import { getRawPackument } from 'query-registry';(async () => {const packument = await getRawPackument({ name: 'query-registry' });// Output: 'query-registry'console.log(packument.name);})();See Also
function getRegistryDownloads
getRegistryDownloads: ({ period: rawDownloadPeriod, registryDownloadsAPI, cached,}?: { period?: DownloadPeriod; registryDownloadsAPI?: string; cached?: boolean;}) => Promise<RegistryDownloads>;
getRegistryDownloads
returns the number of downloads for all registry packages in a given time period.Parameter period
time period in which downloads happened (default:
last-week
)Parameter registryDownloadsAPI
URL of the registry's downloads API (default: npm registry)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the weekly downloads for the npm registry:
import { getRegistryDownloads } from 'query-registry';(async () => {const downloads = await getRegistryDownloads();// Output: 'number'console.log(typeof downloads.downloads);})();Example 2
Get the monthly downloads for the npm registry:
import { getRegistryDownloads } from 'query-registry';(async () => {const downloads = await getRegistryDownloads({ period: 'last-month' });// Output: 'number'console.log(typeof downloads.downloads);})();See Also
function getRegistryMetadata
getRegistryMetadata: ({ registry, cached,}?: { registry?: string; cached?: boolean;}) => Promise<RegistryMetadata>;
getRegistryMetadata
returns the metadata describing the registry itself.Parameter registry
URL of the registry (default: npm registry)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the metadata for the npm registry:
import { getRegistryMetadata } from 'query-registry';(async () => {const metadata = await getRegistryMetadata();// Output: 'registry'console.log(metadata.db_name);})();Example 2
Get the metadata for a custom registry:
import { getRegistryMetadata } from 'query-registry';(async () => {const metadata = await getRegistryMetadata({ registry: 'https://example.com' });})();See Also
function searchPackages
searchPackages: ({ query: rawSearchCriteria, registry, mirrors, cached,}: { query: SearchCriteria; registry?: string; mirrors?: string[]; cached?: boolean;}) => Promise<SearchResults>;
searchPackages
returns the packages corresponding to a given query.Parameter query
one or more search criteria
Parameter registry
URL of the registry (default: npm registry)
Parameter mirrors
URLs of the registry mirrors (default: npm registry mirrors)
Parameter cached
accept cached responses (default:
true
)Example 1
Get the search results for text query
query-registry
from the npm registry:import { searchPackages } from 'query-registry';(async () => {const results = await searchPackages({ query: { text: 'query-registry' } });// Output: 'query-registry'console.log(results.objects[0].package.name);})();See Also
Classes
class FetchError
class FetchError extends BaseError {}
FetchError
represents an error that happened when fetching a URL.The
instanceof
operator can be used to check for this error.
constructor
constructor(url: string, response: Response);
property response
readonly response: Response;
Response received
property url
readonly url: string;
URL originally fetched
Interfaces
interface AbbreviatedPackument
interface AbbreviatedPackument extends RawAbbreviatedPackument {}
AbbreviatedPackument
represents a packument (package document) containing only the metadata necessary to install a package.See Also
property distTags
readonly distTags: DistTags;
Mapping of distribution tags to version numbers (alias to
dist-tags
)See Also
property id
readonly id: string;
Unique package name (for example,
foo
or@bar/baz
)
property modifiedAt
readonly modifiedAt: string;
Timestamp of when the package was last modified in ISO 8601 format (for example,
2021-11-23T19:12:24.006Z
); (alias tomodified
)
interface BugTracker
interface BugTracker {}
BugTracker
represents the bug tracking methods.
interface DailyPackageDownloads
interface DailyPackageDownloads extends DailyRegistryDownloads {}
DailyPackageDownloads
lists the number of downloads for a package for each day in a given time period.See Also
property package
readonly package: string;
Package name
interface DailyRegistryDownloads
interface DailyRegistryDownloads {}
DailyRegistryDownloads
lists the number of downloads for the registry for each day in a given time period.See Also
interface DateRange
interface DateRange {}
DateRange
represents a time period between two days where thestart
andend
dates are inclusive.Example 1
const dateRange = {start: new Date('2019-01-01'),end: new Date('2020-01-01'),};See Also
interface DistInfo
interface DistInfo {}
DistInfo
contains data describing the distributed package.See Also
property 'npm-signature'
readonly 'npm-signature'?: string;
npm PGP signature
property fileCount
readonly fileCount?: number;
Number of files in the tarball
property integrity
readonly integrity?: string;
Usually, SHA512 sum of the tarball preceded by
sha512-
property shasum
readonly shasum: string;
SHA1 sum of the tarball
property tarball
readonly tarball: string;
Tarball URL
property unpackedSize
readonly unpackedSize?: number;
Total size in bytes of the unpacked files in the tarball
interface DistTags
interface DistTags {}
DistTags
maps distribution tags to version numbers.
property latest
readonly latest: string;
Latest version number
index signature
readonly [key: string]: string;
Mapping of distribution tags to version numbers
interface DownloadsPerDay
interface DownloadsPerDay {}
DownloadsPerDay
lists the number of downloads in a given day.
interface GitRepository
interface GitRepository {}
GitRepository
represents a git repository hosting the source code of a package.See Also
interface NpmOperationalInternal
interface NpmOperationalInternal {}
interface PackageDownloads
interface PackageDownloads extends RegistryDownloads {}
PackageDownloads
lists the number of downloads for a package in a given time period.See Also
property package
readonly package: string;
Package name
interface PackageFlags
interface PackageFlags {}
PackageFlags
contains flag attributes categorizing the package.
interface PackageJSON
interface PackageJSON {}
PackageJSON
contains the package metadata usually found inpackage.json
files.Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
property author
readonly author?: Person;
Author of the package
See Also
property bin
readonly bin?: string | Record<string, string>;
Executable files
property browser
readonly browser?: string;
Main file (Browser)
property bugs
readonly bugs?: BugTracker;
Bug tracker
See Also
property bundledDependencies
readonly bundledDependencies?: string[];
Bundled dependencies (alias)
property bundleDependencies
readonly bundleDependencies?: string[];
Bundled dependencies
property config
readonly config?: Record<string, string>;
npm config
property contributors
readonly contributors?: Person[];
Contributors to the package
See Also
property cpu
readonly cpu?: string[];
CPU compatibility
property dependencies
readonly dependencies?: Record<string, string>;
Runtime dependencies
property deprecated
readonly deprecated?: string;
Deprecation message
property description
readonly description?: string;
Package description
property devDependencies
readonly devDependencies?: Record<string, string>;
Development dependencies
property directories
readonly directories?: Record<string, string>;
Directories describing the package's structure
property engines
readonly engines?: Record<string, string>;
Node compatibility
property exports
readonly exports?: string | Record<string, unknown>;
Export map
See Also
property files
readonly files?: string[];
File patterns included in the package
property homepage
readonly homepage?: string;
Homepage URL
property keywords
readonly keywords?: string[];
Keywords describing the package
property license
readonly license?: string;
SPDX license identifier
property licenseText
readonly licenseText?: string;
Text of the license
property main
readonly main?: string;
Main file (Node)
property maintainers
readonly maintainers?: Person[];
Maintainers of the package
See Also
property man
readonly man?: string | string[];
Man pages
property module
readonly module?: string;
Main file (Modules)
property name
readonly name: string;
Package name
property optionalDependencies
readonly optionalDependencies?: Record<string, string>;
Optional dependencies
property os
readonly os?: string[];
OS compatibility
property peerDependencies
readonly peerDependencies?: Record<string, string>;
Peer dependencies
property private
readonly private?: boolean;
Prevent publishing
property publishConfig
readonly publishConfig?: Record<string, string>;
Publishing configuration
property readme
readonly readme?: string;
README contents
property readmeFilename
readonly readmeFilename?: string;
Name of the README file
property repository
readonly repository?: string | Repository;
Repository containing the package's source
See Also
property scripts
readonly scripts?: Record<string, string>;
npm scripts
property source
readonly source?: string;
Main source file
property types
readonly types?: string;
Type declarations file
property typings
readonly typings?: string;
Type declarations file (alias)
property version
readonly version: string;
Package version number
index signature
readonly [key: string]: unknown;
Other fields
interface PackageLinks
interface PackageLinks {}
PackageLinks
contains a collection of links of pages associated to the package.
property bugs
readonly bugs?: string;
property homepage
readonly homepage?: string;
property npm
readonly npm?: string;
property repository
readonly repository?: string;
index signature
readonly [key: string]: string | undefined;
interface PackageManifest
interface PackageManifest extends RawPackageManifest {}
PackageManifest
represents the manifest describing a specific version of a package.Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
property createdAt
readonly createdAt: string;
Publishing timestamp
property definitelyTypedName
readonly definitelyTypedName?: string;
Name of the corresponding DefinitelyTyped package, if any
property gitRepository
readonly gitRepository?: GitRepository;
Normalized git repository
property id
readonly id: string;
Package version ID (for example,
foo@1.0.0
or@bar/baz@1.0.0
)
property license
readonly license?: string;
Normalized license
property publisher
readonly publisher: Person;
User who published this version of the package
See Also
property untypedName
readonly untypedName?: string;
Name of the corresponding untyped package (w.r.t. DefinitelyTyped)
interface PackageSearchResult
interface PackageSearchResult {}
PackageSearchResult
contains abbreviated package metadata returned by searching the registry for packages.See Also
property author
readonly author?: Person;
Package author
See Also
property date
readonly date: string;
Publishing timestamp for the latest version
property description
readonly description?: string;
Package description
property keywords
readonly keywords?: string[];
Keywords describing the package
property links
readonly links: PackageLinks;
Links for pages associated to the package
See Also
property maintainers
readonly maintainers?: Person[];
Package maintainers
See Also
property name
readonly name: string;
Package name
property publisher
readonly publisher: Person;
Package publisher
See Also
property scope
readonly scope: string;
Package scope; either
unscoped
or the package's scope
property version
readonly version: string;
Latest package version number
interface Packument
interface Packument extends RawPackument {}
Packument
represents a packument (package document) containing all the data about a package.Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
property distTags
readonly distTags: DistTags;
Mapping of distribution tags to version numbers (alias to
dist-tags
)See Also
property gitRepository
readonly gitRepository?: GitRepository;
Normalized git repository
property id
readonly id: string;
Unique package name (for example,
foo
or@bar/baz
; alias to_id
)
property license
readonly license?: string;
Normalized license
property versionsToTimestamps
readonly versionsToTimestamps: Record<string, string>;
Mapping of version numbers to publishing timestamps without the
created
ormodified
properties present in thetime
propertySee Also
interface Person
interface Person {}
Person
represents a person associated to a package.
interface RawAbbreviatedPackument
interface RawAbbreviatedPackument {}
RawAbbreviatedPackument
represents an abbreviated packument (package document), as returned from the registry, containing only the metadata necessary to install a package.See Also
property 'dist-tags'
readonly 'dist-tags': DistTags;
Mapping of distribution tags to version numbers
See Also
property modified
readonly modified: string;
Timestamp of when the package was last modified in ISO 8601 format (for example,
2021-11-23T19:12:24.006Z
)
property name
readonly name: string;
Package name
property versions
readonly versions: Record< string, Pick< RawPackageManifest, | 'name' | 'version' | 'dist' | 'deprecated' | 'dependencies' | 'optionalDependencies' | 'devDependencies' | 'bundleDependencies' | 'peerDependencies' | 'bin' | 'directories' | 'engines' | '_hasShrinkwrap' >>;
Mapping of version numbers to package manifests
See Also
interface RawPackageManifest
interface RawPackageManifest extends PackageJSON {}
RawPackageManifest
represents the manifest, as returned by the registry, describing a specific version of a package.Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
interface RawPackument
interface RawPackument extends HoistedPackageJSON {}
RawPackument
represents a packument (package document), as returned from the registry, containing all the data about a package .Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
property 'dist-tags'
readonly 'dist-tags': DistTags;
Mapping of distribution tags to version numbers
See Also
property name
readonly name: string;
Package name
property time
readonly time: VersionsToTimestamps;
Mapping of version numbers to publishing timestamps
See Also
property users
readonly users?: Record<string, boolean>;
Names of the npm users who starred the package
property versions
readonly versions: Record<string, RawPackageManifest>;
Mapping of version numbers to package manifests
See Also
interface RegistryDownloads
interface RegistryDownloads {}
RegistryDownloads
lists the number of downloads for the registry in a given time period.See Also
interface RegistryMetadata
interface RegistryMetadata {}
RegistryMetadata
contains information about the registry itself.See Also
property committed_update_seq
readonly committed_update_seq: number;
property compact_running
readonly compact_running: boolean;
property compacted_seq
readonly compacted_seq: number;
property data_size
readonly data_size: number;
property db_name
readonly db_name: string;
Database name, usually
registry
property disk_format_version
readonly disk_format_version: number;
property disk_size
readonly disk_size: number;
property doc_count
readonly doc_count: number;
property doc_del_count
readonly doc_del_count: number;
property instance_start_time
readonly instance_start_time: string;
property other
readonly other: RegistryMetadataOther;
property purge_seq
readonly purge_seq: number;
property sizes
readonly sizes: RegistryMetadataSizes;
property update_seq
readonly update_seq: number;
property uuid
readonly uuid: string;
interface RegistryMetadataOther
interface RegistryMetadataOther {}
property data_size
readonly data_size: number;
interface RegistryMetadataSizes
interface RegistryMetadataSizes {}
interface Repository
interface Repository {}
Repository
represents a remote repository hosting the source code of a package.See Also
interface SearchCriteria
interface SearchCriteria {}
SearchCriteria
represents the available search criteria.See Also
property from
readonly from?: number;
Return results from this offset
property maintenance
readonly maintenance?: number;
Package maintenance influence on results (from
0.0
to1.0
)
property popularity
readonly popularity?: number;
Package popularity influence on results (from
0.0
to1.0
)
property quality
readonly quality?: number;
Package quality influence on results (from
0.0
to1.0
)
property size
readonly size?: number;
Number of results to return (from
0
to250
; default:20
on the npm registry)
property text
readonly text?: string;
Query text
Remarks
The following special text attributes can be used to refine results:
-
author:<name>
: show packages from the given author (for example,author:someone
)-
maintainer:<name>
: show packages with the given maintainer (for example,maintainer:someone
)-
keywords:<keyword list>
: show packages matching the given keyword(s); separators,
,+
and,-
mean respectivelyOR
,AND
andNOT
(for example, usekeywords:foo,bar+baz,-quux
to include keywordsfoo
orbar
andbaz
but notquux
)-
not:unstable
: exclude unstable packages (version<1.0.0
)-
not:insecure
: exclude insecure packages-
is:unstable
: include only unstable packages (version<1.0.0
)-
is:insecure
: include only insecure packages-
boost-exact:<true/false>
: boost packages with exact name match (default:true
)
interface SearchResult
interface SearchResult {}
SearchResult
contains the search result for a single package and its search score.See Also
property flags
readonly flags?: PackageFlags;
Flag attributes for the package
See Also
property package
readonly package: PackageSearchResult;
Abbreviated package metadata
See Also
property score
readonly score: SearchScore;
Final and detailed search score values
See Also
property searchScore
readonly searchScore: number;
Search score value; may be different from
score.final
interface SearchResults
interface SearchResults {}
SearchResults
contains the results returned by the registry for a query.See Also
interface SearchScore
interface SearchScore {}
SearchScore
contains the final and detailed search score values.See Also
interface SearchScoreDetail
interface SearchScoreDetail {}
SearchScoreDetail
contains the search score values for the quality, popularity and maintenance categories.
property maintenance
readonly maintenance: number;
Package maintenance score value
property popularity
readonly popularity: number;
Package popularity score value
property quality
readonly quality: number;
Package quality score value
interface VersionsToTimestamps
interface VersionsToTimestamps {}
VersionsToTimestamps
maps version numbers to their publishing timestamps.
property created
readonly created: string;
Package creation time
property modified
readonly modified: string;
Last package update time
index signature
readonly [key: string]: string;
Mapping of version numbers to publishing timestamps
Type Aliases
type DefaultDownloadPeriod
type DefaultDownloadPeriod = 'last-day' | 'last-week' | 'last-month' | 'last-year';
DefaultDownloadPeriod
represents the default time periods supported by the npm registry.
type DownloadPeriod
type DownloadPeriod = DefaultDownloadPeriod | Date | DateRange;
DownloadPeriod
represents a time period for which downloads should be counted.Remarks
The following time periods are supported:
- a DefaultDownloadPeriod (for example,
last-week
)- a date for a single day (for example,
new Date('2020-01-01')
)- a DateRange
See Also
type HoistedPackageJSON
type HoistedPackageJSON = Pick< PackageJSON, | 'author' | 'bugs' | 'contributors' | 'description' | 'homepage' | 'keywords' | 'license' | 'maintainers' | 'readme' | 'readmeFilename' | 'repository'>;
HoistedPackageJSON
contains the data hoisted from the latest package version into the packument.Remarks
For some packages, especially legacy ones, the properties may be mistyped due to incorrect data present on the registry.
See Also
Package Files (35)
- src/data/registries.ts
- src/endpoints/get-abbreviated-packument.ts
- src/endpoints/get-daily-package-downloads.ts
- src/endpoints/get-daily-registry-downloads.ts
- src/endpoints/get-package-downloads.ts
- src/endpoints/get-package-manifest.ts
- src/endpoints/get-packument.ts
- src/endpoints/get-raw-abbreviated-packument.ts
- src/endpoints/get-raw-package-manifest.ts
- src/endpoints/get-raw-packument.ts
- src/endpoints/get-registry-downloads.ts
- src/endpoints/get-registry-metadata.ts
- src/endpoints/search-packages.ts
- src/index.ts
- src/types/abbreviated-packument.ts
- src/types/bug-tracker.ts
- src/types/dist-info.ts
- src/types/dist-tags.ts
- src/types/download-period.ts
- src/types/downloads.ts
- src/types/git-repository.ts
- src/types/npm-operational-internal.ts
- src/types/package-json.ts
- src/types/package-manifest.ts
- src/types/packument.ts
- src/types/person.ts
- src/types/raw-abbreviated-packument.ts
- src/types/raw-package-manifest.ts
- src/types/raw-packument.ts
- src/types/registry-metadata.ts
- src/types/repository.ts
- src/types/search-criteria.ts
- src/types/search-results.ts
- src/types/versions-to-timestamps.ts
- src/utils/errors.ts
Dependencies (5)
Dev Dependencies (24)
- @commitlint/cli
- @commitlint/config-conventional
- @pollyjs/adapter-node-http
- @pollyjs/core
- @pollyjs/persister-fs
- @types/debug
- @types/git-url-parse
- @types/pollyjs__adapter-node-http
- @types/pollyjs__core
- @types/pollyjs__persister-fs
- @types/setup-polly-jest
- @types/url-join
- @types/validate-npm-package-name
- debug
- dts-cli
- eslint-plugin-prettier
- husky
- nock
- np
- prettier
- setup-polly-jest
- ts-jest
- tslib
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/query-registry
.
- Markdown[](https://www.jsdocs.io/package/query-registry)
- HTML<a href="https://www.jsdocs.io/package/query-registry"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 7318 ms. - Missing or incorrect documentation? Open an issue for this package.