quidproquo-actionprocessor-node 0.0.22 → 0.0.25

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.
@@ -16,6 +16,10 @@ const quidproquo_core_1 = require("quidproquo-core");
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  const axiosInstance = axios_1.default.create({
18
18
  timeout: 10000,
19
+ headers: {
20
+ // Fixes: https://github.com/axios/axios/issues/5346
21
+ 'Accept-Encoding': 'gzip,deflate,compress',
22
+ },
19
23
  });
20
24
  const processNetworkRequestGet = (payload) => __awaiter(void 0, void 0, void 0, function* () {
21
25
  const response = yield axiosInstance.get(payload.url, {
@@ -91,13 +95,19 @@ const processNetworkRequest = (payload) => __awaiter(void 0, void 0, void 0, fun
91
95
  if (!requestMethod) {
92
96
  return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
93
97
  }
94
- const response = yield requestMethod(payload);
95
- return (0, quidproquo_core_1.actionResult)({
96
- headers: response.headers,
97
- status: response.status,
98
- statusText: response.statusText,
99
- data: response.data,
100
- });
98
+ try {
99
+ const response = yield requestMethod(payload);
100
+ return (0, quidproquo_core_1.actionResult)({
101
+ headers: response.headers,
102
+ status: response.status,
103
+ statusText: response.statusText,
104
+ data: response.data,
105
+ });
106
+ }
107
+ catch (err) {
108
+ console.log(err);
109
+ return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, err.stack);
110
+ }
101
111
  });
102
112
  exports.default = {
103
113
  [quidproquo_core_1.NetworkActionType.Request]: processNetworkRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-node",
3
- "version": "0.0.22",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.js",
@@ -9,8 +9,9 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
- "build": "npx rimraf lib && tsc",
13
- "watch": "tsc -w"
12
+ "clean": "npx rimraf lib",
13
+ "build": "npm run clean && tsc",
14
+ "watch": "npm run clean && tsc -w"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",