eve-esi-types 3.2.6 → 3.2.8

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.
@@ -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.5 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.2.8 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.5 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.2.8 of the EVE Online ESI response types.
13
13
  */
14
14
  import "./globals/alliance.d.ts";
15
15
  import "./globals/assets.d.ts";
@@ -9,15 +9,91 @@
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.5 of the EVE Online ESI response types.
12
+ * @summary This file is auto-generated and defines version 3.2.8 of the EVE Online ESI response types.
13
13
  */
14
14
  import type { TESIResponseOKMap } from "./response-map.d.ts";
15
+ import type { RestrictKeys, CombineIntersection } from "./index.d.ts";
16
+
17
+
18
+ /**
19
+ * Defines the keys used in ESI entries for request parameters.
20
+ * These keys represent the main categories of parameters that can be included in an ESI request.
21
+ */
22
+ export type ESIEntryParamKeys = "auth" | "query" | "body" | "pathParams";
23
+ /**
24
+ * Defines the keys that are not directly involved in ESI request parameters.
25
+ * These keys represent metadata or additional information that is not part of the main request parameters.
26
+ */
27
+ export type ESIEntryExtraKeys = "result" | "tag" | "cachedSeconds";
28
+
29
+ /**
30
+ * Resolves the parameters required for making an ESI request to a specific endpoint.
31
+ *
32
+ * This type combines the user-supplied options, path parameters, and the expected response type
33
+ * to produce a structured result that includes:
34
+ * - The actual response payload type (`result`).
35
+ * - The final options object (`finalOptions`) that should be passed to the request.
36
+ * - A flag (`optionIsRequire`) indicating whether the options object is mandatory.
37
+ *
38
+ * @template Mtd - The HTTP method (e.g., "get", "post") of the request.
39
+ * @template REP - The endpoint path, which can be parameterized or already resolved with numbers.
40
+ * @template EPO - The resolved endpoint type tied to `REP`.
41
+ * @template Opt - A record type representing user-supplied request options.
42
+ * @template PathParams - A record type representing path parameters for the endpoint.
43
+ * @template EntryWithParams - The merged type of the response payload and path parameters.
44
+ * @template RequireKeys - The keys from `EntryWithParams` that represent actual request parameters.
45
+ *
46
+ * @returns An object containing:
47
+ * - `result`: The actual response payload type.
48
+ * - `finalOptions`: The exact options object to pass in (e.g., pathParams, query, body, auth).
49
+ * - `optionIsRequire`: A flag (`1` or `0`) indicating whether the options object is required.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * // Example endpoint: /characters/{character_id}/attributes/
54
+ * type ExampleOpt = { auth: true; token: "eyJhbGciOiJSUzI1NiIsI..." };
55
+ * type ResolvedParams = ResolveEndpointParameters<
56
+ * "get", `/characters/${123345}/attributes/`, "/characters/{character_id}/attributes/",
57
+ * ExampleOpt
58
+ * >;
59
+ * // Result:
60
+ * // { auth: true, token: "eyJhbGciOiJSUzI1NiIsI..." }
61
+ * ```
62
+ *
63
+ * @see {@link CombineIntersection}
64
+ * @see {@link RestrictKeys}
65
+ * @see {@link _ESIResponseType}
66
+ */
67
+ export type ResolveEndpointParameters<
68
+ Mtd extends TESIEntryMethod,
69
+ // REP is either a parameterized path or already number-filled:
70
+ REP extends ReplacePathParams<ESIEndpointOf<Mtd>> | ESIEndpointOf<Mtd>,
71
+ // <— tie it directly to REP via ResolvedEndpoint:
72
+ EPO extends ResolvedEndpoint<Mtd, REP>,
73
+ // user-supplied options:
74
+ Opt extends Record<string, unknown>,
75
+
76
+ // now that EPO is fixed, these defaults all line up:
77
+ PathParams extends InferPathParams<REP, EPO> = InferPathParams<REP, EPO>,
78
+ EntryWithParams = _ESIResponseType<Mtd, EPO> & PathParams,
79
+ RequireKeys extends keyof EntryWithParams = Exclude<keyof EntryWithParams, ESIEntryExtraKeys>,
80
+ FinalOpt = CombineIntersection<
81
+ RestrictKeys<Opt, RequireKeys> & Pick<EntryWithParams, RequireKeys>
82
+ >
83
+ > = {
84
+ // the actual `"result"` payload type
85
+ result: EntryWithParams extends { result: infer R } ? R : never;
86
+ // the exact options object you should pass in (pathParams/query/body/auth)
87
+ finalOptions: FinalOpt;
88
+ // 1 if you _must_ pass an options object, else 0
89
+ optionIsRequire: HasRequireParams<Mtd, EPO, PathParams>;
90
+ };
15
91
 
