Skip to content

Commit

Permalink
expose the loaded supergraph sdl in the schema event (#6368)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmrysMyrddin committed Jul 23, 2024
1 parent ad8d4f4 commit 334d301
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-boats-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-tools/federation': minor
---

Expose the loaded supergrapth SDL in the `schema` event
4 changes: 2 additions & 2 deletions packages/federation/src/managed-federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export type SupergraphSchemaManagerOptions = Omit<
};

export class SupergraphSchemaManager extends EventEmitter<{
schema: [GraphQLSchema];
schema: [GraphQLSchema, string];
error: [FetchError | unknown];
failure: [FetchError | unknown, number];
log: [{ source: 'uplink' | 'manager'; message: string; level: 'error' | 'warn' | 'info' }];
Expand Down Expand Up @@ -376,7 +376,7 @@ export class SupergraphSchemaManager extends EventEmitter<{
if ('schema' in result) {
this.#lastSeenId = result.id;
this.schema = result.schema;
this.emit('schema', result.schema);
this.emit('schema', result.schema, result.supergraphSdl);
this.#log('info', 'Supergraph successfully updated');
} else {
this.#log('info', 'Supergraph is up to date');
Expand Down

0 comments on commit 334d301

Please sign in to comment.