eve-esi-types 3.2.0 → 3.2.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/package.json +1 -1
- package/v2/esi-tagged-types.d.ts +1 -1
- 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 +1 -3
- package/v2/response-map.d.ts +1 -1
- package/v2/types-index.d.ts +1 -1
- package/v2/types-util.d.ts +71 -90
|
@@ -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.1 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";
|
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.1 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.1 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,115 +9,98 @@
|
|
|
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.1 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
|
-
import "./index.d.ts"
|
|
15
|
+
import type { PickPathParameters, UnionToTuple } from "./index.d.ts";
|
|
16
|
+
|
|
16
17
|
|
|
17
|
-
// export type TMappingToNumber = { [key in string | number | symbol]: number };
|
|
18
18
|
/**
|
|
19
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
20
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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
|
-
*
|
|
21
|
+
* Resolves the next applicable ESI endpoint based on the current endpoint and its response type.
|
|
22
|
+
*
|
|
23
|
+
* This utility type determines which endpoints can be chained after the current endpoint (`EP`),
|
|
24
|
+
* based on the response type (`BaseResut`) and the URL pattern of potential next endpoints.
|
|
25
|
+
*
|
|
26
|
+
* @template M - The HTTP method type (e.g., "get", "post", etc.), which must extend `TESIEntryMethod`.
|
|
27
|
+
* @template EP - The current ESI endpoint under inspection; it extends `ESIEndpointOf<M>`.
|
|
28
|
+
* @template BaseResut - Defaults to `InferESIResponseResult<M, EP>`; it is the inferred response result of the endpoint.
|
|
29
|
+
* @template Endpoints - Defaults to `ESIEndpointOf<M>`; represents the union of all endpoints for method `M` to be considered as potential next endpoints.
|
|
30
|
+
*
|
|
58
31
|
* @remarks
|
|
59
|
-
* This type
|
|
60
|
-
*
|
|
32
|
+
* This type uses advanced TypeScript features such as conditional types, template literal types, and type inference
|
|
33
|
+
* to perform endpoint validation and chaining.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* type NextEndpoint = ResolveNextEndpoint<"get", "/characters/{character_id}/">;
|
|
38
|
+
* // Result: Union of endpoints like "/characters/{character_id}/assets" if they match the template and response type constraint.
|
|
39
|
+
* ```
|
|
61
40
|
*/
|
|
62
|
-
|
|
63
|
-
export type InferNextEndpoint<
|
|
41
|
+
export type ResolveNextEndpoint<
|
|
64
42
|
M extends TESIEntryMethod,
|
|
65
43
|
EP extends Exclude<ESIEndpointOf<M>, symbol> = Exclude<ESIEndpointOf<M>, symbol>,
|
|
66
44
|
BaseResut extends InferESIResponseResult<M, EP> = InferESIResponseResult<M, EP>,
|
|
45
|
+
// Endpoints extends ESIEndpointAll = ESIEndpointAll,
|
|
67
46
|
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
68
47
|
> = {
|
|
69
48
|
[NextEP in Endpoints]: NextEP extends `${EP}${string}{${string}}/${string}`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
? NextEP : never
|
|
75
|
-
/*/
|
|
76
|
-
? __ShiftType extends 0
|
|
77
|
-
? [EP, NextEP, BaseResut] : NextEP
|
|
78
|
-
: never
|
|
79
|
-
//*/
|
|
80
|
-
: never;
|
|
49
|
+
? ValidateNextEndpoint<BaseResut, NextEP> extends 1
|
|
50
|
+
? NextEP : never
|
|
51
|
+
// ? [EP, NextEP, BaseResut] : never
|
|
52
|
+
: never;
|
|
81
53
|
}[Endpoints];
|
|
82
54
|
|
|
83
55
|
/**
|
|
84
|
-
*
|
|
56
|
+
* Validates whether a given endpoint can be the next endpoint in a chain based on the response type of the current endpoint.
|
|
85
57
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
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
|
-
* ```
|
|
58
|
+
* This utility type checks if the response type (`Entry`) of the current endpoint satisfies the requirements
|
|
59
|
+
* for the next endpoint (`NextEP`), such as having the necessary path parameters.
|
|
91
60
|
*
|
|
92
|
-
* @template
|
|
93
|
-
* @template
|
|
94
|
-
* @template
|
|
95
|
-
* @template
|
|
61
|
+
* @template Entry - The response type of the current endpoint (e.g., `number[]` or an array of objects).
|
|
62
|
+
* @template NextEP - The next endpoint to validate.
|
|
63
|
+
* @template Debug - Optional debug flag; if set to `1`, additional debug information is returned.
|
|
64
|
+
* @template PathParams - Defaults to `UnionToTuple<PickPathParameters<NextEP>>`; represents the path parameters of the next endpoint.
|
|
96
65
|
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* type NextEndpoint = InferNextEndpoint2<"post", "/fleets/{fleet_id}/wings/">;
|
|
100
|
-
* // Result: "/fleets/{fleet_id}/wings/{wing_id}/squads/"
|
|
101
|
-
* ```
|
|
102
66
|
* @remarks
|
|
103
|
-
* This type
|
|
67
|
+
* This type assumes that if the response type is `number[]`, the next endpoint is always valid. For object arrays,
|
|
68
|
+
* it checks if the required path parameters can be inferred from the response type.
|
|
69
|
+
*
|
|
70
|
+
* ```typescript
|
|
71
|
+
* type IsValid = ValidateNextEndpoint<GetCharactersCharacterIdMail_200Ok[], "/characters/{character_id}/mail/{mail_id}/">;
|
|
72
|
+
* // Result: 1 if valid, 0 otherwise.
|
|
73
|
+
* ```
|
|
104
74
|
*/
|
|
105
|
-
export type
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
> =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
:
|
|
117
|
-
|
|
75
|
+
export type ValidateNextEndpoint<
|
|
76
|
+
Entry extends unknown, // number[] or SomeType[]
|
|
77
|
+
NextEP extends string,
|
|
78
|
+
Debug = 0,
|
|
79
|
+
PathParams = UnionToTuple<PickPathParameters<NextEP>>,
|
|
80
|
+
> =
|
|
81
|
+
//* ctt
|
|
82
|
+
// development
|
|
83
|
+
// If it is simply a number[], it is unconditionally assumed that there is a next endpoint.
|
|
84
|
+
Entry extends number[]
|
|
85
|
+
? 1
|
|
86
|
+
: Entry extends (infer O)[]
|
|
87
|
+
? NonNullable<O[PathParams[1]]> extends number
|
|
88
|
+
? Debug extends 1
|
|
89
|
+
? [NextEP, O, PathParams]
|
|
90
|
+
: 1
|
|
91
|
+
: 0
|
|
92
|
+
: 0;
|
|
93
|
+
/*/
|
|
94
|
+
// production
|
|
95
|
+
Entry extends number[] // If it is simply a number[], it is unconditionally assumed that there is a next endpoint.
|
|
96
|
+
? 1 : Entry extends (infer O)[]
|
|
97
|
+
? NonNullable<O[PathParams[1]]> extends number
|
|
98
|
+
? 1: 0
|
|
99
|
+
: 0;
|
|
100
|
+
//*/
|
|
118
101
|
|
|
119
102
|
/**
|
|
120
|
-
* `
|
|
103
|
+
* `ResolveNextEndpointLoos` is a utility type that infers the next endpoint based on the current endpoint and method.
|
|
121
104
|
*
|
|
122
105
|
* DONE: 2025/4/11 15:45:01
|
|
123
106
|
* ``` jsonc
|
|
@@ -129,16 +112,15 @@ export type InferNextEndpoint2<
|
|
|
129
112
|
* @template EP - The endpoint from which the next parameterized endpoint to request is inferred.
|
|
130
113
|
* @template Endpoints - The possible endpoints for the given method.
|
|
131
114
|
*
|
|
132
|
-
* @example
|
|
133
115
|
* ```ts
|
|
134
|
-
* type NextEndpoint =
|
|
116
|
+
* type NextEndpoint = ResolveNextEndpointLoos<"get", "/markets/groups/">;
|
|
135
117
|
* // Result: "/markets/groups/{market_group_id}/"
|
|
136
118
|
* ```
|
|
137
119
|
* @remarks
|
|
138
120
|
* This type is useful for chaining requests or determining the next endpoint to call based on the current endpoint.
|
|
139
121
|
* It does not validate the response type of the endpoint, only the URL pattern.
|
|
140
122
|
*/
|
|
141
|
-
export type
|
|
123
|
+
export type ResolveNextEndpointLoos<
|
|
142
124
|
M extends TESIEntryMethod,
|
|
143
125
|
//* ctt
|
|
144
126
|
// DEVNOTE: As it turns out, the behavior of this utility type is broken unless you use the "skipLibCheck=true".
|
|
@@ -154,7 +136,7 @@ export type InferNextEndpointLoos<
|
|
|
154
136
|
}[Endpoints];
|
|
155
137
|
|
|
156
138
|
/**
|
|
157
|
-
* @see For the meaning of this type of comment trick, see {@link
|
|
139
|
+
* @see For the meaning of this type of comment trick, see {@link ResolveNextEndpointLoos} line comment.
|
|
158
140
|
*/
|
|
159
141
|
type ESIEndpointUnions = {
|
|
160
142
|
[M in TESIEntryMethod]: `${M}:${
|
|
@@ -182,7 +164,6 @@ export type InferESIResponseResultEX<
|
|
|
182
164
|
*
|
|
183
165
|
* @template ActualOpt - The actual type of the options.
|
|
184
166
|
*
|
|
185
|
-
* @example
|
|
186
167
|
* ```ts
|
|
187
168
|
* // @ ts-expect-error
|
|
188
169
|
* export const request: IESIRequestFunction2<ESIRequestOptions> = (method, endpoint, opt) => {
|