16
92
 
17
93
  /**
18
94
  * Represents a function that can make ESI requests with various HTTP methods.
19
95
  *
20
- * @template ActualOpt - The actual type of the options.
96
+ * @template ActualOpt The actual type of the options.
21
97
  *
22
98
  * ```ts
23
99
  * // @ ts-expect-error
@@ -43,7 +119,7 @@ export interface IESIRequestFunction2<ActualOpt extends Record<string, unknown>>
43
119
  * + This interface is used when you already have implementation code such as
44
120
  * TESIRequestFunctionSignature2 and you want to implement additional shorthand methods.
45
121
  *
46
- * @template ActualOpt - The actual type of the options.
122
+ * @template ActualOpt The actual type of the options.
47
123
  *
48
124
  * @example
49
125
  * ```ts
@@ -104,8 +180,8 @@ export declare type TPathParamsNever = { /* pathParams?: never */ };
104
180
  * This type extracts the response type from the `TESIResponseOKMap` based on the provided
105
181
  * HTTP method and endpoint.
106
182
  *
107
- * @template M - The HTTP method to use for the request.
108
- * @template EPx - The endpoint path.
183
+ * @template M The HTTP method to use for the request.
184
+ * @template EPx The endpoint path.
109
185
  * include `string` in the `EPx` constraints to avoid breaking typescript inference.
110
186
  *
111
187
  * @example
@@ -124,7 +200,7 @@ export type _ESIResponseType<
124
200
  /**
125
201
  * Determines if the endpoint requires path parameters.
126
202
  *
127
- * @template EP - The string representing the endpoint path.
203
+ * @template EP The string representing the endpoint path.
128
204
  * @returns {TPathParamsNever | { pathParams: IfParameterizedPath<EP> }}
129
205
  * Returns an object with `pathParams` if the endpoint requires parameters, otherwise returns `TPathParamsNever`.
130
206
  * @example
@@ -136,20 +212,54 @@ export type _ESIResponseType<
136
212
  * @see {@link IfParameterizedPath}
137
213
  * @see {@link ReplacePathParams}
138
214
  */
215
+ //* ctt
139
216
  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
217
+ EP extends PropertyKey,
218
+ Parameterized extends IfParameterizedPath<EP> = IfParameterizedPath<EP>
219
+ > = Parameterized extends 0
144
220
  ? TPathParamsNever :
145
221
  EP extends ReplacePathParams<EP>
