@ctx-core/graphql-client 7.2.10 → 7.2.13

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,23 @@
1
1
  # @ctx-core/graphql-client
2
2
 
3
+ ## 7.2.13
4
+
5
+ ### Patch Changes
6
+
7
+ - update dependencies
8
+
9
+ ## 7.2.12
10
+
11
+ ### Patch Changes
12
+
13
+ - update dependencies
14
+
15
+ ## 7.2.11
16
+
17
+ ### Patch Changes
18
+
19
+ - graphql*fetch*: use fetch*response_pair* to clear out undici response object
20
+
3
21
  ## 7.2.10
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
1
  {
2
- "name": "@ctx-core/graphql-client",
3
- "version": "7.2.10",
4
- "description": "ctx-core graphql-client",
5
- "keywords": [
6
- "ctx-core",
7
- "google"
8
- ],
9
- "homepage": "https://github.com/ctx-core/graphql-client#readme",
10
- "bugs": {
11
- "url": "https://github.com/ctx-core/graphql-client/issues"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/ctx-core/graphql-client.git"
16
- },
17
- "license": "Apache-2.0",
18
- "author": "Brian Takita",
19
- "type": "module",
20
- "types": "./src/index.d.ts",
21
- "exports": {
22
- ".": {
23
- "import": "./src/index.js"
24
- },
25
- "./package.json": "./package.json"
26
- },
27
- "dependencies": {
28
- "@ctx-core/dom": "^11.1.7",
29
- "@ctx-core/fetch-undici": "^1.2.3",
30
- "@ctx-core/graphql": "^9.0.57",
31
- "@ctx-core/object": "*"
32
- },
33
- "devDependencies": {
34
- "@types/node": "^17.0.17",
35
- "c8": "^7.11.0",
36
- "check-dts": "^0.6.6",
37
- "tsm": "^2.2.1",
38
- "typescript": "next",
39
- "uvu": "^0.5.3"
40
- },
41
- "publishConfig": {
42
- "access": "public",
43
- "cache": "~/.npm"
44
- },
45
- "svelte": "./src/index.js",
46
- "sideEffects": false,
47
- "scripts": {
48
- "build": ":",
49
- "clean": ":",
50
- "exec": "$@",
51
- "test": "pnpm test-unit && check-dts",
52
- "test-unit": "tsm node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
53
- "test-unit-coverage": "c8 pnpm test-unit"
54
- },
55
- "readme": "# @ctx-core/graphql-client\n\nGraphQL client logic\n"
2
+ "name": "@ctx-core/graphql-client",
3
+ "version": "7.2.13",
4
+ "description": "ctx-core graphql-client",
5
+ "keywords": [
6
+ "ctx-core",
7
+ "google"
8
+ ],
9
+ "homepage": "https://github.com/ctx-core/graphql-client#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/ctx-core/graphql-client/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/ctx-core/graphql-client.git"
16
+ },
17
+ "license": "Apache-2.0",
18
+ "author": "Brian Takita",
19
+ "type": "module",
20
+ "types": "./src/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./src/index.js"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "scripts": {
28
+ "build": ":",
29
+ "clean": ":",
30
+ "exec": "$@",
31
+ "prepublishOnly": "npm run clean && npm run build && npm run test",
32
+ "test": "pnpm test-unit && check-dts",
33
+ "test-unit": "tsm node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
34
+ "test-unit-coverage": "c8 pnpm test-unit"
35
+ },
36
+ "dependencies": {
37
+ "@ctx-core/dom": "^11.1.7",
38
+ "@ctx-core/fetch-undici": "^1.2.5",
39
+ "@ctx-core/graphql": "^9.0.57",
40
+ "@ctx-core/object": "*"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^17.0.21",
44
+ "c8": "^7.11.0",
45
+ "check-dts": "^0.6.6",
46
+ "tsm": "^2.2.1",
47
+ "typescript": "next",
48
+ "uvu": "^0.5.3"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public",
52
+ "cache": "~/.npm"
53
+ },
54
+ "svelte": "./src/index.js",
55
+ "sideEffects": false
56
56
  }
@@ -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
  }