@lgriffin/esi.ts 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -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-D5L5HZVF.mjs} +3 -2
- package/dist/chunk-D5L5HZVF.mjs.map +1 -0
- package/dist/{chunk-HPSACXX3.js → chunk-XIB2OXEZ.js} +3 -2
- package/dist/chunk-XIB2OXEZ.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/middleware/Middleware.d.mts +30 -0
- package/dist/core/pagination/AsyncPaginationIterator.d.mts +12 -0
- package/dist/core/pagination/CursorPaginationHandler.d.mts +68 -0
- 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/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 +373 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +266 -88
- 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 _chunkXIB2OXEZjs = require('./chunk-XIB2OXEZ.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.0";
|
|
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 _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.EsiError || error instanceof _chunkXIB2OXEZjs.CircuitOpenError) {
|
|
830
895
|
throw error;
|
|
831
896
|
}
|
|
832
897
|
if (error instanceof Error) {
|
|
833
|
-
|
|
834
|
-
throw
|
|
898
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, client, `Unexpected error: ${error.message}`);
|
|
899
|
+
throw _chunkXIB2OXEZjs.buildError.call(void 0, error.message, "ESIJS_ERROR");
|
|
835
900
|
}
|
|
836
|
-
|
|
837
|
-
throw
|
|
901
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, client, `Unexpected error: ${String(error)}`);
|
|
902
|
+
throw _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.CircuitOpenError) {
|
|
873
938
|
throw error;
|
|
874
939
|
}
|
|
875
|
-
if (!refreshAttempted && error instanceof
|
|
940
|
+
if (!refreshAttempted && error instanceof _chunkXIB2OXEZjs.EsiError && error.statusCode === 401 && context.requiresAuth && context.refreshToken) {
|
|
876
941
|
refreshAttempted = true;
|
|
877
|
-
|
|
942
|
+
_chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.EsiError || refreshError instanceof _chunkXIB2OXEZjs.CircuitOpenError) {
|
|
884
949
|
throw refreshError;
|
|
885
950
|
}
|
|
886
951
|
const msg = refreshError instanceof Error ? refreshError.message : String(refreshError);
|
|
887
|
-
|
|
952
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, context.client, `Token refresh failed: ${msg}`, {
|
|
888
953
|
endpoint: context.endpoint
|
|
889
954
|
});
|
|
890
|
-
throw
|
|
955
|
+
throw _chunkXIB2OXEZjs.buildError.call(void 0,
|
|
891
956
|
`Token refresh failed: ${msg}`,
|
|
892
957
|
"TOKEN_REFRESH_FAILED"
|
|
893
958
|
);
|
|
894
959
|
}
|
|
895
|
-
|
|
960
|
+
_chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.EsiError && error.retryable && canRetryMethod && attempt < this.maxRetries) {
|
|
902
967
|
const delay = retryDelay(attempt, this.baseDelayMs, this.maxDelayMs);
|
|
903
|
-
|
|
968
|
+
_chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.EsiError || paginationError instanceof _chunkXIB2OXEZjs.CircuitOpenError) {
|
|
1095
1162
|
throw paginationError;
|
|
1096
1163
|
}
|
|
1097
|
-
throw
|
|
1164
|
+
throw _chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, client, `Failed to parse JSON response: ${msg}`, { url: _url });
|
|
1359
|
+
throw _chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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
|
-
rawUrl,
|
|
1458
|
-
method,
|
|
1459
|
-
templatePath,
|
|
1460
|
-
resolveCache,
|
|
1461
|
-
requiresAuth
|
|
1462
|
-
);
|
|
1463
|
-
if (specHit) {
|
|
1464
|
-
return applyResponseInterceptors(
|
|
1557
|
+
const specCacheHit = () => {
|
|
1558
|
+
const hit = trySpecAwareCacheHit(
|
|
1465
1559
|
client,
|
|
1466
|
-
|
|
1560
|
+
rawUrl,
|
|
1561
|
+
method,
|
|
1562
|
+
templatePath,
|
|
1563
|
+
resolveCache,
|
|
1564
|
+
requiresAuth
|
|
1565
|
+
);
|
|
1566
|
+
return hit ? applyResponseInterceptors(
|
|
1567
|
+
client,
|
|
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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.buildError.call(void 0, `Invalid base URL: ${url}`, "VALIDATION_ERROR");
|
|
1528
1641
|
}
|
|
1529
1642
|
if (parsed.protocol !== "https:") {
|
|
1530
|
-
throw
|
|
1643
|
+
throw _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.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
|
+
_chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.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 _chunkXIB2OXEZjs.EsiError ? err : new (0, _chunkXIB2OXEZjs.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, _chunkXIB2OXEZjs.EsiValidationError)(url, result.error);
|
|
1813
1926
|
}
|
|
1814
1927
|
return result.data;
|
|
1815
1928
|
}
|
|
@@ -1839,7 +1952,7 @@ async function fetchAllPages(client, endpoint, method, requiresAuth = false, bod
|
|
|
1839
1952
|
batch.map(async (page) => {
|
|
1840
1953
|
const sep = endpoint.includes("?") ? "&" : "?";
|
|
1841
1954
|
const pagedEndpoint = `${endpoint}${sep}page=${page}`;
|
|
1842
|
-
|
|
1955
|
+
_chunkXIB2OXEZjs.logInfo2.call(void 0,
|
|
1843
1956
|
client,
|
|
1844
1957
|
`Fetching page ${page}/${totalPages}: ${pagedEndpoint}`,
|
|
1845
1958
|
{ page, totalPages }
|
|
@@ -1887,7 +2000,7 @@ async function* fetchPages(client, endpoint, method, requiresAuth = false, body,
|
|
|
1887
2000
|
for (let page = 2; page <= totalPages; page++) {
|
|
1888
2001
|
const sep = endpoint.includes("?") ? "&" : "?";
|
|
1889
2002
|
const pagedEndpoint = `${endpoint}${sep}page=${page}`;
|
|
1890
|
-
|
|
2003
|
+
_chunkXIB2OXEZjs.logInfo2.call(void 0, client, `Fetching page ${page}/${totalPages}: ${pagedEndpoint}`, {
|
|
1891
2004
|
page,
|
|
1892
2005
|
totalPages
|
|
1893
2006
|
});
|
|
@@ -2104,7 +2217,7 @@ var AllianceClient = class extends BaseEsiClient {
|
|
|
2104
2217
|
* @requires Authentication
|
|
2105
2218
|
*/
|
|
2106
2219
|
getContacts(allianceId) {
|
|
2107
|
-
|
|
2220
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
2108
2221
|
this._client,
|
|
2109
2222
|
"AllianceClient.getContacts() is deprecated. Use ContactsClient.getAllianceContacts() instead. Planned removal in next major version.",
|
|
2110
2223
|
{ allianceId }
|
|
@@ -2120,7 +2233,7 @@ var AllianceClient = class extends BaseEsiClient {
|
|
|
2120
2233
|
* @requires Authentication
|
|
2121
2234
|
*/
|
|
2122
2235
|
getContactLabels(allianceId) {
|
|
2123
|
-
|
|
2236
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
2124
2237
|
this._client,
|
|
2125
2238
|
"AllianceClient.getContactLabels() is deprecated. Use ContactsClient.getAllianceContactLabels() instead. Planned removal in next major version.",
|
|
2126
2239
|
{ allianceId }
|
|
@@ -6675,7 +6788,7 @@ var MetaClient = class extends BaseEsiClient {
|
|
|
6675
6788
|
*/
|
|
6676
6789
|
async getOpenApiYaml() {
|
|
6677
6790
|
const url = `${this._client.getLink()}/meta/openapi.yaml`;
|
|
6678
|
-
|
|
6791
|
+
_chunkXIB2OXEZjs.logInfo2.call(void 0, this._client, `Hitting endpoint: ${url}`, { method: "GET" });
|
|
6679
6792
|
try {
|
|
6680
6793
|
const response = await fetch(url, {
|
|
6681
6794
|
method: "GET",
|
|
@@ -6691,12 +6804,12 @@ var MetaClient = class extends BaseEsiClient {
|
|
|
6691
6804
|
return await response.text();
|
|
6692
6805
|
} catch (error) {
|
|
6693
6806
|
if (error instanceof Error) {
|
|
6694
|
-
|
|
6807
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, this._client, `Error fetching YAML: ${error.message}`, {
|
|
6695
6808
|
url
|
|
6696
6809
|
});
|
|
6697
6810
|
throw error;
|
|
6698
6811
|
} else {
|
|
6699
|
-
|
|
6812
|
+
_chunkXIB2OXEZjs.logError2.call(void 0, this._client, `Unexpected error: ${String(error)}`, { url });
|
|
6700
6813
|
throw new Error(String(error));
|
|
6701
6814
|
}
|
|
6702
6815
|
}
|
|
@@ -7410,7 +7523,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7410
7523
|
let completed = 0;
|
|
7411
7524
|
let running = 0;
|
|
7412
7525
|
let index = 0;
|
|
7413
|
-
|
|
7526
|
+
_chunkXIB2OXEZjs.logInfo2.call(void 0,
|
|
7414
7527
|
null,
|
|
7415
7528
|
`Batch fetch: ${keys.length} items, concurrency=${concurrency}`,
|
|
7416
7529
|
{
|
|
@@ -7427,7 +7540,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7427
7540
|
fetcher(key).then((result) => {
|
|
7428
7541
|
results.set(key, result);
|
|
7429
7542
|
}).catch((err) => {
|
|
7430
|
-
const error = err instanceof
|
|
7543
|
+
const error = err instanceof _chunkXIB2OXEZjs.EsiError || err instanceof Error ? err : new Error(String(err));
|
|
7431
7544
|
errors.set(key, error);
|
|
7432
7545
|
}).finally(() => {
|
|
7433
7546
|
running--;
|
|
@@ -7436,7 +7549,7 @@ async function batchFetch(keys, fetcher, options = {}) {
|
|
|
7436
7549
|
options.onProgress(completed, keys.length);
|
|
7437
7550
|
}
|
|
7438
7551
|
if (completed === keys.length) {
|
|
7439
|
-
|
|
7552
|
+
_chunkXIB2OXEZjs.logDebug2.call(void 0,
|
|
7440
7553
|
null,
|
|
7441
7554
|
`Batch complete: ${results.size} succeeded, ${errors.size} failed`,
|
|
7442
7555
|
{ succeeded: results.size, failed: errors.size }
|
|
@@ -7460,7 +7573,7 @@ async function batchPost(ids, poster, chunkSize = 1e3) {
|
|
|
7460
7573
|
for (let i = 0; i < ids.length; i += chunkSize) {
|
|
7461
7574
|
chunks.push(ids.slice(i, i + chunkSize));
|
|
7462
7575
|
}
|
|
7463
|
-
|
|
7576
|
+
_chunkXIB2OXEZjs.logInfo2.call(void 0,
|
|
7464
7577
|
null,
|
|
7465
7578
|
`Batch POST: ${ids.length} IDs in ${chunks.length} chunks of ${chunkSize}`,
|
|
7466
7579
|
{ total: ids.length, chunks: chunks.length, chunkSize }
|
|
@@ -7486,7 +7599,7 @@ var ETagCacheManager = (_class4 = class {
|
|
|
7486
7599
|
}
|
|
7487
7600
|
log(level, message, context) {
|
|
7488
7601
|
const ctx = context && Object.keys(context).length > 0 ? context : void 0;
|
|
7489
|
-
const emit = level === "info" ?
|
|
7602
|
+
const emit = level === "info" ? _chunkXIB2OXEZjs.logInfo2 : _chunkXIB2OXEZjs.logDebug2;
|
|
7490
7603
|
emit(this.client, message, ctx);
|
|
7491
7604
|
}
|
|
7492
7605
|
constructor(config = {}) {;_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this);_class4.prototype.__init18.call(this);
|
|
@@ -7680,6 +7793,8 @@ var ETagCacheManager = (_class4 = class {
|
|
|
7680
7793
|
var esiRateLimitGroups = {
|
|
7681
7794
|
"GET:alliances/{alliance_id}/contacts": { group: "alliance-social", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7682
7795
|
"GET:alliances/{alliance_id}/contacts/labels": { group: "alliance-social", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7796
|
+
"GET:characters/{character_id}/access-lists": { group: "char-access", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7797
|
+
"GET:characters/{character_id}/access-lists/{access_list_id}": { group: "char-access", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7683
7798
|
"GET:characters/{character_id}/agents_research": { group: "char-industry", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7684
7799
|
"GET:characters/{character_id}/assets": { group: "char-asset", maxTokens: 1800, windowSizeMs: 9e5 },
|
|
7685
7800
|
"POST:characters/{character_id}/assets/locations": { group: "char-asset", maxTokens: 1800, windowSizeMs: 9e5 },
|
|
@@ -7723,6 +7838,8 @@ var esiRateLimitGroups = {
|
|
|
7723
7838
|
"DELETE:characters/{character_id}/mail/labels/{label_id}": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7724
7839
|
"GET:characters/{character_id}/mail/lists": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7725
7840
|
"GET:characters/{character_id}/medals": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7841
|
+
"GET:characters/{character_id}/mercenary-tactical-operations": { group: "char-activity", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7842
|
+
"GET:characters/{character_id}/mercenary-tactical-operations/{operation_id}": { group: "char-activity", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7726
7843
|
"GET:characters/{character_id}/mining": { group: "char-industry", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7727
7844
|
"GET:characters/{character_id}/notifications": { group: "char-notification", maxTokens: 15, windowSizeMs: 9e5 },
|
|
7728
7845
|
"GET:characters/{character_id}/notifications/contacts": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
@@ -7735,6 +7852,8 @@ var esiRateLimitGroups = {
|
|
|
7735
7852
|
"GET:characters/{character_id}/skillqueue": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7736
7853
|
"GET:characters/{character_id}/skills": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7737
7854
|
"GET:characters/{character_id}/standings": { group: "char-social", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7855
|
+
"GET:characters/{character_id}/structures/mercenary-dens": { group: "char-structure", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7856
|
+
"GET:characters/{character_id}/structures/mercenary-dens/{mercenary_den_id}": { group: "char-structure", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7738
7857
|
"GET:characters/{character_id}/titles": { group: "char-detail", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7739
7858
|
"GET:characters/{character_id}/wallet": { group: "char-wallet", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7740
7859
|
"GET:characters/{character_id}/wallet/journal": { group: "char-wallet", maxTokens: 150, windowSizeMs: 9e5 },
|
|
@@ -7777,6 +7896,10 @@ var esiRateLimitGroups = {
|
|
|
7777
7896
|
"GET:corporations/{corporation_id}/starbases": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7778
7897
|
"GET:corporations/{corporation_id}/starbases/{starbase_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7779
7898
|
"GET:corporations/{corporation_id}/structures": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7899
|
+
"GET:corporations/{corporation_id}/structures/skyhooks": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7900
|
+
"GET:corporations/{corporation_id}/structures/skyhooks/{skyhook_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7901
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7902
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs/{sovereignty_hub_id}": { group: "corp-structure", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7780
7903
|
"GET:corporations/{corporation_id}/titles": { group: "corp-detail", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7781
7904
|
"GET:corporations/{corporation_id}/wallets": { group: "corp-wallet", maxTokens: 300, windowSizeMs: 9e5 },
|
|
7782
7905
|
"GET:corporations/{corporation_id}/wallets/{division}/journal": { group: "corp-wallet", maxTokens: 300, windowSizeMs: 9e5 },
|
|
@@ -7812,9 +7935,9 @@ var esiRateLimitGroups = {
|
|
|
7812
7935
|
"GET:meta/compatibility-dates": { group: "meta", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7813
7936
|
"GET:meta/status": { group: "meta", maxTokens: 150, windowSizeMs: 9e5 },
|
|
7814
7937
|
"POST:route/{origin_system_id}/{destination_system_id}": { group: "routes", maxTokens: 3600, windowSizeMs: 9e5 },
|
|
7938
|
+
"GET:skyhooks/raidable": { group: "activity", maxTokens: 30, windowSizeMs: 9e5 },
|
|
7815
7939
|
"GET:sovereignty/campaigns": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7816
|
-
"GET:sovereignty/
|
|
7817
|
-
"GET:sovereignty/structures": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7940
|
+
"GET:sovereignty/systems": { group: "sovereignty", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7818
7941
|
"GET:status": { group: "status", maxTokens: 600, windowSizeMs: 9e5 },
|
|
7819
7942
|
"POST:ui/autopilot/waypoint": { group: "ui", maxTokens: 900, windowSizeMs: 9e5 },
|
|
7820
7943
|
"POST:ui/openwindow/contract": { group: "ui", maxTokens: 900, windowSizeMs: 9e5 },
|
|
@@ -7834,8 +7957,19 @@ function getTokenCost(statusCode) {
|
|
|
7834
7957
|
if (statusCode >= 500 && statusCode < 600) return 0;
|
|
7835
7958
|
return 2;
|
|
7836
7959
|
}
|
|
7960
|
+
function retryAfterDeadline(value, now) {
|
|
7961
|
+
const trimmed = value.trim();
|
|
7962
|
+
if (/^\d+$/.test(trimmed)) return now + parseInt(trimmed, 10) * 1e3;
|
|
7963
|
+
if (!/[A-Za-z]/.test(trimmed)) return void 0;
|
|
7964
|
+
const date = Date.parse(trimmed);
|
|
7965
|
+
return Number.isNaN(date) ? void 0 : date;
|
|
7966
|
+
}
|
|
7837
7967
|
var DEFAULT_WINDOW_MS = 9e5;
|
|
7838
|
-
var DEFAULT_ERROR_LIMIT = {
|
|
7968
|
+
var DEFAULT_ERROR_LIMIT = {
|
|
7969
|
+
remain: 100,
|
|
7970
|
+
reset: 0,
|
|
7971
|
+
exhaustedUntil: 0
|
|
7972
|
+
};
|
|
7839
7973
|
var RateLimiter = (_class5 = class _RateLimiter {
|
|
7840
7974
|
|
|
7841
7975
|
|
|
@@ -7851,10 +7985,10 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7851
7985
|
__init25() {this.lastCleanup = 0}
|
|
7852
7986
|
static __initStatic2() {this.CLEANUP_INTERVAL_MS = 6e4}
|
|
7853
7987
|
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',
|
|
7988
|
+
this.minDelayMs = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _14 => _14.minDelayMs]), () => ( 50));
|
|
7989
|
+
this.decelerationThreshold = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _15 => _15.decelerationThreshold]), () => ( 0.2));
|
|
7990
|
+
this.userKeyExtractor = _optionalChain([config, 'optionalAccess', _16 => _16.userKeyExtractor]);
|
|
7991
|
+
this.endpointOverrides = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _17 => _17.endpointOverrides]), () => ( {}));
|
|
7858
7992
|
if (this.userKeyExtractor) {
|
|
7859
7993
|
this.userBuckets = /* @__PURE__ */ new Map();
|
|
7860
7994
|
}
|
|
@@ -7935,7 +8069,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7935
8069
|
getBucket(templatePath, method, requestHeaders, groupNameOverride) {
|
|
7936
8070
|
const bucketMap = this.resolveBucketMap(requestHeaders);
|
|
7937
8071
|
const spec = this.lookupGroupSpec(method, templatePath);
|
|
7938
|
-
const groupName = _nullishCoalesce(groupNameOverride, () => ( _optionalChain([spec, 'optionalAccess',
|
|
8072
|
+
const groupName = _nullishCoalesce(groupNameOverride, () => ( _optionalChain([spec, 'optionalAccess', _18 => _18.group])));
|
|
7939
8073
|
if (!groupName) return this.fallbackBucket;
|
|
7940
8074
|
let bucket = bucketMap.get(groupName);
|
|
7941
8075
|
if (!bucket) {
|
|
@@ -7957,6 +8091,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7957
8091
|
}
|
|
7958
8092
|
updateFromResponse(headers, statusCode, templatePath, method, requestHeaders) {
|
|
7959
8093
|
if (this.isTestMode) return;
|
|
8094
|
+
const now = Date.now();
|
|
7960
8095
|
const responseGroup = headers["x-ratelimit-group"] || void 0;
|
|
7961
8096
|
const bucket = this.getBucket(
|
|
7962
8097
|
templatePath,
|
|
@@ -7973,23 +8108,30 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
7973
8108
|
if ("x-ratelimit-used" in headers) {
|
|
7974
8109
|
bucket.used = parseInt(headers["x-ratelimit-used"], 10);
|
|
7975
8110
|
}
|
|
7976
|
-
bucket.lastUpdated =
|
|
8111
|
+
bucket.lastUpdated = now;
|
|
7977
8112
|
if ("retry-after" in headers) {
|
|
7978
|
-
const
|
|
7979
|
-
bucket.blockedUntil =
|
|
8113
|
+
const until = retryAfterDeadline(headers["retry-after"], now);
|
|
8114
|
+
if (until !== void 0) bucket.blockedUntil = until;
|
|
7980
8115
|
}
|
|
7981
8116
|
if (statusCode === 420 || statusCode === 429) {
|
|
7982
|
-
if (bucket.blockedUntil <=
|
|
7983
|
-
bucket.blockedUntil =
|
|
8117
|
+
if (bucket.blockedUntil <= now) {
|
|
8118
|
+
bucket.blockedUntil = now + 6e4;
|
|
7984
8119
|
}
|
|
7985
8120
|
}
|
|
7986
8121
|
const errorLimit = this.resolveErrorLimit(requestHeaders);
|
|
7987
|
-
|
|
7988
|
-
|
|
8122
|
+
const reportedRemain = "x-esi-error-limit-remain" in headers ? parseInt(headers["x-esi-error-limit-remain"], 10) : void 0;
|
|
8123
|
+
if (reportedRemain !== void 0 && reportedRemain > 0 && errorLimit.remain <= 0 && now < errorLimit.exhaustedUntil) {
|
|
8124
|
+
return;
|
|
8125
|
+
}
|
|
8126
|
+
if (reportedRemain !== void 0) {
|
|
8127
|
+
errorLimit.remain = reportedRemain;
|
|
7989
8128
|
}
|
|
7990
8129
|
if ("x-esi-error-limit-reset" in headers) {
|
|
7991
8130
|
errorLimit.reset = parseInt(headers["x-esi-error-limit-reset"], 10);
|
|
7992
8131
|
}
|
|
8132
|
+
if (reportedRemain !== void 0 && reportedRemain <= 0) {
|
|
8133
|
+
errorLimit.exhaustedUntil = now + errorLimit.reset * 1e3;
|
|
8134
|
+
}
|
|
7993
8135
|
}
|
|
7994
8136
|
updateRateLimitInfo(headers) {
|
|
7995
8137
|
this.updateFromResponse(headers, 200);
|
|
@@ -8008,7 +8150,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8008
8150
|
stillBlockedBucket = bucket2;
|
|
8009
8151
|
const waitedUntil = bucket2.blockedUntil;
|
|
8010
8152
|
const waitTime = waitedUntil - now;
|
|
8011
|
-
|
|
8153
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
8012
8154
|
null,
|
|
8013
8155
|
`[ESI Rate Limit] Group '${bucket2.group}' blocked for ${Math.ceil(waitTime / 1e3)}s (420/429 received)`,
|
|
8014
8156
|
{ group: bucket2.group, waitMs: waitTime }
|
|
@@ -8020,12 +8162,12 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8020
8162
|
}
|
|
8021
8163
|
if (stillBlockedBucket && stillBlockedBucket.blockedUntil > Date.now()) {
|
|
8022
8164
|
const waitTime = stillBlockedBucket.blockedUntil - Date.now();
|
|
8023
|
-
|
|
8165
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
8024
8166
|
null,
|
|
8025
8167
|
`[ESI Rate Limit] Group '${stillBlockedBucket.group}' still blocked after retry budget exhausted; aborting request instead of sending while blocked`,
|
|
8026
8168
|
{ group: stillBlockedBucket.group }
|
|
8027
8169
|
);
|
|
8028
|
-
throw new (0,
|
|
8170
|
+
throw new (0, _chunkXIB2OXEZjs.EsiError)(
|
|
8029
8171
|
429,
|
|
8030
8172
|
`Rate limit group '${stillBlockedBucket.group}' still blocked for ${Math.ceil(waitTime / 1e3)}s`
|
|
8031
8173
|
);
|
|
@@ -8035,7 +8177,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8035
8177
|
const resetMs = errorLimit.reset * 1e3;
|
|
8036
8178
|
const delay = Math.min(resetMs, 5e3);
|
|
8037
8179
|
if (delay > 0) {
|
|
8038
|
-
|
|
8180
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
8039
8181
|
null,
|
|
8040
8182
|
`[ESI Rate Limit] Legacy error limit low (${errorLimit.remain}), waiting ${delay}ms`,
|
|
8041
8183
|
{ errorLimitRemain: errorLimit.remain }
|
|
@@ -8044,7 +8186,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8044
8186
|
}
|
|
8045
8187
|
} else if (errorLimit.remain <= 0 && errorLimit.reset > 0) {
|
|
8046
8188
|
const waitTime = errorLimit.reset * 1e3;
|
|
8047
|
-
|
|
8189
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
8048
8190
|
null,
|
|
8049
8191
|
`[ESI Rate Limit] Legacy error limit exhausted, waiting ${Math.ceil(waitTime / 1e3)}s`,
|
|
8050
8192
|
{ errorLimitReset: errorLimit.reset }
|
|
@@ -8055,7 +8197,7 @@ var RateLimiter = (_class5 = class _RateLimiter {
|
|
|
8055
8197
|
if (bucket.remaining >= 0 && bucket.limit > 0) {
|
|
8056
8198
|
const ratio = bucket.remaining / bucket.limit;
|
|
8057
8199
|
if (bucket.remaining <= 0) {
|
|
8058
|
-
|
|
8200
|
+
_chunkXIB2OXEZjs.logWarn2.call(void 0,
|
|
8059
8201
|
null,
|
|
8060
8202
|
`[ESI Rate Limit] Group '${bucket.group}' token bucket empty, waiting 1s`,
|
|
8061
8203
|
{ group: bucket.group }
|
|
@@ -8193,7 +8335,7 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8193
8335
|
const existing = this.inflight.get(key);
|
|
8194
8336
|
if (existing) {
|
|
8195
8337
|
if (this.client) {
|
|
8196
|
-
|
|
8338
|
+
_chunkXIB2OXEZjs.logDebug2.call(void 0, this.client, `[Dedup] Coalescing request: ${key}`);
|
|
8197
8339
|
}
|
|
8198
8340
|
return existing;
|
|
8199
8341
|
}
|
|
@@ -8203,6 +8345,32 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8203
8345
|
this.inflight.set(key, promise);
|
|
8204
8346
|
return promise;
|
|
8205
8347
|
}
|
|
8348
|
+
/**
|
|
8349
|
+
* Drop the in-flight entries whose key contains `pathSegment`, so a call
|
|
8350
|
+
* made after a write cannot join a request sent before it.
|
|
8351
|
+
*
|
|
8352
|
+
* The requests themselves keep running and whoever already joined them still
|
|
8353
|
+
* gets their answer. Only the map entry goes, which is what new callers look
|
|
8354
|
+
* in. Matching is `includes`, the same rule ETagCacheManager.deleteByPath
|
|
8355
|
+
* uses, so one written path invalidates the cache and detaches the reads of
|
|
8356
|
+
* it by the same test.
|
|
8357
|
+
*/
|
|
8358
|
+
detachByPath(pathSegment) {
|
|
8359
|
+
let count = 0;
|
|
8360
|
+
for (const key of this.inflight.keys()) {
|
|
8361
|
+
if (key.includes(pathSegment)) {
|
|
8362
|
+
this.inflight.delete(key);
|
|
8363
|
+
count += 1;
|
|
8364
|
+
}
|
|
8365
|
+
}
|
|
8366
|
+
if (count > 0 && this.client) {
|
|
8367
|
+
_chunkXIB2OXEZjs.logDebug2.call(void 0,
|
|
8368
|
+
this.client,
|
|
8369
|
+
`[Dedup] Detached ${count} in-flight request(s) matching ${pathSegment} after a write`
|
|
8370
|
+
);
|
|
8371
|
+
}
|
|
8372
|
+
return count;
|
|
8373
|
+
}
|
|
8206
8374
|
get pending() {
|
|
8207
8375
|
return this.inflight.size;
|
|
8208
8376
|
}
|
|
@@ -8214,25 +8382,25 @@ var RequestDeduplicator = (_class6 = class {constructor() { _class6.prototype.__
|
|
|
8214
8382
|
// src/core/configureApiClient.ts
|
|
8215
8383
|
function configureApiClient(client, config) {
|
|
8216
8384
|
let deduplicator = null;
|
|
8217
|
-
client.setRateLimiter(new RateLimiter(_optionalChain([config, 'optionalAccess',
|
|
8218
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8385
|
+
client.setRateLimiter(new RateLimiter(_optionalChain([config, 'optionalAccess', _19 => _19.rateLimiterConfig])));
|
|
8386
|
+
if (_optionalChain([config, 'optionalAccess', _20 => _20.enableRequestDeduplication]) !== false) {
|
|
8219
8387
|
deduplicator = new RequestDeduplicator();
|
|
8220
8388
|
deduplicator.setClient(client);
|
|
8221
8389
|
client.setDeduplicator(deduplicator);
|
|
8222
8390
|
}
|
|
8223
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8224
|
-
const cache = new ETagCacheManager(_optionalChain([config, 'optionalAccess',
|
|
8391
|
+
if (_optionalChain([config, 'optionalAccess', _21 => _21.enableETagCache]) !== false) {
|
|
8392
|
+
const cache = new ETagCacheManager(_optionalChain([config, 'optionalAccess', _22 => _22.etagCacheConfig]));
|
|
8225
8393
|
cache.setClient(client);
|
|
8226
8394
|
client.setCache(cache);
|
|
8227
8395
|
}
|
|
8228
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8229
|
-
const cb = new (0,
|
|
8396
|
+
if (_optionalChain([config, 'optionalAccess', _23 => _23.enableCircuitBreaker])) {
|
|
8397
|
+
const cb = new (0, _chunkXIB2OXEZjs.CircuitBreaker)(config.circuitBreakerConfig);
|
|
8230
8398
|
cb.setClient(client);
|
|
8231
8399
|
client.setCircuitBreaker(cb);
|
|
8232
8400
|
}
|
|
8233
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8401
|
+
if (_optionalChain([config, 'optionalAccess', _24 => _24.retryConfig])) {
|
|
8234
8402
|
client.setRetryConfig(config.retryConfig);
|
|
8235
|
-
} else if (_optionalChain([config, 'optionalAccess',
|
|
8403
|
+
} else if (_optionalChain([config, 'optionalAccess', _25 => _25.retryAttempts]) !== void 0) {
|
|
8236
8404
|
client.setRetryConfig({ maxRetries: config.retryAttempts });
|
|
8237
8405
|
} else {
|
|
8238
8406
|
client.setRetryConfig({
|
|
@@ -8241,32 +8409,32 @@ function configureApiClient(client, config) {
|
|
|
8241
8409
|
maxDelayMs: 3e4
|
|
8242
8410
|
});
|
|
8243
8411
|
}
|
|
8244
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8412
|
+
if (_optionalChain([config, 'optionalAccess', _26 => _26.retryStrategy])) {
|
|
8245
8413
|
client.setRetryStrategy(config.retryStrategy);
|
|
8246
8414
|
}
|
|
8247
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8415
|
+
if (_optionalChain([config, 'optionalAccess', _27 => _27.requestInterceptors])) {
|
|
8248
8416
|
for (const interceptor of config.requestInterceptors) {
|
|
8249
8417
|
client.addRequestInterceptor(interceptor);
|
|
8250
8418
|
}
|
|
8251
8419
|
}
|
|
8252
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8420
|
+
if (_optionalChain([config, 'optionalAccess', _28 => _28.responseInterceptors])) {
|
|
8253
8421
|
for (const interceptor of config.responseInterceptors) {
|
|
8254
8422
|
client.addResponseInterceptor(interceptor);
|
|
8255
8423
|
}
|
|
8256
8424
|
}
|
|
8257
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8425
|
+
if (_optionalChain([config, 'optionalAccess', _29 => _29.validateResponse]) !== void 0) {
|
|
8258
8426
|
client.setValidateResponse(config.validateResponse);
|
|
8259
8427
|
}
|
|
8260
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8428
|
+
if (_optionalChain([config, 'optionalAccess', _30 => _30.validateRequest]) !== void 0) {
|
|
8261
8429
|
client.setValidateRequest(config.validateRequest);
|
|
8262
8430
|
}
|
|
8263
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8431
|
+
if (_optionalChain([config, 'optionalAccess', _31 => _31.timeout]) !== void 0) {
|
|
8264
8432
|
client.setTimeout(config.timeout);
|
|
8265
8433
|
}
|
|
8266
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8434
|
+
if (_optionalChain([config, 'optionalAccess', _32 => _32.logger])) {
|
|
8267
8435
|
client.setLogger(config.logger);
|
|
8268
|
-
} else if (_optionalChain([config, 'optionalAccess',
|
|
8269
|
-
client.setLogger(
|
|
8436
|
+
} else if (_optionalChain([config, 'optionalAccess', _33 => _33.logLevel])) {
|
|
8437
|
+
client.setLogger(_chunkXIB2OXEZjs.createDefaultLogger.call(void 0, config.logLevel));
|
|
8270
8438
|
}
|
|
8271
8439
|
return { deduplicator };
|
|
8272
8440
|
}
|
|
@@ -8279,36 +8447,36 @@ var EsiClient = (_class7 = class {
|
|
|
8279
8447
|
__init29() {this._diagnostics = null}
|
|
8280
8448
|
__init30() {this.deduplicator = null}
|
|
8281
8449
|
constructor(config) {;_class7.prototype.__init28.call(this);_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);
|
|
8282
|
-
const token = _optionalChain([config, 'optionalAccess',
|
|
8450
|
+
const token = _optionalChain([config, 'optionalAccess', _34 => _34.accessToken]) || process.env.ESI_ACCESS_TOKEN;
|
|
8283
8451
|
const baseUrl = validateBaseUrl(
|
|
8284
|
-
_optionalChain([config, 'optionalAccess',
|
|
8285
|
-
_optionalChain([config, 'optionalAccess',
|
|
8452
|
+
_optionalChain([config, 'optionalAccess', _35 => _35.baseUrl]) || process.env.ESI_BASE_URL || "https://esi.evetech.net",
|
|
8453
|
+
_optionalChain([config, 'optionalAccess', _36 => _36.unsafeAllowCustomHost])
|
|
8286
8454
|
);
|
|
8287
8455
|
this.apiClient = new ApiClient(
|
|
8288
|
-
_optionalChain([config, 'optionalAccess',
|
|
8456
|
+
_optionalChain([config, 'optionalAccess', _37 => _37.clientId]) || process.env.ESI_CLIENT_ID || "esi-client",
|
|
8289
8457
|
baseUrl,
|
|
8290
8458
|
token
|
|
8291
8459
|
);
|
|
8292
|
-
const datasource = _optionalChain([config, 'optionalAccess',
|
|
8460
|
+
const datasource = _optionalChain([config, 'optionalAccess', _38 => _38.datasource]) || process.env.ESI_DATASOURCE;
|
|
8293
8461
|
if (datasource) {
|
|
8294
8462
|
this.apiClient.setDatasource(datasource);
|
|
8295
8463
|
}
|
|
8296
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8464
|
+
if (_optionalChain([config, 'optionalAccess', _39 => _39.language])) {
|
|
8297
8465
|
this.apiClient.setLanguage(config.language);
|
|
8298
8466
|
}
|
|
8299
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8467
|
+
if (_optionalChain([config, 'optionalAccess', _40 => _40.compatibilityDate])) {
|
|
8300
8468
|
this.apiClient.setCompatibilityDate(config.compatibilityDate);
|
|
8301
8469
|
}
|
|
8302
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8470
|
+
if (_optionalChain([config, 'optionalAccess', _41 => _41.onTokenRefresh])) {
|
|
8303
8471
|
this.apiClient.setTokenProvider(config.onTokenRefresh);
|
|
8304
8472
|
}
|
|
8305
8473
|
const result = configureApiClient(this.apiClient, config);
|
|
8306
8474
|
this.deduplicator = result.deduplicator;
|
|
8307
|
-
this.etagCacheEnabled = _optionalChain([config, 'optionalAccess',
|
|
8308
|
-
const clientLogger = _nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8475
|
+
this.etagCacheEnabled = _optionalChain([config, 'optionalAccess', _42 => _42.enableETagCache]) !== false;
|
|
8476
|
+
const clientLogger = _nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )));
|
|
8309
8477
|
clientLogger.info("EsiClient initialized successfully", {
|
|
8310
8478
|
baseUrl,
|
|
8311
|
-
clientId: _optionalChain([config, 'optionalAccess',
|
|
8479
|
+
clientId: _optionalChain([config, 'optionalAccess', _43 => _43.clientId])
|
|
8312
8480
|
});
|
|
8313
8481
|
}
|
|
8314
8482
|
getClient(name) {
|
|
@@ -8443,11 +8611,11 @@ var EsiClient = (_class7 = class {
|
|
|
8443
8611
|
}
|
|
8444
8612
|
setAccessToken(token) {
|
|
8445
8613
|
this.apiClient.setAccessToken(token);
|
|
8446
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8614
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )))).info("Access token updated");
|
|
8447
8615
|
}
|
|
8448
8616
|
setTokenProvider(provider) {
|
|
8449
8617
|
this.apiClient.setTokenProvider(provider);
|
|
8450
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8618
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )))).info(
|
|
8451
8619
|
provider ? "Token provider configured" : "Token provider removed"
|
|
8452
8620
|
);
|
|
8453
8621
|
}
|
|
@@ -8495,7 +8663,7 @@ var EsiClient = (_class7 = class {
|
|
|
8495
8663
|
this.deduplicator.clear();
|
|
8496
8664
|
}
|
|
8497
8665
|
this.clients.clear();
|
|
8498
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8666
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )))).info(
|
|
8499
8667
|
"EsiClient shutdown completed"
|
|
8500
8668
|
);
|
|
8501
8669
|
}
|
|
@@ -8543,7 +8711,7 @@ var CustomEsiClient = (_class8 = class {
|
|
|
8543
8711
|
for (const name of this.enabledClients) {
|
|
8544
8712
|
this.clients.set(name, createClientInstance(name, this.apiClient));
|
|
8545
8713
|
}
|
|
8546
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8714
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )))).info(
|
|
8547
8715
|
`CustomEsiClient initialized with clients: ${config.clients.join(", ")}`,
|
|
8548
8716
|
{ clients: config.clients }
|
|
8549
8717
|
);
|
|
@@ -8675,7 +8843,7 @@ var CustomEsiClient = (_class8 = class {
|
|
|
8675
8843
|
this.deduplicator.clear();
|
|
8676
8844
|
}
|
|
8677
8845
|
this.clients.clear();
|
|
8678
|
-
(_nullishCoalesce(this.apiClient.getLogger(), () => (
|
|
8846
|
+
(_nullishCoalesce(this.apiClient.getLogger(), () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )))).info(
|
|
8679
8847
|
"CustomEsiClient shutdown completed"
|
|
8680
8848
|
);
|
|
8681
8849
|
}
|
|
@@ -8740,21 +8908,21 @@ var EsiApiFactory = class {
|
|
|
8740
8908
|
}
|
|
8741
8909
|
static buildApiClient(config) {
|
|
8742
8910
|
const baseUrl = validateBaseUrl(
|
|
8743
|
-
_optionalChain([config, 'optionalAccess',
|
|
8744
|
-
_optionalChain([config, 'optionalAccess',
|
|
8911
|
+
_optionalChain([config, 'optionalAccess', _44 => _44.baseUrl]) || process.env.ESI_BASE_URL || "https://esi.evetech.net",
|
|
8912
|
+
_optionalChain([config, 'optionalAccess', _45 => _45.unsafeAllowCustomHost])
|
|
8745
8913
|
);
|
|
8746
8914
|
const client = new ApiClient(
|
|
8747
|
-
_optionalChain([config, 'optionalAccess',
|
|
8915
|
+
_optionalChain([config, 'optionalAccess', _46 => _46.clientId]) || process.env.ESI_CLIENT_ID || "esi-standalone-client",
|
|
8748
8916
|
baseUrl,
|
|
8749
|
-
_optionalChain([config, 'optionalAccess',
|
|
8917
|
+
_optionalChain([config, 'optionalAccess', _47 => _47.accessToken]) || process.env.ESI_ACCESS_TOKEN
|
|
8750
8918
|
);
|
|
8751
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8919
|
+
if (_optionalChain([config, 'optionalAccess', _48 => _48.language])) {
|
|
8752
8920
|
client.setLanguage(config.language);
|
|
8753
8921
|
}
|
|
8754
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
8922
|
+
if (_optionalChain([config, 'optionalAccess', _49 => _49.onTokenRefresh])) {
|
|
8755
8923
|
client.setTokenProvider(config.onTokenRefresh);
|
|
8756
8924
|
}
|
|
8757
|
-
const datasource = _optionalChain([config, 'optionalAccess',
|
|
8925
|
+
const datasource = _optionalChain([config, 'optionalAccess', _50 => _50.datasource]);
|
|
8758
8926
|
if (datasource) {
|
|
8759
8927
|
client.setDatasource(datasource);
|
|
8760
8928
|
}
|
|
@@ -8852,6 +9020,8 @@ var ApiClientBuilder = class {
|
|
|
8852
9020
|
var esiEndpointScopes = {
|
|
8853
9021
|
"GET:alliances/{alliance_id}/contacts": ["esi-alliances.read_contacts.v1"],
|
|
8854
9022
|
"GET:alliances/{alliance_id}/contacts/labels": ["esi-alliances.read_contacts.v1"],
|
|
9023
|
+
"GET:characters/{character_id}/access-lists": ["esi-access.read_lists.v1"],
|
|
9024
|
+
"GET:characters/{character_id}/access-lists/{access_list_id}": ["esi-access.read_lists.v1"],
|
|
8855
9025
|
"GET:characters/{character_id}/agents_research": ["esi-characters.read_agents_research.v1"],
|
|
8856
9026
|
"GET:characters/{character_id}/assets": ["esi-assets.read_assets.v1"],
|
|
8857
9027
|
"POST:characters/{character_id}/assets/locations": ["esi-assets.read_assets.v1"],
|
|
@@ -8895,6 +9065,8 @@ var esiEndpointScopes = {
|
|
|
8895
9065
|
"DELETE:characters/{character_id}/mail/labels/{label_id}": ["esi-mail.organize_mail.v1"],
|
|
8896
9066
|
"GET:characters/{character_id}/mail/lists": ["esi-mail.read_mail.v1"],
|
|
8897
9067
|
"GET:characters/{character_id}/medals": ["esi-characters.read_medals.v1"],
|
|
9068
|
+
"GET:characters/{character_id}/mercenary-tactical-operations": ["esi-activities.read_character.v1"],
|
|
9069
|
+
"GET:characters/{character_id}/mercenary-tactical-operations/{operation_id}": ["esi-activities.read_character.v1"],
|
|
8898
9070
|
"GET:characters/{character_id}/mining": ["esi-industry.read_character_mining.v1"],
|
|
8899
9071
|
"GET:characters/{character_id}/notifications": ["esi-characters.read_notifications.v1"],
|
|
8900
9072
|
"GET:characters/{character_id}/notifications/contacts": ["esi-characters.read_notifications.v1"],
|
|
@@ -8909,6 +9081,8 @@ var esiEndpointScopes = {
|
|
|
8909
9081
|
"GET:characters/{character_id}/skillqueue": ["esi-skills.read_skillqueue.v1"],
|
|
8910
9082
|
"GET:characters/{character_id}/skills": ["esi-skills.read_skills.v1"],
|
|
8911
9083
|
"GET:characters/{character_id}/standings": ["esi-characters.read_standings.v1"],
|
|
9084
|
+
"GET:characters/{character_id}/structures/mercenary-dens": ["esi-structures.read_character.v1"],
|
|
9085
|
+
"GET:characters/{character_id}/structures/mercenary-dens/{mercenary_den_id}": ["esi-structures.read_character.v1"],
|
|
8912
9086
|
"GET:characters/{character_id}/titles": ["esi-characters.read_titles.v1"],
|
|
8913
9087
|
"GET:characters/{character_id}/wallet": ["esi-wallet.read_character_wallet.v1"],
|
|
8914
9088
|
"GET:characters/{character_id}/wallet/journal": ["esi-wallet.read_character_wallet.v1"],
|
|
@@ -8953,6 +9127,10 @@ var esiEndpointScopes = {
|
|
|
8953
9127
|
"GET:corporations/{corporation_id}/starbases": ["esi-corporations.read_starbases.v1"],
|
|
8954
9128
|
"GET:corporations/{corporation_id}/starbases/{starbase_id}": ["esi-corporations.read_starbases.v1"],
|
|
8955
9129
|
"GET:corporations/{corporation_id}/structures": ["esi-corporations.read_structures.v1"],
|
|
9130
|
+
"GET:corporations/{corporation_id}/structures/skyhooks": ["esi-structures.read_corporation.v1"],
|
|
9131
|
+
"GET:corporations/{corporation_id}/structures/skyhooks/{skyhook_id}": ["esi-structures.read_corporation.v1"],
|
|
9132
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs": ["esi-structures.read_corporation.v1"],
|
|
9133
|
+
"GET:corporations/{corporation_id}/structures/sovereignty-hubs/{sovereignty_hub_id}": ["esi-structures.read_corporation.v1"],
|
|
8956
9134
|
"GET:corporations/{corporation_id}/titles": ["esi-corporations.read_titles.v1"],
|
|
8957
9135
|
"GET:corporations/{corporation_id}/wallets": ["esi-wallet.read_corporation_wallets.v1"],
|
|
8958
9136
|
"GET:corporations/{corporation_id}/wallets/{division}/journal": ["esi-wallet.read_corporation_wallets.v1"],
|
|
@@ -9343,7 +9521,7 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9343
9521
|
})));
|
|
9344
9522
|
this.refreshSkewMs = _nullishCoalesce(config.refreshSkewMs, () => ( 6e4));
|
|
9345
9523
|
this.autoRefresh = _nullishCoalesce(config.autoRefresh, () => ( true));
|
|
9346
|
-
this.logger = _nullishCoalesce(config.logger, () => (
|
|
9524
|
+
this.logger = _nullishCoalesce(config.logger, () => ( _chunkXIB2OXEZjs.getLogger.call(void 0, )));
|
|
9347
9525
|
this.now = _nullishCoalesce(config.now, () => ( (() => Date.now())));
|
|
9348
9526
|
this.hooks = {
|
|
9349
9527
|
onRefresh: config.onRefresh,
|
|
@@ -9566,14 +9744,14 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9566
9744
|
this.logger.warn(
|
|
9567
9745
|
`SSO revoked refresh token for character ${characterId}`
|
|
9568
9746
|
);
|
|
9569
|
-
_optionalChain([this, 'access',
|
|
9747
|
+
_optionalChain([this, 'access', _51 => _51.hooks, 'access', _52 => _52.onRevoked, 'optionalCall', _53 => _53(characterId)]);
|
|
9570
9748
|
throw new (0, _chunkBBSHKVPIjs.TokenRevokedError)(err.message, characterId);
|
|
9571
9749
|
}
|
|
9572
9750
|
const error = toError(err);
|
|
9573
9751
|
this.logger.error(
|
|
9574
9752
|
`Token refresh failed for character ${characterId}: ${error.message}`
|
|
9575
9753
|
);
|
|
9576
|
-
_optionalChain([this, 'access',
|
|
9754
|
+
_optionalChain([this, 'access', _54 => _54.hooks, 'access', _55 => _55.onRefreshError, 'optionalCall', _56 => _56(characterId, error)]);
|
|
9577
9755
|
throw error;
|
|
9578
9756
|
}
|
|
9579
9757
|
const superseded = await this.supersededBy(characterId, generation);
|
|
@@ -9581,12 +9759,12 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9581
9759
|
const updated = this.buildStoredToken(response, stored);
|
|
9582
9760
|
await this.storage.set(characterId, updated);
|
|
9583
9761
|
this.logger.debug(`Refreshed token for character ${characterId}`);
|
|
9584
|
-
_optionalChain([this, 'access',
|
|
9762
|
+
_optionalChain([this, 'access', _57 => _57.hooks, 'access', _58 => _58.onRefresh, 'optionalCall', _59 => _59(updated)]);
|
|
9585
9763
|
return updated;
|
|
9586
9764
|
}
|
|
9587
9765
|
async refreshOne(token, options) {
|
|
9588
9766
|
const { characterId } = token;
|
|
9589
|
-
if (_optionalChain([options, 'access',
|
|
9767
|
+
if (_optionalChain([options, 'access', _60 => _60.signal, 'optionalAccess', _61 => _61.aborted])) {
|
|
9590
9768
|
return { characterId, status: "skipped", reason: "aborted" };
|
|
9591
9769
|
}
|
|
9592
9770
|
if (token.revokedAt !== void 0) {
|
|
@@ -9660,17 +9838,17 @@ var EsiTokenManager = (_class11 = class {
|
|
|
9660
9838
|
}
|
|
9661
9839
|
const now = this.now();
|
|
9662
9840
|
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',
|
|
9841
|
+
const scopes = decoded.scopes && decoded.scopes.length > 0 ? decoded.scopes : _nullishCoalesce(_optionalChain([previous, 'optionalAccess', _62 => _62.scopes]), () => ( []));
|
|
9664
9842
|
const token = {
|
|
9665
9843
|
characterId: _nullishCoalesce(decoded.characterId, () => ( previous.characterId)),
|
|
9666
|
-
characterName: decoded.characterName || _optionalChain([previous, 'optionalAccess',
|
|
9844
|
+
characterName: decoded.characterName || _optionalChain([previous, 'optionalAccess', _63 => _63.characterName]) || "",
|
|
9667
9845
|
accessToken: response.accessToken,
|
|
9668
9846
|
refreshToken: response.refreshToken,
|
|
9669
9847
|
expiresAt,
|
|
9670
9848
|
scopes,
|
|
9671
9849
|
updatedAt: now
|
|
9672
9850
|
};
|
|
9673
|
-
const ownerHash = _nullishCoalesce(decoded.ownerHash, () => ( _optionalChain([previous, 'optionalAccess',
|
|
9851
|
+
const ownerHash = _nullishCoalesce(decoded.ownerHash, () => ( _optionalChain([previous, 'optionalAccess', _64 => _64.ownerHash])));
|
|
9674
9852
|
if (ownerHash !== void 0) token.ownerHash = ownerHash;
|
|
9675
9853
|
return token;
|
|
9676
9854
|
}
|
|
@@ -9931,5 +10109,5 @@ function generateState() {
|
|
|
9931
10109
|
|
|
9932
10110
|
|
|
9933
10111
|
|
|
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 =
|
|
10112
|
+
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 = _chunkXIB2OXEZjs.CircuitBreaker; exports.CircuitOpenError = _chunkXIB2OXEZjs.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 = _chunkXIB2OXEZjs.EsiError; exports.EsiSpec = esi_spec_generated_exports; exports.EsiTokenManager = EsiTokenManager; exports.EsiValidationError = _chunkXIB2OXEZjs.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 = _chunkXIB2OXEZjs.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 = _chunkXIB2OXEZjs.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 = _chunkXIB2OXEZjs.getLogger; exports.isAuthError = _chunkBBSHKVPIjs.isAuthError; exports.isCharacterNotFound = _chunkBBSHKVPIjs.isCharacterNotFound; exports.isCircuitOpen = _chunkXIB2OXEZjs.isCircuitOpen; exports.isEsiError = _chunkXIB2OXEZjs.isEsiError; exports.isForbidden = _chunkXIB2OXEZjs.isForbidden; exports.isNotFound = _chunkXIB2OXEZjs.isNotFound; exports.isRateLimited = _chunkXIB2OXEZjs.isRateLimited; exports.isRetryable = _chunkXIB2OXEZjs.isRetryable; exports.isServerError = _chunkXIB2OXEZjs.isServerError; exports.isSsoError = _chunkBBSHKVPIjs.isSsoError; exports.isTimeout = _chunkXIB2OXEZjs.isTimeout; exports.isTokenRevoked = _chunkBBSHKVPIjs.isTokenRevoked; exports.isUnauthorized = _chunkXIB2OXEZjs.isUnauthorized; exports.isValidationError = _chunkXIB2OXEZjs.isValidationError; exports.logDebug = _chunkXIB2OXEZjs.logDebug; exports.logError = _chunkXIB2OXEZjs.logError; exports.logFatal = _chunkXIB2OXEZjs.logFatal; exports.logInfo = _chunkXIB2OXEZjs.logInfo; exports.logTrace = _chunkXIB2OXEZjs.logTrace; exports.logWarn = _chunkXIB2OXEZjs.logWarn; exports.parseCharacterId = parseCharacterId; exports.parseScopes = parseScopes; exports.sanitizeUrl = _chunkXIB2OXEZjs.sanitizeUrl; exports.schemas = _chunkSAQBXXTMjs.schemas_exports; exports.setLogger = _chunkXIB2OXEZjs.setLogger; exports.toPinoLogger = _chunkXIB2OXEZjs.toPinoLogger;
|
|
9935
10113
|
//# sourceMappingURL=index.js.map
|