eve-esi-types 3.1.6 → 3.2.0

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.
Files changed (227) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/jsconfig.json +28 -0
  3. package/lib/rq-util.mjs +1 -1
  4. package/lib/tagged-request-api.mjs +5 -6
  5. package/package.json +14 -8
  6. package/v2/esi-tagged-types.d.ts +9 -5
  7. package/v2/{get_alliances_alliance_id_ok.d.ts → globals/alliance.d.ts} +44 -0
  8. package/v2/globals/assets.d.ts +443 -0
  9. package/v2/globals/calendar.d.ts +130 -0
  10. package/v2/globals/character.d.ts +1084 -0
  11. package/v2/{get_characters_character_id_clones_ok.d.ts → globals/clones.d.ts} +15 -0
  12. package/v2/globals/contacts.d.ts +212 -0
  13. package/v2/globals/contracts.d.ts +546 -0
  14. package/v2/globals/corporation.d.ts +2329 -0
  15. package/v2/globals/dogma.d.ts +262 -0
  16. package/v2/globals/factionwarfare.d.ts +668 -0
  17. package/v2/{get_characters_character_id_fittings_ok.d.ts → globals/fittings.d.ts} +23 -0
  18. package/v2/globals/fleets.d.ts +201 -0
  19. package/v2/{get_incursions_ok.d.ts → globals/incursions.d.ts} +5 -0
  20. package/v2/globals/industry.d.ts +445 -0
  21. package/v2/globals/insurance.d.ts +47 -0
  22. package/v2/{get_killmails_killmail_id_killmail_hash_ok.d.ts → globals/killmails.d.ts} +55 -0
  23. package/v2/globals/location.d.ts +74 -0
  24. package/v2/{get_loyalty_stores_corporation_id_offers_ok.d.ts → globals/loyalty.d.ts} +30 -0
  25. package/v2/globals/mail.d.ts +237 -0
  26. package/v2/globals/market.d.ts +615 -0
  27. package/v2/globals/planetaryinteraction.d.ts +344 -0
  28. package/v2/globals/routes.d.ts +14 -0
  29. package/v2/{get_characters_character_id_search_ok.d.ts → globals/search.d.ts} +5 -0
  30. package/v2/globals/skills.d.ts +144 -0
  31. package/v2/globals/sovereignty.d.ts +168 -0
  32. package/v2/{get_status_ok.d.ts → globals/status.d.ts} +5 -0
  33. package/v2/globals/universe.d.ts +1297 -0
  34. package/v2/globals/wallet.d.ts +601 -0
  35. package/v2/{get_wars_war_id_ok.d.ts → globals/wars.d.ts} +40 -0
  36. package/v2/index.d.ts +38 -163
  37. package/v2/response-map.d.ts +22 -45
  38. package/v2/types-index.d.ts +31 -182
  39. package/v2/types-util.d.ts +335 -0
  40. package/v2/util.d.ts +4 -2
  41. package/web/index.html +1 -1
  42. package/docs/esi-tagged-types.md +0 -120
  43. package/docs/v2/identify-parameters.md +0 -74
  44. package/docs/v2/if-parameterized-path.md +0 -70
  45. package/docs/v2/infer-esi-response-result.md +0 -44
  46. package/docs/v2/require-these.md +0 -57
  47. package/docs/v3/esi-enhanced-function-signature.md +0 -67
  48. package/docs/v3/esi-types-util3.md +0 -319
  49. package/docs/v3/has-require-params.md +0 -50
  50. package/docs/v3/infer-endpoint-origin.md +0 -57
  51. package/docs/v3/infer-path-params.md +0 -41
  52. package/docs/v3/pick-require-params.md +0 -56
  53. package/docs/v3/replace-path-params.md +0 -60
  54. package/docs/v3/resolved-endpoint.md +0 -44
  55. package/tsconfig.json +0 -28
  56. package/v2/get_alliances_alliance_id_contacts_labels_ok.d.ts +0 -24
  57. package/v2/get_alliances_alliance_id_contacts_ok.d.ts +0 -35
  58. package/v2/get_alliances_alliance_id_corporations_ok.d.ts +0 -9
  59. package/v2/get_alliances_alliance_id_icons_ok.d.ts +0 -18
  60. package/v2/get_alliances_ok.d.ts +0 -9
  61. package/v2/get_characters_character_id_agents_research_ok.d.ts +0 -33
  62. package/v2/get_characters_character_id_assets_ok.d.ts +0 -134
  63. package/v2/get_characters_character_id_attributes_ok.d.ts +0 -42
  64. package/v2/get_characters_character_id_blueprints_ok.d.ts +0 -122
  65. package/v2/get_characters_character_id_calendar_event_id_attendees_ok.d.ts +0 -30
  66. package/v2/get_characters_character_id_calendar_event_id_ok.d.ts +0 -56
  67. package/v2/get_characters_character_id_calendar_ok.d.ts +0 -37
  68. package/v2/get_characters_character_id_contacts_labels_ok.d.ts +0 -24
  69. package/v2/get_characters_character_id_contacts_ok.d.ts +0 -43
  70. package/v2/get_characters_character_id_contracts_contract_id_bids_ok.d.ts +0 -32
  71. package/v2/get_characters_character_id_contracts_contract_id_items_ok.d.ts +0 -38
  72. package/v2/get_characters_character_id_contracts_ok.d.ts +0 -117
  73. package/v2/get_characters_character_id_corporationhistory_ok.d.ts +0 -32
  74. package/v2/get_characters_character_id_fatigue_ok.d.ts +0 -22
  75. package/v2/get_characters_character_id_fleet_ok.d.ts +0 -31
  76. package/v2/get_characters_character_id_fw_stats_ok.d.ts +0 -64
  77. package/v2/get_characters_character_id_implants_ok.d.ts +0 -9
  78. package/v2/get_characters_character_id_industry_jobs_ok.d.ts +0 -105
  79. package/v2/get_characters_character_id_killmails_recent_ok.d.ts +0 -24
  80. package/v2/get_characters_character_id_location_ok.d.ts +0 -22
  81. package/v2/get_characters_character_id_loyalty_points_ok.d.ts +0 -24
  82. package/v2/get_characters_character_id_mail_labels_ok.d.ts +0 -62
  83. package/v2/get_characters_character_id_mail_lists_ok.d.ts +0 -24
  84. package/v2/get_characters_character_id_mail_mail_id_ok.d.ts +0 -59
  85. package/v2/get_characters_character_id_mail_ok.d.ts +0 -65
  86. package/v2/get_characters_character_id_medals_ok.d.ts +0 -135
  87. package/v2/get_characters_character_id_mining_ok.d.ts +0 -29
  88. package/v2/get_characters_character_id_notifications_contacts_ok.d.ts +0 -36
  89. package/v2/get_characters_character_id_notifications_ok.d.ts +0 -291
  90. package/v2/get_characters_character_id_ok.d.ts +0 -55
  91. package/v2/get_characters_character_id_online_ok.d.ts +0 -26
  92. package/v2/get_characters_character_id_opportunities_ok.d.ts +0 -24
  93. package/v2/get_characters_character_id_orders_history_ok.d.ts +0 -87
  94. package/v2/get_characters_character_id_orders_ok.d.ts +0 -82
  95. package/v2/get_characters_character_id_planets_ok.d.ts +0 -124
  96. package/v2/get_characters_character_id_planets_planet_id_ok.d.ts +0 -283
  97. package/v2/get_characters_character_id_portrait_ok.d.ts +0 -26
  98. package/v2/get_characters_character_id_roles_ok.d.ts +0 -270
  99. package/v2/get_characters_character_id_ship_ok.d.ts +0 -19
  100. package/v2/get_characters_character_id_skillqueue_ok.d.ts +0 -48
  101. package/v2/get_characters_character_id_skills_ok.d.ts +0 -47
  102. package/v2/get_characters_character_id_standings_ok.d.ts +0 -29
  103. package/v2/get_characters_character_id_titles_ok.d.ts +0 -184
  104. package/v2/get_characters_character_id_wallet_journal_ok.d.ts +0 -228
  105. package/v2/get_characters_character_id_wallet_ok.d.ts +0 -7
  106. package/v2/get_characters_character_id_wallet_transactions_ok.d.ts +0 -53
  107. package/v2/get_contracts_public_bids_contract_id_ok.d.ts +0 -28
  108. package/v2/get_contracts_public_items_contract_id_ok.d.ts +0 -49
  109. package/v2/get_contracts_public_region_id_ok.d.ts +0 -81
  110. package/v2/get_corporation_corporation_id_mining_extractions_ok.d.ts +0 -39
  111. package/v2/get_corporation_corporation_id_mining_observers_observer_id_ok.d.ts +0 -36
  112. package/v2/get_corporation_corporation_id_mining_observers_ok.d.ts +0 -30
  113. package/v2/get_corporations_corporation_id_alliancehistory_ok.d.ts +0 -32
  114. package/v2/get_corporations_corporation_id_assets_ok.d.ts +0 -170
  115. package/v2/get_corporations_corporation_id_blueprints_ok.d.ts +0 -163
  116. package/v2/get_corporations_corporation_id_contacts_labels_ok.d.ts +0 -24
  117. package/v2/get_corporations_corporation_id_contacts_ok.d.ts +0 -39
  118. package/v2/get_corporations_corporation_id_containers_logs_ok.d.ts +0 -188
  119. package/v2/get_corporations_corporation_id_contracts_contract_id_bids_ok.d.ts +0 -33
  120. package/v2/get_corporations_corporation_id_contracts_contract_id_items_ok.d.ts +0 -38
  121. package/v2/get_corporations_corporation_id_contracts_ok.d.ts +0 -117
  122. package/v2/get_corporations_corporation_id_customs_offices_ok.d.ts +0 -78
  123. package/v2/get_corporations_corporation_id_divisions_ok.d.ts +0 -128
  124. package/v2/get_corporations_corporation_id_facilities_ok.d.ts +0 -25
  125. package/v2/get_corporations_corporation_id_fw_stats_ok.d.ts +0 -60
  126. package/v2/get_corporations_corporation_id_icons_ok.d.ts +0 -22
  127. package/v2/get_corporations_corporation_id_industry_jobs_ok.d.ts +0 -105
  128. package/v2/get_corporations_corporation_id_killmails_recent_ok.d.ts +0 -24
  129. package/v2/get_corporations_corporation_id_medals_issued_ok.d.ts +0 -41
  130. package/v2/get_corporations_corporation_id_medals_ok.d.ts +0 -36
  131. package/v2/get_corporations_corporation_id_members_limit_ok.d.ts +0 -7
  132. package/v2/get_corporations_corporation_id_members_ok.d.ts +0 -9
  133. package/v2/get_corporations_corporation_id_members_titles_ok.d.ts +0 -194
  134. package/v2/get_corporations_corporation_id_membertracking_ok.d.ts +0 -41
  135. package/v2/get_corporations_corporation_id_ok.d.ts +0 -66
  136. package/v2/get_corporations_corporation_id_orders_history_ok.d.ts +0 -91
  137. package/v2/get_corporations_corporation_id_orders_ok.d.ts +0 -86
  138. package/v2/get_corporations_corporation_id_roles_history_ok.d.ts +0 -171
  139. package/v2/get_corporations_corporation_id_roles_ok.d.ts +0 -543
  140. package/v2/get_corporations_corporation_id_shareholders_ok.d.ts +0 -29
  141. package/v2/get_corporations_corporation_id_standings_ok.d.ts +0 -29
  142. package/v2/get_corporations_corporation_id_starbases_ok.d.ts +0 -51
  143. package/v2/get_corporations_corporation_id_starbases_starbase_id_ok.d.ts +0 -110
  144. package/v2/get_corporations_corporation_id_structures_ok.d.ts +0 -176
  145. package/v2/get_corporations_corporation_id_titles_ok.d.ts +0 -548
  146. package/v2/get_corporations_corporation_id_wallets_division_journal_ok.d.ts +0 -229
  147. package/v2/get_corporations_corporation_id_wallets_division_transactions_ok.d.ts +0 -50
  148. package/v2/get_corporations_corporation_id_wallets_ok.d.ts +0 -62
  149. package/v2/get_corporations_npccorps_ok.d.ts +0 -9
  150. package/v2/get_dogma_attributes_attribute_id_ok.d.ts +0 -50
  151. package/v2/get_dogma_attributes_ok.d.ts +0 -9
  152. package/v2/get_dogma_dynamic_items_type_id_item_id_ok.d.ts +0 -58
  153. package/v2/get_dogma_effects_effect_id_ok.d.ts +0 -127
  154. package/v2/get_dogma_effects_ok.d.ts +0 -9
  155. package/v2/get_fleets_fleet_id_members_ok.d.ts +0 -54
  156. package/v2/get_fleets_fleet_id_ok.d.ts +0 -26
  157. package/v2/get_fleets_fleet_id_wings_ok.d.ts +0 -45
  158. package/v2/get_fw_leaderboards_characters_ok.d.ts +0 -110
  159. package/v2/get_fw_leaderboards_corporations_ok.d.ts +0 -109
  160. package/v2/get_fw_leaderboards_ok.d.ts +0 -182
  161. package/v2/get_fw_stats_ok.d.ts +0 -66
  162. package/v2/get_fw_systems_ok.d.ts +0 -41
  163. package/v2/get_fw_wars_ok.d.ts +0 -24
  164. package/v2/get_industry_facilities_ok.d.ts +0 -37
  165. package/v2/get_industry_systems_ok.d.ts +0 -119
  166. package/v2/get_insurance_prices_ok.d.ts +0 -62
  167. package/v2/get_markets_groups_market_group_id_ok.d.ts +0 -27
  168. package/v2/get_markets_groups_ok.d.ts +0 -9
  169. package/v2/get_markets_prices_ok.d.ts +0 -25
  170. package/v2/get_markets_region_id_history_ok.d.ts +0 -40
  171. package/v2/get_markets_region_id_orders_ok.d.ts +0 -74
  172. package/v2/get_markets_region_id_types_ok.d.ts +0 -9
  173. package/v2/get_markets_structures_structure_id_ok.d.ts +0 -70
  174. package/v2/get_opportunities_groups_group_id_ok.d.ts +0 -38
  175. package/v2/get_opportunities_groups_ok.d.ts +0 -9
  176. package/v2/get_opportunities_tasks_ok.d.ts +0 -9
  177. package/v2/get_opportunities_tasks_task_id_ok.d.ts +0 -26
  178. package/v2/get_route_origin_destination_ok.d.ts +0 -9
  179. package/v2/get_sovereignty_campaigns_ok.d.ts +0 -83
  180. package/v2/get_sovereignty_map_ok.d.ts +0 -32
  181. package/v2/get_sovereignty_structures_ok.d.ts +0 -46
  182. package/v2/get_universe_ancestries_ok.d.ts +0 -40
  183. package/v2/get_universe_asteroid_belts_asteroid_belt_id_ok.d.ts +0 -37
  184. package/v2/get_universe_bloodlines_ok.d.ts +0 -57
  185. package/v2/get_universe_categories_category_id_ok.d.ts +0 -28
  186. package/v2/get_universe_categories_ok.d.ts +0 -9
  187. package/v2/get_universe_constellations_constellation_id_ok.d.ts +0 -47
  188. package/v2/get_universe_constellations_ok.d.ts +0 -9
  189. package/v2/get_universe_factions_ok.d.ts +0 -56
  190. package/v2/get_universe_graphics_graphic_id_ok.d.ts +0 -42
  191. package/v2/get_universe_graphics_ok.d.ts +0 -9
  192. package/v2/get_universe_groups_group_id_ok.d.ts +0 -27
  193. package/v2/get_universe_groups_ok.d.ts +0 -9
  194. package/v2/get_universe_moons_moon_id_ok.d.ts +0 -41
  195. package/v2/get_universe_planets_planet_id_ok.d.ts +0 -42
  196. package/v2/get_universe_races_ok.d.ts +0 -52
  197. package/v2/get_universe_regions_ok.d.ts +0 -9
  198. package/v2/get_universe_regions_region_id_ok.d.ts +0 -28
  199. package/v2/get_universe_schematics_schematic_id_ok.d.ts +0 -18
  200. package/v2/get_universe_stargates_stargate_id_ok.d.ts +0 -57
  201. package/v2/get_universe_stars_star_id_ok.d.ts +0 -129
  202. package/v2/get_universe_stations_station_id_ok.d.ts +0 -104
  203. package/v2/get_universe_structures_ok.d.ts +0 -9
  204. package/v2/get_universe_structures_structure_id_ok.d.ts +0 -43
  205. package/v2/get_universe_system_jumps_ok.d.ts +0 -24
  206. package/v2/get_universe_system_kills_ok.d.ts +0 -32
  207. package/v2/get_universe_systems_ok.d.ts +0 -9
  208. package/v2/get_universe_systems_system_id_ok.d.ts +0 -94
  209. package/v2/get_universe_types_ok.d.ts +0 -9
  210. package/v2/get_universe_types_type_id_ok.d.ts +0 -105
  211. package/v2/get_wars_ok.d.ts +0 -9
  212. package/v2/get_wars_war_id_killmails_ok.d.ts +0 -24
  213. package/v2/post_characters_affiliation_ok.d.ts +0 -32
  214. package/v2/post_characters_character_id_assets_locations_ok.d.ts +0 -39
  215. package/v2/post_characters_character_id_assets_names_ok.d.ts +0 -24
  216. package/v2/post_characters_character_id_contacts_created.d.ts +0 -9
  217. package/v2/post_characters_character_id_cspa_created.d.ts +0 -7
  218. package/v2/post_characters_character_id_fittings_created.d.ts +0 -14
  219. package/v2/post_characters_character_id_mail_created.d.ts +0 -7
  220. package/v2/post_characters_character_id_mail_labels_created.d.ts +0 -7
  221. package/v2/post_corporations_corporation_id_assets_locations_ok.d.ts +0 -39
  222. package/v2/post_corporations_corporation_id_assets_names_ok.d.ts +0 -24
  223. package/v2/post_fleets_fleet_id_wings_created.d.ts +0 -14
  224. package/v2/post_fleets_fleet_id_wings_wing_id_squads_created.d.ts +0 -14
  225. package/v2/post_universe_ids_ok.d.ts +0 -86
  226. package/v2/post_universe_names_ok.d.ts +0 -38
  227. /package/v2/{extra-types.d.ts → globals/extra-types.d.ts} +0 -0
