@localisprimary/esi 1.0.2 → 1.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/dist/client.js CHANGED
@@ -1,7 +1,15 @@
1
+ const COMPATIBILITY_DATE = '2025-07-29';
1
2
  export class EsiClient {
2
3
  constructor(options = {}) {
3
4
  this.baseUrl = 'https://esi.evetech.net';
5
+ this.userAgent = '@localisprimary/esi';
4
6
  this.token = options.token;
7
+ if (options.userAgent?.length) {
8
+ this.userAgent += ` ${options.userAgent}`;
9
+ }
10
+ else {
11
+ console.warn('@localisprimary/esi: No user agent provided in constructor. This will be required in a future release.');
12
+ }
5
13
  }
6
14
  async request(method, path, params, body) {
7
15
  const url = new URL(path, this.baseUrl);
@@ -14,6 +22,8 @@ export class EsiClient {
14
22
  }
15
23
  const headers = {
16
24
  'Content-Type': 'application/json',
25
+ 'X-Compatibility-Date': COMPATIBILITY_DATE,
26
+ 'X-User-Agent': this.userAgent,
17
27
  };
18
28
  if (this.token) {
19
29
  headers['Authorization'] = `Bearer ${this.token}`;