@lgriffin/esi.ts 10.0.0 → 10.2.1
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 +158 -0
- package/README.md +14 -5
- package/dist/EsiClient.d.mts +140 -0
- package/dist/EsiClientBuilder.d.mts +75 -0
- package/dist/auth/EsiTokenManager.d.mts +200 -0
- package/dist/auth/EveSsoClient.d.mts +88 -0
- package/dist/auth/errors.d.mts +42 -0
- package/dist/auth/index.d.mts +14 -0
- package/dist/auth/jwt.d.mts +43 -0
- package/dist/auth/pkce.d.mts +21 -0
- package/dist/auth/storage/FileTokenStorage.d.mts +44 -0
- package/dist/auth/storage/MemoryTokenStorage.d.mts +18 -0
- package/dist/auth/types.d.mts +42 -0
- package/dist/{chunk-7A72QFDF.mjs → chunk-4W66ONJI.mjs} +4 -7
- package/dist/chunk-4W66ONJI.mjs.map +1 -0
- package/dist/{chunk-HPSACXX3.js → chunk-N3B65VLB.js} +4 -7
- package/dist/chunk-N3B65VLB.js.map +1 -0
- package/dist/clients/AccessListsClient.d.mts +25 -0
- package/dist/clients/AllianceClient.d.mts +59 -0
- package/dist/clients/AssetsClient.d.mts +65 -0
- package/dist/clients/BaseEsiClient.d.mts +19 -0
- package/dist/clients/CalendarClient.d.mts +48 -0
- package/dist/clients/CharacterClient.d.mts +134 -0
- package/dist/clients/ClonesClient.d.mts +27 -0
- package/dist/clients/ContactsClient.d.mts +96 -0
- package/dist/clients/ContractsClient.d.mts +91 -0
- package/dist/clients/CorporationProjectsClient.d.mts +54 -0
- package/dist/clients/CorporationsClient.d.mts +219 -0
- package/dist/clients/CosmeticsClient.d.mts +11 -0
- package/dist/clients/DogmaClient.d.mts +42 -0
- package/dist/clients/FactionClient.d.mts +60 -0
- package/dist/clients/FittingsClient.d.mts +38 -0
- package/dist/clients/FleetClient.d.mts +134 -0
- package/dist/clients/FreelanceJobsClient.d.mts +61 -0
- package/dist/clients/IncursionsClient.d.mts +14 -0
- package/dist/clients/IndustryClient.d.mts +86 -0
- package/dist/clients/InsuranceClient.d.mts +14 -0
- package/dist/clients/KillmailsClient.d.mts +37 -0
- package/dist/clients/LocationClient.d.mts +32 -0
- package/dist/clients/LoyaltyClient.d.mts +28 -0
- package/dist/clients/MailClient.d.mts +104 -0
- package/dist/clients/MarketClient.d.mts +102 -0
- package/dist/clients/MercenaryClient.d.mts +42 -0
- package/dist/clients/MetaClient.d.mts +45 -0
- package/dist/clients/MilitaryCampaignsClient.d.mts +53 -0
- package/dist/clients/ParagonHubClient.d.mts +13 -0
- package/dist/clients/PiClient.d.mts +45 -0
- package/dist/clients/RouteClient.d.mts +25 -0
- package/dist/clients/SearchClient.d.mts +17 -0
- package/dist/clients/SkillsClient.d.mts +39 -0
- package/dist/clients/SkyhooksClient.d.mts +48 -0
- package/dist/clients/SovereigntyClient.d.mts +20 -0
- package/dist/clients/StatusClient.d.mts +14 -0
- package/dist/clients/UiClient.d.mts +44 -0
- package/dist/clients/UniverseClient.d.mts +212 -0
- package/dist/clients/WalletClient.d.mts +70 -0
- package/dist/clients/WarsClient.d.mts +33 -0
- package/dist/core/ApiClient.d.mts +73 -0
- package/dist/core/ApiClientBuilder.d.mts +24 -0
- package/dist/core/ApiRequestHandler.d.ts.map +1 -1
- package/dist/core/BatchRequestHandler.d.mts +12 -0
- package/dist/core/ClientRegistry.d.mts +45 -0
- package/dist/core/EsiDiagnostics.d.mts +35 -0
- package/dist/core/IDeduplicator.d.mts +22 -0
- package/dist/core/IDeduplicator.d.ts +16 -0
- package/dist/core/IDeduplicator.d.ts.map +1 -1
- package/dist/core/IRetryStrategy.d.mts +5 -0
- package/dist/core/RequestDeduplicator.d.mts +21 -0
- package/dist/core/RequestDeduplicator.d.ts +11 -0
- package/dist/core/RequestDeduplicator.d.ts.map +1 -1
- package/dist/core/RetryStrategy.d.mts +21 -0
- package/dist/core/cache/ETagCacheManager.d.mts +75 -0
- package/dist/core/cache/ICache.d.mts +27 -0
- package/dist/core/cache/cacheKey.d.ts +11 -0
- package/dist/core/cache/cacheKey.d.ts.map +1 -1
- package/dist/core/circuitBreaker/CircuitBreaker.d.mts +52 -0
- package/dist/core/circuitBreaker/CircuitBreaker.d.ts.map +1 -1
- package/dist/core/circuitBreaker/ICircuitBreaker.d.mts +23 -0
- package/dist/core/configureApiClient.d.mts +18 -0
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/endpoints/EndpointDefinition.d.mts +63 -0
- package/dist/core/endpoints/accessListEndpoints.d.mts +34 -0
- package/dist/core/endpoints/allianceEndpoints.d.mts +43 -0
- package/dist/core/endpoints/assetEndpoints.d.mts +76 -0
- package/dist/core/endpoints/buildEndpointPath.d.mts +7 -0
- package/dist/core/endpoints/calendarEndpoints.d.mts +54 -0
- package/dist/core/endpoints/characterEndpoints.d.mts +185 -0
- package/dist/core/endpoints/cloneEndpoints.d.mts +32 -0
- package/dist/core/endpoints/contactEndpoints.d.mts +106 -0
- package/dist/core/endpoints/contractEndpoints.d.mts +168 -0
- package/dist/core/endpoints/corporationEndpoints.d.mts +324 -0
- package/dist/core/endpoints/corporationProjectEndpoints.d.mts +102 -0
- package/dist/core/endpoints/cosmeticsEndpoints.d.mts +52 -0
- package/dist/core/endpoints/createClient.d.mts +69 -0
- package/dist/core/endpoints/dogmaEndpoints.d.mts +89 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.d.ts.map +1 -1
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.mts +7 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.ts.map +1 -1
- package/dist/core/endpoints/esi-scopes.generated.d.mts +3 -0
- package/dist/core/endpoints/esi-scopes.generated.d.ts.map +1 -1
- package/dist/core/endpoints/factionEndpoints.d.mts +194 -0
- package/dist/core/endpoints/fittingEndpoints.d.mts +34 -0
- package/dist/core/endpoints/fleetEndpoints.d.mts +137 -0
- package/dist/core/endpoints/freelanceJobsEndpoints.d.mts +181 -0
- package/dist/core/endpoints/incursionEndpoints.d.mts +19 -0
- package/dist/core/endpoints/industryEndpoints.d.mts +138 -0
- package/dist/core/endpoints/insuranceEndpoints.d.mts +17 -0
- package/dist/core/endpoints/killmailEndpoints.d.mts +62 -0
- package/dist/core/endpoints/locationEndpoints.d.mts +37 -0
- package/dist/core/endpoints/loyaltyEndpoints.d.mts +32 -0
- package/dist/core/endpoints/mailEndpoints.d.mts +111 -0
- package/dist/core/endpoints/marketEndpoints.d.mts +191 -0
- package/dist/core/endpoints/mercenaryEndpoints.d.mts +79 -0
- package/dist/core/endpoints/metaEndpoints.d.mts +50 -0
- package/dist/core/endpoints/militaryCampaignEndpoints.d.mts +87 -0
- package/dist/core/endpoints/paragonHubEndpoints.d.mts +163 -0
- package/dist/core/endpoints/piEndpoints.d.mts +101 -0
- package/dist/core/endpoints/routeEndpoints.d.mts +14 -0
- package/dist/core/endpoints/searchEndpoints.d.mts +26 -0
- package/dist/core/endpoints/skillEndpoints.d.mts +52 -0
- package/dist/core/endpoints/skyhookEndpoints.d.mts +111 -0
- package/dist/core/endpoints/sovereigntyEndpoints.d.mts +59 -0
- package/dist/core/endpoints/statusEndpoints.d.mts +14 -0
- package/dist/core/endpoints/uiEndpoints.d.mts +43 -0
- package/dist/core/endpoints/universeEndpoints.d.mts +456 -0
- package/dist/core/endpoints/walletEndpoints.d.mts +98 -0
- package/dist/core/endpoints/warEndpoints.d.mts +51 -0
- package/dist/core/logger/DefaultLogger.d.mts +31 -0
- package/dist/core/logger/ILogger.d.mts +17 -0
- package/dist/core/logger/NoopLogger.d.mts +7 -0
- package/dist/core/logger/loggerUtil.d.mts +11 -0
- package/dist/core/logger/resolveLogger.d.ts +3 -3
- package/dist/core/logger/resolveLogger.d.ts.map +1 -1
- package/dist/core/middleware/Middleware.d.mts +30 -0
- package/dist/core/pagination/AsyncPaginationIterator.d.mts +12 -0
- package/dist/core/pagination/AsyncPaginationIterator.d.ts.map +1 -1
- package/dist/core/pagination/CursorPaginationHandler.d.mts +68 -0
- package/dist/core/pagination/CursorPaginationHandler.d.ts.map +1 -1
- package/dist/core/rateLimiter/IRateLimiter.d.mts +27 -0
- package/dist/core/rateLimiter/RateLimiter.d.mts +62 -0
- package/dist/core/rateLimiter/RateLimiter.d.ts.map +1 -1
- package/dist/core/requestPipeline/cachePolicy.d.ts +11 -1
- package/dist/core/requestPipeline/cachePolicy.d.ts.map +1 -1
- package/dist/core/requestPipeline/fetchExecution.d.ts.map +1 -1
- package/dist/core/requestPipeline/index.d.ts +1 -1
- package/dist/core/requestPipeline/index.d.ts.map +1 -1
- package/dist/core/requestPipeline/paginationOrchestration.d.ts +1 -1
- package/dist/core/requestPipeline/paginationOrchestration.d.ts.map +1 -1
- package/dist/core/requestPipeline/statusHandling.d.ts +6 -0
- package/dist/core/requestPipeline/statusHandling.d.ts.map +1 -1
- package/dist/core/util/concurrency.d.ts.map +1 -1
- package/dist/core/util/error.d.mts +37 -0
- package/dist/core/util/retry.d.mts +8 -0
- package/dist/core/util/retry.d.ts.map +1 -1
- package/dist/errors.d.mts +5 -0
- package/dist/errors.js +2 -2
- package/dist/errors.mjs +1 -1
- package/dist/index.d.mts +81 -0
- package/dist/index.js +374 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +267 -90
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/access-lists.d.mts +16 -0
- package/dist/schemas/alliance.d.mts +26 -0
- package/dist/schemas/assets.d.mts +24 -0
- package/dist/schemas/calendar.d.mts +27 -0
- package/dist/schemas/character.d.mts +109 -0
- package/dist/schemas/clones.d.mts +17 -0
- package/dist/schemas/common.d.mts +74 -0
- package/dist/schemas/contacts.d.mts +14 -0
- package/dist/schemas/contracts.d.mts +104 -0
- package/dist/schemas/corporation-projects.d.mts +104 -0
- package/dist/schemas/corporation.d.mts +193 -0
- package/dist/schemas/cosmetics.d.mts +58 -0
- package/dist/schemas/dogma.d.mts +57 -0
- package/dist/schemas/esiEnum.d.mts +3 -0
- package/dist/schemas/faction-warfare.d.mts +203 -0
- package/dist/schemas/fittings.d.mts +13 -0
- package/dist/schemas/fleet.d.mts +37 -0
- package/dist/schemas/freelance-jobs.d.mts +171 -0
- package/dist/schemas/incursions.d.mts +12 -0
- package/dist/schemas/index.d.mts +39 -0
- package/dist/schemas/industry.d.mts +99 -0
- package/dist/schemas/insurance.d.mts +10 -0
- package/dist/schemas/killmails.d.mts +38 -0
- package/dist/schemas/location.d.mts +18 -0
- package/dist/schemas/loyalty.d.mts +18 -0
- package/dist/schemas/mail.d.mts +53 -0
- package/dist/schemas/market.d.mts +123 -0
- package/dist/schemas/mercenary.d.mts +74 -0
- package/dist/schemas/meta.d.mts +36 -0
- package/dist/schemas/military-campaigns.d.mts +26 -0
- package/dist/schemas/paragon-hub.d.mts +96 -0
- package/dist/schemas/pi.d.mts +71 -0
- package/dist/schemas/skills.d.mts +28 -0
- package/dist/schemas/skyhooks.d.mts +129 -0
- package/dist/schemas/sovereignty.d.mts +56 -0
- package/dist/schemas/status.d.mts +8 -0
- package/dist/schemas/universe.d.mts +285 -0
- package/dist/schemas/wallet.d.mts +45 -0
- package/dist/schemas/wars.d.mts +27 -0
- package/dist/sde/IStaticDataProvider.d.mts +106 -0
- package/dist/sde/MemorySdeProvider.d.mts +167 -0
- package/dist/sde/SdeDataProvider.d.mts +119 -0
- package/dist/sde/SdeTestDataFactory.d.mts +33 -0
- package/dist/sde/errors.d.mts +23 -0
- package/dist/sde/index.d.mts +9 -0
- package/dist/sde/memory.d.mts +8 -0
- package/dist/sde/types.d.mts +1039 -0
- package/dist/sde/version.d.mts +7 -0
- package/dist/testing/TestDataFactory.d.mts +172 -0
- package/dist/testing/index.d.mts +2 -0
- package/dist/testing/index.js +2 -2
- package/dist/testing/index.mjs +1 -1
- package/dist/types/access-lists.d.mts +5 -0
- package/dist/types/alliance.d.mts +7 -0
- package/dist/types/api-responses.d.mts +40 -0
- package/dist/types/assets.d.mts +6 -0
- package/dist/types/branded.d.mts +23 -0
- package/dist/types/calendar.d.mts +6 -0
- package/dist/types/character.d.mts +17 -0
- package/dist/types/clones.d.mts +4 -0
- package/dist/types/common.d.mts +19 -0
- package/dist/types/contacts.d.mts +5 -0
- package/dist/types/contracts.d.mts +9 -0
- package/dist/types/corporation-projects.d.mts +10 -0
- package/dist/types/corporation.d.mts +19 -0
- package/dist/types/cosmetics.d.mts +8 -0
- package/dist/types/dogma.d.mts +6 -0
- package/dist/types/faction-warfare.d.mts +17 -0
- package/dist/types/fittings.d.mts +4 -0
- package/dist/types/fleet.d.mts +7 -0
- package/dist/types/freelance-jobs.d.mts +12 -0
- package/dist/types/generated/esi-spec.generated.d.mts +2136 -0
- package/dist/types/generated/esi-spec.generated.d.ts +164 -16
- package/dist/types/generated/esi-spec.generated.d.ts.map +1 -1
- package/dist/types/generated/spec-alignment.check.d.ts +2 -2
- package/dist/types/incursions.d.mts +4 -0
- package/dist/types/industry.d.mts +11 -0
- package/dist/types/insurance.d.mts +4 -0
- package/dist/types/killmails.d.mts +5 -0
- package/dist/types/location.d.mts +6 -0
- package/dist/types/loyalty.d.mts +5 -0
- package/dist/types/mail.d.mts +6 -0
- package/dist/types/market.d.mts +12 -0
- package/dist/types/mercenary.d.mts +7 -0
- package/dist/types/meta.d.mts +9 -0
- package/dist/types/military-campaigns.d.mts +6 -0
- package/dist/types/paragon-hub.d.mts +8 -0
- package/dist/types/pi.d.mts +6 -0
- package/dist/types/skills.d.mts +5 -0
- package/dist/types/skyhooks.d.mts +8 -0
- package/dist/types/sovereignty.d.mts +6 -0
- package/dist/types/status.d.mts +4 -0
- package/dist/types/universe.d.mts +27 -0
- package/dist/types/wallet.d.mts +6 -0
- package/dist/types/wars.d.mts +4 -0
- package/package.json +92 -24
- package/dist/chunk-7A72QFDF.mjs.map +0 -1
- package/dist/chunk-HPSACXX3.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -41,7 +41,6 @@ var _chunkBBSHKVPIjs = require('./chunk-BBSHKVPI.js');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var _chunkHPSACXX3js = require('./chunk-HPSACXX3.js');
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
@@ -174,6 +173,7 @@ var _chunkHPSACXX3js = require('./chunk-HPSACXX3.js');
|
|
|
174
173
|
|
|
175
174
|
|
|
176
175
|
|
|
176
|
+
var _chunkSAQBXXTMjs = require('./chunk-SAQBXXTM.js');
|
|
177
177
|
|
|
178
178
|
|
|
179
179
|
|
|
@@ -206,7 +206,7 @@ var _chunkHPSACXX3js = require('./chunk-HPSACXX3.js');
|
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
|
|
209
|
-
var
|
|
209
|
+
var _chunkN3B65VLBjs = require('./chunk-N3B65VLB.js');
|
|
210
210
|
require('./chunk-PZ5AY32C.js');
|
|
211
211
|
|
|
212
212
|
// src/core/middleware/Middleware.ts
|
|
@@ -428,17 +428,23 @@ var ApiClient = (_class2 = class {
|
|
|
428
428
|
|
|
429
429
|
// src/core/cache/cacheKey.ts
|
|
430
430
|
var _crypto = require('crypto');
|
|
431
|
-
function
|
|
432
|
-
if (!requiresAuth) return
|
|
431
|
+
function scopeToIdentity(key, client, requiresAuth) {
|
|
432
|
+
if (!requiresAuth) return key;
|
|
433
433
|
const authHeader = client.getAuthorizationHeader();
|
|
434
|
-
if (!authHeader) return
|
|
434
|
+
if (!authHeader) return key;
|
|
435
435
|
const hash = _crypto.createHash.call(void 0, "sha256").update(authHeader).digest("hex").slice(0, 16);
|
|
436
|
-
return `${hash}:${
|
|
436
|
+
return `${hash}:${key}`;
|
|
437
|
+
}
|
|
438
|
+
function buildCacheKey(url, client, requiresAuth = false) {
|
|
439
|
+
return scopeToIdentity(url, client, requiresAuth);
|
|
440
|
+
}
|
|
441
|
+
function buildDedupeKey(endpoint, client, requiresAuth = false) {
|
|
442
|
+
return scopeToIdentity(endpoint, client, requiresAuth);
|
|
437
443
|
}
|
|
438
444
|
|
|
439
445
|
// src/core/constants.ts
|
|
440
446
|
var PACKAGE_NAME = "esi.ts";
|
|
441
|
-
var PACKAGE_VERSION = "10.
|
|
447
|
+
var PACKAGE_VERSION = "10.2.1";
|
|
442
448
|
var USER_AGENT = `${PACKAGE_NAME}/${PACKAGE_VERSION}`;
|
|
443
449
|
var COMPATIBILITY_DATE = "2026-05-19";
|
|
444
450
|
|
|
@@ -463,7 +469,7 @@ function buildRequestHeaders(client, url, method, requiresAuth, useETag, body, r
|
|
|
463
469
|
if (requiresAuth) {
|
|
464
470
|
const authHeader = client.getAuthorizationHeader();
|
|
465
471
|
if (!authHeader) {
|
|
466
|
-
throw
|
|
472
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
467
473
|
[
|
|
468
474
|
"Authorization header is required for this endpoint but no access token is configured",
|
|
469
475
|
"Fix: set ESI_ACCESS_TOKEN in your environment (see .env.example), or call client.setAccessToken(token), or pass accessToken to the EsiClient constructor"
|
|
@@ -479,7 +485,7 @@ function buildRequestHeaders(client, url, method, requiresAuth, useETag, body, r
|
|
|
479
485
|
const cachedETag = cache.getETag(key);
|
|
480
486
|
if (cachedETag) {
|
|
481
487
|
headers["If-None-Match"] = cachedETag;
|
|
482
|
-
|
|
488
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0, client, `Adding If-None-Match header: ${cachedETag}`, {
|
|
483
489
|
etag: cachedETag
|
|
484
490
|
});
|
|
485
491
|
}
|
|
@@ -503,6 +509,8 @@ var esiCacheTtls = {
|
|
|
503
509
|
"GET:alliances/{alliance_id}/contacts/labels": 300,
|
|
504
510
|
"GET:alliances/{alliance_id}/corporations": 3600,
|
|
505
511
|
"GET:characters/{character_id}": 86400,
|
|
512
|
+
"GET:characters/{character_id}/access-lists": 300,
|
|
513
|
+
"GET:characters/{character_id}/access-lists/{access_list_id}": 300,
|
|
506
514
|
"GET:characters/{character_id}/agents_research": 3600,
|
|
507
515
|
"GET:characters/{character_id}/assets": 3600,
|
|
508
516
|
"GET:characters/{character_id}/attributes": 120,
|
|
@@ -533,6 +541,8 @@ var esiCacheTtls = {
|
|
|
533
541
|
"GET:characters/{character_id}/mail/labels": 30,
|
|
534
542
|
"GET:characters/{character_id}/mail/lists": 120,
|
|
535
543
|
"GET:characters/{character_id}/medals": 3600,
|
|
544
|
+
"GET:characters/{character_id}/mercenary-tactical-operations": 300,
|
|
545
|
+
"GET:characters/{character_id}/mercenary-tactical-operations/{operation_id}": 300,
|
|
536
546
|
"GET:characters/{character_id}/mining": 600,
|
|
537
547
|
"GET:characters/{character_id}/notifications": 600,
|
|
538
548
|
"GET:characters/{character_id}/notifications/contacts": 600,
|
|
@@ -547,6 +557,8 @@ var esiCacheTtls = {
|
|
|
547
557
|
"GET:characters/{character_id}/skillqueue": 60,
|
|
548
558
|
"GET:characters/{character_id}/skills": 60,
|
|
549
559
|
"GET:characters/{character_id}/standings": 3600,
|
|
560
|
+
"GET:characters/{character_id}/structures/mercenary-dens": 3600,
|
|
561
|
+
"GET:characters/{character_id}/structures/mercenary-dens/{mercenary_den_id}": 3600,
|
|
550
562
|
"GET:characters/{character_id}/titles": 3600,
|
|
551
563
|
"GET:characters/{character_id}/wallet": 120,
|
|
552
564
|
"GET:characters/{character_id}/wallet/journal": 3600,
|
|
@@ -591,6 +603,10 @@ var esiCacheTtls = {
|
|
|
591
603
|
"GET:corporations/{corporation_id}/starbases": 3600,
|
|
592
604
|
"GET:corporations/{corporation_id}/starbases/{starbase_id}": 3600,
|
|
593
605
|
"GET:corporations/{corporation_id}/structures": 3600,
|
|
606
|
+
"GET:corporations/{corporation_id}/structures/skyhooks": 3600,
|
|
607
|
+
"GET:corporations/{corporation_id}/structures/skyhooks/{skyhook_id}": 3600,
|
|
608
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs": 3600,
|
|
609
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs/{sovereignty_hub_id}": 3600,
|
|
594
610
|
"GET:corporations/{corporation_id}/titles": 3600,
|
|
595
611
|
"GET:corporations/{corporation_id}/wallets": 300,
|
|
596
612
|
"GET:corporations/{corporation_id}/wallets/{division}/journal": 3600,
|
|
@@ -611,9 +627,9 @@ var esiCacheTtls = {
|
|
|
611
627
|
"GET:markets/structures/{structure_id}": 300,
|
|
612
628
|
"GET:meta/changelog": 600,
|
|
613
629
|
"GET:meta/compatibility-dates": 600,
|
|
630
|
+
"GET:skyhooks/raidable": 300,
|
|
614
631
|
"GET:sovereignty/campaigns": 5,
|
|
615
|
-
"GET:sovereignty/
|
|
616
|
-
"GET:sovereignty/structures": 120,
|
|
632
|
+
"GET:sovereignty/systems": 300,
|
|
617
633
|
"GET:status": 30,
|
|
618
634
|
"GET:universe/schematics/{schematic_id}": 3600,
|
|
619
635
|
"GET:universe/structures": 3600,
|
|
@@ -647,7 +663,7 @@ function trySpecAwareCacheHit(client, url, method, templatePath, resolveCache2,
|
|
|
647
663
|
if (!entry) return null;
|
|
648
664
|
const age = Date.now() - entry.timestamp;
|
|
649
665
|
if (age < specTtlMs) {
|
|
650
|
-
|
|
666
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
651
667
|
client,
|
|
652
668
|
`Spec-aware cache hit for ${url} (age=${Math.round(age / 1e3)}s, ttl=${Math.round(specTtlMs / 1e3)}s)`,
|
|
653
669
|
{ method, templatePath }
|
|
@@ -662,6 +678,10 @@ function trySpecAwareCacheHit(client, url, method, templatePath, resolveCache2,
|
|
|
662
678
|
}
|
|
663
679
|
return null;
|
|
664
680
|
}
|
|
681
|
+
function hasCachedEntry(client, url, resolveCache2, requiresAuth = false) {
|
|
682
|
+
const cache = resolveCache2(client);
|
|
683
|
+
return !!cache && cache.has(buildCacheKey(url, client, requiresAuth));
|
|
684
|
+
}
|
|
665
685
|
function tryStaleCacheResponse(client, url, parsed, resolveCache2, requiresAuth = false) {
|
|
666
686
|
const cache = resolveCache2(client);
|
|
667
687
|
if (!cache) return null;
|
|
@@ -677,17 +697,47 @@ function tryStaleCacheResponse(client, url, parsed, resolveCache2, requiresAuth
|
|
|
677
697
|
cacheHitType: "stale-on-error"
|
|
678
698
|
};
|
|
679
699
|
}
|
|
680
|
-
|
|
700
|
+
var RECENT_WRITES = 64;
|
|
701
|
+
var writeLogs = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
function writeLogFor(cache) {
|
|
703
|
+
let log = writeLogs.get(cache);
|
|
704
|
+
if (!log) {
|
|
705
|
+
log = { generation: 0, recent: [] };
|
|
706
|
+
writeLogs.set(cache, log);
|
|
707
|
+
}
|
|
708
|
+
return log;
|
|
709
|
+
}
|
|
710
|
+
function currentWriteGeneration(client, resolveCache2) {
|
|
711
|
+
const cache = resolveCache2(client);
|
|
712
|
+
return cache ? writeLogFor(cache).generation : 0;
|
|
713
|
+
}
|
|
714
|
+
function invalidatedSince(cache, generation, key) {
|
|
715
|
+
const log = writeLogFor(cache);
|
|
716
|
+
if (log.generation === generation) return false;
|
|
717
|
+
if (log.generation - generation > log.recent.length) return true;
|
|
718
|
+
return log.recent.some(
|
|
719
|
+
(write) => write.generation > generation && key.includes(write.path)
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
function cacheResponse(client, url, method, endpoint, parsed, data, useETag, resolveCache2, templatePath, requiresAuth = false, sentAtWriteGeneration) {
|
|
681
723
|
const cache = resolveCache2(client);
|
|
682
724
|
if (useETag && method === "GET" && cache && parsed.etag) {
|
|
683
725
|
const key = buildCacheKey(url, client, requiresAuth);
|
|
726
|
+
if (sentAtWriteGeneration !== void 0 && invalidatedSince(cache, sentAtWriteGeneration, key)) {
|
|
727
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
728
|
+
client,
|
|
729
|
+
`Not caching ${url}: a write invalidated it while the request was in flight`,
|
|
730
|
+
{ method }
|
|
731
|
+
);
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
684
734
|
const headerTtl = parseCacheControlTtl(parsed.raw);
|
|
685
735
|
const specTtlMs = templatePath ? lookupSpecTtl(method, templatePath) : void 0;
|
|
686
736
|
const freshnessTtl = _nullishCoalesce(specTtlMs, () => ( headerTtl));
|
|
687
737
|
const ttl = retentionTtl(freshnessTtl);
|
|
688
738
|
cache.set(key, parsed.etag, data, parsed.raw, ttl);
|
|
689
739
|
const ttlInfo = freshnessTtl !== void 0 ? ` (ttl=${freshnessTtl}ms, kept for ${ttl}ms)` : "";
|
|
690
|
-
|
|
740
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
691
741
|
client,
|
|
692
742
|
`Cached response for ${url} with ETag ${parsed.etag}${ttlInfo}`,
|
|
693
743
|
{
|
|
@@ -703,16 +753,23 @@ function evictRejectedResponse(client, endpoint, requiresAuth, resolveCache2) {
|
|
|
703
753
|
if (!cache) return;
|
|
704
754
|
const url = `${client.getLink()}/${endpoint}`;
|
|
705
755
|
if (cache.delete(buildCacheKey(url, client, requiresAuth))) {
|
|
706
|
-
|
|
756
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
707
757
|
client,
|
|
708
758
|
`Evicted cached response for ${url} after it failed validation`
|
|
709
759
|
);
|
|
710
760
|
}
|
|
711
761
|
}
|
|
712
762
|
function invalidateAfterWrite(client, method, endpoint, resolveCache2) {
|
|
763
|
+
if (method === "GET") return;
|
|
764
|
+
const path2 = endpoint.split("?")[0];
|
|
765
|
+
_optionalChain([client, 'access', _2 => _2.getDeduplicator, 'call', _3 => _3(), 'optionalAccess', _4 => _4.detachByPath, 'optionalCall', _5 => _5(path2)]);
|
|
713
766
|
const cache = resolveCache2(client);
|
|
714
|
-
if (
|
|
715
|
-
cache.deleteByPath(
|
|
767
|
+
if (cache) {
|
|
768
|
+
cache.deleteByPath(path2);
|
|
769
|
+
const log = writeLogFor(cache);
|
|
770
|
+
log.generation += 1;
|
|
771
|
+
log.recent.push({ generation: log.generation, path: path2 });
|
|
772
|
+
if (log.recent.length > RECENT_WRITES) log.recent.shift();
|
|
716
773
|
}
|
|
717
774
|
}
|
|
718
775
|
|
|
@@ -729,16 +786,20 @@ var STATUS_MESSAGES = {
|
|
|
729
786
|
422: "Unprocessable Entity",
|
|
730
787
|
429: "Too many requests",
|
|
731
788
|
500: "Internal server error",
|
|
789
|
+
502: "Bad Gateway",
|
|
732
790
|
503: "Service Unavailable",
|
|
733
791
|
504: "Gateway Timeout",
|
|
734
792
|
520: "Internal server error, did the request terminate too soon?"
|
|
735
793
|
};
|
|
794
|
+
function statusMessage(response) {
|
|
795
|
+
return STATUS_MESSAGES[response.status] || response.statusText || `HTTP ${response.status}`;
|
|
796
|
+
}
|
|
736
797
|
function handleEarlyStatus(client, status, url, parsed, useETag, resolveCache2, requiresAuth = false) {
|
|
737
798
|
if (status === 201) {
|
|
738
799
|
return { headers: parsed.raw, body: void 0, status: 201 };
|
|
739
800
|
}
|
|
740
801
|
if (status === 204) {
|
|
741
|
-
|
|
802
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, client, `No Content for endpoint: ${url}`, { status });
|
|
742
803
|
return { headers: parsed.raw, body: void 0, status: 204 };
|
|
743
804
|
}
|
|
744
805
|
if (status === 304) {
|
|
@@ -747,11 +808,15 @@ function handleEarlyStatus(client, status, url, parsed, useETag, resolveCache2,
|
|
|
747
808
|
const key = buildCacheKey(url, client, requiresAuth);
|
|
748
809
|
const cachedEntry = cache.get(key);
|
|
749
810
|
if (cachedEntry) {
|
|
750
|
-
|
|
811
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, client, `Cache hit (304) for endpoint: ${url}`, {
|
|
751
812
|
status,
|
|
752
813
|
cacheHitType: "etag-304"
|
|
753
814
|
});
|
|
754
|
-
const headers = {
|
|
815
|
+
const headers = {
|
|
816
|
+
...cachedEntry.headers,
|
|
817
|
+
...parsed.raw
|
|
818
|
+
};
|
|
819
|
+
if ("etag" in parsed.raw) headers["etag"] = cachedEntry.etag;
|
|
755
820
|
cache.set(
|
|
756
821
|
key,
|
|
757
822
|
cachedEntry.etag,
|
|
@@ -768,7 +833,7 @@ function handleEarlyStatus(client, status, url, parsed, useETag, resolveCache2,
|
|
|
768
833
|
};
|
|
769
834
|
}
|
|
770
835
|
}
|
|
771
|
-
throw new (0,
|
|
836
|
+
throw new (0, _chunkN3B65VLBjs.EsiError)(
|
|
772
837
|
304,
|
|
773
838
|
"Not Modified \u2014 no cached data available",
|
|
774
839
|
url,
|
|
@@ -790,8 +855,8 @@ async function readEsiErrorReason(response) {
|
|
|
790
855
|
}
|
|
791
856
|
}
|
|
792
857
|
function handleErrorResponse(client, response, url, parsed, useETag, resolveCache2, requiresAuth = false, esiReason) {
|
|
793
|
-
const
|
|
794
|
-
const errorMessage = esiReason ? `${
|
|
858
|
+
const text = statusMessage(response);
|
|
859
|
+
const errorMessage = esiReason ? `${text}: ${esiReason}` : text;
|
|
795
860
|
if (response.status >= 500 && useETag) {
|
|
796
861
|
const staleResult = tryStaleCacheResponse(
|
|
797
862
|
client,
|
|
@@ -801,14 +866,14 @@ function handleErrorResponse(client, response, url, parsed, useETag, resolveCach
|
|
|
801
866
|
requiresAuth
|
|
802
867
|
);
|
|
803
868
|
if (staleResult) {
|
|
804
|
-
|
|
869
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0, client, `${errorMessage} for ${url} \u2014 serving stale cache`, {
|
|
805
870
|
status: response.status
|
|
806
871
|
});
|
|
807
872
|
return { ...staleResult, status: response.status };
|
|
808
873
|
}
|
|
809
874
|
}
|
|
810
875
|
if (response.status === 420 || response.status === 429) {
|
|
811
|
-
|
|
876
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0, client, `Rate limited (${response.status}) on ${url}`, {
|
|
812
877
|
status: response.status
|
|
813
878
|
});
|
|
814
879
|
}
|
|
@@ -818,7 +883,7 @@ function handleErrorResponse(client, response, url, parsed, useETag, resolveCach
|
|
|
818
883
|
} else if (response.status === 403) {
|
|
819
884
|
message = `${errorMessage} \u2014 your access token does not have the OAuth scopes required for this endpoint. Check the scopes on your EVE SSO application`;
|
|
820
885
|
}
|
|
821
|
-
throw new (0,
|
|
886
|
+
throw new (0, _chunkN3B65VLBjs.EsiError)(
|
|
822
887
|
response.status,
|
|
823
888
|
message,
|
|
824
889
|
url,
|
|
@@ -826,20 +891,20 @@ function handleErrorResponse(client, response, url, parsed, useETag, resolveCach
|
|
|
826
891
|
);
|
|
827
892
|
}
|
|
828
893
|
function wrapError(error, client) {
|
|
829
|
-
if (error instanceof
|
|
894
|
+
if (error instanceof _chunkN3B65VLBjs.EsiError || error instanceof _chunkN3B65VLBjs.CircuitOpenError) {
|
|
830
895
|
throw error;
|
|
831
896
|
}
|
|
832
897
|
if (error instanceof Error) {
|
|
833
|
-
|
|
834
|
-
throw
|
|
898
|
+
_chunkN3B65VLBjs.logError2.call(void 0, client, `Unexpected error: ${error.message}`);
|
|
899
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0, error.message, "ESIJS_ERROR");
|
|
835
900
|
}
|
|
836
|
-
|
|
837
|
-
throw
|
|
901
|
+
_chunkN3B65VLBjs.logError2.call(void 0, client, `Unexpected error: ${String(error)}`);
|
|
902
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0, String(error), "ESIJS_ERROR");
|
|
838
903
|
}
|
|
839
904
|
|
|
840
905
|
// src/core/util/retry.ts
|
|
841
906
|
function retryDelay(attempt, baseMs, maxMs) {
|
|
842
|
-
const exponential = baseMs * Math.pow(2, attempt);
|
|
907
|
+
const exponential = baseMs === 0 ? 0 : baseMs * Math.pow(2, attempt);
|
|
843
908
|
const jitter = exponential * (0.75 + Math.random() * 0.5);
|
|
844
909
|
return Math.min(jitter, maxMs);
|
|
845
910
|
}
|
|
@@ -856,10 +921,10 @@ var RetryStrategy = class {
|
|
|
856
921
|
|
|
857
922
|
|
|
858
923
|
constructor(config) {
|
|
859
|
-
this.maxRetries = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
860
|
-
this.baseDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
861
|
-
this.maxDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
862
|
-
this.retryMutations = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
924
|
+
this.maxRetries = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _6 => _6.maxRetries]), () => ( 0));
|
|
925
|
+
this.baseDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _7 => _7.baseDelayMs]), () => ( 1e3));
|
|
926
|
+
this.maxDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _8 => _8.maxDelayMs]), () => ( 3e4));
|
|
927
|
+
this.retryMutations = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _9 => _9.retryMutations]), () => ( false));
|
|
863
928
|
}
|
|
864
929
|
async execute(operation, context) {
|
|
865
930
|
const canRetryMethod = context.method === "GET" || this.retryMutations;
|
|
@@ -869,38 +934,38 @@ var RetryStrategy = class {
|
|
|
869
934
|
try {
|
|
870
935
|
return await operation();
|
|
871
936
|
} catch (error) {
|
|
872
|
-
if (error instanceof
|
|
937
|
+
if (error instanceof _chunkN3B65VLBjs.CircuitOpenError) {
|
|
873
938
|
throw error;
|
|
874
939
|
}
|
|
875
|
-
if (!refreshAttempted && error instanceof
|
|
940
|
+
if (!refreshAttempted && error instanceof _chunkN3B65VLBjs.EsiError && error.statusCode === 401 && context.requiresAuth && context.refreshToken) {
|
|
876
941
|
refreshAttempted = true;
|
|
877
|
-
|
|
942
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, context.client, "Received 401, attempting token refresh...", {
|
|
878
943
|
endpoint: context.endpoint
|
|
879
944
|
});
|
|
880
945
|
try {
|
|
881
946
|
await context.refreshToken();
|
|
882
947
|
} catch (refreshError) {
|
|
883
|
-
if (refreshError instanceof
|
|
948
|
+
if (refreshError instanceof _chunkN3B65VLBjs.EsiError || refreshError instanceof _chunkN3B65VLBjs.CircuitOpenError) {
|
|
884
949
|
throw refreshError;
|
|
885
950
|
}
|
|
886
951
|
const msg = refreshError instanceof Error ? refreshError.message : String(refreshError);
|
|
887
|
-
|
|
952
|
+
_chunkN3B65VLBjs.logError2.call(void 0, context.client, `Token refresh failed: ${msg}`, {
|
|
888
953
|
endpoint: context.endpoint
|
|
889
954
|
});
|
|
890
|
-
throw
|
|
955
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
891
956
|
`Token refresh failed: ${msg}`,
|
|
892
957
|
"TOKEN_REFRESH_FAILED"
|
|
893
958
|
);
|
|
894
959
|
}
|
|
895
|
-
|
|
960
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, context.client, "Token refreshed, retrying request", {
|
|
896
961
|
endpoint: context.endpoint
|
|
897
962
|
});
|
|
898
963
|
attempt--;
|
|
899
964
|
continue;
|
|
900
965
|
}
|
|
901
|
-
if (error instanceof
|
|
966
|
+
if (error instanceof _chunkN3B65VLBjs.EsiError && error.retryable && canRetryMethod && attempt < this.maxRetries) {
|
|
902
967
|
const delay = retryDelay(attempt, this.baseDelayMs, this.maxDelayMs);
|
|
903
|
-
|
|
968
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
904
969
|
context.client,
|
|
905
970
|
`Request to ${context.endpoint} failed (${error.statusCode}), retrying in ${Math.round(delay)}ms (attempt ${attempt + 1}/${this.maxRetries})`,
|
|
906
971
|
{ method: context.method, statusCode: error.statusCode }
|
|
@@ -923,7 +988,7 @@ function resolveCache(client) {
|
|
|
923
988
|
function resolveRateLimiter(client) {
|
|
924
989
|
const limiter = client.getRateLimiter();
|
|
925
990
|
if (!limiter) {
|
|
926
|
-
throw
|
|
991
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
927
992
|
"No rate limiter configured on ApiClient. Set one via apiClient.setRateLimiter(new RateLimiter()).",
|
|
928
993
|
"CONFIGURATION_ERROR"
|
|
929
994
|
);
|
|
@@ -955,7 +1020,7 @@ var PaginationHandler = (_class3 = class {
|
|
|
955
1020
|
if (effectiveMaxPage <= 1) {
|
|
956
1021
|
return allData;
|
|
957
1022
|
}
|
|
958
|
-
|
|
1023
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, client, `Fetching pages 2-${effectiveMaxPage} for ${endpoint}...`, {
|
|
959
1024
|
method,
|
|
960
1025
|
totalPages
|
|
961
1026
|
});
|
|
@@ -971,19 +1036,19 @@ var PaginationHandler = (_class3 = class {
|
|
|
971
1036
|
pageFetch
|
|
972
1037
|
);
|
|
973
1038
|
if (opts.stopOnEmptyPage && (!pageData || pageData.length === 0)) {
|
|
974
|
-
|
|
1039
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0, client, `Page ${page} is empty. Stopping pagination.`, {
|
|
975
1040
|
page
|
|
976
1041
|
});
|
|
977
1042
|
break;
|
|
978
1043
|
}
|
|
979
1044
|
allData.push(...pageData);
|
|
980
|
-
|
|
1045
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
981
1046
|
client,
|
|
982
1047
|
`Fetched page ${page}/${effectiveMaxPage} (${pageData.length} items)`,
|
|
983
1048
|
{ page, items: pageData.length }
|
|
984
1049
|
);
|
|
985
1050
|
} catch (error) {
|
|
986
|
-
|
|
1051
|
+
_chunkN3B65VLBjs.logError2.call(void 0,
|
|
987
1052
|
client,
|
|
988
1053
|
`Failed to fetch page ${page}: ${error instanceof Error ? error.message : String(error)}`,
|
|
989
1054
|
{ page }
|
|
@@ -991,7 +1056,7 @@ var PaginationHandler = (_class3 = class {
|
|
|
991
1056
|
throw error instanceof Error ? error : new Error(`Failed to fetch page ${page}: ${String(error)}`);
|
|
992
1057
|
}
|
|
993
1058
|
}
|
|
994
|
-
|
|
1059
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
995
1060
|
client,
|
|
996
1061
|
`Pagination complete. Fetched ${allData.length} total items from up to ${effectiveMaxPage} pages.`,
|
|
997
1062
|
{ totalItems: allData.length }
|
|
@@ -1009,7 +1074,7 @@ var PaginationHandler = (_class3 = class {
|
|
|
1009
1074
|
const paginatedEndpoint = this.buildPaginatedEndpoint(endpoint, page);
|
|
1010
1075
|
return retryStrategy.execute(
|
|
1011
1076
|
() => {
|
|
1012
|
-
|
|
1077
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
1013
1078
|
client,
|
|
1014
1079
|
`Fetching page ${page} via pipeline: ${paginatedEndpoint}`,
|
|
1015
1080
|
{ page }
|
|
@@ -1045,12 +1110,12 @@ function handleCursorPagination(parsed, data) {
|
|
|
1045
1110
|
};
|
|
1046
1111
|
return { headers: parsed.raw, body: data, status: 200, cursors };
|
|
1047
1112
|
}
|
|
1048
|
-
async function handleOffsetPagination(client, endpoint, method, requiresAuth, parsed, data, body, url, useETag, pageFetch, resolveCache2, templatePath) {
|
|
1113
|
+
async function handleOffsetPagination(client, endpoint, method, requiresAuth, parsed, data, body, url, useETag, pageFetch, resolveCache2, templatePath, sentAtWriteGeneration) {
|
|
1049
1114
|
const totalPages = parsed.xPages;
|
|
1050
1115
|
if (totalPages <= 1) {
|
|
1051
1116
|
return { headers: parsed.raw, body: data, status: 200 };
|
|
1052
1117
|
}
|
|
1053
|
-
|
|
1118
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
1054
1119
|
client,
|
|
1055
1120
|
`Found ${totalPages} pages, fetching additional pages with rate limiting...`,
|
|
1056
1121
|
{ endpoint, totalPages }
|
|
@@ -1081,20 +1146,22 @@ async function handleOffsetPagination(client, endpoint, method, requiresAuth, pa
|
|
|
1081
1146
|
allData,
|
|
1082
1147
|
useETag,
|
|
1083
1148
|
resolveCache2,
|
|
1084
|
-
templatePath
|
|
1149
|
+
templatePath,
|
|
1150
|
+
requiresAuth,
|
|
1151
|
+
sentAtWriteGeneration
|
|
1085
1152
|
);
|
|
1086
1153
|
return { headers: parsed.raw, body: allData, status: 200 };
|
|
1087
1154
|
} catch (paginationError) {
|
|
1088
1155
|
const msg = paginationError instanceof Error ? paginationError.message : String(paginationError);
|
|
1089
|
-
|
|
1156
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0, client, `Pagination failed for ${url}: ${msg}`, {
|
|
1090
1157
|
url,
|
|
1091
1158
|
endpoint,
|
|
1092
1159
|
error: msg
|
|
1093
1160
|
});
|
|
1094
|
-
if (paginationError instanceof
|
|
1161
|
+
if (paginationError instanceof _chunkN3B65VLBjs.EsiError || paginationError instanceof _chunkN3B65VLBjs.CircuitOpenError) {
|
|
1095
1162
|
throw paginationError;
|
|
1096
1163
|
}
|
|
1097
|
-
throw
|
|
1164
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1098
1165
|
`Pagination incomplete for ${url}: ${msg}`,
|
|
1099
1166
|
"PAGINATION_INCOMPLETE",
|
|
1100
1167
|
url
|
|
@@ -1182,10 +1249,21 @@ function isAbortError(err) {
|
|
|
1182
1249
|
function networkError(err, url) {
|
|
1183
1250
|
const reason = err instanceof Error ? err.message : String(err);
|
|
1184
1251
|
return Object.assign(
|
|
1185
|
-
new (0,
|
|
1252
|
+
new (0, _chunkN3B65VLBjs.EsiError)(0, `Network request failed: ${reason}`, url),
|
|
1186
1253
|
{ cause: err }
|
|
1187
1254
|
);
|
|
1188
1255
|
}
|
|
1256
|
+
async function bufferBody(response) {
|
|
1257
|
+
if (typeof response.text !== "function") return;
|
|
1258
|
+
const text = await response.text();
|
|
1259
|
+
Object.defineProperties(response, {
|
|
1260
|
+
text: { value: () => Promise.resolve(text), configurable: true },
|
|
1261
|
+
json: {
|
|
1262
|
+
value: () => Promise.resolve(text).then((t) => JSON.parse(t)),
|
|
1263
|
+
configurable: true
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1189
1267
|
async function executeSingleFetch(client, endpoint, method, body, requiresAuth, useETag, resolveCache2, resolveRateLimiter2, resolveCircuitBreaker2, requestTimeout, templatePath) {
|
|
1190
1268
|
const rawUrl = `${client.getLink()}/${endpoint}`;
|
|
1191
1269
|
const builtHeaders = buildRequestHeaders(
|
|
@@ -1211,9 +1289,9 @@ async function executeSingleFetch(client, endpoint, method, body, requiresAuth,
|
|
|
1211
1289
|
body: req.body ? JSON.stringify(req.body) : void 0
|
|
1212
1290
|
};
|
|
1213
1291
|
const url = req.url;
|
|
1214
|
-
|
|
1292
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, client, `Hitting endpoint: ${url}`, { method, endpoint });
|
|
1215
1293
|
const cb = resolveCircuitBreaker2(client);
|
|
1216
|
-
const cbKey = cb && templatePath && _optionalChain([cb, 'access',
|
|
1294
|
+
const cbKey = cb && templatePath && _optionalChain([cb, 'access', _10 => _10.getKeyStrategy, 'optionalCall', _11 => _11()]) === "template" ? templatePath : endpoint;
|
|
1217
1295
|
if (cb) cb.checkCircuit(cbKey);
|
|
1218
1296
|
let cbRecorded = false;
|
|
1219
1297
|
try {
|
|
@@ -1226,6 +1304,7 @@ async function executeSingleFetch(client, endpoint, method, body, requiresAuth,
|
|
|
1226
1304
|
let response;
|
|
1227
1305
|
try {
|
|
1228
1306
|
response = await client.getFetch()(url, options);
|
|
1307
|
+
await bufferBody(response);
|
|
1229
1308
|
} catch (err) {
|
|
1230
1309
|
clearTimeout(timer);
|
|
1231
1310
|
if (cb) {
|
|
@@ -1233,7 +1312,7 @@ async function executeSingleFetch(client, endpoint, method, body, requiresAuth,
|
|
|
1233
1312
|
cbRecorded = true;
|
|
1234
1313
|
}
|
|
1235
1314
|
if (isAbortError(err)) {
|
|
1236
|
-
throw new (0,
|
|
1315
|
+
throw new (0, _chunkN3B65VLBjs.TimeoutError)(timeoutMs, url);
|
|
1237
1316
|
}
|
|
1238
1317
|
throw networkError(err, url);
|
|
1239
1318
|
}
|
|
@@ -1255,7 +1334,7 @@ async function executeSingleFetch(client, endpoint, method, body, requiresAuth,
|
|
|
1255
1334
|
cbRecorded = true;
|
|
1256
1335
|
}
|
|
1257
1336
|
if (parsed.warning) {
|
|
1258
|
-
|
|
1337
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
1259
1338
|
client,
|
|
1260
1339
|
`ESI Warning ${parsed.warning.code}: ${parsed.warning.message}`,
|
|
1261
1340
|
{
|
|
@@ -1276,8 +1355,8 @@ async function parseJsonBody(client, response, _url) {
|
|
|
1276
1355
|
return await response.json();
|
|
1277
1356
|
} catch (jsonError) {
|
|
1278
1357
|
const msg = jsonError instanceof Error ? jsonError.message : String(jsonError);
|
|
1279
|
-
|
|
1280
|
-
throw
|
|
1358
|
+
_chunkN3B65VLBjs.logError2.call(void 0, client, `Failed to parse JSON response: ${msg}`, { url: _url });
|
|
1359
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0, `Invalid JSON response: ${msg}`, "JSON_PARSE_ERROR");
|
|
1281
1360
|
}
|
|
1282
1361
|
}
|
|
1283
1362
|
async function fetchOnePage(client, endpoint, method, body, requiresAuth, useETag, resolveCache2, resolveRateLimiter2, resolveCircuitBreaker2, requestTimeout, templatePath) {
|
|
@@ -1295,11 +1374,11 @@ async function fetchOnePage(client, endpoint, method, body, requiresAuth, useETa
|
|
|
1295
1374
|
templatePath
|
|
1296
1375
|
);
|
|
1297
1376
|
if (!response.ok) {
|
|
1298
|
-
const
|
|
1377
|
+
const text = statusMessage(response);
|
|
1299
1378
|
const reason = await readEsiErrorReason(response);
|
|
1300
|
-
throw new (0,
|
|
1379
|
+
throw new (0, _chunkN3B65VLBjs.EsiError)(
|
|
1301
1380
|
response.status,
|
|
1302
|
-
reason ? `${
|
|
1381
|
+
reason ? `${text}: ${reason}` : text,
|
|
1303
1382
|
url,
|
|
1304
1383
|
_nullishCoalesce(parsed.requestId, () => ( void 0))
|
|
1305
1384
|
);
|
|
@@ -1324,6 +1403,13 @@ var executeRequest = async (client, endpoint, method, body, requiresAuth = false
|
|
|
1324
1403
|
);
|
|
1325
1404
|
};
|
|
1326
1405
|
try {
|
|
1406
|
+
const writeGeneration = currentWriteGeneration(client, resolveCache);
|
|
1407
|
+
const revalidating = useETag && method === "GET" && hasCachedEntry(
|
|
1408
|
+
client,
|
|
1409
|
+
`${client.getLink()}/${endpoint}`,
|
|
1410
|
+
resolveCache,
|
|
1411
|
+
requiresAuth
|
|
1412
|
+
);
|
|
1327
1413
|
const { response, parsed, url } = await executeSingleFetch(
|
|
1328
1414
|
client,
|
|
1329
1415
|
endpoint,
|
|
@@ -1349,6 +1435,18 @@ var executeRequest = async (client, endpoint, method, body, requiresAuth = false
|
|
|
1349
1435
|
}
|
|
1350
1436
|
return finish({ headers: parsed.raw, body: data2, status: 201 });
|
|
1351
1437
|
}
|
|
1438
|
+
if (response.status === 304 && revalidating && !hasCachedEntry(client, url, resolveCache, requiresAuth)) {
|
|
1439
|
+
return await executeRequest(
|
|
1440
|
+
client,
|
|
1441
|
+
endpoint,
|
|
1442
|
+
method,
|
|
1443
|
+
body,
|
|
1444
|
+
requiresAuth,
|
|
1445
|
+
useETag,
|
|
1446
|
+
requestTimeout,
|
|
1447
|
+
templatePath
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1352
1450
|
const earlyResult = handleEarlyStatus(
|
|
1353
1451
|
client,
|
|
1354
1452
|
response.status,
|
|
@@ -1373,18 +1471,21 @@ var executeRequest = async (client, endpoint, method, body, requiresAuth = false
|
|
|
1373
1471
|
return finish(staleOrThrow);
|
|
1374
1472
|
}
|
|
1375
1473
|
const data = await parseJsonBody(client, response, url);
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1474
|
+
if (parsed.xPages <= 1 || parsed.hasCursorPagination) {
|
|
1475
|
+
cacheResponse(
|
|
1476
|
+
client,
|
|
1477
|
+
url,
|
|
1478
|
+
method,
|
|
1479
|
+
endpoint,
|
|
1480
|
+
parsed,
|
|
1481
|
+
data,
|
|
1482
|
+
useETag,
|
|
1483
|
+
resolveCache,
|
|
1484
|
+
templatePath,
|
|
1485
|
+
requiresAuth,
|
|
1486
|
+
writeGeneration
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1388
1489
|
const cursorResult = handleCursorPagination(parsed, data);
|
|
1389
1490
|
if (cursorResult) return finish(cursorResult);
|
|
1390
1491
|
const pageFetch = async (paginatedEndpoint) => {
|
|
@@ -1415,7 +1516,8 @@ var executeRequest = async (client, endpoint, method, body, requiresAuth = false
|
|
|
1415
1516
|
useETag,
|
|
1416
1517
|
pageFetch,
|
|
1417
1518
|
resolveCache,
|
|
1418
|
-
templatePath
|
|
1519
|
+
templatePath,
|
|
1520
|
+
writeGeneration
|
|
1419
1521
|
);
|
|
1420
1522
|
return finish(paginatedResult);
|
|
1421
1523
|
} catch (error) {
|
|
@@ -1452,24 +1554,26 @@ var handleSinglePageRequest = async (client, endpoint, method, body, requiresAut
|
|
|
1452
1554
|
var handleRequest = async (client, endpoint, method, body, requiresAuth = false, useETag = true, templatePath, requestTimeout) => {
|
|
1453
1555
|
const rawUrl = `${client.getLink()}/${endpoint}`;
|
|
1454
1556
|
const startTime = Date.now();
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
return applyResponseInterceptors(
|
|
1557
|
+
const specCacheHit = () => {
|
|
1558
|
+
const hit = trySpecAwareCacheHit(
|
|
1559
|
+
client,
|
|
1560
|
+
rawUrl,
|
|
1561
|
+
method,
|
|
1562
|
+
templatePath,
|
|
1563
|
+
resolveCache,
|
|
1564
|
+
requiresAuth
|
|
1565
|
+
);
|
|
1566
|
+
return hit ? applyResponseInterceptors(
|
|
1465
1567
|
client,
|
|
1466
|
-
|
|
1568
|
+
hit,
|
|
1467
1569
|
rawUrl,
|
|
1468
1570
|
endpoint,
|
|
1469
1571
|
method,
|
|
1470
1572
|
startTime
|
|
1471
|
-
);
|
|
1472
|
-
}
|
|
1573
|
+
) : null;
|
|
1574
|
+
};
|
|
1575
|
+
const specHit = specCacheHit();
|
|
1576
|
+
if (specHit) return specHit;
|
|
1473
1577
|
const doExecute = () => executeRequest(
|
|
1474
1578
|
client,
|
|
1475
1579
|
endpoint,
|
|
@@ -1482,7 +1586,16 @@ var handleRequest = async (client, endpoint, method, body, requiresAuth = false,
|
|
|
1482
1586
|
);
|
|
1483
1587
|
const dedup = client.getDeduplicator();
|
|
1484
1588
|
const canDedup = dedup && method === "GET" && !body;
|
|
1485
|
-
|
|
1589
|
+
let attempted = false;
|
|
1590
|
+
const operation = () => {
|
|
1591
|
+
const retryHit = attempted ? specCacheHit() : null;
|
|
1592
|
+
attempted = true;
|
|
1593
|
+
if (retryHit) return retryHit;
|
|
1594
|
+
return canDedup ? dedup.dedupe(
|
|
1595
|
+
buildDedupeKey(endpoint, client, requiresAuth),
|
|
1596
|
+
doExecute
|
|
1597
|
+
) : doExecute();
|
|
1598
|
+
};
|
|
1486
1599
|
const retryStrategy = resolveRetryStrategy(client);
|
|
1487
1600
|
return retryStrategy.execute(operation, {
|
|
1488
1601
|
client,
|
|
@@ -1498,20 +1611,20 @@ var handleRequest = async (client, endpoint, method, body, requiresAuth = false,
|
|
|
1498
1611
|
var UNSAFE_PATH_CHARS = /[/\\?#@!$&'()*+,;=<>{}|^`]/;
|
|
1499
1612
|
function validatePathParam(paramName, value) {
|
|
1500
1613
|
if (value === null || value === void 0 || value === "") {
|
|
1501
|
-
throw
|
|
1614
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1502
1615
|
`Path parameter '${paramName}' must not be empty`,
|
|
1503
1616
|
"VALIDATION_ERROR"
|
|
1504
1617
|
);
|
|
1505
1618
|
}
|
|
1506
1619
|
const str = `${value}`;
|
|
1507
1620
|
if (UNSAFE_PATH_CHARS.test(str)) {
|
|
1508
|
-
throw
|
|
1621
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1509
1622
|
`Path parameter '${paramName}' contains invalid characters`,
|
|
1510
1623
|
"VALIDATION_ERROR"
|
|
1511
1624
|
);
|
|
1512
1625
|
}
|
|
1513
1626
|
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
1514
|
-
throw
|
|
1627
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1515
1628
|
`Path parameter '${paramName}' must be a finite number`,
|
|
1516
1629
|
"VALIDATION_ERROR"
|
|
1517
1630
|
);
|
|
@@ -1524,13 +1637,13 @@ function validateBaseUrl(url, allowCustomHost) {
|
|
|
1524
1637
|
try {
|
|
1525
1638
|
parsed = new URL(url);
|
|
1526
1639
|
} catch (e3) {
|
|
1527
|
-
throw
|
|
1640
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0, `Invalid base URL: ${url}`, "VALIDATION_ERROR");
|
|
1528
1641
|
}
|
|
1529
1642
|
if (parsed.protocol !== "https:") {
|
|
1530
|
-
throw
|
|
1643
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0, "Base URL must use HTTPS protocol", "VALIDATION_ERROR");
|
|
1531
1644
|
}
|
|
1532
1645
|
if (!allowCustomHost && !ALLOWED_ESI_HOSTS.includes(parsed.hostname)) {
|
|
1533
|
-
throw
|
|
1646
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1534
1647
|
`Base URL host '${parsed.hostname}' is not in the allowlist. Allowed hosts: ${ALLOWED_ESI_HOSTS.join(", ")}. Set unsafeAllowCustomHost to bypass this check.`,
|
|
1535
1648
|
"VALIDATION_ERROR"
|
|
1536
1649
|
);
|
|
@@ -1539,20 +1652,20 @@ function validateBaseUrl(url, allowCustomHost) {
|
|
|
1539
1652
|
}
|
|
1540
1653
|
function validateQueryParam(paramName, value) {
|
|
1541
1654
|
if (value === null || value === void 0) {
|
|
1542
|
-
throw
|
|
1655
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1543
1656
|
`Query parameter '${paramName}' must not be null or undefined`,
|
|
1544
1657
|
"VALIDATION_ERROR"
|
|
1545
1658
|
);
|
|
1546
1659
|
}
|
|
1547
1660
|
const str = `${value}`;
|
|
1548
1661
|
if (typeof value === "number" && !Number.isFinite(value)) {
|
|
1549
|
-
throw
|
|
1662
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1550
1663
|
`Query parameter '${paramName}' must be a finite number`,
|
|
1551
1664
|
"VALIDATION_ERROR"
|
|
1552
1665
|
);
|
|
1553
1666
|
}
|
|
1554
1667
|
if (str.length > 2e3) {
|
|
1555
|
-
throw
|
|
1668
|
+
throw _chunkN3B65VLBjs.buildError.call(void 0,
|
|
1556
1669
|
`Query parameter '${paramName}' exceeds maximum length`,
|
|
1557
1670
|
"VALIDATION_ERROR"
|
|
1558
1671
|
);
|
|
@@ -1641,8 +1754,8 @@ function buildMeta(response) {
|
|
|
1641
1754
|
}
|
|
1642
1755
|
function createClient(apiClient, endpoints, options) {
|
|
1643
1756
|
const client = {};
|
|
1644
|
-
const returnMetadata = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1645
|
-
const safeMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1757
|
+
const returnMetadata = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _12 => _12.returnMetadata]), () => ( false));
|
|
1758
|
+
const safeMode = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.safeMode]), () => ( false));
|
|
1646
1759
|
for (const [methodName, def] of Object.entries(endpoints)) {
|
|
1647
1760
|
client[methodName] = async (...args) => {
|
|
1648
1761
|
try {
|
|
@@ -1653,7 +1766,7 @@ function createClient(apiClient, endpoints, options) {
|
|
|
1653
1766
|
parts.push(`Use '${def.deprecated.replacedBy}' instead.`);
|
|
1654
1767
|
if (def.deprecated.sunsetDate)
|
|
1655
1768
|
parts.push(`Sunset date: ${def.deprecated.sunsetDate}.`);
|
|
1656
|
-
|
|
1769
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0, apiClient, parts.join(" "), { endpoint: methodName });
|
|
1657
1770
|
}
|
|
1658
1771
|
const built = buildEndpointPath(def, args, apiClient.getDatasource());
|
|
1659
1772
|
let path2 = built.path;
|
|
@@ -1661,7 +1774,7 @@ function createClient(apiClient, endpoints, options) {
|
|
|
1661
1774
|
if (apiClient.getValidateRequest() && def.requestSchema && body != null) {
|
|
1662
1775
|
const reqResult = def.requestSchema.safeParse(body);
|
|
1663
1776
|
if (!reqResult.success) {
|
|
1664
|
-
throw new (0,
|
|
1777
|
+
throw new (0, _chunkN3B65VLBjs.EsiValidationError)(
|
|
1665
1778
|
`${apiClient.getLink()}/${path2}`,
|
|
1666
1779
|
reqResult.error,
|
|
1667
1780
|
void 0,
|
|
@@ -1702,7 +1815,7 @@ function createClient(apiClient, endpoints, options) {
|
|
|
1702
1815
|
def.requiresAuth,
|
|
1703
1816
|
resolveCache
|
|
1704
1817
|
);
|
|
1705
|
-
throw new (0,
|
|
1818
|
+
throw new (0, _chunkN3B65VLBjs.EsiValidationError)(
|
|
1706
1819
|
`${apiClient.getLink()}/${path2}`,
|
|
1707
1820
|
result.error
|
|
1708
1821
|
);
|
|
@@ -1749,7 +1862,7 @@ function createClient(apiClient, endpoints, options) {
|
|
|
1749
1862
|
def.requiresAuth,
|
|
1750
1863
|
resolveCache
|
|
1751
1864
|
);
|
|
1752
|
-
throw new (0,
|
|
1865
|
+
throw new (0, _chunkN3B65VLBjs.EsiValidationError)(
|
|
1753
1866
|
`${apiClient.getLink()}/${path2}`,
|
|
1754
1867
|
result.error
|
|
1755
1868
|
);
|
|
@@ -1765,7 +1878,7 @@ function createClient(apiClient, endpoints, options) {
|
|
|
1765
1878
|
return responseBody;
|
|
1766
1879
|
} catch (err) {
|
|
1767
1880
|
if (safeMode) {
|
|
1768
|
-
const error = err instanceof
|
|
1881
|
+
const error = err instanceof _chunkN3B65VLBjs.EsiError ? err : new (0, _chunkN3B65VLBjs.EsiError)(
|
|
1769
1882
|
0,
|
|
1770
1883
|
err instanceof Error ? err.message : String(err)
|
|
1771
1884
|
);
|
|
@@ -1809,7 +1922,7 @@ function validatePageBody(body, schema, url, validate) {
|
|
|
1809
1922
|
if (!schema || !validate) return body;
|
|
1810
1923
|
const result = schema.safeParse(body);
|
|
1811
1924
|
if (!result.success) {
|
|
1812
|
-
throw new (0,
|
|
1925
|
+
throw new (0, _chunkN3B65VLBjs.EsiValidationError)(url, result.error);
|
|
1813
1926
|
}
|
|
1814
1927
|
return result.data;
|
|
1815
1928
|
}
|
|
@@ -1831,7 +1944,6 @@ async function fetchAllPages(client, endpoint, method, requiresAuth = false, bod
|
|
|
1831
1944
|
);
|
|
1832
1945
|
const totalPages = parseInt(firstResponse.headers["x-pages"] || "1", 10);
|
|
1833
1946
|
const result = extractArray(firstBody);
|
|
1834
|
-
if (totalPages <= 1) return result;
|
|
1835
1947
|
const remaining = Array.from({ length: totalPages - 1 }, (_, i) => i + 2);
|
|
1836
1948
|
for (let i = 0; i < remaining.length; i += concurrency) {
|
|
1837
1949
|
const batch = remaining.slice(i, i + concurrency);
|
|
@@ -1839,7 +1951,7 @@ async function fetchAllPages(client, endpoint, method, requiresAuth = false, bod
|
|
|
1839
1951
|
batch.map(async (page) => {
|
|
1840
1952
|
const sep = endpoint.includes("?") ? "&" : "?";
|
|
1841
1953
|
const pagedEndpoint = `${endpoint}${sep}page=${page}`;
|
|
1842
|
-
|
|
1954
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
1843
1955
|
client,
|
|
1844
1956
|
`Fetching page ${page}/${totalPages}: ${pagedEndpoint}`,
|
|
1845
1957
|
{ page, totalPages }
|
|
@@ -1887,7 +1999,7 @@ async function* fetchPages(client, endpoint, method, requiresAuth = false, body,
|
|
|
1887
1999
|
for (let page = 2; page <= totalPages; page++) {
|
|
1888
2000
|
const sep = endpoint.includes("?") ? "&" : "?";
|
|
1889
2001
|
const pagedEndpoint = `${endpoint}${sep}page=${page}`;
|
|
1890
|
-
|
|
2002
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, client, `Fetching page ${page}/${totalPages}: ${pagedEndpoint}`, {
|
|
1891
2003
|
page,
|
|
1892
2004
|
totalPages
|
|
1893
2005
|
});
|
|
@@ -2104,7 +2216,7 @@ var AllianceClient = class extends BaseEsiClient {
|
|
|
2104
2216
|
* @requires Authentication
|
|
2105
2217
|
*/
|
|
2106
2218
|
getContacts(allianceId) {
|
|
2107
|
-
|
|
2219
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
2108
2220
|
this._client,
|
|
2109
2221
|
"AllianceClient.getContacts() is deprecated. Use ContactsClient.getAllianceContacts() instead. Planned removal in next major version.",
|
|
2110
2222
|
{ allianceId }
|
|
@@ -2120,7 +2232,7 @@ var AllianceClient = class extends BaseEsiClient {
|
|
|
2120
2232
|
* @requires Authentication
|
|
2121
2233
|
*/
|
|
2122
2234
|
getContactLabels(allianceId) {
|
|
2123
|
-
|
|
2235
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
2124
2236
|
this._client,
|
|
2125
2237
|
"AllianceClient.getContactLabels() is deprecated. Use ContactsClient.getAllianceContactLabels() instead. Planned removal in next major version.",
|
|
2126
2238
|
{ allianceId }
|
|
@@ -6675,7 +6787,7 @@ var MetaClient = class extends BaseEsiClient {
|
|
|
6675
6787
|
*/
|
|
6676
6788
|
async getOpenApiYaml() {
|
|
6677
6789
|
const url = `${this._client.getLink()}/meta/openapi.yaml`;
|
|
6678
|
-
|
|
6790
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0, this._client, `Hitting endpoint: ${url}`, { method: "GET" });
|
|
6679
6791
|
try {
|
|
6680
6792
|
const response = await fetch(url, {
|
|
6681
6793
|
method: "GET",
|
|
@@ -6691,12 +6803,12 @@ var MetaClient = class extends BaseEsiClient {
|
|
|
6691
6803
|
return await response.text();
|
|
6692
6804
|
} catch (error) {
|
|
6693
6805
|
if (error instanceof Error) {
|
|
6694
|
-
|
|
6806
|
+
_chunkN3B65VLBjs.logError2.call(void 0, this._client, `Error fetching YAML: ${error.message}`, {
|
|
6695
6807
|
url
|
|
6696
6808
|
});
|
|
6697
6809
|
throw error;
|
|
6698
6810
|
} else {
|
|
6699
|
-
|
|
6811
|
+
_chunkN3B65VLBjs.logError2.call(void 0, this._client, `Unexpected error: ${String(error)}`, { url });
|
|
6700
6812
|
throw new Error(String(error));
|
|
6701
6813
|
}
|
|
6702
6814
|
}
|
|
@@ -7410,7 +7522,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7410
7522
|
let completed = 0;
|
|
7411
7523
|
let running = 0;
|
|
7412
7524
|
let index = 0;
|
|
7413
|
-
|
|
7525
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
7414
7526
|
null,
|
|
7415
7527
|
`Batch fetch: ${keys.length} items, concurrency=${concurrency}`,
|
|
7416
7528
|
{
|
|
@@ -7427,7 +7539,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7427
7539
|
fetcher(key).then((result) => {
|
|
7428
7540
|
results.set(key, result);
|
|
7429
7541
|
}).catch((err) => {
|
|
7430
|
-
const error = err instanceof
|
|
7542
|
+
const error = err instanceof _chunkN3B65VLBjs.EsiError || err instanceof Error ? err : new Error(String(err));
|
|
7431
7543
|
errors.set(key, error);
|
|
7432
7544
|
}).finally(() => {
|
|
7433
7545
|
running--;
|
|
@@ -7436,7 +7548,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7436
7548
|
options.onProgress(completed, keys.length);
|
|
7437
7549
|
}
|
|
7438
7550
|
if (completed === keys.length) {
|
|
7439
|
-
|
|
7551
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
7440
7552
|
null,
|
|
7441
7553
|
`Batch complete: ${results.size} succeeded, ${errors.size} failed`,
|
|
7442
7554
|
{ succeeded: results.size, failed: errors.size }
|
|
@@ -7460,7 +7572,7 @@ async function batchPost(ids, poster, chunkSize = 1e3) {
|
|
|
7460
7572
|
for (let i = 0; i < ids.length; i += chunkSize) {
|
|
7461
7573
|
chunks.push(ids.slice(i, i + chunkSize));
|
|
7462
7574
|
}
|
|
7463
|
-
|
|
7575
|
+
_chunkN3B65VLBjs.logInfo2.call(void 0,
|
|
7464
7576
|
null,
|
|
7465
7577
|
`Batch POST: ${ids.length} IDs in ${chunks.length} chunks of ${chunkSize}`,
|
|
7466
7578
|
{ total: ids.length, chunks: chunks.length, chunkSize }
|
|
@@ -7486,7 +7598,7 @@ var ETagCacheManager = (_class4 = class {
|
|
|
7486
7598
|
}
|
|
7487
7599
|
log(level, message, context) {
|
|
7488
7600
|
const ctx = context && Object.keys(context).length > 0 ? context : void 0;
|
|
7489
|
-
const emit = level === "info" ?
|
|
7601
|
+
const emit = level === "info" ? _chunkN3B65VLBjs.logInfo2 : _chunkN3B65VLBjs.logDebug2;
|
|
7490
7602
|
emit(this.client, message, ctx);
|
|
7491
7603
|
}
|
|
7492
7604
|
constructor(config = {}) {;_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this);_class4.prototype.__init18.call(this);
|
|
@@ -7680,6 +7792,8 @@ var ETagCacheManager = (_class4 = class {
|
|
|
7680
7792
|
var esiRateLimitGroups = {
|
|
7681
7793
|
"GET:alliances/{alliance_id}/contacts": { group: "alliance-social", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7682
7794
|
"GET:alliances/{alliance_id}/contacts/labels": { group: "alliance-social", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7795
|
+
"GET:characters/{character_id}/access-lists": { group: "char-access", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7796
|
+
"GET:characters/{character_id}/access-lists/{access_list_id}": { group: "char-access", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7683
7797
|
"GET:characters/{character_id}/agents_research": { group: "char-industry", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7684
7798
|
"GET:characters/{character_id}/assets": { group: "char-asset", maxTokens: 1800, windowSizeMs: 9e5 },
|
|
7685
7799
|
"POST:characters/{character_id}/assets/locations": { group: "char-asset", maxTokens: 1800, windowSizeMs: 9e5 },
|
|
@@ -7723,6 +7837,8 @@ var esiRateLimitGroups = {
|
|
|
7723
7837
|
"DELETE:characters/{character_id}/mail/labels/{label_id}": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7724
7838
|
"GET:characters/{character_id}/mail/lists": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7725
7839
|
"GET:characters/{character_id}/medals": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7840
|
+
"GET:characters/{character_id}/mercenary-tactical-operations": { group: "char-activity", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7841
|
+
"GET:characters/{character_id}/mercenary-tactical-operations/{operation_id}": { group: "char-activity", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7726
7842
|
"GET:characters/{character_id}/mining": { group: "char-industry", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7727
7843
|
"GET:characters/{character_id}/notifications": { group: "char-notification", maxTokens: 15, windowSizeMs: 9e5 },
|
|
7728
7844
|
"GET:characters/{character_id}/notifications/contacts": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
@@ -7735,6 +7851,8 @@ var esiRateLimitGroups = {
|
|
|
7735
7851
|
"GET:characters/{character_id}/skillqueue": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7736
7852
|
"GET:characters/{character_id}/skills": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7737
7853
|
"GET:characters/{character_id}/standings": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7854
|
+
"GET:characters/{character_id}/structures/mercenary-dens": { group: "char-structure", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7855
|
+
"GET:characters/{character_id}/structures/mercenary-dens/{mercenary_den_id}": { group: "char-structure", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7738
7856
|
"GET:characters/{character_id}/titles": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7739
7857
|
"GET:characters/{character_id}/wallet": { group: "char-wallet", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7740
7858
|
"GET:characters/{character_id}/wallet/journal": { group: "char-wallet", maxTokens: 150, windowSizeMs: 9e5 },
|
|
@@ -7777,6 +7895,10 @@ var esiRateLimitGroups = {
|
|
|
7777
7895
|
"GET:corporations/{corporation_id}/starbases": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7778
7896
|
"GET:corporations/{corporation_id}/starbases/{starbase_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7779
7897
|
"GET:corporations/{corporation_id}/structures": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7898
|
+
"GET:corporations/{corporation_id}/structures/skyhooks": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7899
|
+
"GET:corporations/{corporation_id}/structures/skyhooks/{skyhook_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7900
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7901
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs/{sovereignty_hub_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7780
7902
|
"GET:corporations/{corporation_id}/titles": { group: "corp-detail", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7781
7903
|
"GET:corporations/{corporation_id}/wallets": { group: "corp-wallet", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7782
7904
|
"GET:corporations/{corporation_id}/wallets/{division}/journal": { group: "corp-wallet", maxTokens: 300, windowSizeMs: 9e5 },
|
|
@@ -7812,9 +7934,9 @@ var esiRateLimitGroups = {
|
|
|
7812
7934
|
"GET:meta/compatibility-dates": { group: "meta", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7813
7935
|
"GET:meta/status": { group: "meta", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7814
7936
|
"POST:route/{origin_system_id}/{destination_system_id}": { group: "routes", maxTokens: 3600, windowSizeMs: 9e5 },
|
|
7937
|
+
"GET:skyhooks/raidable": { group: "activity", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7815
7938
|
"GET:sovereignty/campaigns": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7816
|
-
"GET:sovereignty/
|
|
7817
|
-
"GET:sovereignty/structures": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7939
|
+
"GET:sovereignty/systems": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7818
7940
|
"GET:status": { group: "status", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7819
7941
|
"POST:ui/autopilot/waypoint": { group: "ui", maxTokens: 900, windowSizeMs: 9e5 },
|
|
7820
7942
|
"POST:ui/openwindow/contract": { group: "ui", maxTokens: 900, windowSizeMs: 9e5 },
|
|
@@ -7834,8 +7956,19 @@ function getTokenCost(statusCode) {
|
|
|
7834
7956
|
if (statusCode >= 500 && statusCode < 600) return 0;
|
|
7835
7957
|
return 2;
|
|
7836
7958
|
}
|
|
7959
|
+
function retryAfterDeadline(value, now) {
|
|
7960
|
+
const trimmed = value.trim();
|
|
7961
|
+
if (/^\d+$/.test(trimmed)) return now + parseInt(trimmed, 10) * 1e3;
|
|
7962
|
+
if (!/[A-Za-z]/.test(trimmed)) return void 0;
|
|
7963
|
+
const date = Date.parse(trimmed);
|
|
7964
|
+
return Number.isNaN(date) ? void 0 : date;
|
|
7965
|
+
}
|
|
7837
7966
|
var DEFAULT_WINDOW_MS = 9e5;
|
|
7838
|
-
var DEFAULT_ERROR_LIMIT = {
|
|
7967
|
+
var DEFAULT_ERROR_LIMIT = {
|
|
7968
|
+
remain: 100,
|
|
7969
|
+
reset: 0,
|
|
7970
|
+
exhaustedUntil: 0
|
|
7971
|
+
};
|
|
7839
7972
|
var RateLimiter = (_class5 = class _RateLimiter {
|
|
7840
7973
|
|
|
7841
7974
|
|
|
@@ -7851,10 +7984,10 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7851
7984
|
__init25() {this.lastCleanup = 0}
|
|
7852
7985
|
static __initStatic2() {this.CLEANUP_INTERVAL_MS = 6e4}
|
|
7853
7986
|
constructor(config) {;_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);_class5.prototype.__init25.call(this);
|
|
7854
|
-
this.minDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
7855
|
-
this.decelerationThreshold = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
7856
|
-
this.userKeyExtractor = _optionalChain([config, 'optionalAccess',
|
|
7857
|
-
this.endpointOverrides = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
7987
|
+
this.minDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _14 => _14.minDelayMs]), () => ( 50));
|
|
7988
|
+
this.decelerationThreshold = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _15 => _15.decelerationThreshold]), () => ( 0.2));
|
|
7989
|
+
this.userKeyExtractor = _optionalChain([config, 'optionalAccess', _16 => _16.userKeyExtractor]);
|
|
7990
|
+
this.endpointOverrides = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _17 => _17.endpointOverrides]), () => ( {}));
|
|
7858
7991
|
if (this.userKeyExtractor) {
|
|
7859
7992
|
this.userBuckets = /* @__PURE__ */ new Map();
|
|
7860
7993
|
}
|
|
@@ -7935,7 +8068,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7935
8068
|
getBucket(templatePath, method, requestHeaders, groupNameOverride) {
|
|
7936
8069
|
const bucketMap = this.resolveBucketMap(requestHeaders);
|
|
7937
8070
|
const spec = this.lookupGroupSpec(method, templatePath);
|
|
7938
|
-
const groupName = _nullishCoalesce(groupNameOverride, () => ( _optionalChain([spec, 'optionalAccess',
|
|
8071
|
+
const groupName = _nullishCoalesce(groupNameOverride, () => ( _optionalChain([spec, 'optionalAccess', _18 => _18.group])));
|
|
7939
8072
|
if (!groupName) return this.fallbackBucket;
|
|
7940
8073
|
let bucket = bucketMap.get(groupName);
|
|
7941
8074
|
if (!bucket) {
|
|
@@ -7957,6 +8090,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7957
8090
|
}
|
|
7958
8091
|
updateFromResponse(headers, statusCode, templatePath, method, requestHeaders) {
|
|
7959
8092
|
if (this.isTestMode) return;
|
|
8093
|
+
const now = Date.now();
|
|
7960
8094
|
const responseGroup = headers["x-ratelimit-group"] || void 0;
|
|
7961
8095
|
const bucket = this.getBucket(
|
|
7962
8096
|
templatePath,
|
|
@@ -7973,23 +8107,30 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7973
8107
|
if ("x-ratelimit-used" in headers) {
|
|
7974
8108
|
bucket.used = parseInt(headers["x-ratelimit-used"], 10);
|
|
7975
8109
|
}
|
|
7976
|
-
bucket.lastUpdated =
|
|
8110
|
+
bucket.lastUpdated = now;
|
|
7977
8111
|
if ("retry-after" in headers) {
|
|
7978
|
-
const
|
|
7979
|
-
bucket.blockedUntil =
|
|
8112
|
+
const until = retryAfterDeadline(headers["retry-after"], now);
|
|
8113
|
+
if (until !== void 0) bucket.blockedUntil = until;
|
|
7980
8114
|
}
|
|
7981
8115
|
if (statusCode === 420 || statusCode === 429) {
|
|
7982
|
-
if (bucket.blockedUntil <=
|
|
7983
|
-
bucket.blockedUntil =
|
|
8116
|
+
if (bucket.blockedUntil <= now) {
|
|
8117
|
+
bucket.blockedUntil = now + 6e4;
|
|
7984
8118
|
}
|
|
7985
8119
|
}
|
|
7986
8120
|
const errorLimit = this.resolveErrorLimit(requestHeaders);
|
|
7987
|
-
|
|
7988
|
-
|
|
8121
|
+
const reportedRemain = "x-esi-error-limit-remain" in headers ? parseInt(headers["x-esi-error-limit-remain"], 10) : void 0;
|
|
8122
|
+
if (reportedRemain !== void 0 && reportedRemain > 0 && errorLimit.remain <= 0 && now < errorLimit.exhaustedUntil) {
|
|
8123
|
+
return;
|
|
8124
|
+
}
|
|
8125
|
+
if (reportedRemain !== void 0) {
|
|
8126
|
+
errorLimit.remain = reportedRemain;
|
|
7989
8127
|
}
|
|
7990
8128
|
if ("x-esi-error-limit-reset" in headers) {
|
|
7991
8129
|
errorLimit.reset = parseInt(headers["x-esi-error-limit-reset"], 10);
|
|
7992
8130
|
}
|
|
8131
|
+
if (reportedRemain !== void 0 && reportedRemain <= 0) {
|
|
8132
|
+
errorLimit.exhaustedUntil = now + errorLimit.reset * 1e3;
|
|
8133
|
+
}
|
|
7993
8134
|
}
|
|
7994
8135
|
updateRateLimitInfo(headers) {
|
|
7995
8136
|
this.updateFromResponse(headers, 200);
|
|
@@ -8008,7 +8149,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8008
8149
|
stillBlockedBucket = bucket2;
|
|
8009
8150
|
const waitedUntil = bucket2.blockedUntil;
|
|
8010
8151
|
const waitTime = waitedUntil - now;
|
|
8011
|
-
|
|
8152
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
8012
8153
|
null,
|
|
8013
8154
|
`[ESI Rate Limit] Group '${bucket2.group}' blocked for ${Math.ceil(waitTime / 1e3)}s (420/429 received)`,
|
|
8014
8155
|
{ group: bucket2.group, waitMs: waitTime }
|
|
@@ -8020,12 +8161,12 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8020
8161
|
}
|
|
8021
8162
|
if (stillBlockedBucket && stillBlockedBucket.blockedUntil > Date.now()) {
|
|
8022
8163
|
const waitTime = stillBlockedBucket.blockedUntil - Date.now();
|
|
8023
|
-
|
|
8164
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
8024
8165
|
null,
|
|
8025
8166
|
`[ESI Rate Limit] Group '${stillBlockedBucket.group}' still blocked after retry budget exhausted; aborting request instead of sending while blocked`,
|
|
8026
8167
|
{ group: stillBlockedBucket.group }
|
|
8027
8168
|
);
|
|
8028
|
-
throw new (0,
|
|
8169
|
+
throw new (0, _chunkN3B65VLBjs.EsiError)(
|
|
8029
8170
|
429,
|
|
8030
8171
|
`Rate limit group '${stillBlockedBucket.group}' still blocked for ${Math.ceil(waitTime / 1e3)}s`
|
|
8031
8172
|
);
|
|
@@ -8035,7 +8176,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8035
8176
|
const resetMs = errorLimit.reset * 1e3;
|
|
8036
8177
|
const delay = Math.min(resetMs, 5e3);
|
|
8037
8178
|
if (delay > 0) {
|
|
8038
|
-
|
|
8179
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
8039
8180
|
null,
|
|
8040
8181
|
`[ESI Rate Limit] Legacy error limit low (${errorLimit.remain}), waiting ${delay}ms`,
|
|
8041
8182
|
{ errorLimitRemain: errorLimit.remain }
|
|
@@ -8044,7 +8185,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8044
8185
|
}
|
|
8045
8186
|
} else if (errorLimit.remain <= 0 && errorLimit.reset > 0) {
|
|
8046
8187
|
const waitTime = errorLimit.reset * 1e3;
|
|
8047
|
-
|
|
8188
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
8048
8189
|
null,
|
|
8049
8190
|
`[ESI Rate Limit] Legacy error limit exhausted, waiting ${Math.ceil(waitTime / 1e3)}s`,
|
|
8050
8191
|
{ errorLimitReset: errorLimit.reset }
|
|
@@ -8055,7 +8196,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8055
8196
|
if (bucket.remaining >= 0 && bucket.limit > 0) {
|
|
8056
8197
|
const ratio = bucket.remaining / bucket.limit;
|
|
8057
8198
|
if (bucket.remaining <= 0) {
|
|
8058
|
-
|
|
8199
|
+
_chunkN3B65VLBjs.logWarn2.call(void 0,
|
|
8059
8200
|
null,
|
|
8060
8201
|
`[ESI Rate Limit] Group '${bucket.group}' token bucket empty, waiting 1s`,
|
|
8061
8202
|
{ group: bucket.group }
|
|
@@ -8193,7 +8334,7 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8193
8334
|
const existing = this.inflight.get(key);
|
|
8194
8335
|
if (existing) {
|
|
8195
8336
|
if (this.client) {
|
|
8196
|
-
|
|
8337
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0, this.client, `[Dedup] Coalescing request: ${key}`);
|
|
8197
8338
|
}
|
|
8198
8339
|
return existing;
|
|
8199
8340
|
}
|
|
@@ -8203,6 +8344,32 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8203
8344
|
this.inflight.set(key, promise);
|
|
8204
8345
|
return promise;
|
|
8205
8346
|
}
|
|
8347
|
+
/**
|
|
8348
|
+
* Drop the in-flight entries whose key contains `pathSegment`, so a call
|
|
8349
|
+
* made after a write cannot join a request sent before it.
|
|
8350
|
+
*
|
|
8351
|
+
* The requests themselves keep running and whoever already joined them still
|
|
8352
|
+
* gets their answer. Only the map entry goes, which is what new callers look
|
|
8353
|
+
* in. Matching is `includes`, the same rule ETagCacheManager.deleteByPath
|
|
8354
|
+
* uses, so one written path invalidates the cache and detaches the reads of
|
|
8355
|
+
* it by the same test.
|
|
8356
|
+
*/
|
|
8357
|
+
detachByPath(pathSegment) {
|
|
8358
|
+
let count = 0;
|
|
8359
|
+
for (const key of this.inflight.keys()) {
|
|
8360
|
+
if (key.includes(pathSegment)) {
|
|
8361
|
+
this.inflight.delete(key);
|
|
8362
|
+
count += 1;
|
|
8363
|
+
}
|
|
8364
|
+
}
|
|
8365
|
+
if (count > 0 && this.client) {
|
|
8366
|
+
_chunkN3B65VLBjs.logDebug2.call(void 0,
|
|
8367
|
+
this.client,
|
|
8368
|
+
`[Dedup] Detached ${count} in-flight request(s) matching ${pathSegment} after a write`
|
|
8369
|
+
);
|
|
8370
|
+
}
|
|
8371
|
+
return count;
|
|
8372
|
+
}
|
|
8206
8373
|
get pending() {
|
|
8207
8374
|
return this.inflight.size;
|
|
8208
8375
|
}
|
|
@@ -8214,25 +8381,25 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8214
8381
|
// src/core/configureApiClient.ts
|
|
8215
8382
|
function configureApiClient(client, config) {
|
|
8216
8383
|
let deduplicator = null;
|
|
8217
|
-
client.setRateLimiter(new RateLimiter(_optionalChain([config, 'optionalAccess',
|
|
8218
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8384
|
+
client.setRateLimiter(new RateLimiter(_optionalChain([config, 'optionalAccess', _19 => _19.rateLimiterConfig])));
|
|
8385
|
+
if (_optionalChain([config, 'optionalAccess', _20 => _20.enableRequestDeduplication]) !== false) {
|
|
8219
8386
|
deduplicator = new RequestDeduplicator();
|
|
8220
8387
|
deduplicator.setClient(client);
|
|
8221
8388
|
client.setDeduplicator(deduplicator);
|
|
8222
8389
|
}
|
|
8223
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8224
|
-
const cache = new ETagCacheManager(_optionalChain([config, 'optionalAccess',
|
|
8390
|
+
if (_optionalChain([config, 'optionalAccess', _21 => _21.enableETagCache]) !== false) {
|
|
8391
|
+
const cache = new ETagCacheManager(_optionalChain([config, 'optionalAccess', _22 => _22.etagCacheConfig]));
|
|
8225
8392
|
cache.setClient(client);
|
|
8226
8393
|
client.setCache(cache);
|
|
8227
8394
|
}
|
|
8228
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8229
|
-
const cb = new (0,
|
|
8395
|
+
if (_optionalChain([config, 'optionalAccess', _23 => _23.enableCircuitBreaker])) {
|
|
8396
|
+
const cb = new (0, _chunkN3B65VLBjs.CircuitBreaker)(config.circuitBreakerConfig);
|
|
8230
8397
|
cb.setClient(client);
|
|
8231
8398
|
client.setCircuitBreaker(cb);
|
|
8232
8399
|
}
|
|
8233
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8400
|
+
if (_optionalChain([config, 'optionalAccess', _24 => _24.retryConfig])) {
|
|
8234
8401
|
client.setRetryConfig(config.retryConfig);
|
|
8235
|
-
} else if (_optionalChain([config, 'optionalAccess',
|
|
8402
|
+
} else if (_optionalChain([config, 'optionalAccess', _25 => _25.retryAttempts]) !== void 0) {
|
|
8236
8403
|
client.setRetryConfig({ maxRetries: config.retryAttempts });
|
|
8237
8404
|
} else {
|
|
8238
8405
|
client.setRetryConfig({
|
|
@@ -8241,32 +8408,32 @@ function configureApiClient(client, config) {
|
|
|
8241
8408
|
maxDelayMs: 3e4
|
|
8242
8409
|
});
|
|
8243
8410
|
}
|
|
8244
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8411
|
+
if (_optionalChain([config, 'optionalAccess', _26 => _26.retryStrategy])) {
|
|
8245
8412
|
client.setRetryStrategy(config.retryStrategy);
|
|
8246
8413
|
}
|
|
8247
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8414
|
+
if (_optionalChain([config, 'optionalAccess', _27 => _27.requestInterceptors])) {
|
|
8248
8415
|
for (const interceptor of config.requestInterceptors) {
|
|
8249
8416
|
client.addRequestInterceptor(interceptor);
|
|
8250
8417
|
}
|
|
8251
8418
|
}
|
|
8252
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8419
|
+
if (_optionalChain([config, 'optionalAccess', _28 => _28.responseInterceptors])) {
|
|
8253
8420
|
for (const interceptor of config.responseInterceptors) {
|
|
8254
8421
|
client.addResponseInterceptor(interceptor);
|
|
8255
8422
|
}
|
|
8256
8423
|
}
|
|
8257
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8424
|
+
if (_optionalChain([config, 'optionalAccess', _29 => _29.validateResponse]) !== void 0) {
|
|
8258
8425
|
client.setValidateResponse(config.validateResponse);
|
|
8259
8426
|
}
|
|
8260
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8427
|
+
if (_optionalChain([config, 'optionalAccess', _30 => _30.validateRequest]) !== void 0) {
|
|
8261
8428
|
client.setValidateRequest(config.validateRequest);
|
|
8262
8429
|
}
|
|
8263
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8430
|
+
if (_optionalChain([config, 'optionalAccess', _31 => _31.timeout]) !== void 0) {
|
|
8264
8431
|
client.setTimeout(config.timeout);
|
|
8265
8432
|
}
|
|
8266
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8433
|
+
if (_optionalChain([config, 'optionalAccess', _32 => _32.logger])) {
|
|
8267
8434
|
client.setLogger(config.logger);
|
|
8268
|
-
} else if (_optionalChain([config, 'optionalAccess',
|
|
8269
|
-
client.setLogger(
|
|
8435
|
+
} else if (_optionalChain([config, 'optionalAccess', _33 => _33.logLevel])) {
|
|
8436
|
+
client.setLogger(_chunkN3B65VLBjs.createDefaultLogger.call(void 0, config.logLevel));
|
|
8270
8437
|
}
|
|
8271
8438
|
return { deduplicator };
|
|
8272
8439
|
}
|
|
@@ -8279,36 +8446,36 @@ var EsiClient = (_class7 = class {
|
|
|
8279
8446
|
__init29() {this._diagnostics = null}
|
|
8280
8447
|
__init30() {this.deduplicator = null}
|
|
8281
8448
|
constructor(config) {;_class7.prototype.__init28.call(this);_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);
|
|
8282
|
-
const token = _optionalChain([config, 'optionalAccess',
|
|
8449
|
+
const token = _optionalChain([config, 'optionalAccess', _34 => _34.accessToken]) || process.env.ESI_ACCESS_TOKEN;
|
|
8283
8450
|
const baseUrl = validateBaseUrl(
|
|
8284
|
-
_optionalChain([config, 'optionalAccess',
|
|
8285
|
-
_optionalChain([config, 'optionalAccess',
|
|
8451
|
+
_optionalChain([config, 'optionalAccess', _35 => _35.baseUrl]) || process.env.ESI_BASE_URL || "https://esi.evetech.net",
|
|
8452
|
+
_optionalChain([config, 'optionalAccess', _36 => _36.unsafeAllowCustomHost])
|
|
8286
8453
|
);
|
|
8287
8454
|
this.apiClient = new ApiClient(
|
|
8288
|
-
_optionalChain([config, 'optionalAccess',
|
|
8455
|
+
_optionalChain([config, 'optionalAccess', _37 => _37.clientId]) || process.env.ESI_CLIENT_ID || "esi-client",
|
|
8289
8456
|
baseUrl,
|
|
8290
8457
|
token
|
|
8291
8458
|
);
|
|
8292
|
-
const datasource = _optionalChain([config, 'optionalAccess',
|
|
8459
|
+
const datasource = _optionalChain([config, 'optionalAccess', _38 => _38.datasource]) || process.env.ESI_DATASOURCE;
|
|
8293
8460
|
if (datasource) {
|
|
8294
8461
|
this.apiClient.setDatasource(datasource);
|
|
8295
8462
|
}
|
|
8296
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8463
|
+
if (_optionalChain([config, 'optionalAccess', _39 => _39.language])) {
|
|
8297
8464
|
this.apiClient.setLanguage(config.language);
|
|
8298
8465
|
}
|
|
8299
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8466
|
+
if (_optionalChain([config, 'optionalAccess', _40 => _40.compatibilityDate])) {
|
|
8300
8467
|
this.apiClient.setCompatibilityDate(config.compatibilityDate);
|
|
8301
8468
|
}
|
|
8302
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8469
|
+
if (_optionalChain([config, 'optionalAccess', _41 => _41.onTokenRefresh])) {
|
|
8303
8470
|
this.apiClient.setTokenProvider(config.onTokenRefresh);
|
|
8304
8471
|
}
|
|
8305
8472
|
const result = configureApiClient(this.apiClient, config);
|
|
8306
8473
|
this.deduplicator = result.deduplicator;
|
|
8307
|
-
this.etagCacheEnabled = _optionalChain([config, 'optionalAccess',
|
|
8308
|
-
const clientLogger = _nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8474
|
+
this.etagCacheEnabled = _optionalChain([config, 'optionalAccess', _42 => _42.enableETagCache]) !== false;
|
|
8475
|
+
const clientLogger = _nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )));
|
|
8309
8476
|
clientLogger.info("EsiClient initialized successfully", {
|
|
8310
8477
|
baseUrl,
|
|
8311
|
-
clientId: _optionalChain([config, 'optionalAccess',
|
|
8478
|
+
clientId: _optionalChain([config, 'optionalAccess', _43 => _43.clientId])
|
|
8312
8479
|
});
|
|
8313
8480
|
}
|
|
8314
8481
|
getClient(name) {
|
|
@@ -8443,11 +8610,11 @@ var EsiClient = (_class7 = class {
|
|
|
8443
8610
|
}
|
|
8444
8611
|
setAccessToken(token) {
|
|
8445
8612
|
this.apiClient.setAccessToken(token);
|
|
8446
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8613
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )))).info("Access token updated");
|
|
8447
8614
|
}
|
|
8448
8615
|
setTokenProvider(provider) {
|
|
8449
8616
|
this.apiClient.setTokenProvider(provider);
|
|
8450
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8617
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )))).info(
|
|
8451
8618
|
provider ? "Token provider configured" : "Token provider removed"
|
|
8452
8619
|
);
|
|
8453
8620
|
}
|
|
@@ -8495,7 +8662,7 @@ var EsiClient = (_class7 = class {
|
|
|
8495
8662
|
this.deduplicator.clear();
|
|
8496
8663
|
}
|
|
8497
8664
|
this.clients.clear();
|
|
8498
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8665
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )))).info(
|
|
8499
8666
|
"EsiClient shutdown completed"
|
|
8500
8667
|
);
|
|
8501
8668
|
}
|
|
@@ -8543,7 +8710,7 @@ var CustomEsiClient = (_class8 = class {
|
|
|
8543
8710
|
for (const name of this.enabledClients) {
|
|
8544
8711
|
this.clients.set(name, createClientInstance(name, this.apiClient));
|
|
8545
8712
|
}
|
|
8546
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8713
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )))).info(
|
|
8547
8714
|
`CustomEsiClient initialized with clients: ${config.clients.join(", ")}`,
|
|
8548
8715
|
{ clients: config.clients }
|
|
8549
8716
|
);
|
|
@@ -8675,7 +8842,7 @@ var CustomEsiClient = (_class8 = class {
|
|
|
8675
8842
|
this.deduplicator.clear();
|
|
8676
8843
|
}
|
|
8677
8844
|
this.clients.clear();
|
|
8678
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8845
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )))).info(
|
|
8679
8846
|
"CustomEsiClient shutdown completed"
|
|
8680
8847
|
);
|
|
8681
8848
|
}
|
|
@@ -8740,21 +8907,21 @@ var EsiApiFactory = class {
|
|
|
8740
8907
|
}
|
|
8741
8908
|
static buildApiClient(config) {
|
|
8742
8909
|
const baseUrl = validateBaseUrl(
|
|
8743
|
-
_optionalChain([config, 'optionalAccess',
|
|
8744
|
-
_optionalChain([config, 'optionalAccess',
|
|
8910
|
+
_optionalChain([config, 'optionalAccess', _44 => _44.baseUrl]) || process.env.ESI_BASE_URL || "https://esi.evetech.net",
|
|
8911
|
+
_optionalChain([config, 'optionalAccess', _45 => _45.unsafeAllowCustomHost])
|
|
8745
8912
|
);
|
|
8746
8913
|
const client = new ApiClient(
|
|
8747
|
-
_optionalChain([config, 'optionalAccess',
|
|
8914
|
+
_optionalChain([config, 'optionalAccess', _46 => _46.clientId]) || process.env.ESI_CLIENT_ID || "esi-standalone-client",
|
|
8748
8915
|
baseUrl,
|
|
8749
|
-
_optionalChain([config, 'optionalAccess',
|
|
8916
|
+
_optionalChain([config, 'optionalAccess', _47 => _47.accessToken]) || process.env.ESI_ACCESS_TOKEN
|
|
8750
8917
|
);
|
|
8751
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8918
|
+
if (_optionalChain([config, 'optionalAccess', _48 => _48.language])) {
|
|
8752
8919
|
client.setLanguage(config.language);
|
|
8753
8920
|
}
|
|
8754
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8921
|
+
if (_optionalChain([config, 'optionalAccess', _49 => _49.onTokenRefresh])) {
|
|
8755
8922
|
client.setTokenProvider(config.onTokenRefresh);
|
|
8756
8923
|
}
|
|
8757
|
-
const datasource = _optionalChain([config, 'optionalAccess',
|
|
8924
|
+
const datasource = _optionalChain([config, 'optionalAccess', _50 => _50.datasource]);
|
|
8758
8925
|
if (datasource) {
|
|
8759
8926
|
client.setDatasource(datasource);
|
|
8760
8927
|
}
|
|
@@ -8852,6 +9019,8 @@ var ApiClientBuilder = class {
|
|
|
8852
9019
|
var esiEndpointScopes = {
|
|
8853
9020
|
"GET:alliances/{alliance_id}/contacts": ["esi-alliances.read_contacts.v1"],
|
|
8854
9021
|
"GET:alliances/{alliance_id}/contacts/labels": ["esi-alliances.read_contacts.v1"],
|
|
9022
|
+
"GET:characters/{character_id}/access-lists": ["esi-access.read_lists.v1"],
|
|
9023
|
+
"GET:characters/{character_id}/access-lists/{access_list_id}": ["esi-access.read_lists.v1"],
|
|
8855
9024
|
"GET:characters/{character_id}/agents_research": ["esi-characters.read_agents_research.v1"],
|
|
8856
9025
|
"GET:characters/{character_id}/assets": ["esi-assets.read_assets.v1"],
|
|
8857
9026
|
"POST:characters/{character_id}/assets/locations": ["esi-assets.read_assets.v1"],
|
|
@@ -8895,6 +9064,8 @@ var esiEndpointScopes = {
|
|
|
8895
9064
|
"DELETE:characters/{character_id}/mail/labels/{label_id}": ["esi-mail.organize_mail.v1"],
|
|
8896
9065
|
"GET:characters/{character_id}/mail/lists": ["esi-mail.read_mail.v1"],
|
|
8897
9066
|
"GET:characters/{character_id}/medals": ["esi-characters.read_medals.v1"],
|
|
9067
|
+
"GET:characters/{character_id}/mercenary-tactical-operations": ["esi-activities.read_character.v1"],
|
|
9068
|
+
"GET:characters/{character_id}/mercenary-tactical-operations/{operation_id}": ["esi-activities.read_character.v1"],
|
|
8898
9069
|
"GET:characters/{character_id}/mining": ["esi-industry.read_character_mining.v1"],
|
|
8899
9070
|
"GET:characters/{character_id}/notifications": ["esi-characters.read_notifications.v1"],
|
|
8900
9071
|
"GET:characters/{character_id}/notifications/contacts": ["esi-characters.read_notifications.v1"],
|
|
@@ -8909,6 +9080,8 @@ var esiEndpointScopes = {
|
|
|
8909
9080
|
"GET:characters/{character_id}/skillqueue": ["esi-skills.read_skillqueue.v1"],
|
|
8910
9081
|
"GET:characters/{character_id}/skills": ["esi-skills.read_skills.v1"],
|
|
8911
9082
|
"GET:characters/{character_id}/standings": ["esi-characters.read_standings.v1"],
|
|
9083
|
+
"GET:characters/{character_id}/structures/mercenary-dens": ["esi-structures.read_character.v1"],
|
|
9084
|
+
"GET:characters/{character_id}/structures/mercenary-dens/{mercenary_den_id}": ["esi-structures.read_character.v1"],
|
|
8912
9085
|
"GET:characters/{character_id}/titles": ["esi-characters.read_titles.v1"],
|
|
8913
9086
|
"GET:characters/{character_id}/wallet": ["esi-wallet.read_character_wallet.v1"],
|
|
8914
9087
|
"GET:characters/{character_id}/wallet/journal": ["esi-wallet.read_character_wallet.v1"],
|
|
@@ -8953,6 +9126,10 @@ var esiEndpointScopes = {
|
|
|
8953
9126
|
"GET:corporations/{corporation_id}/starbases": ["esi-corporations.read_starbases.v1"],
|
|
8954
9127
|
"GET:corporations/{corporation_id}/starbases/{starbase_id}": ["esi-corporations.read_starbases.v1"],
|
|
8955
9128
|
"GET:corporations/{corporation_id}/structures": ["esi-corporations.read_structures.v1"],
|
|
9129
|
+
"GET:corporations/{corporation_id}/structures/skyhooks": ["esi-structures.read_corporation.v1"],
|
|
9130
|
+
"GET:corporations/{corporation_id}/structures/skyhooks/{skyhook_id}": ["esi-structures.read_corporation.v1"],
|
|
9131
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs": ["esi-structures.read_corporation.v1"],
|
|
9132
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs/{sovereignty_hub_id}": ["esi-structures.read_corporation.v1"],
|
|
8956
9133
|
"GET:corporations/{corporation_id}/titles": ["esi-corporations.read_titles.v1"],
|
|
8957
9134
|
"GET:corporations/{corporation_id}/wallets": ["esi-wallet.read_corporation_wallets.v1"],
|
|
8958
9135
|
"GET:corporations/{corporation_id}/wallets/{division}/journal": ["esi-wallet.read_corporation_wallets.v1"],
|
|
@@ -9189,7 +9366,7 @@ function resolveLimit(requested) {
|
|
|
9189
9366
|
}
|
|
9190
9367
|
async function runWithConcurrency(items, worker, options = {}) {
|
|
9191
9368
|
const limit = resolveLimit(options.concurrency);
|
|
9192
|
-
const results =
|
|
9369
|
+
const results = [];
|
|
9193
9370
|
let nextIndex = 0;
|
|
9194
9371
|
let completed = 0;
|
|
9195
9372
|
async function runOne() {
|
|
@@ -9343,7 +9520,7 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9343
9520
|
})));
|
|
9344
9521
|
this.refreshSkewMs = _nullishCoalesce(config.refreshSkewMs, () => ( 6e4));
|
|
9345
9522
|
this.autoRefresh = _nullishCoalesce(config.autoRefresh, () => ( true));
|
|
9346
|
-
this.logger = _nullishCoalesce(config.logger, () => (
|
|
9523
|
+
this.logger = _nullishCoalesce(config.logger, () => ( _chunkN3B65VLBjs.getLogger.call(void 0, )));
|
|
9347
9524
|
this.now = _nullishCoalesce(config.now, () => ( (() => Date.now())));
|
|
9348
9525
|
this.hooks = {
|
|
9349
9526
|
onRefresh: config.onRefresh,
|
|
@@ -9566,14 +9743,14 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9566
9743
|
this.logger.warn(
|
|
9567
9744
|
`SSO revoked refresh token for character ${characterId}`
|
|
9568
9745
|
);
|
|
9569
|
-
_optionalChain([this, 'access',
|
|
9746
|
+
_optionalChain([this, 'access', _51 => _51.hooks, 'access', _52 => _52.onRevoked, 'optionalCall', _53 => _53(characterId)]);
|
|
9570
9747
|
throw new (0, _chunkBBSHKVPIjs.TokenRevokedError)(err.message, characterId);
|
|
9571
9748
|
}
|
|
9572
9749
|
const error = toError(err);
|
|
9573
9750
|
this.logger.error(
|
|
9574
9751
|
`Token refresh failed for character ${characterId}: ${error.message}`
|
|
9575
9752
|
);
|
|
9576
|
-
_optionalChain([this, 'access',
|
|
9753
|
+
_optionalChain([this, 'access', _54 => _54.hooks, 'access', _55 => _55.onRefreshError, 'optionalCall', _56 => _56(characterId, error)]);
|
|
9577
9754
|
throw error;
|
|
9578
9755
|
}
|
|
9579
9756
|
const superseded = await this.supersededBy(characterId, generation);
|
|
@@ -9581,12 +9758,12 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9581
9758
|
const updated = this.buildStoredToken(response, stored);
|
|
9582
9759
|
await this.storage.set(characterId, updated);
|
|
9583
9760
|
this.logger.debug(`Refreshed token for character ${characterId}`);
|
|
9584
|
-
_optionalChain([this, 'access',
|
|
9761
|
+
_optionalChain([this, 'access', _57 => _57.hooks, 'access', _58 => _58.onRefresh, 'optionalCall', _59 => _59(updated)]);
|
|
9585
9762
|
return updated;
|
|
9586
9763
|
}
|
|
9587
9764
|
async refreshOne(token, options) {
|
|
9588
9765
|
const { characterId } = token;
|
|
9589
|
-
if (_optionalChain([options, 'access',
|
|
9766
|
+
if (_optionalChain([options, 'access', _60 => _60.signal, 'optionalAccess', _61 => _61.aborted])) {
|
|
9590
9767
|
return { characterId, status: "skipped", reason: "aborted" };
|
|
9591
9768
|
}
|
|
9592
9769
|
if (token.revokedAt !== void 0) {
|
|
@@ -9660,17 +9837,17 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9660
9837
|
}
|
|
9661
9838
|
const now = this.now();
|
|
9662
9839
|
const expiresAt = response.expiresIn > 0 ? now + response.expiresIn * 1e3 : _nullishCoalesce(decoded.expiresAt, () => ( now));
|
|
9663
|
-
const scopes = decoded.scopes && decoded.scopes.length > 0 ? decoded.scopes : _nullishCoalesce(_optionalChain([previous, 'optionalAccess',
|
|
9840
|
+
const scopes = decoded.scopes && decoded.scopes.length > 0 ? decoded.scopes : _nullishCoalesce(_optionalChain([previous, 'optionalAccess', _62 => _62.scopes]), () => ( []));
|
|
9664
9841
|
const token = {
|
|
9665
9842
|
characterId: _nullishCoalesce(decoded.characterId, () => ( previous.characterId)),
|
|
9666
|
-
characterName: decoded.characterName || _optionalChain([previous, 'optionalAccess',
|
|
9843
|
+
characterName: decoded.characterName || _optionalChain([previous, 'optionalAccess', _63 => _63.characterName]) || "",
|
|
9667
9844
|
accessToken: response.accessToken,
|
|
9668
9845
|
refreshToken: response.refreshToken,
|
|
9669
9846
|
expiresAt,
|
|
9670
9847
|
scopes,
|
|
9671
9848
|
updatedAt: now
|
|
9672
9849
|
};
|
|
9673
|
-
const ownerHash = _nullishCoalesce(decoded.ownerHash, () => ( _optionalChain([previous, 'optionalAccess',
|
|
9850
|
+
const ownerHash = _nullishCoalesce(decoded.ownerHash, () => ( _optionalChain([previous, 'optionalAccess', _64 => _64.ownerHash])));
|
|
9674
9851
|
if (ownerHash !== void 0) token.ownerHash = ownerHash;
|
|
9675
9852
|
return token;
|
|
9676
9853
|
}
|
|
@@ -9931,5 +10108,5 @@ function generateState() {
|
|
|
9931
10108
|
|
|
9932
10109
|
|
|
9933
10110
|
|
|
9934
|
-
exports.AccessListsClient = AccessListsClient; exports.AllianceClient = AllianceClient; exports.ApiClient = ApiClient; exports.ApiClientBuilder = ApiClientBuilder; exports.AssetsClient = AssetsClient; exports.AuthError = _chunkBBSHKVPIjs.AuthError; exports.BaseEsiClient = BaseEsiClient; exports.CalendarClient = CalendarClient; exports.CharacterClient = CharacterClient; exports.CharacterNotFoundError = _chunkBBSHKVPIjs.CharacterNotFoundError; exports.CharacterSkillsClient = CharacterSkillsClient; exports.CircuitBreaker =
|
|
10111
|
+
exports.AccessListsClient = AccessListsClient; exports.AllianceClient = AllianceClient; exports.ApiClient = ApiClient; exports.ApiClientBuilder = ApiClientBuilder; exports.AssetsClient = AssetsClient; exports.AuthError = _chunkBBSHKVPIjs.AuthError; exports.BaseEsiClient = BaseEsiClient; exports.CalendarClient = CalendarClient; exports.CharacterClient = CharacterClient; exports.CharacterNotFoundError = _chunkBBSHKVPIjs.CharacterNotFoundError; exports.CharacterSkillsClient = CharacterSkillsClient; exports.CircuitBreaker = _chunkN3B65VLBjs.CircuitBreaker; exports.CircuitOpenError = _chunkN3B65VLBjs.CircuitOpenError; exports.ClonesClient = ClonesClient; exports.ContactsClient = ContactsClient; exports.ContractsClient = ContractsClient; exports.CorporationProjectsClient = CorporationProjectsClient; exports.CorporationsClient = CorporationsClient; exports.CosmeticsClient = CosmeticsClient; exports.CustomEsiClient = CustomEsiClient; exports.DEFAULT_SSO_BASE_URL = DEFAULT_SSO_BASE_URL; exports.DogmaClient = DogmaClient; exports.ETagCacheManager = ETagCacheManager; exports.EsiApiFactory = EsiApiFactory; exports.EsiClient = EsiClient; exports.EsiClientBuilder = EsiClientBuilder; exports.EsiDiagnostics = EsiDiagnostics; exports.EsiError = _chunkN3B65VLBjs.EsiError; exports.EsiSpec = esi_spec_generated_exports; exports.EsiTokenManager = EsiTokenManager; exports.EsiValidationError = _chunkN3B65VLBjs.EsiValidationError; exports.EveSsoClient = EveSsoClient; exports.FactionClient = FactionClient; exports.FileTokenStorage = FileTokenStorage; exports.FittingsClient = FittingsClient; exports.FleetClient = FleetClient; exports.FreelanceJobsClient = FreelanceJobsClient; exports.IncursionsClient = IncursionsClient; exports.IndustryClient = IndustryClient; exports.InsuranceClient = InsuranceClient; exports.KillmailsClient = KillmailsClient; exports.LocationClient = LocationClient; exports.LoyaltyClient = LoyaltyClient; exports.MailClient = MailClient; exports.MarketClient = MarketClient; exports.MemoryTokenStorage = MemoryTokenStorage; exports.MercenaryClient = MercenaryClient; exports.MetaClient = MetaClient; exports.MilitaryCampaignsClient = MilitaryCampaignsClient; exports.ParagonHubClient = ParagonHubClient; exports.PiClient = PiClient; exports.RateLimiter = RateLimiter; exports.RequestDeduplicator = RequestDeduplicator; exports.RetryStrategy = RetryStrategy; exports.RouteClient = RouteClient; exports.SearchClient = SearchClient; exports.SkyhooksClient = SkyhooksClient; exports.SovereigntyClient = SovereigntyClient; exports.SsoError = _chunkBBSHKVPIjs.SsoError; exports.StatusClient = StatusClient; exports.TimeoutError = _chunkN3B65VLBjs.TimeoutError; exports.TokenDecodeError = _chunkBBSHKVPIjs.TokenDecodeError; exports.TokenRevokedError = _chunkBBSHKVPIjs.TokenRevokedError; exports.UiClient = UiClient; exports.UniverseClient = UniverseClient; exports.WalletClient = WalletClient; exports.WarsClient = WarsClient; exports.batchFetch = batchFetch; exports.batchPost = batchPost; exports.brand = brand; exports.buildEndpointPath = buildEndpointPath; exports.codeChallengeFromVerifier = codeChallengeFromVerifier; exports.configureApiClient = configureApiClient; exports.createDefaultLogger = _chunkN3B65VLBjs.createDefaultLogger; exports.createNoopLogger = createNoopLogger; exports.decodeAccessToken = decodeAccessToken; exports.decodeJwtPayload = decodeJwtPayload; exports.esiEndpointScopes = esiEndpointScopes; exports.fetchAllCursorPages = fetchAllCursorPages; exports.fetchAllPages = fetchAllPages; exports.fetchPages = fetchPages; exports.generateCodeVerifier = generateCodeVerifier; exports.generatePkcePair = generatePkcePair; exports.generateState = generateState; exports.getDefaultClient = getDefaultClient; exports.getLogger = _chunkN3B65VLBjs.getLogger; exports.isAuthError = _chunkBBSHKVPIjs.isAuthError; exports.isCharacterNotFound = _chunkBBSHKVPIjs.isCharacterNotFound; exports.isCircuitOpen = _chunkN3B65VLBjs.isCircuitOpen; exports.isEsiError = _chunkN3B65VLBjs.isEsiError; exports.isForbidden = _chunkN3B65VLBjs.isForbidden; exports.isNotFound = _chunkN3B65VLBjs.isNotFound; exports.isRateLimited = _chunkN3B65VLBjs.isRateLimited; exports.isRetryable = _chunkN3B65VLBjs.isRetryable; exports.isServerError = _chunkN3B65VLBjs.isServerError; exports.isSsoError = _chunkBBSHKVPIjs.isSsoError; exports.isTimeout = _chunkN3B65VLBjs.isTimeout; exports.isTokenRevoked = _chunkBBSHKVPIjs.isTokenRevoked; exports.isUnauthorized = _chunkN3B65VLBjs.isUnauthorized; exports.isValidationError = _chunkN3B65VLBjs.isValidationError; exports.logDebug = _chunkN3B65VLBjs.logDebug; exports.logError = _chunkN3B65VLBjs.logError; exports.logFatal = _chunkN3B65VLBjs.logFatal; exports.logInfo = _chunkN3B65VLBjs.logInfo; exports.logTrace = _chunkN3B65VLBjs.logTrace; exports.logWarn = _chunkN3B65VLBjs.logWarn; exports.parseCharacterId = parseCharacterId; exports.parseScopes = parseScopes; exports.sanitizeUrl = _chunkN3B65VLBjs.sanitizeUrl; exports.schemas = _chunkSAQBXXTMjs.schemas_exports; exports.setLogger = _chunkN3B65VLBjs.setLogger; exports.toPinoLogger = _chunkN3B65VLBjs.toPinoLogger;
|
|
9935
10112
|
//# sourceMappingURL=index.js.map
|