eve-esi-types 2.3.3 → 2.3.5
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/lib/console-util.d.mts +15 -0
- package/lib/console-util.mjs +102 -0
- package/lib/constants.d.mts +10 -0
- package/lib/constants.mjs +23 -0
- package/lib/esi-error-types.d.ts +13 -2
- package/lib/request-api.d.mts +1 -1
- package/lib/request-api.mjs +5 -7
- package/lib/rq-util.d.mts +18 -18
- package/lib/rq-util.mjs +33 -54
- package/lib/tagged-request-api.d.mts +4 -3
- package/lib/tagged-request-api.mjs +18 -7
- package/minimal-rq.mjs +16 -8
- package/package.json +2 -2
- package/v2/esi-tagged-types.d.ts +8 -8
- package/v2/index.d.ts +30 -2
- package/v2/response-map.d.ts +138 -18
- package/v2/types-index.d.ts +1 -1
- package/web/index.css +101 -0
- package/web/index.html +57 -0
- package/index.html +0 -18
package/minimal-rq.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { request } from "./lib/request-api.mjs";
|
|
|
15
15
|
// constants, types
|
|
16
16
|
// - - - - - - - - - - - - - - - - - - - -
|
|
17
17
|
// shorthands
|
|
18
|
-
const log =
|
|
18
|
+
const log = util.getUniversalLogger("[request-mini]: ");
|
|
19
19
|
/**
|
|
20
20
|
* @typedef {import("./v2").IESIRequestFunction<util.ESIRequestOptions>} IESIRequestFunction
|
|
21
21
|
* @typedef {import("./v2").TESIRequestFunctionMethods<util.ESIRequestOptions>} TESIRequestFunctionMethods
|
|
@@ -44,17 +44,18 @@ async function getEVEStatus(fn) {
|
|
|
44
44
|
}
|
|
45
45
|
const { clog, rlog } = util.getLogger();
|
|
46
46
|
CaseIESIRequestFunction: {
|
|
47
|
+
const ID_CCP_Zoetrope = 2112625428;
|
|
47
48
|
// - - - - - - - - - - - -
|
|
48
49
|
// Character
|
|
49
50
|
// - - - - - - - - - - - -
|
|
50
51
|
// Here, I borrow data from "CCP Zoetrope".
|
|
51
52
|
rlog("- - - - - - - > run as IESIRequestFunction<ESIRequestOptions>".red);
|
|
52
53
|
clog();
|
|
53
|
-
await fn.get("/characters/{character_id}/",
|
|
54
|
+
await fn.get("/characters/{character_id}/", ID_CCP_Zoetrope).then(log);
|
|
54
55
|
clog('(portrait)');
|
|
55
|
-
await fn.get("/characters/{character_id}/portrait/",
|
|
56
|
+
await fn.get("/characters/{character_id}/portrait/", ID_CCP_Zoetrope).then(log);
|
|
56
57
|
clog('(affiliation)');
|
|
57
|
-
const affiliation = await fn.post("/characters/affiliation/", { body: [
|
|
58
|
+
const affiliation = await fn.post("/characters/affiliation/", { body: [ID_CCP_Zoetrope] });
|
|
58
59
|
log(affiliation);
|
|
59
60
|
clog('(corporation)');
|
|
60
61
|
await fn.get("/corporations/{corporation_id}/", affiliation[0].corporation_id).then(log);
|
|
@@ -78,16 +79,23 @@ async function getEVEStatus(fn) {
|
|
|
78
79
|
}
|
|
79
80
|
return fn.get("/status/");
|
|
80
81
|
}
|
|
82
|
+
const runTest = () => {
|
|
83
|
+
getEVEStatus(request).then(eveStatus => log(eveStatus));
|
|
84
|
+
};
|
|
81
85
|
// type following and run
|
|
82
86
|
// node minimal-rq.mjs -debug
|
|
83
87
|
if (!util.is("x")) {
|
|
84
|
-
|
|
88
|
+
runTest();
|
|
85
89
|
}
|
|
86
90
|
else {
|
|
87
91
|
// @ts-ignore
|
|
88
|
-
globalThis.runTest =
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
globalThis.runTest = runTest;
|
|
93
|
+
if (!util.isNode) {
|
|
94
|
+
const button = document.getElementById("run-test");
|
|
95
|
+
if (button) {
|
|
96
|
+
button.addEventListener("click", () => runTest());
|
|
97
|
+
}
|
|
98
|
+
}
|
|
91
99
|
}
|
|
92
100
|
// {
|
|
93
101
|
// "players": 16503,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve-esi-types",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Extracted the main type of ESI. use for ESI request response types (version 2 only)",
|
|
5
5
|
"main": "v2/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"v2",
|
|
16
16
|
"lib",
|
|
17
|
+
"web",
|
|
17
18
|
"*.d.mts",
|
|
18
|
-
"index.html",
|
|
19
19
|
"*.mjs",
|
|
20
20
|
"LICENSE",
|
|
21
21
|
"*.md",
|
package/v2/esi-tagged-types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/esi-tagged-types.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 2.3.
|
|
12
|
+
* @summary This file is auto-generated and defines version 2.3.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
import { TESIResponseOKMap } from "./index.d.ts";
|
|
15
15
|
export * from "./index.d.ts";
|
|
@@ -30,13 +30,13 @@ export declare type LCamelCase<S extends string> = S extends `${infer P1} ${infe
|
|
|
30
30
|
? `${Lowercase<P1>}${Capitalize<P2>}` : Lowercase<S>;
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
declare
|
|
34
|
-
METHOD
|
|
35
|
-
TAGs
|
|
36
|
-
}
|
|
37
|
-
declare type InferSomethingBy<Tag, AsType extends EInferSomethingBy = EInferSomethingBy
|
|
33
|
+
declare type EInferSomethingBy = {
|
|
34
|
+
readonly METHOD: 0;
|
|
35
|
+
readonly TAGs: 1;
|
|
36
|
+
};
|
|
37
|
+
declare type InferSomethingBy<Tag, AsType extends EInferSomethingBy = EInferSomethingBy["METHOD"]> = {
|
|
38
38
|
[M in TESIEntryMethod]: TESIResponseOKMap[M] extends Record<`/${string}/`, { tag: infer ActualTag }>
|
|
39
|
-
? AsType extends EInferSomethingBy
|
|
39
|
+
? AsType extends EInferSomethingBy["TAGs"]
|
|
40
40
|
? ActualTag : ActualTag extends Tag
|
|
41
41
|
? M
|
|
42
42
|
: never
|
|
@@ -50,7 +50,7 @@ declare type InferSomethingBy<Tag, AsType extends EInferSomethingBy = EInferSome
|
|
|
50
50
|
* @template M - The HTTP method.
|
|
51
51
|
* @date 2025/2/28
|
|
52
52
|
*/
|
|
53
|
-
export declare type ESITags = InferSomethingBy<never, EInferSomethingBy
|
|
53
|
+
export declare type ESITags = InferSomethingBy<never, EInferSomethingBy["TAGs"]>
|
|
54
54
|
|
|
55
55
|
// - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
56
56
|
// Utility Type `InferMethod`
|
package/v2/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* THIS DTS IS AUTO GENERATED, DO NOT EDIT
|
|
10
10
|
*
|
|
11
11
|
* @file eve-esi-types/v2/index.d.ts
|
|
12
|
-
* @summary This file is auto-generated and defines version 2.3.
|
|
12
|
+
* @summary This file is auto-generated and defines version 2.3.5 of the EVE Online ESI response types.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { TESIResponseOKMap } from "./response-map.d.ts";
|
|
@@ -68,6 +68,34 @@ export type TESIRequestFunctionMethods<ActualOpt = {}> = {
|
|
|
68
68
|
[method in TESIEntryMethod]: TESIRequestFunctionEachMethod<method, ActualOpt>;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* List of "x-cached-seconds"
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* // const cacheSecGet: 3600 | 300 | 604800 | 120 | 5 | 600 | 86400 | 60 | 30 | 1200 | 1800 | 30758400
|
|
76
|
+
* const cacheSecGet: TESICachedSeconds<"get">;
|
|
77
|
+
* // const cache5sec: 5
|
|
78
|
+
* const cache5s: TESICachedSeconds<"put">;
|
|
79
|
+
* // const cache3600s: 3600
|
|
80
|
+
* const cache3600s: TESICachedSeconds<"post">;
|
|
81
|
+
* // "/characters/affiliation/"
|
|
82
|
+
* const cache3600sEndpoint: TESICachedSeconds<"post", 1>;
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare type TESICachedSeconds<
|
|
86
|
+
Method extends TESIEntryMethod, AsEndpoint = void
|
|
87
|
+
> = {
|
|
88
|
+
[M in TESIEntryMethod]: {
|
|
89
|
+
[EP in keyof TESIResponseOKMap[M]]: TESIResponseOKMap[M][EP]["cachedSeconds"] extends number
|
|
90
|
+
? AsEndpoint extends void
|
|
91
|
+
? TESIResponseOKMap[M][EP]["cachedSeconds"]: EP
|
|
92
|
+
: never
|
|
93
|
+
}[keyof TESIResponseOKMap[M]];
|
|
94
|
+
}[Method];
|
|
95
|
+
// const cacheSecGet: TESICachedSeconds<"get">;
|
|
96
|
+
// const cache5sec: TESICachedSeconds<"put">;
|
|
97
|
+
// const cache3600sEndpoint: TESICachedSeconds<"post", 1>;
|
|
98
|
+
|
|
71
99
|
declare global {
|
|
72
100
|
|
|
73
101
|
/**
|
|
@@ -143,7 +171,7 @@ declare global {
|
|
|
143
171
|
//* ctt
|
|
144
172
|
type IdentifyParameters<
|
|
145
173
|
Entry, Opt,
|
|
146
|
-
Keys = Exclude<keyof Entry, "result" | "tag">
|
|
174
|
+
Keys = Exclude<keyof Entry, "result" | "tag" | "cachedSeconds">
|
|
147
175
|
> = RequireThese<Opt, Keys> & Pick<Entry, Keys>;
|
|
148
176
|
/*/
|
|
149
177
|
type IdentifyParameters<
|