eve-esi-types 3.2.0 → 3.2.2
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/CHANGELOG.md +27 -8
- package/package.json +1 -1
- package/v2/esi-tagged-types.d.ts +1 -1
- package/v2/experimental-esi-types.d.ts +287 -0
- package/v2/globals/character.d.ts +32 -198
- package/v2/globals/corporation.d.ts +352 -1104
- package/v2/globals/factionwarfare.d.ts +6 -78
- package/v2/globals/universe.d.ts +78 -78
- package/v2/index.d.ts +6 -4
- package/v2/response-map.d.ts +1 -1
- package/v2/types-index.d.ts +1 -1
- package/v2/types-util.d.ts +3 -166
- package/v2/util.d.ts +19 -0
|
@@ -137,109 +137,37 @@ interface GetCorporationsCorporationIdFwStatsVictoryPoints {
|
|
|
137
137
|
*
|
|
138
138
|
* @maxItems 4
|
|
139
139
|
*/
|
|
140
|
-
type GetFwLeaderboardsActiveTotal =
|
|
141
|
-
| []
|
|
142
|
-
| [GetFwLeaderboardsActiveTotalActiveTotal]
|
|
143
|
-
| [GetFwLeaderboardsActiveTotalActiveTotal, GetFwLeaderboardsActiveTotalActiveTotal]
|
|
144
|
-
| [
|
|
145
|
-
GetFwLeaderboardsActiveTotalActiveTotal,
|
|
146
|
-
GetFwLeaderboardsActiveTotalActiveTotal,
|
|
147
|
-
GetFwLeaderboardsActiveTotalActiveTotal
|
|
148
|
-
]
|
|
149
|
-
| [
|
|
150
|
-
GetFwLeaderboardsActiveTotalActiveTotal,
|
|
151
|
-
GetFwLeaderboardsActiveTotalActiveTotal,
|
|
152
|
-
GetFwLeaderboardsActiveTotalActiveTotal,
|
|
153
|
-
GetFwLeaderboardsActiveTotalActiveTotal
|
|
154
|
-
];
|
|
140
|
+
type GetFwLeaderboardsActiveTotal = GetFwLeaderboardsActiveTotalActiveTotal[]
|
|
155
141
|
/**
|
|
156
142
|
* Top 4 ranking of factions by kills in the past week
|
|
157
143
|
*
|
|
158
144
|
* @maxItems 4
|
|
159
145
|
*/
|
|
160
|
-
type GetFwLeaderboardsLastWeek =
|
|
161
|
-
| []
|
|
162
|
-
| [GetFwLeaderboardsLastWeekLastWeek]
|
|
163
|
-
| [GetFwLeaderboardsLastWeekLastWeek, GetFwLeaderboardsLastWeekLastWeek]
|
|
164
|
-
| [GetFwLeaderboardsLastWeekLastWeek, GetFwLeaderboardsLastWeekLastWeek, GetFwLeaderboardsLastWeekLastWeek]
|
|
165
|
-
| [
|
|
166
|
-
GetFwLeaderboardsLastWeekLastWeek,
|
|
167
|
-
GetFwLeaderboardsLastWeekLastWeek,
|
|
168
|
-
GetFwLeaderboardsLastWeekLastWeek,
|
|
169
|
-
GetFwLeaderboardsLastWeekLastWeek
|
|
170
|
-
];
|
|
146
|
+
type GetFwLeaderboardsLastWeek = GetFwLeaderboardsLastWeekLastWeek[];
|
|
171
147
|
/**
|
|
172
148
|
* Top 4 ranking of factions by kills in the past day
|
|
173
149
|
*
|
|
174
150
|
* @maxItems 4
|
|
175
151
|
*/
|
|
176
|
-
type GetFwLeaderboardsYesterday =
|
|
177
|
-
| []
|
|
178
|
-
| [GetFwLeaderboardsYesterdayYesterday]
|
|
179
|
-
| [GetFwLeaderboardsYesterdayYesterday, GetFwLeaderboardsYesterdayYesterday]
|
|
180
|
-
| [GetFwLeaderboardsYesterdayYesterday, GetFwLeaderboardsYesterdayYesterday, GetFwLeaderboardsYesterdayYesterday]
|
|
181
|
-
| [
|
|
182
|
-
GetFwLeaderboardsYesterdayYesterday,
|
|
183
|
-
GetFwLeaderboardsYesterdayYesterday,
|
|
184
|
-
GetFwLeaderboardsYesterdayYesterday,
|
|
185
|
-
GetFwLeaderboardsYesterdayYesterday
|
|
186
|
-
];
|
|
152
|
+
type GetFwLeaderboardsYesterday = GetFwLeaderboardsYesterdayYesterday[];
|
|
187
153
|
/**
|
|
188
154
|
* Top 4 ranking of factions active in faction warfare by total victory points. A faction is considered "active" if they have participated in faction warfare in the past 14 days
|
|
189
155
|
*
|
|
190
156
|
* @maxItems 4
|
|
191
157
|
*/
|
|
192
|
-
type GetFwLeaderboardsVictoryPointsActiveTotal =
|
|
193
|
-
| []
|
|
194
|
-
| [GetFwLeaderboardsActiveTotalActiveTotal_1]
|
|
195
|
-
| [GetFwLeaderboardsActiveTotalActiveTotal_1, GetFwLeaderboardsActiveTotalActiveTotal_1]
|
|
196
|
-
| [
|
|
197
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1,
|
|
198
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1,
|
|
199
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1
|
|
200
|
-
]
|
|
201
|
-
| [
|
|
202
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1,
|
|
203
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1,
|
|
204
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1,
|
|
205
|
-
GetFwLeaderboardsActiveTotalActiveTotal_1
|
|
206
|
-
];
|
|
158
|
+
type GetFwLeaderboardsVictoryPointsActiveTotal = GetFwLeaderboardsActiveTotalActiveTotal_1[];
|
|
207
159
|
/**
|
|
208
160
|
* Top 4 ranking of factions by victory points in the past week
|
|
209
161
|
*
|
|
210
162
|
* @maxItems 4
|
|
211
163
|
*/
|
|
212
|
-
type GetFwLeaderboardsVictoryPointsLastWeek =
|
|
213
|
-
| []
|
|
214
|
-
| [GetFwLeaderboardsLastWeekLastWeek_1]
|
|
215
|
-
| [GetFwLeaderboardsLastWeekLastWeek_1, GetFwLeaderboardsLastWeekLastWeek_1]
|
|
216
|
-
| [GetFwLeaderboardsLastWeekLastWeek_1, GetFwLeaderboardsLastWeekLastWeek_1, GetFwLeaderboardsLastWeekLastWeek_1]
|
|
217
|
-
| [
|
|
218
|
-
GetFwLeaderboardsLastWeekLastWeek_1,
|
|
219
|
-
GetFwLeaderboardsLastWeekLastWeek_1,
|
|
220
|
-
GetFwLeaderboardsLastWeekLastWeek_1,
|
|
221
|
-
GetFwLeaderboardsLastWeekLastWeek_1
|
|
222
|
-
];
|
|
164
|
+
type GetFwLeaderboardsVictoryPointsLastWeek = GetFwLeaderboardsLastWeekLastWeek_1[];
|
|
223
165
|
/**
|
|
224
166
|
* Top 4 ranking of factions by victory points in the past day
|
|
225
167
|
*
|
|
226
168
|
* @maxItems 4
|
|
227
169
|
*/
|
|
228
|
-
type GetFwLeaderboardsVictoryPointsYesterday =
|
|
229
|
-
| []
|
|
230
|
-
| [GetFwLeaderboardsYesterdayYesterday_1]
|
|
231
|
-
| [GetFwLeaderboardsYesterdayYesterday_1, GetFwLeaderboardsYesterdayYesterday_1]
|
|
232
|
-
| [
|
|
233
|
-
GetFwLeaderboardsYesterdayYesterday_1,
|
|
234
|
-
GetFwLeaderboardsYesterdayYesterday_1,
|
|
235
|
-
GetFwLeaderboardsYesterdayYesterday_1
|
|
236
|
-
]
|
|
237
|
-
| [
|
|
238
|
-
GetFwLeaderboardsYesterdayYesterday_1,
|
|
239
|
-
GetFwLeaderboardsYesterdayYesterday_1,
|
|
240
|
-
GetFwLeaderboardsYesterdayYesterday_1,
|
|
241
|
-
GetFwLeaderboardsYesterdayYesterday_1
|
|
242
|
-
];
|
|
170
|
+
type GetFwLeaderboardsVictoryPointsYesterday = GetFwLeaderboardsYesterdayYesterday_1[];
|
|
243
171
|
|
|
244
172
|
/**
|
|
245
173
|
* 200 ok object
|
package/v2/globals/universe.d.ts
CHANGED
|
@@ -1179,84 +1179,84 @@ interface GetUniverseTypesTypeIdDogmaEffect {
|
|
|
1179
1179
|
* shared interface
|
|
1180
1180
|
*/
|
|
1181
1181
|
interface PostUniverseIdsEntity {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1182
|
+
/**
|
|
1183
|
+
* id integer
|
|
1184
|
+
*/
|
|
1185
|
+
id?: number;
|
|
1186
|
+
/**
|
|
1187
|
+
* name string
|
|
1188
|
+
*/
|
|
1189
|
+
name?: string;
|
|
1190
|
+
[k: string]: unknown | undefined;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* 200 ok object
|
|
1195
|
+
*/
|
|
1196
|
+
interface PostUniverseIdsOk {
|
|
1197
|
+
/**
|
|
1198
|
+
* agents array
|
|
1199
|
+
*
|
|
1200
|
+
* @maxItems 500
|
|
1201
|
+
*/
|
|
1202
|
+
agents?: PostUniverseIdsEntity[];
|
|
1203
|
+
/**
|
|
1204
|
+
* alliances array
|
|
1205
|
+
*
|
|
1206
|
+
* @maxItems 500
|
|
1207
|
+
*/
|
|
1208
|
+
alliances?: PostUniverseIdsEntity[];
|
|
1209
|
+
/**
|
|
1210
|
+
* characters array
|
|
1211
|
+
*
|
|
1212
|
+
* @maxItems 500
|
|
1213
|
+
*/
|
|
1214
|
+
characters?: PostUniverseIdsEntity[];
|
|
1215
|
+
/**
|
|
1216
|
+
* constellations array
|
|
1217
|
+
*
|
|
1218
|
+
* @maxItems 500
|
|
1219
|
+
*/
|
|
1220
|
+
constellations?: PostUniverseIdsEntity[];
|
|
1221
|
+
/**
|
|
1222
|
+
* corporations array
|
|
1223
|
+
*
|
|
1224
|
+
* @maxItems 500
|
|
1225
|
+
*/
|
|
1226
|
+
corporations?: PostUniverseIdsEntity[];
|
|
1227
|
+
/**
|
|
1228
|
+
* factions array
|
|
1229
|
+
*
|
|
1230
|
+
* @maxItems 500
|
|
1231
|
+
*/
|
|
1232
|
+
factions?: PostUniverseIdsEntity[];
|
|
1233
|
+
/**
|
|
1234
|
+
* inventory_types array
|
|
1235
|
+
*
|
|
1236
|
+
* @maxItems 500
|
|
1237
|
+
*/
|
|
1238
|
+
inventory_types?: PostUniverseIdsEntity[];
|
|
1239
|
+
/**
|
|
1240
|
+
* regions array
|
|
1241
|
+
*
|
|
1242
|
+
* @maxItems 500
|
|
1243
|
+
*/
|
|
1244
|
+
regions?: PostUniverseIdsEntity[];
|
|
1245
|
+
/**
|
|
1246
|
+
* stations array
|
|
1247
|
+
*
|
|
1248
|
+
* @maxItems 500
|
|
1249
|
+
*/
|
|
1250
|
+
stations?: PostUniverseIdsEntity[];
|
|
1251
|
+
/**
|
|
1252
|
+
* systems array
|
|
1253
|
+
*
|
|
1254
|
+
* @maxItems 500
|
|
1255
|
+
*/
|
|
1256
|
+
systems?: PostUniverseIdsEntity[];
|
|
1257
|
+
[k: string]: unknown | undefined;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
1260
|
/*!
|
|
1261
1261
|
* ESI endpoint: post:/universe/names/
|
|
1262
1262
|
*/
|
package/v2/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/index.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 3.2.
|
|
12
|
+
* @summary This file is auto-generated and defines version 3.2.2 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
15
|
import type { PickPathParameters, InferKeysLen } from "./util.d.ts";
|
|
@@ -20,8 +20,6 @@ import type {
|
|
|
20
20
|
// ESIEndpointUnions,
|
|
21
21
|
// IESIRequestFunction2,
|
|
22
22
|
// InferESIResponseResultEX,
|
|
23
|
-
// InferNextEndpoint2, InferNextEndpointLoos,
|
|
24
|
-
// InferNextEndpoint,
|
|
25
23
|
// TESICachedSeconds, TESIRequestFunctionMethods2,
|
|
26
24
|
// __IdentifyParameters, __InferESIResponseResult,
|
|
27
25
|
} from "./types-util.d.ts";
|
|
@@ -440,10 +438,14 @@ declare global {
|
|
|
440
438
|
/*
|
|
441
439
|
*/
|
|
442
440
|
|
|
441
|
+
// declare const NO_CONTENT_RESPONSE: unique symbol;
|
|
442
|
+
// type NoContentResponse = {
|
|
443
|
+
// [NO_CONTENT_RESPONSE]: never;
|
|
444
|
+
// };
|
|
443
445
|
/**
|
|
444
446
|
* Represents a response with no content (HTTP status 204).
|
|
445
447
|
*/
|
|
446
|
-
type NoContentResponse = { /* status: 204 */ };
|
|
448
|
+
type NoContentResponse = { /* status: 204 */ } & { __status: 204 };
|
|
447
449
|
|
|
448
450
|
/**
|
|
449
451
|
* Represents the HTTP methods supported by ESI.
|
package/v2/response-map.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/response-map.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 3.2.
|
|
12
|
+
* @summary This file is auto-generated and defines version 3.2.2 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import "./types-index.d.ts";
|
|
15
15
|
|
package/v2/types-index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/types-index.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 3.2.
|
|
12
|
+
* @summary This file is auto-generated and defines version 3.2.2 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import "./globals/alliance.d.ts";
|
|
15
15
|
import "./globals/assets.d.ts";
|
package/v2/types-util.d.ts
CHANGED
|
@@ -9,180 +9,16 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/types-util.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 3.2.
|
|
12
|
+
* @summary This file is auto-generated and defines version 3.2.2 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
|
-
import "./index.d.ts"
|
|
16
15
|
|
|
17
|
-
// export type TMappingToNumber = { [key in string | number | symbol]: number };
|
|
18
|
-
/**
|
|
19
|
-
* @experimental
|
|
20
|
-
*
|
|
21
|
-
* InferNextEndpoint is an experimental utility type designed to verify and infer the "next" applicable
|
|
22
|
-
* ESI endpoint based on an initial endpoint's result type. In essence, it inspects the URL pattern and
|
|
23
|
-
* the inferred response type (Resut) associated with a given endpoint (EP) and then determines whether that
|
|
24
|
-
* endpoint can be further chained to another ESI endpoint.
|
|
25
|
-
*
|
|
26
|
-
* **The type parameters are as follows**:
|
|
27
|
-
*
|
|
28
|
-
* @param M - The HTTP method type (e.g. "get", "post", etc.), which must extend TESIEntryMethod.
|
|
29
|
-
* @param EP - The current ESI endpoint under inspection; it extends ESIEndpointOf<M>.
|
|
30
|
-
* @param Resut - Defaults to InferESIResponseResult<M, EP>; it is the inferred response result of the endpoint.
|
|
31
|
-
* This type is tested against acceptable response formats (either a number array or an object
|
|
32
|
-
* mapping keys to numbers).
|
|
33
|
-
* @param Endpoints - Defaults to ESIEndpointOf<M>; represents the union of all endpoints for method M to be
|
|
34
|
-
* considered as potential next endpoints.
|
|
35
|
-
*
|
|
36
|
-
* The type works by iterating over each endpoint (EPOrigin) in the union Endpoints. For each EPOrigin:
|
|
37
|
-
* - It checks whether the original endpoint EP is assignable to Endpoints.
|
|
38
|
-
* - It then tests if EPOrigin extends the template literal type `${EP}{${string}}/${string}`—that is, if EPOrigin
|
|
39
|
-
* is a URL based on EP that includes a parameterized section (denoted by `{...}`) followed by some additional
|
|
40
|
-
* path segments.
|
|
41
|
-
* - Next, it ensures that the inferred response result type (Resut) conforms to one of the acceptable formats:
|
|
42
|
-
* either a number array or an object whose values are numbers. The object form uses `{ [x: infer T]: number }`
|
|
43
|
-
* for type inference (this version works as intended).
|
|
44
|
-
* - If all conditions are met, EPOrigin is retained in the union; otherwise, it is replaced with never.
|
|
45
|
-
*
|
|
46
|
-
* Finally, the mapped type is indexed over Endpoints to yield a union of all endpoint URLs that satisfy the above
|
|
47
|
-
* conditions. This allows chaining or conditional logic in ESI client implementations based on response shape.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* // Given:
|
|
51
|
-
* // - M = "get"
|
|
52
|
-
* // - EP = "/characters/{character_id}/"
|
|
53
|
-
* // - And InferESIResponseResult<"get", "/characters/{character_id}/"> is inferred as number[] or a
|
|
54
|
-
* // valid mapping (e.g., { [x: string]: number })
|
|
55
|
-
* // Then, InferNextEndpoint<"get", "/characters/{character_id}/"> computes to the union of endpoints like:
|
|
56
|
-
* // "/characters/{character_id}/assets" // if it matches the template and response type constraint.
|
|
57
|
-
*
|
|
58
|
-
* @remarks
|
|
59
|
-
* This type is highly experimental and leverages advanced TypeScript features—including conditional types,
|
|
60
|
-
* template literal types, and type inference—to perform non-trivial endpoint validation.
|
|
61
|
-
*/
|
|
62
|
-
//* ctt ignore path parameter
|
|
63
|
-
export type InferNextEndpoint<
|
|
64
|
-
M extends TESIEntryMethod,
|
|
65
|
-
EP extends Exclude<ESIEndpointOf<M>, symbol> = Exclude<ESIEndpointOf<M>, symbol>,
|
|
66
|
-
BaseResut extends InferESIResponseResult<M, EP> = InferESIResponseResult<M, EP>,
|
|
67
|
-
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
68
|
-
> = {
|
|
69
|
-
[NextEP in Endpoints]: NextEP extends `${EP}${string}{${string}}/${string}`
|
|
70
|
-
// ? BaseResut extends number[] | TMappingToNumber // does not works...("skipLibCheck=false")
|
|
71
|
-
// DEVNOTE: As it turns out, the behavior of this utility type is broken unless you use the "skipLibCheck=true".
|
|
72
|
-
? BaseResut extends number[] | { [x: infer T]: number }
|
|
73
|
-
//* ctt
|
|
74
|
-
? NextEP : never
|
|
75
|
-
/*/
|
|
76
|
-
? __ShiftType extends 0
|
|
77
|
-
? [EP, NextEP, BaseResut] : NextEP
|
|
78
|
-
: never
|
|
79
|
-
//*/
|
|
80
|
-
: never;
|
|
81
|
-
}[Endpoints];
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* `InferNextEndpoint2` is a utility type that infers the next endpoint based on the current endpoint and method.
|
|
85
|
-
*
|
|
86
|
-
* DONE: 2025/4/11 15:45:01
|
|
87
|
-
* ``` jsonc
|
|
88
|
-
* // From the EP, infer the next parameterized endpoint to request.
|
|
89
|
-
* // If the result of the EP is `number[] | { [x: infer T]: number }`, infer the next parameterized endpoint to request.
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @template M - The HTTP method to use for the request.
|
|
93
|
-
* @template EP - The endpoint from which the next parameterized endpoint to request is inferred.
|
|
94
|
-
* @template BaseResut - The base response result type.
|
|
95
|
-
* @template Endpoints - The possible endpoints for the given method.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* type NextEndpoint = InferNextEndpoint2<"post", "/fleets/{fleet_id}/wings/">;
|
|
100
|
-
* // Result: "/fleets/{fleet_id}/wings/{wing_id}/squads/"
|
|
101
|
-
* ```
|
|
102
|
-
* @remarks
|
|
103
|
-
* This type is useful for chaining requests or determining the next endpoint to call based on the current endpoint.
|
|
104
|
-
*/
|
|
105
|
-
export type InferNextEndpoint2<
|
|
106
|
-
M extends TESIEntryMethod,
|
|
107
|
-
EP extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
108
|
-
BaseResut extends InferESIResponseResultEX<`${M}:${EP}`> = InferESIResponseResultEX<`${M}:${EP}`>,
|
|
109
|
-
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
110
|
-
> = {
|
|
111
|
-
[NextEP in Endpoints]: NextEP extends `${EP}{${string}}/${string}`
|
|
112
|
-
// ? BaseResut extends number[] | TMappingToNumber // does not works...("skipLibCheck=false")
|
|
113
|
-
// DEVNOTE: As it turns out, the behavior of this utility type is broken unless you use the "skipLibCheck=true".
|
|
114
|
-
? BaseResut extends number[] | { [x: infer T]: number }
|
|
115
|
-
? NextEP : never
|
|
116
|
-
: never;
|
|
117
|
-
}[Endpoints];
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* `InferNextEndpointLoos` is a utility type that infers the next endpoint based on the current endpoint and method.
|
|
121
|
-
*
|
|
122
|
-
* DONE: 2025/4/11 15:45:01
|
|
123
|
-
* ``` jsonc
|
|
124
|
-
* // Infer the next parameterized endpoint to request from the EP
|
|
125
|
-
* // Does not validate the EP result, just infers the next endpoint to request
|
|
126
|
-
* ```
|
|
127
|
-
*
|
|
128
|
-
* @template M - The HTTP method to use for the request.
|
|
129
|
-
* @template EP - The endpoint from which the next parameterized endpoint to request is inferred.
|
|
130
|
-
* @template Endpoints - The possible endpoints for the given method.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```ts
|
|
134
|
-
* type NextEndpoint = InferNextEndpointLoos<"get", "/markets/groups/">;
|
|
135
|
-
* // Result: "/markets/groups/{market_group_id}/"
|
|
136
|
-
* ```
|
|
137
|
-
* @remarks
|
|
138
|
-
* This type is useful for chaining requests or determining the next endpoint to call based on the current endpoint.
|
|
139
|
-
* It does not validate the response type of the endpoint, only the URL pattern.
|
|
140
|
-
*/
|
|
141
|
-
export type InferNextEndpointLoos<
|
|
142
|
-
M extends TESIEntryMethod,
|
|
143
|
-
//* ctt
|
|
144
|
-
// DEVNOTE: As it turns out, the behavior of this utility type is broken unless you use the "skipLibCheck=true".
|
|
145
|
-
EP extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
146
|
-
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
147
|
-
/*/
|
|
148
|
-
// This fix is required for skipLibCheck=false
|
|
149
|
-
EP extends Exclude<ESIEndpointOf<M>, symbol> = Exclude<ESIEndpointOf<M>, symbol>,
|
|
150
|
-
Endpoints extends Exclude<ESIEndpointOf<M>, symbol> = Exclude<ESIEndpointOf<M>, symbol>,
|
|
151
|
-
//*/
|
|
152
|
-
> = {
|
|
153
|
-
[NextEP in Endpoints]: NextEP extends `${EP}{${string}}${string}` ? NextEP : never
|
|
154
|
-
}[Endpoints];
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @see For the meaning of this type of comment trick, see {@link InferNextEndpointLoos} line comment.
|
|
158
|
-
*/
|
|
159
|
-
type ESIEndpointUnions = {
|
|
160
|
-
[M in TESIEntryMethod]: `${M}:${
|
|
161
|
-
//* ctt
|
|
162
|
-
ESIEndpointOf<M>
|
|
163
|
-
/*/
|
|
164
|
-
Exclude<ESIEndpointOf<M>, symbol>
|
|
165
|
-
//*/
|
|
166
|
-
}`;
|
|
167
|
-
}[TESIEntryMethod];
|
|
168
|
-
export type InferESIResponseResultEX<
|
|
169
|
-
EP extends unknown
|
|
170
|
-
// EP extends ESIEndpointUnions
|
|
171
|
-
> = EP extends `${infer M}:${infer EPRest}`
|
|
172
|
-
? M extends TESIEntryMethod
|
|
173
|
-
? EPRest extends ESIEndpointOf<M>
|
|
174
|
-
? _ESIResponseType<M, EPRest> extends { result: infer U }
|
|
175
|
-
? U : never
|
|
176
|
-
: never
|
|
177
|
-
: never
|
|
178
|
-
: never;
|
|
179
16
|
|
|
180
17
|
/**
|
|
181
18
|
* Represents a function that can make ESI requests with various HTTP methods.
|
|
182
19
|
*
|
|
183
20
|
* @template ActualOpt - The actual type of the options.
|
|
184
21
|
*
|
|
185
|
-
* @example
|
|
186
22
|
* ```ts
|
|
187
23
|
* // @ ts-expect-error
|
|
188
24
|
* export const request: IESIRequestFunction2<ESIRequestOptions> = (method, endpoint, opt) => {
|
|
@@ -269,7 +105,8 @@ export declare type TPathParamsNever = { /* pathParams?: never */ };
|
|
|
269
105
|
* HTTP method and endpoint.
|
|
270
106
|
*
|
|
271
107
|
* @template M - The HTTP method to use for the request.
|
|
272
|
-
* @template EPx - The endpoint path.
|
|
108
|
+
* @template EPx - The endpoint path.
|
|
109
|
+
* include `string` in the `EPx` constraints to avoid breaking typescript inference.
|
|
273
110
|
*
|
|
274
111
|
* @example
|
|
275
112
|
* ```ts
|
package/v2/util.d.ts
CHANGED
|
@@ -51,3 +51,22 @@ export type UnionToTuple<T> = UnionToIntersection<
|
|
|
51
51
|
* @date 2025/2/11 18:12:02
|
|
52
52
|
*/
|
|
53
53
|
export type InferKeysLen<T> = UnionToTuple<T>["length"];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Splits a string by a delimiter and returns a tuple of the resulting substrings.
|
|
57
|
+
* @example
|
|
58
|
+
* Split<"get:/characters/{character_id}/wallet/", ":">
|
|
59
|
+
* // Result: ["get", "/characters/{character_id}/wallet/"]
|
|
60
|
+
*/
|
|
61
|
+
export type Split<S extends string, D extends string = ":"> =
|
|
62
|
+
S extends `${infer T}${D}${infer U}`
|
|
63
|
+
? [T, ...Split<U, D>]
|
|
64
|
+
: [S];
|
|
65
|
+
|
|
66
|
+
// // Test cases
|
|
67
|
+
// type Test1 = Split<"get:/characters/{character_id}/wallet/">;
|
|
68
|
+
// // Expected: ["get", "/characters/{character_id}/wallet/"]
|
|
69
|
+
// type Test2 = Split<"a.b.c", ".">;
|
|
70
|
+
// // Expected: ['a', 'b', 'c']
|
|
71
|
+
// type Test3 = Split<"hello", ",">;
|
|
72
|
+
// // Expected: ['hello']
|