Skip to content

Commit

Permalink
Cleanup @graphql-tools/federation (#308)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ardatan and github-actions[bot] authored Dec 10, 2024
1 parent 261d057 commit d747d4c
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 1,245 deletions.
9 changes: 9 additions & 0 deletions .changeset/@graphql-tools_federation-308-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@graphql-tools/federation': patch
---

dependencies updates:

- Added dependency [`@graphql-yoga/typed-event-target@^3.0.0` ↗︎](https://www.npmjs.com/package/@graphql-yoga/typed-event-target/v/3.0.0) (to `dependencies`)
- Added dependency [`@whatwg-node/disposablestack@^0.0.5` ↗︎](https://www.npmjs.com/package/@whatwg-node/disposablestack/v/0.0.5) (to `dependencies`)
- Added dependency [`@whatwg-node/events@^0.1.2` ↗︎](https://www.npmjs.com/package/@whatwg-node/events/v/0.1.2) (to `dependencies`)
28 changes: 28 additions & 0 deletions .changeset/fair-glasses-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'@graphql-tools/federation': major
---

BREAKING CHANGES;

- Removed `buildSubgraphSchema`, use `@apollo/subgraph` instead.
- Removed the following gateway related functions, and prefer using Supergraph approach instead
- `getSubschemaForFederationWithURL`
- `getSubschemaForFederationWithTypeDefs`
- `getSubschemaForFederationWithExecutor`
- `getSubschemaForFederationWithSchema`
- `federationSubschemaTransformer`
- `SupergraphSchemaManager` is no longer an `EventEmitter` but `EventTarget` instead, and it emits a real `Event` object.
- `SupergraphSchemaManager` is now `Disposable` and it no longer stops based on Nodejs terminate events, so you should use `using` syntax.

```ts
using manager = new SupergraphSchemaManager({ ... });

manager.addEventListener('error', (event: SupergraphSchemaManagerErrorEvent) => {
console.error(event.detail.error);
});

let schema: GraphQLSchema | null = null;
manager.addEventListener('schema', (event: SupergraphSchemaManagerSchemaEvent) => {
schema = event.detail.schema;
});
```
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ jobs:
name: Package binary
run: yarn workspace @graphql-hive/gateway tsx scripts/package-binary
- name: Test
uses: nick-fields/retry@v3
env:
E2E_GATEWAY_RUNNER: ${{matrix.setup.gateway-runner}}
run: yarn test:e2e
with:
timeout_minutes: 10
max_attempts: 2
command: yarn test:e2e
3 changes: 3 additions & 0 deletions packages/federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
"@graphql-tools/stitch": "workspace:^",
"@graphql-tools/utils": "^10.6.2",
"@graphql-tools/wrap": "workspace:^",
"@graphql-yoga/typed-event-target": "^3.0.0",
"@whatwg-node/disposablestack": "^0.0.5",
"@whatwg-node/events": "^0.1.2",
"@whatwg-node/fetch": "^0.10.1",
"tslib": "^2.8.1"
},
Expand Down
260 changes: 0 additions & 260 deletions packages/federation/src/gateway.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/federation/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export * from './gateway.js';
export * from './managed-federation.js';
export * from './subgraph.js';
export * from './supergraph.js';
export * from './utils.js';
Loading

0 comments on commit d747d4c

Please sign in to comment.