@lgriffin/esi.ts 5.1.0 → 6.0.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 +60 -0
- package/README.md +271 -9
- package/dist/EsiClient.d.ts +7 -0
- package/dist/EsiClient.d.ts.map +1 -1
- package/dist/EsiClient.js +19 -0
- package/dist/clients/AssetsClient.d.ts +3 -0
- package/dist/clients/AssetsClient.d.ts.map +1 -1
- package/dist/clients/AssetsClient.js +6 -0
- package/dist/clients/BaseEsiClient.d.ts +3 -1
- package/dist/clients/BaseEsiClient.d.ts.map +1 -1
- package/dist/clients/BaseEsiClient.js +7 -0
- package/dist/clients/ContractsClient.d.ts +4 -0
- package/dist/clients/ContractsClient.d.ts.map +1 -1
- package/dist/clients/ContractsClient.js +9 -0
- package/dist/clients/KillmailsClient.d.ts +3 -0
- package/dist/clients/KillmailsClient.d.ts.map +1 -1
- package/dist/clients/KillmailsClient.js +6 -0
- package/dist/clients/MarketClient.d.ts +7 -0
- package/dist/clients/MarketClient.d.ts.map +1 -1
- package/dist/clients/MarketClient.js +18 -0
- package/dist/clients/WalletClient.d.ts +4 -0
- package/dist/clients/WalletClient.d.ts.map +1 -1
- package/dist/clients/WalletClient.js +9 -0
- package/dist/core/ApiClient.d.ts +10 -0
- package/dist/core/ApiClient.d.ts.map +1 -1
- package/dist/core/ApiClient.js +21 -0
- package/dist/core/ApiRequestHandler.d.ts +4 -1
- package/dist/core/ApiRequestHandler.d.ts.map +1 -1
- package/dist/core/ApiRequestHandler.js +116 -41
- package/dist/core/BatchRequestHandler.d.ts +12 -0
- package/dist/core/BatchRequestHandler.d.ts.map +1 -0
- package/dist/core/BatchRequestHandler.js +66 -0
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/endpoints/EndpointDefinition.d.ts +3 -0
- package/dist/core/endpoints/EndpointDefinition.d.ts.map +1 -1
- package/dist/core/endpoints/accessListEndpoints.d.ts +16 -0
- package/dist/core/endpoints/accessListEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/accessListEndpoints.js +2 -0
- package/dist/core/endpoints/allianceEndpoints.d.ts +14 -0
- package/dist/core/endpoints/allianceEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/allianceEndpoints.js +3 -0
- package/dist/core/endpoints/assetEndpoints.d.ts +27 -0
- package/dist/core/endpoints/assetEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/assetEndpoints.js +5 -0
- package/dist/core/endpoints/buildEndpointPath.d.ts +7 -0
- package/dist/core/endpoints/buildEndpointPath.d.ts.map +1 -0
- package/dist/core/endpoints/buildEndpointPath.js +44 -0
- package/dist/core/endpoints/calendarEndpoints.d.ts +40 -0
- package/dist/core/endpoints/calendarEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/calendarEndpoints.js +5 -0
- package/dist/core/endpoints/characterEndpoints.d.ts +105 -0
- package/dist/core/endpoints/characterEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/characterEndpoints.js +13 -0
- package/dist/core/endpoints/cloneEndpoints.d.ts +21 -0
- package/dist/core/endpoints/cloneEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/cloneEndpoints.js +2 -0
- package/dist/core/endpoints/contactEndpoints.d.ts +49 -0
- package/dist/core/endpoints/contactEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/contactEndpoints.js +8 -0
- package/dist/core/endpoints/contractEndpoints.d.ts +184 -0
- package/dist/core/endpoints/contractEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/contractEndpoints.js +11 -0
- package/dist/core/endpoints/corporationEndpoints.d.ts +192 -0
- package/dist/core/endpoints/corporationEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/corporationEndpoints.js +18 -0
- package/dist/core/endpoints/createClient.d.ts.map +1 -1
- package/dist/core/endpoints/createClient.js +29 -43
- package/dist/core/endpoints/dogmaEndpoints.d.ts +38 -0
- package/dist/core/endpoints/dogmaEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/dogmaEndpoints.js +4 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.d.ts +2 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.d.ts.map +1 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.js +126 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.ts +7 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.ts.map +1 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.js +153 -0
- package/dist/core/endpoints/esi-scopes.generated.d.ts +3 -0
- package/dist/core/endpoints/esi-scopes.generated.d.ts.map +1 -0
- package/dist/core/endpoints/esi-scopes.generated.js +127 -0
- package/dist/core/endpoints/factionEndpoints.d.ts +154 -0
- package/dist/core/endpoints/factionEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/factionEndpoints.js +10 -0
- package/dist/core/endpoints/fittingEndpoints.d.ts +12 -0
- package/dist/core/endpoints/fittingEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/fittingEndpoints.js +3 -0
- package/dist/core/endpoints/fleetEndpoints.d.ts +45 -0
- package/dist/core/endpoints/fleetEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/fleetEndpoints.js +6 -0
- package/dist/core/endpoints/freelanceJobsEndpoints.d.ts +122 -0
- package/dist/core/endpoints/freelanceJobsEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/freelanceJobsEndpoints.js +8 -0
- package/dist/core/endpoints/incursionEndpoints.d.ts +15 -0
- package/dist/core/endpoints/incursionEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/incursionEndpoints.js +3 -0
- package/dist/core/endpoints/industryEndpoints.d.ts +103 -0
- package/dist/core/endpoints/industryEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/industryEndpoints.js +10 -0
- package/dist/core/endpoints/insuranceEndpoints.d.ts +9 -0
- package/dist/core/endpoints/insuranceEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/insuranceEndpoints.js +3 -0
- package/dist/core/endpoints/killmailEndpoints.d.ts +41 -0
- package/dist/core/endpoints/killmailEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/killmailEndpoints.js +5 -0
- package/dist/core/endpoints/locationEndpoints.d.ts +16 -0
- package/dist/core/endpoints/locationEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/locationEndpoints.js +4 -0
- package/dist/core/endpoints/loyaltyEndpoints.d.ts +17 -0
- package/dist/core/endpoints/loyaltyEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/loyaltyEndpoints.js +4 -0
- package/dist/core/endpoints/mailEndpoints.d.ts +35 -0
- package/dist/core/endpoints/mailEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/mailEndpoints.js +4 -0
- package/dist/core/endpoints/marketEndpoints.d.ts +123 -0
- package/dist/core/endpoints/marketEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/marketEndpoints.js +9 -0
- package/dist/core/endpoints/mercenaryEndpoints.d.ts +24 -0
- package/dist/core/endpoints/mercenaryEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/mercenaryEndpoints.js +4 -0
- package/dist/core/endpoints/piEndpoints.d.ts +76 -0
- package/dist/core/endpoints/piEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/piEndpoints.js +5 -0
- package/dist/core/endpoints/skillEndpoints.d.ts +21 -0
- package/dist/core/endpoints/skillEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/skillEndpoints.js +5 -0
- package/dist/core/endpoints/skyhookEndpoints.d.ts +27 -0
- package/dist/core/endpoints/skyhookEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/skyhookEndpoints.js +5 -0
- package/dist/core/endpoints/sovereigntyEndpoints.d.ts +37 -0
- package/dist/core/endpoints/sovereigntyEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/sovereigntyEndpoints.js +4 -0
- package/dist/core/endpoints/statusEndpoints.d.ts +6 -0
- package/dist/core/endpoints/statusEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/statusEndpoints.js +2 -0
- package/dist/core/endpoints/universeEndpoints.d.ts +272 -0
- package/dist/core/endpoints/universeEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/universeEndpoints.js +25 -0
- package/dist/core/endpoints/walletEndpoints.d.ts +51 -0
- package/dist/core/endpoints/walletEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/walletEndpoints.js +6 -0
- package/dist/core/endpoints/warEndpoints.d.ts +30 -0
- package/dist/core/endpoints/warEndpoints.d.ts.map +1 -1
- package/dist/core/endpoints/warEndpoints.js +5 -0
- package/dist/core/pagination/AsyncPaginationIterator.js +2 -2
- package/dist/core/pagination/PaginationHandler.d.ts +1 -1
- package/dist/core/pagination/PaginationHandler.d.ts.map +1 -1
- package/dist/core/pagination/PaginationHandler.js +2 -2
- package/dist/core/rateLimiter/IRateLimiter.d.ts +13 -3
- package/dist/core/rateLimiter/IRateLimiter.d.ts.map +1 -1
- package/dist/core/rateLimiter/RateLimiter.d.ts +24 -51
- package/dist/core/rateLimiter/RateLimiter.d.ts.map +1 -1
- package/dist/core/rateLimiter/RateLimiter.js +208 -98
- package/dist/core/util/error.d.ts +10 -1
- package/dist/core/util/error.d.ts.map +1 -1
- package/dist/core/util/error.js +24 -2
- package/dist/core/util/retry.d.ts +8 -0
- package/dist/core/util/retry.d.ts.map +1 -0
- package/dist/core/util/retry.js +9 -0
- package/dist/core/util/stringUtil.d.ts +2 -0
- package/dist/core/util/stringUtil.d.ts.map +1 -0
- package/dist/core/util/stringUtil.js +6 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -2
- package/dist/schemas/access-lists.d.ts +30 -0
- package/dist/schemas/access-lists.d.ts.map +1 -0
- package/dist/schemas/access-lists.js +14 -0
- package/dist/schemas/alliance.d.ts +30 -0
- package/dist/schemas/alliance.d.ts.map +1 -0
- package/dist/schemas/alliance.js +28 -0
- package/dist/schemas/assets.d.ts +28 -0
- package/dist/schemas/assets.d.ts.map +1 -0
- package/dist/schemas/assets.js +26 -0
- package/dist/schemas/calendar.d.ts +41 -0
- package/dist/schemas/calendar.d.ts.map +1 -0
- package/dist/schemas/calendar.js +43 -0
- package/dist/schemas/character.d.ts +122 -0
- package/dist/schemas/character.d.ts.map +1 -0
- package/dist/schemas/character.js +114 -0
- package/dist/schemas/clones.d.ts +23 -0
- package/dist/schemas/clones.d.ts.map +1 -0
- package/dist/schemas/clones.js +21 -0
- package/dist/schemas/common.d.ts +59 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +34 -0
- package/dist/schemas/contacts.d.ts +18 -0
- package/dist/schemas/contacts.d.ts.map +1 -0
- package/dist/schemas/contacts.js +15 -0
- package/dist/schemas/contracts.d.ts +63 -0
- package/dist/schemas/contracts.d.ts.map +1 -0
- package/dist/schemas/contracts.js +58 -0
- package/dist/schemas/corporation.d.ts +193 -0
- package/dist/schemas/corporation.d.ts.map +1 -0
- package/dist/schemas/corporation.js +178 -0
- package/dist/schemas/dogma.d.ts +40 -0
- package/dist/schemas/dogma.d.ts.map +1 -0
- package/dist/schemas/dogma.js +42 -0
- package/dist/schemas/faction-warfare.d.ts +95 -0
- package/dist/schemas/faction-warfare.d.ts.map +1 -0
- package/dist/schemas/faction-warfare.js +92 -0
- package/dist/schemas/fittings.d.ts +13 -0
- package/dist/schemas/fittings.d.ts.map +1 -0
- package/dist/schemas/fittings.js +15 -0
- package/dist/schemas/fleet.d.ts +46 -0
- package/dist/schemas/fleet.d.ts.map +1 -0
- package/dist/schemas/fleet.js +48 -0
- package/dist/schemas/freelance-jobs.d.ts +141 -0
- package/dist/schemas/freelance-jobs.d.ts.map +1 -0
- package/dist/schemas/freelance-jobs.js +99 -0
- package/dist/schemas/incursions.d.ts +16 -0
- package/dist/schemas/incursions.d.ts.map +1 -0
- package/dist/schemas/incursions.js +14 -0
- package/dist/schemas/index.d.ts +33 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +48 -0
- package/dist/schemas/industry.d.ts +73 -0
- package/dist/schemas/industry.d.ts.map +1 -0
- package/dist/schemas/industry.js +75 -0
- package/dist/schemas/insurance.d.ts +10 -0
- package/dist/schemas/insurance.d.ts.map +1 -0
- package/dist/schemas/insurance.js +12 -0
- package/dist/schemas/killmails.d.ts +38 -0
- package/dist/schemas/killmails.d.ts.map +1 -0
- package/dist/schemas/killmails.js +42 -0
- package/dist/schemas/location.d.ts +18 -0
- package/dist/schemas/location.d.ts.map +1 -0
- package/dist/schemas/location.js +20 -0
- package/dist/schemas/loyalty.d.ts +18 -0
- package/dist/schemas/loyalty.d.ts.map +1 -0
- package/dist/schemas/loyalty.js +20 -0
- package/dist/schemas/mail.d.ts +25 -0
- package/dist/schemas/mail.d.ts.map +1 -0
- package/dist/schemas/mail.js +29 -0
- package/dist/schemas/market.d.ts +29 -0
- package/dist/schemas/market.d.ts.map +1 -0
- package/dist/schemas/market.js +26 -0
- package/dist/schemas/mercenary.d.ts +25 -0
- package/dist/schemas/mercenary.d.ts.map +1 -0
- package/dist/schemas/mercenary.js +22 -0
- package/dist/schemas/pi.d.ts +77 -0
- package/dist/schemas/pi.d.ts.map +1 -0
- package/dist/schemas/pi.js +85 -0
- package/dist/schemas/skills.d.ts +18 -0
- package/dist/schemas/skills.d.ts.map +1 -0
- package/dist/schemas/skills.js +20 -0
- package/dist/schemas/skyhooks.d.ts +28 -0
- package/dist/schemas/skyhooks.d.ts.map +1 -0
- package/dist/schemas/skyhooks.js +30 -0
- package/dist/schemas/sovereignty.d.ts +45 -0
- package/dist/schemas/sovereignty.d.ts.map +1 -0
- package/dist/schemas/sovereignty.js +43 -0
- package/dist/schemas/status.d.ts +8 -0
- package/dist/schemas/status.d.ts.map +1 -0
- package/dist/schemas/status.js +10 -0
- package/dist/schemas/universe.d.ts +286 -0
- package/dist/schemas/universe.d.ts.map +1 -0
- package/dist/schemas/universe.js +245 -0
- package/dist/schemas/wallet.d.ts +27 -0
- package/dist/schemas/wallet.d.ts.map +1 -0
- package/dist/schemas/wallet.js +29 -0
- package/dist/schemas/wars.d.ts +27 -0
- package/dist/schemas/wars.d.ts.map +1 -0
- package/dist/schemas/wars.js +31 -0
- package/dist/testing/TestDataFactory.d.ts +44 -3
- package/dist/testing/TestDataFactory.d.ts.map +1 -1
- package/dist/types/access-lists.d.ts +4 -10
- package/dist/types/access-lists.d.ts.map +1 -1
- package/dist/types/alliance.d.ts +6 -24
- package/dist/types/alliance.d.ts.map +1 -1
- package/dist/types/api-responses.d.ts +1 -0
- package/dist/types/api-responses.d.ts.map +1 -1
- package/dist/types/api-responses.js +24 -0
- package/dist/types/assets.d.ts +5 -22
- package/dist/types/assets.d.ts.map +1 -1
- package/dist/types/calendar.d.ts +5 -23
- package/dist/types/calendar.d.ts.map +1 -1
- package/dist/types/character.d.ts +15 -104
- package/dist/types/character.d.ts.map +1 -1
- package/dist/types/clones.d.ts +3 -15
- package/dist/types/clones.d.ts.map +1 -1
- package/dist/types/common.d.ts +4 -12
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/contacts.d.ts +4 -11
- package/dist/types/contacts.d.ts.map +1 -1
- package/dist/types/contracts.d.ts +5 -39
- package/dist/types/contracts.d.ts.map +1 -1
- package/dist/types/corporation.d.ts +18 -166
- package/dist/types/corporation.d.ts.map +1 -1
- package/dist/types/dogma.d.ts +5 -38
- package/dist/types/dogma.d.ts.map +1 -1
- package/dist/types/faction-warfare.d.ts +8 -88
- package/dist/types/faction-warfare.d.ts.map +1 -1
- package/dist/types/fittings.d.ts +3 -11
- package/dist/types/fittings.d.ts.map +1 -1
- package/dist/types/fleet.d.ts +6 -34
- package/dist/types/fleet.d.ts.map +1 -1
- package/dist/types/freelance-jobs.d.ts +10 -91
- package/dist/types/freelance-jobs.d.ts.map +1 -1
- package/dist/types/generated/esi-spec.generated.d.ts +1763 -0
- package/dist/types/generated/esi-spec.generated.d.ts.map +1 -0
- package/dist/types/generated/esi-spec.generated.js +6 -0
- package/dist/types/incursions.d.ts +3 -10
- package/dist/types/incursions.d.ts.map +1 -1
- package/dist/types/industry.d.ts +9 -64
- package/dist/types/industry.d.ts.map +1 -1
- package/dist/types/insurance.d.ts +3 -8
- package/dist/types/insurance.d.ts.map +1 -1
- package/dist/types/killmails.d.ts +4 -36
- package/dist/types/killmails.d.ts.map +1 -1
- package/dist/types/location.d.ts +5 -16
- package/dist/types/location.d.ts.map +1 -1
- package/dist/types/loyalty.d.ts +4 -16
- package/dist/types/loyalty.d.ts.map +1 -1
- package/dist/types/mail.d.ts +4 -18
- package/dist/types/mail.d.ts.map +1 -1
- package/dist/types/market.d.ts +4 -22
- package/dist/types/market.d.ts.map +1 -1
- package/dist/types/mercenary.d.ts +4 -18
- package/dist/types/mercenary.d.ts.map +1 -1
- package/dist/types/pi.d.ts +5 -66
- package/dist/types/pi.d.ts.map +1 -1
- package/dist/types/skills.d.ts +4 -16
- package/dist/types/skills.d.ts.map +1 -1
- package/dist/types/skyhooks.d.ts +5 -26
- package/dist/types/skyhooks.d.ts.map +1 -1
- package/dist/types/sovereignty.d.ts +5 -32
- package/dist/types/sovereignty.d.ts.map +1 -1
- package/dist/types/status.d.ts +3 -6
- package/dist/types/status.d.ts.map +1 -1
- package/dist/types/universe.d.ts +26 -274
- package/dist/types/universe.d.ts.map +1 -1
- package/dist/types/wallet.d.ts +4 -25
- package/dist/types/wallet.d.ts.map +1 -1
- package/dist/types/wars.d.ts +3 -25
- package/dist/types/wars.d.ts.map +1 -1
- package/package.json +51 -46
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [6.0.0] - 2026-07-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Runtime response validation** via [Zod](https://zod.dev/) schemas — every ESI endpoint response is validated at runtime, catching shape mismatches before they propagate to consumer code
|
|
15
|
+
- Zod schemas for all 31 domain modules (133 interfaces) in `src/schemas/`, exported under the `schemas` namespace
|
|
16
|
+
- `EsiValidationError` class (extends `EsiError`) thrown when response data doesn't match the expected schema
|
|
17
|
+
- `isValidationError()` type guard for catching validation errors
|
|
18
|
+
- `validateResponse` option on `EsiClientConfig` — on by default, can be disabled globally
|
|
19
|
+
- `responseSchema` field on `EndpointDefinition` — wires schemas into the request pipeline via `createClient()`
|
|
20
|
+
- New developer guide: `guides/RUNTIME-VALIDATION.md`
|
|
21
|
+
- Response Validation Pipeline diagram in `guides/ARCHITECTURE.md`
|
|
22
|
+
- Comprehensive TDD tests for schema parsing, validation integration, and common schemas (94 new tests)
|
|
23
|
+
- BDD feature and step definitions for 9 runtime validation scenarios
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- All TypeScript types in `src/types/` are now derived from Zod schemas via `z.infer<>` — schemas are the single source of truth
|
|
28
|
+
- Schemas use `.passthrough()` mode so extra fields from ESI are preserved, not rejected
|
|
29
|
+
- Test mock data across 25 test files updated to be spec-accurate (required by runtime validation)
|
|
30
|
+
- Path-parameter IDs (e.g., `character_id`, `alliance_id`) are now optional in schemas, matching ESI which omits them from response bodies
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
- Added `zod` as a production dependency
|
|
35
|
+
|
|
36
|
+
## [5.3.0] - 2026-06-30
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Accept-Language configuration** — `language` option on `EsiClientConfig` injects the `Accept-Language` header for localized ESI responses (en, de, fr, ja, ru, zh, ko, es); changeable at runtime via `ApiClient.setLanguage()`
|
|
41
|
+
- **ESI scope metadata** — generated `esi-scopes.generated.ts` with `EsiScope` union type (63 scopes) and `esiEndpointScopes` record mapping 119 authenticated endpoints to their required OAuth scopes
|
|
42
|
+
- Exported `EsiScope` type and `esiEndpointScopes` map from package root
|
|
43
|
+
- **Streaming pagination** — `stream*` methods on domain clients yield `PageResult<T>` one page at a time via `AsyncGenerator`, enabling backpressure and early termination for large paginated datasets
|
|
44
|
+
- Streaming methods added to `MarketClient` (6), `ContractsClient` (3), `WalletClient` (3), `AssetsClient` (2), `KillmailsClient` (2)
|
|
45
|
+
- `buildEndpointPath()` utility extracted from `createClient.ts` and exported from package root
|
|
46
|
+
- `streamEndpoint()` protected method on `BaseEsiClient` for building custom streaming domain clients
|
|
47
|
+
- Streaming pagination example (`npm run example:streaming`)
|
|
48
|
+
|
|
49
|
+
## [5.2.0] - 2026-06-29
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- **Spec-driven type generation** from ESI swagger spec (`npm run generate:types`) — 147 TypeScript interfaces + cache TTL map for 119 endpoints
|
|
54
|
+
- **Spec-aware cache bypass** — GET requests within ESI-specified `x-cached-seconds` TTL return cached data with zero HTTP calls, layered on top of ETag caching
|
|
55
|
+
- **`batch()` and `batchPost()` methods** on `EsiClient` — bounded concurrency for multi-ID fetches, auto-chunking for POST endpoints
|
|
56
|
+
- **`EsiSpec` namespace export** with generated response types alongside hand-written types
|
|
57
|
+
- **Type drift detection** in `npm run validate:esi` — compares hand-written types against generated spec types
|
|
58
|
+
- CI step to verify generated types are up to date
|
|
59
|
+
- **Retry with exponential backoff** — configurable retry for transient 5xx, timeout, and rate limit errors with jitter; respects circuit breaker state; GET-only by default with `retryMutations` opt-in
|
|
60
|
+
- **`TimeoutError`** subclass of `EsiError` — typed timeout errors with `timeoutMs` property; per-request timeout override via `handleRequest()`
|
|
61
|
+
- **Enhanced response metadata** via `withMetadata()` — rate limit info (`RateLimitMeta`), response timing (`responseTimeMs`), and cache hit type (`cacheHitType`: `'spec-ttl'` | `'etag-304'` | `'stale-on-error'`)
|
|
62
|
+
- `RetryConfig` interface and `retryConfig` option on `EsiClientConfig`
|
|
63
|
+
- `CircuitOpenError` passthrough in request handler (previously wrapped as generic Error)
|
|
64
|
+
- **Per-group rate limiting** — 36 ESI rate limit groups extracted from the OpenAPI meta spec at build time; each group gets its own token bucket instead of a single global counter, preventing a burst of market requests from starving unrelated endpoints
|
|
65
|
+
- **Optional per-user bucketing** — `userKeyExtractor` config option creates separate bucket sets per user key, supporting multi-character EVE applications
|
|
66
|
+
- **Group-aware rate limit status** — `getGroupStatus(group)` and `getAllGroupStatuses()` methods for fine-grained rate limit monitoring; `isBlocked(group?)` accepts an optional group name
|
|
67
|
+
- Generated `esi-rate-limit-groups.generated.ts` with 146 endpoint-to-group mappings
|
|
68
|
+
- Exported `RateLimitGroupStatus` and `RateLimitGroupSpec` types
|
|
69
|
+
|
|
10
70
|
## [5.1.0] - 2026-06-26
|
|
11
71
|
|
|
12
72
|
### Added
|
package/README.md
CHANGED
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
A type-safe TypeScript client for the [EVE Online ESI API](https://esi.evetech.net/).
|
|
12
12
|
|
|
13
|
-
- Typed responses for all endpoints
|
|
13
|
+
- Typed responses for all endpoints with **runtime validation** via Zod schemas
|
|
14
|
+
- Spec-driven type generation from ESI swagger spec (147 interfaces)
|
|
14
15
|
- ETag caching with Cache-Control TTL, stale-on-error, and write invalidation
|
|
15
|
-
-
|
|
16
|
+
- Spec-aware cache TTLs — zero-request cache hits within ESI-specified windows
|
|
17
|
+
- Batch requests with bounded concurrency and auto-chunking
|
|
18
|
+
- Automatic offset-based pagination, cursor-based pagination, and streaming pagination support
|
|
16
19
|
- Rate limiting with header-driven backoff
|
|
17
20
|
- Automatic token refresh with 401 retry and concurrent coalescing
|
|
18
21
|
- 35 domain clients covering the full ESI surface
|
|
@@ -74,17 +77,26 @@ const client = new EsiClient({
|
|
|
74
77
|
accessToken: 'your-token', // EVE SSO token for authenticated endpoints
|
|
75
78
|
baseUrl: 'https://esi.evetech.net', // ESI base URL (default)
|
|
76
79
|
onTokenRefresh: async () => newToken, // Auto-refresh on 401 (optional)
|
|
80
|
+
language: 'en', // Accept-Language header: en, de, fr, ja, ru, zh, ko, es (default: none)
|
|
77
81
|
timeout: 30000, // Request timeout in ms (default: 30000)
|
|
78
|
-
|
|
82
|
+
retryConfig: {
|
|
83
|
+
maxRetries: 3, // Max retry attempts for transient errors (default: 0)
|
|
84
|
+
baseDelayMs: 1000, // Initial backoff delay (default: 1000)
|
|
85
|
+
maxDelayMs: 30000, // Maximum backoff delay (default: 30000)
|
|
86
|
+
retryMutations: false, // Retry POST/PUT/DELETE (default: false, GET only)
|
|
87
|
+
},
|
|
79
88
|
enableETagCache: true, // ETag caching (default: true)
|
|
80
89
|
etagCacheConfig: {
|
|
81
90
|
maxEntries: 1000, // Max cached responses (default: 1000)
|
|
82
91
|
defaultTtl: 300000, // Fallback TTL in ms (default: 5 min)
|
|
83
92
|
cleanupInterval: 60000, // Expired entry cleanup interval (default: 1 min)
|
|
84
93
|
},
|
|
94
|
+
validateResponse: true, // Runtime Zod validation of ESI responses (default: true)
|
|
85
95
|
});
|
|
86
96
|
```
|
|
87
97
|
|
|
98
|
+
Retry is disabled by default (`maxRetries: 0`). When enabled, transient errors (502, 503, 504, timeout, rate limit) are retried with exponential backoff and jitter. The circuit breaker is respected — requests are not retried when the circuit is open.
|
|
99
|
+
|
|
88
100
|
The access token can be updated at runtime:
|
|
89
101
|
|
|
90
102
|
```typescript
|
|
@@ -257,6 +269,173 @@ client.updateCacheConfig({ maxEntries: 2000 });
|
|
|
257
269
|
const uncachedClient = new EsiClient({ enableETagCache: false });
|
|
258
270
|
```
|
|
259
271
|
|
|
272
|
+
### Spec-Aware Cache TTLs
|
|
273
|
+
|
|
274
|
+
The library reads `x-cached-seconds` from the ESI swagger spec (119 of 195 endpoints). Within the TTL window, repeated GET requests return cached data with **zero HTTP calls** — not even a conditional GET.
|
|
275
|
+
|
|
276
|
+
This layers on top of ETag caching in three tiers:
|
|
277
|
+
|
|
278
|
+
1. **Spec TTL** — data can't have changed yet, return cached data immediately
|
|
279
|
+
2. **ETag conditional GET** — data might have changed, send `If-None-Match` to check
|
|
280
|
+
3. **Full request** — no cache entry, fetch fresh data
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
const client = new EsiClient();
|
|
284
|
+
|
|
285
|
+
// First call — fetches from ESI
|
|
286
|
+
const alliances = await client.alliance.getAlliances();
|
|
287
|
+
|
|
288
|
+
// Second call within the next 3600s — returns cached data, zero HTTP calls
|
|
289
|
+
const same = await client.alliance.getAlliances();
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Batch Requests
|
|
293
|
+
|
|
294
|
+
Fetch data for multiple IDs with bounded concurrency using `batch()`, or chunk large POST payloads with `batchPost()`:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { EsiClient } from '@lgriffin/esi.ts';
|
|
298
|
+
|
|
299
|
+
const client = new EsiClient();
|
|
300
|
+
|
|
301
|
+
// Fetch 500 type details with at most 10 concurrent requests
|
|
302
|
+
const result = await client.batch(
|
|
303
|
+
typeIds,
|
|
304
|
+
(id) => client.universe.getTypeById(id),
|
|
305
|
+
{
|
|
306
|
+
concurrency: 10,
|
|
307
|
+
onProgress: (done, total) => console.log(`${done}/${total}`),
|
|
308
|
+
},
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// result.results: Map<number, T> — successful responses
|
|
312
|
+
// result.errors: Map<number, Error> — failed requests
|
|
313
|
+
console.log(`${result.results.size} succeeded, ${result.errors.size} failed`);
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
For POST endpoints that accept arrays (e.g., `postUniverseNames` with a 1000-ID limit), `batchPost` auto-chunks and concatenates:
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
const allNames = await client.batchPost(
|
|
320
|
+
largeIdArray,
|
|
321
|
+
(chunk) => client.universe.postUniverseNames(chunk),
|
|
322
|
+
1000, // chunk size
|
|
323
|
+
);
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Runtime Response Validation
|
|
327
|
+
|
|
328
|
+
ESI.ts validates every API response at runtime using [Zod](https://zod.dev/) schemas. If CCP changes the ESI API and the response no longer matches the expected shape, you get an immediate `EsiValidationError` instead of silent data corruption.
|
|
329
|
+
|
|
330
|
+
Validation is **on by default**. Extra fields from ESI are preserved (passthrough mode), so new fields added by CCP won't break your application.
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
import {
|
|
334
|
+
EsiClient,
|
|
335
|
+
EsiValidationError,
|
|
336
|
+
isValidationError,
|
|
337
|
+
schemas,
|
|
338
|
+
} from '@lgriffin/esi.ts';
|
|
339
|
+
|
|
340
|
+
const client = new EsiClient();
|
|
341
|
+
|
|
342
|
+
// Validation happens automatically on every request
|
|
343
|
+
const character = await client.characters.getCharacterPublicInfo(12345);
|
|
344
|
+
|
|
345
|
+
// Disable validation globally if needed
|
|
346
|
+
const rawClient = new EsiClient({ validateResponse: false });
|
|
347
|
+
|
|
348
|
+
// Use schemas directly for your own validation
|
|
349
|
+
const result = schemas.CharacterInfoSchema.safeParse(someData);
|
|
350
|
+
if (result.success) {
|
|
351
|
+
console.log(result.data.name);
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
See [guides/RUNTIME-VALIDATION.md](guides/RUNTIME-VALIDATION.md) for the full guide on schemas, error handling, and extending schemas.
|
|
356
|
+
|
|
357
|
+
## Generated Types
|
|
358
|
+
|
|
359
|
+
The library includes TypeScript interfaces generated directly from the ESI swagger spec, available as the `EsiSpec` namespace. These are guaranteed to match the live spec and complement the hand-written types:
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
import { EsiSpec } from '@lgriffin/esi.ts';
|
|
363
|
+
|
|
364
|
+
// Generated type — exact spec field names and optionality
|
|
365
|
+
const order: EsiSpec.GetMarketsRegionIdOrders200Ok = {
|
|
366
|
+
order_id: 123,
|
|
367
|
+
type_id: 34,
|
|
368
|
+
price: 5.5,
|
|
369
|
+
volume_remain: 1000,
|
|
370
|
+
volume_total: 5000,
|
|
371
|
+
is_buy_order: false,
|
|
372
|
+
// ...
|
|
373
|
+
};
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
To regenerate types from the latest ESI spec:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
npm run generate:types # fetches spec, generates 147 interfaces + cache TTL map + rate limit groups + scope map
|
|
380
|
+
npm run validate:esi # reports type drift between hand-written and generated types
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## ESI Scopes
|
|
384
|
+
|
|
385
|
+
The library includes a generated scope-to-endpoint mapping extracted from the ESI swagger spec. Use it to check which OAuth scopes an endpoint requires before making a request:
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
import { esiEndpointScopes, EsiScope } from '@lgriffin/esi.ts';
|
|
389
|
+
|
|
390
|
+
// Look up scopes for a specific endpoint
|
|
391
|
+
const walletScopes = esiEndpointScopes['GET:characters/{character_id}/wallet'];
|
|
392
|
+
// → ['esi-wallet.read_character_wallet.v1']
|
|
393
|
+
|
|
394
|
+
// Check if an endpoint requires auth
|
|
395
|
+
const isPublic = !esiEndpointScopes['GET:universe/types/{type_id}'];
|
|
396
|
+
// → true (public endpoint, no scopes needed)
|
|
397
|
+
|
|
398
|
+
// Type-safe scope values
|
|
399
|
+
const scope: EsiScope = 'esi-assets.read_assets.v1';
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Streaming Pagination
|
|
403
|
+
|
|
404
|
+
For large paginated endpoints (market orders, contracts, assets), streaming yields one page at a time via `AsyncGenerator` instead of eagerly fetching all pages into memory:
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
import { EsiClient } from '@lgriffin/esi.ts';
|
|
408
|
+
|
|
409
|
+
const client = new EsiClient();
|
|
410
|
+
|
|
411
|
+
// Stream all market orders in The Forge, page by page
|
|
412
|
+
for await (const page of client.market.streamMarketOrders(10000002)) {
|
|
413
|
+
console.log(
|
|
414
|
+
`Page ${page.page}/${page.totalPages}: ${page.data.length} orders`,
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
// Process each order as it arrives
|
|
418
|
+
for (const order of page.data) {
|
|
419
|
+
if (order.is_buy_order && order.price > 1_000_000) {
|
|
420
|
+
console.log(`High-value buy: ${order.type_id} @ ${order.price} ISK`);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Early termination — stops fetching remaining pages
|
|
425
|
+
if (page.page >= 3) break;
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Available streaming methods:
|
|
430
|
+
|
|
431
|
+
- **MarketClient** — `streamMarketOrders`, `streamMarketTypes`, `streamCharacterOrderHistory`, `streamCorporationOrders`, `streamCorporationOrderHistory`, `streamMarketOrdersInStructure`
|
|
432
|
+
- **ContractsClient** — `streamPublicContracts`, `streamCharacterContracts`, `streamCorporationContracts`
|
|
433
|
+
- **WalletClient** — `streamCharacterWalletJournal`, `streamCorporationWalletJournal`, `streamCharacterWalletTransactions`
|
|
434
|
+
- **AssetsClient** — `streamCharacterAssets`, `streamCorporationAssets`
|
|
435
|
+
- **KillmailsClient** — `streamCharacterRecentKillmails`, `streamCorporationRecentKillmails`
|
|
436
|
+
|
|
437
|
+
Try it: `npm run example:streaming`
|
|
438
|
+
|
|
260
439
|
## Cursor-based Pagination
|
|
261
440
|
|
|
262
441
|
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.
|
|
@@ -321,17 +500,26 @@ Key points:
|
|
|
321
500
|
API errors throw `EsiError` with `statusCode`, `message`, and `url` properties:
|
|
322
501
|
|
|
323
502
|
```typescript
|
|
324
|
-
import {
|
|
503
|
+
import {
|
|
504
|
+
EsiError,
|
|
505
|
+
TimeoutError,
|
|
506
|
+
EsiValidationError,
|
|
507
|
+
isTimeout,
|
|
508
|
+
isRetryable,
|
|
509
|
+
isValidationError,
|
|
510
|
+
} from '@lgriffin/esi.ts';
|
|
325
511
|
|
|
326
512
|
try {
|
|
327
513
|
const alliance = await client.alliance.getAllianceById(99999999);
|
|
328
514
|
console.log('Alliance:', alliance.name);
|
|
329
515
|
} catch (err) {
|
|
330
|
-
if (err
|
|
516
|
+
if (isValidationError(err)) {
|
|
517
|
+
console.log('Response validation failed:', err.validationError);
|
|
518
|
+
} else if (isTimeout(err)) {
|
|
519
|
+
console.log(`Request timed out after ${err.timeoutMs}ms`);
|
|
520
|
+
} else if (err instanceof EsiError) {
|
|
331
521
|
console.log(`ESI error ${err.statusCode}: ${err.message}`);
|
|
332
|
-
|
|
333
|
-
} else {
|
|
334
|
-
console.error('Network or parse error:', err);
|
|
522
|
+
console.log(`Retryable: ${err.retryable}`);
|
|
335
523
|
}
|
|
336
524
|
}
|
|
337
525
|
```
|
|
@@ -340,6 +528,77 @@ try {
|
|
|
340
528
|
- **304 Not Modified** — handled internally, returns cached data
|
|
341
529
|
- **4xx/5xx** — throws `EsiError`
|
|
342
530
|
- **5xx with cache** — returns stale cached data instead of throwing
|
|
531
|
+
- **Timeout** — throws `TimeoutError` (extends `EsiError` with `statusCode: 0` and `timeoutMs`)
|
|
532
|
+
- **Retryable errors** — `EsiError.retryable` returns `true` for 502, 503, 504, 420, 429, and timeouts
|
|
533
|
+
- **Validation errors** — throws `EsiValidationError` (extends `EsiError`) when response data doesn't match the expected Zod schema
|
|
534
|
+
|
|
535
|
+
## Response Metadata
|
|
536
|
+
|
|
537
|
+
Use `withMetadata()` to get response headers, cache status, rate limit info, and timing alongside the data:
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
const metaClient = client.alliance.withMetadata();
|
|
541
|
+
const result = await metaClient.getAllianceById(99000001);
|
|
542
|
+
|
|
543
|
+
console.log(result.data.name); // "Goonswarm Federation"
|
|
544
|
+
console.log(result.meta.fromCache); // true if served from cache
|
|
545
|
+
console.log(result.meta.cacheHitType); // 'spec-ttl' | 'etag-304' | 'stale-on-error'
|
|
546
|
+
console.log(result.meta.responseTimeMs); // milliseconds
|
|
547
|
+
console.log(result.meta.rateLimit); // { remaining, limit, used, group }
|
|
548
|
+
console.log(result.meta.requestId); // ESI request ID for debugging
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
The `meta` object includes:
|
|
552
|
+
|
|
553
|
+
| Field | Type | Description |
|
|
554
|
+
| ---------------- | ------------------------ | ------------------------------------------------- |
|
|
555
|
+
| `headers` | `Record<string, string>` | Raw response headers |
|
|
556
|
+
| `fromCache` | `boolean` | Whether data was served from cache |
|
|
557
|
+
| `stale` | `boolean` | Whether cached data is stale (5xx fallback) |
|
|
558
|
+
| `cacheHitType` | `string?` | `'spec-ttl'`, `'etag-304'`, or `'stale-on-error'` |
|
|
559
|
+
| `rateLimit` | `RateLimitMeta?` | Rate limit status from ESI headers |
|
|
560
|
+
| `responseTimeMs` | `number?` | Request duration in milliseconds |
|
|
561
|
+
| `requestId` | `string?` | ESI request ID |
|
|
562
|
+
| `warning` | `object?` | ESI deprecation warning |
|
|
563
|
+
|
|
564
|
+
## Rate Limiting
|
|
565
|
+
|
|
566
|
+
ESI.ts automatically manages rate limiting using ESI's per-group token bucket system. The 36 rate limit groups from the ESI OpenAPI spec are extracted at build time, so each group (e.g., `market-order`, `char-notification`) gets its own independent bucket. A burst of market requests won't starve unrelated endpoints.
|
|
567
|
+
|
|
568
|
+
Rate limiting works out of the box with no configuration. For multi-character applications, enable per-user bucketing:
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
import { EsiClient } from '@lgriffin/esi.ts';
|
|
572
|
+
|
|
573
|
+
const client = new EsiClient({
|
|
574
|
+
rateLimiterConfig: {
|
|
575
|
+
userKeyExtractor: (headers) => headers['authorization'] ?? 'anon',
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
Monitor rate limit status per group:
|
|
581
|
+
|
|
582
|
+
```typescript
|
|
583
|
+
const limiter = client.getRateLimiter();
|
|
584
|
+
|
|
585
|
+
// Worst-case across all groups (backward-compatible)
|
|
586
|
+
const status = limiter.getStatus();
|
|
587
|
+
console.log(status.remaining, status.limit, status.group);
|
|
588
|
+
|
|
589
|
+
// Specific group
|
|
590
|
+
const marketStatus = limiter.getGroupStatus('market-order');
|
|
591
|
+
console.log(marketStatus?.remaining); // tokens remaining in this group
|
|
592
|
+
|
|
593
|
+
// All active groups
|
|
594
|
+
const all = limiter.getAllGroupStatuses();
|
|
595
|
+
for (const [group, info] of all) {
|
|
596
|
+
console.log(`${group}: ${info.remaining}/${info.limit}`);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Check if a specific group is blocked
|
|
600
|
+
console.log(limiter.isBlocked('char-notification')); // true if 429'd
|
|
601
|
+
```
|
|
343
602
|
|
|
344
603
|
## Lightweight Clients
|
|
345
604
|
|
|
@@ -390,6 +649,7 @@ npm run example:dogma # Item type details + dogma attributes
|
|
|
390
649
|
npm run example:contracts # Public region contracts + auction bids/items
|
|
391
650
|
npm run example:rate-limiting # Rate limiter & pagination demonstration
|
|
392
651
|
npm run example:cursor-pagination # Freelance Jobs with cursor pagination
|
|
652
|
+
npm run example:streaming # Streaming pagination for large datasets
|
|
393
653
|
npm run example:token-refresh # Automatic token refresh on 401
|
|
394
654
|
```
|
|
395
655
|
|
|
@@ -492,6 +752,7 @@ npm run bdd # BDD scenario tests
|
|
|
492
752
|
npm run knip # Detect dead code and unused exports
|
|
493
753
|
npm run validate:esi # Validate endpoints against live ESI swagger spec
|
|
494
754
|
npm run validate # Run all checks: lint, format, build, coverage, knip
|
|
755
|
+
npm run generate:types # Regenerate TypeScript interfaces from ESI swagger spec
|
|
495
756
|
|
|
496
757
|
# Documentation
|
|
497
758
|
npm run docs # Generate TypeDoc API documentation
|
|
@@ -523,6 +784,7 @@ Every pull request runs the full validation suite:
|
|
|
523
784
|
- ESLint (with security and sonarjs plugins)
|
|
524
785
|
- Prettier formatting check
|
|
525
786
|
- TypeScript compilation
|
|
787
|
+
- Generated types staleness check (regenerates from live ESI spec and verifies no diff)
|
|
526
788
|
- Unit tests across Node.js 18, 20, and 22
|
|
527
789
|
- BDD scenario tests
|
|
528
790
|
- Coverage threshold enforcement (branches: 50%, functions: 50%, lines: 65%, statements: 65%)
|
|
@@ -534,7 +796,7 @@ See [.github/workflows/README.md](.github/workflows/README.md) for full workflow
|
|
|
534
796
|
## Testing
|
|
535
797
|
|
|
536
798
|
```bash
|
|
537
|
-
npm test # Unit +
|
|
799
|
+
npm test # Unit + BDD tests (108 suites, 2836 tests)
|
|
538
800
|
npm run coverage # Tests with coverage report (thresholds enforced)
|
|
539
801
|
npm run bdd # BDD scenario tests only
|
|
540
802
|
```
|
package/dist/EsiClient.d.ts
CHANGED
|
@@ -38,7 +38,9 @@ import { AccessListsClient } from './clients/AccessListsClient';
|
|
|
38
38
|
import { ETagCacheConfig } from './core/cache/ETagCacheManager';
|
|
39
39
|
import { CircuitBreakerConfig } from './core/circuitBreaker/CircuitBreaker';
|
|
40
40
|
import { RateLimiterConfig } from './core/rateLimiter/RateLimiter';
|
|
41
|
+
import { RetryConfig } from './core/util/retry';
|
|
41
42
|
import { EsiDiagnostics } from './core/EsiDiagnostics';
|
|
43
|
+
import { BatchOptions, BatchResult } from './core/BatchRequestHandler';
|
|
42
44
|
export type EsiDatasource = 'tranquility' | 'singularity';
|
|
43
45
|
export interface EsiClientConfig {
|
|
44
46
|
clientId?: string;
|
|
@@ -48,15 +50,18 @@ export interface EsiClientConfig {
|
|
|
48
50
|
onTokenRefresh?: TokenProvider;
|
|
49
51
|
timeout?: number;
|
|
50
52
|
retryAttempts?: number;
|
|
53
|
+
retryConfig?: RetryConfig;
|
|
51
54
|
enableETagCache?: boolean;
|
|
52
55
|
etagCacheConfig?: ETagCacheConfig;
|
|
53
56
|
enableCircuitBreaker?: boolean;
|
|
54
57
|
circuitBreakerConfig?: CircuitBreakerConfig;
|
|
55
58
|
unsafeAllowCustomHost?: boolean;
|
|
56
59
|
enableRequestDeduplication?: boolean;
|
|
60
|
+
language?: string;
|
|
57
61
|
rateLimiterConfig?: RateLimiterConfig;
|
|
58
62
|
requestInterceptors?: RequestInterceptor[];
|
|
59
63
|
responseInterceptors?: ResponseInterceptor[];
|
|
64
|
+
validateResponse?: boolean;
|
|
60
65
|
}
|
|
61
66
|
export declare class EsiClient {
|
|
62
67
|
private apiClient;
|
|
@@ -111,6 +116,8 @@ export declare class EsiClient {
|
|
|
111
116
|
updateCacheConfig(newConfig: Partial<ETagCacheConfig>): void;
|
|
112
117
|
getCircuitBreakerStats(): import(".").CircuitBreakerStats | null;
|
|
113
118
|
resetCircuitBreaker(endpoint?: string): void;
|
|
119
|
+
batch<K, T>(keys: K[], fetcher: (key: K) => Promise<T>, options?: BatchOptions): Promise<BatchResult<K, T>>;
|
|
120
|
+
batchPost<T>(ids: number[], poster: (chunk: number[]) => Promise<T[]>, chunkSize?: number): Promise<T[]>;
|
|
114
121
|
shutdown(): void;
|
|
115
122
|
}
|
|
116
123
|
export declare function getDefaultClient(): EsiClient;
|
package/dist/EsiClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EsiClient.d.ts","sourceRoot":"","sources":["../src/EsiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,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IACD,IAAI,QAAQ,IAAI,cAAc,CAE7B;IACD,IAAI,SAAS,IAAI,eAAe,CAE/B;IACD,IAAI,WAAW,IAAI,iBAAiB,CAEnC;IAED,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,GAAG,MAAM,IAAI;IAIzD,sBAAsB,CAAC,EAAE,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAI3D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKnC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAO3D,IAAI,WAAW,IAAI,cAAc,CAShC;IAED,aAAa;IAIb,UAAU,IAAI,IAAI;IAIlB,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAI5D,sBAAsB;IAItB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAItC,KAAK,CAAC,CAAC,EAAE,CAAC,EACd,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAC/B,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAIvB,SAAS,CAAC,CAAC,EACf,GAAG,EAAE,MAAM,EAAE,EACb,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,EACzC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,EAAE,CAAC;IAIf,QAAQ,IAAI,IAAI;CAejB;AAGD,wBAAgB,gBAAgB,IAAI,SAAS,CAK5C"}
|
package/dist/EsiClient.js
CHANGED
|
@@ -13,6 +13,7 @@ const CircuitBreaker_1 = require("./core/circuitBreaker/CircuitBreaker");
|
|
|
13
13
|
const RateLimiter_1 = require("./core/rateLimiter/RateLimiter");
|
|
14
14
|
const RequestDeduplicator_1 = require("./core/RequestDeduplicator");
|
|
15
15
|
const EsiDiagnostics_1 = require("./core/EsiDiagnostics");
|
|
16
|
+
const BatchRequestHandler_1 = require("./core/BatchRequestHandler");
|
|
16
17
|
const logger_1 = __importDefault(require("./core/logger/logger"));
|
|
17
18
|
class EsiClient {
|
|
18
19
|
apiClient;
|
|
@@ -29,6 +30,9 @@ class EsiClient {
|
|
|
29
30
|
if (datasource) {
|
|
30
31
|
this.apiClient.setDatasource(datasource);
|
|
31
32
|
}
|
|
33
|
+
if (config?.language) {
|
|
34
|
+
this.apiClient.setLanguage(config.language);
|
|
35
|
+
}
|
|
32
36
|
if (config?.timeout !== undefined) {
|
|
33
37
|
this.apiClient.setTimeout(config.timeout);
|
|
34
38
|
}
|
|
@@ -47,6 +51,12 @@ class EsiClient {
|
|
|
47
51
|
if (config?.enableCircuitBreaker) {
|
|
48
52
|
this.apiClient.setCircuitBreaker(new CircuitBreaker_1.CircuitBreaker(config.circuitBreakerConfig));
|
|
49
53
|
}
|
|
54
|
+
if (config?.retryConfig) {
|
|
55
|
+
this.apiClient.setRetryConfig(config.retryConfig);
|
|
56
|
+
}
|
|
57
|
+
else if (config?.retryAttempts !== undefined) {
|
|
58
|
+
this.apiClient.setRetryConfig({ maxRetries: config.retryAttempts });
|
|
59
|
+
}
|
|
50
60
|
if (config?.requestInterceptors) {
|
|
51
61
|
for (const interceptor of config.requestInterceptors) {
|
|
52
62
|
this.apiClient.addRequestInterceptor(interceptor);
|
|
@@ -57,6 +67,9 @@ class EsiClient {
|
|
|
57
67
|
this.apiClient.addResponseInterceptor(interceptor);
|
|
58
68
|
}
|
|
59
69
|
}
|
|
70
|
+
if (config?.validateResponse !== undefined) {
|
|
71
|
+
this.apiClient.setValidateResponse(config.validateResponse);
|
|
72
|
+
}
|
|
60
73
|
logger_1.default.info('EsiClient initialized successfully');
|
|
61
74
|
}
|
|
62
75
|
getClient(name) {
|
|
@@ -206,6 +219,12 @@ class EsiClient {
|
|
|
206
219
|
resetCircuitBreaker(endpoint) {
|
|
207
220
|
this.diagnostics.resetCircuitBreaker(endpoint);
|
|
208
221
|
}
|
|
222
|
+
async batch(keys, fetcher, options) {
|
|
223
|
+
return (0, BatchRequestHandler_1.batchFetch)(keys, fetcher, options);
|
|
224
|
+
}
|
|
225
|
+
async batchPost(ids, poster, chunkSize) {
|
|
226
|
+
return (0, BatchRequestHandler_1.batchPost)(ids, poster, chunkSize);
|
|
227
|
+
}
|
|
209
228
|
shutdown() {
|
|
210
229
|
const cache = this.apiClient.getCache();
|
|
211
230
|
if (cache) {
|
|
@@ -2,6 +2,7 @@ import { ApiClient } from '../core/ApiClient';
|
|
|
2
2
|
import { BaseEsiClient } from './BaseEsiClient';
|
|
3
3
|
import { assetEndpoints } from '../core/endpoints/assetEndpoints';
|
|
4
4
|
import { CharacterAsset, AssetLocation, AssetName } from '../types/api-responses';
|
|
5
|
+
import { PageResult } from '../core/pagination/AsyncPaginationIterator';
|
|
5
6
|
export declare class AssetsClient extends BaseEsiClient<typeof assetEndpoints> {
|
|
6
7
|
constructor(client: ApiClient);
|
|
7
8
|
/**
|
|
@@ -56,5 +57,7 @@ export declare class AssetsClient extends BaseEsiClient<typeof assetEndpoints> {
|
|
|
56
57
|
* @requires Authentication
|
|
57
58
|
*/
|
|
58
59
|
postCorporationAssetNames(corporationId: number, itemIds: number[]): Promise<AssetName[]>;
|
|
60
|
+
streamCharacterAssets(characterId: number): AsyncGenerator<PageResult<CharacterAsset>, void, undefined>;
|
|
61
|
+
streamCorporationAssets(corporationId: number): AsyncGenerator<PageResult<CharacterAsset>, void, undefined>;
|
|
59
62
|
}
|
|
60
63
|
//# sourceMappingURL=AssetsClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetsClient.d.ts","sourceRoot":"","sources":["../../src/clients/AssetsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EA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AE,GAChB,OAAO,CAAC,SAAS,EAAE,CAAC;IAOvB,qBAAqB,CACnB,WAAW,EAAE,MAAM,GAClB,cAAc,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAO9D,uBAAuB,CACrB,aAAa,EAAE,MAAM,GACpB,cAAc,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;CAM/D"}
|
|
@@ -71,5 +71,11 @@ class AssetsClient extends BaseEsiClient_1.BaseEsiClient {
|
|
|
71
71
|
postCorporationAssetNames(corporationId, itemIds) {
|
|
72
72
|
return this.api.postCorporationAssetNames(corporationId, itemIds);
|
|
73
73
|
}
|
|
74
|
+
streamCharacterAssets(characterId) {
|
|
75
|
+
return this.streamEndpoint('getCharacterAssets', characterId);
|
|
76
|
+
}
|
|
77
|
+
streamCorporationAssets(corporationId) {
|
|
78
|
+
return this.streamEndpoint('getCorporationAssets', corporationId);
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
exports.AssetsClient = AssetsClient;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ApiClient } from '../core/ApiClient';
|
|
2
2
|
import { createClient, WithMetadata } from '../core/endpoints/createClient';
|
|
3
3
|
import { EndpointMap } from '../core/endpoints/EndpointDefinition';
|
|
4
|
+
import { PageResult } from '../core/pagination/AsyncPaginationIterator';
|
|
4
5
|
type ClientMethods<T extends EndpointMap> = ReturnType<typeof createClient<T>>;
|
|
5
6
|
export declare abstract class BaseEsiClient<T extends EndpointMap> {
|
|
6
7
|
protected api: ClientMethods<T>;
|
|
7
8
|
protected _client: ApiClient;
|
|
8
|
-
|
|
9
|
+
protected _endpoints: T;
|
|
9
10
|
private _metaApi?;
|
|
10
11
|
constructor(client: ApiClient, endpoints: T);
|
|
12
|
+
protected streamEndpoint<R>(endpointName: string & keyof T, ...args: unknown[]): AsyncGenerator<PageResult<R>, void, undefined>;
|
|
11
13
|
withMetadata(): WithMetadata<Omit<this, 'withMetadata'>>;
|
|
12
14
|
}
|
|
13
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEsiClient.d.ts","sourceRoot":"","sources":["../../src/clients/BaseEsiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,YAAY,EAEZ,YAAY,EACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E,8BAAsB,aAAa,CAAC,CAAC,SAAS,WAAW;IACvD,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAChC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC;IAC7B,
|
|
1
|
+
{"version":3,"file":"BaseEsiClient.d.ts","sourceRoot":"","sources":["../../src/clients/BaseEsiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,YAAY,EAEZ,YAAY,EACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAEnE,OAAO,EAEL,UAAU,EACX,MAAM,4CAA4C,CAAC;AAEpD,KAAK,aAAa,CAAC,CAAC,SAAS,WAAW,IAAI,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E,8BAAsB,aAAa,CAAC,CAAC,SAAS,WAAW;IACvD,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAChC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC;IAC7B,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAmB;gBAExB,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAM3C,SAAS,CAAC,cAAc,CAAC,CAAC,EACxB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,EAC9B,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAgBjD,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;CAQzD"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseEsiClient = void 0;
|
|
4
4
|
const createClient_1 = require("../core/endpoints/createClient");
|
|
5
|
+
const buildEndpointPath_1 = require("../core/endpoints/buildEndpointPath");
|
|
6
|
+
const AsyncPaginationIterator_1 = require("../core/pagination/AsyncPaginationIterator");
|
|
5
7
|
class BaseEsiClient {
|
|
6
8
|
api;
|
|
7
9
|
_client;
|
|
@@ -12,6 +14,11 @@ class BaseEsiClient {
|
|
|
12
14
|
this._endpoints = endpoints;
|
|
13
15
|
this.api = (0, createClient_1.createClient)(client, endpoints);
|
|
14
16
|
}
|
|
17
|
+
streamEndpoint(endpointName, ...args) {
|
|
18
|
+
const def = this._endpoints[endpointName];
|
|
19
|
+
const { path, body } = (0, buildEndpointPath_1.buildEndpointPath)(def, args, this._client.getDatasource());
|
|
20
|
+
return (0, AsyncPaginationIterator_1.fetchPages)(this._client, path, def.method, def.requiresAuth, body);
|
|
21
|
+
}
|
|
15
22
|
withMetadata() {
|
|
16
23
|
if (!this._metaApi) {
|
|
17
24
|
this._metaApi = (0, createClient_1.createClient)(this._client, this._endpoints, {
|
|
@@ -2,6 +2,7 @@ import { ApiClient } from '../core/ApiClient';
|
|
|
2
2
|
import { BaseEsiClient } from './BaseEsiClient';
|
|
3
3
|
import { contractEndpoints } from '../core/endpoints/contractEndpoints';
|
|
4
4
|
import { Contract, ContractBid, ContractItem } from '../types/api-responses';
|
|
5
|
+
import { PageResult } from '../core/pagination/AsyncPaginationIterator';
|
|
5
6
|
export declare class ContractsClient extends BaseEsiClient<typeof contractEndpoints> {
|
|
6
7
|
constructor(client: ApiClient);
|
|
7
8
|
/**
|
|
@@ -77,5 +78,8 @@ export declare class ContractsClient extends BaseEsiClient<typeof contractEndpoi
|
|
|
77
78
|
* @requires Authentication
|
|
78
79
|
*/
|
|
79
80
|
getCorporationContractItems(corporationId: number, contractId: number): Promise<ContractItem[]>;
|
|
81
|
+
streamPublicContracts(regionId: number): AsyncGenerator<PageResult<Contract>, void, undefined>;
|
|
82
|
+
streamCharacterContracts(characterId: number): AsyncGenerator<PageResult<Contract>, void, undefined>;
|
|
83
|
+
streamCorporationContracts(corporationId: number): AsyncGenerator<PageResult<Contract>, void, undefined>;
|
|
80
84
|
}
|
|
81
85
|
//# sourceMappingURL=ContractsClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractsClient.d.ts","sourceRoot":"","sources":["../../src/clients/ContractsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContractsClient.d.ts","sourceRoot":"","sources":["../../src/clients/ContractsClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,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