npms.io 2.4.6 → 2.4.7
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/dist/Endpoints.d.ts +14 -0
- package/dist/Endpoints.js +25 -0
- package/dist/NpmsIO.d.ts +11 -0
- package/dist/NpmsIO.js +24 -0
- package/dist/api/PackageAPI.d.ts +18 -0
- package/dist/api/PackageAPI.js +43 -0
- package/dist/api/SearchAPI.d.ts +34 -0
- package/dist/api/SearchAPI.js +65 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/dist/interfaces/API.d.ts +5 -0
- package/dist/interfaces/API.js +2 -0
- package/dist/interfaces/ClientOptions.d.ts +3 -0
- package/dist/interfaces/ClientOptions.js +2 -0
- package/dist/interfaces/PackageInfo.d.ts +151 -0
- package/dist/interfaces/PackageInfo.js +2 -0
- package/dist/interfaces/SearchOptions.d.ts +16 -0
- package/dist/interfaces/SearchOptions.js +2 -0
- package/dist/interfaces/SearchResult.d.ts +57 -0
- package/dist/interfaces/SearchResult.js +2 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/interfaces/index.js +21 -0
- package/package.json +4 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const Endpoint: {
|
|
2
|
+
MGET: string;
|
|
3
|
+
PACKAGE: string;
|
|
4
|
+
Package: {
|
|
5
|
+
multiPackageInfo(): string;
|
|
6
|
+
packageInfo(packageName: string): string;
|
|
7
|
+
};
|
|
8
|
+
SEARCH: string;
|
|
9
|
+
Search: {
|
|
10
|
+
search(): string;
|
|
11
|
+
suggestions(): string;
|
|
12
|
+
};
|
|
13
|
+
SUGGESTIONS: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Endpoint = void 0;
|
|
4
|
+
exports.Endpoint = {
|
|
5
|
+
MGET: 'mget',
|
|
6
|
+
PACKAGE: 'package',
|
|
7
|
+
Package: {
|
|
8
|
+
multiPackageInfo() {
|
|
9
|
+
return `/${exports.Endpoint.PACKAGE}/${exports.Endpoint.MGET}`;
|
|
10
|
+
},
|
|
11
|
+
packageInfo(packageName) {
|
|
12
|
+
return `/${exports.Endpoint.PACKAGE}/${encodeURIComponent(packageName)}`;
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
SEARCH: 'search',
|
|
16
|
+
Search: {
|
|
17
|
+
search() {
|
|
18
|
+
return `/${exports.Endpoint.SEARCH}`;
|
|
19
|
+
},
|
|
20
|
+
suggestions() {
|
|
21
|
+
return `/${exports.Endpoint.SEARCH}/${exports.Endpoint.SUGGESTIONS}`;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
SUGGESTIONS: 'suggestions',
|
|
25
|
+
};
|
package/dist/NpmsIO.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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({
|
|
27
|
+
// eslint-disable-next-line id-length
|
|
28
|
+
q: query }, (options.size && { size: options.size }));
|
|
29
|
+
const { data } = yield this.apiClient.get(endpoint, { params });
|
|
30
|
+
return data;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Perform a search query.
|
|
35
|
+
* @param query Besides normal text, `query` supports qualifiers to express filters and other modifiers:
|
|
36
|
+
* - `scope:types` Show/filter results that belong to the `@types` scope
|
|
37
|
+
* - `author:sindresorhus` Show/filter results in which `sindresorhus` is the author
|
|
38
|
+
* - `maintainer:sindresorhus` Show/filter results in which `sindresorhus` is qualifier as a maintainer
|
|
39
|
+
* - `keywords:gulpplugin` Show/filter results that have `gulpplugin` in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g.: `-framework`)
|
|
40
|
+
* - `not:deprecated` Exclude deprecated packages from the results
|
|
41
|
+
* - `not:unstable` Exclude packages whose version is `< 1.0.0`
|
|
42
|
+
* - `not:insecure` Exclude packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
|
|
43
|
+
* - `is:deprecated` Show/filter is deprecated packages
|
|
44
|
+
* - `is:unstable` Show/filter packages whose version is `< 1.0.0`
|
|
45
|
+
* - `is:insecure` Show/filter packages that are insecure or have vulnerable dependencies (as per [nsp](https://nodesecurity.io/))
|
|
46
|
+
* - `boost-exact:false` Do not boost exact matches, defaults to `true`
|
|
47
|
+
* - `score-effect:14` Set the effect that package scores have for the final search score, defaults to `15.3`
|
|
48
|
+
* - `quality-weight:1` Set the weight that quality has for the each package score, defaults to `1.95`
|
|
49
|
+
* - `popularity-weight:1` Set the weight that popularity has for the each package score, defaults to `3.3`
|
|
50
|
+
* - `maintenance-weight:1` Set the weight that the quality has for the each package score, defaults to `2.05`
|
|
51
|
+
* @param options Additional search options
|
|
52
|
+
* @see https://api-docs.npms.io/#api-Search-ExecuteSearchQuery
|
|
53
|
+
*/
|
|
54
|
+
searchPackage(query_1) {
|
|
55
|
+
return __awaiter(this, arguments, void 0, function* (query, options = {}) {
|
|
56
|
+
const endpoint = Endpoints_1.Endpoint.Search.search();
|
|
57
|
+
const params = Object.assign(Object.assign({
|
|
58
|
+
// eslint-disable-next-line id-length
|
|
59
|
+
q: query }, (options.from && { from: options.from })), (options.size && { size: options.size }));
|
|
60
|
+
const { data } = yield this.apiClient.get(endpoint, { params });
|
|
61
|
+
return data;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.SearchAPI = SearchAPI;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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("./interfaces/"), exports);
|
|
19
|
+
__exportStar(require("./NpmsIO"), exports);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export interface Badge {
|
|
2
|
+
info: Info;
|
|
3
|
+
urls: Urls;
|
|
4
|
+
}
|
|
5
|
+
export interface Collected {
|
|
6
|
+
github?: GitHub;
|
|
7
|
+
metadata: Metadata;
|
|
8
|
+
npm: Npm;
|
|
9
|
+
source?: Source;
|
|
10
|
+
}
|
|
11
|
+
export interface Error {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Evaluation {
|
|
16
|
+
maintenance: Maintenance;
|
|
17
|
+
popularity: Popularity;
|
|
18
|
+
quality: Quality;
|
|
19
|
+
}
|
|
20
|
+
export interface PackageInfo {
|
|
21
|
+
/** The date in which the package was last analyzed */
|
|
22
|
+
analyzedAt: string;
|
|
23
|
+
/** The collected information from all sources */
|
|
24
|
+
collected: Collected;
|
|
25
|
+
/** The error associated with the last analyze attempt */
|
|
26
|
+
error?: Error;
|
|
27
|
+
/** The package evaluation */
|
|
28
|
+
evaluation: Evaluation;
|
|
29
|
+
/** The package score */
|
|
30
|
+
score: Score;
|
|
31
|
+
}
|
|
32
|
+
export interface Score {
|
|
33
|
+
detail: Detail;
|
|
34
|
+
final: number;
|
|
35
|
+
}
|
|
36
|
+
interface Contributor {
|
|
37
|
+
commitsCount: number;
|
|
38
|
+
username: string;
|
|
39
|
+
}
|
|
40
|
+
interface Detail {
|
|
41
|
+
maintenance: number;
|
|
42
|
+
popularity: number;
|
|
43
|
+
quality: number;
|
|
44
|
+
}
|
|
45
|
+
interface Files {
|
|
46
|
+
hasChangelog: boolean;
|
|
47
|
+
readmeSize: number;
|
|
48
|
+
testsSize: number;
|
|
49
|
+
}
|
|
50
|
+
interface GitHub {
|
|
51
|
+
commits: Release[];
|
|
52
|
+
contributors: Contributor[];
|
|
53
|
+
forksCount: number;
|
|
54
|
+
homepage?: string;
|
|
55
|
+
issues: Issues;
|
|
56
|
+
starsCount: number;
|
|
57
|
+
statuses: Status[];
|
|
58
|
+
subscribersCount: number;
|
|
59
|
+
}
|
|
60
|
+
interface Info {
|
|
61
|
+
modifiers?: Modifiers;
|
|
62
|
+
service: string;
|
|
63
|
+
type: string;
|
|
64
|
+
}
|
|
65
|
+
interface Issues {
|
|
66
|
+
count: number;
|
|
67
|
+
distribution: Record<string, number>;
|
|
68
|
+
isDisabled: boolean;
|
|
69
|
+
openCount: number;
|
|
70
|
+
}
|
|
71
|
+
interface Links {
|
|
72
|
+
bugs?: string;
|
|
73
|
+
homepage?: string;
|
|
74
|
+
npm: string;
|
|
75
|
+
repository?: string;
|
|
76
|
+
}
|
|
77
|
+
interface Maintenance {
|
|
78
|
+
commitsFrequency: number;
|
|
79
|
+
issuesDistribution: number;
|
|
80
|
+
openIssues: number;
|
|
81
|
+
releasesFrequency: number;
|
|
82
|
+
}
|
|
83
|
+
interface Metadata {
|
|
84
|
+
date: string;
|
|
85
|
+
dependencies: Record<string, string>;
|
|
86
|
+
description: string;
|
|
87
|
+
hasSelectiveFiles?: boolean;
|
|
88
|
+
hasTestScript?: boolean;
|
|
89
|
+
keywords: string[];
|
|
90
|
+
license: string;
|
|
91
|
+
links: Links;
|
|
92
|
+
maintainers: Publisher[];
|
|
93
|
+
name: string;
|
|
94
|
+
publisher: Publisher;
|
|
95
|
+
readme?: string;
|
|
96
|
+
releases: Release[];
|
|
97
|
+
repository: Repository;
|
|
98
|
+
scope: string;
|
|
99
|
+
version: string;
|
|
100
|
+
}
|
|
101
|
+
interface Modifiers {
|
|
102
|
+
type: string;
|
|
103
|
+
}
|
|
104
|
+
interface Npm {
|
|
105
|
+
dependentsCount: number;
|
|
106
|
+
downloads: Release[];
|
|
107
|
+
starsCount: number;
|
|
108
|
+
}
|
|
109
|
+
interface Popularity {
|
|
110
|
+
communityInterest: number;
|
|
111
|
+
dependentsCount: number;
|
|
112
|
+
downloadsAcceleration: number;
|
|
113
|
+
downloadsCount: number;
|
|
114
|
+
}
|
|
115
|
+
interface Publisher {
|
|
116
|
+
email?: string;
|
|
117
|
+
username: string;
|
|
118
|
+
}
|
|
119
|
+
interface Quality {
|
|
120
|
+
branding: number;
|
|
121
|
+
carefulness: number;
|
|
122
|
+
health: number;
|
|
123
|
+
tests: number;
|
|
124
|
+
}
|
|
125
|
+
interface Release {
|
|
126
|
+
count: number;
|
|
127
|
+
from: string;
|
|
128
|
+
to: string;
|
|
129
|
+
}
|
|
130
|
+
interface Repository {
|
|
131
|
+
directory: string;
|
|
132
|
+
type?: string;
|
|
133
|
+
url: string;
|
|
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 {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface Author {
|
|
2
|
+
email?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
username?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Flags {
|
|
8
|
+
deprecated?: boolean;
|
|
9
|
+
insecure?: boolean;
|
|
10
|
+
unstable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface Package {
|
|
13
|
+
author?: Author;
|
|
14
|
+
date: string;
|
|
15
|
+
description: string;
|
|
16
|
+
keywords?: string[];
|
|
17
|
+
links: Links;
|
|
18
|
+
maintainers: Publisher[];
|
|
19
|
+
name: string;
|
|
20
|
+
publisher: Publisher;
|
|
21
|
+
scope: string;
|
|
22
|
+
version: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Publisher {
|
|
25
|
+
email: string;
|
|
26
|
+
username: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Result {
|
|
29
|
+
/** The package flags (deprecated, unstable, insecure) */
|
|
30
|
+
flags?: Flags;
|
|
31
|
+
/** The package data which contains the name, version and other useful information */
|
|
32
|
+
package: Package;
|
|
33
|
+
/** The package score */
|
|
34
|
+
score: Score;
|
|
35
|
+
/** The computed search score (from Elasticsearch) */
|
|
36
|
+
searchScore: number;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchResult {
|
|
39
|
+
results: Result[];
|
|
40
|
+
total: number;
|
|
41
|
+
}
|
|
42
|
+
interface Detail {
|
|
43
|
+
maintenance: number;
|
|
44
|
+
popularity: number;
|
|
45
|
+
quality: number;
|
|
46
|
+
}
|
|
47
|
+
interface Links {
|
|
48
|
+
bugs?: string;
|
|
49
|
+
homepage?: string;
|
|
50
|
+
npm: string;
|
|
51
|
+
repository?: string;
|
|
52
|
+
}
|
|
53
|
+
interface Score {
|
|
54
|
+
detail: Detail;
|
|
55
|
+
final: number;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@ffflorian/api-client": "2.5.
|
|
4
|
+
"@ffflorian/api-client": "2.5.1"
|
|
5
5
|
},
|
|
6
6
|
"description": "A npms.io API client",
|
|
7
7
|
"devDependencies": {
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"readme": "https://github.com/ffflorian/api-clients#readme",
|
|
30
30
|
"repository": "https://github.com/ffflorian/api-clients.git",
|
|
31
31
|
"scripts": {
|
|
32
|
+
"build": "yarn build:ts",
|
|
32
33
|
"build:ts": "tsc -p tsconfig.build.json",
|
|
33
34
|
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/npms.io src/index.ts",
|
|
34
35
|
"clean": "rimraf dist",
|
|
35
|
-
"dist": "yarn clean && yarn build
|
|
36
|
+
"dist": "yarn clean && yarn build",
|
|
36
37
|
"test": "exit 0"
|
|
37
38
|
},
|
|
38
|
-
"version": "2.4.
|
|
39
|
+
"version": "2.4.7"
|
|
39
40
|
}
|