@lgriffin/esi.ts 5.0.0 → 5.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 +39 -0
- package/README.md +174 -7
- package/dist/EsiClient.d.ts +5 -0
- package/dist/EsiClient.d.ts.map +1 -1
- package/dist/EsiClient.js +13 -0
- package/dist/core/ApiClient.d.ts +4 -0
- package/dist/core/ApiClient.d.ts.map +1 -1
- package/dist/core/ApiClient.js +7 -0
- package/dist/core/ApiRequestHandler.d.ts +3 -1
- package/dist/core/ApiRequestHandler.d.ts.map +1 -1
- package/dist/core/ApiRequestHandler.js +107 -41
- package/dist/core/BatchRequestHandler.d.ts +12 -0
- package/dist/core/BatchRequestHandler.d.ts.map +1 -0
- package/dist/core/BatchRequestHandler.js +66 -0
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/endpoints/createClient.d.ts.map +1 -1
- package/dist/core/endpoints/createClient.js +14 -2
- package/dist/core/endpoints/esi-cache-ttls.generated.d.ts +2 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.d.ts.map +1 -0
- package/dist/core/endpoints/esi-cache-ttls.generated.js +126 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.ts +7 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.d.ts.map +1 -0
- package/dist/core/endpoints/esi-rate-limit-groups.generated.js +153 -0
- package/dist/core/pagination/PaginationHandler.d.ts +1 -1
- package/dist/core/pagination/PaginationHandler.d.ts.map +1 -1
- package/dist/core/pagination/PaginationHandler.js +2 -2
- package/dist/core/rateLimiter/IRateLimiter.d.ts +13 -3
- package/dist/core/rateLimiter/IRateLimiter.d.ts.map +1 -1
- package/dist/core/rateLimiter/RateLimiter.d.ts +24 -51
- package/dist/core/rateLimiter/RateLimiter.d.ts.map +1 -1
- package/dist/core/rateLimiter/RateLimiter.js +213 -109
- package/dist/core/util/error.d.ts +5 -1
- package/dist/core/util/error.d.ts.map +1 -1
- package/dist/core/util/error.js +11 -2
- package/dist/core/util/headersUtil.d.ts.map +1 -1
- package/dist/core/util/headersUtil.js +2 -1
- package/dist/core/util/retry.d.ts +8 -0
- package/dist/core/util/retry.d.ts.map +1 -0
- package/dist/core/util/retry.js +9 -0
- package/dist/core/util/stringUtil.d.ts +2 -0
- package/dist/core/util/stringUtil.d.ts.map +1 -0
- package/dist/core/util/stringUtil.js +6 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/types/api-responses.d.ts +1 -0
- package/dist/types/api-responses.d.ts.map +1 -1
- package/dist/types/api-responses.js +24 -0
- package/dist/types/common.d.ts +9 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/generated/esi-spec.generated.d.ts +1763 -0
- package/dist/types/generated/esi-spec.generated.d.ts.map +1 -0
- package/dist/types/generated/esi-spec.generated.js +6 -0
- package/package.json +4 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Auto-generated from ESI OpenAPI spec — do not edit manually
|
|
3
|
+
// Endpoints with rate limit groups: 146
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.esiRateLimitGroups = void 0;
|
|
6
|
+
exports.esiRateLimitGroups = {
|
|
7
|
+
'GET:alliances/{alliance_id}/contacts': { group: 'alliance-social', maxTokens: 300, windowSizeMs: 900000 },
|
|
8
|
+
'GET:alliances/{alliance_id}/contacts/labels': { group: 'alliance-social', maxTokens: 300, windowSizeMs: 900000 },
|
|
9
|
+
'GET:characters/{character_id}/agents_research': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
10
|
+
'GET:characters/{character_id}/assets': { group: 'char-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
11
|
+
'POST:characters/{character_id}/assets/locations': { group: 'char-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
12
|
+
'POST:characters/{character_id}/assets/names': { group: 'char-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
13
|
+
'GET:characters/{character_id}/attributes': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
14
|
+
'GET:characters/{character_id}/blueprints': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
15
|
+
'GET:characters/{character_id}/calendar': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
16
|
+
'GET:characters/{character_id}/calendar/{event_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
17
|
+
'PUT:characters/{character_id}/calendar/{event_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
18
|
+
'GET:characters/{character_id}/calendar/{event_id}/attendees': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
19
|
+
'GET:characters/{character_id}/clones': { group: 'char-location', maxTokens: 1200, windowSizeMs: 900000 },
|
|
20
|
+
'GET:characters/{character_id}/contacts': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
21
|
+
'POST:characters/{character_id}/contacts': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
22
|
+
'PUT:characters/{character_id}/contacts': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
23
|
+
'DELETE:characters/{character_id}/contacts': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
24
|
+
'GET:characters/{character_id}/contacts/labels': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
25
|
+
'GET:characters/{character_id}/contracts': { group: 'char-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
26
|
+
'GET:characters/{character_id}/contracts/{contract_id}/bids': { group: 'char-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
27
|
+
'GET:characters/{character_id}/contracts/{contract_id}/items': { group: 'char-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
28
|
+
'POST:characters/{character_id}/cspa': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
29
|
+
'GET:characters/{character_id}/fatigue': { group: 'char-location', maxTokens: 1200, windowSizeMs: 900000 },
|
|
30
|
+
'GET:characters/{character_id}/fittings': { group: 'fitting', maxTokens: 150, windowSizeMs: 900000 },
|
|
31
|
+
'POST:characters/{character_id}/fittings': { group: 'fitting', maxTokens: 150, windowSizeMs: 900000 },
|
|
32
|
+
'DELETE:characters/{character_id}/fittings/{fitting_id}': { group: 'fitting', maxTokens: 150, windowSizeMs: 900000 },
|
|
33
|
+
'GET:characters/{character_id}/fleet': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
34
|
+
'GET:characters/{character_id}/freelance-jobs': { group: 'char-freelance-job', maxTokens: 300, windowSizeMs: 900000 },
|
|
35
|
+
'GET:characters/{character_id}/freelance-jobs/{job_id}/participation': { group: 'char-freelance-job', maxTokens: 300, windowSizeMs: 900000 },
|
|
36
|
+
'GET:characters/{character_id}/fw/stats': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
37
|
+
'GET:characters/{character_id}/implants': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
38
|
+
'GET:characters/{character_id}/industry/jobs': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
39
|
+
'GET:characters/{character_id}/killmails/recent': { group: 'char-killmail', maxTokens: 30, windowSizeMs: 900000 },
|
|
40
|
+
'GET:characters/{character_id}/location': { group: 'char-location', maxTokens: 1200, windowSizeMs: 900000 },
|
|
41
|
+
'GET:characters/{character_id}/loyalty/points': { group: 'char-wallet', maxTokens: 150, windowSizeMs: 900000 },
|
|
42
|
+
'GET:characters/{character_id}/mail': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
43
|
+
'POST:characters/{character_id}/mail': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
44
|
+
'GET:characters/{character_id}/mail/{mail_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
45
|
+
'PUT:characters/{character_id}/mail/{mail_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
46
|
+
'DELETE:characters/{character_id}/mail/{mail_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
47
|
+
'GET:characters/{character_id}/mail/labels': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
48
|
+
'POST:characters/{character_id}/mail/labels': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
49
|
+
'DELETE:characters/{character_id}/mail/labels/{label_id}': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
50
|
+
'GET:characters/{character_id}/mail/lists': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
51
|
+
'GET:characters/{character_id}/medals': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
52
|
+
'GET:characters/{character_id}/mining': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
53
|
+
'GET:characters/{character_id}/notifications': { group: 'char-notification', maxTokens: 15, windowSizeMs: 900000 },
|
|
54
|
+
'GET:characters/{character_id}/notifications/contacts': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
55
|
+
'GET:characters/{character_id}/online': { group: 'char-location', maxTokens: 1200, windowSizeMs: 900000 },
|
|
56
|
+
'GET:characters/{character_id}/planets': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
57
|
+
'GET:characters/{character_id}/planets/{planet_id}': { group: 'char-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
58
|
+
'GET:characters/{character_id}/portrait': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
59
|
+
'GET:characters/{character_id}/roles': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
60
|
+
'GET:characters/{character_id}/ship': { group: 'char-location', maxTokens: 1200, windowSizeMs: 900000 },
|
|
61
|
+
'GET:characters/{character_id}/skillqueue': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
62
|
+
'GET:characters/{character_id}/skills': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
63
|
+
'GET:characters/{character_id}/standings': { group: 'char-social', maxTokens: 600, windowSizeMs: 900000 },
|
|
64
|
+
'GET:characters/{character_id}/titles': { group: 'char-detail', maxTokens: 600, windowSizeMs: 900000 },
|
|
65
|
+
'GET:characters/{character_id}/wallet': { group: 'char-wallet', maxTokens: 150, windowSizeMs: 900000 },
|
|
66
|
+
'GET:characters/{character_id}/wallet/journal': { group: 'char-wallet', maxTokens: 150, windowSizeMs: 900000 },
|
|
67
|
+
'GET:characters/{character_id}/wallet/transactions': { group: 'char-wallet', maxTokens: 150, windowSizeMs: 900000 },
|
|
68
|
+
'GET:corporation/{corporation_id}/mining/extractions': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
69
|
+
'GET:corporation/{corporation_id}/mining/observers': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
70
|
+
'GET:corporation/{corporation_id}/mining/observers/{observer_id}': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
71
|
+
'GET:corporations/{corporation_id}/assets': { group: 'corp-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
72
|
+
'POST:corporations/{corporation_id}/assets/locations': { group: 'corp-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
73
|
+
'POST:corporations/{corporation_id}/assets/names': { group: 'corp-asset', maxTokens: 1800, windowSizeMs: 900000 },
|
|
74
|
+
'GET:corporations/{corporation_id}/blueprints': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
75
|
+
'GET:corporations/{corporation_id}/contacts': { group: 'corp-social', maxTokens: 300, windowSizeMs: 900000 },
|
|
76
|
+
'GET:corporations/{corporation_id}/contacts/labels': { group: 'corp-social', maxTokens: 300, windowSizeMs: 900000 },
|
|
77
|
+
'GET:corporations/{corporation_id}/containers/logs': { group: 'corp-structure', maxTokens: 300, windowSizeMs: 900000 },
|
|
78
|
+
'GET:corporations/{corporation_id}/contracts': { group: 'corp-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
79
|
+
'GET:corporations/{corporation_id}/contracts/{contract_id}/bids': { group: 'corp-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
80
|
+
'GET:corporations/{corporation_id}/contracts/{contract_id}/items': { group: 'corp-contract', maxTokens: 600, windowSizeMs: 900000 },
|
|
81
|
+
'GET:corporations/{corporation_id}/customs_offices': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
82
|
+
'GET:corporations/{corporation_id}/divisions': { group: 'corp-wallet', maxTokens: 300, windowSizeMs: 900000 },
|
|
83
|
+
'GET:corporations/{corporation_id}/facilities': { group: 'corp-structure', maxTokens: 300, windowSizeMs: 900000 },
|
|
84
|
+
'GET:corporations/{corporation_id}/freelance-jobs': { group: 'corp-freelance-job', maxTokens: 300, windowSizeMs: 900000 },
|
|
85
|
+
'GET:corporations/{corporation_id}/freelance-jobs/{job_id}/participants': { group: 'corp-freelance-job', maxTokens: 300, windowSizeMs: 900000 },
|
|
86
|
+
'GET:corporations/{corporation_id}/fw/stats': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
87
|
+
'GET:corporations/{corporation_id}/industry/jobs': { group: 'corp-industry', maxTokens: 600, windowSizeMs: 900000 },
|
|
88
|
+
'GET:corporations/{corporation_id}/killmails/recent': { group: 'corp-killmail', maxTokens: 30, windowSizeMs: 900000 },
|
|
89
|
+
'GET:corporations/{corporation_id}/medals': { group: 'corp-detail', maxTokens: 300, windowSizeMs: 900000 },
|
|
90
|
+
'GET:corporations/{corporation_id}/medals/issued': { group: 'corp-detail', maxTokens: 300, windowSizeMs: 900000 },
|
|
91
|
+
'GET:corporations/{corporation_id}/members': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
92
|
+
'GET:corporations/{corporation_id}/members/limit': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
93
|
+
'GET:corporations/{corporation_id}/members/titles': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
94
|
+
'GET:corporations/{corporation_id}/membertracking': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
95
|
+
'GET:corporations/{corporation_id}/projects': { group: 'corp-project', maxTokens: 600, windowSizeMs: 900000 },
|
|
96
|
+
'GET:corporations/{corporation_id}/projects/{project_id}': { group: 'corp-project', maxTokens: 600, windowSizeMs: 900000 },
|
|
97
|
+
'GET:corporations/{corporation_id}/projects/{project_id}/contribution/{character_id}': { group: 'corp-project', maxTokens: 600, windowSizeMs: 900000 },
|
|
98
|
+
'GET:corporations/{corporation_id}/projects/{project_id}/contributors': { group: 'corp-project', maxTokens: 600, windowSizeMs: 900000 },
|
|
99
|
+
'GET:corporations/{corporation_id}/roles': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
100
|
+
'GET:corporations/{corporation_id}/roles/history': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
101
|
+
'GET:corporations/{corporation_id}/shareholders': { group: 'corp-detail', maxTokens: 300, windowSizeMs: 900000 },
|
|
102
|
+
'GET:corporations/{corporation_id}/standings': { group: 'corp-member', maxTokens: 300, windowSizeMs: 900000 },
|
|
103
|
+
'GET:corporations/{corporation_id}/starbases': { group: 'corp-structure', maxTokens: 300, windowSizeMs: 900000 },
|
|
104
|
+
'GET:corporations/{corporation_id}/starbases/{starbase_id}': { group: 'corp-structure', maxTokens: 300, windowSizeMs: 900000 },
|
|
105
|
+
'GET:corporations/{corporation_id}/structures': { group: 'corp-structure', maxTokens: 300, windowSizeMs: 900000 },
|
|
106
|
+
'GET:corporations/{corporation_id}/titles': { group: 'corp-detail', maxTokens: 300, windowSizeMs: 900000 },
|
|
107
|
+
'GET:corporations/{corporation_id}/wallets': { group: 'corp-wallet', maxTokens: 300, windowSizeMs: 900000 },
|
|
108
|
+
'GET:corporations/{corporation_id}/wallets/{division}/journal': { group: 'corp-wallet', maxTokens: 300, windowSizeMs: 900000 },
|
|
109
|
+
'GET:corporations/{corporation_id}/wallets/{division}/transactions': { group: 'corp-wallet', maxTokens: 300, windowSizeMs: 900000 },
|
|
110
|
+
'GET:fleets/{fleet_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
111
|
+
'PUT:fleets/{fleet_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
112
|
+
'GET:fleets/{fleet_id}/members': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
113
|
+
'POST:fleets/{fleet_id}/members': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
114
|
+
'PUT:fleets/{fleet_id}/members/{member_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
115
|
+
'DELETE:fleets/{fleet_id}/members/{member_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
116
|
+
'PUT:fleets/{fleet_id}/squads/{squad_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
117
|
+
'DELETE:fleets/{fleet_id}/squads/{squad_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
118
|
+
'GET:fleets/{fleet_id}/wings': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
119
|
+
'POST:fleets/{fleet_id}/wings': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
120
|
+
'PUT:fleets/{fleet_id}/wings/{wing_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
121
|
+
'DELETE:fleets/{fleet_id}/wings/{wing_id}': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
122
|
+
'POST:fleets/{fleet_id}/wings/{wing_id}/squads': { group: 'fleet', maxTokens: 1800, windowSizeMs: 900000 },
|
|
123
|
+
'GET:freelance-jobs': { group: 'freelance-job', maxTokens: 900, windowSizeMs: 900000 },
|
|
124
|
+
'GET:freelance-jobs/{job_id}': { group: 'freelance-job', maxTokens: 900, windowSizeMs: 900000 },
|
|
125
|
+
'GET:fw/leaderboards': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
126
|
+
'GET:fw/leaderboards/characters': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
127
|
+
'GET:fw/leaderboards/corporations': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
128
|
+
'GET:fw/stats': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
129
|
+
'GET:fw/systems': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
130
|
+
'GET:fw/wars': { group: 'factional-warfare', maxTokens: 150, windowSizeMs: 900000 },
|
|
131
|
+
'GET:incursions': { group: 'incursion', maxTokens: 150, windowSizeMs: 900000 },
|
|
132
|
+
'GET:industry/facilities': { group: 'industry', maxTokens: 150, windowSizeMs: 900000 },
|
|
133
|
+
'GET:industry/systems': { group: 'industry', maxTokens: 150, windowSizeMs: 900000 },
|
|
134
|
+
'GET:insurance/prices': { group: 'insurance', maxTokens: 150, windowSizeMs: 900000 },
|
|
135
|
+
'GET:killmails/{killmail_id}/{killmail_hash}': { group: 'killmail', maxTokens: 3600, windowSizeMs: 900000 },
|
|
136
|
+
'GET:markets/{region_id}/orders': { group: 'market-order', maxTokens: 12000, windowSizeMs: 900000 },
|
|
137
|
+
'GET:meta/changelog': { group: 'meta', maxTokens: 150, windowSizeMs: 900000 },
|
|
138
|
+
'GET:meta/compatibility-dates': { group: 'meta', maxTokens: 150, windowSizeMs: 900000 },
|
|
139
|
+
'GET:meta/status': { group: 'meta', maxTokens: 150, windowSizeMs: 900000 },
|
|
140
|
+
'POST:route/{origin_system_id}/{destination_system_id}': { group: 'routes', maxTokens: 3600, windowSizeMs: 900000 },
|
|
141
|
+
'GET:sovereignty/campaigns': { group: 'sovereignty', maxTokens: 600, windowSizeMs: 900000 },
|
|
142
|
+
'GET:sovereignty/map': { group: 'sovereignty', maxTokens: 600, windowSizeMs: 900000 },
|
|
143
|
+
'GET:sovereignty/structures': { group: 'sovereignty', maxTokens: 600, windowSizeMs: 900000 },
|
|
144
|
+
'GET:status': { group: 'status', maxTokens: 600, windowSizeMs: 900000 },
|
|
145
|
+
'POST:ui/autopilot/waypoint': { group: 'ui', maxTokens: 900, windowSizeMs: 900000 },
|
|
146
|
+
'POST:ui/openwindow/contract': { group: 'ui', maxTokens: 900, windowSizeMs: 900000 },
|
|
147
|
+
'POST:ui/openwindow/information': { group: 'ui', maxTokens: 900, windowSizeMs: 900000 },
|
|
148
|
+
'POST:ui/openwindow/marketdetails': { group: 'ui', maxTokens: 900, windowSizeMs: 900000 },
|
|
149
|
+
'POST:ui/openwindow/newmail': { group: 'ui', maxTokens: 900, windowSizeMs: 900000 },
|
|
150
|
+
'GET:wars': { group: 'killmail', maxTokens: 3600, windowSizeMs: 900000 },
|
|
151
|
+
'GET:wars/{war_id}': { group: 'killmail', maxTokens: 3600, windowSizeMs: 900000 },
|
|
152
|
+
'GET:wars/{war_id}/killmails': { group: 'killmail', maxTokens: 3600, windowSizeMs: 900000 },
|
|
153
|
+
};
|
|
@@ -16,7 +16,7 @@ export declare class PaginationHandler {
|
|
|
16
16
|
* Fetch remaining pages (2..totalPages) and combine with first page data.
|
|
17
17
|
* The caller has already fetched page 1 and knows the total page count.
|
|
18
18
|
*/
|
|
19
|
-
static fetchRemainingPages(client: ApiClient, endpoint: string, method: string, requiresAuth: boolean, firstPageData: unknown[], totalPages: number, body?: unknown, options?: PaginationOptions, pageFetch?: PageFetcher): Promise<unknown[]>;
|
|
19
|
+
static fetchRemainingPages(client: ApiClient, endpoint: string, method: string, requiresAuth: boolean, firstPageData: unknown[], totalPages: number, body?: unknown, options?: PaginationOptions, pageFetch?: PageFetcher, templatePath?: string): Promise<unknown[]>;
|
|
20
20
|
/**
|
|
21
21
|
* Fetch a single page with retry logic
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationHandler.d.ts","sourceRoot":"","sources":["../../../src/core/pagination/PaginationHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAE5E,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAKrC;IAEF;;;OAGG;WACU,mBAAmB,CAC9B,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EAAE,EACxB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,GAAE,iBAAsB,EAC/B,SAAS,CAAC,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"PaginationHandler.d.ts","sourceRoot":"","sources":["../../../src/core/pagination/PaginationHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,iBAAiB,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAE5E,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAKrC;IAEF;;;OAGG;WACU,mBAAmB,CAC9B,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EAAE,EACxB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,GAAE,iBAAsB,EAC/B,SAAS,CAAC,EAAE,WAAW,EACvB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC;IA8DrB;;OAEG;mBACkB,kBAAkB;IA2CvC;;;OAGG;mBACkB,eAAe;CAiDrC"}
|
|
@@ -19,7 +19,7 @@ class PaginationHandler {
|
|
|
19
19
|
* Fetch remaining pages (2..totalPages) and combine with first page data.
|
|
20
20
|
* The caller has already fetched page 1 and knows the total page count.
|
|
21
21
|
*/
|
|
22
|
-
static async fetchRemainingPages(client, endpoint, method, requiresAuth, firstPageData, totalPages, body, options = {}, pageFetch) {
|
|
22
|
+
static async fetchRemainingPages(client, endpoint, method, requiresAuth, firstPageData, totalPages, body, options = {}, pageFetch, templatePath) {
|
|
23
23
|
const opts = { ...this.DEFAULT_OPTIONS, ...options };
|
|
24
24
|
const rateLimiter = client.getRateLimiter();
|
|
25
25
|
const allData = [...firstPageData];
|
|
@@ -32,7 +32,7 @@ class PaginationHandler {
|
|
|
32
32
|
for (let page = 2; page <= effectiveMaxPage; page++) {
|
|
33
33
|
try {
|
|
34
34
|
if (rateLimiter)
|
|
35
|
-
await rateLimiter.checkRateLimit();
|
|
35
|
+
await rateLimiter.checkRateLimit(templatePath, method);
|
|
36
36
|
const pageData = await this.fetchPageWithRetry(client, endpoint, method, page, requiresAuth, body, opts, pageFetch);
|
|
37
37
|
consecutiveFailures = 0;
|
|
38
38
|
if (opts.stopOnEmptyPage && (!pageData || pageData.length === 0)) {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
export interface RateLimitGroupStatus {
|
|
2
|
+
group: string;
|
|
3
|
+
remaining: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
used: number;
|
|
6
|
+
windowSizeMs: number;
|
|
7
|
+
blockedUntil: number;
|
|
8
|
+
}
|
|
1
9
|
export interface IRateLimiter {
|
|
2
|
-
checkRateLimit(): Promise<void>;
|
|
3
|
-
updateFromResponse(headers: Record<string, string>, statusCode: number): void;
|
|
10
|
+
checkRateLimit(templatePath?: string, method?: string, requestHeaders?: Record<string, string>): Promise<void>;
|
|
11
|
+
updateFromResponse(headers: Record<string, string>, statusCode: number, templatePath?: string, method?: string, requestHeaders?: Record<string, string>): void;
|
|
4
12
|
getStatus(): {
|
|
5
13
|
remaining: number;
|
|
6
14
|
limit: number;
|
|
@@ -11,7 +19,9 @@ export interface IRateLimiter {
|
|
|
11
19
|
retryAfter: number | null;
|
|
12
20
|
blockedUntil: number;
|
|
13
21
|
};
|
|
14
|
-
|
|
22
|
+
getGroupStatus(group: string): RateLimitGroupStatus | undefined;
|
|
23
|
+
getAllGroupStatuses(): Map<string, RateLimitGroupStatus>;
|
|
24
|
+
isBlocked(group?: string): boolean;
|
|
15
25
|
reset(): void;
|
|
16
26
|
}
|
|
17
27
|
//# sourceMappingURL=IRateLimiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRateLimiter.d.ts","sourceRoot":"","sources":["../../../src/core/rateLimiter/IRateLimiter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"IRateLimiter.d.ts","sourceRoot":"","sources":["../../../src/core/rateLimiter/IRateLimiter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,CACZ,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,kBAAkB,CAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,IAAI,CAAC;IACR,SAAS,IAAI;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;IAChE,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACzD,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -1,77 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
* Rate Limiter for ESI API calls
|
|
3
|
-
*
|
|
4
|
-
* Implements both the new floating-window rate limiting system and the legacy
|
|
5
|
-
* error-limit system per the official ESI documentation:
|
|
6
|
-
*
|
|
7
|
-
* New system (X-Ratelimit-* headers):
|
|
8
|
-
* - Floating window with token bucket per IP+route group
|
|
9
|
-
* - Token costs: 2xx = 2 tokens, 3xx = 1 token, 4xx = 5 tokens, 5xx = 0 tokens
|
|
10
|
-
* - Returns 429 when bucket is empty, with Retry-After header
|
|
11
|
-
*
|
|
12
|
-
* Legacy system (x-esi-error-limit-* headers):
|
|
13
|
-
* - 100 non-2xx/3xx errors per minute
|
|
14
|
-
* - Returns 420 when limit exceeded, with Retry-After header
|
|
15
|
-
*/
|
|
16
|
-
import { IRateLimiter } from './IRateLimiter';
|
|
1
|
+
import { IRateLimiter, RateLimitGroupStatus } from './IRateLimiter';
|
|
17
2
|
export interface RateLimitInfo {
|
|
18
|
-
/** Tokens remaining in current window (new system) */
|
|
19
3
|
remaining: number;
|
|
20
|
-
/** Total token budget (new system) */
|
|
21
4
|
limit: number;
|
|
22
|
-
/** Tokens used in current window (new system) */
|
|
23
5
|
used: number;
|
|
24
|
-
/** Route group for this endpoint (new system) */
|
|
25
6
|
group: string | null;
|
|
26
|
-
/** Legacy error-limit remaining count */
|
|
27
7
|
errorLimitRemain: number;
|
|
28
|
-
/** Legacy error-limit seconds until reset */
|
|
29
8
|
errorLimitReset: number;
|
|
30
|
-
/** Retry-After value in seconds (set on 420/429) */
|
|
31
9
|
retryAfter: number | null;
|
|
32
|
-
/** Timestamp (ms) when we must stop sending requests */
|
|
33
10
|
blockedUntil: number;
|
|
34
11
|
}
|
|
35
12
|
export interface RateLimiterConfig {
|
|
36
13
|
minDelayMs?: number;
|
|
37
14
|
decelerationThreshold?: number;
|
|
15
|
+
userKeyExtractor?: (headers: Record<string, string>) => string;
|
|
38
16
|
}
|
|
39
17
|
export declare class RateLimiter implements IRateLimiter {
|
|
40
|
-
private rateLimitInfo;
|
|
41
|
-
private lastRequestTime;
|
|
42
18
|
private readonly minDelayMs;
|
|
43
|
-
private isTestMode;
|
|
44
19
|
private readonly decelerationThreshold;
|
|
20
|
+
private readonly userKeyExtractor?;
|
|
21
|
+
private lastRequestTime;
|
|
22
|
+
private isTestMode;
|
|
23
|
+
private errorLimitRemain;
|
|
24
|
+
private errorLimitReset;
|
|
25
|
+
private defaultBuckets;
|
|
26
|
+
private userBuckets;
|
|
27
|
+
private fallbackBucket;
|
|
28
|
+
private lastCleanup;
|
|
29
|
+
private static readonly CLEANUP_INTERVAL_MS;
|
|
45
30
|
constructor(config?: RateLimiterConfig);
|
|
46
|
-
private
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* Prefer updateFromResponse() which also accepts status code.
|
|
55
|
-
*/
|
|
31
|
+
private createFallbackBucket;
|
|
32
|
+
private createBucketFromSpec;
|
|
33
|
+
private createBucketForGroup;
|
|
34
|
+
private lookupGroupSpec;
|
|
35
|
+
private resolveBucketMap;
|
|
36
|
+
private getBucket;
|
|
37
|
+
private cleanupStaleUsers;
|
|
38
|
+
updateFromResponse(headers: Record<string, string>, statusCode: number, templatePath?: string, method?: string, requestHeaders?: Record<string, string>): void;
|
|
56
39
|
updateRateLimitInfo(headers: Record<string, string>): void;
|
|
57
|
-
|
|
58
|
-
* Check if we should wait before making the next request.
|
|
59
|
-
* Enforces hard blocks (420/429), proactive deceleration, and minimum delay.
|
|
60
|
-
*/
|
|
61
|
-
checkRateLimit(): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Enforce minimum delay between requests
|
|
64
|
-
*/
|
|
40
|
+
checkRateLimit(templatePath?: string, method?: string, requestHeaders?: Record<string, string>): Promise<void>;
|
|
65
41
|
private enforceMinDelay;
|
|
66
|
-
/** Get current rate limit status */
|
|
67
42
|
getStatus(): RateLimitInfo;
|
|
68
|
-
|
|
43
|
+
getGroupStatus(group: string): RateLimitGroupStatus | undefined;
|
|
44
|
+
getAllGroupStatuses(): Map<string, RateLimitGroupStatus>;
|
|
69
45
|
static getTokenCost(statusCode: number): number;
|
|
70
|
-
|
|
71
|
-
isBlocked(): boolean;
|
|
72
|
-
/** Set test mode (disables all delays) */
|
|
46
|
+
isBlocked(group?: string): boolean;
|
|
73
47
|
setTestMode(enabled: boolean): void;
|
|
74
|
-
/** Reset rate limiter state */
|
|
75
48
|
reset(): void;
|
|
76
49
|
}
|
|
77
50
|
//# sourceMappingURL=RateLimiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RateLimiter.d.ts","sourceRoot":"","sources":["../../../src/core/rateLimiter/RateLimiter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"RateLimiter.d.ts","sourceRoot":"","sources":["../../../src/core/rateLimiter/RateLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AASpE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;CAChE;AAmBD,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;IAC/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAEtB;IAEZ,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,UAAU,CAAkB;IAEpC,OAAO,CAAC,gBAAgB,CAAe;IACvC,OAAO,CAAC,eAAe,CAAa;IAEpC,OAAO,CAAC,cAAc,CAAuC;IAC7D,OAAO,CAAC,WAAW,CAA2C;IAC9D,OAAO,CAAC,cAAc,CAAc;IAEpC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAEzC,MAAM,CAAC,EAAE,iBAAiB;IAUtC,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,SAAS;IAuBjB,OAAO,CAAC,iBAAiB;IAazB,kBAAkB,CAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,IAAI;IAyCP,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAIpD,cAAc,CAClB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC;YA8DF,eAAe;IAgB7B,SAAS,IAAI,aAAa;IAyC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAa/D,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAexD,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAI/C,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAelC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAInC,KAAK,IAAI,IAAI;CASd"}
|