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