eve-esi-types 3.2.4 → 3.2.6
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 +26 -0
- package/{v2 → dist/v2}/esi-tagged-types.d.ts +1 -1
- package/{v2 → dist/v2}/experimental-esi-types.d.ts +26 -5
- package/{v2 → dist/v2}/index.d.ts +52 -32
- package/{v2 → dist/v2}/response-map.d.ts +1 -1
- package/{v2 → dist/v2}/types-index.d.ts +1 -1
- package/{v2 → dist/v2}/types-util.d.ts +1 -1
- package/{v2 → dist/v2}/util.d.ts +15 -0
- package/jsconfig.json +5 -5
- package/lib/request-api.d.mts +4 -4
- package/lib/request-api.mjs +8 -8
- package/lib/rq-util.d.mts +8 -2
- package/lib/rq-util.mjs +18 -4
- package/lib/tagged-request-api.d.mts +2 -2
- package/lib/tagged-request-api.mjs +2 -2
- package/minimal-rq.mjs +3 -3
- package/package.json +3 -3
- package/request-v3.d.mts +1 -8
- package/request-v3.mjs +12 -11
- package/tagged-rq.mjs +15 -5
- /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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [3.2.6] - 2025-04-24
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug Fixes
|
|
8
|
+
|
|
9
|
+
- `normalizeOptions` bug
|
|
10
|
+
|
|
11
|
+
### ⚙️ Miscellaneous Tasks
|
|
12
|
+
|
|
13
|
+
- Update CHANGELOG.md
|
|
14
|
+
- Update "main" field in package.json to point to dist folder
|
|
15
|
+
- Bump version to v3.2.6
|
|
16
|
+
|
|
17
|
+
## [3.2.5] - 2025-04-24
|
|
18
|
+
|
|
19
|
+
### 💼 Other
|
|
20
|
+
|
|
21
|
+
- Refactor v2/experimental-esi-types.d.ts
|
|
22
|
+
|
|
23
|
+
### ⚙️ Miscellaneous Tasks
|
|
24
|
+
|
|
25
|
+
- Update CHANGELOG.md
|
|
26
|
+
- Relocate v2 files to dist/v2 directory
|
|
27
|
+
- Update import paths to reflect new structure
|
|
28
|
+
- Update jsconfig.json for improved path resolution
|
|
29
|
+
- Bump version to v3.2.5
|
|
30
|
+
|
|
5
31
|
## [3.2.4] - 2025-04-22
|
|
6
32
|
|
|
7
33
|
### 🚜 Refactor
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/esi-tagged-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.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./index.d.ts";
|
|
15
15
|
export type * from "./index.d.ts";
|
|
@@ -9,10 +9,22 @@
|
|
|
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.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { _ESIResponseType, PickPathParameters, UnionToTuple, Split } from "./index.d.ts";
|
|
15
15
|
|
|
16
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
17
|
+
// TESIRequestFunctionWithContext
|
|
18
|
+
// - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
19
|
+
export type TESIRequestFunctionWithContext<
|
|
20
|
+
CTX extends TESIRequestFunctionContext,
|
|
21
|
+
Mtd extends TESIEntryMethod = CTX["method"],
|
|
22
|
+
// @ts-expect-error TODO: 2025/4/24
|
|
23
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd> = CTX["endpoint"],
|
|
24
|
+
ActualOpt extends Record<string, unknown> = CTX["options"]
|
|
25
|
+
> = (context: CTX) => Promise<NonNullable<CTX["result"]>>;
|
|
26
|
+
|
|
27
|
+
|
|
16
28
|
/**
|
|
17
29
|
* Infers the response result type of an ESI endpoint based on a union of HTTP method and endpoint.
|
|
18
30
|
*
|
|
@@ -93,6 +105,17 @@ export type ResolveNextEndpoint<
|
|
|
93
105
|
: never;
|
|
94
106
|
}[Endpoints];
|
|
95
107
|
|
|
108
|
+
|
|
109
|
+
export type SplitEndpointUnion<
|
|
110
|
+
S extends ESIEndpointUnions, D extends string = ":",
|
|
111
|
+
AR extends any[] = Split<S, D>
|
|
112
|
+
> = AR[0] extends TESIEntryMethod
|
|
113
|
+
? AR[1] extends Exclude<ESIEndpointOf<AR[0]>, symbol>
|
|
114
|
+
? AR: never
|
|
115
|
+
: never;
|
|
116
|
+
// // Test cases
|
|
117
|
+
// type Test1 = SplitEndpointUnion<"post:/universe/ids/">;
|
|
118
|
+
|
|
96
119
|
/**
|
|
97
120
|
* Resolves the next applicable ESI endpoint based on a union of HTTP method and endpoint.
|
|
98
121
|
*
|
|
@@ -117,10 +140,8 @@ export type ResolveNextEndpoint<
|
|
|
117
140
|
*/
|
|
118
141
|
export type ResolveNextEndpointFromUnion<
|
|
119
142
|
EPU extends ESIEndpointUnions,
|
|
120
|
-
SplitM_EP =
|
|
121
|
-
// @ts-expect-error
|
|
143
|
+
SplitM_EP extends [TESIEntryMethod, any] = SplitEndpointUnion<EPU>,
|
|
122
144
|
M extends TESIEntryMethod = SplitM_EP[0],
|
|
123
|
-
// @ts-expect-error
|
|
124
145
|
EP extends Exclude<ESIEndpointOf<M>, symbol> = SplitM_EP[1],
|
|
125
146
|
BaseResut extends InferESIResponseResult<M, EP> = InferESIResponseResult<M, EP>,
|
|
126
147
|
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
@@ -219,7 +240,7 @@ type ValidateEndpointParamsInArray<
|
|
|
219
240
|
export type ResolveNextEndpointLoos<
|
|
220
241
|
M extends TESIEntryMethod,
|
|
221
242
|
/* ctt
|
|
222
|
-
// DEVNOTE:
|
|
243
|
+
// DEVNOTE: By applying "skipLibCheck=true", typescript semantics error will not occur.
|
|
223
244
|
EP extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
224
245
|
Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>,
|
|
225
246
|
/*/
|
|
@@ -9,10 +9,10 @@
|
|
|
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.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
|
-
import type { PickPathParameters, InferKeysLen } from "./util.d.ts";
|
|
15
|
+
import type { PickPathParameters, InferKeysLen, CombineIntersection } from "./util.d.ts";
|
|
16
16
|
import type {
|
|
17
17
|
_ESIResponseType,
|
|
18
18
|
_IfNeedPathParams,
|
|
@@ -54,28 +54,35 @@ type ESIEntryKeys = "auth" | "query" | "body" | "pathParams";
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
//* ctt
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
// incomplete
|
|
58
|
+
export type RestrictKeys<
|
|
59
|
+
T, RequireKeys/* extends keyof T */,
|
|
59
60
|
Extras = Exclude<ESIEntryKeys, RequireKeys>
|
|
60
61
|
> = {
|
|
61
62
|
[P in keyof T]: P extends Extras ? never : T[P];
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
export type RestrictKeys2<
|
|
65
|
+
T,
|
|
66
|
+
RequireKeys extends keyof T,
|
|
67
|
+
Extras = Exclude<keyof T, RequireKeys>
|
|
68
|
+
> = (
|
|
69
|
+
// 1. Include and make the required keys mandatory
|
|
70
|
+
{
|
|
71
|
+
[RQ in keyof T as RQ extends RequireKeys ? RQ : never]-?: T[RQ];
|
|
72
|
+
} &
|
|
73
|
+
// 2. Exclude extra keys from ESIEntryKeys and assign `never`
|
|
74
|
+
{
|
|
75
|
+
[Extra in ESIEntryKeys as Extra extends Extras ? Extra : never]?: never;
|
|
76
|
+
} &
|
|
77
|
+
// 3. Include remaining keys (not in ESIEntryKeys) as optional with their original types
|
|
78
|
+
{
|
|
79
|
+
[Other in keyof T as Other extends Extras ? (Other extends ESIEntryKeys ? never : Other) : never]?: T[Other];
|
|
80
|
+
}
|
|
81
|
+
) extends infer O
|
|
82
|
+
// Flatten the intersected type into a single object
|
|
83
|
+
? { [K in keyof O]: O[K] }
|
|
84
|
+
: never;
|
|
71
85
|
/*/
|
|
72
|
-
type RestrictKeys<
|
|
73
|
-
T, T2,
|
|
74
|
-
K extends keyof T,
|
|
75
|
-
Extras = Exclude<ESIEntryKeys, K>
|
|
76
|
-
> = T2 & {
|
|
77
|
-
[P in keyof T as P extends K ? never : P]: P extends Extras ? never : T[P];
|
|
78
|
-
};
|
|
79
86
|
//*/
|
|
80
87
|
|
|
81
88
|
declare global {
|
|
@@ -140,6 +147,23 @@ declare global {
|
|
|
140
147
|
HasOpt = HasRequireParams<Mtd, EPX, PPM>,
|
|
141
148
|
>(method: Mtd, endpoint: REP, ...options: HasOpt extends 1 ? [Opt] : [Opt?]) => Promise<Ret>;
|
|
142
149
|
|
|
150
|
+
|
|
151
|
+
type TESIRequestFunctionContext<
|
|
152
|
+
Mtd extends TESIEntryMethod = TESIEntryMethod,
|
|
153
|
+
REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd> = ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
|
|
154
|
+
ActualOpt extends Record<string, unknown> = Record<string, unknown>,
|
|
155
|
+
|
|
156
|
+
EPX extends ResolvedEndpoint<REP, Mtd> = ResolvedEndpoint<REP, Mtd>,
|
|
157
|
+
PPM extends InferPathParams<REP, EPX> = InferPathParams<REP, EPX>,
|
|
158
|
+
Opt extends IdentifyParameters<Mtd, EPX, ActualOpt, PPM> = IdentifyParameters<Mtd, EPX, ActualOpt, PPM>,
|
|
159
|
+
Ret extends InferESIResponseResult<Mtd, EPX> = InferESIResponseResult<Mtd, EPX>,
|
|
160
|
+
HasOpt = HasRequireParams<Mtd, EPX, PPM>,
|
|
161
|
+
> = {
|
|
162
|
+
method: Mtd; endpoint: REP;
|
|
163
|
+
} & (HasOpt extends 1 ? { options: Opt } : { options?: Opt }) & {
|
|
164
|
+
result?: Ret;
|
|
165
|
+
};
|
|
166
|
+
|
|
143
167
|
/**
|
|
144
168
|
* A function signature type for making enhanced ESI requests.
|
|
145
169
|
*
|
|
@@ -392,28 +416,24 @@ declare global {
|
|
|
392
416
|
* @see {@link _ESIResponseType}
|
|
393
417
|
* @see Documentation of [`IdentifyParameters`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v2/identify-parameters.md)
|
|
394
418
|
*/
|
|
395
|
-
|
|
419
|
+
/* ctt
|
|
396
420
|
type IdentifyParameters<
|
|
397
421
|
M extends TESIEntryMethod,
|
|
398
422
|
EPx extends ESIEndpointOf<M> | string,
|
|
399
423
|
Opt extends Record<string, unknown>,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
RequireKeys = Exclude<keyof
|
|
403
|
-
|
|
404
|
-
> = RestrictKeys<Opt, RequireKeys> & Pick<Entry, RequireKeys> & AdditionalParams;
|
|
424
|
+
PathParams,
|
|
425
|
+
EntryWithParams = _ESIResponseType<M, EPx> & PathParams,
|
|
426
|
+
RequireKeys extends keyof EntryWithParams = Exclude<keyof EntryWithParams, "result" | "tag" | "cachedSeconds">
|
|
427
|
+
> = RestrictKeys<Opt, RequireKeys> & Pick<EntryWithParams, RequireKeys>;
|
|
405
428
|
/*/
|
|
406
|
-
// DEVNOTE: 2025/3/24
|
|
407
|
-
// The definition is simple and highly maintainable, but it is not possible to reference the `pathParams` property when implementing `TESIRequestFunctionSignature2` etc.
|
|
408
429
|
type IdentifyParameters<
|
|
409
430
|
M extends TESIEntryMethod,
|
|
410
431
|
EPx extends ESIEndpointOf<M> | string,
|
|
411
432
|
Opt extends Record<string, unknown>,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
> = RestrictKeys<Opt, Pick<Entry, Keys> & AdditionalParams, Keys>;
|
|
433
|
+
PathParams,
|
|
434
|
+
EntryWithParams = _ESIResponseType<M, EPx> & PathParams,
|
|
435
|
+
RequireKeys extends keyof EntryWithParams = Exclude<keyof EntryWithParams, "result" | "tag" | "cachedSeconds">
|
|
436
|
+
> = CombineIntersection< RestrictKeys<Opt, RequireKeys> & Pick<EntryWithParams, RequireKeys> >;
|
|
417
437
|
//*/
|
|
418
438
|
|
|
419
439
|
/**
|
|
@@ -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.5 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.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import "./globals/alliance.d.ts";
|
|
15
15
|
import "./globals/assets.d.ts";
|
|
@@ -9,7 +9,7 @@
|
|
|
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.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
15
15
|
|
package/{v2 → dist/v2}/util.d.ts
RENAMED
|
@@ -16,10 +16,18 @@
|
|
|
16
16
|
* @template Path The string representing the endpoint path.
|
|
17
17
|
* @returns {string | never} The parameter name if the path is parameterized, otherwise `never`.
|
|
18
18
|
*/
|
|
19
|
+
//* ctt
|
|
19
20
|
export type PickPathParameters<Path extends string> =
|
|
20
21
|
Path extends `${string}/{${infer Param}}/${infer Rest}`
|
|
21
22
|
? Param | PickPathParameters<`/${Rest}`>
|
|
22
23
|
: never;
|
|
24
|
+
/*/
|
|
25
|
+
export type PickPathParameters<Path extends string> =
|
|
26
|
+
Path extends `${string}/{${infer Param}}/${string}/{${infer Param2}}/${string}`
|
|
27
|
+
? Param | Param2 : Path extends `${string}/{${infer Param}}/${string}`
|
|
28
|
+
? Param
|
|
29
|
+
: never;
|
|
30
|
+
//*/
|
|
23
31
|
|
|
24
32
|
/**
|
|
25
33
|
* Convert a union type to an intersection type.
|
|
@@ -70,3 +78,10 @@ export type Split<S extends string, D extends string = ":"> =
|
|
|
70
78
|
// // Expected: ['a', 'b', 'c']
|
|
71
79
|
// type Test3 = Split<"hello", ",">;
|
|
72
80
|
// // Expected: ['hello']
|
|
81
|
+
|
|
82
|
+
//* ctt
|
|
83
|
+
// export type CombineIntersection<IS> = IS extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
84
|
+
export type CombineIntersection<IS extends Record<string, unknown>> = { [K in keyof IS]: IS[K] };
|
|
85
|
+
/*/
|
|
86
|
+
export type CombineIntersection<IS> = IS;
|
|
87
|
+
//*/
|
package/jsconfig.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
//
|
|
4
|
+
// "skipDefaultLibCheck": true,
|
|
5
5
|
// "skipLibCheck": true,
|
|
6
6
|
// This flag is required
|
|
7
7
|
"checkJs": true,
|
|
8
8
|
// This flag is required
|
|
9
9
|
"strict": true,
|
|
10
10
|
"noEmit": true,
|
|
11
|
-
"
|
|
12
|
-
// "
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
// "listFiles": true,
|
|
13
13
|
// "target": "esnext",
|
|
14
14
|
// "module": "esnext",
|
|
15
|
-
|
|
15
|
+
"diagnostics": true,
|
|
16
16
|
// "moduleResolution": "node",
|
|
17
17
|
"rootDirs": [
|
|
18
18
|
"./"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"./*.mjs",
|
|
23
23
|
"./lib/*.mjs",
|
|
24
24
|
// "./lib/*.d.mts",
|
|
25
|
-
"./v2/**/*.d.ts"
|
|
25
|
+
"./dist/v2/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"exclude": [
|
|
28
28
|
]
|
package/lib/request-api.d.mts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
8
|
import * as util from "./rq-util.mjs";
|
|
9
|
-
import type { IESIRequestFunction2 } from "../v2";
|
|
9
|
+
import type { IESIRequestFunction2 } from "../dist/v2";
|
|
10
10
|
/**
|
|
11
|
-
* @typedef {import("../v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
12
|
-
* @typedef {import("../v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
11
|
+
* @typedef {import("../dist/v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
12
|
+
* @typedef {import("../dist/v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
13
13
|
*/
|
|
14
14
|
/** #### Sample of `TESIRequestFunctionSignature`
|
|
15
15
|
*
|
|
@@ -19,7 +19,7 @@ import type { IESIRequestFunction2 } from "../v2";
|
|
|
19
19
|
* @type {IESIRequestFunction2}
|
|
20
20
|
* @param method - The HTTP method to use for the request
|
|
21
21
|
* @param endpoint - The Path of the ESI endpoint to send the request to
|
|
22
|
-
* @param
|
|
22
|
+
* @param opt - An object of options to include in the request
|
|
23
23
|
* @returns A Promise object containing the response data
|
|
24
24
|
* @throws {util.ESIRequestError}
|
|
25
25
|
*/
|
package/lib/request-api.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="../v2"/>
|
|
8
|
+
/// <reference types="../dist/v2"/>
|
|
9
9
|
// - - - - - - - - - - - - - - - - - - - -
|
|
10
10
|
// imports
|
|
11
11
|
// - - - - - - - - - - - - - - - - - - - -
|
|
@@ -17,8 +17,8 @@ import * as util from "./rq-util.mjs";
|
|
|
17
17
|
const log = util.getUniversalLogger("[request-api]: ");
|
|
18
18
|
const DEBUG = util.isDebug();
|
|
19
19
|
/**
|
|
20
|
-
* @typedef {import("../v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
21
|
-
* @typedef {import("../v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
20
|
+
* @typedef {import("../dist/v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
21
|
+
* @typedef {import("../dist/v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
22
22
|
*/
|
|
23
23
|
// - - - - - - - - - - - - - - - - - - - -
|
|
24
24
|
// main functions
|
|
@@ -31,21 +31,21 @@ const DEBUG = util.isDebug();
|
|
|
31
31
|
* @type {IESIRequestFunction2}
|
|
32
32
|
* @param method - The HTTP method to use for the request
|
|
33
33
|
* @param endpoint - The Path of the ESI endpoint to send the request to
|
|
34
|
-
* @param
|
|
34
|
+
* @param opt - An object of options to include in the request
|
|
35
35
|
* @returns A Promise object containing the response data
|
|
36
36
|
* @throws {util.ESIRequestError}
|
|
37
37
|
*/
|
|
38
38
|
export const request2 = /** @type {IESIRequestFunction2} */ (async (method, endpoint, opt) => {
|
|
39
|
+
// When only options are provided
|
|
40
|
+
const actualOpt = /** @type {NonNullable<typeof opt> & util.ESIRequestOptions} */ (opt || {});
|
|
39
41
|
/** @type {number[]=} */
|
|
40
42
|
let pathParams;
|
|
41
|
-
if (typeof
|
|
42
|
-
pathParams = /** @type {number[]} */ (Array.isArray(
|
|
43
|
+
if (typeof actualOpt.pathParams === "number" || Array.isArray(actualOpt.pathParams)) {
|
|
44
|
+
pathParams = /** @type {number[]} */ (Array.isArray(actualOpt.pathParams) ? actualOpt.pathParams : [actualOpt.pathParams]);
|
|
43
45
|
}
|
|
44
46
|
if (Array.isArray(pathParams)) {
|
|
45
47
|
endpoint = util.replaceCbt(endpoint, pathParams);
|
|
46
48
|
}
|
|
47
|
-
// When only options are provided
|
|
48
|
-
const actualOpt = /** @type {NonNullable<typeof opt>} */ (opt || {});
|
|
49
49
|
const { rqopt, qss } = util.initOptions(method, actualOpt);
|
|
50
50
|
const endpointUrl = util.curl(endpoint);
|
|
51
51
|
const up = new URLSearchParams(qss);
|
package/lib/rq-util.d.mts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="../v2"/>
|
|
8
|
+
/// <reference types="../dist/v2"/>
|
|
9
9
|
// - - - - - - - - - - - - - - - - - - - -
|
|
10
10
|
// imports
|
|
11
11
|
// - - - - - - - - - - - - - - - - - - - -
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// https://opensource.org/licenses/mit-license.php
|
|
17
17
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
18
18
|
*/
|
|
19
|
-
import type { TESIRequestFunctionMethods2 } from "../v2";
|
|
19
|
+
import type { TESIRequestFunctionMethods2 } from "../dist/v2";
|
|
20
20
|
import type { TESIErrorStats } from "./esi-error-types";
|
|
21
21
|
export { isNode } from "./constants.mjs";
|
|
22
22
|
/**
|
|
@@ -77,6 +77,12 @@ export declare class ESIErrorLimitReachedError extends ESIRequestError {
|
|
|
77
77
|
/**
|
|
78
78
|
* @typedef {import("./rq-util.mjs").ESIRequestOptions} ESIRequestOptions
|
|
79
79
|
*/
|
|
80
|
+
/**
|
|
81
|
+
* @template T
|
|
82
|
+
* @param {[T] | [(T | undefined)?]} opt
|
|
83
|
+
* @returns {NonNullable<T>}
|
|
84
|
+
*/
|
|
85
|
+
export declare const normalizeOptions: <T extends unknown>(opt: [T] | [(T | undefined)?]) => NonNullable<T>;
|
|
80
86
|
/**
|
|
81
87
|
* #### status: 200 | 201 | 204
|
|
82
88
|
*
|
package/lib/rq-util.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="../v2"/>
|
|
8
|
+
/// <reference types="../dist/v2"/>
|
|
9
9
|
// - - - - - - - - - - - - - - - - - - - -
|
|
10
10
|
// imports
|
|
11
11
|
// - - - - - - - - - - - - - - - - - - - -
|
|
@@ -51,6 +51,20 @@ export class ESIErrorLimitReachedError extends ESIRequestError {
|
|
|
51
51
|
// - - - - - - - - - - - - - - - - - - - -
|
|
52
52
|
// utility functions
|
|
53
53
|
// - - - - - - - - - - - - - - - - - - - -
|
|
54
|
+
/**
|
|
55
|
+
* @template T
|
|
56
|
+
* @param {[T] | [(T | undefined)?]} opt
|
|
57
|
+
* @returns {NonNullable<T>}
|
|
58
|
+
*/
|
|
59
|
+
export const normalizeOptions = (opt) => {
|
|
60
|
+
//* ctt
|
|
61
|
+
return /** @type {NonNullable<T>} */ (opt.length ? (opt[0] ?? {}) : {});
|
|
62
|
+
/*/
|
|
63
|
+
const r = /** @type {NonNullable<T>} * /(opt.length ? (opt[0] ?? {}): {}) as NonNullable<T>;
|
|
64
|
+
log(`normalizeOptions::[${JSON.stringify(r)}]`);
|
|
65
|
+
return r;
|
|
66
|
+
//*/
|
|
67
|
+
};
|
|
54
68
|
/**
|
|
55
69
|
* #### status: 200 | 201 | 204
|
|
56
70
|
*
|
|
@@ -326,7 +340,7 @@ export function getLogger() {
|
|
|
326
340
|
}
|
|
327
341
|
/**
|
|
328
342
|
* Need typescript v5.5 later
|
|
329
|
-
* @import * as ESI from "../v2";
|
|
343
|
+
* @import * as ESI from "../dist/v2";
|
|
330
344
|
* @typedef {ESI.TESIRequestFunctionMethods2<ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
331
345
|
*/
|
|
332
346
|
/**
|
|
@@ -338,12 +352,12 @@ export function getLogger() {
|
|
|
338
352
|
* @type {TESIEnhancedRequestFunctionSignature<TPrependParams, ESIRequestOptions>}
|
|
339
353
|
*/
|
|
340
354
|
const fireWithoutAuth = (fn, method, endpoint, ...opt) => {
|
|
355
|
+
const arg = opt.length ? opt[0] : void 0;
|
|
341
356
|
if (typeof fn === "function") {
|
|
342
|
-
const arg = opt.length ? opt[0] : void 0;
|
|
343
357
|
return fn(method, endpoint, /** @type {Parameters<typeof fn>[2]} */ (arg));
|
|
344
358
|
}
|
|
345
359
|
// @ts-expect-error TODO: ts(2345) The argument type does not match the type of the specified parameter
|
|
346
|
-
return fn[method](endpoint,
|
|
360
|
+
return fn[method](endpoint, arg);
|
|
347
361
|
};
|
|
348
362
|
const token = `token.token.token`;
|
|
349
363
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="../v2/esi-tagged-types"/>
|
|
8
|
+
/// <reference types="../dist/v2/esi-tagged-types"/>
|
|
9
9
|
import type { ESIRequestOptions } from "./rq-util.mjs";
|
|
10
10
|
/**
|
|
11
11
|
* Decorates the ESI request body into a tagged ESI request map.
|
|
@@ -30,4 +30,4 @@ export declare function decoreateESIRequestBody<Opt extends Record<string, unkno
|
|
|
30
30
|
* @since 2.x
|
|
31
31
|
* @type {XESI.TaggedESIRequestMap2<ESIRequestOptions>}
|
|
32
32
|
*/
|
|
33
|
-
export declare const esi: import("../v2/esi-tagged-types").TaggedESIRequestMap2<ESIRequestOptions>;
|
|
33
|
+
export declare const esi: import("../dist/v2/esi-tagged-types").TaggedESIRequestMap2<ESIRequestOptions>;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="../v2/esi-tagged-types"/>
|
|
8
|
+
/// <reference types="../dist/v2/esi-tagged-types"/>
|
|
9
9
|
/**
|
|
10
10
|
* @file eve-esi-types/lib/tagged-request-api.mts
|
|
11
11
|
*/
|
|
12
12
|
import { request2 } from "./request-api.mjs";
|
|
13
13
|
/**
|
|
14
|
-
* @import { TESIRequestFunctionMethods2 } from "../v2"
|
|
14
|
+
* @import { TESIRequestFunctionMethods2 } from "../dist/v2"
|
|
15
15
|
*/
|
|
16
16
|
/**
|
|
17
17
|
* @typedef {`${string}${"" | `,${string}`}`} TMethodList
|
package/minimal-rq.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="./v2"/>
|
|
8
|
+
/// <reference types="./dist/v2"/>
|
|
9
9
|
// - - - - - - - - - - - - - - - - - - - -
|
|
10
10
|
// imports
|
|
11
11
|
// - - - - - - - - - - - - - - - - - - - -
|
|
@@ -17,8 +17,8 @@ import { request2 } from "./lib/request-api.mjs";
|
|
|
17
17
|
// shorthands
|
|
18
18
|
const log = util.getUniversalLogger("[request-mini]: ");
|
|
19
19
|
/**
|
|
20
|
-
* @typedef {import("./v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
21
|
-
* @typedef {import("./v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
20
|
+
* @typedef {import("./dist/v2").IESIRequestFunction2<util.ESIRequestOptions>} IESIRequestFunction2
|
|
21
|
+
* @typedef {import("./dist/v2").TESIRequestFunctionMethods2<util.ESIRequestOptions>} TESIRequestFunctionMethods2
|
|
22
22
|
*/
|
|
23
23
|
// - - - - - - - - - - - - - - - - - - - -
|
|
24
24
|
// main functions
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-esi-types",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "Extracted the main type of ESI. use for ESI request response types (version 2 only)",
|
|
5
|
-
"main": "v2/index.d.ts",
|
|
5
|
+
"main": "dist/v2/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "tsc -p jsconfig.json",
|
|
8
8
|
"test": "node request-v3.mjs -debug",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+ssh://git@github.com/jeffy-g/eve-esi-types.git"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"
|
|
16
|
+
"dist",
|
|
17
17
|
"lib",
|
|
18
18
|
"web",
|
|
19
19
|
"*.d.mts",
|
package/request-v3.d.mts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
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
|
-
import { type ESIRequestOptions } from "./lib/rq-util.mjs";
|
|
1
|
+
import type { ESIRequestOptions } from "./lib/rq-util.mjs";
|
|
9
2
|
/**
|
|
10
3
|
* @returns Get The Current ESI request pending count.
|
|
11
4
|
*/
|
package/request-v3.mjs
CHANGED
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
https://opensource.org/licenses/mit-license.php
|
|
6
6
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @file request-v3.mts
|
|
10
|
+
* @command node request-v3.mjs
|
|
11
|
+
*/
|
|
12
|
+
/// <reference types="./dist/v2"/>
|
|
9
13
|
// - - - - - - - - - - - - - - - - - - - -
|
|
10
14
|
// imports
|
|
11
15
|
// - - - - - - - - - - - - - - - - - - - -
|
|
12
|
-
|
|
13
|
-
// import type { TESIResponseOKMap } from "eve-esi-types";
|
|
14
|
-
import { is, curl, replaceCbt, getSDEVersion, initOptions, isDebug, fireRequestsDoesNotRequireAuth, isSuccess, handleESIError, handleSuccessResponse } from "./lib/rq-util.mjs";
|
|
16
|
+
import { is, curl, replaceCbt, getSDEVersion, normalizeOptions, initOptions, isDebug, fireRequestsDoesNotRequireAuth, isSuccess, handleESIError, handleSuccessResponse, } from "./lib/rq-util.mjs";
|
|
15
17
|
// - - - - - - - - - - - - - - - - - - - -
|
|
16
18
|
// constants, types
|
|
17
19
|
// - - - - - - - - - - - - - - - - - - - -
|
|
@@ -21,9 +23,8 @@ const isArray = Array.isArray;
|
|
|
21
23
|
/**
|
|
22
24
|
* enable/disable console.log
|
|
23
25
|
*/
|
|
24
|
-
|
|
26
|
+
const LOG = isDebug();
|
|
25
27
|
/**
|
|
26
|
-
* @typedef {import("./v2").TESIResponseOKMap} TESIResponseOKMap
|
|
27
28
|
* @typedef {import("./lib/rq-util.mjs").ESIRequestOptions} ESIRequestOptions
|
|
28
29
|
* @typedef {import("./lib/rq-util.mjs").ESIRequestError} ESIRequestError
|
|
29
30
|
* @typedef {import("./lib/rq-util.mjs").Truthy} Truthy
|
|
@@ -50,17 +51,17 @@ export const getRequestPending = () => ax;
|
|
|
50
51
|
* @throws {ESIRequestError}
|
|
51
52
|
* @async
|
|
52
53
|
*/
|
|
53
|
-
export const fire = /** @type {TESIRequestFunctionSignature2<ESIRequestOptions>} */ (async (mthd, endp, opt) => {
|
|
54
|
+
export const fire = /** @type {TESIRequestFunctionSignature2<ESIRequestOptions>} */ (async (mthd, endp, ...opt) => {
|
|
55
|
+
// When only options are provided
|
|
56
|
+
const actualOpt = normalizeOptions(opt);
|
|
54
57
|
/** @type {number[]=} */
|
|
55
58
|
let pathParams;
|
|
56
|
-
if (
|
|
57
|
-
pathParams = typeof
|
|
59
|
+
if (actualOpt.pathParams) {
|
|
60
|
+
pathParams = typeof actualOpt.pathParams === "number" ? [actualOpt.pathParams] : isArray(actualOpt.pathParams) ? actualOpt.pathParams : void 0;
|
|
58
61
|
}
|
|
59
62
|
if (isArray(pathParams)) {
|
|
60
63
|
endp = replaceCbt(endp, pathParams);
|
|
61
64
|
}
|
|
62
|
-
// When only options are provided
|
|
63
|
-
const actualOpt = opt || /** @type {NonNullable<typeof opt>} */ ({});
|
|
64
65
|
const { rqopt, qss } = initOptions(mthd, actualOpt);
|
|
65
66
|
const endpointUrl = curl(endp);
|
|
66
67
|
const up = new URLSearchParams(qss);
|
package/tagged-rq.mjs
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
// https://opensource.org/licenses/mit-license.php
|
|
6
6
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
7
7
|
*/
|
|
8
|
-
/// <reference types="./v2"/>
|
|
8
|
+
/// <reference types="./dist/v2"/>
|
|
9
9
|
/**
|
|
10
10
|
* @file tagged-rq.mts
|
|
11
11
|
* @command node tagged-rq.mjs -x -debug
|
|
12
12
|
*/
|
|
13
13
|
import { esi } from "./lib/tagged-request-api.mjs";
|
|
14
14
|
import * as util from "./lib/rq-util.mjs";
|
|
15
|
+
const ID_CCP_Zoetrope = 2112625428;
|
|
15
16
|
// Furthermore, the endpoint selected is narrowed down by "tags" and "method".
|
|
16
17
|
esi.alliance.get("/alliances/").then(aIds => {
|
|
17
18
|
console.log(`get:alliances, id size=${aIds.length}`);
|
|
@@ -19,7 +20,7 @@ esi.alliance.get("/alliances/").then(aIds => {
|
|
|
19
20
|
// esi.alliance.get(`/alliances/${aid}/`).then(console.log);
|
|
20
21
|
// }
|
|
21
22
|
});
|
|
22
|
-
esi.character.get("/characters/{character_id}/", { pathParams:
|
|
23
|
+
esi.character.get("/characters/{character_id}/", { pathParams: ID_CCP_Zoetrope }).then(console.log);
|
|
23
24
|
esi.universe.post("/universe/ids/", {
|
|
24
25
|
body: ["the forge", "plex"]
|
|
25
26
|
}).then(console.log);
|
|
@@ -27,18 +28,27 @@ esi.universe.post("/universe/names/", {
|
|
|
27
28
|
body: [44992, 434243723, 109299958, 10000002]
|
|
28
29
|
}).then(console.log);
|
|
29
30
|
esi.universe.get("/universe/structures/", { query: { filter: "market" } }).then(console.log);
|
|
31
|
+
esi.wars.get("/wars/", { query: { max_war_id: 20 } }).then(warIds => {
|
|
32
|
+
console.log(`get:alliances, id size=${warIds.length}`);
|
|
33
|
+
// for (const wid of warIds) {
|
|
34
|
+
// esi.wars.get(`/wars/${wid}/`).then(console.log);
|
|
35
|
+
// }
|
|
36
|
+
});
|
|
37
|
+
esi.character.post("/characters/affiliation/", {
|
|
38
|
+
body: [ID_CCP_Zoetrope]
|
|
39
|
+
}).then(console.log);
|
|
30
40
|
// node tagged-rq.mjs -x -debug -withError
|
|
31
41
|
if (util.is("withError")) {
|
|
32
|
-
esi.assets.get(
|
|
42
|
+
esi.assets.get(`/characters/${ID_CCP_Zoetrope}/assets/`, {
|
|
33
43
|
auth: true
|
|
34
44
|
}).then(console.log).catch(console.log);
|
|
35
|
-
esi.mail.post(
|
|
45
|
+
esi.mail.post(`/characters/${ID_CCP_Zoetrope}/mail/`, /** @satisfies {Pick<TESIResponsePostEntry<"/characters/{character_id}/mail/">, "auth" | "body">} */ ({
|
|
36
46
|
auth: true,
|
|
37
47
|
body: {
|
|
38
48
|
subject: "test!!",
|
|
39
49
|
body: "",
|
|
40
50
|
recipients: [{
|
|
41
|
-
recipient_id:
|
|
51
|
+
recipient_id: ID_CCP_Zoetrope, recipient_type: "character"
|
|
42
52
|
}]
|
|
43
53
|
},
|
|
44
54
|
// token: "s.s.s"
|
|
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
|