-
-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get defer/stream from graphql-js (#4796)
* get defer/stream from graphql-js * prettier * use agnostic root type getter * use createGraphQLError * fix issue with v15 and v16 cause of obj vs enum * Fix tests * Remove unused subscribe * Fix TS * Fix ESM * ESM fix * move collect fields to utils * chore(dependencies): updated changesets for modified dependencies * run prettier * make default execute incremental * chore(dependencies): updated changesets for modified dependencies * .. * chore(dependencies): updated changesets for modified dependencies * Sync * Use ValueOrPromise * chore(dependencies): updated changesets for modified dependencies * Fix * chore(dependencies): updated changesets for modified dependencies * Go * Go * stop Co-authored-by: Arda TANRIKULU <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
691966b
commit 80836fa
Showing
52 changed files
with
4,675 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@graphql-tools/executor': patch | ||
--- | ||
dependencies updates: | ||
- Added dependency [`@repeaterjs/[email protected]` ↗︎](https://www.npmjs.com/package/@repeaterjs/repeater/v/3.0.4) (to `dependencies`) | ||
- Added dependency [`[email protected]` ↗︎](https://www.npmjs.com/package/value-or-promise/v/1.0.1) (to `dependencies`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-tools/utils': minor | ||
--- | ||
|
||
add `@defer` directive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-tools/executor': patch | ||
--- | ||
|
||
get defer stream from graphql-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-tools/utils': minor | ||
--- | ||
|
||
export collect field helpers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-tools/utils': minor | ||
--- | ||
|
||
add `@stream` directive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@graphql-tools/utils': major | ||
'@graphql-tools/delegate': patch | ||
'@graphql-tools/stitch': patch | ||
--- | ||
|
||
update `collectFields` to support collecting deffered values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/executor/src/__testUtils__/expectEqualPromisesOrValues.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { isPromise, MaybePromise } from '@graphql-tools/utils'; | ||
import { expectJSON } from './expectJSON.js'; | ||
|
||
export function expectMatchingValues<T>(values: ReadonlyArray<T>): T { | ||
const [firstValue, ...remainingValues] = values; | ||
for (const value of remainingValues) { | ||
expectJSON(value).toDeepEqual(firstValue); | ||
} | ||
return firstValue; | ||
} | ||
|
||
export function expectEqualPromisesOrValues<T>(items: ReadonlyArray<MaybePromise<T>>): MaybePromise<T> { | ||
const [firstItem, ...remainingItems] = items; | ||
if (isPromise(firstItem)) { | ||
if (remainingItems.every(isPromise)) { | ||
return Promise.all(items).then(expectMatchingValues); | ||
} | ||
} else if (remainingItems.every(item => !isPromise(item))) { | ||
return expectMatchingValues(items); | ||
} | ||
throw new Error('Cannot compare promises and values'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { isPromise } from '@graphql-tools/utils'; | ||
|
||
export function expectPromise(maybePromise: unknown) { | ||
expect(isPromise(maybePromise)).toBeTruthy(); | ||
|
||
return { | ||
toResolve() { | ||
return maybePromise; | ||
}, | ||
async toRejectWith(message: string) { | ||
let caughtError: Error | undefined; | ||
try { | ||
await maybePromise; | ||
} catch (error) { | ||
caughtError = error as Error; | ||
} | ||
|
||
expect(caughtError).toBeInstanceOf(Error); | ||
expect(caughtError).toHaveProperty('message', message); | ||
}, | ||
}; | ||
} |
Oops, something went wrong.