1 | import { Person } from './person';
|
2 | /**
|
3 | * `SearchResults` contains the results returned by the registry for a query.
|
4 | *
|
5 | * @see {@link SearchResult}
|
6 | * @see {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search}
|
7 | */
|
8 | export interface SearchResults {
|
9 | /**
|
10 | * List of search results
|
11 | *
|
12 | * @see {@link SearchResult}
|
13 | */
|
14 | readonly objects: SearchResult[];
|
15 | /**
|
16 | * Total number of search results corresponding to a query;
|
17 | * may be higher than the number of `objects`
|
18 | */
|
19 | readonly total: number;
|
20 | /** Date at which the search happened */
|
21 | readonly time: string;
|
22 | }
|
23 | /**
|
24 | * `SearchResult` contains the search result for a single package
|
25 | * and its search score.
|
26 | *
|
27 | * @see {@link PackageSearchResult}
|
28 | * @see {@link SearchScore}
|
29 | * @see {@link PackageFlags}
|
30 | */
|
31 | export interface SearchResult {
|
32 | /**
|
33 | * Abbreviated package metadata
|
34 | *
|
35 | * @see {@link PackageSearchResult}
|
36 | */
|
37 | readonly package: PackageSearchResult;
|
38 | /**
|
39 | * Final and detailed search score values
|
40 | *
|
41 | * @see {@link SearchScore}
|
42 | */
|
43 | readonly score: SearchScore;
|
44 | /** Search score value; may be different from `score.final` */
|
45 | readonly searchScore: number;
|
46 | /**
|
47 | * Flag attributes for the package
|
48 | *
|
49 | * @see {@link PackageFlags}
|
50 | */
|
51 | readonly flags?: PackageFlags;
|
52 | }
|
53 | /**
|
54 | * `PackageSearchResult` contains abbreviated package metadata returned
|
55 | * by searching the registry for packages.
|
56 | *
|
57 | * @see {@link Person}
|
58 | * @see {@link PackageLinks}
|
59 | */
|
60 | export interface PackageSearchResult {
|
61 | /** Package name */
|
62 | readonly name: string;
|
63 | /** Latest package version number */
|
64 | readonly version: string;
|
65 | /** Package scope; either `unscoped` or the package's scope */
|
66 | readonly scope: string;
|
67 | /** Publishing timestamp for the latest version */
|
68 | readonly date: string;
|
69 | /**
|
70 | * Package publisher
|
71 | *
|
72 | * @see {@link Person}
|
73 | */
|
74 | readonly publisher: Person;
|
75 | /**
|
76 | * Links for pages associated to the package
|
77 | *
|
78 | * @see {@link PackageLinks}
|
79 | */
|
80 | readonly links: PackageLinks;
|
81 | /** Package description */
|
82 | readonly description?: string;
|
83 | /** Keywords describing the package */
|
84 | readonly keywords?: string[];
|
85 | /**
|
86 | * Package author
|
87 | *
|
88 | * @see {@link Person}
|
89 | */
|
90 | readonly author?: Person;
|
91 | /**
|
92 | * Package maintainers
|
93 | *
|
94 | * @see {@link Person}
|
95 | */
|
96 | readonly maintainers?: Person[];
|
97 | }
|
98 | /**
|
99 | * `PackageLinks` contains a collection of links of pages associated to the package.
|
100 | */
|
101 | export interface PackageLinks {
|
102 | readonly npm?: string;
|
103 | readonly homepage?: string;
|
104 | readonly repository?: string;
|
105 | readonly bugs?: string;
|
106 | readonly [key: string]: string | undefined;
|
107 | }
|
108 | /**
|
109 | * `SearchScore` contains the final and detailed search score values.
|
110 | *
|
111 | * @see {@link SearchScoreDetail}
|
112 | */
|
113 | export interface SearchScore {
|
114 | /** Final search score value, computed from the detailed scores */
|
115 | readonly final: number;
|
116 | /**
|
117 | * Detailed search score values
|
118 | *
|
119 | * @see {@link SearchScoreDetail}
|
120 | */
|
121 | readonly detail: SearchScoreDetail;
|
122 | }
|
123 | /**
|
124 | * `SearchScoreDetail` contains the search score values for the
|
125 | * quality, popularity and maintenance categories.
|
126 | */
|
127 | export interface SearchScoreDetail {
|
128 | /** Package quality score value */
|
129 | readonly quality: number;
|
130 | /** Package popularity score value */
|
131 | readonly popularity: number;
|
132 | /** Package maintenance score value */
|
133 | readonly maintenance: number;
|
134 | }
|
135 | /**
|
136 | * `PackageFlags` contains flag attributes categorizing the package.
|
137 | */
|
138 | export interface PackageFlags {
|
139 | /** If true, package version is `<1.0.0` */
|
140 | readonly unstable?: boolean;
|
141 | /** If true, package is insecure or has vulnerable dependencies */
|
142 | readonly insecure?: boolean;
|
143 | }
|
144 | //# sourceMappingURL=search-results.d.ts.map |
\ | No newline at end of file |