UNPKG

2.44 kBTypeScriptView Raw
1import { DistTags } from './dist-tags';
2import { PackageJSON } from './package-json';
3import { RawPackageManifest } from './raw-package-manifest';
4import { VersionsToTimestamps } from './versions-to-timestamps';
5/**
6 * `RawPackument` represents a packument (package document), as returned
7 * from the registry, containing all the data about a package .
8 *
9 * @remarks
10 * For some packages, especially legacy ones,
11 * the properties may be mistyped due to incorrect data present on the registry.
12 *
13 * @see {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#getpackage}
14 * @see {@link https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#full-metadata-format}
15 * @see {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#package}
16 * @see {@link HoistedPackageJSON}
17 */
18export interface RawPackument extends HoistedPackageJSON {
19 /** Unique package name (for example, `foo` or `@bar/baz`) */
20 readonly _id: string;
21 /** Latest revision ID in CouchDB */
22 readonly _rev: string;
23 /** Package name */
24 readonly name: string;
25 /**
26 * Mapping of distribution tags to version numbers
27 *
28 * @see {@link DistTags}
29 */
30 readonly 'dist-tags': DistTags;
31 /**
32 * Mapping of version numbers to publishing timestamps
33 *
34 * @see {@link VersionsToTimestamps}
35 */
36 readonly time: VersionsToTimestamps;
37 /**
38 * Mapping of version numbers to package manifests
39 *
40 * @see {@link RawPackageManifest}
41 */
42 readonly versions: Record<string, RawPackageManifest>;
43 /** Names of the npm users who starred the package */
44 readonly users?: Record<string, boolean>;
45}
46/**
47 * `HoistedPackageJSON` contains the data hoisted
48 * from the latest package version into the packument.
49 *
50 * @remarks
51 * For some packages, especially legacy ones,
52 * the properties may be mistyped due to incorrect data present on the registry.
53 *
54 * @see {@link PackageJSON}
55 * @see {@link RawPackument}
56 * @see {@link https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md#full-metadata-format}
57 */
58export declare type HoistedPackageJSON = Pick<PackageJSON, 'author' | 'bugs' | 'contributors' | 'description' | 'homepage' | 'keywords' | 'license' | 'maintainers' | 'readme' | 'readmeFilename' | 'repository'>;
59//# sourceMappingURL=raw-packument.d.ts.map
\No newline at end of file