@trayio/axios 4.36.0 → 4.36.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"AxiosHttpClient.d.ts","sourceRoot":"","sources":["../../src/http/AxiosHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAEN,UAAU,EACV,WAAW,EAEX,YAAY,EAEZ,MAAM,2BAA2B,CAAC;AAGnC,OAAO,QAAQ,GAAG,QAAQ,WAAW,CAAC,CAAC;AACvC,OAAO,EAAQ,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAK9D,qBAAa,eAAgB,YAAW,UAAU;IAEhD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,WAAqC;IAGpE,OAAO,CACN,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,GAClB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC;IAkFrC,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,2BAA2B;IAUnC,YAAY,aAAc,QAAQ,cAAc,OAAO,MAAM,EAAE,MAAM,CAAC,cAKpE;CACF"}
1
+ {"version":3,"file":"AxiosHttpClient.d.ts","sourceRoot":"","sources":["../../src/http/AxiosHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAEN,UAAU,EACV,WAAW,EAEX,YAAY,EAEZ,MAAM,2BAA2B,CAAC;AAInC,OAAO,QAAQ,GAAG,QAAQ,WAAW,CAAC,CAAC;AACvC,OAAO,EAAQ,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAK9D,qBAAa,eAAgB,YAAW,UAAU;IAEhD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,GAAE,WAAqC;IAGpE,OAAO,CACN,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,GAClB,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,CAAC;IA2FrC,OAAO,CAAC,wBAAwB;IAchC,OAAO,CAAC,2BAA2B;IAUnC,YAAY,aAAc,QAAQ,cAAc,OAAO,MAAM,EAAE,MAAM,CAAC,cAKpE;CACF"}
@@ -7,6 +7,7 @@ exports.AxiosHttpClient = void 0;
7
7
  const Http_1 = require("@trayio/commons/http/Http");
8
8
  const Task_1 = require("@trayio/commons/task/Task");
9
9
  const axios_1 = __importDefault(require("axios"));
10
+ const https_1 = require("https");
10
11
  const FormData = require("form-data");
11
12
  const NodeFsFileStorage_1 = require("@trayio/commons/file/NodeFsFileStorage");
12
13
  const BufferExtensions_1 = require("@trayio/commons/buffer/BufferExtensions");
@@ -36,6 +37,12 @@ class AxiosHttpClient {
36
37
  };
37
38
  }, {});
38
39
  let axiosConfig;
40
+ // We need a keep-alive heartbeat shorter than 350 seconds to bypass the idle timeout in AWS NAT/LB servers:
41
+ // https://repost.aws/knowledge-center/lambda-vpc-timeout
42
+ const httpsAgent = new https_1.Agent({
43
+ keepAlive: true,
44
+ keepAliveMsecs: 42000,
45
+ });
39
46
  if (headers['content-type'] &&
40
47
  headers['content-type'].includes(Http_1.HttpContentType.MultipartRequestBody)) {
41
48
  const formData = new FormData();
@@ -54,6 +61,7 @@ class AxiosHttpClient {
54
61
  data: formData,
55
62
  responseType: 'stream',
56
63
  headers,
64
+ httpsAgent,
57
65
  params: request.queryString,
58
66
  };
59
67
  return (0, Task_1.createTaskEitherFromPromiseWithSimpleError)(() => (0, axios_1.default)(axiosConfig)
@@ -66,6 +74,7 @@ class AxiosHttpClient {
66
74
  data: request.body,
67
75
  responseType: 'stream',
68
76
  headers,
77
+ httpsAgent,
69
78
  params: request.queryString,
70
79
  };
71
80
  return (0, Task_1.createTaskEitherFromPromiseWithSimpleError)(() => (0, axios_1.default)(axiosConfig)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/axios",
3
- "version": "4.36.0",
3
+ "version": "4.36.1",
4
4
  "description": "Axios extensions and implementations",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@trayio/commons": "4.36.0",
17
+ "@trayio/commons": "4.36.1",
18
18
  "axios": "1.7.4",
19
19
  "form-data": "4.0.0"
20
20
  },