1 | /**
|
2 | * This package exports several functions to query
|
3 | * the {@link https://www.npmjs.com | npm registry}
|
4 | * (or one of its mirrors) through one of its
|
5 | * {@link https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md | endpoints}.
|
6 | *
|
7 | * @example
|
8 | * Get the metadata for the npm registry:
|
9 | *
|
10 | * ```typescript
|
11 | * import { getRegistryMetadata } from 'query-registry';
|
12 | *
|
13 | * (async () => {
|
14 | * const metadata = await getRegistryMetadata();
|
15 | *
|
16 | * // Output: 'registry'
|
17 | * console.log(metadata.db_name);
|
18 | * })();
|
19 | * ```
|
20 | *
|
21 | * @example
|
22 | * Get the latest manifest for package `query-registry` from the npm registry:
|
23 | *
|
24 | * ```typescript
|
25 | * import { getPackageManifest } from 'query-registry';
|
26 | *
|
27 | * (async () => {
|
28 | * const manifest = await getPackageManifest({ name: 'query-registry' });
|
29 | *
|
30 | * // Output: 'query-registry'
|
31 | * console.log(manifest.name);
|
32 | * })();
|
33 | * ```
|
34 | *
|
35 | * @example
|
36 | * Get the abbreviated packument for package `query-registry` from the npm registry:
|
37 | *
|
38 | * ```typescript
|
39 | * import { getAbbreviatedPackument } from 'query-registry';
|
40 | *
|
41 | * (async () => {
|
42 | * const packument = await getAbbreviatedPackument({ name: 'query-registry' });
|
43 | *
|
44 | * // Output: 'query-registry'
|
45 | * console.log(manifest.name);
|
46 | * })();
|
47 | * ```
|
48 | *
|
49 | * @example
|
50 | * Get the weekly downloads for package `query-registry` from the npm registry:
|
51 | *
|
52 | * ```typescript
|
53 | * import { getPackageDownloads } from 'query-registry';
|
54 | *
|
55 | * (async () => {
|
56 | * const downloads = await getPackageDownloads({ name: 'query-registry' });
|
57 | *
|
58 | * // Output: 'query-registry'
|
59 | * console.log(downloads.package);
|
60 | *
|
61 | * // Output: 'number'
|
62 | * console.log(typeof downloads.downloads);
|
63 | * })();
|
64 | * ```
|
65 | *
|
66 | * @example
|
67 | * Get the search results for text query `query-registry` from the npm registry:
|
68 | *
|
69 | * ```typescript
|
70 | * import { searchPackages } from 'query-registry';
|
71 | *
|
72 | * (async () => {
|
73 | * const results = await searchPackages({ query: { text: 'query-registry' } });
|
74 | *
|
75 | * // Output: 'query-registry'
|
76 | * console.log(results.objects[0].package.name);
|
77 | * })();
|
78 | * ```
|
79 | *
|
80 | * @example
|
81 | * Enable {@link https://www.npmjs.com/package/debug | debug messages}
|
82 | * by setting the `DEBUG` environment variable to `query-registry`
|
83 | * (available only in non production environments):
|
84 | *
|
85 | * ```bash
|
86 | * $ DEBUG="query-registry"
|
87 | * ```
|
88 | *
|
89 | * @packageDocumentation
|
90 | */
|
91 |
|
92 | export * from './data/registries';
|
93 | export * from './endpoints/get-abbreviated-packument';
|
94 | export * from './endpoints/get-daily-package-downloads';
|
95 | export * from './endpoints/get-daily-registry-downloads';
|
96 | export * from './endpoints/get-package-downloads';
|
97 | export * from './endpoints/get-package-manifest';
|
98 | export * from './endpoints/get-packument';
|
99 | export * from './endpoints/get-raw-abbreviated-packument';
|
100 | export * from './endpoints/get-raw-package-manifest';
|
101 | export * from './endpoints/get-raw-packument';
|
102 | export * from './endpoints/get-registry-downloads';
|
103 | export * from './endpoints/get-registry-metadata';
|
104 | export * from './endpoints/search-packages';
|
105 | export * from './types/abbreviated-packument';
|
106 | export * from './types/bug-tracker';
|
107 | export * from './types/dist-info';
|
108 | export * from './types/dist-tags';
|
109 | export * from './types/download-period';
|
110 | export * from './types/downloads';
|
111 | export * from './types/git-repository';
|
112 | export * from './types/npm-operational-internal';
|
113 | export * from './types/package-json';
|
114 | export * from './types/package-manifest';
|
115 | export * from './types/packument';
|
116 | export * from './types/person';
|
117 | export * from './types/raw-abbreviated-packument';
|
118 | export * from './types/raw-package-manifest';
|
119 | export * from './types/raw-packument';
|
120 | export * from './types/registry-metadata';
|
121 | export * from './types/repository';
|
122 | export * from './types/search-criteria';
|
123 | export * from './types/search-results';
|
124 | export * from './types/versions-to-timestamps';
|
125 | export * from './utils/errors';
|