@restorecommerce/gql-bot 0.2.4 → 0.2.7

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
@@ -3,6 +3,36 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.2.7](https://github.com/restorecommerce/libs/compare/@restorecommerce/gql-bot@0.2.6...@restorecommerce/gql-bot@0.2.7) (2022-08-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **gql-bot:** always pre-process response before logging ([ff6963e](https://github.com/restorecommerce/libs/commit/ff6963e0f2c7c5c0d61a3d1f890706f52fe02d91))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.2.6](https://github.com/restorecommerce/libs/compare/@restorecommerce/gql-bot@0.2.5...@restorecommerce/gql-bot@0.2.6) (2022-08-10)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **gql-bot:** fix null type error ([22db1dc](https://github.com/restorecommerce/libs/commit/22db1dce1d3e31658852cb80194aa2140ecc0970))
23
+
24
+
25
+
26
+
27
+
28
+ ## [0.2.5](https://github.com/restorecommerce/libs/compare/@restorecommerce/gql-bot@0.2.4...@restorecommerce/gql-bot@0.2.5) (2022-08-10)
29
+
30
+ **Note:** Version bump only for package @restorecommerce/gql-bot
31
+
32
+
33
+
34
+
35
+
6
36
  ## [0.2.4](https://github.com/restorecommerce/libs/compare/@restorecommerce/gql-bot@0.2.3...@restorecommerce/gql-bot@0.2.4) (2022-06-20)
7
37
 
8
38
  **Note:** Version bump only for package @restorecommerce/gql-bot
package/lib/client.js CHANGED
@@ -59,7 +59,7 @@ const checkError = (data) => {
59
59
  }
60
60
  }
61
61
  else {
62
- if ('__typename' in data) {
62
+ if (data && '__typename' in data) {
63
63
  switch (data['__typename']) {
64
64
  case 'IoRestorecommerceStatusOperationStatus':
65
65
  case 'IoRestorecommerceStatusStatus':
@@ -190,15 +190,15 @@ class Client {
190
190
  });
191
191
  const error = checkError(response);
192
192
  if (error) {
193
+ const processed = (0, utils_1.processResponse)(response);
193
194
  if (verbose) {
194
195
  console.error(JSON.stringify({
195
196
  request: mutation,
196
197
  variables,
197
- response
198
+ response: processed
198
199
  }));
199
200
  }
200
201
  else if (ignoreErrors) {
201
- const processed = (0, utils_1.processResponse)(response);
202
202
  console.error(JSON.stringify(processed));
203
203
  }
204
204
  throw new Error(JSON.stringify(error));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@restorecommerce/gql-bot",
3
3
  "description": "GraphQL Client Automated Task Processor",
4
4
  "main": "lib/index",
5
- "version": "0.2.4",
5
+ "version": "0.2.7",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/restorecommerce/libs.git"
@@ -71,5 +71,5 @@
71
71
  }
72
72
  }
73
73
  },
74
- "gitHead": "4dd7fcfeb6b9be52a91beb8b6353fbe69c17cc44"
74
+ "gitHead": "2919a9307270e927f21d7850df0d258da76ce93d"
75
75
  }
package/src/client.ts CHANGED
@@ -51,7 +51,7 @@ const checkError = (data: any): any => {
51
51
  return result;
52
52
  }
53
53
  } else {
54
- if ('__typename' in data) {
54
+ if (data && '__typename' in data) {
55
55
  switch (data['__typename']) {
56
56
  case 'IoRestorecommerceStatusOperationStatus':
57
57
  case 'IoRestorecommerceStatusStatus':
@@ -204,14 +204,14 @@ export class Client {
204
204
 
205
205
  const error = checkError(response);
206
206
  if (error) {
207
+ const processed = processResponse(response);
207
208
  if (verbose) {
208
209
  console.error(JSON.stringify({
209
210
  request: mutation,
210
211
  variables,
211
- response
212
+ response: processed
212
213
  }));
213
214
  } else if (ignoreErrors) {
214
- const processed = processResponse(response);
215
215
  console.error(JSON.stringify(processed));
216
216
  }
217
217
  throw new Error(JSON.stringify(error));