146
- ? TPathParamsNever : { pathParams: IfParameterizedPath<EP> };
222
+ ? TPathParamsNever : { pathParams: Parameterized };
223
+ /*/
224
+ export type _IfNeedPathParams<
225
+ EP extends PropertyKey,
226
+ Parameterized extends IfParameterizedPath<EP> = IfParameterizedPath<EP>
227
+ > = Parameterized extends 0
228
+ ? TPathParamsNever : { pathParams: Parameterized };
229
+ //*/
230
+
231
+ /**
232
+ * Picks the required parameters from an entry type, including additional parameters.
233
+ *
234
+ * This type excludes the keys "result", "tag", and "cachedSeconds" from the entry type and the additional parameters,
235
+ * and returns the remaining keys as the required parameters.
236
+ *
237
+ * @template M The HTTP method to use for the request.
238
+ * @template EPx The endpoint path.
239
+ * @template AdditionalParams Additional parameters to include in the check.
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
244
+ * type RequiredParams = PickRequireParams<"get", "/example/endpoint", { auth: string }, ExampleEntry>;
245
+ * // Result: "auth"
246
+ * ```
247
+ * @see {@link ESIEndpointOf}
248
+ * @see {@link _ESIResponseType}
249
+ * @deprecated 2025/4/28
250
+ * @see Documentation of [`PickRequireParams`](https://github.com/jeffy-g/eve-esi-types/blob/master/docs/v3/pick-require-params.md)
251
+ */
252
+ export type __PickRequireParams<
253
+ M extends TESIEntryMethod,
254
+ EPx extends ESIEndpointOf<M> | string,
255
+ AdditionalParams,
256
+ > = Exclude<keyof (_ESIResponseType<M, EPx> & AdditionalParams), ESIEntryExtraKeys>;
147
257
 
148
258
  /**
149
259
  * Infer the result type of an ESI response based on the method and endpoint.
150
260
  *
151
- * @template M - The HTTP method (e.g., "get", "post").
152
- * @template EP - The endpoint path.
261
+ * @template M The HTTP method (e.g., "get", "post").
262
+ * @template EP The endpoint path.
153
263
  * @deprecated 2025/3/17
154
264
  */
155
265
  export type __InferESIResponseResult<
@@ -159,13 +269,13 @@ export type __InferESIResponseResult<
159
269
  /**
160
270
  * Identifies the required parameters for a given entry type.
161
271
  *
162
- * @template Entry - The entry type to identify parameters for.
163
- * @template Opt - The type of the parameters.
272
+ * @template Entry The entry type to identify parameters for.
273
+ * @template Opt The type of the parameters.
164
274
  * @type {Opt & Pick<Entry, Exclude<keyof Entry, "result">>}
165
275
  * @deprecated 2025/3/17
166
276
  */
167
277
  export type __IdentifyParameters<
168
278
  Entry, Opt,
169
- Keys = Exclude<keyof Entry, "result" | "tag" | "cachedSeconds">
279
+ Keys = Exclude<keyof Entry, ESIEntryExtraKeys>
170
280
  // @ts-expect-error
171
281
  > = RequireThese<Opt, Keys> & Pick<Entry, Keys>;
package/dist/v2/util.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * @returns {string | never} The parameter name if the path is parameterized, otherwise `never`.
18
18
  */
19
19
  //* ctt
20
- export type PickPathParameters<Path extends string> =
20
+ export type PickPathParameters<Path extends PropertyKey> =
21
21
  Path extends `${string}/{${infer Param}}/${infer Rest}`
22
22
  ? Param | PickPathParameters<`/${Rest}`>
23
23
  : never;
@@ -28,6 +28,10 @@ export type PickPathParameters<Path extends string> =
28
28
  ? Param
29
29
  : never;
30
30
  //*/
31
+ export type PathParamsToMap<EP extends PropertyKey> =
32
+ EP extends `${infer _Start}{${infer Param}}${infer Rest}`
33
+ ? { [K in Param | keyof PathParamsToMap<Rest>]: string }
34
+ : {};
31
35
 
32
36
  /**
33
37
  * Convert a union type to an intersection type.
@@ -36,7 +40,6 @@ export type PickPathParameters<Path extends string> =
36
40
  * @returns {I} The intersection type.
37
41
  */
38
42
  export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
