@vroskus/library-api 1.0.21 → 1.0.24

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/index.d.ts CHANGED
@@ -12,7 +12,7 @@ declare class ApiService<C extends $Config> {
12
12
  responseContextListener: $ResponseContextListener;
13
13
  mock: AxiosMockAdapter | null;
14
14
  path: (arg0: string) => RegExp | string;
15
- constructor({ apiUrl, timeout, }: C);
15
+ constructor({ apiUrl, headers, httpsAgent, timeout, }: C);
16
16
  setUnauthenticatedHandler({ handler, }: {
17
17
  handler: $UnauthenticatedHandler;
18
18
  }): void;
package/dist/index.js CHANGED
@@ -42,7 +42,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  const axios = __importStar(require("axios"));
43
43
  const axios_mock_adapter_1 = __importDefault(require("axios-mock-adapter"));
44
44
  const lodash_1 = __importDefault(require("lodash"));
45
- const uuid_1 = require("uuid");
46
45
  __exportStar(require("./types"), exports);
47
46
  const unauthenticatedStatus = 401;
48
47
  const defaultRetryDelay = 3000;
@@ -50,13 +49,11 @@ const defaultRetryQuantity = 3;
50
49
  const defaultRetryIncrementor = 1;
51
50
  const zeroValue = 0;
52
51
  class ApiService {
53
- constructor({ apiUrl, timeout, }) {
52
+ constructor({ apiUrl, headers, httpsAgent, timeout, }) {
54
53
  const connectionConfig = {
55
54
  baseURL: apiUrl,
56
- headers: {
57
- Accept: 'application/json',
58
- 'Content-Type': 'application/json',
59
- },
55
+ headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, (headers || {})),
56
+ httpsAgent,
60
57
  timeout,
61
58
  withCredentials: true,
62
59
  };
@@ -100,7 +97,7 @@ class ApiService {
100
97
  return Promise.reject(error);
101
98
  });
102
99
  this.connection.interceptors.request.use((config) => {
103
- const requestId = (0, uuid_1.v4)();
100
+ const requestId = crypto.randomUUID();
104
101
  lodash_1.default.set(config, 'headers.X-Request-Id', requestId);
105
102
  const startTimestamp = performance.now();
106
103
  lodash_1.default.set(config, 'startTimestamp', startTimestamp);
package/dist/types.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import type { Agent } from 'https';
1
2
  export type $Config = {
2
3
  apiUrl: string;
4
+ headers?: Record<string, string>;
5
+ httpsAgent?: Agent;
3
6
  timeout: number;
4
7
  };
5
8
  export type $RequestContext = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vroskus/library-api",
3
- "version": "1.0.21",
3
+ "version": "1.0.24",
4
4
  "description": "Api",
5
5
  "author": "Vilius Roškus <vilius@regattas.eu>",
6
6
  "license": "MIT",
@@ -24,16 +24,15 @@
24
24
  "dependencies": {
25
25
  "axios": "^1.8.4",
26
26
  "axios-mock-adapter": "^2.1.0",
27
- "lodash": "^4.17.21",
28
- "uuid": "^11.1.0"
27
+ "lodash": "^4.17.21"
29
28
  },
30
29
  "devDependencies": {
31
- "@types/jest": "^29.5.14",
30
+ "@types/jest": "^30.0.0",
32
31
  "@types/lodash": "^4.17.16",
33
- "@types/node": "^22.14.0",
32
+ "@types/node": "^25.0.3",
34
33
  "@types/query-string": "^6.3.0",
35
- "@vroskus/eslint-config": "^1.0.25",
36
- "jest": "^29.7.0",
34
+ "@vroskus/eslint-config": "^1.0.30",
35
+ "jest": "^30.2.0",
37
36
  "jest-coverage-thresholds-bumper": "^1.1.0",
38
37
  "ts-jest": "^29.3.1",
39
38
  "typescript": "^5.8.3"
@@ -51,10 +50,10 @@
51
50
  ],
52
51
  "coverageThreshold": {
53
52
  "global": {
54
- "branches": 51.35,
53
+ "branches": 52.63,
55
54
  "functions": 50,
56
- "lines": 68.75,
57
- "statements": 65.76
55
+ "lines": 68.42,
56
+ "statements": 65.45
58
57
  }
59
58
  }
60
59
  }