-
-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: executor from graphql-js (#4778)
* feat: executor from graphql-js * Some cleanup * Make it even more agnostic * Do not fail fast * Go * No more jsutils * Go * More * Revert "Go" This reverts commit c6a6204. * make it use tools more * fix build * remove fn in fork * changeset * bad rebase * Drop v15 * Drop v14 * Use more from executor * chore(dependencies): updated changesets for modified dependencies * Go * Yes * chore(dependencies): updated changesets for modified dependencies * Go * Relax * Go * chore(dependencies): updated changesets for modified dependencies 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
e60266b
commit df5848b
Showing
85 changed files
with
8,602 additions
and
251 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,5 @@ | ||
--- | ||
'@graphql-tools/delegate': patch | ||
--- | ||
dependencies updates: | ||
- Added dependency [`@graphql-tools/[email protected]` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor/v/0.0.0) (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 isIterableObject, isObjectLike, isPromise, promiseReduce, hasOwnProperty |
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 `Path` util from `graphql/jsutils` |
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 | ||
--- | ||
|
||
initial release |
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': patch | ||
--- | ||
|
||
improve inpsect util |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## `@graphql-tools/executor` | ||
|
||
Fork of GraphQL.js' execute function |
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,73 @@ | ||
{ | ||
"name": "@graphql-tools/executor", | ||
"version": "0.0.0", | ||
"author": "Saihajpreet Singh <[email protected]>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ardatan/graphql-tools.git", | ||
"directory": "packages/executor" | ||
}, | ||
"keywords": [ | ||
"gql", | ||
"graphql", | ||
"typescript" | ||
], | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"exports": { | ||
".": { | ||
"require": { | ||
"types": "./dist/typings/index.d.cts", | ||
"default": "./dist/cjs/index.js" | ||
}, | ||
"import": { | ||
"types": "./dist/typings/index.d.ts", | ||
"default": "./dist/esm/index.js" | ||
}, | ||
"default": { | ||
"types": "./dist/typings/index.d.ts", | ||
"default": "./dist/esm/index.js" | ||
} | ||
}, | ||
"./*": { | ||
"require": { | ||
"types": "./dist/typings/*.d.cts", | ||
"default": "./dist/cjs/*.js" | ||
}, | ||
"import": { | ||
"types": "./dist/typings/*.d.ts", | ||
"default": "./dist/esm/*.js" | ||
}, | ||
"default": { | ||
"types": "./dist/typings/*.d.ts", | ||
"default": "./dist/esm/*.js" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"typings": "dist/typings/index.d.ts", | ||
"typescript": { | ||
"definition": "dist/typings/index.d.ts" | ||
}, | ||
"dependencies": { | ||
"@graphql-tools/utils": "8.12.0", | ||
"@graphql-typed-document-node/core": "3.1.1" | ||
}, | ||
"devDependencies": { | ||
"graphql": "^16.6.0", | ||
"typescript": "4.8.4" | ||
}, | ||
"peerDependencies": { | ||
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" | ||
}, | ||
"buildOptions": { | ||
"input": "./src/index.ts" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist", | ||
"access": "public" | ||
}, | ||
"type": "module" | ||
} |
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,63 @@ | ||
import { isObjectLike } from '@graphql-tools/utils'; | ||
|
||
/** | ||
* Creates an object map with the same keys as `map` and values generated by | ||
* running each value of `map` thru `fn`. | ||
*/ | ||
function mapValue<T, V>(map: Record<string, T>, fn: (value: T, key: string) => V): Record<string, V> { | ||
const result = Object.create(null); | ||
|
||
for (const key of Object.keys(map)) { | ||
result[key] = fn(map[key], key); | ||
} | ||
return result; | ||
} | ||
|
||
/** | ||
* Deeply transforms an arbitrary value to a JSON-safe value by calling toJSON | ||
* on any nested value which defines it. | ||
*/ | ||
function toJSONDeep(value: unknown): unknown { | ||
if (!isObjectLike(value)) { | ||
return value; | ||
} | ||
|
||
// @ts-expect-error: toJSON is not defined on all objects | ||
if (typeof value.toJSON === 'function') { | ||
// @ts-expect-error: toJSON is not defined on all objects | ||
return value.toJSON(); | ||
} | ||
|
||
if (Array.isArray(value)) { | ||
return value.map(toJSONDeep); | ||
} | ||
|
||
return mapValue(value, toJSONDeep); | ||
} | ||
|
||
export function expectJSON(actual: unknown) { | ||
const actualJSON = toJSONDeep(actual); | ||
|
||
return { | ||
toDeepEqual(expected: unknown) { | ||
const expectedJSON = toJSONDeep(expected); | ||
expect(actualJSON).toMatchObject(expectedJSON as any); | ||
}, | ||
toDeepNestedProperty(path: string, expected: unknown) { | ||
const expectedJSON = toJSONDeep(expected); | ||
expect(actualJSON).toHaveProperty(path, expectedJSON); | ||
}, | ||
}; | ||
} | ||
|
||
export function expectToThrowJSON(fn: () => unknown) { | ||
function mapException(): unknown { | ||
try { | ||
return fn(); | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
|
||
return expect(mapException()); | ||
} |
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,3 @@ | ||
export function resolveOnNextTick(): Promise<void> { | ||
return Promise.resolve(undefined); | ||
} |
Oops, something went wrong.