eve-esi-types 3.2.4 → 3.2.7
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 +39 -0
- package/README.md +87 -63
- package/{v2 → dist/v2}/esi-tagged-types.d.ts +77 -44
- package/{v2 → dist/v2}/experimental-esi-types.d.ts +139 -29
- package/dist/v2/index.d.ts +621 -0
- package/{v2 → dist/v2}/response-map.d.ts +1 -1
- package/{v2 → dist/v2}/types-index.d.ts +1 -1
- package/dist/v2/types-util.d.ts +281 -0
- package/dist/v2/util.d.ts +149 -0
- package/lib/console-util.mjs +1 -1
- package/lib/request-api.d.mts +4 -4
- package/lib/request-api.mjs +15 -16
- package/lib/rq-util.d.mts +76 -15
- package/lib/rq-util.mjs +122 -48
- package/lib/tagged-request-api.d.mts +2 -2
- package/lib/tagged-request-api.mjs +2 -2
- package/minimal-rq.mjs +5 -5
- package/package.json +5 -5
- package/request-v3.d.mts +1 -8
- package/request-v3.mjs +16 -19
- package/tagged-rq.mjs +17 -6
- package/{jsconfig.json → tsconfig.json} +5 -5
- package/v2/index.d.ts +0 -515
- package/v2/types-util.d.ts +0 -171
- package/v2/util.d.ts +0 -72
- /package/{v2 → dist/v2}/globals/alliance.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/assets.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/calendar.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/character.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/clones.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/contacts.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/contracts.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/corporation.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/dogma.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/extra-types.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/factionwarfare.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/fittings.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/fleets.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/incursions.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/industry.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/insurance.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/killmails.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/location.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/loyalty.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/mail.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/market.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/planetaryinteraction.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/routes.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/search.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/skills.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/sovereignty.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/status.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/universe.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/wallet.d.ts +0 -0
- /package/{v2 → dist/v2}/globals/wars.d.ts +0 -0
|
@@ -9,9 +9,110 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/experimental-esi-types.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.7 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
|
-
import type {
|
|
14
|
+
import type {
|
|
15
|
+
Split,
|
|
16
|
+
UnionToTuple,
|
|
17
|
+
RestrictKeys,
|
|
18
|
+
_ESIResponseType,
|
|
19
|
+
ESIEntryExtraKeys,
|
|
20
|
+
PickPathParameters,
|
|
21
|
+
ExtractPathParamKeys,
|
|
22
|
+
CombineIntersection,
|
|
23
|
+
} from "./index.d.ts";
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the final request-parameter shape and response type for an ESI endpoint,
|
|
28
|
+
* and indicates whether any parameters are actually required.
|
|
29
|
+
*
|
|
30
|
+
* @template M The HTTP method (e.g. `"get"`, `"post"`) of the request.
|
|
31
|
+
* @template EPx The endpoint path, constrained to `ESIEndpointOf<M>` or a string.
|
|
32
|
+
* @template Opt A record type of user-supplied options (e.g. query/body/path params).
|
|
33
|
+
* @template PathParams A record type representing the path-parameter properties.
|
|
34
|
+
* @template EntryWithParams
|
|
35
|
+
* By default, the merged type of the raw ESI response payload
|
|
36
|
+
* (`_ESIResponseType<M, EPx>`) and `PathParams`.
|
|
37
|
+
* @template RequireKeys
|
|
38
|
+
* The keys in `EntryWithParams` that represent actual request parameters,
|
|
39
|
+
* i.e. all keys minus the built-in ESI metadata (`result`, `tag`, `cachedSeconds`).
|
|
40
|
+
* @template FinalOpt
|
|
41
|
+
* The flattened intersection of:
|
|
42
|
+
* - the subset of `Opt` whose keys are in `RequireKeys`, and
|
|
43
|
+
* - a `Pick` of `EntryWithParams` over those same keys.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // /characters/{character_id}/attributes/
|
|
48
|
+
* type ExampleEntry = {
|
|
49
|
+
* result: GetCharactersCharacterIdAttributesOk;
|
|
50
|
+
* tag: "Skills";
|
|
51
|
+
* cachedSeconds: 120;
|
|
52
|
+
* auth: true;
|
|
53
|
+
* };
|
|
54
|
+
* type ExampleOpt = { auth: true; token: string };
|
|
55
|
+
* type ExamplePath = { character_id: number };
|
|
56
|
+
*
|
|
57
|
+
* // Suppose _ESIResponseType<"get", "/characters/{character_id}/attributes/"> = ExampleEntry
|
|
58
|
+
* type Desc = ResolveEndpointRequest<
|
|
59
|
+
* "get",
|
|
60
|
+
* "/characters/{character_id}/attributes/",
|
|
61
|
+
* ExampleOpt,
|
|
62
|
+
* ExamplePath
|
|
63
|
+
* >;
|
|
64
|
+
* // Desc resolves to:
|
|
65
|
+
* // [
|
|
66
|
+
* // { auth: true; token: string; character_id: number; },
|
|
67
|
+
* // GetCharactersCharacterIdAttributesOk,
|
|
68
|
+
* // 1
|
|
69
|
+
* // ]
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @see {@link ESIEndpointOf}
|
|
73
|
+
* @see {@link _ESIResponseType}
|
|
74
|
+
*/
|
|
75
|
+
export type ResolveEndpointRequest<
|
|
76
|
+
M extends TESIEntryMethod,
|
|
77
|
+
EPx extends ESIEndpointOf<M> | string,
|
|
78
|
+
Opt extends Record<string, unknown>,
|
|
79
|
+
PathParams extends Record<string, unknown>,
|
|
80
|
+
EntryWithParams = _ESIResponseType<M, EPx> & PathParams,
|
|
81
|
+
RequireKeys extends keyof EntryWithParams = Exclude<keyof EntryWithParams, ESIEntryExtraKeys>,
|
|
82
|
+
FinalOpt = CombineIntersection< RestrictKeys<Opt, RequireKeys> & Pick<EntryWithParams, RequireKeys> >
|
|
83
|
+
> = [
|
|
84
|
+
[RequireKeys] extends [never] ? [FinalOpt?] : [FinalOpt],
|
|
85
|
+
EntryWithParams extends { result: infer R } ? R : never,
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
type TESIRequestFunctionContext<
|
|
90
|
+
Mtd extends TESIEntryMethod = TESIEntryMethod,
|
|
91
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd> = ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
92
|
+
ActualOpt extends Record<string, unknown> = Record<string, unknown>,
|
|
93
|
+
|
|
94
|
+
EPO extends ResolvedEndpoint<Mtd, REP> = ResolvedEndpoint<Mtd, REP>,
|
|
95
|
+
PPM extends InferPathParams<REP, EPO> = InferPathParams<REP, EPO>,
|
|
96
|
+
Opt extends IdentifyParameters<Mtd, EPO, ActualOpt, PPM> = IdentifyParameters<Mtd, EPO, ActualOpt, PPM>,
|
|
97
|
+
Ret extends InferESIResponseResult<Mtd, EPO> = InferESIResponseResult<Mtd, EPO>,
|
|
98
|
+
HasOpt = HasRequireParams<Mtd, EPO, PPM>,
|
|
99
|
+
> = {
|
|
100
|
+
method: Mtd; endpoint: REP;
|
|
101
|
+
} & (HasOpt extends 1 ? { options: Opt } : { options?: Opt }) & {
|
|
102
|
+
result?: Ret;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
106
|
+
// TESIRequestFunctionWithContext
|
|
107
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
108
|
+
export type TESIRequestFunctionWithContext<
|
|
109
|
+
CTX extends TESIRequestFunctionContext,
|
|
110
|
+
Mtd extends TESIEntryMethod = CTX["method"],
|
|
111
|
+
// @ts-expect-error TODO: 2025/4/24
|
|
112
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd> = CTX["endpoint"],
|
|
113
|
+
ActualOpt extends Record<string, unknown> = CTX["options"]
|
|
114
|
+
> = (context: CTX) => Promise<NonNullable<CTX["result"]>>;
|
|
115
|
+
|
|
15
116
|
|
|
16
117
|
/**
|
|
17
118
|
* Infers the response result type of an ESI endpoint based on a union of HTTP method and endpoint.
|
|
@@ -19,7 +120,7 @@ import type { _ESIResponseType, PickPathParameters, UnionToTuple, Split } from "
|
|
|
19
120
|
* This utility type takes an endpoint union (`EPU`) in the format `${TESIEntryMethod}:${ESIEndpointAll}`
|
|
20
121
|
* and infers the response result type from the corresponding ESI response map.
|
|
21
122
|
*
|
|
22
|
-
* @template EPU
|
|
123
|
+
* @template EPU A union of HTTP method and endpoint in the format `${TESIEntryMethod}:${ESIEndpointAll}`.
|
|
23
124
|
*
|
|
24
125
|
* @remarks
|
|
25
126
|
* This type uses advanced TypeScript features such as template literal types and conditional types
|
|
@@ -64,10 +165,10 @@ export type InferESIResponseResultFromUnion<
|
|
|
64
165
|
* This utility type determines which endpoints can be chained after the current endpoint (`EP`),
|
|
65
166
|
* based on the response type (`BaseResut`) and the URL pattern of potential next endpoints.
|
|
66
167
|
*
|
|
67
|
-
* @template M
|
|
68
|
-
* @template EP
|
|
69
|
-
* @template BaseResut
|
|
70
|
-
* @template Endpoints
|
|
168
|
+
* @template M The HTTP method type (e.g., "get", "post", etc.), which must extend `TESIEntryMethod`.
|
|
169
|
+
* @template EP The current ESI endpoint under inspection; it extends `ESIEndpointOf<M>`.
|
|
170
|
+
* @template BaseResut Defaults to `InferESIResponseResult<M, EP>`; it is the inferred response result of the endpoint.
|
|
171
|
+
* @template Endpoints Defaults to `ESIEndpointOf<M>`; represents the union of all endpoints for method `M` to be considered as potential next endpoints.
|
|
71
172
|
*
|
|
72
173
|
* @remarks
|
|
73
174
|
* This type uses advanced TypeScript features such as conditional types, template literal types, and type inference
|
|
@@ -93,17 +194,28 @@ export type ResolveNextEndpoint<
|
|
|
93
194
|
: never;
|
|
94
195
|
}[Endpoints];
|
|
95
196
|
|
|
197
|
+
|
|
198
|
+
export type SplitEndpointUnion<
|
|
199
|
+
S extends ESIEndpointUnions, D extends string = ":",
|
|
200
|
+
AR extends any[] = Split<S, D>
|
|
201
|
+
> = AR[0] extends TESIEntryMethod
|
|
202
|
+
? AR[1] extends Exclude<ESIEndpointOf<AR[0]>, symbol>
|
|
203
|
+
? AR: never
|
|
204
|
+
: never;
|
|
205
|
+
// // Test cases
|
|
206
|
+
// type Test1 = SplitEndpointUnion<"post:/universe/ids/">;
|
|
207
|
+
|
|
96
208
|
/**
|
|
97
209
|
* Resolves the next applicable ESI endpoint based on a union of HTTP method and endpoint.
|
|
98
210
|
*
|
|
99
211
|
* This utility type determines which endpoints can be chained after the current endpoint (`EP`),
|
|
100
212
|
* based on the response type (`BaseResut`) and the URL pattern of potential next endpoints.
|
|
101
213
|
*
|
|
102
|
-
* @template EPU
|
|
103
|
-
* @template M
|
|
104
|
-
* @template EP
|
|
105
|
-
* @template BaseResut
|
|
106
|
-
* @template Endpoints
|
|
214
|
+
* @template EPU A union of HTTP method and endpoint in the format `${TESIEntryMethod}:${ESIEndpointAll}`.
|
|
215
|
+
* @template M The HTTP method extracted from `EPU`.
|
|
216
|
+
* @template EP The current endpoint extracted from `EPU`.
|
|
217
|
+
* @template BaseResut The inferred response result of the endpoint.
|
|
218
|
+
* @template Endpoints The union of all endpoints for the given method.
|
|
107
219
|
*
|
|
108
220
|
* @remarks
|
|
109
221
|
* This type uses advanced TypeScript features such as conditional types and template literal types
|
|
@@ -117,10 +229,8 @@ export type ResolveNextEndpoint<
|
|
|
117
229
|
*/
|
|
118
230
|
export type ResolveNextEndpointFromUnion<
|
|
119
231
|
EPU extends ESIEndpointUnions,
|
|
120
|
-
SplitM_EP =
|
|
121
|
-
// @ts-expect-error
|
|
232
|
+
SplitM_EP extends [TESIEntryMethod, any] = SplitEndpointUnion<EPU>,
|
|
122
233
|
M extends TESIEntryMethod = SplitM_EP[0],
|
|
123
|
-
// @ts-expect-error
|
|
124
234
|
EP extends Exclude<ESIEndpointOf<M>, symbol> = SplitM_EP[1],
|
|
125
235
|
BaseResut extends InferESIResponseResult<M, EP> = InferESIResponseResult<M, EP>,
|
|
126
236
|
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
@@ -138,9 +248,9 @@ export type ResolveNextEndpointFromUnion<
|
|
|
138
248
|
* This utility type checks if the response type (`Entry`) of the current endpoint satisfies the requirements
|
|
139
249
|
* for the next endpoint (`NextEP`), such as having the necessary path parameters.
|
|
140
250
|
*
|
|
141
|
-
* @template BaseResut
|
|
142
|
-
* @template NextEP
|
|
143
|
-
* @template Debug
|
|
251
|
+
* @template BaseResut The response type of the current endpoint (e.g., `number[]` or an array of objects).
|
|
252
|
+
* @template NextEP The next endpoint to validate.
|
|
253
|
+
* @template Debug Optional debug flag; if set to `1`, additional debug information is returned.
|
|
144
254
|
*
|
|
145
255
|
* @remarks
|
|
146
256
|
* This type assumes that if the response type is `number[]`, the next endpoint is always valid. For object arrays,
|
|
@@ -165,10 +275,10 @@ export type ValidateNextEndpoint<
|
|
|
165
275
|
* Validates whether the elements of an object array satisfy the path parameter requirements
|
|
166
276
|
* for a given endpoint.
|
|
167
277
|
*
|
|
168
|
-
* @template BaseResut
|
|
169
|
-
* @template NextEP
|
|
170
|
-
* @template Debug
|
|
171
|
-
* @template PathParams
|
|
278
|
+
* @template BaseResut The response type of the current endpoint (e.g., an array of objects).
|
|
279
|
+
* @template NextEP The next endpoint to validate.
|
|
280
|
+
* @template Debug Optional debug flag; if set to `1`, additional debug information is returned.
|
|
281
|
+
* @template PathParams Defaults to `ExtractPathParamsTuple<NextEP>`; represents the path parameters of the next endpoint.
|
|
172
282
|
*
|
|
173
283
|
* @remarks
|
|
174
284
|
* This type assumes that if the response type is an array of objects, it checks whether the required
|
|
@@ -186,7 +296,7 @@ type ValidateEndpointParamsInArray<
|
|
|
186
296
|
BaseResut extends unknown, // SomeType[]
|
|
187
297
|
NextEP extends string,
|
|
188
298
|
Debug = 0,
|
|
189
|
-
PathParams extends any[] =
|
|
299
|
+
PathParams extends any[] = ExtractPathParamKeys<NextEP>,
|
|
190
300
|
> = BaseResut extends (infer O)[]
|
|
191
301
|
? PathParams[1] extends keyof O ? NonNullable<O[PathParams[1]]> extends number
|
|
192
302
|
? Debug extends 1 // development
|
|
@@ -204,9 +314,9 @@ type ValidateEndpointParamsInArray<
|
|
|
204
314
|
* // Does not validate the EP result, just infers the next endpoint to request
|
|
205
315
|
* ```
|
|
206
316
|
*
|
|
207
|
-
* @template M
|
|
208
|
-
* @template EP
|
|
209
|
-
* @template Endpoints
|
|
317
|
+
* @template M The HTTP method to use for the request.
|
|
318
|
+
* @template EP The endpoint from which the next parameterized endpoint to request is inferred.
|
|
319
|
+
* @template Endpoints The possible endpoints for the given method.
|
|
210
320
|
*
|
|
211
321
|
* ```ts
|
|
212
322
|
* type NextEndpoint = ResolveNextEndpointLoos<"get", "/markets/groups/">;
|
|
@@ -219,7 +329,7 @@ type ValidateEndpointParamsInArray<
|
|
|
219
329
|
export type ResolveNextEndpointLoos<
|
|
220
330
|
M extends TESIEntryMethod,
|
|
221
331
|
/* ctt
|
|
222
|
-
// DEVNOTE:
|
|
332
|
+
// DEVNOTE: By applying "skipLibCheck=true", typescript semantics error will not occur.
|
|
223
333
|
EP extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
224
334
|
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
225
335
|
/*/
|
|
@@ -255,7 +365,7 @@ export type ESIEndpointUnions = {
|
|
|
255
365
|
* if the inferred response type (`InferESIResponseResultFromUnion<EPU>`) matches the specified type `T`.
|
|
256
366
|
* If it matches, the endpoint is included; otherwise, it is excluded.
|
|
257
367
|
*
|
|
258
|
-
* @template T
|
|
368
|
+
* @template T The response type to filter endpoints by.
|
|
259
369
|
*
|
|
260
370
|
* @example
|
|
261
371
|
* ``` ts
|
|
@@ -274,7 +384,7 @@ export type FilterEndpointUnionsByResponse<T> = {
|
|
|
274
384
|
* `ResolveNextEndpoint2` to determine if the endpoint is valid. If valid, the endpoint
|
|
275
385
|
* is included in the result; otherwise, it is excluded.
|
|
276
386
|
*
|
|
277
|
-
* @template EPUs
|
|
387
|
+
* @template EPUs The list of filtered endpoints to process.
|
|
278
388
|
*
|
|
279
389
|
* @example
|
|
280
390
|
* ``` ts
|