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 |
|
77 | export * from './data/registries';
|
78 | export * from './endpoints/get-daily-package-downloads';
|
79 | export * from './endpoints/get-daily-registry-downloads';
|
80 | export * from './endpoints/get-package-downloads';
|
81 | export * from './endpoints/get-package-manifest';
|
82 | export * from './endpoints/get-packument';
|
83 | export * from './endpoints/get-raw-package-manifest';
|
84 | export * from './endpoints/get-raw-packument';
|
85 | export * from './endpoints/get-registry-downloads';
|
86 | export * from './endpoints/get-registry-metadata';
|
87 | export * from './endpoints/search-packages';
|
88 | export * from './types/bug-tracker';
|
89 | export * from './types/dist-info';
|
90 | export * from './types/dist-tags';
|
91 | export * from './types/download-period';
|
92 | export * from './types/downloads';
|
93 | export * from './types/git-repository';
|
94 | export * from './types/npm-operational-internal';
|
95 | export * from './types/package-json';
|
96 | export * from './types/package-manifest';
|
97 | export * from './types/packument';
|
98 | export * from './types/person';
|
99 | export * from './types/raw-package-manifest';
|
100 | export * from './types/raw-packument';
|
101 | export * from './types/registry-metadata';
|
102 | export * from './types/repository';
|
103 | export * from './types/search-criteria';
|
104 | export * from './types/search-results';
|
105 | export * from './types/versions-to-timestamps';
|
106 | export * from './utils/errors';
|