Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ardatan/graphql-tools
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @graphql-tools/utils@10.0.11
Choose a base ref
...
head repository: ardatan/graphql-tools
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @graphql-tools/utils@10.0.12
Choose a head ref

Commits on Nov 23, 2023

  1. Copy the full SHA
    159a178 View commit details
  2. chore(release): update monorepo packages versions (#5716)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    2 people authored and ardatan committed Nov 23, 2023
    Copy the full SHA
    9cb3380 View commit details
  3. Update CHANGELOG.md

    ardatan committed Nov 23, 2023
    Copy the full SHA
    6ac6f73 View commit details

Commits on Nov 24, 2023

  1. chore(deps): update dependency @types/node to v20.9.5 (#5717)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 24, 2023
    Copy the full SHA
    01e8209 View commit details
  2. Copy the full SHA
    efedc59 View commit details
  3. chore(deps): update dependency @types/node to v20.10.0 (#5718)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 24, 2023
    Copy the full SHA
    00ca9d8 View commit details
  4. chore(release): update monorepo packages versions (#5719)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    theguild-bot and github-actions[bot] authored Nov 24, 2023
    Copy the full SHA
    6bae620 View commit details
  5. chore(deps): update dependency svelte2tsx to v0.6.27 (#5720)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 24, 2023
    Copy the full SHA
    b6b240d View commit details

Commits on Nov 25, 2023

  1. chore(deps): update dependency @vue/compiler-sfc to v3.3.9 (#5721)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 25, 2023
    Copy the full SHA
    638267a View commit details

Commits on Nov 27, 2023

  1. chore(deps): update dependency typedoc to v0.25.4 (#5722)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 27, 2023
    Copy the full SHA
    8ca4ec1 View commit details
  2. chore(deps): update dependency esbuild to v0.19.8 (#5723)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 27, 2023
    Copy the full SHA
    6fd5e19 View commit details
  3. Copy the full SHA
    cfbd2e0 View commit details
  4. chore(deps): update typescript-eslint monorepo to v6.13.0 (#5725)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 27, 2023
    Copy the full SHA
    2861f7d View commit details

Commits on Nov 28, 2023

  1. chore(deps): update all non-major dependencies (#5727)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 28, 2023
    Copy the full SHA
    978df32 View commit details
  2. chore(release): update monorepo packages versions (#5726)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    theguild-bot and github-actions[bot] authored Nov 28, 2023
    Copy the full SHA
    ec0206d View commit details
  3. chore(deps): update dependency @changesets/changelog-github to v0.5.0 (

    …#5728)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 28, 2023
    Copy the full SHA
    0209a06 View commit details
  4. chore(deps): update typescript-eslint monorepo to v6.13.1 (#5731)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 28, 2023
    Copy the full SHA
    d529afd View commit details
  5. chore(deps): update dependency @changesets/cli to v2.27.1 (#5729)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 28, 2023
    Copy the full SHA
    c6b44f7 View commit details

Commits on Nov 29, 2023

  1. chore(deps): update dependency @graphql-yoga/plugin-defer-stream to v…

    …3.0.1 (#5733)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 29, 2023
    Copy the full SHA
    53743b4 View commit details
  2. chore(deps): update @theguild/components (#5734)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 29, 2023
    Copy the full SHA
    db66ec8 View commit details
  3. fix(deps): update all non-major dependencies to v7.23.5 (#5736)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 29, 2023
    Copy the full SHA
    c1cd845 View commit details

Commits on Nov 30, 2023

  1. chore(deps): update all non-major dependencies (#5737)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 30, 2023
    Copy the full SHA
    8c12cd9 View commit details
  2. chore(deps): update dependency svelte to v4.2.8 (#5738)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 30, 2023
    Copy the full SHA
    2586f2b View commit details
  3. chore(deps): update all non-major dependencies (#5739)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Nov 30, 2023
    Copy the full SHA
    c30c1c7 View commit details

Commits on Dec 2, 2023

  1. chore(deps): update all non-major dependencies (#5742)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2023
    Copy the full SHA
    91f10fd View commit details
  2. chore(deps): update dependency eslint-config-prettier to v9.1.0 (#5743)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2023
    Copy the full SHA
    419c086 View commit details
  3. chore(deps): update dependency @types/react to v18.2.41 (#5744)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2023
    Copy the full SHA
    fd188e3 View commit details

Commits on Dec 3, 2023

  1. chore(deps): update all non-major dependencies (#5745)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 3, 2023
    Copy the full SHA
    7774226 View commit details

Commits on Dec 4, 2023

  1. chore(deps): update dependency @vue/compiler-sfc to v3.3.10 (#5746)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 4, 2023
    Copy the full SHA
    c46e643 View commit details
  2. chore(deps): update typescript-eslint monorepo to v6.13.2 (#5747)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 4, 2023
    Copy the full SHA
    4e7e6ff View commit details

Commits on Dec 5, 2023

  1. chore(deps): update dependency @types/react to v18.2.42 (#5748)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 5, 2023
    Copy the full SHA
    23398bf View commit details
  2. chore(deps): update dependency prettier-plugin-tailwindcss to v0.5.8 (#…

    …5749)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 5, 2023
    Copy the full SHA
    9d4b90a View commit details

Commits on Dec 6, 2023

  1. chore(deps): update all non-major dependencies (#5750)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 6, 2023
    Copy the full SHA
    b1be57f View commit details
  2. chore(deps): update dependency puppeteer to v21.6.0 (#5751)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 6, 2023
    Copy the full SHA
    d6b1797 View commit details

Commits on Dec 7, 2023

  1. chore(deps): update dependency typescript to v5.3.3 (#5752)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 7, 2023
    Copy the full SHA
    de5fade View commit details
  2. chore(deps): update dependency @types/node to v20.10.4 (#5754)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 7, 2023
    Copy the full SHA
    7a03aba View commit details
  3. fix: remove headers from extensions (#5755)

    * fix: remove headers from extensions
    
    * Call delete only if exists
    
    ---------
    
    Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
    darren-west and ardatan authored Dec 7, 2023
    Copy the full SHA
    b8c7b09 View commit details
  4. Add missing changeset

    ardatan committed Dec 7, 2023
    Copy the full SHA
    a4463d3 View commit details
  5. chore(release): update monorepo packages versions (#5756)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    theguild-bot and github-actions[bot] authored Dec 7, 2023
    Copy the full SHA
    0ab7f73 View commit details

Commits on Dec 8, 2023

  1. chore(deps): update all non-major dependencies (#5759)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 8, 2023
    Copy the full SHA
    17a5c73 View commit details
  2. chore(deps): update dependency ts-node to v10.9.2 (#5760)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 8, 2023
    Copy the full SHA
    cbd4c61 View commit details

Commits on Dec 9, 2023

  1. chore(deps): update dependency @types/react to v18.2.43 (#5761)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 9, 2023
    Copy the full SHA
    77575dd View commit details
  2. fix(deps): update dependency ws to v8.15.0 (#5762)

    * fix(deps): update dependency ws to v8.15.0
    
    * chore(dependencies): updated changesets for modified dependencies
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    renovate[bot] and github-actions[bot] authored Dec 9, 2023
    Copy the full SHA
    701cfd3 View commit details
  3. Use ranged dependencies

    ardatan authored Dec 9, 2023
    Copy the full SHA
    38a92ab View commit details
  4. chore(release): update monorepo packages versions (#5763)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    theguild-bot and github-actions[bot] authored Dec 9, 2023
    Copy the full SHA
    a3259da View commit details

Commits on Dec 10, 2023

  1. chore(deps): update all non-major dependencies (#5764)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 10, 2023
    Copy the full SHA
    95ee22e View commit details
  2. chore(deps): update dependency @urql/core to v4.2.1 (#5765)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 10, 2023
    Copy the full SHA
    472ee22 View commit details

Commits on Dec 11, 2023

  1. chore(deps): update dependency eslint-plugin-n to v16.4.0 (#5766)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 11, 2023
    Copy the full SHA
    462461f View commit details
  2. fix(deps): update all non-major dependencies to v7.23.6 (#5767)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 11, 2023
    Copy the full SHA
    aae0752 View commit details
  3. chore(deps): update typescript-eslint monorepo to v6.14.0 (#5768)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 11, 2023
    Copy the full SHA
    cafc6e7 View commit details
Showing with 2,379 additions and 1,647 deletions.
  1. +8 −0 benchmark/federation/CHANGELOG.md
  2. +4 −4 benchmark/federation/package.json
  3. +19 −19 package.json
  4. +1 −1 packages/executors/apollo-link/package.json
  5. +16 −0 packages/executors/http/CHANGELOG.md
  6. +1 −1 packages/executors/http/package.json
  7. +25 −13 packages/executors/http/src/handleAsyncIterable.ts
  8. +14 −7 packages/executors/http/src/index.ts
  9. +30 −0 packages/executors/http/tests/buildHTTPExecutor.test.ts
  10. +85 −0 packages/executors/http/tests/handleEventStreamResponse.test.ts
  11. +10 −0 packages/executors/legacy-ws/CHANGELOG.md
  12. +3 −3 packages/executors/legacy-ws/package.json
  13. +1 −1 packages/executors/urql-exchange/package.json
  14. +7 −0 packages/federation/CHANGELOG.md
  15. +1 −1 packages/federation/package.json
  16. +19 −12 packages/federation/src/supergraph.ts
  17. +351 −3 packages/federation/test/__snapshots__/supergraphs.test.ts.snap
  18. +16 −0 packages/federation/test/fixtures/supergraphs/c.graphql
  19. +19 −4 packages/federation/test/supergraphs.test.ts
  20. +6 −6 packages/graphql-tag-pluck/package.json
  21. +1 −1 packages/links/package.json
  22. +100 −35 packages/load/CHANGELOG.md
  23. +2 −2 packages/load/package.json
  24. +16 −20 packages/load/src/load-typedefs.ts
  25. +25 −67 packages/load/src/load-typedefs/collect-sources.ts
  26. +5 −13 packages/load/src/load-typedefs/load-file.ts
  27. +14 −34 packages/load/src/load-typedefs/parse.ts
  28. +5 −14 packages/load/src/utils/pointers.ts
  29. +396 −156 packages/loaders/url/CHANGELOG.md
  30. +6 −6 packages/loaders/url/package.json
  31. +67 −23 packages/node-require/CHANGELOG.md
  32. +3 −3 packages/node-require/package.json
  33. +16 −1 packages/utils/CHANGELOG.md
  34. +1 −1 packages/utils/package.json
  35. +15 −0 packages/utils/src/debugTimer.ts
  36. +24 −0 packages/utils/src/descriptionFromObject.ts
  37. +1 −0 packages/utils/src/index.ts
  38. +16 −110 packages/utils/src/print-schema-with-directives.ts
  39. +5 −5 website/package.json
  40. +1,025 −1,081 yarn.lock
8 changes: 8 additions & 0 deletions benchmark/federation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# federation-benchmark

## 0.0.109

### Patch Changes

- Updated dependencies
[[`efedc590`](https://github.com/ardatan/graphql-tools/commit/efedc59018ea1d63f86973d0c6608b3c7ddc2e71)]:
- @graphql-tools/federation@1.1.12

## 0.0.108

### Patch Changes
8 changes: 4 additions & 4 deletions benchmark/federation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "federation-benchmark",
"version": "0.0.108",
"version": "0.0.109",
"private": true,
"scripts": {
"loadtest:federation": "k6 -e ENDPOINT=federation run k6.js",
@@ -9,9 +9,9 @@
"start": "cross-env NODE_ENV=production node index.js"
},
"dependencies": {
"@apollo/gateway": "2.5.7",
"@apollo/subgraph": "2.5.7",
"@graphql-tools/federation": "1.1.11",
"@apollo/gateway": "2.6.2",
"@apollo/subgraph": "2.6.2",
"@graphql-tools/federation": "1.1.12",
"@graphql-tools/stitch": "9.0.3",
"cross-env": "7.0.3",
"express": "4.18.2",
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -43,44 +43,44 @@
"ts:check": "tsc --noEmit"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/preset-env": "7.23.3",
"@babel/preset-env": "7.23.6",
"@babel/preset-typescript": "7.23.3",
"@changesets/changelog-github": "0.4.8",
"@changesets/cli": "2.26.2",
"@theguild/prettier-config": "2.0.2",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.1",
"@theguild/prettier-config": "2.0.3",
"@types/debug": "4.1.12",
"@types/jest": "29.5.10",
"@types/node": "20.9.4",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"@types/jest": "29.5.11",
"@types/node": "20.10.5",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"babel-jest": "29.7.0",
"bob-the-bundler": "7.0.1",
"chalk": "4.1.2",
"concurrently": "8.2.2",
"eslint": "8.54.0",
"eslint-config-prettier": "9.0.0",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.5.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-standard": "5.0.0",
"globby": "11.1.0",
"graphql": "16.8.1",
"graphql-subscriptions": "2.0.0",
"husky": "8.0.3",
"jest": "29.7.0",
"lint-staged": "15.1.0",
"lint-staged": "15.2.0",
"patch-package": "8.0.0",
"prettier": "3.1.0",
"prettier-plugin-tailwindcss": "0.5.7",
"prettier": "3.1.1",
"prettier-plugin-tailwindcss": "0.5.9",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"typedoc": "0.25.3",
"ts-node": "10.9.2",
"typedoc": "0.25.4",
"typedoc-plugin-markdown": "3.16.0",
"typedoc-plugin-rename-defaults": "0.7.0",
"typescript": "5.3.2",
"typescript": "5.3.3",
"weak-napi": "2.0.2"
},
"resolutions": {
2 changes: 1 addition & 1 deletion packages/executors/apollo-link/package.json
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
"tslib": "^2.3.1"
},
"devDependencies": {
"@apollo/client": "3.8.7"
"@apollo/client": "3.8.8"
},
"publishConfig": {
"directory": "dist",
16 changes: 16 additions & 0 deletions packages/executors/http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @graphql-tools/executor-http

## 1.0.5

### Patch Changes

- [`a4463d3`](https://github.com/ardatan/graphql-tools/commit/a4463d3607f33b176828bc48b6895adf3120aeec)
Thanks [@ardatan](https://github.com/ardatan)! - Remove headers from extensions in the GraphQL
request

## 1.0.4

### Patch Changes

- [#5724](https://github.com/ardatan/graphql-tools/pull/5724)
[`cfbd2e07`](https://github.com/ardatan/graphql-tools/commit/cfbd2e07aff0c773a2e2766ea5fd34b628e72f1f)
Thanks [@enisdenjo](https://github.com/enisdenjo)! - Handle chunked and no-space messages in SSE

## 1.0.3

### Patch Changes
2 changes: 1 addition & 1 deletion packages/executors/http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/executor-http",
"version": "1.0.3",
"version": "1.0.5",
"type": "module",
"description": "A set of utils for faster development of GraphQL tools",
"repository": {
38 changes: 25 additions & 13 deletions packages/executors/http/src/handleAsyncIterable.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
/* eslint-disable no-labels */
import { TextDecoder } from '@whatwg-node/fetch';

const DELIM = '\n\n';

export async function* handleAsyncIterable(asyncIterable: AsyncIterable<Uint8Array | string>) {
const textDecoder = new TextDecoder();
let currChunk = '';
outer: for await (const chunk of asyncIterable) {
const chunkStr =
typeof chunk === 'string' ? chunk : textDecoder.decode(chunk, { stream: true });
for (const part of chunkStr.split('\n\n')) {
if (part) {
const eventStr = part.split('event: ')[1];
const dataStr = part.split('data: ')[1];
if (eventStr === 'complete') {
break outer;
}
if (dataStr) {
const data = JSON.parse(dataStr);
yield data.payload || data;
}
currChunk += typeof chunk === 'string' ? chunk : textDecoder.decode(chunk);
for (;;) {
const delimIndex = currChunk.indexOf(DELIM);
if (delimIndex === -1) {
// incomplete message, wait for more chunks
continue outer;
}

const msg = currChunk.slice(0, delimIndex); // whole message
currChunk = currChunk.slice(delimIndex + DELIM.length); // remainder

// data
const dataStr = msg.split('data:')[1]?.trim();
if (dataStr) {
const data = JSON.parse(dataStr);
yield data.payload || data;
}

// event
const event = msg.split('event:')[1]?.trim();
if (event === 'complete') {
break outer;
}
}
}
21 changes: 14 additions & 7 deletions packages/executors/http/src/index.ts
Original file line number Diff line number Diff line change
@@ -126,13 +126,20 @@ export function buildHTTPExecutor(
}

const endpoint = request.extensions?.endpoint || options?.endpoint || '/graphql';
const headers = Object.assign(
{
accept,
},
(typeof options?.headers === 'function' ? options.headers(request) : options?.headers) || {},
request.extensions?.headers || {},
);
const headers = { accept };

if (options?.headers) {
Object.assign(
headers,
typeof options?.headers === 'function' ? options.headers(request) : options?.headers,
);
}

if (request.extensions?.headers) {
const { headers: headersFromExtensions, ...restExtensions } = request.extensions;
Object.assign(headers, headersFromExtensions);
request.extensions = restExtensions;
}

const query = print(request.document);

30 changes: 30 additions & 0 deletions packages/executors/http/tests/buildHTTPExecutor.test.ts
Original file line number Diff line number Diff line change
@@ -114,4 +114,34 @@ describe('buildHTTPExecutor', () => {
});
expect(method).toBe('POST');
});

it('should not encode headers from extensions', async () => {
const executor = buildHTTPExecutor({
useGETForQueries: true,
fetch(url) {
expect(url).not.toMatch(/(Authorization|headers)/i);
return new Response(JSON.stringify({ data: { hello: 'world!' } }), {
headers: { 'Content-Type': 'application/json' },
});
},
});
const result = (await executor({
document: parse(/* GraphQL */ `
query {
hello
}
`),
extensions: {
headers: {
Authorization: 'Token',
},
},
})) as ExecutionResult;

expect(result.data).toMatchInlineSnapshot(`
{
"hello": "world!",
}
`);
});
});
85 changes: 85 additions & 0 deletions packages/executors/http/tests/handleEventStreamResponse.test.ts
Original file line number Diff line number Diff line change
@@ -42,4 +42,89 @@ describe('handleEventStreamResponse', () => {
},
});
});

it('should handle an event without spaces', async () => {
const readableStream = new ReadableStream<Uint8Array>({
start(controller) {
controller.enqueue(encoder.encode('event:complete\n'));
controller.enqueue(encoder.encode('data:{"foo":"bar"}\n'));
controller.enqueue(encoder.encode('\n'));
},
});

const response = new Response(readableStream);
const asyncIterable = handleEventStreamResponse(response);
const iterator = asyncIterable[Symbol.asyncIterator]();

await expect(iterator.next()).resolves.toMatchInlineSnapshot(`
{
"done": false,
"value": {
"foo": "bar",
},
}
`);
});

it('should handle a chunked event with data', async () => {
let currChunk = 0;
const chunks = [
'event: next\n',
'data: { "foo":',
'"bar" }\n\n',
'event: next',
'\ndata: { "foo": "baz" }\n',
'\nevent: next\ndata: { "foo": "',
'bay"',
' }\n',
'\n',
];

const readableStream = new ReadableStream<Uint8Array>({
async pull(controller) {
const chunk = chunks[currChunk++];
if (chunk) {
await new Promise(resolve => setTimeout(resolve, 0)); // stream chunk after one tick
controller.enqueue(encoder.encode(chunk));
} else {
controller.close();
}
},
});

const response = new Response(readableStream);
const asyncIterable = handleEventStreamResponse(response);
const iterator = asyncIterable[Symbol.asyncIterator]();

await expect(iterator.next()).resolves.toMatchInlineSnapshot(`
{
"done": false,
"value": {
"foo": "bar",
},
}
`);
await expect(iterator.next()).resolves.toMatchInlineSnapshot(`
{
"done": false,
"value": {
"foo": "baz",
},
}
`);
await expect(iterator.next()).resolves.toMatchInlineSnapshot(`
{
"done": false,
"value": {
"foo": "bay",
},
}
`);
await expect(iterator.next()).resolves.toMatchInlineSnapshot(`
{
"done": true,
"value": undefined,
}
`);
});
});
10 changes: 10 additions & 0 deletions packages/executors/legacy-ws/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @graphql-tools/executor-legacy-ws

## 1.0.5

### Patch Changes

- [#5762](https://github.com/ardatan/graphql-tools/pull/5762)
[`701cfd3`](https://github.com/ardatan/graphql-tools/commit/701cfd331e60b5d77563be140671d52691aa7348)
Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
- Updated dependency [`ws@8.15.0` ↗︎](https://www.npmjs.com/package/ws/v/8.15.0) (from `8.14.2`,
in `dependencies`)

## 1.0.4

### Patch Changes
6 changes: 3 additions & 3 deletions packages/executors/legacy-ws/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/executor-legacy-ws",
"version": "1.0.4",
"version": "1.0.5",
"type": "module",
"description": "A set of utils for faster development of GraphQL tools",
"repository": {
@@ -53,9 +53,9 @@
"dependencies": {
"@graphql-tools/utils": "^10.0.0",
"@types/ws": "^8.0.0",
"isomorphic-ws": "5.0.0",
"isomorphic-ws": "^5.0.0",
"tslib": "^2.4.0",
"ws": "8.14.2"
"ws": "^8.15.0"
},
"publishConfig": {
"directory": "dist",
2 changes: 1 addition & 1 deletion packages/executors/urql-exchange/package.json
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
"tslib": "^2.4.0"
},
"devDependencies": {
"@urql/core": "4.2.0",
"@urql/core": "4.2.2",
"wonka": "6.3.4"
},
"publishConfig": {
7 changes: 7 additions & 0 deletions packages/federation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @graphql-tools/federation

## 1.1.12

### Patch Changes

- [`efedc590`](https://github.com/ardatan/graphql-tools/commit/efedc59018ea1d63f86973d0c6608b3c7ddc2e71)
Thanks [@ardatan](https://github.com/ardatan)! - Handle unions correctly

## 1.1.11

### Patch Changes
Loading