@ctx-core/graphql-client 7.2.7 → 7.2.11

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,5 +1,31 @@
1
1
  # @ctx-core/graphql-client
2
2
 
3
+ ## 7.2.11
4
+
5
+ ### Patch Changes
6
+
7
+ - graphql*fetch*: use fetch*response_pair* to clear out undici response object
8
+
9
+ ## 7.2.10
10
+
11
+ ### Patch Changes
12
+
13
+ - update dependencies
14
+
15
+ ## 7.2.9
16
+
17
+ ### Patch Changes
18
+
19
+ - update dependencies
20
+
21
+ ## 7.2.8
22
+
23
+ ### Patch Changes
24
+
25
+ - update dependencies
26
+ - Updated dependencies
27
+ - @ctx-core/dom@11.1.7
28
+
3
29
  ## 7.2.7
4
30
 
5
31
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/graphql-client",
3
- "version": "7.2.7",
3
+ "version": "7.2.11",
4
4
  "description": "ctx-core graphql-client",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -25,13 +25,13 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@ctx-core/dom": "^11.1.6",
29
- "@ctx-core/fetch-undici": "^1.2.0",
28
+ "@ctx-core/dom": "^11.1.7",
29
+ "@ctx-core/fetch-undici": "^1.2.3",
30
30
  "@ctx-core/graphql": "^9.0.57",
31
31
  "@ctx-core/object": "*"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^17.0.17",
34
+ "@types/node": "^17.0.18",
35
35
  "c8": "^7.11.0",
36
36
  "check-dts": "^0.6.6",
37
37
  "tsm": "^2.2.1",
@@ -1,4 +1,4 @@
1
- import { fetch } from '@ctx-core/fetch-undici'
1
+ import { fetch_response_pair_ } from '@ctx-core/fetch-undici'
2
2
  import { assign } from '@ctx-core/object'
3
3
  export function graphql_fetch_(in_http_opts = {}) {
4
4
  return async function graphql_fetch(body, fn_in_http_opts = {}) {
@@ -6,7 +6,7 @@ export function graphql_fetch_(in_http_opts = {}) {
6
6
  if (!url) {
7
7
  throw `no url prop`
8
8
  }
9
- const response = await fetch(url, assign({
9
+ const [payload, response] = await fetch_response_pair_(url, assign({
10
10
  method: 'POST',
11
11
  headers: assign({
12
12
  'Content-Type': 'application/json'
@@ -14,16 +14,14 @@ export function graphql_fetch_(in_http_opts = {}) {
14
14
  body
15
15
  }, in_http_opts, fn_in_http_opts))
16
16
  if (response.ok) {
17
- const payload = await response.json()
18
17
  if (payload.errors) throw payload
19
18
  return payload
20
19
  } else {
21
- const error_text = await response.text()
22
20
  if (process.env.NODE_ENV === 'production') {
23
- console.error(error_text)
21
+ console.error(payload)
24
22
  throw `Error fetching graphql`
25
23
  } else {
26
- throw error_text
24
+ throw payload
27
25
  }
28
26
  }
29
27
  }