@localisprimary/esi 2.0.10 → 2.0.11
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/client.js +10 -4
- package/dist/types.d.ts +18 -11
- package/package.json +52 -52
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const COMPATIBILITY_DATE = '2026-
|
|
1
|
+
const COMPATIBILITY_DATE = '2026-02-10';
|
|
2
2
|
export class EsiClient {
|
|
3
3
|
constructor(options) {
|
|
4
4
|
this.baseUrl = 'https://esi.evetech.net';
|
|
@@ -14,7 +14,7 @@ export class EsiClient {
|
|
|
14
14
|
}
|
|
15
15
|
async request(method, path, params, body) {
|
|
16
16
|
const url = new URL(path, this.baseUrl);
|
|
17
|
-
if (params
|
|
17
|
+
if (params) {
|
|
18
18
|
Object.entries(params).forEach(([key, value]) => {
|
|
19
19
|
if (value !== undefined) {
|
|
20
20
|
url.searchParams.append(key, String(value));
|
|
@@ -41,13 +41,19 @@ export class EsiClient {
|
|
|
41
41
|
headers: this.useRequestHeaders ? headers : undefined,
|
|
42
42
|
body: body ? JSON.stringify(body) : undefined,
|
|
43
43
|
});
|
|
44
|
-
const data = await response.json();
|
|
45
44
|
if (!response.ok) {
|
|
45
|
+
let error = 'Request failed';
|
|
46
|
+
try {
|
|
47
|
+
const errorData = await response.json();
|
|
48
|
+
error = errorData.error || error;
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
46
51
|
throw {
|
|
47
|
-
error
|
|
52
|
+
error,
|
|
48
53
|
status: response.status,
|
|
49
54
|
};
|
|
50
55
|
}
|
|
56
|
+
const data = await response.json();
|
|
51
57
|
return {
|
|
52
58
|
data,
|
|
53
59
|
status: response.status,
|
package/dist/types.d.ts
CHANGED
|
@@ -98,16 +98,21 @@ export interface PostCharactersAffiliationResponseHeaders {
|
|
|
98
98
|
ETag?: string;
|
|
99
99
|
'Last-Modified'?: string;
|
|
100
100
|
}
|
|
101
|
+
export type AllianceID = number;
|
|
102
|
+
export type BloodlineID = number;
|
|
103
|
+
export type CorporationID = number;
|
|
104
|
+
export type FactionID = number;
|
|
105
|
+
export type RaceID = number;
|
|
101
106
|
export interface GetCharacterResponse {
|
|
102
|
-
alliance_id?:
|
|
107
|
+
alliance_id?: AllianceID;
|
|
103
108
|
birthday: string;
|
|
104
|
-
bloodline_id:
|
|
105
|
-
corporation_id:
|
|
109
|
+
bloodline_id: BloodlineID;
|
|
110
|
+
corporation_id: CorporationID;
|
|
106
111
|
description?: string;
|
|
107
|
-
faction_id?:
|
|
108
|
-
gender: '
|
|
112
|
+
faction_id?: FactionID;
|
|
113
|
+
gender: 'male' | 'female';
|
|
109
114
|
name: string;
|
|
110
|
-
race_id:
|
|
115
|
+
race_id: RaceID;
|
|
111
116
|
security_status?: number;
|
|
112
117
|
title?: string;
|
|
113
118
|
}
|
|
@@ -1278,14 +1283,16 @@ export interface GetCorporationsNpccorpsResponseHeaders {
|
|
|
1278
1283
|
ETag?: string;
|
|
1279
1284
|
'Last-Modified'?: string;
|
|
1280
1285
|
}
|
|
1286
|
+
export type CharacterID = number;
|
|
1287
|
+
export type StationID = number;
|
|
1281
1288
|
export interface GetCorporationResponse {
|
|
1282
|
-
alliance_id?:
|
|
1283
|
-
ceo_id:
|
|
1284
|
-
creator_id:
|
|
1289
|
+
alliance_id?: AllianceID;
|
|
1290
|
+
ceo_id: CharacterID;
|
|
1291
|
+
creator_id: CharacterID;
|
|
1285
1292
|
date_founded?: string;
|
|
1286
1293
|
description?: string;
|
|
1287
|
-
faction_id?:
|
|
1288
|
-
home_station_id?:
|
|
1294
|
+
faction_id?: FactionID;
|
|
1295
|
+
home_station_id?: StationID;
|
|
1289
1296
|
member_count: number;
|
|
1290
1297
|
name: string;
|
|
1291
1298
|
shares?: number;
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
"name": "@localisprimary/esi",
|
|
3
|
+
"version": "2.0.11",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Auto-generated TypeScript client for the EVE Online API",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"scripts": {
|
|
10
|
+
"fetch-schema": "node scripts/fetch-schema.ts",
|
|
11
|
+
"generate": "node scripts/generate.ts && pnpm lint:fix && pnpm format",
|
|
12
|
+
"build": "rimraf dist && tsc",
|
|
13
|
+
"compile": "pnpm fetch-schema && pnpm generate && pnpm build && pnpm test",
|
|
14
|
+
"lint": "oxlint src",
|
|
15
|
+
"lint:fix": "oxlint src --fix",
|
|
16
|
+
"format": "oxfmt",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"change": "beachball change"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"eve",
|
|
22
|
+
"eveonline",
|
|
23
|
+
"eve online",
|
|
24
|
+
"esi",
|
|
25
|
+
"api",
|
|
26
|
+
"client",
|
|
27
|
+
"typescript"
|
|
28
|
+
],
|
|
29
|
+
"author": "Adam Trager <hello@adamtrager.com>",
|
|
30
|
+
"funding": "https://buymeacoffee.com/nfinished",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/localisprimary/esi.git"
|
|
34
|
+
},
|
|
35
|
+
"license": "ISC",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^24.10.9",
|
|
38
|
+
"@vitest/ui": "^4.0.18",
|
|
39
|
+
"beachball": "^2.63.0",
|
|
40
|
+
"camelcase": "^9.0.0",
|
|
41
|
+
"oxfmt": "^0.28.0",
|
|
42
|
+
"oxlint": "^1.43.0",
|
|
43
|
+
"rimraf": "^6.1.2",
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"vitest": "^4.0.18"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist/**/*"
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": "^24.13.0"
|
|
52
|
+
},
|
|
53
|
+
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264"
|
|
54
54
|
}
|