39
-
40
43
  /**
41
44
  * Convert a union type to a tuple.
42
45
  *
@@ -47,6 +50,56 @@ export type UnionToTuple<T> = UnionToIntersection<
47
50
  T extends any ? () => T : never
48
51
  > extends () => infer R ? [...UnionToTuple<Exclude<T, R>>, R] : [];
49
52
 
53
+ // - - - - - - - - - - - - - - - - - - - - - - - - - -
54
+ // Implemented: 2025/4/28
55
+ // - - - - - - - - - - - - - - - - - - - - - - - - - -
56
+ /**
57
+ * Extracts parameter keys from a parameterized path string as a tuple.
58
+ *
59
+ * This utility type takes a parameterized path string (e.g., `"/foo/{a}/bar/{b}/baz/"`)
60
+ * and extracts the parameter keys (e.g., `["a", "b"]`) as a tuple.
61
+ *
62
+ * @template Path - The parameterized path string.
63
+ * @returns {string[]} A tuple of parameter keys extracted from the path.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * type Params = ExtractPathParamKeys<"/foo/{a}/bar/{b}/baz/">;
68
+ * // Result: ["a", "b"]
69
+ * ```
70
+ */
71
+ export type ExtractPathParamKeys<
72
+ P extends PropertyKey
73
+ > = P extends `${infer _Before}{${infer Param}}${infer Rest}`
74
+ ? [Param, ...ExtractPathParamKeys<Rest>]
75
+ : [];
76
+
77
+ /**
78
+ * Extract parameter keys from either
79
+ * - a single parameterized path string, or
80
+ * - an array (or readonly array) of those strings,
81
+ * and return them as a union.
82
+ *
83
+ * @template Path
84
+ * Either a string template or an (readonly) array of string templates.
85
+ * @returns A union of all parameter names.
86
+ *
87
+ * @example
88
+ * type U1 = ExtractPathParamUnion<"/foo/{a}/bar/{b}/baz/">;
89
+ * // -> "a" | "b"
90
+ *
91
+ * type U2 = ExtractPathParamUnion<
92
+ * ["/foo/{a}/bar/{b}/baz/", "/users/{user_id}/posts/{post_id}"]
93
+ * >;
94
+ * // -> "a" | "b" | "user_id" | "post_id"
95
+ */
96
+ export type ExtractPathParamUnion<Path extends string | readonly string[]> =
97
+ Path extends readonly any[]
98
+ ? ExtractPathParamKeys<Path[number]>[number]
99
+ : Path extends string
100
+ ? ExtractPathParamKeys<Path>[number] : never;
101
+
102
+
50
103
  /**
51
104
  * #### Build an array of elements from a flattened tuple of type "1" | "2" | "3" ...
52
105
  *
@@ -59,7 +112,6 @@ export type UnionToTuple<T> = UnionToIntersection<
59
112
  * @date 2025/2/11 18:12:02
60
113
  */
61
114
  export type InferKeysLen<T> = UnionToTuple<T>["length"];
62
-
63
115
  /**
64
116
  * Splits a string by a delimiter and returns a tuple of the resulting substrings.
65
117
  * @example
@@ -79,6 +131,16 @@ export type Split<S extends string, D extends string = ":"> =
79
131
  // type Test3 = Split<"hello", ",">;
80
132
  // // Expected: ['hello']
81
133
 
134
+ /**
135
+ * Combines an intersection of object types into a single object type.
136
+ *
137
+ * @template IS The intersection of object types to combine.
138
+ * @returns {Record<string, unknown>} A single object type with all properties from the intersection.
139
+ *
140
+ * @example
141
+ * type Combined = CombineIntersection<{ a: string } & { b: number }>;
142
+ * // Result: { a: string; b: number }
143
+ */
82
144
  //* ctt
83
145
  // export type CombineIntersection<IS> = IS extends infer O ? { [K in keyof O]: O[K] } : never;
84
146
  export type CombineIntersection<IS extends Record<string, unknown>> = { [K in keyof IS]: IS[K] };
@@ -83,7 +83,7 @@ export function getLogger(banner, logSelector = ".log-frame") {
83
83
  return console.log.bind(console, banner);
84
84
  }
