UNPKG

3.24 kBPlain TextView Raw
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 weekly downloads for package `query-registry` from the npm registry:
37 *
38 * ```typescript
39 * import { getPackageDownloads } from 'query-registry';
40 *
41 * (async () => {
42 * const downloads = await getPackageDownloads({ name: 'query-registry' });
43 *
44 * // Output: 'query-registry'
45 * console.log(downloads.package);
46 *
47 * // Output: 'number'
48 * console.log(typeof downloads.downloads);
49 * })();
50 * ```
51 *
52 * @example
53 * Get the search results for text query `query-registry` from the npm registry:
54 *
55 * ```typescript
56 * import { searchPackages } from 'query-registry';
57 *
58 * (async () => {
59 * const results = await searchPackages({ query: { text: 'query-registry' } });
60 *
61 * // Output: 'query-registry'
62 * console.log(results.objects[0].package.name);
63 * })();
64 * ```
65 *
66 * @example
67 * Enable {@link https://www.npmjs.com/package/debug | debug messages}
68 * by setting the `DEBUG` environment variable to `query-registry`:
69 *
70 * ```bash
71 * $ DEBUG="query-registry"
72 * ```
73 *
74 * @packageDocumentation
75 */
76
77export * from './data/registries';
78export * from './endpoints/get-daily-package-downloads';
79export * from './endpoints/get-daily-registry-downloads';
80export * from './endpoints/get-package-downloads';
81export * from './endpoints/get-package-manifest';
82export * from './endpoints/get-packument';
83export * from './endpoints/get-raw-package-manifest';
84export * from './endpoints/get-raw-packument';
85export * from './endpoints/get-registry-downloads';
86export * from './endpoints/get-registry-metadata';
87export * from './endpoints/search-packages';
88export * from './types/bug-tracker';
89export * from './types/dist-info';
90export * from './types/dist-tags';
91export * from './types/download-period';
92export * from './types/downloads';
93export * from './types/git-repository';
94export * from './types/npm-operational-internal';
95export * from './types/package-json';
96export * from './types/package-manifest';
97export * from './types/packument';
98export * from './types/person';
99export * from './types/raw-package-manifest';
100export * from './types/raw-packument';
101export * from './types/registry-metadata';
102export * from './types/repository';
103export * from './types/search-criteria';
104export * from './types/search-results';
105export * from './types/versions-to-timestamps';
106export * from './utils/errors';