@lgriffin/esi.ts 4.0.0 → 5.1.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.
- package/CHANGELOG.md +174 -0
- package/LICENSE +26 -26
- package/README.md +562 -557
- package/dist/EsiClient.d.ts +8 -2
- package/dist/EsiClient.d.ts.map +1 -1
- package/dist/EsiClient.js +9 -0
- package/dist/EsiClientBuilder.d.ts +4 -1
- package/dist/EsiClientBuilder.d.ts.map +1 -1
- package/dist/EsiClientBuilder.js +9 -0
- package/dist/clients/AccessListsClient.d.ts +15 -0
- package/dist/clients/AccessListsClient.d.ts.map +1 -0
- package/dist/clients/AccessListsClient.js +20 -0
- package/dist/clients/MercenaryClient.d.ts +20 -0
- package/dist/clients/MercenaryClient.d.ts.map +1 -0
- package/dist/clients/MercenaryClient.js +27 -0
- package/dist/clients/SkyhooksClient.d.ts +26 -0
- package/dist/clients/SkyhooksClient.d.ts.map +1 -0
- package/dist/clients/SkyhooksClient.js +35 -0
- package/dist/clients/SovereigntyClient.d.ts +4 -10
- package/dist/clients/SovereigntyClient.d.ts.map +1 -1
- package/dist/clients/SovereigntyClient.js +4 -12
- package/dist/clients/UniverseClient.d.ts +2 -2
- package/dist/clients/UniverseClient.d.ts.map +1 -1
- package/dist/clients/UniverseClient.js +3 -3
- package/dist/config/configManager.d.ts.map +1 -1
- package/dist/config/configManager.js +12 -6
- package/dist/config/jest/jest.setup.js +0 -1
- package/dist/core/ApiRequestHandler.d.ts.map +1 -1
- package/dist/core/ApiRequestHandler.js +7 -3
- package/dist/core/ClientRegistry.d.ts +6 -4
- package/dist/core/ClientRegistry.d.ts.map +1 -1
- package/dist/core/ClientRegistry.js +11 -2
- package/dist/core/circuitBreaker/CircuitBreaker.js +2 -2
- package/dist/core/constants.d.ts +3 -3
- package/dist/core/constants.js +2 -2
- package/dist/core/endpoints/accessListEndpoints.d.ts +9 -0
- package/dist/core/endpoints/accessListEndpoints.d.ts.map +1 -0
- package/dist/core/endpoints/accessListEndpoints.js +11 -0
- package/dist/core/endpoints/assetEndpoints.d.ts +4 -12
- package/dist/core/endpoints/assetEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/assetEndpoints.js +4 -4
- package/dist/core/endpoints/contactEndpoints.d.ts +1 -3
- package/dist/core/endpoints/contactEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/contactEndpoints.js +1 -1
- package/dist/core/endpoints/mercenaryEndpoints.d.ts +13 -0
- package/dist/core/endpoints/mercenaryEndpoints.d.ts.map +1 -0
- package/dist/core/endpoints/mercenaryEndpoints.js +15 -0
- package/dist/core/endpoints/skyhookEndpoints.d.ts +18 -0
- package/dist/core/endpoints/skyhookEndpoints.d.ts.map +1 -0
- package/dist/core/endpoints/skyhookEndpoints.js +20 -0
- package/dist/core/endpoints/sovereigntyEndpoints.d.ts +2 -7
- package/dist/core/endpoints/sovereigntyEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/sovereigntyEndpoints.js +2 -7
- package/dist/core/endpoints/universeEndpoints.d.ts +2 -6
- package/dist/core/endpoints/universeEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/universeEndpoints.js +2 -2
- package/dist/core/rateLimiter/RateLimiter.d.ts.map +1 -1
- package/dist/core/rateLimiter/RateLimiter.js +5 -11
- package/dist/core/util/headersUtil.d.ts.map +1 -1
- package/dist/core/util/headersUtil.js +2 -1
- package/dist/core/util/testHelpers.d.ts +0 -2
- package/dist/core/util/testHelpers.d.ts.map +1 -1
- package/dist/core/util/testHelpers.js +3 -19
- package/dist/core/util/validation.js +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/testing/TestDataFactory.d.ts +8 -2
- package/dist/testing/TestDataFactory.d.ts.map +1 -1
- package/dist/testing/TestDataFactory.js +86 -1
- package/dist/types/access-lists.d.ts +11 -0
- package/dist/types/access-lists.d.ts.map +1 -0
- package/dist/types/api-responses.d.ts +3 -0
- package/dist/types/api-responses.d.ts.map +1 -1
- package/dist/types/api-responses.js +3 -0
- package/dist/types/mercenary.d.ts +19 -0
- package/dist/types/mercenary.d.ts.map +1 -0
- package/dist/types/mercenary.js +2 -0
- package/dist/types/skyhooks.d.ts +27 -0
- package/dist/types/skyhooks.d.ts.map +1 -0
- package/dist/types/skyhooks.js +2 -0
- package/dist/types/sovereignty.d.ts +11 -9
- package/dist/types/sovereignty.d.ts.map +1 -1
- package/package.json +181 -156
- package/dist/api/alliances/getAllianceById.js +0 -17
- package/dist/api/alliances/getAllianceContactLabels.js +0 -13
- package/dist/api/alliances/getAllianceContacts.js +0 -13
- package/dist/api/alliances/getAllianceCorporations.js +0 -13
- package/dist/api/alliances/getAllianceIcons.js +0 -13
- package/dist/api/alliances/getAlliances.js +0 -13
- package/dist/api/assets/getCharacterAssets.js +0 -13
- package/dist/api/assets/getCorporationAssets.js +0 -13
- package/dist/api/assets/postCharacterAssetLocations.js +0 -13
- package/dist/api/assets/postCharacterAssetNames.js +0 -13
- package/dist/api/assets/postCorporationAssetLocations.js +0 -13
- package/dist/api/assets/postCorporationAssetNames.js +0 -13
- package/dist/api/bookmarks/getCharacterBookmarkFolders.js +0 -13
- package/dist/api/bookmarks/getCharacterBookmarks.js +0 -13
- package/dist/api/bookmarks/getCorporationBookmarkFolders.js +0 -13
- package/dist/api/bookmarks/getCorporationBookmarks.js +0 -13
- package/dist/api/calendar/getCalendarEventById.js +0 -13
- package/dist/api/calendar/getCalendarEvents.js +0 -13
- package/dist/api/calendar/getEventAttendees.js +0 -13
- package/dist/api/calendar/respondToCalendarEvent.js +0 -14
- package/dist/api/characters/getAgentsResearch.js +0 -13
- package/dist/api/characters/getBlueprints.js +0 -13
- package/dist/api/characters/getCharacterPublicInfo.js +0 -13
- package/dist/api/characters/getCharacterRoles.js +0 -13
- package/dist/api/characters/getCharacterStandings.js +0 -13
- package/dist/api/characters/getCharacterTitles.js +0 -13
- package/dist/api/characters/getContactNotifications.js +0 -13
- package/dist/api/characters/getCorporationHistory.js +0 -13
- package/dist/api/characters/getJumpFatigue.js +0 -13
- package/dist/api/characters/getMedals.js +0 -13
- package/dist/api/characters/getNotifications.js +0 -13
- package/dist/api/characters/getPortrait.js +0 -13
- package/dist/api/characters/postCSPAChargeCost.js +0 -13
- package/dist/api/characters/postCharacterAffiliations.js +0 -14
- package/dist/api/clones/getClones.js +0 -14
- package/dist/api/clones/getImplants.js +0 -14
- package/dist/api/clones/postJumpCloneActivation.js +0 -14
- package/dist/api/contacts/deleteCharacterContacts.js +0 -13
- package/dist/api/contacts/getAllianceContactLabels.js +0 -13
- package/dist/api/contacts/getAllianceContacts.js +0 -13
- package/dist/api/contacts/getCharacterContactLabels.js +0 -13
- package/dist/api/contacts/getCharacterContacts.js +0 -13
- package/dist/api/contacts/getCorporationContactLabels.js +0 -13
- package/dist/api/contacts/getCorporationContacts.js +0 -13
- package/dist/api/contacts/postCharacterContacts.js +0 -13
- package/dist/api/contacts/putCharacterContacts.js +0 -13
- package/dist/api/contracts/getCharacterContractBids.js +0 -13
- package/dist/api/contracts/getCharacterContractItems.js +0 -13
- package/dist/api/contracts/getCharacterContracts.js +0 -13
- package/dist/api/contracts/getCorporationContractBids.js +0 -13
- package/dist/api/contracts/getCorporationContractItems.js +0 -13
- package/dist/api/contracts/getCorporationContracts.js +0 -13
- package/dist/api/contracts/getPublicContractBids.js +0 -13
- package/dist/api/contracts/getPublicContractItems.js +0 -13
- package/dist/api/contracts/getPublicContracts.js +0 -13
- package/dist/api/corporations/getCorporationAllianceHistory.js +0 -13
- package/dist/api/corporations/getCorporationAlscLogs.js +0 -13
- package/dist/api/corporations/getCorporationBlueprints.js +0 -13
- package/dist/api/corporations/getCorporationDivisions.js +0 -13
- package/dist/api/corporations/getCorporationFacilities.js +0 -13
- package/dist/api/corporations/getCorporationIcon.js +0 -13
- package/dist/api/corporations/getCorporationInfo.js +0 -13
- package/dist/api/corporations/getCorporationIssuedMedals.js +0 -13
- package/dist/api/corporations/getCorporationMedals.js +0 -13
- package/dist/api/corporations/getCorporationMemberLimit.js +0 -13
- package/dist/api/corporations/getCorporationMemberRoles.js +0 -13
- package/dist/api/corporations/getCorporationMemberRolesHistory.js +0 -13
- package/dist/api/corporations/getCorporationMemberTracking.js +0 -13
- package/dist/api/corporations/getCorporationMembers.js +0 -13
- package/dist/api/corporations/getCorporationMembersTitles.js +0 -13
- package/dist/api/corporations/getCorporationProjects.js +0 -13
- package/dist/api/corporations/getCorporationShareholders.js +0 -13
- package/dist/api/corporations/getCorporationStandings.js +0 -13
- package/dist/api/corporations/getCorporationStarbaseDetail.js +0 -13
- package/dist/api/corporations/getCorporationStarbases.js +0 -13
- package/dist/api/corporations/getCorporationStructures.js +0 -13
- package/dist/api/corporations/getCorporationTitles.js +0 -13
- package/dist/api/corporations/getNpcCorporations.js +0 -13
- package/dist/api/dogma/getDogmaAttributeById.js +0 -13
- package/dist/api/dogma/getDogmaAttributes.js +0 -13
- package/dist/api/dogma/getDogmaDynamicItemAttributes.js +0 -13
- package/dist/api/dogma/getDogmaEffectById.js +0 -13
- package/dist/api/dogma/getDogmaEffects.js +0 -13
- package/dist/api/factions/getCharacterFactionWarfareStats.js +0 -13
- package/dist/api/factions/getCharacterLeaderboards.js +0 -13
- package/dist/api/factions/getCorporationFactionWarfareStats.js +0 -13
- package/dist/api/factions/getCorporationLeaderboards.js +0 -13
- package/dist/api/factions/getFactionLeaderboards.js +0 -13
- package/dist/api/factions/getFactionWarfareStats.js +0 -13
- package/dist/api/factions/getFactionWarfareSystems.js +0 -13
- package/dist/api/factions/getFactionWarfareWars.js +0 -13
- package/dist/api/fittings/deleteCharacterFitting.js +0 -13
- package/dist/api/fittings/getCharacterFittings.js +0 -13
- package/dist/api/fittings/postCharacterFittings.js +0 -13
- package/dist/api/fleets/deleteFleetMember.js +0 -13
- package/dist/api/fleets/deleteFleetSquad.js +0 -13
- package/dist/api/fleets/deleteFleetWing.js +0 -13
- package/dist/api/fleets/getCharacterFleetInfo.js +0 -13
- package/dist/api/fleets/getFleetInfo.js +0 -13
- package/dist/api/fleets/getFleetMembers.js +0 -13
- package/dist/api/fleets/getFleetWings.js +0 -13
- package/dist/api/fleets/postFleetInvitation.js +0 -13
- package/dist/api/fleets/postFleetSquad.js +0 -14
- package/dist/api/fleets/postFleetWing.js +0 -13
- package/dist/api/fleets/putFleetMember.js +0 -13
- package/dist/api/fleets/putFleetSquad.js +0 -13
- package/dist/api/fleets/putFleetWing.js +0 -14
- package/dist/api/fleets/updateFleet.js +0 -13
- package/dist/api/incursions/getIncursions.js +0 -13
- package/dist/api/industry/getCharacterIndustryJobs.js +0 -13
- package/dist/api/industry/getCharacterMiningLedger.js +0 -13
- package/dist/api/industry/getCorporationIndustryJobs.js +0 -13
- package/dist/api/industry/getCorporationMiningObserver.js +0 -13
- package/dist/api/industry/getCorporationMiningObservers.js +0 -13
- package/dist/api/industry/getIndustryFacilities.js +0 -13
- package/dist/api/industry/getIndustrySystems.js +0 -13
- package/dist/api/industry/getMoonExtractionTimers.js +0 -13
- package/dist/api/insurance/getInsurancePrices.js +0 -13
- package/dist/api/killmails/getCharacterRecentKillmails.js +0 -13
- package/dist/api/killmails/getCorporationRecentKillmails.js +0 -13
- package/dist/api/killmails/getKillmail.js +0 -13
- package/dist/api/location/getCharacterLocation.js +0 -13
- package/dist/api/location/getCharacterOnline.js +0 -13
- package/dist/api/location/getCharacterShip.js +0 -13
- package/dist/api/loyalty/getLoyaltyPoints.js +0 -13
- package/dist/api/loyalty/getLoyaltyStoreOffers.js +0 -13
- package/dist/api/mail/deleteCharacterMail.js +0 -13
- package/dist/api/mail/deleteCharacterMailLabel.js +0 -13
- package/dist/api/mail/deleteCharacterMailLabel.test.js +0 -21
- package/dist/api/mail/getCharacerMailingLists.test.js +0 -33
- package/dist/api/mail/getCharacterMail.js +0 -13
- package/dist/api/mail/getCharacterMailHeaders.js +0 -13
- package/dist/api/mail/getCharacterMailLabels.js +0 -13
- package/dist/api/mail/getCharacterMailingLists.js +0 -13
- package/dist/api/mail/postCharacterMail.js +0 -13
- package/dist/api/mail/postCharacterMailLabels.js +0 -13
- package/dist/api/mail/putCharacterMail.js +0 -13
- package/dist/api/market/getCharacterOrderHistory.js +0 -13
- package/dist/api/market/getCharacterOrders.js +0 -13
- package/dist/api/market/getCorporationOrderHistory.js +0 -13
- package/dist/api/market/getCorporationOrders.js +0 -13
- package/dist/api/market/getMarketGroupInformation.js +0 -13
- package/dist/api/market/getMarketGroups.js +0 -13
- package/dist/api/market/getMarketHistory.js +0 -13
- package/dist/api/market/getMarketOrders.js +0 -13
- package/dist/api/market/getMarketOrdersInStructure.js +0 -13
- package/dist/api/market/getMarketPrices.js +0 -13
- package/dist/api/market/getMarketTypes.js +0 -13
- package/dist/api/meta/getSwaggerJson.js +0 -13
- package/dist/api/meta/getSwaggerYaml.js +0 -37
- package/dist/api/opportunities/getCharacterOpportunities.js +0 -13
- package/dist/api/opportunities/getOpportunitiesGroupById.js +0 -13
- package/dist/api/opportunities/getOpportunitiesGroups.js +0 -13
- package/dist/api/opportunities/getOpportunitiesTaskById.js +0 -13
- package/dist/api/opportunities/getOpportunitiesTasks.js +0 -13
- package/dist/api/pi/getColonies.js +0 -13
- package/dist/api/pi/getColonyLayout.js +0 -13
- package/dist/api/pi/getCorporationCustomsOffices.js +0 -13
- package/dist/api/pi/getSchematicInformation.js +0 -13
- package/dist/api/route/getRoute.js +0 -13
- package/dist/api/search/getCharacterSearch.js +0 -13
- package/dist/api/skills/getCharacterAttributes.js +0 -13
- package/dist/api/skills/getCharacterSkillQueue.js +0 -13
- package/dist/api/skills/getCharacterSkills.js +0 -13
- package/dist/api/sovereignty/getSovereigntyCampaigns.js +0 -13
- package/dist/api/sovereignty/getSovereigntyMap.js +0 -13
- package/dist/api/sovereignty/getSovereigntyStructures.js +0 -13
- package/dist/api/status/getStatus.js +0 -13
- package/dist/api/ui/postAutopilotWaypoint.js +0 -13
- package/dist/api/ui/postOpenContractWindow.js +0 -13
- package/dist/api/ui/postOpenInformationWindow.js +0 -13
- package/dist/api/ui/postOpenMarketDetailsWindow.js +0 -13
- package/dist/api/ui/postOpenNewMailWindow.js +0 -13
- package/dist/api/universe/getAncestries.js +0 -13
- package/dist/api/universe/getAsteroidBeltInfo.js +0 -13
- package/dist/api/universe/getBloodlines.js +0 -13
- package/dist/api/universe/getConstellationById.js +0 -13
- package/dist/api/universe/getConstellations.js +0 -13
- package/dist/api/universe/getFactions.js +0 -13
- package/dist/api/universe/getGraphicById.js +0 -13
- package/dist/api/universe/getGraphics.js +0 -13
- package/dist/api/universe/getItemCategories.js +0 -13
- package/dist/api/universe/getItemCategoryById.js +0 -13
- package/dist/api/universe/getItemGroupById.js +0 -13
- package/dist/api/universe/getItemGroups.js +0 -13
- package/dist/api/universe/getMoonById.js +0 -13
- package/dist/api/universe/getPlanetById.js +0 -13
- package/dist/api/universe/getRaces.js +0 -13
- package/dist/api/universe/getRegionById.js +0 -13
- package/dist/api/universe/getRegions.js +0 -13
- package/dist/api/universe/getSchematicById.js +0 -13
- package/dist/api/universe/getStarById.js +0 -13
- package/dist/api/universe/getStargateById.js +0 -13
- package/dist/api/universe/getStationById.js +0 -13
- package/dist/api/universe/getStructureById.js +0 -13
- package/dist/api/universe/getStructures.js +0 -13
- package/dist/api/universe/getSystemById.js +0 -13
- package/dist/api/universe/getSystemJumps.js +0 -13
- package/dist/api/universe/getSystemKills.js +0 -13
- package/dist/api/universe/getSystems.js +0 -13
- package/dist/api/universe/getTypeById.js +0 -13
- package/dist/api/universe/getTypes.js +0 -13
- package/dist/api/universe/postBulkNamesToIds.js +0 -14
- package/dist/api/universe/postNamesAndCategories.js +0 -14
- package/dist/api/wallet/getCharacterWallet.js +0 -13
- package/dist/api/wallet/getCharacterWalletJournal.js +0 -13
- package/dist/api/wallet/getCharacterWalletTransactions.js +0 -13
- package/dist/api/wallet/getCorporationWalletJournal.js +0 -13
- package/dist/api/wallet/getCorporationWalletTransactions.js +0 -13
- package/dist/api/wallet/getCorporationWallets.js +0 -13
- package/dist/api/wars/getWarById.js +0 -13
- package/dist/api/wars/getWarKillmails.js +0 -13
- package/dist/api/wars/getWars.js +0 -13
- package/dist/builders/AllianceApiBuilder.js +0 -13
- package/dist/builders/AssetsApiBuilder.js +0 -13
- package/dist/builders/BookmarkApiBuilder.js +0 -13
- package/dist/builders/CalendarApiBuilder.js +0 -13
- package/dist/builders/CharacterApiBuilder.js +0 -13
- package/dist/builders/ClonesApiBuilder.js +0 -13
- package/dist/builders/ContactsApiBuilder.js +0 -13
- package/dist/builders/ContractsApiBuilder.js +0 -13
- package/dist/builders/CorporationsApiBuilder.js +0 -13
- package/dist/builders/DogmaApiBuilder.js +0 -13
- package/dist/builders/FactionApiBuilder.js +0 -13
- package/dist/builders/FittingsApiBuilder.js +0 -13
- package/dist/builders/FleetApiBuilder.js +0 -13
- package/dist/builders/IncursionsApiBuilder.js +0 -13
- package/dist/builders/IndustryApiBuilder.js +0 -13
- package/dist/builders/InsuranceApiBuilder.js +0 -13
- package/dist/builders/KillmailsBuilder.js +0 -13
- package/dist/builders/LocationApiBuilder.js +0 -13
- package/dist/builders/LoyaltyApiBuilder.js +0 -13
- package/dist/builders/MailApiBuilder.js +0 -13
- package/dist/builders/MarketApiBuilder.js +0 -13
- package/dist/builders/MetaApiBuilder.js +0 -13
- package/dist/builders/OpportunitiesApiBuilder.js +0 -13
- package/dist/builders/PiApiBuilder.js +0 -13
- package/dist/builders/RouteApiBuilder.js +0 -13
- package/dist/builders/SearchApiBuilder.js +0 -13
- package/dist/builders/SkillsApiBuilder.js +0 -13
- package/dist/builders/SovereigntyApiBuilder.js +0 -13
- package/dist/builders/StatusApiBuilder.js +0 -13
- package/dist/builders/UiApiBuilder.js +0 -13
- package/dist/builders/UniverseApiBuilder.js +0 -13
- package/dist/builders/WalletApiBuilder.js +0 -13
- package/dist/builders/WarsAPIBuilder.js +0 -13
- package/dist/clients/BookmarkClient.js +0 -28
- package/dist/clients/OpportunitiesClient.js +0 -33
- package/dist/config/constants.js +0 -11
- package/dist/core/ApiError.js +0 -11
- package/dist/core/container/Container.js +0 -145
- package/dist/core/errors/ApiError.js +0 -129
- package/dist/core/factory/ApiFactory.js +0 -170
- package/dist/core/logger/index.d.ts +0 -2
- package/dist/core/logger/index.d.ts.map +0 -1
- package/dist/core/logger/index.js +0 -8
- package/dist/core/util/file.js +0 -26
- package/dist/core/util/inputValidation.js +0 -9
- package/dist/core/util/network.js +0 -15
- package/dist/core/util/request.js +0 -21
- package/dist/testing/TestHelpers.js +0 -205
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/{core/IAPIBuilder.js → types/access-lists.js} +0 -0
package/README.md
CHANGED
|
@@ -1,557 +1,562 @@
|
|
|
1
|
-
# ESI.ts
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/js/%40lgriffin%2Fesi.ts)
|
|
4
|
-
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
5
|
-
[](https://github.com/lgriffin/ESI.ts/actions/workflows/ci.yml)
|
|
7
|
-
[](https://github.com/lgriffin/ESI.ts/actions/workflows/pr-validation.yml)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- Automatic
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
|
188
|
-
|
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
|
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
client.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
// Fetch
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
npm run example:
|
|
380
|
-
npm run example:
|
|
381
|
-
npm run example:
|
|
382
|
-
npm run example:
|
|
383
|
-
npm run example:
|
|
384
|
-
npm run example:
|
|
385
|
-
npm run example:
|
|
386
|
-
npm run example:
|
|
387
|
-
npm run example:
|
|
388
|
-
npm run example:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
npm run example
|
|
402
|
-
npm run example:
|
|
403
|
-
npm run example:
|
|
404
|
-
npm run example:
|
|
405
|
-
npm run example:
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
###
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
|
466
|
-
|
|
|
467
|
-
| [
|
|
468
|
-
| [
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
#
|
|
481
|
-
npm
|
|
482
|
-
npm run
|
|
483
|
-
npm run
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
#
|
|
487
|
-
npm run
|
|
488
|
-
npm run
|
|
489
|
-
npm run
|
|
490
|
-
|
|
491
|
-
#
|
|
492
|
-
npm run
|
|
493
|
-
npm run
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
-
|
|
524
|
-
-
|
|
525
|
-
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
1
|
+
# ESI.ts
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40lgriffin%2Fesi.ts)
|
|
4
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://github.com/lgriffin/ESI.ts/actions/workflows/ci.yml)
|
|
7
|
+
[](https://github.com/lgriffin/ESI.ts/actions/workflows/pr-validation.yml)
|
|
8
|
+
[](https://github.com/lgriffin/ESI.ts)
|
|
9
|
+
[](https://www.npmjs.com/package/@lgriffin/esi.ts)
|
|
10
|
+
|
|
11
|
+
A type-safe TypeScript client for the [EVE Online ESI API](https://esi.evetech.net/).
|
|
12
|
+
|
|
13
|
+
- Typed responses for all endpoints
|
|
14
|
+
- ETag caching with Cache-Control TTL, stale-on-error, and write invalidation
|
|
15
|
+
- Automatic offset-based pagination and cursor-based pagination support
|
|
16
|
+
- Rate limiting with header-driven backoff
|
|
17
|
+
- Automatic token refresh with 401 retry and concurrent coalescing
|
|
18
|
+
- 35 domain clients covering the full ESI surface
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @lgriffin/esi.ts
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Building from Source
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/lgriffin/ESI.ts.git
|
|
30
|
+
cd ESI.ts
|
|
31
|
+
npm install # installs dependencies and compiles (via the prepare script)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If you've already installed and just need to recompile:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Verify everything works:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run example:status # quick smoke test — checks ESI is reachable
|
|
44
|
+
npm test # run the full test suite
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { EsiClient } from '@lgriffin/esi.ts';
|
|
51
|
+
|
|
52
|
+
const client = new EsiClient();
|
|
53
|
+
|
|
54
|
+
// Public data — no auth required
|
|
55
|
+
const alliances = await client.alliance.getAlliances();
|
|
56
|
+
const character = await client.characters.getCharacterPublicInfo(1689391488);
|
|
57
|
+
const system = await client.universe.getSystemById(30000142);
|
|
58
|
+
const prices = await client.market.getMarketPrices();
|
|
59
|
+
|
|
60
|
+
// Authenticated data — token read from ESI_ACCESS_TOKEN env var
|
|
61
|
+
const authedClient = new EsiClient();
|
|
62
|
+
const assets = await authedClient.assets.getCharacterAssets(characterId);
|
|
63
|
+
const wallet = await authedClient.wallet.getCharacterWallet(characterId);
|
|
64
|
+
|
|
65
|
+
// Clean up when done
|
|
66
|
+
await client.shutdown();
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configuration
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const client = new EsiClient({
|
|
73
|
+
clientId: 'my-app', // User-Agent identifier (default: 'esi-client')
|
|
74
|
+
accessToken: 'your-token', // EVE SSO token for authenticated endpoints
|
|
75
|
+
baseUrl: 'https://esi.evetech.net', // ESI base URL (default)
|
|
76
|
+
onTokenRefresh: async () => newToken, // Auto-refresh on 401 (optional)
|
|
77
|
+
timeout: 30000, // Request timeout in ms (default: 30000)
|
|
78
|
+
retryAttempts: 3, // Retry count (default: 3)
|
|
79
|
+
enableETagCache: true, // ETag caching (default: true)
|
|
80
|
+
etagCacheConfig: {
|
|
81
|
+
maxEntries: 1000, // Max cached responses (default: 1000)
|
|
82
|
+
defaultTtl: 300000, // Fallback TTL in ms (default: 5 min)
|
|
83
|
+
cleanupInterval: 60000, // Expired entry cleanup interval (default: 1 min)
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The access token can be updated at runtime:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
client.setAccessToken('new-token');
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Authentication
|
|
95
|
+
|
|
96
|
+
Many ESI endpoints require an EVE SSO access token. There are three ways to provide one:
|
|
97
|
+
|
|
98
|
+
### 1. Environment variable (recommended)
|
|
99
|
+
|
|
100
|
+
Set `ESI_ACCESS_TOKEN` in your environment or a `.env` file. The client reads it automatically — no token in source code.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Copy the example and fill in your token
|
|
104
|
+
cp .env.example .env
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```env
|
|
108
|
+
ESI_ACCESS_TOKEN=your-eve-sso-access-token
|
|
109
|
+
ESI_CLIENT_ID=my-app-name
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If you use a `.env` loader like [dotenv](https://www.npmjs.com/package/dotenv), load it before creating the client:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
import 'dotenv/config';
|
|
116
|
+
import { EsiClient } from '@lgriffin/esi.ts';
|
|
117
|
+
|
|
118
|
+
const client = new EsiClient();
|
|
119
|
+
// Token is picked up from process.env.ESI_ACCESS_TOKEN
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2. Constructor parameter
|
|
123
|
+
|
|
124
|
+
Pass the token directly (useful for apps that manage tokens themselves):
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const client = new EsiClient({ accessToken: token });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 3. Runtime update
|
|
131
|
+
|
|
132
|
+
Set or refresh the token after construction:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
client.setAccessToken(newToken);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Getting an EVE SSO token
|
|
139
|
+
|
|
140
|
+
1. Register an application at [EVE Developers](https://developers.eveonline.com/)
|
|
141
|
+
2. Set a callback URL and select the ESI scopes your app needs
|
|
142
|
+
3. Implement the [OAuth2 flow](https://docs.esi.evetech.net/docs/sso/) to obtain an access token
|
|
143
|
+
4. Access tokens expire — use the refresh token to get new ones
|
|
144
|
+
|
|
145
|
+
### Automatic Token Refresh
|
|
146
|
+
|
|
147
|
+
EVE SSO access tokens expire after 20 minutes. Instead of manually tracking expiry, you can provide a refresh callback — the client will automatically call it on 401, update the token, and retry the request:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
const client = new EsiClient({
|
|
151
|
+
accessToken: initialToken,
|
|
152
|
+
onTokenRefresh: async () => {
|
|
153
|
+
const response = await fetch('https://login.eveonline.com/v2/oauth/token', {
|
|
154
|
+
method: 'POST',
|
|
155
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
156
|
+
body: new URLSearchParams({
|
|
157
|
+
grant_type: 'refresh_token',
|
|
158
|
+
refresh_token: myRefreshToken,
|
|
159
|
+
client_id: myClientId,
|
|
160
|
+
}),
|
|
161
|
+
});
|
|
162
|
+
const { access_token } = await response.json();
|
|
163
|
+
return access_token;
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Requests now auto-refresh on 401 — no manual token management needed
|
|
168
|
+
const location = await client.location.getCharacterLocation(characterId);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The token provider can also be set or changed at runtime:
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
client.setTokenProvider(myRefreshFunction);
|
|
175
|
+
client.setTokenProvider(undefined); // disable auto-refresh
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Key behaviors:
|
|
179
|
+
|
|
180
|
+
- Only retries **once** per request — if the refreshed token also gets a 401, the error is thrown
|
|
181
|
+
- **Concurrent coalescing** — if multiple requests hit 401 simultaneously, only one refresh call is made
|
|
182
|
+
- If the refresh callback throws (e.g., refresh token revoked), a `TOKEN_REFRESH_FAILED` error is raised
|
|
183
|
+
- Without a token provider, 401 errors throw immediately as before
|
|
184
|
+
|
|
185
|
+
### Environment variables reference
|
|
186
|
+
|
|
187
|
+
| Variable | Description | Default |
|
|
188
|
+
| ------------------ | -------------------------------------------- | ------------------------- |
|
|
189
|
+
| `ESI_ACCESS_TOKEN` | EVE SSO access token | none |
|
|
190
|
+
| `ESI_CLIENT_ID` | User-Agent identifier | `esi-client` |
|
|
191
|
+
| `ESI_BASE_URL` | ESI API base URL | `https://esi.evetech.net` |
|
|
192
|
+
| `ESI_LOG_LEVEL` | Log level (`error`, `warn`, `info`, `debug`) | `warn` |
|
|
193
|
+
|
|
194
|
+
## Available APIs
|
|
195
|
+
|
|
196
|
+
All clients are accessed as properties on the `EsiClient` instance. Authenticated endpoints require an access token.
|
|
197
|
+
|
|
198
|
+
| Client | Property | Auth | Examples |
|
|
199
|
+
| -------------- | ---------------------- | ---- | -------------------------------------------------------- |
|
|
200
|
+
| Alliance | `client.alliance` | Some | `getAlliances()`, `getAllianceById(id)` |
|
|
201
|
+
| Assets | `client.assets` | Yes | `getCharacterAssets(id)` |
|
|
202
|
+
| Calendar | `client.calendar` | Yes | `getCharacterCalendar(id)` |
|
|
203
|
+
| Characters | `client.characters` | Some | `getCharacterPublicInfo(id)`, `getCharacterPortrait(id)` |
|
|
204
|
+
| Clones | `client.clones` | Yes | `getCharacterClones(id)` |
|
|
205
|
+
| Contacts | `client.contacts` | Yes | `getCharacterContacts(id)` |
|
|
206
|
+
| Contracts | `client.contracts` | Yes | `getCharacterContracts(id)` |
|
|
207
|
+
| Corporations | `client.corporations` | Some | `getCorporationInfo(id)`, `getCorporationMembers(id)` |
|
|
208
|
+
| Dogma | `client.dogma` | No | `getDogmaAttributes()`, `getDogmaEffects()` |
|
|
209
|
+
| Factions | `client.factions` | Some | `getFactionWarStats()` |
|
|
210
|
+
| Fittings | `client.fittings` | Yes | `getFittings(id)`, `createFitting(id, body)` |
|
|
211
|
+
| Fleets | `client.fleets` | Yes | `getFleet(id)`, `getFleetMembers(id)` |
|
|
212
|
+
| Incursions | `client.incursions` | No | `getIncursions()` |
|
|
213
|
+
| Industry | `client.industry` | Some | `getCharacterIndustryJobs(id)` |
|
|
214
|
+
| Insurance | `client.insurance` | No | `getInsurancePrices()` |
|
|
215
|
+
| Killmails | `client.killmails` | Some | `getKillmail(id, hash)` |
|
|
216
|
+
| Location | `client.location` | Yes | `getCharacterLocation(id)` |
|
|
217
|
+
| Loyalty | `client.loyalty` | Yes | `getCharacterLoyaltyPoints(id)` |
|
|
218
|
+
| Mail | `client.mail` | Yes | `getCharacterMail(id)` |
|
|
219
|
+
| Market | `client.market` | Some | `getMarketPrices()`, `getMarketOrders(regionId)` |
|
|
220
|
+
| PI | `client.pi` | Yes | `getCharacterPlanets(id)` |
|
|
221
|
+
| Route | `client.route` | No | `getRoute(origin, destination)` |
|
|
222
|
+
| Search | `client.search` | Some | `search(characterId, query)` |
|
|
223
|
+
| Skills | `client.skills` | Yes | `getCharacterSkills(id)` |
|
|
224
|
+
| Sovereignty | `client.sovereignty` | No | `getSovereigntySystems()`, `getSovereigntyMap()` |
|
|
225
|
+
| Skyhooks | `client.skyhooks` | No | `getSovereigntyHubs()`, `getRaidableSkyhooks()` |
|
|
226
|
+
| Mercenary | `client.mercenary` | No | `getMercenaryDens()`, `getMercenaryTacticalOperations()` |
|
|
227
|
+
| Access Lists | `client.accessLists` | Yes | `getAccessList(id)` |
|
|
228
|
+
| Status | `client.status` | No | `getStatus()` |
|
|
229
|
+
| UI | `client.ui` | Yes | `setWaypoint(id)` |
|
|
230
|
+
| Universe | `client.universe` | Some | `getSystemById(id)`, `getTypeById(id)` |
|
|
231
|
+
| Wallet | `client.wallet` | Yes | `getCharacterWallet(id)` |
|
|
232
|
+
| Wars | `client.wars` | No | `getWars()`, `getWarById(id)` |
|
|
233
|
+
| Freelance Jobs | `client.freelanceJobs` | Some | `getFreelanceJobs()`, `getFreelanceJobById(id)` |
|
|
234
|
+
| Meta | `client.meta` | No | `getOpenApiJson()`, `getOpenApiYaml()` |
|
|
235
|
+
|
|
236
|
+
## Caching
|
|
237
|
+
|
|
238
|
+
ETag caching is enabled by default. The client automatically:
|
|
239
|
+
|
|
240
|
+
1. Stores ETag and response data on GET requests
|
|
241
|
+
2. Sends `If-None-Match` on subsequent requests
|
|
242
|
+
3. Returns cached data on `304 Not Modified`
|
|
243
|
+
4. Parses `Cache-Control: max-age` from ESI for per-endpoint TTL
|
|
244
|
+
5. Serves stale cached data when ESI returns 5xx errors
|
|
245
|
+
6. Invalidates related GET caches when POST/PUT/DELETE requests are made
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// Cache stats
|
|
249
|
+
const stats = client.getCacheStats();
|
|
250
|
+
console.log(`${stats.totalEntries}/${stats.maxEntries} entries cached`);
|
|
251
|
+
|
|
252
|
+
// Manual cache operations
|
|
253
|
+
client.clearCache();
|
|
254
|
+
client.updateCacheConfig({ maxEntries: 2000 });
|
|
255
|
+
|
|
256
|
+
// Disable caching entirely
|
|
257
|
+
const uncachedClient = new EsiClient({ enableETagCache: false });
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Cursor-based Pagination
|
|
261
|
+
|
|
262
|
+
Newer ESI routes (Freelance Jobs, and future routes) use cursor-based pagination with opaque `before`/`after` tokens in the response body. See the [ESI blog post](https://developers.eveonline.com/blog/changing-pagination-turning-a-new-page) for background.
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
import { EsiClient, fetchAllCursorPages } from '@lgriffin/esi.ts';
|
|
266
|
+
|
|
267
|
+
const client = new EsiClient();
|
|
268
|
+
|
|
269
|
+
// Fetch first page — returns { cursor: { before, after }, freelance_jobs: [...] }
|
|
270
|
+
const page = await client.freelanceJobs.getFreelanceJobs();
|
|
271
|
+
console.log(page.freelance_jobs); // job records
|
|
272
|
+
console.log(page.cursor.after); // opaque token for next page
|
|
273
|
+
|
|
274
|
+
// Fetch next page using the cursor
|
|
275
|
+
const nextPage = await client.freelanceJobs.getFreelanceJobs(
|
|
276
|
+
undefined,
|
|
277
|
+
page.cursor.after,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// Auto-fetch all pages in one call
|
|
281
|
+
const allJobs = await fetchAllCursorPages(
|
|
282
|
+
(before, after) => client.freelanceJobs.getFreelanceJobs(before, after),
|
|
283
|
+
(response) => response.freelance_jobs,
|
|
284
|
+
(response) => response.cursor,
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
// Authenticated endpoints — character/corporation freelance jobs
|
|
288
|
+
const authedClient = new EsiClient({ accessToken: 'your-token' });
|
|
289
|
+
const myJobs =
|
|
290
|
+
await authedClient.freelanceJobs.getCharacterFreelanceJobs(characterId);
|
|
291
|
+
const corpJobs =
|
|
292
|
+
await authedClient.freelanceJobs.getCorporationFreelanceJobs(corporationId);
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Polling for changes** — cursor tokens persist across sessions, so you can save the last `after` token and poll later to get only records that changed:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// After initial scan, save the final cursor
|
|
299
|
+
let savedCursor = lastPage.cursor.after;
|
|
300
|
+
|
|
301
|
+
// Later: check for updates (hours, days, or weeks later)
|
|
302
|
+
const updates = await client.freelanceJobs.getFreelanceJobs(
|
|
303
|
+
undefined,
|
|
304
|
+
savedCursor,
|
|
305
|
+
);
|
|
306
|
+
if (updates.freelance_jobs.length > 0) {
|
|
307
|
+
// Process changed records — duplicates are expected for modified records
|
|
308
|
+
savedCursor = updates.cursor.after;
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Key points:
|
|
313
|
+
|
|
314
|
+
- Cursor tokens are **opaque strings** — never parse or validate them
|
|
315
|
+
- An **empty result array** signals the end of the dataset (not a short page)
|
|
316
|
+
- **Duplicates across pages** are expected when records are modified between requests
|
|
317
|
+
- Existing offset-based routes (`getMarketOrders`, etc.) are unchanged
|
|
318
|
+
|
|
319
|
+
## Error Handling
|
|
320
|
+
|
|
321
|
+
API errors throw `EsiError` with `statusCode`, `message`, and `url` properties:
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
import { EsiError } from '@lgriffin/esi.ts';
|
|
325
|
+
|
|
326
|
+
try {
|
|
327
|
+
const alliance = await client.alliance.getAllianceById(99999999);
|
|
328
|
+
console.log('Alliance:', alliance.name);
|
|
329
|
+
} catch (err) {
|
|
330
|
+
if (err instanceof EsiError) {
|
|
331
|
+
console.log(`ESI error ${err.statusCode}: ${err.message}`);
|
|
332
|
+
// e.g. "ESI error 404: Resource not found"
|
|
333
|
+
} else {
|
|
334
|
+
console.error('Network or parse error:', err);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
- **204 No Content** — returns `undefined` (valid for DELETE/POST actions)
|
|
340
|
+
- **304 Not Modified** — handled internally, returns cached data
|
|
341
|
+
- **4xx/5xx** — throws `EsiError`
|
|
342
|
+
- **5xx with cache** — returns stale cached data instead of throwing
|
|
343
|
+
|
|
344
|
+
## Lightweight Clients
|
|
345
|
+
|
|
346
|
+
If you only need a subset of APIs, use `CustomEsiClient` or `EsiClientBuilder` to load only what you need:
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
import { EsiClientBuilder } from '@lgriffin/esi.ts';
|
|
350
|
+
|
|
351
|
+
const client = new EsiClientBuilder()
|
|
352
|
+
.addClients(['market', 'universe', 'characters'])
|
|
353
|
+
.withClientId('my-trading-bot')
|
|
354
|
+
.withAccessToken('your-token')
|
|
355
|
+
.build();
|
|
356
|
+
|
|
357
|
+
const prices = await client.market?.getMarketPrices();
|
|
358
|
+
const system = await client.universe?.getSystemById(30000142);
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Or create standalone single-API clients:
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
import { EsiApiFactory } from '@lgriffin/esi.ts';
|
|
365
|
+
|
|
366
|
+
const marketClient = EsiApiFactory.createMarketClient({
|
|
367
|
+
clientId: 'price-checker',
|
|
368
|
+
});
|
|
369
|
+
const prices = await marketClient.getMarketPrices();
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Examples
|
|
373
|
+
|
|
374
|
+
Runnable examples are in the `examples/` directory.
|
|
375
|
+
|
|
376
|
+
### Public Endpoints (no auth needed)
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
npm run example:status # Server status — quickest smoke test
|
|
380
|
+
npm run example:character # Character public info, portrait, corporation
|
|
381
|
+
npm run example:universe # Solar system, constellation, region, station
|
|
382
|
+
npm run example:market # Average prices + Tritanium price history
|
|
383
|
+
npm run example:alliance # Alliance info + member corporations
|
|
384
|
+
npm run example:route # Jita-to-Amarr route with system names
|
|
385
|
+
npm run example:wars # Recent wars with aggressor/defender details
|
|
386
|
+
npm run example:sovereignty # Nullsec sovereignty map + active campaigns
|
|
387
|
+
npm run example:industry # Industry facilities, cost indices, insurance
|
|
388
|
+
npm run example:incursions # Active incursions + faction warfare stats
|
|
389
|
+
npm run example:dogma # Item type details + dogma attributes
|
|
390
|
+
npm run example:contracts # Public region contracts + auction bids/items
|
|
391
|
+
npm run example:rate-limiting # Rate limiter & pagination demonstration
|
|
392
|
+
npm run example:cursor-pagination # Freelance Jobs with cursor pagination
|
|
393
|
+
npm run example:token-refresh # Automatic token refresh on 401
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Authenticated Endpoints (require ESI_ACCESS_TOKEN)
|
|
397
|
+
|
|
398
|
+
These examples require an EVE SSO token with the listed scopes. Set `ESI_ACCESS_TOKEN` in your environment or `.env` file.
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
npm run example # Full character profile assembly
|
|
402
|
+
npm run example:wallet # Wallet balance, journal, transactions (esi-wallet.read_character_wallet.v1)
|
|
403
|
+
npm run example:skills # Trained skills, queue, attributes (esi-skills.read_skills.v1, esi-skills.read_skillqueue.v1)
|
|
404
|
+
npm run example:assets # Asset inventory with bulk name lookup (esi-assets.read_assets.v1)
|
|
405
|
+
npm run example:killmails # Recent killmails + full details (esi-killmails.read_killmails.v1)
|
|
406
|
+
npm run example:fleet # Fleet info, members, wing/squad structure (esi-fleets.read_fleet.v1)
|
|
407
|
+
npm run example:mail # Inbox headers, labels, mailing lists (esi-mail.read_mail.v1)
|
|
408
|
+
npm run example:location # Current system, online status, ship (esi-location.read_location.v1)
|
|
409
|
+
npm run example:fittings # Saved fittings + clone state + implants (esi-fittings.read_fittings.v1, esi-clones.read_clones.v1)
|
|
410
|
+
npm run example:contacts # Contact list with standings + labels (esi-characters.read_contacts.v1)
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Parallel Requests
|
|
414
|
+
|
|
415
|
+
```typescript
|
|
416
|
+
const [character, portrait, corp] = await Promise.all([
|
|
417
|
+
client.characters.getCharacterPublicInfo(characterId),
|
|
418
|
+
client.characters.getCharacterPortrait(characterId),
|
|
419
|
+
client.corporations.getCorporationInfo(corporationId),
|
|
420
|
+
]);
|
|
421
|
+
|
|
422
|
+
console.log(`${character.name} [${corp.ticker}]`);
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Market Analysis
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
const [orders, history] = await Promise.all([
|
|
429
|
+
client.market.getMarketOrders(regionId),
|
|
430
|
+
client.market.getMarketHistory(regionId, typeId),
|
|
431
|
+
]);
|
|
432
|
+
|
|
433
|
+
const buyOrders = orders.filter((o) => o.is_buy_order);
|
|
434
|
+
const sellOrders = orders.filter((o) => !o.is_buy_order);
|
|
435
|
+
|
|
436
|
+
console.log(`Best buy: ${Math.max(...buyOrders.map((o) => o.price))}`);
|
|
437
|
+
console.log(`Best sell: ${Math.min(...sellOrders.map((o) => o.price))}`);
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Resource Management
|
|
441
|
+
|
|
442
|
+
Always call `shutdown()` when you're done to clean up cache timers:
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
const client = new EsiClient();
|
|
446
|
+
try {
|
|
447
|
+
const status = await client.status.getStatus();
|
|
448
|
+
console.log(status.server_version);
|
|
449
|
+
} finally {
|
|
450
|
+
await client.shutdown();
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
## Development
|
|
455
|
+
|
|
456
|
+
### Prerequisites
|
|
457
|
+
|
|
458
|
+
- Node.js 18+
|
|
459
|
+
- npm
|
|
460
|
+
|
|
461
|
+
### Code Quality Tools
|
|
462
|
+
|
|
463
|
+
The project uses a comprehensive suite of static analysis and code quality tools:
|
|
464
|
+
|
|
465
|
+
| Tool | Purpose | Command |
|
|
466
|
+
| ------------------------------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------ |
|
|
467
|
+
| [ESLint](https://eslint.org/) | Linting with TypeScript, security, and code smell rules | `npm run lint` |
|
|
468
|
+
| [Prettier](https://prettier.io/) | Code formatting | `npm run format:check` |
|
|
469
|
+
| [knip](https://knip.dev/) | Dead code and unused export detection | `npm run knip` |
|
|
470
|
+
| [eslint-plugin-security](https://github.com/eslint-community/eslint-plugin-security) | Security anti-pattern detection | Integrated into `npm run lint` |
|
|
471
|
+
| [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs) | Cognitive complexity and code smell detection | Integrated into `npm run lint` |
|
|
472
|
+
| [husky](https://typicode.github.io/husky/) | Git pre-commit hooks | Automatic on commit |
|
|
473
|
+
| [lint-staged](https://github.com/lint-staged/lint-staged) | Run linters on staged files only | Automatic on commit |
|
|
474
|
+
|
|
475
|
+
### Available Scripts
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
# Development
|
|
479
|
+
npm run build # Compile TypeScript
|
|
480
|
+
npm run lint # Run ESLint
|
|
481
|
+
npm run lint:fix # Run ESLint with auto-fix
|
|
482
|
+
npm run format # Format code with Prettier
|
|
483
|
+
npm run format:check # Check formatting without modifying
|
|
484
|
+
|
|
485
|
+
# Testing
|
|
486
|
+
npm test # Unit tests
|
|
487
|
+
npm run test:all # Unit + improved + BDD tests
|
|
488
|
+
npm run coverage # Tests with coverage report (thresholds enforced)
|
|
489
|
+
npm run bdd # BDD scenario tests
|
|
490
|
+
|
|
491
|
+
# Static Analysis
|
|
492
|
+
npm run knip # Detect dead code and unused exports
|
|
493
|
+
npm run validate:esi # Validate endpoints against live ESI swagger spec
|
|
494
|
+
npm run validate # Run all checks: lint, format, build, coverage, knip
|
|
495
|
+
|
|
496
|
+
# Documentation
|
|
497
|
+
npm run docs # Generate TypeDoc API documentation
|
|
498
|
+
npm run docs:serve # Serve docs locally on port 8080
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### ESI Endpoint Validation
|
|
502
|
+
|
|
503
|
+
To verify that the codebase endpoint definitions match the live ESI swagger spec:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
npm run validate:esi
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
This fetches `https://esi.evetech.net/latest/swagger.json` and reports:
|
|
510
|
+
|
|
511
|
+
- Endpoints in the codebase that are no longer in the ESI spec
|
|
512
|
+
- Endpoints in the ESI spec that the codebase doesn't cover
|
|
513
|
+
- HTTP method mismatches between codebase and spec
|
|
514
|
+
|
|
515
|
+
### Pre-commit Hooks
|
|
516
|
+
|
|
517
|
+
The project uses husky with lint-staged to run ESLint and Prettier on staged files before each commit. This is set up automatically when you run `npm install`.
|
|
518
|
+
|
|
519
|
+
### CI/CD
|
|
520
|
+
|
|
521
|
+
Every pull request runs the full validation suite:
|
|
522
|
+
|
|
523
|
+
- ESLint (with security and sonarjs plugins)
|
|
524
|
+
- Prettier formatting check
|
|
525
|
+
- TypeScript compilation
|
|
526
|
+
- Unit tests across Node.js 18, 20, and 22
|
|
527
|
+
- BDD scenario tests
|
|
528
|
+
- Coverage threshold enforcement (branches: 50%, functions: 50%, lines: 65%, statements: 65%)
|
|
529
|
+
- Dead code detection via knip
|
|
530
|
+
- npm security audit
|
|
531
|
+
|
|
532
|
+
See [.github/workflows/README.md](.github/workflows/README.md) for full workflow details.
|
|
533
|
+
|
|
534
|
+
## Testing
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
npm test # Unit + integration tests (73 suites, 577 tests)
|
|
538
|
+
npm run coverage # Tests with coverage report (thresholds enforced)
|
|
539
|
+
npm run bdd # BDD scenario tests only
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
To verify against the live ESI API:
|
|
543
|
+
|
|
544
|
+
```bash
|
|
545
|
+
npm run example:status # Confirms ESI connectivity and server status
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
## Contributing
|
|
549
|
+
|
|
550
|
+
1. Fork the repository
|
|
551
|
+
2. Create a feature branch
|
|
552
|
+
3. Write tests for your changes
|
|
553
|
+
4. Run `npm run validate` to check everything passes
|
|
554
|
+
5. Open a Pull Request
|
|
555
|
+
|
|
556
|
+
## License
|
|
557
|
+
|
|
558
|
+
GPL-3.0-or-later - see the [LICENSE](LICENSE) file for details.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
**o7**
|