85
85
  else {
86
- /** @type {function(...any): void} */
86
+ /** @type {(...data: any[]) => void} */
87
87
  const log = (...data) => {
88
88
  let text = banner;
89
89
  for (const d of data) {
@@ -37,16 +37,12 @@ const DEBUG = util.isDebug();
37
37
  */
38
38
  export const request2 = /** @type {IESIRequestFunction2} */ (async (method, endpoint, opt) => {
39
39
  // When only options are provided
40
- const actualOpt = /** @type {NonNullable<typeof opt> & util.ESIRequestOptions} */ (opt || {});
41
- /** @type {number[]=} */
42
- let pathParams;
43
- if (typeof actualOpt.pathParams === "number" || Array.isArray(actualOpt.pathParams)) {
44
- pathParams = /** @type {number[]} */ (Array.isArray(actualOpt.pathParams) ? actualOpt.pathParams : [actualOpt.pathParams]);
45
- }
46
- if (Array.isArray(pathParams)) {
40
+ const nOpt = util.normalizeOptions([opt]);
41
+ if (util.hasPathParams(nOpt)) {
42
+ const pathParams = Array.isArray(nOpt.pathParams) ? nOpt.pathParams : [nOpt.pathParams];
47
43
  endpoint = util.replaceCbt(endpoint, pathParams);
48
44
  }
49
- const { rqopt, qss } = util.initOptions(method, actualOpt);
45
+ const { rqopt, qss } = util.initOptions(method, nOpt);
50
46
  const endpointUrl = util.curl(endpoint);
51
47
  const up = new URLSearchParams(qss);
52
48
  const url = `${endpointUrl}${up.size ? `?${up}` : ""}`;
@@ -59,7 +55,7 @@ export const request2 = /** @type {IESIRequestFunction2} */ (async (method, endp
59
55
  }
60
56
  // else if (isError(status)) {}
61
57
  // Actually, throw Error
62
- throw await util.handleESIError(res, endpointUrl, actualOpt.cancelable);
58
+ throw await util.handleESIError(res, endpointUrl, nOpt.cancelable);
63
59
  }
64
60
  catch (e) {
65
61
  log(e);
@@ -69,8 +65,9 @@ export const request2 = /** @type {IESIRequestFunction2} */ (async (method, endp
69
65
  // implements rest methods of `request` (IESIRequestFunction2)
70
66
  //
71
67
  /** @type {TESIEntryMethod[]} */ (["get", "post", "put", "delete"]).forEach((method) => {
72
- request2[method] = /** @type {TESIRequestFunctionEachMethod2<typeof method, util.ESIRequestOptions>} */ ((endpoint, opt) => {
73
- // @ts-expect- error TODO: ts(2345)
74
- return request2(method, endpoint, /** @type {Parameters<typeof request2>[2]} */ (opt));
68
+ request2[method] = /** @type {TESIRequestFunctionEachMethod2<typeof method, util.ESIRequestOptions>} */ ((endpoint, ...opt) => {
69
+ // @ts-expect-error TODO: ts(2345)
70
+ return request2(method, endpoint, ...opt);
71
+ // return request2(method, endpoint, /** @type {Parameters<typeof request2>[2]} */(opt) as Parameters<typeof request2>[2]);
75
72
  });
76
73
  });
package/lib/rq-util.d.mts CHANGED
@@ -27,7 +27,7 @@ export type Truthy = string | number | boolean;
27
27
  /**
28
28
  * __{Header}.{Payload}.{Signature}__
29
29
  */
30
- export type TAcccessToken = `${string}.${string}.${string}`;
30
+ export type TAccessToken = `${string}.${string}.${string}`;
31
31
  export type ESIRequestOptions = {
32
32
  /**
33
33
  * query params for ESI request.
@@ -53,14 +53,45 @@ export type ESIRequestOptions = {
53
53
  /**
54
54
  * Can be an empty object if no authentication is required.description
55
55
  */
56
- token?: TAcccessToken;
56
+ token?: TAccessToken;
57
57
  /**
58
58
  * cancel request immediately
59
59
  */
60
60
  cancelable?: AbortController;
61
61
  };
62
62
  /**
63
- * @typedef {string | number | boolean} Truthy
63
+ * type of the JWT token `payload` section
64
+ */
65
+ export declare type TJWTPayload = {
66
+ /** scopes. */
67
+ scp: string[];
68
+ /** uuid of the token */
69
+ jti: string;
70
+ /** jwt type */
71
+ kid: string;
72
+ /** contains EVE character ID.
73
+ * ```
74
+ * "CHARACTER:EVE:<character_id>"
75
+ * ```
76
+ */
77
+ sub: `CHARACTER:EVE:${number}`;
78
+ /** Application client ID. */
79
+ azp: string;
80
+ /** EVE character name. */
81
+ name: string;
82
+ /** owner hash. */
83
+ owner: string;
84
+ /** expire date as 1/1000. (UNIX timestamp) */
85
+ exp: number;
86
+ /** issuer host name. */
87
+ iss: string;
88
+ };
89
+ /**
90
+ * @import * as ESIUtil from "./rq-util.mjs";
91
+ * @typedef {ESIUtil.Truthy} Truthy
92
+ * @typedef {ESIUtil.TAccessToken} TAccessToken
93
+ * @typedef {ESIUtil.TJWTPayload} TJWTPayload
94
+ * @typedef {ESIUtil.ESIRequestOptions} ESIRequestOptions
64
95
  */
65
96
  /**
66
97
  * simple named error class.
@@ -74,15 +105,13 @@ export declare class ESIErrorLimitReachedError extends ESIRequestError {
74
105
  constructor();
75
106
  valueOf(): number;
76
107
  }
77
- /**
78
- * @typedef {import("./rq-util.mjs").ESIRequestOptions} ESIRequestOptions
79
- */
80
108
  /**
81
109
  * @template T
110
+ * @template {Record<string, unknown>} O
82
111
  * @param {[T] | [(T | undefined)?]} opt
83
- * @returns {NonNullable<T>}
112
+ * @returns {NonNullable<T> & O}
84
113
  */
85
- export declare const normalizeOptions: <T extends unknown>(opt: [T] | [(T | undefined)?]) => NonNullable<T>;
114
+ export declare const normalizeOptions: <T extends unknown, O extends Record<string, unknown> = ESIRequestOptions>(opt: [T] | [(T | undefined)?]) => (NonNullable<T> & O);
86
115
  /**
87
116
  * #### status: 200 | 201 | 204
88
117
  *
@@ -92,10 +121,11 @@ export declare const normalizeOptions: <T extends unknown>(opt: [T] | [(T | unde
92
121
  * @param {string} endpointUrl
93
122
  * @param {RequestInit} requestOpt
94
123
  * @param {URLSearchParams} urlParams
95
- * @param {(minus?: Truthy) => void=} increment
124
+ * @param {(minus?: Truthy) => void=} progress
125
+ * @param {true=} allowFetchPages 2025/4/26
96
126
  * @returns {Promise<any>}
97
127
  */
98
- export declare const handleSuccessResponse: (response: Response, endpointUrl: string, requestOpt: RequestInit, urlParams: URLSearchParams, increment?: (minus?: Truthy) => void) => Promise<any>;
128
+ export declare const handleSuccessResponse: (response: Response, endpointUrl: string, requestOpt: RequestInit, urlParams: URLSearchParams, progress?: (minus?: Truthy) => void, allowFetchPages?: true) => Promise<any>;
99
129
  /**
100
130
  * @import {
101
131
  * TESIErrorStats,
@@ -152,11 +182,13 @@ export declare const initOptions: (method: string, opt: ESIRequestOptions) => {
152
182
  * @param {RequestInit} rqopt request options
153
183
  * @param {URLSearchParams} usp queries
154
184
  * @param {number} pc pageCount
155
- * @param {(minus?: number) => void=} increment
185
+ * @param {(minus?: number) => void=} progress
156
186
  * @returns {Promise<T | null>}
157
187
  */
158
- export declare const fetchP: <T extends unknown>(endpointUrl: string, rqopt: RequestInit, usp: URLSearchParams, pc: number, increment?: (minus?: Truthy) => void) => Promise<T | null>;
188
+ export declare const fetchP: <T extends unknown>(endpointUrl: string, rqopt: RequestInit, usp: URLSearchParams, pc: number, progress?: (minus?: Truthy) => void) => Promise<T | null>;
159
189
  /** ### replace (C)urly (B)races (T)oken
190
+ *
191
+ * + Replace each `{…}` placeholder in the endpoint string with the corresponding ID.
160
192
  *
161
193
  * @example
162
194
  * "/characters/{character_id}/skills"
@@ -164,18 +196,39 @@ export declare const fetchP: <T extends unknown>(endpointUrl: string, rqopt: Req
164
196
  * "/characters/<char.character_id>/skills"
165
197
  *
166
198
  * @template {unknown} T
167
- * @param {T} endpoint e.g - "/characters/{character_id}/"
168
- * @param {number[]} ids
169
- * @returns {T} fragment of qualified endpoint uri or null.
199
+ * @param {T} endpoint An endpoint template, e.g. "/characters/{character_id}/skills"
200
+ * @param {number[]} ids An array of numbers to fill into each placeholder, in order of appearance
201
+ * @returns {T} A fully-qualified endpoint string with all `{…}` tokens replaced by their IDs
170
202
  */
171
203
  export declare const replaceCbt: <T extends unknown>(endpoint: T, ids: number[]) => T;
172
204
  /**
173
205
  * @template {unknown} T
174
- * @param {T} endp this means endpoint url fragment like `/characters/{character_id}/` or `/characters/{character_id}/agents_research/`
206
+ * @param {T} endpoint this means endpoint url fragment like `/characters/{character_id}/` or `/characters/{character_id}/agents_research/`
175
207
  * + The version parameter is forced to apply `latest`
176
208
  * @returns {string}
177
209
  */
178
- export declare const curl: <T extends unknown>(endp: T) => string;
210
+ export declare const curl: <T extends unknown>(endpoint: T) => string;
211
+ /**
212
+ * Type guard that checks whether the given object has a `pathParams` property
213
+ * of type `number` or `number[]`.
214
+ *
215
+ * @template {Record<string, unknown>} T - The type of the object being checked.
216
+ * @param {T} opt - The object to inspect.
217
+ * @returns {opt is (T & { pathParams: number | number[] })}
218
+ * `true` if `opt` contains a `pathParams` property whose value is either
219
+ * a single number or an array of numbers, otherwise `false`.
220
+ *
221
+ * @date 2025/4/28
222
+ */
223
+ export declare function hasPathParams<T extends Record<string, unknown>>(opt: T): opt is (T & {
224
+ pathParams: number | number[];
225
+ });
226
+ /**
227
+ *
228
+ * @param {string} accessToken OAuth 2.0 access token
229
+ * @returns {TJWTPayload}
230
+ */
231
+ export declare const getJWTPayload: (accessToken: string) => TJWTPayload;
179
232
  /**
180
233
  * @date 2020/03/31
181
234
  * @version 2.1
@@ -194,6 +247,8 @@ type TPrependParams = TESIRequestFunctionSignature2<ESIRequestOptions> | TESIReq
194
247
  /**
195
248
  * #### Fire a request that does not require authentication.
196
249
  *
250
+ * + __CAVEAT:__ This function should only be used for testing.
251
+ *
197
252
  * @param {TPrependParams} fn
198
253
  * @returns {Promise<void>}
199
254
  */