@@ -1,319 +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
- # ESI Types Utility 3.1 Summary
10
-
11
- This document provides detailed explanations of each type defined in the `eve-esi-types/v2/index.d.ts` file.
12
-
13
- > ## TESIRequestFunctionSignature2
14
-
15
- `TESIRequestFunctionSignature2` is a type that defines the signature of an ESI request function where the endpoint can be a real endpoint or a parameterized endpoint. This function sends a request to a specified endpoint and returns a response.
16
-
17
- #### Type Parameters
18
-
19
- - `ActualOpt`: The actual type of the options.
20
- - `M`: The HTTP method to use for the request.
21
- - `RealEP`: The real path of the ESI endpoint to send the request to.
22
- - `EPx`: The parameterized path of the ESI endpoint to send the request to.
23
- - `PathParams`: Parameters to include in the request if the endpoint is parameterized.
24
- - `Opt`: Options to include in the request. If there is a required parameter, its type will be merged with `ActualOpt`.
25
- - `R`: The response type.
26
- - `HasOpt`: Determines if the options parameter is required.
27
-
28
- #### Parameters
29
-
30
- - `method`: The HTTP method to use for the request (e.g., "get", "post").
31
- - `endpoint`: The real path of the ESI endpoint to send the request to.
32
- - `options`: An optional object containing additional options for the request. If the endpoint has required parameters, this parameter must be provided.
33
-
34
- #### Returns
35
-
36
- A `Promise` object containing the response data, with the type inferred based on the method and endpoint.
37
-
38
- #### Remarks
39
-
40
- The `...options: HasOpt extends 1 ? [Opt] : [Opt?]` parameter is defined this way to enforce that if the endpoint has required parameters, the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
41
-
42
-
43
- > ## TESIRequestFunctionEachMethod2
44
-
45
- `TESIRequestFunctionEachMethod2` is a type that defines the signature of an ESI request function for a specific HTTP method. This function sends a request to a specified endpoint and returns a response.
46
-
47
- #### Type Parameters
48
-
49
- - `M`: The HTTP method to use for the request.
50
- - `ActualOpt`: The actual type of the options.
51
- - `RealEP`: The real path of the ESI endpoint to send the request to.
52
- - `EPx`: The parameterized path of the ESI endpoint to send the request to.
53
- - `PathParams`: Parameters to include in the request if the endpoint is parameterized.
54
- - `Opt`: Options to include in the request. If there is a required parameter, its type will be merged with `ActualOpt`.
55
- - `R`: The response type.
56
- - `HasOpt`: Determines if the options parameter is required.
57
-
58
- #### Parameters
59
-
60
- - `endpoint`: The real path of the ESI endpoint to send the request to.
61
- - `options`: An optional object containing additional options for the request. If the endpoint has required parameters, this parameter must be provided.
62
-
63
- #### Returns
64
-
65
- A `Promise` object containing the response data, with the type inferred based on the method and endpoint.
66
-
67
- #### Remarks
68
-
69
- The `...options: HasOpt extends 1 ? [Opt] : [Opt?]` parameter is defined this way to enforce that if the endpoint has required parameters, the `options` parameter must be provided. If there are no required parameters, the `options` parameter is optional.
70
-
71
-
72
-
73
- ## ReplacePathParams
74
-
75
- `ReplacePathParams` is a type that replaces path parameters in a string with numbers.
76
-
77
- ```typescript
78
- type ReplacePathParams<T extends unknown> = T extends `${infer Start}{${infer Param}}${infer End}`
79
- ? `${Start}${number}${ReplacePathParams<End>}` : T;
80
- ```
81
-
82
- <details>
83
- > Example
84
-
85
- ```typescript
86
- type Example = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
87
- // Result: `/characters/${number}/fittings/${number}/`
88
- ```
89
- </details>
90
-
91
- ## InferPathParams
92
-
93
- `InferPathParams` is a type that infers the path parameters based on the real endpoint and the resolved endpoint.
94
-
95
- ```typescript
96
- type InferPathParams<
97
- RealEP extends unknown, EPx extends unknown
98
- > = RealEP extends EPx ? _IfNeedPathParams<EPx> : TPathParamsNever;
99
- ```
100
-
101
- ## InferEndpointOrigin
102
-
103
- `InferEndpointOrigin` is a type that infers the original endpoint based on the real endpoint and the HTTP method. This type maps the real endpoint to its corresponding parameterized endpoint by checking if the real endpoint matches the pattern of any parameterized endpoint.
104
-
105
- ```typescript
106
- type InferEndpointOrigin<
107
- RealEP extends unknown, M extends TESIEntryMethod,
108
- Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>
109
- > = {
110
- [EP in Endpoints]: RealEP extends ReplacePathParams<EP>
111
- ? EP : never;
112
- }[Endpoints];
113
- ```
114
-
115
- <details>
116
- > Example
117
-
118
- ```typescript
119
- type Original = InferEndpointOrigin<"/characters/123/fittings/456/", "delete">;
120
- // Result: "/characters/{character_id}/fittings/{fitting_id}/"
121
- ```
122
- </details>
123
-
124
-
125
- ## ResolvedEndpoint
126
-
127
- `ResolvedEndpoint` is a type that determines the resolved endpoint based on the real endpoint and the method.
128
-
129
- ```typescript
130
- type ResolvedEndpoint<
131
- RealEP extends unknown, M extends TESIEntryMethod,
132
- > = InferEndpointOrigin<RealEP, M> extends never ? RealEP: InferEndpointOrigin<RealEP, M>;
133
- ```
134
-
135
- <details>
136
- > Example
137
-
138
- ```typescript
139
- type Resolved = ResolvedEndpoint<"/characters/123/fittings/456/", "delete">;
140
- // Result: "/characters/{character_id}/fittings/{fitting_id}/"
141
- ```
142
- </details>
143
-
144
- ## PickRequireParams
145
-
146
- `PickRequireParams` is a type that picks the required parameters from an entry type, including additional parameters. This type excludes the keys "result", "tag", and "cachedSeconds" from the entry type and the additional parameters, and returns the remaining keys as the required parameters.
147
-
148
- ```typescript
149
- type PickRequireParams<
150
- M extends TESIEntryMethod,
151
- EPx extends ESIEndpointOf<M> | string,
152
- AdditionalParams,
153
- Entry = _ESIResponseType<M, EPx>
154
- > = Exclude<keyof (Entry & AdditionalParams), "result" | "tag" | "cachedSeconds">;
155
- ```
156
-
157
- <details>
158
- > Example
159
-
160
- ```typescript
161
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
162
- type RequiredParams = PickRequireParams<"get", "/example/endpoint", { auth: string }>;
163
- // Result: "auth"
164
- ```
165
- </details>
166
-
167
- ## HasRequireParams
168
-
169
- `HasRequireParams` is a type that determines if the given entry has required parameters, including additional options. This type checks if an entry has any required parameters by excluding the keys "result", "tag", and "cachedSeconds". If any keys remain after this exclusion, it means the entry has required parameters.
170
-
171
- ```typescript
172
- type HasRequireParams<
173
- M extends TESIEntryMethod,
174
- EPx extends ESIEndpointOf<M> | string,
175
- AdditionalParams,
176
- > = PickRequireParams<M, EPx, AdditionalParams> extends never ? 0 : 1;
177
- ```
178
-
179
- <details>
180
- > Example
181
-
182
- ```typescript
183
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
184
- type HasRequired = HasRequireParams<"get", "/example/endpoint", { auth: string }>;
185
- // Result: 1
186
- ```
187
- </details>
188
-
189
- ## IfParameterizedPath
190
-
191
- `IfParameterizedPath` is a type that determines the required number of replacements if `EP` (endpoint) is a parameterized path.
192
-
193
- ```typescript
194
- type IfParameterizedPath<EP extends unknown, Opt = never> = EP extends `${string}/{${string}}${string}`
195
- ? PickPathParameters<EP> extends never
196
- ? Opt : InferKeysLen<PickPathParameters<EP>> extends 1
197
- ? number : [number, number]
198
- : Opt;
199
- ```
200
-
201
- ## IdentifyParameters
202
-
203
- `IdentifyParameters` is a type that identifies the required parameters for a given entry type, including additional options. This type combines the required parameters from the entry type and the additional options, ensuring that all required parameters are marked as required.
204
-
205
- ```typescript
206
- type IdentifyParameters<
207
- M extends TESIEntryMethod,
208
- EPx extends ESIEndpointOf<M> | string,
209
- Opt extends Record<string, unknown>,
210
- Entry = _ESIResponseType<M, EPx>,
211
- Keys = Exclude<keyof Entry, "result" | "tag" | "cachedSeconds">
212
- > = RequireThese<Opt, Keys> & Pick<Entry, Keys>;
213
- ```
214
-
215
- <details>
216
- > Example
217
-
218
- ```typescript
219
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
220
- type ExampleOpt = { auth: string };
221
- type IdentifiedParams = IdentifyParameters<"get", "/example/endpoint", ExampleOpt, ExampleEntry>;
222
- // Result: { auth: string } & { auth: string }
223
- ```
224
- </details>
225
-
226
- ## InferESIResponseResult
227
-
228
- `InferESIResponseResult` is a type that infers the result type of an ESI response based on the method and endpoint.
229
-
230
- ```typescript
231
- type InferESIResponseResult<
232
- M extends TESIEntryMethod,
233
- EPx extends ESIEndpointOf<M> | string
234
- > = _ESIResponseType<M, EPx> extends { result: infer U } ? U : never;
235
- ```
236
-
237
- <details>
238
- > Example
239
-
240
- ```typescript
241
- type Result = InferESIResponseResult<"get", "/characters/{character_id}/">;
242
- // Result: The inferred type of the response for the given method and endpoint.
243
- ```
244
- </details>
245
-
246
- ## NoContentResponse
247
-
248
- `NoContentResponse` is a type that represents a response with no content (HTTP status 204).
249
-
250
- ```typescript
251
- type NoContentResponse = { /* status: 204 */ };
252
- ```
253
-
254
- ## TESIEntryMethod
255
-
256
- `TESIEntryMethod` is a type that represents the HTTP methods supported by ESI.
257
-
258
- ```typescript
259
- type TESIEntryMethod = keyof TESIResponseOKMap;
260
- ```
261
-
262
- <details>
263
- > Example
264
-
265
- ```typescript
266
- "get" | "post" | "put" | "delete"
267
- ```
268
- </details>
269
-
270
- ## ESIEndpointOf
271
-
272
- `ESIEndpointOf` is a type that represents the endpoints for the specified HTTP method.
273
-
274
- ```typescript
275
- type ESIEndpointOf<M extends TESIEntryMethod> = keyof TESIResponseOKMap[M];
276
- ```
277
-
278
- <details>
279
- > Example
280
-
281
- ```typescript
282
- type TEndPointGet = ESIEndpointOf<"get">;
283
- type TEndPointPost = ESIEndpointOf<"post">;
284
- type TEndPointPut = ESIEndpointOf<"put">;
285
- type TEndPointDelete = ESIEndpointOf<"delete">;
286
- ```
287
- </details>
288
-
289
- ## TESIResponseGetEntry
290
-
291
- `TESIResponseGetEntry` is a type that represents the entry details for the "get" method.
292
-
293
- ```typescript
294
- type TESIResponseGetEntry<K extends TEndPointGet> = TESIResponseOKMap["get"][K];
295
- ```
296
-
297
- ## TESIResponsePutEntry
298
-
299
- `TESIResponsePutEntry` is a type that represents the entry details for the "put" method.
300
-
301
- ```typescript
302
- type TESIResponsePutEntry<K extends TEndPointPut> = TESIResponseOKMap["put"][K];
303
- ```
304
-
305
- ## TESIResponsePostEntry
306
-
307
- `TESIResponsePostEntry` is a type that represents the entry details for the "post" method.
308
-
309
- ```typescript
310
- type TESIResponsePostEntry<K extends TEndPointPost> = TESIResponseOKMap["post"][K];
311
- ```
312
-
313
- ## TESIResponseDeleteEntry
314
-
315
- `TESIResponseDeleteEntry` is a type that represents the entry details for the "delete" method.
316
-
317
- ```typescript
318
- type TESIResponseDeleteEntry<K extends TEndPointDelete> = TESIResponseOKMap["delete"][K];
319
- ```
@@ -1,50 +0,0 @@
1
- # Explanation of the `HasRequireParams` Type
2
-
3
- `HasRequireParams` is a conditional TypeScript utility type designed to determine whether an API entry has any required parameters, including additional options. It does so by leveraging the `PickRequireParams` type to extract the keys from an entry type that are considered required once common metadata keys (`"result"`, `"tag"`, and `"cachedSeconds"`) have been excluded. If there remain any keys after this exclusion, it means the entry has required parameters, and the type evaluates to `1`; otherwise, it evaluates to `0`.
4
-
5
- ## Type Definition
6
-
7
- ```typescript
8
- type HasRequireParams<
9
- M extends TESIEntryMethod,
10
- EPx extends ESIEndpointOf<M> | string,
11
- AdditionalParams,
12
- > = PickRequireParams<M, EPx, AdditionalParams> extends never ? 0 : 1;
13
- ```
14
-
15
- ## Template Parameters
16
-
17
- - **`M extends TESIEntryMethod`**
18
- Represents the HTTP method (like `"get"`, `"post"`, `"delete"`, etc.) for the request. This helps identify the correct set of endpoints and types associated with that method.
19
-
20
- - **`EPx extends ESIEndpointOf<M> | string`**
21
- Denotes the endpoint path. It can be a specific parameterized endpoint from a predefined set (based on the HTTP method) or a generic string.
22
-
23
- - **`AdditionalParams`**
24
- Contains any extra parameters that should be considered during the evaluation. These are merged with the entry type to form a complete set of properties before excluding the metadata keys.
25
-
26
- ## How It Works
27
-
28
- 1. **Extracting Required Parameters**
29
- The type starts by merging the entry type with `AdditionalParams` and then uses `PickRequireParams` to exclude common metadata keys (`"result"`, `"tag"`, and `"cachedSeconds"`). This extraction isolates the parameters that are truly required for the API call.
30
-
31
- 2. **Conditional Evaluation**
32
- - If the resulting type from `PickRequireParams` is `never` (meaning there are no keys left), then `HasRequireParams` evaluates to `0`.
33
- - Otherwise, if there exists at least one required parameter, it evaluates to `1`.
34
-
35
- ## Practical Example
36
-
37
- ```typescript
38
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
39
- type HasRequired = HasRequireParams<"get", "/example/endpoint", { auth: string }>;
40
- // Evaluates to: 1
41
- ```
42
-
43
- In this example:
44
- - The `ExampleEntry` type includes metadata keys as well as an essential key `auth`.
45
- - After merging with `AdditionalParams` (which also includes `{ auth: string }`) and excluding the metadata keys, `auth` remains.
46
- - Since there is a required parameter (`auth`), `HasRequireParams` evaluates to `1`.
47
-
48
- ---
49
-
50
- `HasRequireParams` provides a straightforward mechanism to check if any required parameters exist for a given API entry, assisting in enhancing type safety and clarity in API definitions.
@@ -1,57 +0,0 @@
1
- # Explanation of the `InferEndpointOrigin` Type
2
-
3
- `InferEndpointOrigin` is a utility TypeScript type that deduces the original parameterized endpoint from a real endpoint string and a specified HTTP method. It does so by mapping over all possible parameterized endpoints associated with the given HTTP method, and selecting the one whose transformed version (via `ReplacePathParams`) matches the real endpoint. This technique enables you to recover the canonical endpoint structure from a concrete URL.
4
-
5
- ## Type Definition
6
-
7
- ```typescript
8
- type InferEndpointOrigin<
9
- RealEP extends unknown, M extends TESIEntryMethod,
10
- Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>
11
- > = {
12
- [EP in Endpoints]: RealEP extends ReplacePathParams<EP>
13
- ? EP : never;
14
- }[Endpoints];
15
- ```
16
-
17
- ## Template Parameters
18
-
19
- - **`RealEP extends unknown`**
20
- The real endpoint path, e.g., `"/characters/123/fittings/456/"`, representing the concrete URL accessed in a request.
21
-
22
- - **`M extends TESIEntryMethod`**
23
- The HTTP method (such as `"get"`, `"post"`, `"delete"`, etc.) used to determine which endpoints are applicable.
24
-
25
- - **`Endpoints extends ESIEndpointOf<M> = ESIEndpointOf<M>`**
26
- The union of all possible parameterized endpoints for the given HTTP method. These endpoints generally include dynamic segments in their definition, like `"/characters/{character_id}/fittings/{fitting_id}/"`.
27
-
28
- ## How It Works
29
-
30
- 1. **Mapping Over Endpoints**
31
- The type creates a mapped type where it iterates over each possible endpoint (`EP`) in the `Endpoints` union:
32
- ```typescript
33
- RealEP extends ReplacePathParams<EP> ? EP : never;
34
- ```
35
- - **Condition:** It checks if the real endpoint `RealEP` is assignable to the version of `EP` produced by `ReplacePathParams` (i.e., with its dynamic segments replaced by `${number}`).
36
- - **Outcome:**
37
- - If the condition holds true, it retains `EP`—indicating that this is the matching original endpoint.
38
- - Otherwise, it assigns `never` for that endpoint.
39
-
40
- 2. **Indexing the Mapped Type**
41
- After processing all endpoints, the type uses an index lookup `[Endpoints]` to extract the union of all endpoints that passed the conditional check (i.e., where the condition did not yield `never`). In typical usage, this results in a single matching endpoint.
42
-
43
- ## Practical Example
44
-
45
- ```ts
46
- type Original = InferEndpointOrigin<"/characters/123/fittings/456/", "delete">;
47
- // Evaluates to: "/characters/{character_id}/fittings/{fitting_id}/"
48
- ```
49
-
50
- In this example:
51
- - The real endpoint `"/characters/123/fittings/456/"` is compared against each parameterized endpoint available for the `"delete"` method.
52
- - When the condition `RealEP extends ReplacePathParams<EP>` is satisfied, it indicates that the endpoint structure matches. Accordingly, the original parameterized endpoint (`EP`) is selected.
53
- - The final resulting type is the parameterized endpoint, `"/characters/{character_id}/fittings/{fitting_id}/"`.
54
-
55
- ---
56
-
57
- `InferEndpointOrigin` thus serves as a robust mechanism to align concrete URLs with their original endpoint definitions, ensuring accurate type-checking for API route definitions.
@@ -1,41 +0,0 @@
1
- # Explanation of the `InferPathParams` Type
2
-
3
- `InferPathParams` is a conditional utility TypeScript type that infers path parameters by comparing the real endpoint path (`RealEP`) with the resolved endpoint path (`EPx`). It determines the appropriate type for the path parameters based on whether the real endpoint extends the resolved endpoint.
4
-
5
- ## Type Definition
6
-
7
- ```typescript
8
- type InferPathParams<
9
- RealEP extends unknown, EPx extends unknown
10
- > = RealEP extends EPx ? _IfNeedPathParams<EPx> : TPathParamsNever;
11
- ```
12
-
13
- ## Template Parameters
14
-
15
- - **`RealEP extends unknown`**
16
- Represents the real endpoint path, which is the original route definition provided in your API.
17
-
18
- - **`EPx extends unknown`**
19
- Represents the resolved endpoint path, which may be a transformed or standardized version of the real endpoint.
20
-
21
- ## How It Works
22
-
23
- 1. **Conditional Check**
24
- The type first evaluates whether `RealEP` extends `EPx`:
25
- - If **true**, it indicates that the real endpoint is compatible with the resolved endpoint.
26
-
27
- 2. **Path Parameter Inference**
28
- - When the condition is met, the type returns `_IfNeedPathParams<EPx>`, a helper type that likely infers and extracts the necessary path parameters embedded within `EPx`.
29
- - Otherwise, it returns `TPathParamsNever`, a type signaling that no valid path parameters could be inferred or that they are not needed.
30
-
31
- ## Practical Example
32
-
33
- Consider a scenario where you have:
34
- - A real endpoint like `"/characters/{character_id}"`.
35
- - A resolved endpoint that might incorporate specific formatting or type annotations.
36
-
37
- Using `InferPathParams`, if the real endpoint correctly extends the resolved endpoint, `_IfNeedPathParams` will process `EPx` to extract dynamic segments (such as converting `{character_id}` to an interpolated type). If not, it falls back to `TPathParamsNever`.
38
-
39
- ---
40
-
41
- This type is instrumental in achieving type safety in API route definitions. By conditionally inferring path parameters, it ensures that only valid and necessary parameters are extracted, promoting robust type-checking and eliminating unnecessary types.
@@ -1,56 +0,0 @@
1
- # Explanation of the `PickRequireParams` Type
2
-
3
- `PickRequireParams` is an advanced TypeScript utility type designed to extract the required keys from an entry type after merging it with additional parameters. It achieves this by excluding specific keys—namely, `"result"`, `"tag"`, and `"cachedSeconds"`—which are considered metadata or non-essential for defining required parameters. This type proves extremely useful when determining which parameters are needed for a particular API operation.
4
-
5
- ## Type Definition
6
-
7
- ```typescript
8
- type PickRequireParams<
9
- M extends TESIEntryMethod,
10
- EPx extends ESIEndpointOf<M> | string,
11
- AdditionalParams,
12
- Entry = _ESIResponseType<M, EPx>
13
- > = Exclude<keyof (Entry & AdditionalParams), "result" | "tag" | "cachedSeconds">;
14
- ```
15
-
16
- ## Template Parameters
17
-
18
- - **`M extends TESIEntryMethod`**
19
- Denotes the HTTP method (such as `"get"`, `"post"`, etc.) used for the request. This helps narrow down the endpoint and response types applicable for the method.
20
-
21
- - **`EPx extends ESIEndpointOf<M> | string`**
22
- Represents the endpoint path. It can either be a specific parameterized endpoint from a predefined collection (for the given HTTP method) or a generic string.
23
-
24
- - **`AdditionalParams`**
25
- Contains any extra parameters that need to be considered. These are merged with the entry type to facilitate a comprehensive parameter extraction.
26
-
27
- - **`Entry = _ESIResponseType<M, EPx>`**
28
- By default, this infers the response type corresponding to the HTTP method and endpoint provided. The resulting type is combined with `AdditionalParams` to determine the full set of keys available before excluding the non-required ones.
29
-
30
- ## How It Works
31
-
32
- 1. **Merging Types**
33
- The type starts by merging `Entry` with `AdditionalParams` using an intersection (`Entry & AdditionalParams`). This combined type gathers all properties from both sources.
34
-
35
- 2. **Extracting Keys**
36
- Using `keyof` on the merged type yields a union of all property keys present in either `Entry` or `AdditionalParams`.
37
-
38
- 3. **Excluding Unwanted Keys**
39
- The `Exclude` utility then removes the keys `"result"`, `"tag"`, and `"cachedSeconds"` from the union. These keys are typically reserved for metadata or caching information and are not required as input parameters.
40
-
41
- ## Practical Example
42
-
43
- ```typescript
44
- type ExampleEntry = { result: string, tag: string, cachedSeconds: number, auth: string };
45
- type RequiredParams = PickRequireParams<"get", "/example/endpoint", { auth: string }, ExampleEntry>;
46
- // Result: "auth"
47
- ```
48
-
49
- In this example:
50
- - The `ExampleEntry` type contains metadata keys (`result`, `tag`, `cachedSeconds`) and an essential key `auth`.
51
- - After merging with `AdditionalParams` (which provides `{ auth: string }`), the `PickRequireParams` type excludes the metadata keys.
52
- - The final resulting type, `RequiredParams`, is `"auth"`, representing the required parameter.
53
-
54
- ---
55
-
56
- `PickRequireParams` provides a powerful approach to isolating the essential parameters needed for API operations, ensuring that extraneous metadata does not interfere with type-safety and clarity in your API definitions.
@@ -1,60 +0,0 @@
1
- # Explanation of the `ReplacePathParams` Type
2
-
3
- `ReplacePathParams` is a recursive TypeScript type designed to replace dynamic segments—specifically,
4
- the path parameters enclosed in curly braces—in a string literal with a standardized template literal interpolation of `${number}`.
5
- This is especially useful when defining API endpoints where parameters in the URL are expected to be numeric.
6
-
7
- ## Type Definition
8
-
9
- ```typescript
10
- type ReplacePathParams<T extends unknown> = T extends `${infer Start}{${infer Param}}${infer End}`
11
- ? `${Start}${number}${ReplacePathParams<End>}`
12
- : T;
13
- ```
14
-
15
- ### Parameters
16
-
17
- + T extends unknown Although T is declared with the type unknown, it is intended to be a string literal representing the endpoint path.
18
- The type processes the string to find dynamic segments that need to be replaced.
19
-
20
- ### How It Works
21
-
22
- 1. Pattern Matching The type checks if the input string T matches the pattern:
23
-
24
- `${infer Start}{${infer Param}}${infer End}`
25
-
26
- + `Start`: Captures the substring leading up to the first occurrence of a path parameter.
27
-
28
- + `{${infer Param}}`: Matches a section of the string enclosed in curly braces. The content inside the braces, which is the path parameter's name, is stored temporarily in Param.
29
-
30
- + `End`: Captures the remaining part of the string following the matched dynamic segment.
31
-
32
- 2. **Recursive Replacement** If the pattern is matched:
33
-
34
- + The matching segment `{${infer Param}}` is replaced with `${number}`.
35
-
36
- + The type then recursively applies itself to the remainder of the string (`End`) by calling `ReplacePathParams<End>`,
37
- ensuring that all occurrences of path parameters are replaced.
38
-
39
- 3. Base Case If `T` does not contain any substring that fits the pattern (i.e., no occurrence of a dynamic segment in curly braces),
40
- the type simply evaluates to `T` without modification. This serves as the termination condition for the recursion.
41
-
42
- ### Practical Example
43
-
44
- ```ts
45
- type Example = ReplacePathParams<"/characters/{character_id}/fittings/{fitting_id}/">;
46
- // Evaluates to: "/characters/${number}/fittings/${number}/"
47
- ```
48
-
49
- In this example:
50
-
51
- 1. The first dynamic segment `{character_id}` is replaced with `${number}`.
52
-
53
- 1. The type then recursively processes the remaining string, encountering and replacing {fitting_id} with `${number}`.
54
-
55
- 1. The final resulting type is `"/characters/${number}/fittings/${number}/"`.
56
-
57
- ---
58
-
59
- The `ReplacePathParams` type is a powerful tool for transforming endpoint strings into a more standardized format.
60
- This is especially beneficial when type-checking API route definitions or dynamically generating strongly-typed URL strings based on certain conditions.
@@ -1,44 +0,0 @@
1
- # Explanation of the `ResolvedEndpoint` Type
2
-
3
- `ResolvedEndpoint` is a utility TypeScript type that determines the final, "resolved" endpoint based on a given real endpoint and the specific HTTP method. It leverages the `InferEndpointOrigin` type to deduce the original parameterized endpoint from the real endpoint. If no matching parameterized endpoint is found (i.e., the inference results in `never`), it defaults back to the real endpoint.
4
-
5
- ## Type Definition
6
-
7
- ```typescript
8
- type ResolvedEndpoint<
9
- RealEP extends unknown, M extends TESIEntryMethod,
10
- > = InferEndpointOrigin<RealEP, M> extends never ? RealEP : InferEndpointOrigin<RealEP, M>;
11
- ```
12
-
13
- ## Template Parameters
14
-
15
- - **`RealEP extends unknown`**
16
- The real endpoint path, representing the actual URL used in a request (for example, `"/characters/123/fittings/456/"`).
17
-
18
- - **`M extends TESIEntryMethod`**
19
- The HTTP method (such as `"get"`, `"post"`, `"delete"`, etc.) used for the request. This is used to narrow down which set of parameterized endpoints should be considered.
20
-
21
- ## How It Works
22
-
23
- 1. **Endpoint Inference**
24
- The type starts by invoking `InferEndpointOrigin<RealEP, M>`, which attempts to map the real endpoint to its original parameterized form (e.g., converting `"/characters/123/fittings/456/"` to `"/characters/{character_id}/fittings/{fitting_id}/"`).
25
-
26
- 2. **Conditional Resolution**
27
- - If `InferEndpointOrigin<RealEP, M>` results in `never`, it means no matching parameterized endpoint could be inferred from the given real endpoint. In such cases, the type falls back and returns `RealEP` as is.
28
- - If the inference is successful, the resolved parameterized endpoint is returned.
29
-
30
- ## Practical Example
31
-
32
- ```ts
33
- type Resolved = ResolvedEndpoint<"/characters/123/fittings/456/", "delete">;
34
- // Evaluates to: "/characters/{character_id}/fittings/{fitting_id}/"
35
- ```
36
-
37
- In this example:
38
- - The real endpoint `"/characters/123/fittings/456/"` along with the HTTP method `"delete"` is provided.
39
- - `InferEndpointOrigin` successfully maps it to its original form (`"/characters/{character_id}/fittings/{fitting_id}/"`), so that becomes the resolved endpoint.
40
- - If the mapping had failed (i.e., if no parameterized endpoint matched), the type would have defaulted to returning the original real endpoint.
41
-
42
- ---
43
-
44
- `ResolvedEndpoint` thus ensures that you get a consistent and properly parameterized endpoint format, which is crucial for maintaining type safety and clarity in API route definitions.
package/tsconfig.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "compilerOptions": {
4
- "skipDefaultLibCheck": true,
5
- "skipLibCheck": true,
6
- "declaration": true,
7
- // "declarationDir": "./dts",
8
- "outDir": ".",
9
- "target": "esnext",
10
- "module": "esnext",
11
- "diagnostics": true,
12
- "newLine": "LF",
13
- "strict": true,
14
- "moduleResolution": "node",
15
- "rootDirs": [
16
- "./scripts"
17
- ]
18
- },
19
- "include": [
20
- "./scripts/**/*.mts",
21
- "./scripts/**/*.d.ts",
22
- "./v2/*.d.ts"
23
- ],
24
- "exclude": [
25
- "./scripts/auth-*",
26
- "./scripts/esi-*",
27
- ]
28
- }