@podium/client 5.1.10-next.2 → 5.1.10

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
@@ -1,16 +1,9 @@
1
- ## [5.1.10-next.2](https://github.com/podium-lib/client/compare/v5.1.10-next.1...v5.1.10-next.2) (2024-08-26)
1
+ ## [5.1.10](https://github.com/podium-lib/client/compare/v5.1.9...v5.1.10) (2024-09-06)
2
2
 
3
3
 
4
4
  ### Bug Fixes
5
5
 
6
- * use AbortController instead of AbortSignal to avoid unhandled exception ([#412](https://github.com/podium-lib/client/issues/412)) ([87f5ffe](https://github.com/podium-lib/client/commit/87f5ffe553aa49189658a9be0e19d1323878a55a))
7
-
8
- ## [5.1.10-next.1](https://github.com/podium-lib/client/compare/v5.1.9...v5.1.10-next.1) (2024-08-22)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * use AbortSignal to ensure timeouts are respected ([08899d9](https://github.com/podium-lib/client/commit/08899d974246037cb1893a5b6d06bd6df58815e2))
6
+ * **deps:** update dependency @podium/utils to v5.2.0 ([f7d4675](https://github.com/podium-lib/client/commit/f7d4675e6e2b9f2fba26cbd164d3e7a73b9c132e))
14
7
 
15
8
  ## [5.1.9](https://github.com/podium-lib/client/compare/v5.1.8...v5.1.9) (2024-08-19)
16
9
 
package/lib/http.js CHANGED
@@ -1,4 +1,4 @@
1
- import { request as undiciRequest } from 'undici';
1
+ import { request } from 'undici';
2
2
 
3
3
  /**
4
4
  * @typedef {object} PodiumHttpClientRequestOptions
@@ -7,38 +7,22 @@ import { request as undiciRequest } from 'undici';
7
7
  * @property {boolean} [rejectUnauthorized]
8
8
  * @property {boolean} [follow]
9
9
  * @property {number} [timeout]
10
+ * @property {number} [bodyTimeout]
10
11
  * @property {object} [query]
11
12
  * @property {import('http').IncomingHttpHeaders} [headers]
12
13
  */
13
14
 
14
15
  export default class HTTP {
15
- constructor(requestFn = undiciRequest) {
16
- this.requestFn = requestFn;
17
- }
18
-
19
16
  /**
20
17
  * @param {string} url
21
18
  * @param {PodiumHttpClientRequestOptions} options
22
19
  * @returns {Promise<Pick<import('undici').Dispatcher.ResponseData, 'statusCode' | 'headers' | 'body'>>}
23
20
  */
24
21
  async request(url, options) {
25
- const abortController = new AbortController();
26
-
27
- const timeoutId = setTimeout(() => {
28
- abortController.abort();
29
- }, options.timeout || 1000);
30
-
31
- try {
32
- const { statusCode, headers, body } = await this.requestFn(
33
- new URL(url),
34
- {
35
- ...options,
36
- signal: abortController.signal,
37
- },
38
- );
39
- return { statusCode, headers, body };
40
- } finally {
41
- clearTimeout(timeoutId);
42
- }
22
+ const { statusCode, headers, body } = await request(
23
+ new URL(url),
24
+ options,
25
+ );
26
+ return { statusCode, headers, body };
43
27
  }
44
28
  }
@@ -136,7 +136,7 @@ export default class PodletClientContentResolver {
136
136
  /** @type {import('./http.js').PodiumHttpClientRequestOptions} */
137
137
  const reqOptions = {
138
138
  rejectUnauthorized: outgoing.rejectUnauthorized,
139
- timeout: outgoing.timeout,
139
+ bodyTimeout: outgoing.timeout,
140
140
  method: 'GET',
141
141
  query: outgoing.reqOptions.query,
142
142
  headers,
@@ -267,7 +267,6 @@ export default class PodletClientContentResolver {
267
267
  }),
268
268
  );
269
269
 
270
- // @ts-ignore
271
270
  pipeline([body, outgoing], (err) => {
272
271
  if (err) {
273
272
  this.#log.warn('error while piping content stream', err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podium/client",
3
- "version": "5.1.10-next.2",
3
+ "version": "5.1.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  "@hapi/boom": "10.0.1",
41
41
  "@metrics/client": "2.5.3",
42
42
  "@podium/schemas": "5.0.6",
43
- "@podium/utils": "5.1.0",
43
+ "@podium/utils": "5.2.0",
44
44
  "abslog": "2.4.4",
45
45
  "http-cache-semantics": "^4.0.3",
46
46
  "lodash.clonedeep": "^4.5.0",
@@ -51,10 +51,10 @@
51
51
  "@podium/test-utils": "2.5.2",
52
52
  "@semantic-release/changelog": "6.0.3",
53
53
  "@semantic-release/git": "10.0.1",
54
- "@semantic-release/github": "10.0.6",
54
+ "@semantic-release/github": "10.1.7",
55
55
  "@semantic-release/npm": "12.0.1",
56
56
  "@semantic-release/release-notes-generator": "13.0.0",
57
- "@sinonjs/fake-timers": "11.2.2",
57
+ "@sinonjs/fake-timers": "11.3.1",
58
58
  "@types/readable-stream": "4.0.15",
59
59
  "benchmark": "2.1.4",
60
60
  "eslint": "9.6.0",
@@ -62,10 +62,10 @@
62
62
  "eslint-plugin-prettier": "5.1.3",
63
63
  "express": "4.19.2",
64
64
  "get-stream": "9.0.1",
65
- "globals": "15.8.0",
65
+ "globals": "15.9.0",
66
66
  "http-proxy": "1.18.1",
67
67
  "is-stream": "4.0.1",
68
- "npm-run-all2": "5.0.0",
68
+ "npm-run-all2": "5.0.2",
69
69
  "prettier": "3.3.2",
70
70
  "semantic-release": "23.1.1",
71
71
  "tap": "18.7.2",
package/types/http.d.ts CHANGED
@@ -5,12 +5,11 @@
5
5
  * @property {boolean} [rejectUnauthorized]
6
6
  * @property {boolean} [follow]
7
7
  * @property {number} [timeout]
8
+ * @property {number} [bodyTimeout]
8
9
  * @property {object} [query]
9
10
  * @property {import('http').IncomingHttpHeaders} [headers]
10
11
  */
11
12
  export default class HTTP {
12
- constructor(requestFn?: typeof undiciRequest);
13
- requestFn: typeof undiciRequest;
14
13
  /**
15
14
  * @param {string} url
16
15
  * @param {PodiumHttpClientRequestOptions} options
@@ -24,7 +23,7 @@ export type PodiumHttpClientRequestOptions = {
24
23
  rejectUnauthorized?: boolean;
25
24
  follow?: boolean;
26
25
  timeout?: number;
26
+ bodyTimeout?: number;
27
27
  query?: object;
28
28
  headers?: import('http').IncomingHttpHeaders;
29
29
  };
30
- import { request as undiciRequest } from 'undici';