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
package/v2/types-util.d.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
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/types-util.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 3.2.4 of the EVE Online ESI response types.
|
|
13
|
-
*/
|
|
14
|
-
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Represents a function that can make ESI requests with various HTTP methods.
|
|
19
|
-
*
|
|
20
|
-
* @template ActualOpt - The actual type of the options.
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* // @ ts-expect-error
|
|
24
|
-
* export const request: IESIRequestFunction2<ESIRequestOptions> = (method, endpoint, opt) => {
|
|
25
|
-
* // Implementation for "get" | "post" | "put" | "delete" request
|
|
26
|
-
* };
|
|
27
|
-
* // You can easily implement "get" | "post" | "put" | "delete" requests
|
|
28
|
-
* // with code like the following:
|
|
29
|
-
* (["get", "post", "put", "delete"] as (keyof typeof request)[]).forEach((method) => {
|
|
30
|
-
* request[method] = function (this: typeof request, endpoint, opt) {
|
|
31
|
-
* return this(method, endpoint, opt);
|
|
32
|
-
* } as TESIRequestFunctionEachMethod2<typeof method>;
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export interface IESIRequestFunction2<ActualOpt extends Record<string, unknown>>
|
|
37
|
-
extends TESIRequestFunctionSignature2<ActualOpt>, TESIRequestFunctionMethods2<ActualOpt> {
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Represents the methods available for making ESI requests.
|
|
42
|
-
*
|
|
43
|
-
* + This interface is used when you already have implementation code such as
|
|
44
|
-
* TESIRequestFunctionSignature2 and you want to implement additional shorthand methods.
|
|
45
|
-
*
|
|
46
|
-
* @template ActualOpt - The actual type of the options.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```ts
|
|
50
|
-
* export const request: TESIRequestFunctionSignature2<ESIRequestOptions> = (method, endpoint, opt) => {
|
|
51
|
-
* // Implementation for "get" | "post" | "put" | "delete" request
|
|
52
|
-
* };
|
|
53
|
-
* // You can easily implement "get" | "post" | "put" | "delete" requests
|
|
54
|
-
* // with code like the following:
|
|
55
|
-
* const esiMethods = {} as TESIRequestFunctionMethods2<ESIRequestOptions>;
|
|
56
|
-
* (["get", "post", "put", "delete"] as (keyof TESIRequestFunctionMethods2)[]).forEach((method) => {
|
|
57
|
-
* esiMethods[method] = function (endpoint, opt) {
|
|
58
|
-
* return request(method, endpoint, opt);
|
|
59
|
-
* } as TESIRequestFunctionEachMethod2<typeof method>;
|
|
60
|
-
* });
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export type TESIRequestFunctionMethods2<ActualOpt extends Record<string, unknown>> = {
|
|
64
|
-
[method in TESIEntryMethod]: TESIRequestFunctionEachMethod2<method, ActualOpt>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* List of "x-cached-seconds"
|
|
69
|
-
*
|
|
70
|
-
* ```ts
|
|
71
|
-
* // const cacheSecGet: 3600 | 300 | 604800 | 120 | 5 | 600 | 86400 | 60 | 30 | 1200 | 1800 | 30758400
|
|
72
|
-
* const cacheSecGet: TESICachedSeconds<"get">;
|
|
73
|
-
* // const cache5sec: 5
|
|
74
|
-
* const cache5s: TESICachedSeconds<"put">;
|
|
75
|
-
* // const cache3600s: 3600
|
|
76
|
-
* const cache3600s: TESICachedSeconds<"post">;
|
|
77
|
-
* // "/characters/affiliation/"
|
|
78
|
-
* const cache3600sEndpoint: TESICachedSeconds<"post", 1>;
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export declare type TESICachedSeconds<
|
|
82
|
-
Method extends TESIEntryMethod, AsEndpoint = 0
|
|
83
|
-
> = {
|
|
84
|
-
[M in TESIEntryMethod]: {
|
|
85
|
-
[EP in ESIEndpointOf<M>]: TESIResponseOKMap[M][EP] extends { cachedSeconds: number }
|
|
86
|
-
? AsEndpoint extends 0
|
|
87
|
-
? TESIResponseOKMap[M][EP]["cachedSeconds"]: EP
|
|
88
|
-
: never
|
|
89
|
-
}[ESIEndpointOf<M>];
|
|
90
|
-
}[Method];
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Indicates that no path parameters are allowed.
|
|
94
|
-
*
|
|
95
|
-
* This type serves as a compile-time signal for endpoints that do not support dynamic URL segments.
|
|
96
|
-
* By using this type, it is clear that no path parameters should be provided.
|
|
97
|
-
*/
|
|
98
|
-
export declare type TPathParamsNever = { /* pathParams?: never */ };
|
|
99
|
-
|
|
100
|
-
// local types
|
|
101
|
-
/**
|
|
102
|
-
* Infers the response type of an ESI request based on the HTTP method and endpoint.
|
|
103
|
-
*
|
|
104
|
-
* This type extracts the response type from the `TESIResponseOKMap` based on the provided
|
|
105
|
-
* HTTP method and endpoint.
|
|
106
|
-
*
|
|
107
|
-
* @template M - The HTTP method to use for the request.
|
|
108
|
-
* @template EPx - The endpoint path.
|
|
109
|
-
* include `string` in the `EPx` constraints to avoid breaking typescript inference.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* type ResponseType = _ESIResponseType<"get", "/characters/{character_id}/">;
|
|
114
|
-
* // Result: The inferred response type for the given method and endpoint.
|
|
115
|
-
* ```
|
|
116
|
-
* @internal
|
|
117
|
-
* @see {@link ESIEndpointOf}
|
|
118
|
-
*/
|
|
119
|
-
export type _ESIResponseType<
|
|
120
|
-
M extends TESIEntryMethod,
|
|
121
|
-
EPx extends ESIEndpointOf<M> | string,
|
|
122
|
-
> = TESIResponseOKMap[M][Extract<EPx, ESIEndpointOf<M>>];
|
|
123
|
-
// type XOK = _ESIResponseType<"get", "/status/"> extends global._ESIResponseType<"get", "/status/"> ? 1 : 0;
|
|
124
|
-
/**
|
|
125
|
-
* Determines if the endpoint requires path parameters.
|
|
126
|
-
*
|
|
127
|
-
* @template EP - The string representing the endpoint path.
|
|
128
|
-
* @returns {TPathParamsNever | { pathParams: IfParameterizedPath<EP> }}
|
|
129
|
-
* Returns an object with `pathParams` if the endpoint requires parameters, otherwise returns `TPathParamsNever`.
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* type Example = IfNeedPathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
|
|
133
|
-
* // Result: { pathParams: [number, number] }
|
|
134
|
-
* ```
|
|
135
|
-
* @internal
|
|
136
|
-
* @see {@link IfParameterizedPath}
|
|
137
|
-
* @see {@link ReplacePathParams}
|
|
138
|
-
*/
|
|
139
|
-
export type _IfNeedPathParams<
|
|
140
|
-
EP extends unknown,
|
|
141
|
-
// will be `never` when cached
|
|
142
|
-
// Parameterized extends IfParameterizedPath<EP> = IfParameterizedPath<EP>
|
|
143
|
-
> = IfParameterizedPath<EP> extends never
|
|
144
|
-
? TPathParamsNever :
|
|
145
|
-
EP extends ReplacePathParams<EP>
|
|
146
|
-
? TPathParamsNever : { pathParams: IfParameterizedPath<EP> };
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Infer the result type of an ESI response based on the method and endpoint.
|
|
150
|
-
*
|
|
151
|
-
* @template M - The HTTP method (e.g., "get", "post").
|
|
152
|
-
* @template EP - The endpoint path.
|
|
153
|
-
* @deprecated 2025/3/17
|
|
154
|
-
*/
|
|
155
|
-
export type __InferESIResponseResult<
|
|
156
|
-
M extends TESIEntryMethod,
|
|
157
|
-
EP extends ESIEndpointOf<M>
|
|
158
|
-
> = TESIResponseOKMap[M][EP] extends { result: infer U } ? U : never;
|
|
159
|
-
/**
|
|
160
|
-
* Identifies the required parameters for a given entry type.
|
|
161
|
-
*
|
|
162
|
-
* @template Entry - The entry type to identify parameters for.
|
|
163
|
-
* @template Opt - The type of the parameters.
|
|
164
|
-
* @type {Opt & Pick<Entry, Exclude<keyof Entry, "result">>}
|
|
165
|
-
* @deprecated 2025/3/17
|
|
166
|
-
*/
|
|
167
|
-
export type __IdentifyParameters<
|
|
168
|
-
Entry, Opt,
|
|
169
|
-
Keys = Exclude<keyof Entry, "result" | "tag" | "cachedSeconds">
|
|
170
|
-
// @ts-expect-error
|
|
171
|
-
> = RequireThese<Opt, Keys> & Pick<Entry, Keys>;
|
package/v2/util.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
* @file eve-esi-types/v2/util.d.ts
|
|
10
|
-
* @since 2.3.1
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* If `Path` is parameterized, return the parameter name, such as `killmail_id`.
|
|
15
|
-
*
|
|
16
|
-
* @template Path The string representing the endpoint path.
|
|
17
|
-
* @returns {string | never} The parameter name if the path is parameterized, otherwise `never`.
|
|
18
|
-
*/
|
|
19
|
-
export type PickPathParameters<Path extends string> =
|
|
20
|
-
Path extends `${string}/{${infer Param}}/${infer Rest}`
|
|
21
|
-
? Param | PickPathParameters<`/${Rest}`>
|
|
22
|
-
: never;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Convert a union type to an intersection type.
|
|
26
|
-
*
|
|
27
|
-
* @template U The union type to convert.
|
|
28
|
-
* @returns {I} The intersection type.
|
|
29
|
-
*/
|
|
30
|
-
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Convert a union type to a tuple.
|
|
34
|
-
*
|
|
35
|
-
* @template T The union type to convert.
|
|
36
|
-
* @returns {Array} The tuple representation of the union type.
|
|
37
|
-
*/
|
|
38
|
-
export type UnionToTuple<T> = UnionToIntersection<
|
|
39
|
-
T extends any ? () => T : never
|
|
40
|
-
> extends () => infer R ? [...UnionToTuple<Exclude<T, R>>, R] : [];
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* #### Build an array of elements from a flattened tuple of type "1" | "2" | "3" ...
|
|
44
|
-
*
|
|
45
|
-
* NOTE: This utility cannot calculate lengths greater than 48 (?).
|
|
46
|
-
*
|
|
47
|
-
* + Returns the final length of the array.
|
|
48
|
-
*
|
|
49
|
-
* @template T The union type to be converted to a tuple and measured.
|
|
50
|
-
* @returns {number} The length of the tuple.
|
|
51
|
-
* @date 2025/2/11 18:12:02
|
|
52
|
-
*/
|
|
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']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|