crates.io 2.4.4 → 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 +5 -6
- package/dist/CratesIO.d.ts +0 -22
- package/dist/CratesIO.js +0 -50
- package/dist/Endpoints.d.ts +0 -30
- package/dist/Endpoints.js +0 -62
- package/dist/api/CratesAPI.d.ts +0 -80
- package/dist/api/CratesAPI.js +0 -184
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -17
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -18
- package/dist/interfaces/API.d.ts +0 -4
- package/dist/interfaces/API.js +0 -2
- package/dist/interfaces/Category.d.ts +0 -8
- package/dist/interfaces/Category.js +0 -2
- package/dist/interfaces/Crate.d.ts +0 -30
- package/dist/interfaces/Crate.js +0 -2
- package/dist/interfaces/Dependency.d.ts +0 -12
- package/dist/interfaces/Dependency.js +0 -2
- package/dist/interfaces/Download.d.ts +0 -6
- package/dist/interfaces/Download.js +0 -2
- package/dist/interfaces/Keyword.d.ts +0 -6
- package/dist/interfaces/Keyword.js +0 -2
- package/dist/interfaces/Options.d.ts +0 -9
- package/dist/interfaces/Options.js +0 -2
- package/dist/interfaces/Result.d.ts +0 -47
- package/dist/interfaces/Result.js +0 -2
- package/dist/interfaces/Summary.d.ts +0 -13
- package/dist/interfaces/Summary.js +0 -2
- package/dist/interfaces/Team.d.ts +0 -2
- package/dist/interfaces/Team.js +0 -2
- package/dist/interfaces/User.d.ts +0 -8
- package/dist/interfaces/User.js +0 -2
- package/dist/interfaces/Version.d.ts +0 -22
- package/dist/interfaces/Version.js +0 -2
- package/dist/interfaces/index.d.ts +0 -12
- package/dist/interfaces/index.js +0 -28
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.
|
|
4
|
+
"@ffflorian/api-client": "2.5.0"
|
|
5
5
|
},
|
|
6
6
|
"description": "A crates.io API client",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@types/node": "~24",
|
|
9
|
-
"rimraf": "6.1.
|
|
10
|
-
"typedoc": "0.28.
|
|
11
|
-
"typescript": "
|
|
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.
|
|
39
|
-
"gitHead": "12bebfb90528bb894bccb99670373af33c6a5159"
|
|
38
|
+
"version": "2.4.6"
|
|
40
39
|
}
|
package/dist/CratesIO.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { API, ClientOptions, Summary } from './interfaces';
|
|
2
|
-
export declare class CratesIO {
|
|
3
|
-
readonly api: API;
|
|
4
|
-
private readonly apiClient;
|
|
5
|
-
private readonly options;
|
|
6
|
-
constructor(apiKey?: string);
|
|
7
|
-
constructor(options?: ClientOptions);
|
|
8
|
-
/**
|
|
9
|
-
* Set a new API key.
|
|
10
|
-
* @param apiKey The API key
|
|
11
|
-
*/
|
|
12
|
-
setApiKey(apiKey: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* Set a new API URL.
|
|
15
|
-
* @param newURL The new API url
|
|
16
|
-
*/
|
|
17
|
-
setApiUrl(newURL: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Retrieve a summary containing crates.io wide information.
|
|
20
|
-
*/
|
|
21
|
-
summary(): Promise<Summary>;
|
|
22
|
-
}
|
package/dist/CratesIO.js
DELETED
|
@@ -1,50 +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.CratesIO = void 0;
|
|
13
|
-
const api_client_1 = require("@ffflorian/api-client");
|
|
14
|
-
const api_1 = require("./api");
|
|
15
|
-
const Endpoints_1 = require("./Endpoints");
|
|
16
|
-
class CratesIO {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.options = typeof options === 'string' ? { apiKey: options } : options || {};
|
|
19
|
-
this.apiClient = new api_client_1.APIClient('https://crates.io/api/v1');
|
|
20
|
-
this.api = {
|
|
21
|
-
crates: new api_1.CratesAPI(this.apiClient),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Set a new API key.
|
|
26
|
-
* @param apiKey The API key
|
|
27
|
-
*/
|
|
28
|
-
setApiKey(apiKey) {
|
|
29
|
-
this.options.apiKey = apiKey;
|
|
30
|
-
this.api.crates.setApiKey(apiKey);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Set a new API URL.
|
|
34
|
-
* @param newURL The new API url
|
|
35
|
-
*/
|
|
36
|
-
setApiUrl(newURL) {
|
|
37
|
-
this.apiClient.setBaseURL(newURL);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Retrieve a summary containing crates.io wide information.
|
|
41
|
-
*/
|
|
42
|
-
summary() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const endpoint = Endpoints_1.Endpoint.summary();
|
|
45
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
46
|
-
return data;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.CratesIO = CratesIO;
|
package/dist/Endpoints.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const Endpoint: {
|
|
2
|
-
AUTHORS: string;
|
|
3
|
-
CRATES: string;
|
|
4
|
-
DEPENDENCIES: string;
|
|
5
|
-
DOWNLOAD: string;
|
|
6
|
-
DOWNLOADS: string;
|
|
7
|
-
FOLLOWING: string;
|
|
8
|
-
OWNERS: string;
|
|
9
|
-
OWNER_TEAM: string;
|
|
10
|
-
OWNER_USER: string;
|
|
11
|
-
REVERSE_DEPENDENCIES: string;
|
|
12
|
-
SUMMARY: string;
|
|
13
|
-
VERSIONS: string;
|
|
14
|
-
Crates: {
|
|
15
|
-
authors(packageName: string, version: string): string;
|
|
16
|
-
crate(packageName: string): string;
|
|
17
|
-
crates(): string;
|
|
18
|
-
dependencies(packageName: string): string;
|
|
19
|
-
download(packageName: string, version: string): string;
|
|
20
|
-
downloads(packageName: string): string;
|
|
21
|
-
following(packageName: string): string;
|
|
22
|
-
owners(packageName: string): string;
|
|
23
|
-
ownerTeam(packageName: string): string;
|
|
24
|
-
ownerUser(packageName: string): string;
|
|
25
|
-
reverseDependencies(packageName: string): string;
|
|
26
|
-
version(packageName: string, version: string): string;
|
|
27
|
-
versions(packageName: string): string;
|
|
28
|
-
};
|
|
29
|
-
summary(): string;
|
|
30
|
-
};
|
package/dist/Endpoints.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Endpoint = void 0;
|
|
4
|
-
const encode = encodeURIComponent;
|
|
5
|
-
exports.Endpoint = {
|
|
6
|
-
AUTHORS: 'authors',
|
|
7
|
-
CRATES: 'crates',
|
|
8
|
-
DEPENDENCIES: 'dependencies',
|
|
9
|
-
DOWNLOAD: 'download',
|
|
10
|
-
DOWNLOADS: 'downloads',
|
|
11
|
-
FOLLOWING: 'following',
|
|
12
|
-
OWNERS: 'owners',
|
|
13
|
-
OWNER_TEAM: 'owner_team',
|
|
14
|
-
OWNER_USER: 'owner_user',
|
|
15
|
-
REVERSE_DEPENDENCIES: 'reverse_dependencies',
|
|
16
|
-
SUMMARY: 'summary',
|
|
17
|
-
VERSIONS: 'versions',
|
|
18
|
-
Crates: {
|
|
19
|
-
authors(packageName, version) {
|
|
20
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${encode(version)}/${exports.Endpoint.AUTHORS}`;
|
|
21
|
-
},
|
|
22
|
-
crate(packageName) {
|
|
23
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}`;
|
|
24
|
-
},
|
|
25
|
-
crates() {
|
|
26
|
-
return `/${exports.Endpoint.CRATES}`;
|
|
27
|
-
},
|
|
28
|
-
dependencies(packageName) {
|
|
29
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.DEPENDENCIES}`;
|
|
30
|
-
},
|
|
31
|
-
download(packageName, version) {
|
|
32
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${encode(version)}/${exports.Endpoint.DOWNLOAD}`;
|
|
33
|
-
},
|
|
34
|
-
downloads(packageName) {
|
|
35
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.DOWNLOADS}`;
|
|
36
|
-
},
|
|
37
|
-
following(packageName) {
|
|
38
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.FOLLOWING}`;
|
|
39
|
-
},
|
|
40
|
-
owners(packageName) {
|
|
41
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.OWNERS}`;
|
|
42
|
-
},
|
|
43
|
-
ownerTeam(packageName) {
|
|
44
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.OWNER_TEAM}`;
|
|
45
|
-
},
|
|
46
|
-
ownerUser(packageName) {
|
|
47
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.OWNER_USER}`;
|
|
48
|
-
},
|
|
49
|
-
reverseDependencies(packageName) {
|
|
50
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.REVERSE_DEPENDENCIES}`;
|
|
51
|
-
},
|
|
52
|
-
version(packageName, version) {
|
|
53
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${encode(version)}`;
|
|
54
|
-
},
|
|
55
|
-
versions(packageName) {
|
|
56
|
-
return `/${exports.Endpoint.CRATES}/${encode(packageName)}/${exports.Endpoint.VERSIONS}`;
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
summary() {
|
|
60
|
-
return `/${exports.Endpoint.SUMMARY}`;
|
|
61
|
-
},
|
|
62
|
-
};
|
package/dist/api/CratesAPI.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { APIClient } from '@ffflorian/api-client';
|
|
2
|
-
import type { AuthorsResult, CrateResult, DependenciesResult, DownloadsResult, FollowingResult, ReverseDependenciesResult, SearchOptions, SearchResult, TeamsResult, UrlResult, UsersResult, Version } from '../interfaces/';
|
|
3
|
-
export declare class CratesAPI {
|
|
4
|
-
private readonly apiClient;
|
|
5
|
-
private apiKey?;
|
|
6
|
-
constructor(apiClient: APIClient, apiKey?: string);
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve the owners of a crate.
|
|
9
|
-
* @param packageName The package name
|
|
10
|
-
*/
|
|
11
|
-
following(packageName: string): Promise<FollowingResult>;
|
|
12
|
-
/**
|
|
13
|
-
* Retrieve the owners of a crate.
|
|
14
|
-
* @param packageName The package name
|
|
15
|
-
*/
|
|
16
|
-
getAuthors(packageName: string, version: string): Promise<AuthorsResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Retrieve information of a crate.
|
|
19
|
-
* @param packageName The package name
|
|
20
|
-
*/
|
|
21
|
-
getCrate(packageName: string): Promise<CrateResult>;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve a page of crates, optionally constrained by a query.
|
|
24
|
-
* @param query The search query
|
|
25
|
-
* @param options The search options
|
|
26
|
-
*/
|
|
27
|
-
getCrates(query: string, options?: SearchOptions): Promise<SearchResult>;
|
|
28
|
-
/**
|
|
29
|
-
* Retrieve the dependencies of a crate version.
|
|
30
|
-
* @param packageName The package name
|
|
31
|
-
*/
|
|
32
|
-
getDependencies(packageName: string): Promise<DependenciesResult>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve download stats for a crate.
|
|
35
|
-
* @param packageName The package name
|
|
36
|
-
*/
|
|
37
|
-
getDownloads(packageName: string): Promise<DownloadsResult>;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve a download link for a certain version of a crate.
|
|
40
|
-
* @param packageName The package name
|
|
41
|
-
*/
|
|
42
|
-
getDownloadUrl(packageName: string, version: string): Promise<UrlResult>;
|
|
43
|
-
/**
|
|
44
|
-
* Retrieve the owners of a crate.
|
|
45
|
-
* @param packageName The package name
|
|
46
|
-
*/
|
|
47
|
-
getOwners(packageName: string): Promise<UsersResult>;
|
|
48
|
-
/**
|
|
49
|
-
* Retrieve the reverse dependencies of a crate version.
|
|
50
|
-
* @param packageName The package name
|
|
51
|
-
*/
|
|
52
|
-
getReverseDependencies(packageName: string): Promise<ReverseDependenciesResult>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve the team owner of a crate.
|
|
55
|
-
* @param packageName The package name
|
|
56
|
-
*/
|
|
57
|
-
getTeamOwner(packageName: string): Promise<TeamsResult>;
|
|
58
|
-
/**
|
|
59
|
-
* Retrieve the user owner of a crate.
|
|
60
|
-
* @param packageName The package name
|
|
61
|
-
*/
|
|
62
|
-
getUserOwner(packageName: string): Promise<UsersResult>;
|
|
63
|
-
/**
|
|
64
|
-
* Retrieve a specific version of a crate.
|
|
65
|
-
* @param packageName The package name
|
|
66
|
-
*/
|
|
67
|
-
getVersion(packageName: string, version: string): Promise<Version>;
|
|
68
|
-
/**
|
|
69
|
-
* Retrieve all versions of a crate.
|
|
70
|
-
* @param packageName The package name
|
|
71
|
-
*/
|
|
72
|
-
getVersions(packageName: string): Promise<{
|
|
73
|
-
versions: Version[];
|
|
74
|
-
}>;
|
|
75
|
-
/**
|
|
76
|
-
* Set a new API key.
|
|
77
|
-
* @param apiKey The API key
|
|
78
|
-
*/
|
|
79
|
-
setApiKey(apiKey: string): void;
|
|
80
|
-
}
|
package/dist/api/CratesAPI.js
DELETED
|
@@ -1,184 +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.CratesAPI = void 0;
|
|
13
|
-
const Endpoints_1 = require("../Endpoints");
|
|
14
|
-
class CratesAPI {
|
|
15
|
-
constructor(apiClient, apiKey) {
|
|
16
|
-
this.apiClient = apiClient;
|
|
17
|
-
this.apiKey = apiKey;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Retrieve the owners of a crate.
|
|
21
|
-
* @param packageName The package name
|
|
22
|
-
*/
|
|
23
|
-
following(packageName) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const endpoint = Endpoints_1.Endpoint.Crates.following(packageName);
|
|
26
|
-
if (!this.apiKey) {
|
|
27
|
-
throw new Error('You need to set an API key to use this endpoint.');
|
|
28
|
-
}
|
|
29
|
-
const additionalConfig = {
|
|
30
|
-
headers: {
|
|
31
|
-
Authorization: this.apiKey,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
const { data } = yield this.apiClient.get(endpoint, additionalConfig);
|
|
35
|
-
return data;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve the owners of a crate.
|
|
40
|
-
* @param packageName The package name
|
|
41
|
-
*/
|
|
42
|
-
getAuthors(packageName, version) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const endpoint = Endpoints_1.Endpoint.Crates.authors(packageName, version);
|
|
45
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
46
|
-
return data;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Retrieve information of a crate.
|
|
51
|
-
* @param packageName The package name
|
|
52
|
-
*/
|
|
53
|
-
getCrate(packageName) {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const endpoint = Endpoints_1.Endpoint.Crates.crate(packageName);
|
|
56
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
57
|
-
return data;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Retrieve a page of crates, optionally constrained by a query.
|
|
62
|
-
* @param query The search query
|
|
63
|
-
* @param options The search options
|
|
64
|
-
*/
|
|
65
|
-
getCrates(query, options) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const endpoint = Endpoints_1.Endpoint.Crates.crates();
|
|
68
|
-
const additionalConfig = {
|
|
69
|
-
params: Object.assign(Object.assign({}, options), {
|
|
70
|
-
// eslint-disable-next-line id-length
|
|
71
|
-
q: query }),
|
|
72
|
-
};
|
|
73
|
-
const { data } = yield this.apiClient.get(endpoint, additionalConfig);
|
|
74
|
-
return data;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Retrieve the dependencies of a crate version.
|
|
79
|
-
* @param packageName The package name
|
|
80
|
-
*/
|
|
81
|
-
getDependencies(packageName) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const endpoint = Endpoints_1.Endpoint.Crates.dependencies(packageName);
|
|
84
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
85
|
-
return data;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Retrieve download stats for a crate.
|
|
90
|
-
* @param packageName The package name
|
|
91
|
-
*/
|
|
92
|
-
getDownloads(packageName) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const endpoint = Endpoints_1.Endpoint.Crates.downloads(packageName);
|
|
95
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
96
|
-
return data;
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Retrieve a download link for a certain version of a crate.
|
|
101
|
-
* @param packageName The package name
|
|
102
|
-
*/
|
|
103
|
-
getDownloadUrl(packageName, version) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const endpoint = Endpoints_1.Endpoint.Crates.download(packageName, version);
|
|
106
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
107
|
-
return data;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Retrieve the owners of a crate.
|
|
112
|
-
* @param packageName The package name
|
|
113
|
-
*/
|
|
114
|
-
getOwners(packageName) {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
const endpoint = Endpoints_1.Endpoint.Crates.owners(packageName);
|
|
117
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
118
|
-
return data;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Retrieve the reverse dependencies of a crate version.
|
|
123
|
-
* @param packageName The package name
|
|
124
|
-
*/
|
|
125
|
-
getReverseDependencies(packageName) {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const endpoint = Endpoints_1.Endpoint.Crates.reverseDependencies(packageName);
|
|
128
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
129
|
-
return data;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Retrieve the team owner of a crate.
|
|
134
|
-
* @param packageName The package name
|
|
135
|
-
*/
|
|
136
|
-
getTeamOwner(packageName) {
|
|
137
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const endpoint = Endpoints_1.Endpoint.Crates.ownerTeam(packageName);
|
|
139
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
140
|
-
return data;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Retrieve the user owner of a crate.
|
|
145
|
-
* @param packageName The package name
|
|
146
|
-
*/
|
|
147
|
-
getUserOwner(packageName) {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const endpoint = Endpoints_1.Endpoint.Crates.ownerUser(packageName);
|
|
150
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
151
|
-
return data;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Retrieve a specific version of a crate.
|
|
156
|
-
* @param packageName The package name
|
|
157
|
-
*/
|
|
158
|
-
getVersion(packageName, version) {
|
|
159
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
const endpoint = Endpoints_1.Endpoint.Crates.version(packageName, version);
|
|
161
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
162
|
-
return data;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Retrieve all versions of a crate.
|
|
167
|
-
* @param packageName The package name
|
|
168
|
-
*/
|
|
169
|
-
getVersions(packageName) {
|
|
170
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
const endpoint = Endpoints_1.Endpoint.Crates.versions(packageName);
|
|
172
|
-
const { data } = yield this.apiClient.get(endpoint);
|
|
173
|
-
return data;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Set a new API key.
|
|
178
|
-
* @param apiKey The API key
|
|
179
|
-
*/
|
|
180
|
-
setApiKey(apiKey) {
|
|
181
|
-
this.apiKey = apiKey;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
exports.CratesAPI = CratesAPI;
|
package/dist/api/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CratesAPI';
|
package/dist/api/index.js
DELETED
|
@@ -1,17 +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("./CratesAPI"), exports);
|
package/dist/index.d.ts
DELETED
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("./CratesIO"), exports);
|
|
18
|
-
__exportStar(require("./interfaces/"), exports);
|
package/dist/interfaces/API.d.ts
DELETED
package/dist/interfaces/API.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface Crate {
|
|
2
|
-
badges: {
|
|
3
|
-
[key: string]: {
|
|
4
|
-
[key: string]: string;
|
|
5
|
-
};
|
|
6
|
-
} | null;
|
|
7
|
-
categories: string | null;
|
|
8
|
-
created_at: string;
|
|
9
|
-
description: string;
|
|
10
|
-
documentation: string | null;
|
|
11
|
-
downloads: number;
|
|
12
|
-
exact_match: boolean;
|
|
13
|
-
homepage: string | null;
|
|
14
|
-
id: string;
|
|
15
|
-
keywords: string | null;
|
|
16
|
-
links: {
|
|
17
|
-
owner_team: string;
|
|
18
|
-
owner_user: string;
|
|
19
|
-
owners: string;
|
|
20
|
-
reverse_dependencies: string;
|
|
21
|
-
version_downloads: string;
|
|
22
|
-
versions: string;
|
|
23
|
-
};
|
|
24
|
-
max_version: string;
|
|
25
|
-
name: string;
|
|
26
|
-
recent_downloads: number | null;
|
|
27
|
-
repository: string | null;
|
|
28
|
-
updated_at: string;
|
|
29
|
-
versions: number[] | null;
|
|
30
|
-
}
|
package/dist/interfaces/Crate.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface Dependency {
|
|
2
|
-
crate_id: string;
|
|
3
|
-
default_features: boolean;
|
|
4
|
-
downloads: number;
|
|
5
|
-
features: string[];
|
|
6
|
-
id: number;
|
|
7
|
-
kind: 'build' | 'normal' | 'dev';
|
|
8
|
-
optional: boolean;
|
|
9
|
-
req: string;
|
|
10
|
-
target: string | null;
|
|
11
|
-
version_id: number;
|
|
12
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { Category, Crate, Dependency, Download, Keyword, Team, User, Version } from '.';
|
|
2
|
-
export interface AuthorsResult {
|
|
3
|
-
meta: {
|
|
4
|
-
names: string[];
|
|
5
|
-
};
|
|
6
|
-
users: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface CrateResult {
|
|
9
|
-
categories: Category[];
|
|
10
|
-
crate: Crate;
|
|
11
|
-
keywords: Keyword[];
|
|
12
|
-
}
|
|
13
|
-
export interface DependenciesResult {
|
|
14
|
-
dependencies: Dependency[];
|
|
15
|
-
}
|
|
16
|
-
export interface DownloadsResult {
|
|
17
|
-
version_downloads: Download[];
|
|
18
|
-
}
|
|
19
|
-
export interface FollowingResult {
|
|
20
|
-
following: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface ReverseDependenciesResult extends DependenciesResult, VersionResult {
|
|
23
|
-
meta: {
|
|
24
|
-
total: number;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export interface SearchResult {
|
|
28
|
-
crates: Crate[];
|
|
29
|
-
meta: {
|
|
30
|
-
total: number;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface UrlResult {
|
|
34
|
-
url: string;
|
|
35
|
-
}
|
|
36
|
-
export interface UsersResult {
|
|
37
|
-
users: User[];
|
|
38
|
-
}
|
|
39
|
-
export interface TeamsResult {
|
|
40
|
-
teams: Team[];
|
|
41
|
-
}
|
|
42
|
-
export interface VersionsResult {
|
|
43
|
-
versions: Version[];
|
|
44
|
-
}
|
|
45
|
-
export interface VersionResult {
|
|
46
|
-
version: Version;
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Category } from './Category';
|
|
2
|
-
import type { Crate } from './Crate';
|
|
3
|
-
import type { Keyword } from './Keyword';
|
|
4
|
-
export interface Summary {
|
|
5
|
-
just_updated: Crate[];
|
|
6
|
-
most_downloaded: Crate[];
|
|
7
|
-
most_recently_downloaded: Crate[];
|
|
8
|
-
new_crates: Crate[];
|
|
9
|
-
num_crates: number;
|
|
10
|
-
num_downloads: number;
|
|
11
|
-
popular_categories: Category[];
|
|
12
|
-
popular_keywords: Keyword[];
|
|
13
|
-
}
|
package/dist/interfaces/Team.js
DELETED
package/dist/interfaces/User.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface Version {
|
|
2
|
-
crate: string;
|
|
3
|
-
crate_size: number;
|
|
4
|
-
created_at: string;
|
|
5
|
-
dl_path: string;
|
|
6
|
-
downloads: number;
|
|
7
|
-
features: {
|
|
8
|
-
[key: string]: string[];
|
|
9
|
-
};
|
|
10
|
-
id: number;
|
|
11
|
-
license: string;
|
|
12
|
-
links: {
|
|
13
|
-
authors: string;
|
|
14
|
-
dependencies: string;
|
|
15
|
-
version_downloads: string;
|
|
16
|
-
};
|
|
17
|
-
num: string;
|
|
18
|
-
published_by: null | string;
|
|
19
|
-
readme_path: string;
|
|
20
|
-
updated_at: string;
|
|
21
|
-
yanked: boolean;
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './API';
|
|
2
|
-
export * from './Category';
|
|
3
|
-
export * from './Crate';
|
|
4
|
-
export * from './Dependency';
|
|
5
|
-
export * from './Download';
|
|
6
|
-
export * from './Keyword';
|
|
7
|
-
export * from './Options';
|
|
8
|
-
export * from './Result';
|
|
9
|
-
export * from './Summary';
|
|
10
|
-
export * from './Team';
|
|
11
|
-
export * from './User';
|
|
12
|
-
export * from './Version';
|
package/dist/interfaces/index.js
DELETED
|
@@ -1,28 +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("./Category"), exports);
|
|
19
|
-
__exportStar(require("./Crate"), exports);
|
|
20
|
-
__exportStar(require("./Dependency"), exports);
|
|
21
|
-
__exportStar(require("./Download"), exports);
|
|
22
|
-
__exportStar(require("./Keyword"), exports);
|
|
23
|
-
__exportStar(require("./Options"), exports);
|
|
24
|
-
__exportStar(require("./Result"), exports);
|
|
25
|
-
__exportStar(require("./Summary"), exports);
|
|
26
|
-
__exportStar(require("./Team"), exports);
|
|
27
|
-
__exportStar(require("./User"), exports);
|
|
28
|
-
__exportStar(require("./Version"), exports);
|