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

Type Aliases

Variables

variable cloudflareRegistry

const cloudflareRegistry: string;

variable InvalidPackageNameError

const InvalidPackageNameError: any;

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;

variable npmRegistryDownloadsAPI

const npmRegistryDownloadsAPI: string;

variable npmRegistryMirrors

const npmRegistryMirrors: string[];

variable yarnRegistry

const yarnRegistry: string;

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 to modified)

    interface BugTracker

    interface BugTracker {}
    • BugTracker represents the bug tracking methods.

    property email

    readonly email?: string;

      property url

      readonly url?: string;

        interface DailyPackageDownloads

        interface DailyPackageDownloads extends DailyRegistryDownloads {}

        property package

        readonly package: string;
        • Package name

        interface DailyRegistryDownloads

        interface DailyRegistryDownloads {}

        property downloads

        readonly downloads: DownloadsPerDay[];
        • Download counts per day

        property end

        readonly end: string;
        • Date of the last day (inclusive)

        property start

        readonly start: string;
        • Date of the first day (inclusive)

        interface DateRange

        interface DateRange {}

        property end

        readonly end: Date;
        • Date of the last day (inclusive)

        property start

        readonly start: Date;
        • Date of the first day (inclusive)

        interface DistInfo

        interface DistInfo {}

        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.

        property day

        readonly day: string;
        • Day date

        property downloads

        readonly downloads: number;
        • Total number of downloads in the day

        interface GitRepository

        interface GitRepository {}
        • GitRepository represents a git repository hosting the source code of a package.

          See Also

        property directory

        readonly directory?: string;
        • Specific directory in the repository (for example, a directory in a monorepo)

        property type

        readonly type: 'git';
        • Repository type, always git

        property url

        readonly url: string;
        • Repository URL

        interface NpmOperationalInternal

        interface NpmOperationalInternal {}

          property host

          readonly host: string;

            property tmp

            readonly tmp: string;

              interface PackageDownloads

              interface PackageDownloads extends RegistryDownloads {}

              property package

              readonly package: string;
              • Package name

              interface PackageFlags

              interface PackageFlags {}
              • PackageFlags contains flag attributes categorizing the package.

              property insecure

              readonly insecure?: boolean;
              • If true, package is insecure or has vulnerable dependencies

              property unstable

              readonly unstable?: boolean;
              • If true, package version is <1.0.0

              interface PackageJSON

              interface PackageJSON {}

              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;

              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>;

              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 {}
              • 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;

                        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

                        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 or modified properties present in the time property

                          See Also

                        interface Person

                        interface Person {}
                        • Person represents a person associated to a package.

                        property email

                        readonly email?: string;

                          property name

                          readonly name?: string;

                            property url

                            readonly url?: string;

                              property username

                              readonly username?: string;

                                interface RawAbbreviatedPackument

                                interface RawAbbreviatedPackument {}

                                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'
                                >
                                >;

                                interface RawPackageManifest

                                interface RawPackageManifest extends PackageJSON {}

                                property dist

                                readonly dist: DistInfo;
                                • Distribution data from the registry

                                  See Also

                                property gitHead

                                readonly gitHead?: string;
                                • Commit hash corresponding to the published version

                                property name

                                readonly name: string;
                                • Package name

                                property version

                                readonly version: string;
                                • Package version number

                                interface RawPackument

                                interface RawPackument extends HoistedPackageJSON {}

                                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;

                                property users

                                readonly users?: Record<string, boolean>;
                                • Names of the npm users who starred the package

                                property versions

                                readonly versions: Record<string, RawPackageManifest>;

                                interface RegistryDownloads

                                interface RegistryDownloads {}

                                property downloads

                                readonly downloads: number;
                                • Total number of downloads

                                property end

                                readonly end: string;
                                • Date of the last day (inclusive)

                                property start

                                readonly start: string;
                                • Date of the first day (inclusive)

                                interface RegistryMetadata

                                interface RegistryMetadata {}

                                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 {}

                                                                  property active

                                                                  readonly active: number;

                                                                    property external

                                                                    readonly external: number;

                                                                      property file

                                                                      readonly file: number;

                                                                        interface Repository

                                                                        interface Repository {}

                                                                        property directory

                                                                        readonly directory?: string;
                                                                        • Specific directory in the repository containing the package (for example, a directory in a monorepo)

                                                                        property type

                                                                        readonly type?: string;
                                                                        • Repository type (for example, git)

                                                                        property url

                                                                        readonly url: string;
                                                                        • Repository's URL

                                                                        interface SearchCriteria

                                                                        interface SearchCriteria {}

                                                                        property from

                                                                        readonly from?: number;
                                                                        • Return results from this offset

                                                                        property maintenance

                                                                        readonly maintenance?: number;
                                                                        • Package maintenance influence on results (from 0.0 to 1.0)

                                                                        property popularity

                                                                        readonly popularity?: number;
                                                                        • Package popularity influence on results (from 0.0 to 1.0)

                                                                        property quality

                                                                        readonly quality?: number;
                                                                        • Package quality influence on results (from 0.0 to 1.0)

                                                                        property size

                                                                        readonly size?: number;
                                                                        • Number of results to return (from 0 to 250; 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 respectively OR, AND and NOT (for example, use keywords:foo,bar+baz,-quux to include keywords foo or bar and baz but not quux)

                                                                          - 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 {}

                                                                        property flags

                                                                        readonly flags?: PackageFlags;

                                                                        property package

                                                                        readonly package: PackageSearchResult;

                                                                        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 {}

                                                                        property objects

                                                                        readonly objects: SearchResult[];

                                                                        property time

                                                                        readonly time: string;
                                                                        • Date at which the search happened

                                                                        property total

                                                                        readonly total: number;
                                                                        • Total number of search results corresponding to a query; may be higher than the number of objects

                                                                        interface SearchScore

                                                                        interface SearchScore {}
                                                                        • SearchScore contains the final and detailed search score values.

                                                                          See Also

                                                                        property detail

                                                                        readonly detail: SearchScoreDetail;

                                                                        property final

                                                                        readonly final: number;
                                                                        • Final search score value, computed from the detailed scores

                                                                        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;

                                                                        type HoistedPackageJSON

                                                                        type HoistedPackageJSON = Pick<
                                                                        PackageJSON,
                                                                        | 'author'
                                                                        | 'bugs'
                                                                        | 'contributors'
                                                                        | 'description'
                                                                        | 'homepage'
                                                                        | 'keywords'
                                                                        | 'license'
                                                                        | 'maintainers'
                                                                        | 'readme'
                                                                        | 'readmeFilename'
                                                                        | 'repository'
                                                                        >;

                                                                        Package Files (35)

                                                                        Dependencies (5)

                                                                        Dev Dependencies (24)

                                                                        Peer Dependencies (0)

                                                                        No peer dependencies.

                                                                        Badge

                                                                        To add a badge like this onejsDocs.io badgeto 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
                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](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>