npms.io 2.4.5 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "author": "Florian Imdahl <git@ffflorian.de>",
3
3
  "dependencies": {
4
- "@ffflorian/api-client": "2.2.0"
4
+ "@ffflorian/api-client": "2.5.0"
5
5
  },
6
6
  "description": "A npms.io API client",
7
7
  "devDependencies": {
8
8
  "@types/node": "~24",
9
- "rimraf": "6.1.2",
10
- "typedoc": "0.28.15",
11
- "typescript": "5.9.3"
9
+ "rimraf": "6.1.3",
10
+ "typedoc": "0.28.18",
11
+ "typescript": "6.0.2"
12
12
  },
13
13
  "engines": {
14
14
  "node": ">= 21"
@@ -35,6 +35,5 @@
35
35
  "dist": "yarn clean && yarn build:ts",
36
36
  "test": "exit 0"
37
37
  },
38
- "version": "2.4.5",
39
- "gitHead": "8d7471cbe490305b3e441c27acbc81e36a4bd9df"
38
+ "version": "2.4.6"
40
39
  }
@@ -1,14 +0,0 @@
1
- export declare const Endpoint: {
2
- PACKAGE: string;
3
- SEARCH: string;
4
- SUGGESTIONS: string;
5
- MGET: string;
6
- Search: {
7
- search(): string;
8
- suggestions(): string;
9
- };
10
- Package: {
11
- packageInfo(packageName: string): string;
12
- multiPackageInfo(): string;
13
- };
14
- };
package/dist/Endpoints.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Endpoint = void 0;
4
- exports.Endpoint = {
5
- PACKAGE: 'package',
6
- SEARCH: 'search',
7
- SUGGESTIONS: 'suggestions',
8
- MGET: 'mget',
9
- Search: {
10
- search() {
11
- return `/${exports.Endpoint.SEARCH}`;
12
- },
13
- suggestions() {
14
- return `/${exports.Endpoint.SEARCH}/${exports.Endpoint.SUGGESTIONS}`;
15
- },
16
- },
17
- Package: {
18
- packageInfo(packageName) {
19
- return `/${exports.Endpoint.PACKAGE}/${encodeURIComponent(packageName)}`;
20
- },
21
- multiPackageInfo() {
22
- return `/${exports.Endpoint.PACKAGE}/${exports.Endpoint.MGET}`;
23
- },
24
- },
25
- };
package/dist/NpmsIO.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { API, ClientOptions } from './interfaces/';
2
- export declare class NpmsIO {
3
- readonly api: API;
4
- private readonly apiClient;
5
- constructor(options?: ClientOptions);
6
- /**
7
- * Set a new API URL.
8
- * @param newURL The new API url
9
- */
10
- setApiUrl(newURL: string): void;
11
- }
package/dist/NpmsIO.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NpmsIO = void 0;
4
- const api_client_1 = require("@ffflorian/api-client");
5
- const api_1 = require("./api");
6
- class NpmsIO {
7
- constructor(options = {}) {
8
- this.apiClient = new api_client_1.APIClient(options.apiUrl || 'https://api.npms.io/v2');
9
- this.api = {
10
- package: new api_1.PackageAPI(this.apiClient),
11
- search: new api_1.SearchAPI(this.apiClient),
12
- };
13
- }
14
- /**
15
- * Set a new API URL.
16
- * @param newURL The new API url
17
- */
18
- setApiUrl(newURL) {
19
- this.apiClient.setBaseURL(newURL);
20
- this.api.package = new api_1.PackageAPI(this.apiClient);
21
- this.api.search = new api_1.SearchAPI(this.apiClient);
22
- }
23
- }
24
- exports.NpmsIO = NpmsIO;
@@ -1,18 +0,0 @@
1
- import type { APIClient } from '@ffflorian/api-client';
2
- import type { PackageInfo } from '../interfaces/';
3
- export declare class PackageAPI {
4
- private readonly apiClient;
5
- constructor(apiClient: APIClient);
6
- /**
7
- * Get various packages info.
8
- * @param packageNames The package names
9
- * @see https://api-docs.npms.io/#api-Package-GetMultiPackageInfo
10
- */
11
- multiPackageInfo(packageNames: string[]): Promise<Record<string, PackageInfo>>;
12
- /**
13
- * Get package info.
14
- * @param packageName The package name
15
- * @see https://api-docs.npms.io/#api-Package-GetPackageInfo
16
- */
17
- packageInfo(packageName: string): Promise<PackageInfo>;
18
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PackageAPI = void 0;
13
- const Endpoints_1 = require("../Endpoints");
14
- class PackageAPI {
15
- constructor(apiClient) {
16
- this.apiClient = apiClient;
17
- }
18
- /**
19
- * Get various packages info.
20
- * @param packageNames The package names
21
- * @see https://api-docs.npms.io/#api-Package-GetMultiPackageInfo
22
- */
23
- multiPackageInfo(packageNames) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const endpoint = Endpoints_1.Endpoint.Package.multiPackageInfo();
26
- const { data } = yield this.apiClient.post(endpoint, packageNames);
27
- return data;
28
- });
29
- }
30
- /**
31
- * Get package info.
32
- * @param packageName The package name
33
- * @see https://api-docs.npms.io/#api-Package-GetPackageInfo
34
- */
35
- packageInfo(packageName) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const endpoint = Endpoints_1.Endpoint.Package.packageInfo(packageName);
38
- const { data } = yield this.apiClient.get(endpoint);
39
- return data;
40
- });
41
- }
42
- }
43
- exports.PackageAPI = PackageAPI;
@@ -1,34 +0,0 @@
1
- import type { APIClient } from '@ffflorian/api-client';
2
- import type { SearchOptions, SearchResult, SuggestionsOptions } from '../interfaces';
3
- export declare class SearchAPI {
4
- private readonly apiClient;
5
- constructor(apiClient: APIClient);
6
- /**
7
- * Fetch suggestions.
8
- * @param query Perform a search query
9
- * @see https://api-docs.npms.io/#api-Search-SearchSuggestions
10
- */
11
- getSuggestions(query: string, options?: SuggestionsOptions): Promise<SearchResult>;
12
- /**
13
- * Perform a search query.
14
- * @param query Besides normal text, `query` supports qualifiers to express filters and other modifiers:
15
- * - `scope:types` Show/filter results that belong to the `@types` scope
16
- * - `author:sindresorhus` Show/filter results in which `sindresorhus` is the author
17
- * - `maintainer:sindresorhus` Show/filter results in which `sindresorhus` is qualifier as a maintainer
18
- * - `keywords:gulpplugin` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
19
- * - `not:deprecated` Exclude deprecated packages from the results
20
- * - `not:unstable` Exclude packages whose version is `< 1.0.0`
21
- * - `not:insecure` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
22
- * - `is:deprecated` Show/filter is deprecated packages
23
- * - `is:unstable` Show/filter packages whose version is `< 1.0.0`
24
- * - `is:insecure` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
25
- * - `boost-exact:false` Do not boost exact matches, defaults to `true`
26
- * - `score-effect:14` Set the effect that package scores have for the final search score, defaults to `15.3`
27
- * - `quality-weight:1` Set the weight that quality has for the each package score, defaults to `1.95`
28
- * - `popularity-weight:1` Set the weight that popularity has for the each package score, defaults to `3.3`
29
- * - `maintenance-weight:1` Set the weight that the quality has for the each package score, defaults to `2.05`
30
- * @param options Additional search options
31
- * @see https://api-docs.npms.io/#api-Search-ExecuteSearchQuery
32
- */
33
- searchPackage(query: string, options?: SearchOptions): Promise<SearchResult>;
34
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SearchAPI = void 0;
13
- const Endpoints_1 = require("../Endpoints");
14
- class SearchAPI {
15
- constructor(apiClient) {
16
- this.apiClient = apiClient;
17
- }
18
- /**
19
- * Fetch suggestions.
20
- * @param query Perform a search query
21
- * @see https://api-docs.npms.io/#api-Search-SearchSuggestions
22
- */
23
- getSuggestions(query_1) {
24
- return __awaiter(this, arguments, void 0, function* (query, options = {}) {
25
- const endpoint = Endpoints_1.Endpoint.Search.search();
26
- const params = Object.assign({ q: query }, (options.size && { size: options.size }));
27
- const { data } = yield this.apiClient.get(endpoint, { params });
28
- return data;
29
- });
30
- }
31
- /**
32
- * Perform a search query.
33
- * @param query Besides normal text, `query` supports qualifiers to express filters and other modifiers:
34
- * - `scope:types` Show/filter results that belong to the `@types` scope
35
- * - `author:sindresorhus` Show/filter results in which `sindresorhus` is the author
36
- * - `maintainer:sindresorhus` Show/filter results in which `sindresorhus` is qualifier as a maintainer
37
- * - `keywords:gulpplugin` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
38
- * - `not:deprecated` Exclude deprecated packages from the results
39
- * - `not:unstable` Exclude packages whose version is `< 1.0.0`
40
- * - `not:insecure` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
41
- * - `is:deprecated` Show/filter is deprecated packages
42
- * - `is:unstable` Show/filter packages whose version is `< 1.0.0`
43
- * - `is:insecure` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
44
- * - `boost-exact:false` Do not boost exact matches, defaults to `true`
45
- * - `score-effect:14` Set the effect that package scores have for the final search score, defaults to `15.3`
46
- * - `quality-weight:1` Set the weight that quality has for the each package score, defaults to `1.95`
47
- * - `popularity-weight:1` Set the weight that popularity has for the each package score, defaults to `3.3`
48
- * - `maintenance-weight:1` Set the weight that the quality has for the each package score, defaults to `2.05`
49
- * @param options Additional search options
50
- * @see https://api-docs.npms.io/#api-Search-ExecuteSearchQuery
51
- */
52
- searchPackage(query_1) {
53
- return __awaiter(this, arguments, void 0, function* (query, options = {}) {
54
- const endpoint = Endpoints_1.Endpoint.Search.search();
55
- const params = Object.assign(Object.assign({ q: query }, (options.from && { from: options.from })), (options.size && { size: options.size }));
56
- const { data } = yield this.apiClient.get(endpoint, { params });
57
- return data;
58
- });
59
- }
60
- }
61
- exports.SearchAPI = SearchAPI;
@@ -1,2 +0,0 @@
1
- export * from './PackageAPI';
2
- export * from './SearchAPI';
package/dist/api/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./PackageAPI"), exports);
18
- __exportStar(require("./SearchAPI"), exports);
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './NpmsIO';
2
- export * from './interfaces/';
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./NpmsIO"), exports);
18
- __exportStar(require("./interfaces/"), exports);
@@ -1,5 +0,0 @@
1
- import { PackageAPI, SearchAPI } from '../api/';
2
- export interface API {
3
- package: PackageAPI;
4
- search: SearchAPI;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export interface ClientOptions {
2
- apiUrl?: string;
3
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,151 +0,0 @@
1
- export interface PackageInfo {
2
- /** The date in which the package was last analyzed */
3
- analyzedAt: string;
4
- /** The collected information from all sources */
5
- collected: Collected;
6
- /** The error associated with the last analyze attempt */
7
- error?: Error;
8
- /** The package evaluation */
9
- evaluation: Evaluation;
10
- /** The package score */
11
- score: Score;
12
- }
13
- interface Badge {
14
- info: Info;
15
- urls: Urls;
16
- }
17
- interface Collected {
18
- github?: GitHub;
19
- metadata: Metadata;
20
- npm: Npm;
21
- source?: Source;
22
- }
23
- interface Contributor {
24
- commitsCount: number;
25
- username: string;
26
- }
27
- interface Detail {
28
- maintenance: number;
29
- popularity: number;
30
- quality: number;
31
- }
32
- interface Error {
33
- code: string;
34
- message: string;
35
- }
36
- interface Evaluation {
37
- maintenance: Maintenance;
38
- popularity: Popularity;
39
- quality: Quality;
40
- }
41
- interface Files {
42
- hasChangelog: boolean;
43
- readmeSize: number;
44
- testsSize: number;
45
- }
46
- interface GitHub {
47
- commits: Release[];
48
- contributors: Contributor[];
49
- forksCount: number;
50
- homepage?: string;
51
- issues: Issues;
52
- starsCount: number;
53
- statuses: Status[];
54
- subscribersCount: number;
55
- }
56
- interface Issues {
57
- count: number;
58
- distribution: Record<string, number>;
59
- isDisabled: boolean;
60
- openCount: number;
61
- }
62
- interface Info {
63
- modifiers?: Modifiers;
64
- service: string;
65
- type: string;
66
- }
67
- interface Links {
68
- bugs?: string;
69
- homepage?: string;
70
- npm: string;
71
- repository?: string;
72
- }
73
- interface Maintenance {
74
- commitsFrequency: number;
75
- issuesDistribution: number;
76
- openIssues: number;
77
- releasesFrequency: number;
78
- }
79
- interface Metadata {
80
- date: string;
81
- dependencies: Record<string, string>;
82
- description: string;
83
- hasSelectiveFiles?: boolean;
84
- hasTestScript?: boolean;
85
- keywords: string[];
86
- license: string;
87
- links: Links;
88
- maintainers: Publisher[];
89
- name: string;
90
- publisher: Publisher;
91
- readme?: string;
92
- releases: Release[];
93
- repository: Repository;
94
- scope: string;
95
- version: string;
96
- }
97
- interface Modifiers {
98
- type: string;
99
- }
100
- interface Npm {
101
- dependentsCount: number;
102
- downloads: Release[];
103
- starsCount: number;
104
- }
105
- interface Popularity {
106
- communityInterest: number;
107
- dependentsCount: number;
108
- downloadsAcceleration: number;
109
- downloadsCount: number;
110
- }
111
- interface Publisher {
112
- email?: string;
113
- username: string;
114
- }
115
- interface Quality {
116
- branding: number;
117
- carefulness: number;
118
- health: number;
119
- tests: number;
120
- }
121
- interface Release {
122
- count: number;
123
- from: string;
124
- to: string;
125
- }
126
- interface Repository {
127
- directory: string;
128
- type?: string;
129
- url: string;
130
- }
131
- interface Score {
132
- detail: Detail;
133
- final: number;
134
- }
135
- interface Source {
136
- badges: Badge[];
137
- coverage: number;
138
- files: Files;
139
- linters: string[];
140
- }
141
- interface Status {
142
- context: string;
143
- state: string;
144
- }
145
- interface Urls {
146
- content: string;
147
- original: string;
148
- service?: string;
149
- shields: string;
150
- }
151
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- export interface SearchOptions extends SuggestionsOptions {
2
- /**
3
- * The offset in which to start searching from (max of 5000)
4
- *
5
- * Default value: `0`
6
- */
7
- from?: string;
8
- }
9
- export interface SuggestionsOptions {
10
- /**
11
- * The total number of results to return (max of 250)
12
- *
13
- * Default value: `25`
14
- */
15
- size?: string;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,57 +0,0 @@
1
- export interface SearchResult {
2
- results: Result[];
3
- total: number;
4
- }
5
- interface Result {
6
- /** The package flags (deprecated, unstable, insecure) */
7
- flags?: Flags;
8
- /** The package data which contains the name, version and other useful information */
9
- package: Package;
10
- /** The package score */
11
- score: Score;
12
- /** The computed search score (from Elasticsearch) */
13
- searchScore: number;
14
- }
15
- interface Author {
16
- email?: string;
17
- name: string;
18
- url?: string;
19
- username?: string;
20
- }
21
- interface Detail {
22
- maintenance: number;
23
- popularity: number;
24
- quality: number;
25
- }
26
- interface Flags {
27
- deprecated?: boolean;
28
- insecure?: boolean;
29
- unstable?: boolean;
30
- }
31
- interface Links {
32
- bugs?: string;
33
- homepage?: string;
34
- npm: string;
35
- repository?: string;
36
- }
37
- interface Package {
38
- author?: Author;
39
- date: string;
40
- description: string;
41
- keywords?: string[];
42
- links: Links;
43
- maintainers: Publisher[];
44
- name: string;
45
- publisher: Publisher;
46
- scope: string;
47
- version: string;
48
- }
49
- interface Publisher {
50
- email: string;
51
- username: string;
52
- }
53
- interface Score {
54
- detail: Detail;
55
- final: number;
56
- }
57
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export * from './API';
2
- export * from './ClientOptions';
3
- export * from './PackageInfo';
4
- export * from './SearchOptions';
5
- export * from './SearchResult';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./API"), exports);
18
- __exportStar(require("./ClientOptions"), exports);
19
- __exportStar(require("./PackageInfo"), exports);
20
- __exportStar(require("./SearchOptions"), exports);
21
- __exportStar(require("./SearchResult"), exports);