libraries.io 3.3.8 → 3.4.1
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/LibrariesIO.d.ts +2 -2
- package/dist/LibrariesIO.js +21 -13
- package/dist/api/APIBase.d.ts +5 -5
- package/dist/api/APIBase.js +3 -3
- package/dist/api/GitHub/GitHubRepositoryAPI.d.ts +2 -2
- package/dist/api/GitHub/GitHubUserAPI.d.ts +2 -2
- package/dist/api/PlatformAPI.d.ts +2 -2
- package/dist/api/ProjectAPI.d.ts +2 -2
- package/dist/api/UserAPI.d.ts +2 -2
- package/package.json +9 -9
package/dist/LibrariesIO.d.ts
CHANGED
package/dist/LibrariesIO.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LibrariesIO = void 0;
|
|
4
|
-
const
|
|
4
|
+
const api_client_1 = require("@ffflorian/api-client");
|
|
5
5
|
const api_1 = require("./api");
|
|
6
6
|
class LibrariesIO {
|
|
7
7
|
constructor(options) {
|
|
@@ -9,17 +9,25 @@ class LibrariesIO {
|
|
|
9
9
|
options = { apiKey: options };
|
|
10
10
|
}
|
|
11
11
|
this.options = Object.assign({ apiUrl: 'https://libraries.io/api' }, options);
|
|
12
|
-
this.apiClient =
|
|
13
|
-
|
|
12
|
+
this.apiClient = new api_client_1.APIClient(this.options.apiUrl);
|
|
13
|
+
this.apiClient.interceptors.request.push((_url, options) => {
|
|
14
|
+
if (options.body) {
|
|
15
|
+
const body = JSON.parse(options.body.toString());
|
|
16
|
+
body.api_key = this.options.apiKey;
|
|
17
|
+
options.body = JSON.stringify(body);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const body = { api_key: this.options.apiKey };
|
|
21
|
+
options.body = JSON.stringify(body);
|
|
22
|
+
}
|
|
23
|
+
return options;
|
|
14
24
|
});
|
|
15
|
-
this.apiClient.interceptors.
|
|
16
|
-
config.data = Object.assign(Object.assign({}, config.data), { api_key: this.options.apiKey });
|
|
17
|
-
return config;
|
|
18
|
-
});
|
|
19
|
-
this.apiClient.interceptors.response.use(response => {
|
|
25
|
+
this.apiClient.interceptors.response.push(response => {
|
|
20
26
|
const headers = response.headers;
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
if (headers.get('total')) {
|
|
28
|
+
return Object.assign(Object.assign({}, response), { totalResults: Number(headers.get('total')) });
|
|
29
|
+
}
|
|
30
|
+
return response;
|
|
23
31
|
});
|
|
24
32
|
this.api = {
|
|
25
33
|
github: {
|
|
@@ -47,10 +55,10 @@ class LibrariesIO {
|
|
|
47
55
|
*/
|
|
48
56
|
/**
|
|
49
57
|
* Set a new API URL.
|
|
50
|
-
* @param
|
|
58
|
+
* @param newURL The new API url
|
|
51
59
|
*/
|
|
52
|
-
setApiUrl(
|
|
53
|
-
this.apiClient.
|
|
60
|
+
setApiUrl(newURL) {
|
|
61
|
+
this.apiClient.setBaseURL(newURL);
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
exports.LibrariesIO = LibrariesIO;
|
package/dist/api/APIBase.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions } from '../interfaces';
|
|
3
3
|
export declare class APIBase {
|
|
4
|
-
protected readonly apiClient:
|
|
4
|
+
protected readonly apiClient: APIClient;
|
|
5
5
|
protected readonly options: ClientOptions;
|
|
6
|
-
constructor(apiClient:
|
|
6
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
7
7
|
/**
|
|
8
8
|
* Set a new API key.
|
|
9
9
|
* @param apiKey The new API key
|
|
@@ -11,8 +11,8 @@ export declare class APIBase {
|
|
|
11
11
|
setApiKey(apiKey: string): void;
|
|
12
12
|
/**
|
|
13
13
|
* Set a new API URL.
|
|
14
|
-
* @param
|
|
14
|
+
* @param newURL The new API url
|
|
15
15
|
*/
|
|
16
|
-
setApiUrl(
|
|
16
|
+
setApiUrl(newURL: string): void;
|
|
17
17
|
protected checkApiKey(apiName?: string): void;
|
|
18
18
|
}
|
package/dist/api/APIBase.js
CHANGED
|
@@ -15,10 +15,10 @@ class APIBase {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Set a new API URL.
|
|
18
|
-
* @param
|
|
18
|
+
* @param newURL The new API url
|
|
19
19
|
*/
|
|
20
|
-
setApiUrl(
|
|
21
|
-
this.apiClient.
|
|
20
|
+
setApiUrl(newURL) {
|
|
21
|
+
this.apiClient.setBaseURL(newURL);
|
|
22
22
|
}
|
|
23
23
|
checkApiKey(apiName) {
|
|
24
24
|
const name = apiName ? `the "${apiName}"` : 'this';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions, LibrariesIOResult, PaginationOptions, Project, RepositoryWithDependencies } from '../../interfaces/';
|
|
3
3
|
import { APIBase } from '../APIBase';
|
|
4
4
|
export declare class GitHubRepositoryAPI extends APIBase {
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
6
6
|
/**
|
|
7
7
|
* Get a list of packages referencing the given repository.
|
|
8
8
|
* @see https://libraries.io/api#repository-projects
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions, Contributor, LibrariesIOResult, PaginationOptions, PlatformType, Project, Repository } from '../../interfaces/';
|
|
3
3
|
import { APIBase } from '../APIBase';
|
|
4
4
|
export declare class GitHubUserAPI extends APIBase {
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
6
6
|
/**
|
|
7
7
|
* Get a list of packages that the given user has contributed to.
|
|
8
8
|
* @see https://libraries.io/api#user-project-contributions
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions, LibrariesIOResult, PaginationOptions, Platform } from '../interfaces/';
|
|
3
3
|
import { APIBase } from './APIBase';
|
|
4
4
|
export declare class PlatformAPI extends APIBase {
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
6
6
|
/**
|
|
7
7
|
* Get list of supported package managers.
|
|
8
8
|
* @see https://libraries.io/api#platforms
|
package/dist/api/ProjectAPI.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions, Contributor, LibrariesIOResult, PaginationOptions, PlatformType, Project, ProjectUsage, ProjectWithDependencies, Repository, SearchOptions } from '../interfaces/';
|
|
3
3
|
import { APIBase } from './APIBase';
|
|
4
4
|
export declare class ProjectAPI extends APIBase {
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
6
6
|
/**
|
|
7
7
|
* Get users that have contributed to a given project.
|
|
8
8
|
* @see https://libraries.io/api#project-contributors
|
package/dist/api/UserAPI.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { APIClient } from '@ffflorian/api-client';
|
|
2
2
|
import type { ClientOptions, LibrariesIOHeaders, LibrariesIOResult, PaginationOptions, PlatformType, PreReleaseOptions, Subscription } from '../interfaces/';
|
|
3
3
|
import { APIBase } from './APIBase';
|
|
4
4
|
export declare class UserAPI extends APIBase {
|
|
5
|
-
constructor(apiClient:
|
|
5
|
+
constructor(apiClient: APIClient, options: ClientOptions);
|
|
6
6
|
/**
|
|
7
7
|
* List packages that a user is subscribed to recieved notifications about new releases.
|
|
8
8
|
* @see https://libraries.io/api#subscriptions-index
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"
|
|
4
|
+
"@ffflorian/api-client": "2.1.2"
|
|
5
5
|
},
|
|
6
6
|
"description": "A libraries.io API client",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@types/node": "~24",
|
|
9
|
-
"rimraf": "6.0
|
|
10
|
-
"typedoc": "0.28.
|
|
9
|
+
"rimraf": "6.1.0",
|
|
10
|
+
"typedoc": "0.28.14",
|
|
11
11
|
"typescript": "5.9.3",
|
|
12
|
-
"vitest": "
|
|
12
|
+
"vitest": "4.0.11"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">= 21"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"name": "libraries.io",
|
|
29
29
|
"repository": "https://github.com/ffflorian/api-clients/tree/main/packages/libraries.io",
|
|
30
30
|
"scripts": {
|
|
31
|
-
"build:ts": "tsc",
|
|
32
|
-
"build:docs": "typedoc --options ../../typedoc.json --out ../../docs/packages/libraries.io src/index.ts",
|
|
31
|
+
"build:ts": "tsc -p tsconfig.build.json",
|
|
32
|
+
"build:docs": "typedoc --tsconfig tsconfig.build.json --options ../../typedoc.json --out ../../docs/packages/libraries.io src/index.ts",
|
|
33
33
|
"clean": "rimraf dist",
|
|
34
34
|
"dist": "yarn clean && yarn build:ts",
|
|
35
35
|
"test": "vitest"
|
|
36
36
|
},
|
|
37
|
-
"version": "3.
|
|
38
|
-
"gitHead": "
|
|
37
|
+
"version": "3.4.1",
|
|
38
|
+
"gitHead": "e5aa38e74982d788efcfac2dd3b46be012c98afb"
|
|
39
39
|
}
|