@lgriffin/esi.ts 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.1.0] - 2026-06-26
11
+
12
+ ### Added
13
+
14
+ - **`noUncheckedIndexedAccess`** compiler flag — array/record indexing now returns `T | undefined`, catching unguarded index access at compile time
15
+ - **`noImplicitReturns`** compiler flag — all function code paths must explicitly return a value
16
+ - **`noImplicitOverride`** compiler flag — `override` keyword required when overriding base class methods
17
+ - **`tsconfig.test.json`** — separate TypeScript config for tests, relaxing `noUncheckedIndexedAccess` for test utility patterns
18
+
19
+ ### Changed
20
+
21
+ - `RateLimiter` token cost lookup inlined (removed unnecessary `Record` indirection)
22
+ - Jest configs (`jest.unit.config.cjs`, `jest.integration.config.cjs`) now use `tsconfig.test.json`
23
+
24
+ ### Fixed
25
+
26
+ - Unguarded indexed access in `ApiRequestHandler`, `CircuitBreaker`, `RateLimiter`, and `headersUtil`
27
+
10
28
  ## [5.0.0] - 2026-06-26
11
29
 
12
30
  ### Breaking Changes
@@ -39,7 +39,7 @@ function resolveCircuitBreaker(client) {
39
39
  }
40
40
  // --- Pure helpers ---
41
41
  const parseCacheControlTtl = (headers) => {
42
- const cacheControl = headers['cache-control'] || headers['Cache-Control'];
42
+ const cacheControl = headers['cache-control'] ?? headers['Cache-Control'];
43
43
  if (!cacheControl)
44
44
  return undefined;
45
45
  const match = /max-age=(\d+)/.exec(cacheControl);
@@ -1,5 +1,5 @@
1
1
  export declare const PACKAGE_NAME = "esi.ts";
2
- export declare const PACKAGE_VERSION = "5.0.0";
3
- export declare const USER_AGENT = "esi.ts/5.0.0";
2
+ export declare const PACKAGE_VERSION = "5.1.0";
3
+ export declare const USER_AGENT = "esi.ts/5.1.0";
4
4
  export declare const COMPATIBILITY_DATE = "2026-05-19";
5
5
  //# sourceMappingURL=constants.d.ts.map
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COMPATIBILITY_DATE = exports.USER_AGENT = exports.PACKAGE_VERSION = exports.PACKAGE_NAME = void 0;
4
4
  exports.PACKAGE_NAME = 'esi.ts';
5
- exports.PACKAGE_VERSION = '5.0.0';
5
+ exports.PACKAGE_VERSION = '5.1.0';
6
6
  exports.USER_AGENT = `${exports.PACKAGE_NAME}/${exports.PACKAGE_VERSION}`;
7
7
  exports.COMPATIBILITY_DATE = '2026-05-19';
@@ -1 +1 @@
1
- {"version":3,"file":"RateLimiter.d.ts","sourceRoot":"","sources":["../../../src/core/rateLimiter/RateLimiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB;AAkBD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS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CAAC;IAC1B,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;CACtB;AAWD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,UAAU,CAAkB;IAEpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;gBAEnC,MAAM,CAAC,EAAE,iBAAiB;IAMtC,OAAO,CAAC,WAAW;IAanB;;;OAGG;IACH,kBAAkB,CAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAU,EAAE,MAAM,GACjB,IAAI;IAkDP;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAI1D;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAyErC;;OAEG;YACW,eAAe;IAgB7B,oCAAoC;IACpC,SAAS,IAAI,aAAa;IAI1B,6CAA6C;IAC7C,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAI/C,0DAA0D;IAC1D,SAAS,IAAI,OAAO;IAIpB,0CAA0C;IAC1C,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAInC,+BAA+B;IAC/B,KAAK,IAAI,IAAI;CAId"}
@@ -19,22 +19,16 @@ exports.RateLimiter = void 0;
19
19
  const loggerUtil_1 = require("../logger/loggerUtil");
20
20
  const sleep_1 = require("../util/sleep");
21
21
  /** Token costs per HTTP status code range, per ESI docs */
22
- const TOKEN_COSTS = {
23
- '2xx': 2,
24
- '3xx': 1,
25
- '4xx': 5,
26
- '5xx': 0,
27
- };
28
22
  function getTokenCost(statusCode) {
29
23
  if (statusCode >= 200 && statusCode < 300)
30
- return TOKEN_COSTS['2xx'];
24
+ return 2;
31
25
  if (statusCode >= 300 && statusCode < 400)
32
- return TOKEN_COSTS['3xx'];
26
+ return 1;
33
27
  if (statusCode >= 400 && statusCode < 500)
34
- return TOKEN_COSTS['4xx'];
28
+ return 5;
35
29
  if (statusCode >= 500 && statusCode < 600)
36
- return TOKEN_COSTS['5xx'];
37
- return 2; // default to 2xx cost
30
+ return 0;
31
+ return 2;
38
32
  }
39
33
  class RateLimiter {
40
34
  rateLimitInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"headersUtil.d.ts","sourceRoot":"","sources":["../../../src/core/util/headersUtil.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,UAAU,GAAG,IAAI,CAOnB;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,OAAO,GAAG,aAAa,CAwBjE"}
1
+ {"version":3,"file":"headersUtil.d.ts","sourceRoot":"","sources":["../../../src/core/util/headersUtil.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,UAAU,GAAG,IAAI,CAQnB;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,OAAO,GAAG,aAAa,CAwBjE"}
@@ -9,7 +9,8 @@ function parseWarning(value) {
9
9
  /^(\d{3}) - ([^ ].+[^ ])$/.exec(value);
10
10
  if (!match)
11
11
  return null;
12
- return { code: parseInt(match[1], 10), message: match[2] };
12
+ const [, code, message] = match;
13
+ return { code: parseInt(code, 10), message: message };
13
14
  }
14
15
  function parseHeaders(fetchHeaders) {
15
16
  const raw = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lgriffin/esi.ts",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "This is a TypeScript Implementation for the EVE Online API offered through ESI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",