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
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
3
|
+
// Copyright (C) 2025 jeffy-g <hirotom1107@gmail.com>
|
|
4
|
+
// Released under the MIT license
|
|
5
|
+
// https://opensource.org/licenses/mit-license.php
|
|
6
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
|
+
*
|
|
11
|
+
* @file eve-esi-types/v2/index.d.ts
|
|
12
|
+
* @summary This file is auto-generated and defines version 3.2.7 of the EVE Online ESI response types.
|
|
13
|
+
*/
|
|
14
|
+
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
|
+
import type { PickPathParameters, InferKeysLen, CombineIntersection, ExtractPathParamKeys } from "./util.d.ts";
|
|
16
|
+
import type {
|
|
17
|
+
ESIEntryParamKeys, ESIEntryExtraKeys,
|
|
18
|
+
_ESIResponseType,
|
|
19
|
+
_IfNeedPathParams,
|
|
20
|
+
TPathParamsNever,
|
|
21
|
+
ResolveEndpointParameters
|
|
22
|
+
// ESIEndpointUnions,
|
|
23
|
+
// IESIRequestFunction2,
|
|
24
|
+
// InferESIResponseResultEX,
|
|
25
|
+
// TESICachedSeconds, TESIRequestFunctionMethods2,
|
|
26
|
+
// __IdentifyParameters, __InferESIResponseResult,
|
|
27
|
+
} from "./types-util.d.ts";
|
|
28
|
+
export type * from "./response-map.d.ts";
|
|
29
|
+
export type * from "./types-util.d.ts";
|
|
30
|
+
export type * from "./util.d.ts";
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
34
|
+
// Internal types
|
|
35
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
36
|
+
/**
|
|
37
|
+
* Restricts the keys of a type to the specified ones while excluding extra keys.
|
|
38
|
+
*
|
|
39
|
+
* This utility type is designed to enforce stricter semantics by marking unwanted keys as `never`.
|
|
40
|
+
*
|
|
41
|
+
* @template T The original type to be constrained.
|
|
42
|
+
* @template T2 The type to merge with the constrained type.
|
|
43
|
+
* @template RequireKeys The keys to retain in the resulting type.
|
|
44
|
+
* @template Extras Automatically derived keys to exclude from the resulting type.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* type Original = { auth?: string; query?: string; body?: string; pathParams?: string; extra?: string };
|
|
49
|
+
* type Required = { auth: true; query: { test: "pen" | "pencil" } };
|
|
50
|
+
* type Restricted = RestrictKeys<Original, Required, "auth" | "query">;
|
|
51
|
+
* // Result: { auth: true; query: { test: "pen" | "pencil" }; body?: undefined; pathParams?: undefined; extra?: string | undefined }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
//* ctt
|
|
55
|
+
// incomplete
|
|
56
|
+
export type RestrictKeys<
|
|
57
|
+
T, RequireKeys/* extends keyof T */,
|
|
58
|
+
Extras = Exclude<ESIEntryParamKeys, RequireKeys>
|
|
59
|
+
> = {
|
|
60
|
+
[P in keyof T]: P extends Extras ? never : T[P];
|
|
61
|
+
};
|
|
62
|
+
export type RestrictKeys2<
|
|
63
|
+
T,
|
|
64
|
+
RequireKeys extends keyof T,
|
|
65
|
+
Extras = Exclude<keyof T, RequireKeys>
|
|
66
|
+
> = (
|
|
67
|
+
// 1. Include and make the required keys mandatory
|
|
68
|
+
{
|
|
69
|
+
[RQ in keyof T as RQ extends RequireKeys ? RQ : never]-?: T[RQ];
|
|
70
|
+
} &
|
|
71
|
+
// 2. Exclude extra keys from ESIEntryParamKeys and assign `never`
|
|
72
|
+
{
|
|
73
|
+
[Extra in ESIEntryParamKeys as Extra extends Extras ? Extra : never]?: never;
|
|
74
|
+
} &
|
|
75
|
+
// 3. Include remaining keys (not in ESIEntryParamKeys) as optional with their original types
|
|
76
|
+
{
|
|
77
|
+
[Other in keyof T as Other extends Extras ? (Other extends ESIEntryParamKeys ? never : Other) : never]?: T[Other];
|
|
78
|
+
}
|
|
79
|
+
) extends infer O
|
|
80
|
+
// Flatten the intersected type into a single object
|
|
81
|
+
? { [K in keyof O]: O[K] }
|
|
82
|
+
: never;
|
|
83
|
+
/*/
|
|
84
|
+
//*/
|
|
85
|
+
|
|
86
|
+
declare global {
|
|
87
|
+
|
|
88
|
+
type ESIEndpointType = string | symbol;
|
|
89
|
+
type __ShiftType = 1;
|
|
90
|
+
/**
|
|
91
|
+
* Marks specific properties of a type as required.
|
|
92
|
+
*
|
|
93
|
+
* @template T The original type.
|
|
94
|
+
* @template K The keys of the properties to mark as required.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* type Original = { a?: number; b?: string; c: boolean };
|
|
99
|
+
* type RequiredA = RequireThese<Original, 'a'>;
|
|
100
|
+
* // Result: { a: number; b?: string; c: boolean }
|
|
101
|
+
* ```
|
|
102
|
+
* @see Documentation of [`RequireThese`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/require-these.md)
|
|
103
|
+
*/
|
|
104
|
+
type RequireThese<T, K extends keyof T> = {
|
|
105
|
+
[P in keyof T as P extends K ? P : never]-?: T[P];
|
|
106
|
+
} & {
|
|
107
|
+
[P in keyof T as P extends K ? never : P]: T[P];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
111
|
+
// Version 3 types
|
|
112
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
113
|
+
/**
|
|
114
|
+
* Defines the function signature for making ESI requests to specific endpoints.
|
|
115
|
+
*
|
|
116
|
+
* This utility type provides a strongly-typed function signature for interacting with ESI endpoints.
|
|
117
|
+
* It ensures type safety by inferring the required parameters, options, and response types for the given endpoint.
|
|
118
|
+
*
|
|
119
|
+
* @template ActualOpt - A record type representing additional options for the request.
|
|
120
|
+
* @template Mtd - The HTTP method (e.g., "get", "post") to use for the request.
|
|
121
|
+
* @template REP - The real path of the ESI endpoint to send the request to.
|
|
122
|
+
* @template EPO - The parameterized path of the ESI endpoint (e.g., `/characters/{character_id}/assets/`).
|
|
123
|
+
* @template Params - The resolved parameters for the endpoint, including path parameters and user-supplied options.
|
|
124
|
+
* @template Opt - The final options object to include in the request.
|
|
125
|
+
* @template Ret - The response type of the endpoint.
|
|
126
|
+
*
|
|
127
|
+
* @param method - The HTTP method to use for the request (e.g., "get", "post").
|
|
128
|
+
* @param endpoint - The real path of the ESI endpoint to send the request to.
|
|
129
|
+
* @param options - An optional object containing additional options for the request. If the endpoint has required parameters, this parameter must be provided.
|
|
130
|
+
*
|
|
131
|
+
* @returns A `Promise` that resolves to the response type of the endpoint.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* - The `...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]` parameter ensures that if the endpoint has required parameters,
|
|
135
|
+
* the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
|
|
136
|
+
* - This type leverages `ResolveEndpointParameters` to infer the required options and response type.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* // Example: Making a request to the "get" method for a specific endpoint
|
|
141
|
+
* type ESIRequest = TESIRequestFunctionSignature2<ESIRequestOptions>;
|
|
142
|
+
* const runRequest: ESIRequest = async (method, endpoint, ...options) => {
|
|
143
|
+
* // Implementation here
|
|
144
|
+
* throw new Error();
|
|
145
|
+
* };
|
|
146
|
+
* runRequest("get", "/characters/{character_id}/assets/", {
|
|
147
|
+
* pathParams: 12345,
|
|
148
|
+
* auth: true,
|
|
149
|
+
* token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
150
|
+
* }).then(response => {
|
|
151
|
+
* console.log(response);
|
|
152
|
+
* });
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @see {@link ResolveEndpointParameters}
|
|
156
|
+
* @see {@link InferESIResponseResult}
|
|
157
|
+
*/
|
|
158
|
+
/* ctt
|
|
159
|
+
type TESIRequestFunctionSignature2<ActualOpt extends Record<string, unknown>> = <
|
|
160
|
+
Mtd extends TESIEntryMethod,
|
|
161
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
162
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
163
|
+
PPM extends InferPathParams<REP, EPO>,
|
|
164
|
+
Opt extends IdentifyParameters<Mtd, EPO, ActualOpt, PPM>,
|
|
165
|
+
Ret extends InferESIResponseResult<Mtd, EPO>,
|
|
166
|
+
HasOpt = HasRequireParams<Mtd, EPO, PPM>,
|
|
167
|
+
>(method: Mtd, endpoint: REP, ...options: HasOpt extends 1 ? [Opt] : [Opt?]) => Promise<Ret>;
|
|
168
|
+
/*/
|
|
169
|
+
type TESIRequestFunctionSignature2<ActualOpt extends Record<string, unknown>> = <
|
|
170
|
+
Mtd extends TESIEntryMethod,
|
|
171
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
172
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
173
|
+
Params extends ResolveEndpointParameters<Mtd, REP, EPO, ActualOpt>,
|
|
174
|
+
Opt extends Params["finalOptions"],
|
|
175
|
+
// Ret extends Params["result"],
|
|
176
|
+
>(method: Mtd, endpoint: REP, ...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]) => Promise<Params["result"]>;
|
|
177
|
+
//*/
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Defines an enhanced function signature for making ESI requests with an additional prepended parameter.
|
|
181
|
+
*
|
|
182
|
+
* This utility type extends the base ESI request function signature by adding a prepended parameter
|
|
183
|
+
* to allow for extra context or pre-processing before performing the request. It ensures type safety
|
|
184
|
+
* by inferring the required parameters, options, and response types for the given endpoint.
|
|
185
|
+
*
|
|
186
|
+
* @template PrependParam - The type of the additional parameter that is injected at the beginning of the function call.
|
|
187
|
+
* @template ActualOpt - A record type representing additional options for the request.
|
|
188
|
+
*
|
|
189
|
+
* @param prependParam - A prepended parameter providing additional context or configuration for the request.
|
|
190
|
+
* @param method - The HTTP method to use for the request (e.g., "get", "post").
|
|
191
|
+
* @param endpoint - The API endpoint, which might include path parameter replacements.
|
|
192
|
+
* @param options - Additional options for the request. If the endpoint has required parameters, this parameter must be provided.
|
|
193
|
+
*
|
|
194
|
+
* @returns A `Promise` that resolves to the response type of the endpoint.
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* - The `...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]` parameter ensures that if the endpoint has required parameters,
|
|
198
|
+
* the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
|
|
199
|
+
* - This type leverages `ResolveEndpointParameters` to infer the required options and response type.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* // Example: Making a request with an additional prepended parameter
|
|
204
|
+
* type EnhancedRequest = TESIEnhancedRequestFunctionSignature<
|
|
205
|
+
* { userId: string },
|
|
206
|
+
* ESIRequestOptions
|
|
207
|
+
* >;
|
|
208
|
+
* const fetchWithContext: EnhancedRequest = async (context, method, endpoint, ...options) => {
|
|
209
|
+
* console.log(`User ID: ${context.userId}`);
|
|
210
|
+
* // Implementation here
|
|
211
|
+
* throw new Error();
|
|
212
|
+
* };
|
|
213
|
+
* fetchWithContext(
|
|
214
|
+
* { userId: "12345" },
|
|
215
|
+
* "get",
|
|
216
|
+
* "/characters/{character_id}/assets/",
|
|
217
|
+
* {
|
|
218
|
+
* pathParams: 12345,
|
|
219
|
+
* auth: true,
|
|
220
|
+
* token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
221
|
+
* }
|
|
222
|
+
* ).then(response => {
|
|
223
|
+
* console.log(response);
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @see {@link ResolveEndpointParameters}
|
|
228
|
+
* @see {@link InferESIResponseResult}
|
|
229
|
+
* @see Documentation of [`TESIEnhancedRequestFunctionSignature`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/esi-enhanced-function-signature.md)
|
|
230
|
+
*/
|
|
231
|
+
/* ctt
|
|
232
|
+
type TESIEnhancedRequestFunctionSignature<
|
|
233
|
+
PrependParam extends unknown, ActualOpt extends Record<string, unknown>
|
|
234
|
+
> = <
|
|
235
|
+
Mtd extends TESIEntryMethod,
|
|
236
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
237
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
238
|
+
PPM extends InferPathParams<REP, EPO>,
|
|
239
|
+
Opt extends IdentifyParameters<Mtd, EPO, ActualOpt, PPM>,
|
|
240
|
+
Ret extends InferESIResponseResult<Mtd, EPO>,
|
|
241
|
+
HasOpt = HasRequireParams<Mtd, EPO, PPM>,
|
|
242
|
+
>(
|
|
243
|
+
prependParam: PrependParam,
|
|
244
|
+
method: Mtd, endpoint: REP, ...options: HasOpt extends 1 ? [Opt] : [Opt?]
|
|
245
|
+
) => Promise<Ret>;
|
|
246
|
+
/*/
|
|
247
|
+
type TESIEnhancedRequestFunctionSignature<
|
|
248
|
+
PrependParam extends unknown, ActualOpt extends Record<string, unknown>
|
|
249
|
+
> = <
|
|
250
|
+
Mtd extends TESIEntryMethod,
|
|
251
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
252
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
253
|
+
Params extends ResolveEndpointParameters<Mtd, REP, EPO, ActualOpt>,
|
|
254
|
+
Opt extends Params["finalOptions"],
|
|
255
|
+
>(
|
|
256
|
+
prependParam: PrependParam,
|
|
257
|
+
method: Mtd, endpoint: REP,
|
|
258
|
+
...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]
|
|
259
|
+
) => Promise<Params["result"]>;
|
|
260
|
+
//*/
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Defines the function signature for making ESI requests for a specific HTTP method.
|
|
264
|
+
*
|
|
265
|
+
* This utility type provides a strongly-typed function signature for interacting with ESI endpoints
|
|
266
|
+
* using a specific HTTP method. It ensures type safety by inferring the required parameters, options,
|
|
267
|
+
* and response types for the given endpoint.
|
|
268
|
+
*
|
|
269
|
+
* @template Mtd - The HTTP method (e.g., "get", "post") to use for the request.
|
|
270
|
+
* @template ActualOpt - A record type representing additional options for the request.
|
|
271
|
+
*
|
|
272
|
+
* @param endpoint - The API endpoint, which might include path parameter replacements.
|
|
273
|
+
* @param options - Additional options for the request. If the endpoint has required parameters, this parameter must be provided.
|
|
274
|
+
*
|
|
275
|
+
* @returns A `Promise` that resolves to the response type of the endpoint.
|
|
276
|
+
*
|
|
277
|
+
* @remarks
|
|
278
|
+
* - The `...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]` parameter ensures that if the endpoint has required parameters,
|
|
279
|
+
* the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
|
|
280
|
+
* - This type leverages `ResolveEndpointParameters` to infer the required options and response type.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* // Example: Making a request to the "get" method for a specific endpoint
|
|
285
|
+
* type GetRequest = TESIRequestFunctionEachMethod2<"get", ESIRequestOptions>;
|
|
286
|
+
* const fireGetRequest: GetRequest = async (endpoint, ...options) => {
|
|
287
|
+
* // Implementation here
|
|
288
|
+
* throw new Error();
|
|
289
|
+
* };
|
|
290
|
+
* fireGetRequest("/characters/{character_id}/assets/", {
|
|
291
|
+
* pathParams: 12345,
|
|
292
|
+
* auth: true,
|
|
293
|
+
* token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
294
|
+
* }).then(response => {
|
|
295
|
+
* console.log(response);
|
|
296
|
+
* });
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @see {@link ResolveEndpointParameters}
|
|
300
|
+
* @see {@link InferESIResponseResult}
|
|
301
|
+
*/
|
|
302
|
+
/* ctt
|
|
303
|
+
type TESIRequestFunctionEachMethod2<Mtd extends TESIEntryMethod, ActualOpt extends Record<string, unknown>> = <
|
|
304
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
305
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
306
|
+
PPM extends InferPathParams<REP, EPO>,
|
|
307
|
+
Opt extends IdentifyParameters<Mtd, EPO, ActualOpt, PPM>,
|
|
308
|
+
Ret extends InferESIResponseResult<Mtd, EPO>,
|
|
309
|
+
HasOpt = HasRequireParams<Mtd, EPO, PPM>,
|
|
310
|
+
>(endpoint: REP, ...options: HasOpt extends 1 ? [Opt] : [Opt?]) => Promise<Ret>;
|
|
311
|
+
/*/
|
|
312
|
+
type TESIRequestFunctionEachMethod2<Mtd extends TESIEntryMethod, ActualOpt extends Record<string, unknown>> = <
|
|
313
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
314
|
+
EPO extends ResolvedEndpoint<Mtd, REP>,
|
|
315
|
+
Params extends ResolveEndpointParameters<Mtd, REP, EPO, ActualOpt>,
|
|
316
|
+
Opt extends Params["finalOptions"],
|
|
317
|
+
>(endpoint: REP, ...options: Params["optionIsRequire"] extends 1 ? [Opt] : [Opt?]) => Promise<Params["result"]>;
|
|
318
|
+
//*/
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Replaces path parameters in a string with numbers.
|
|
322
|
+
*
|
|
323
|
+
* @template T The string representing the endpoint path.
|
|
324
|
+
* @type {string}
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* type Example = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
|
|
328
|
+
* // Result: `/characters/${number}/fittings/${number}/`
|
|
329
|
+
* ```
|
|
330
|
+
* @see Documentation of [`ReplacePathParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/replace-path-params.md)
|
|
331
|
+
*/
|
|
332
|
+
type ReplacePathParams<T extends unknown> = T extends `${infer Start}{${infer Param}}${infer End}`
|
|
333
|
+
? `${Start}${number}${ReplacePathParams<End>}` : T;
|
|
334
|
+
|
|
335
|
+
// // incomplete
|
|
336
|
+
// type Example2 = ReplacePathParams<"/characters/1234/fittings/{fitting_id}/">;
|
|
337
|
+
// // Result: `characters/${number}/fittings/${number}/`
|
|
338
|
+
// type Example3 = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Infers the path parameters based on the real endpoint and the resolved endpoint.
|
|
342
|
+
*
|
|
343
|
+
* @template RealEP The real endpoint path.
|
|
344
|
+
* @template EPO (Endpoint Path Origin) The resolved endpoint path.
|
|
345
|
+
* @returns {TPathParamsNever | _IfNeedPathParams<EPO>}
|
|
346
|
+
* @see {@link _IfNeedPathParams}
|
|
347
|
+
* @see {@link TPathParamsNever}
|
|
348
|
+
* @see Documentation of [`InferPathParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/infer-path-params.md)
|
|
349
|
+
* @date 2025/3/17
|
|
350
|
+
*/
|
|
351
|
+
type InferPathParams<
|
|
352
|
+
RealEP extends PropertyKey, EPO extends PropertyKey
|
|
353
|
+
> = RealEP extends EPO ? _IfNeedPathParams<EPO> : TPathParamsNever;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Infers the original endpoint based on the real endpoint and the HTTP method.
|
|
357
|
+
*
|
|
358
|
+
* This type maps the real endpoint to its corresponding parameterized endpoint
|
|
359
|
+
* by checking if the real endpoint matches the pattern of any parameterized endpoint.
|
|
360
|
+
*
|
|
361
|
+
* @template RealEP The real endpoint path.
|
|
362
|
+
* @template M The HTTP method to use for the request.
|
|
363
|
+
* @template Endpoints The possible endpoints for the given method.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* type Original = InferEndpointOrigin<"/characters/123/fittings/456/", "delete">;
|
|
368
|
+
* // Result: "/characters/{character_id}/fittings/{fitting_id}/"
|
|
369
|
+
* ```
|
|
370
|
+
* @see {@link ESIEndpointOf}
|
|
371
|
+
* @see {@link ReplacePathParams}
|
|
372
|
+
* @see Documentation of [`InferEndpointOrigin`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/infer-endpoint-origin.md)
|
|
373
|
+
*/
|
|
374
|
+
type InferEndpointOrigin<
|
|
375
|
+
M extends TESIEntryMethod, RealEP extends PropertyKey,
|
|
376
|
+
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>
|
|
377
|
+
> = {
|
|
378
|
+
[EP in Endpoints]: RealEP extends ReplacePathParams<EP>
|
|
379
|
+
? EP : never;
|
|
380
|
+
}[Endpoints];
|
|
381
|
+
/**
|
|
382
|
+
* Determines the resolved endpoint based on the real endpoint and the method.
|
|
383
|
+
*
|
|
384
|
+
* @template RealEP The real endpoint path.
|
|
385
|
+
* @template M The HTTP method to use for the request.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```ts
|
|
389
|
+
* type Resolved = ResolvedEndpoint<"/characters/123/fittings/456/", "delete">;
|
|
390
|
+
* // Result: "/characters/{character_id}/fittings/{fitting_id}/"
|
|
391
|
+
* ```
|
|
392
|
+
* @see {@link InferEndpointOrigin}
|
|
393
|
+
* @see Documentation of [`ResolvedEndpoint`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/resolved-endpoint.md)
|
|
394
|
+
*/
|
|
395
|
+
type ResolvedEndpoint<
|
|
396
|
+
M extends TESIEntryMethod,
|
|
397
|
+
RealEP extends PropertyKey,
|
|
398
|
+
> = InferEndpointOrigin<M, RealEP> extends never ? RealEP: InferEndpointOrigin<M, RealEP>;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Determines if the given entry has required parameters, including additional options.
|
|
402
|
+
*
|
|
403
|
+
* This type checks if an entry has any required parameters by excluding the keys "result", "tag", and "cachedSeconds".
|
|
404
|
+
* If any keys remain after this exclusion, it means the entry has required parameters.
|
|
405
|
+
*
|
|
406
|
+
* @template M The HTTP method to use for the request.
|
|
407
|
+
* @template EPx The endpoint path.
|
|
408
|
+
* @template PathParams Path parameters to include in the check.
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
|
|
413
|
+
* type HasRequired = HasRequireParams<"get", "/example/endpoint", { auth: string }>; // 1
|
|
414
|
+
* ```
|
|
415
|
+
* @see {@link ESIEndpointOf}
|
|
416
|
+
* @see Documentation of [`HasRequireParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/has-require-params.md)
|
|
417
|
+
*/
|
|
418
|
+
/* ctt
|
|
419
|
+
type HasRequireParams<
|
|
420
|
+
M extends TESIEntryMethod,
|
|
421
|
+
EPx extends ESIEndpointOf<M> | string,
|
|
422
|
+
AdditionalParams,
|
|
423
|
+
> = PickRequireParams<M, EPx, AdditionalParams> extends never ? 0 : 1;
|
|
424
|
+
/*/
|
|
425
|
+
type HasRequireParams<
|
|
426
|
+
M extends TESIEntryMethod,
|
|
427
|
+
EPx extends ESIEndpointOf<M> | string,
|
|
428
|
+
PathParams extends Record<string, unknown>,
|
|
429
|
+
RequireKeys = Exclude<keyof (_ESIResponseType<M, EPx> & PathParams), ESIEntryExtraKeys>
|
|
430
|
+
> = [RequireKeys] extends [never] ? 0 : 1;
|
|
431
|
+
//*/
|
|
432
|
+
|
|
433
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
434
|
+
// Version 2 types
|
|
435
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
436
|
+
/**
|
|
437
|
+
* Determines the number of parameters in a parameterized endpoint path.
|
|
438
|
+
*
|
|
439
|
+
* This utility type checks if the given endpoint path contains parameters (e.g., `{param}`) and returns:
|
|
440
|
+
* - `number` if there is one parameter.
|
|
441
|
+
* - `[number, number]` if there are two parameters.
|
|
442
|
+
* - `never` if there are no parameters.
|
|
443
|
+
*
|
|
444
|
+
* @template EP - The string representing the endpoint path.
|
|
445
|
+
* @returns {number | [number, number] | never} The number of parameters in the path.
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* type SingleParam = IfParameterizedPath<"/characters/{character_id}/">;
|
|
450
|
+
* // Result: number
|
|
451
|
+
*
|
|
452
|
+
* type TwoParams = IfParameterizedPath<"/characters/{character_id}/assets/{asset_id}/">;
|
|
453
|
+
* // Result: [number, number]
|
|
454
|
+
*
|
|
455
|
+
* type NoParams = IfParameterizedPath<"/characters/1234/">;
|
|
456
|
+
* // Result: 0
|
|
457
|
+
* ```
|
|
458
|
+
* @see {@link ExtractPathParamKeys}
|
|
459
|
+
*/
|
|
460
|
+
/* ctt
|
|
461
|
+
type IfParameterizedPath<EP extends PropertyKey> = EP extends `${string}/{${string}}${string}`
|
|
462
|
+
? PickPathParameters<EP> extends never
|
|
463
|
+
? 0 : InferKeysLen<PickPathParameters<EP>> extends 1
|
|
464
|
+
? number : [number, number]
|
|
465
|
+
: 0;
|
|
466
|
+
/*/
|
|
467
|
+
export type IfParameterizedPath<EP extends PropertyKey> =
|
|
468
|
+
ExtractPathParamKeys<EP> extends []
|
|
469
|
+
? 0 : ExtractPathParamKeys<EP> extends [any]
|
|
470
|
+
? number : ExtractPathParamKeys<EP> extends [any, any]
|
|
471
|
+
? [number, number]
|
|
472
|
+
: never;
|
|
473
|
+
//*/
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Identifies and combines the required request parameters for a given ESI entry.
|
|
477
|
+
*
|
|
478
|
+
* Given:
|
|
479
|
+
* - `Opt`: the shape of user-supplied options (e.g., query/body/path params),
|
|
480
|
+
* - `_ESIResponseType<M, EPx>`: the expected response payload type for method `M` and endpoint `EPx`,
|
|
481
|
+
* - `PathParams`: the path parameters for the endpoint,
|
|
482
|
+
*
|
|
483
|
+
* this type:
|
|
484
|
+
* 1. Merges `_ESIResponseType<M, EPx>` with `PathParams` to form `EntryWithParams`.
|
|
485
|
+
* 2. Excludes extra metadata keys (`result`, `tag`, `cachedSeconds`) from `EntryWithParams`, yielding `RequireKeys`.
|
|
486
|
+
* 3. Restricts `Opt` to only the keys in `RequireKeys`.
|
|
487
|
+
* 4. Picks those `RequireKeys` from `EntryWithParams`.
|
|
488
|
+
* 5. Flattens the intersection into a single parameter object via `CombineIntersection`.
|
|
489
|
+
*
|
|
490
|
+
* @template M The HTTP method (e.g., "get", "post") of the request.
|
|
491
|
+
* @template EPx The endpoint path, constrained to `ESIEndpointOf<M>` or `string`.
|
|
492
|
+
* @template Opt A record type of user-supplied request options.
|
|
493
|
+
* @template PathParams A record type representing path parameters for the endpoint.
|
|
494
|
+
* @template EntryWithParams The merged type of response payload and `PathParams`.
|
|
495
|
+
* @template RequireKeys The keys from `EntryWithParams` that represent actual request parameters.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* // /characters/{character_id}/attributes/
|
|
500
|
+
* type ExampleEntry = { result: GetCharactersCharacterIdAttributesOk; tag: "Skills"; cachedSeconds: 120; auth: true };
|
|
501
|
+
* type ExampleOpt = { auth: true; token: "eyJhbGciOiJSUzI1NiIsI..." };
|
|
502
|
+
* type ExamplePath = { pathParams: number };
|
|
503
|
+
*
|
|
504
|
+
* // Assume _ESIResponseType<"get", "/characters/{character_id}/attributes/"> = ExampleEntry
|
|
505
|
+
* type IdentifiedParams = IdentifyParameters<
|
|
506
|
+
* "get", "/characters/{character_id}/attributes/", ExampleOpt, ExamplePath
|
|
507
|
+
* >;
|
|
508
|
+
* // Resolves to: { auth: true; token: "eyJhbGciOiJSUzI1NiIsI..."; pathParams: number; }
|
|
509
|
+
* ```
|
|
510
|
+
* @see {@link ESIEndpointOf}
|
|
511
|
+
* @see {@link _ESIResponseType}
|
|
512
|
+
* @see Documentation of [`IdentifyParameters`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/identify-parameters.md)
|
|
513
|
+
*/
|
|
514
|
+
type IdentifyParameters<
|
|
515
|
+
M extends TESIEntryMethod,
|
|
516
|
+
EPx extends ESIEndpointOf<M> | string,
|
|
517
|
+
Opt extends Record<string, unknown>,
|
|
518
|
+
PathParams extends Record<string, unknown>,
|
|
519
|
+
EntryWithParams = _ESIResponseType<M, EPx> & PathParams,
|
|
520
|
+
RequireKeys extends keyof EntryWithParams = Exclude<keyof EntryWithParams, ESIEntryExtraKeys>
|
|
521
|
+
> = CombineIntersection<
|
|
522
|
+
RestrictKeys<Opt, RequireKeys> & Pick<EntryWithParams, RequireKeys>
|
|
523
|
+
>;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Infers the result type of an ESI response based on the method and endpoint.
|
|
527
|
+
*
|
|
528
|
+
* @template M The HTTP method to use for the request.
|
|
529
|
+
* @template EPx The endpoint path.
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* type Result = InferESIResponseResult<"get", "/characters/{character_id}/">;
|
|
534
|
+
* // Result: The inferred type of the response for the given method and endpoint.
|
|
535
|
+
* ```
|
|
536
|
+
* @see {@link ESIEndpointOf}
|
|
537
|
+
* @see {@link _ESIResponseType}
|
|
538
|
+
* @see Documentation of [`InferESIResponseResult`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/infer-esi-response-result.md)
|
|
539
|
+
*/
|
|
540
|
+
type InferESIResponseResult<
|
|
541
|
+
M extends TESIEntryMethod,
|
|
542
|
+
EPx extends ESIEndpointOf<M> | string
|
|
543
|
+
> = _ESIResponseType<M, EPx> extends { result: infer U } ? U : never;
|
|
544
|
+
/*
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
// declare const NO_CONTENT_RESPONSE: unique symbol;
|
|
548
|
+
// type NoContentResponse = {
|
|
549
|
+
// [NO_CONTENT_RESPONSE]: never;
|
|
550
|
+
// };
|
|
551
|
+
/**
|
|
552
|
+
* Represents a response with no content (HTTP status 204).
|
|
553
|
+
*/
|
|
554
|
+
type NoContentResponse = { /* status: 204 */ } & { __status: 204 };
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Represents the HTTP methods supported by ESI.
|
|
558
|
+
*
|
|
559
|
+
* ```ts
|
|
560
|
+
* "get" | "post" | "put" | "delete"
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
type TESIEntryMethod = keyof TESIResponseOKMap;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Represents endpoints using `TESIEntryMethod`.
|
|
567
|
+
* @date 2025/3/16
|
|
568
|
+
*/
|
|
569
|
+
type ESIEndpointOf<M extends TESIEntryMethod> = keyof TESIResponseOKMap[M];
|
|
570
|
+
/**
|
|
571
|
+
* Represents the endpoints for the "get" method.
|
|
572
|
+
*/
|
|
573
|
+
type TEndPointGet = ESIEndpointOf<"get">;
|
|
574
|
+
/**
|
|
575
|
+
* Represents the endpoints for the "post" method.
|
|
576
|
+
*/
|
|
577
|
+
type TEndPointPost = ESIEndpointOf<"post">;
|
|
578
|
+
/**
|
|
579
|
+
* Represents the endpoints for the "put" method.
|
|
580
|
+
*/
|
|
581
|
+
type TEndPointPut = ESIEndpointOf<"put">;
|
|
582
|
+
/**
|
|
583
|
+
* Represents the endpoints for the "delete" method.
|
|
584
|
+
*/
|
|
585
|
+
type TEndPointDelete = ESIEndpointOf<"delete">;
|
|
586
|
+
/**
|
|
587
|
+
* Union of all `ESIEndpointOf<TESIEntryMethod>`
|
|
588
|
+
* @date 2025/4/12
|
|
589
|
+
*/
|
|
590
|
+
type ESIEndpointAll = {
|
|
591
|
+
[M in TESIEntryMethod]: ESIEndpointOf<M>;
|
|
592
|
+
}[TESIEntryMethod];
|
|
593
|
+
|
|
594
|
+
// type TESIResponseEntries<
|
|
595
|
+
// M extends TESIEntryMethod, EP extends ESIEndpointOf<M>
|
|
596
|
+
// > = TESIResponseOKMap[M][EP];
|
|
597
|
+
/**
|
|
598
|
+
* Represents the entry details for the "get" method.
|
|
599
|
+
*
|
|
600
|
+
* @template K The endpoint key.
|
|
601
|
+
*/
|
|
602
|
+
type TESIResponseGetEntry<K extends TEndPointGet> = TESIResponseOKMap["get"][K];
|
|
603
|
+
/**
|
|
604
|
+
* Represents the entry details for the "put" method.
|
|
605
|
+
*
|
|
606
|
+
* @template K The endpoint key.
|
|
607
|
+
*/
|
|
608
|
+
type TESIResponsePutEntry<K extends TEndPointPut> = TESIResponseOKMap["put"][K];
|
|
609
|
+
/**
|
|
610
|
+
* Represents the entry details for the "post" method.
|
|
611
|
+
*
|
|
612
|
+
* @template K The endpoint key.
|
|
613
|
+
*/
|
|
614
|
+
type TESIResponsePostEntry<K extends TEndPointPost> = TESIResponseOKMap["post"][K];
|
|
615
|
+
/**
|
|
616
|
+
* Represents the entry details for the "delete" method.
|
|
617
|
+
*
|
|
618
|
+
* @template K The endpoint key.
|
|
619
|
+
*/
|
|
620
|
+
type TESIResponseDeleteEntry<K extends TEndPointDelete> = TESIResponseOKMap["delete"][K];
|
|
621
|
+
}
|
|
@@ -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.7 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import "./types-index.d.ts";
|
|
15
15
|
|
|
@@ -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.7 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import "./globals/alliance.d.ts";
|
|
15
15
|
import "./globals/assets.d.ts";
|