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/merge@6.2.9
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/merge@6.2.10
Choose a head ref

Commits on Feb 18, 2021

  1. fix(deps): update babel monorepo to v7.12.17 (#2613)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 18, 2021
    Copy the full SHA
    2d5610f View commit details
  2. chore(deps): update dependency @types/node to v14.14.29 (#2619)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 18, 2021
    Copy the full SHA
    54767e9 View commit details

Commits on Feb 19, 2021

  1. chore(deps): update dependency @types/node to v14.14.30 (#2620)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 19, 2021
    Copy the full SHA
    53e4637 View commit details
  2. chore(deps): update dependency @types/node to v14.14.31 (#2621)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 19, 2021
    Copy the full SHA
    c832323 View commit details

Commits on Feb 20, 2021

  1. chore(deps): update dependency typedoc to v0.20.26 (#2622)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 20, 2021
    Copy the full SHA
    01b728a View commit details
  2. fix(deps): update dependency lodash to v4.17.21 (#2623)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 20, 2021
    Copy the full SHA
    647c046 View commit details

Commits on Feb 21, 2021

  1. chore(deps): update dependency typedoc to v0.20.27 (#2624)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 21, 2021
    Copy the full SHA
    554d57c View commit details

Commits on Feb 22, 2021

  1. chore(deps): update typescript-eslint monorepo to v4.15.2 (#2631)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 22, 2021
    Copy the full SHA
    348fa70 View commit details
  2. chore(deps): pin dependency @graphql-tools/schema to 7.1.3 (#2633)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 22, 2021
    Copy the full SHA
    b736871 View commit details

Commits on Feb 23, 2021

  1. fix(deps): update babel monorepo to v7.13.0 (#2634)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 23, 2021
    Copy the full SHA
    3bbfa78 View commit details
  2. chore(deps): update dependency typedoc to v0.20.28 (#2636)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 23, 2021
    Copy the full SHA
    e3905fe View commit details
  3. fix(deps): update dependency @babel/parser to v7.13.4 (#2637)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 23, 2021
    Copy the full SHA
    5c8b61a View commit details
  4. chore(deps): update dependency typescript to v4.2.2 (#2640)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 23, 2021
    Copy the full SHA
    56fa5c7 View commit details
  5. chore(deps): update dependency ts-jest to v26.5.2 (#2639)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Feb 23, 2021
    Copy the full SHA
    2870c5e View commit details

Commits on Feb 24, 2021

  1. Copy the full SHA
    1516c89 View commit details
  2. chore(release): update monorepo packages versions (#2641)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Feb 24, 2021
    Copy the full SHA
    46be726 View commit details
  3. chore(deps): update dependency eslint-config-prettier to v8 (#2625)

    * chore(deps): update dependency eslint-config-prettier to v8
    
    * Update .eslintrc.json
    
    * fix lint
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
    3 people authored Feb 24, 2021
    Copy the full SHA
    b543b24 View commit details
  4. Copy the full SHA
    9d112ab View commit details
  5. [deploy_website] enhance(stitch) schema merger validations (#2486)

    * squash
    
    * cleanup warnings in tests.
    
    * more updates + docs.
    
    * shrink diff.
    
    * Create modern-melons-clean.md
    
    * cleanup warnings.
    
    * fix failing test.
    
    * flexible scoping.
    
    * simplify! simplify!
    
    * bang it into shape.
    
    * Update modern-melons-clean.md
    
    * use getNullableType
    
    * call them proxiable.
    
    * update notes.
    
    * add validationLevel indicator.
    gmac authored Feb 24, 2021
    Copy the full SHA
    f962d51 View commit details
  6. Copy the full SHA
    58d4667 View commit details
  7. Fix changeset

    ardatan committed Feb 24, 2021
    Copy the full SHA
    5104135 View commit details
  8. Copy the full SHA
    0194118 View commit details
  9. chore(release): update monorepo packages versions (#2644)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Feb 24, 2021
    Copy the full SHA
    8d9e0a6 View commit details
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -7,8 +7,7 @@
"eslint:recommended",
"standard",
"prettier",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint"],
"rules": {
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -7,14 +7,13 @@
"postinstall": "patch-package",
"predeploy:website": "yarn build:api-docs",
"deploy:website": "cd website && yarn deploy",
"ts:transpile": "tsc --project tsconfig.build.json && tsc --project tsconfig.build.es5.json",
"ts:transpile": "concurrently \"tsc --project tsconfig.build.json\" \"tsc --project tsconfig.build.es5.json\"",
"build": "yarn ts:transpile && bob build",
"build:api-docs": "node scripts/build-api-docs.js",
"lint": "eslint --ext .ts .",
"prettier": "prettier --ignore-path .gitignore --write --list-different \"**/*.{ts,tsx,graphql,yml}\"",
"prettier:check": "prettier --ignore-path .gitignore --check \"**/*.{ts,tsx,graphql,yml}\"",
"test": "jest --no-watchman --forceExit",
"test-and-build": "yarn build && yarn test",
"prerelease": "yarn build",
"prerelease-canary": "yarn build",
"release": "changeset publish",
@@ -45,12 +44,13 @@
"patch-package": "6.2.2",
"@changesets/cli": "2.14.0",
"@types/jest": "26.0.20",
"@types/node": "14.14.28",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
"@types/node": "14.14.31",
"@typescript-eslint/eslint-plugin": "4.15.2",
"@typescript-eslint/parser": "4.15.2",
"@ardatan/bob-the-bundler": "1.2.2",
"concurrently": "6.0.0",
"eslint": "7.20.0",
"eslint-config-prettier": "7.2.0",
"eslint-config-prettier": "8.0.0",
"eslint-config-standard": "16.0.2",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-node": "11.1.0",
@@ -64,10 +64,10 @@
"lint-staged": "10.5.4",
"nock": "13.0.7",
"prettier": "2.2.1",
"ts-jest": "26.5.1",
"typedoc": "0.20.25",
"ts-jest": "26.5.2",
"typedoc": "0.20.28",
"typedoc-plugin-markdown": "3.5.0",
"typescript": "4.1.5"
"typescript": "4.2.2"
},
"husky": {
"hooks": {
2 changes: 1 addition & 1 deletion packages/batch-delegate/package.json
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
},
"devDependencies": {
"@graphql-tools/schema": "7.1.3",
"@graphql-tools/stitch": "7.3.0",
"@graphql-tools/stitch": "7.4.0",
"@graphql-tools/utils": "7.5.0"
},
"publishConfig": {
6 changes: 3 additions & 3 deletions packages/graphql-tag-pluck/package.json
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@
"graphql": "^14.0.0 || ^15.0.0"
},
"dependencies": {
"@babel/parser": "7.12.16",
"@babel/traverse": "7.12.13",
"@babel/types": "7.12.13",
"@babel/parser": "7.13.4",
"@babel/traverse": "7.13.0",
"@babel/types": "7.13.0",
"@graphql-tools/utils": "^7.0.0",
"tslib": "~2.1.0"
},
6 changes: 6 additions & 0 deletions packages/links/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphql-tools/links

## 7.0.6

### Patch Changes

- 1516c89a: fix(links): fix typing issues with linkToExecutor and AsyncExecutor

## 7.0.5

### Patch Changes
2 changes: 1 addition & 1 deletion packages/links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/links",
"version": "7.0.5",
"version": "7.0.6",
"description": "A set of utils for faster development of GraphQL tools",
"repository": {
"type": "git",
6 changes: 3 additions & 3 deletions packages/links/src/linkToExecutor.ts
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@ import { ApolloLink, execute } from '@apollo/client/link/core';
import { Observable } from '@apollo/client/utilities';
import { toPromise } from '@apollo/client/link/utils';

import { Executor, ExecutionParams } from '@graphql-tools/delegate';
import { AsyncExecutor, ExecutionParams } from '@graphql-tools/delegate';
import { ExecutionResult } from '@graphql-tools/utils';

export const linkToExecutor = (link: ApolloLink): Executor => <TReturn, TArgs, TContext>(
export const linkToExecutor = (link: ApolloLink): AsyncExecutor => <TReturn, TArgs, TContext>(
params: ExecutionParams<TArgs, TContext>
): ExecutionResult<TReturn> | Promise<ExecutionResult<TReturn>> => {
): Promise<ExecutionResult<TReturn>> => {
const { document, variables, extensions, context, info } = params;
return toPromise(
execute(link, {
35 changes: 35 additions & 0 deletions packages/merge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# @graphql-tools/merge

## 6.2.10

### Patch Changes

- 0194118f: Introduces a suite of stitched schema validations that enforce the integrity of merged schemas. This includes validations for:

- Strict and safe null consistency (the later of which allows safe transitions in nullability).
- Named type consistency with the option to whitelist proxiable scalar mappings.
- Argument and input field name consistency.
- Enum value consistency when used as an input value.

Validations may be adjusted by setting `validationLevel` to `off|warn|error` globally or scoped for specific types and fields. In this initial v7 release, all validations are introduced at the `warn` threshold for backwards compatibility. Most of these validations will become automatic errors in v8. To enable validation errors now, set `validationLevel: 'error'`. Full configuration options look like this:

```js
const gatewaySchema = stitchSchemas({
subschemas: [...],
typeMergingOptions: {
validationSettings: {
validationLevel: 'error',
strictNullComparison: false, // << gateway "String" may proxy subschema "String!"
proxiableScalars: {
ID: ['String'], // << gateway "ID" may proxy subschema "String"
}
},
validationScopes: {
// scope to specific element paths
'User.id': {
validationLevel: 'warn',
strictNullComparison: true,
},
}
},
});
```

## 6.2.9

### Patch Changes
2 changes: 1 addition & 1 deletion packages/merge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/merge",
"version": "6.2.9",
"version": "6.2.10",
"description": "A set of utils for faster development of GraphQL tools",
"repository": {
"type": "git",
24 changes: 13 additions & 11 deletions packages/merge/src/typedefs-mergers/fields.ts
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ import { mergeDirectives } from './directives';
import { isNotEqual, compareNodes } from '@graphql-tools/utils';
import { mergeArguments } from './arguments';

function fieldAlreadyExists(fieldsArr: ReadonlyArray<any>, otherField: any): boolean {
function fieldAlreadyExists(fieldsArr: ReadonlyArray<any>, otherField: any, config?: Config): boolean {
const result: FieldDefinitionNode | null = fieldsArr.find(field => field.name.value === otherField.name.value);

if (result) {
if (result && !config?.ignoreFieldConflicts) {
const t1 = extractType(result.type);
const t2 = extractType(otherField.type);

@@ -26,22 +26,24 @@ export function mergeFields<T extends FieldDefinitionNode | InputValueDefinition
type: { name: NameNode },
f1: ReadonlyArray<T>,
f2: ReadonlyArray<T>,
config: Config
config?: Config
): T[] {
const result: T[] = [...f2];

for (const field of f1) {
if (fieldAlreadyExists(result, field)) {
if (fieldAlreadyExists(result, field, config)) {
const existing: any = result.find((f: any) => f.name.value === (field as any).name.value);

if (config && config.throwOnConflict) {
preventConflicts(type, existing, field, false);
} else {
preventConflicts(type, existing, field, true);
}
if (!config?.ignoreFieldConflicts) {
if (config?.throwOnConflict) {
preventConflicts(type, existing, field, false);
} else {
preventConflicts(type, existing, field, true);
}

if (isNonNullTypeNode(field.type) && !isNonNullTypeNode(existing.type)) {
existing.type = field.type;
if (isNonNullTypeNode(field.type) && !isNonNullTypeNode(existing.type)) {
existing.type = field.type;
}
}

existing.arguments = mergeArguments(field['arguments'] || [], existing.arguments || [], config);
1 change: 1 addition & 0 deletions packages/merge/src/typedefs-mergers/merge-typedefs.ts
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@ export interface Config {
sort?: boolean | CompareFn<string>;
convertExtensions?: boolean;
consistentEnumMerge?: boolean;
ignoreFieldConflicts?: boolean;
}

/**
34 changes: 34 additions & 0 deletions packages/mock/tests/addMocksToSchema.spec.ts
Original file line number Diff line number Diff line change
@@ -20,20 +20,25 @@ type UserImageURL {
url: String!
}
scalar Date
interface Book {
id: ID!
title: String
publishedAt: Date
}
type TextBook implements Book {
id: ID!
title: String
publishedAt: Date
text: String
}
type ColoringBook implements Book {
id: ID!
title: String
publishedAt: Date
colors: [String]
}
@@ -201,4 +206,33 @@ describe('addMocksToSchema', () => {
expect(data).toBeDefined();
expect(data!['viewer']['book']['__typename']).toBeDefined();
});
it('should handle custom scalars', async () => {

const mockDate = new Date().toJSON().split('T')[0];

const query = `
query {
viewer {
book {
title
publishedAt
}
}
}
`;

const mockedSchema = addMocksToSchema({ schema, mocks: {
Date: () => mockDate
}});
const { data, errors } = await graphql({
schema: mockedSchema,
source: query,
});


expect(errors).not.toBeDefined();
expect(data).toBeDefined();
expect(data!['viewer']['book']['publishedAt']).toBe(mockDate);

})
});
6 changes: 6 additions & 0 deletions packages/resolvers-composition/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphql-tools/resolvers-composition

## 6.2.6

### Patch Changes

- 0194118f: chore(resolvers-composition): bump lodash version

## 6.2.5

### Patch Changes
4 changes: 2 additions & 2 deletions packages/resolvers-composition/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/resolvers-composition",
"version": "6.2.5",
"version": "6.2.6",
"description": "Common package containing utils and types for GraphQL tools",
"repository": {
"type": "git",
@@ -24,7 +24,7 @@
},
"dependencies": {
"@graphql-tools/utils": "^7.0.0",
"lodash": "4.17.20",
"lodash": "4.17.21",
"tslib": "~2.1.0"
},
"publishConfig": {
40 changes: 40 additions & 0 deletions packages/stitch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# @graphql-tools/stitch

## 7.4.0

### Minor Changes

- 0194118f: Introduces a suite of stitched schema validations that enforce the integrity of merged schemas. This includes validations for:

- Strict and safe null consistency (the later of which allows safe transitions in nullability).
- Named type consistency with the option to whitelist proxiable scalar mappings.
- Argument and input field name consistency.
- Enum value consistency when used as an input value.

Validations may be adjusted by setting `validationLevel` to `off|warn|error` globally or scoped for specific types and fields. In this initial v7 release, all validations are introduced at the `warn` threshold for backwards compatibility. Most of these validations will become automatic errors in v8. To enable validation errors now, set `validationLevel: 'error'`. Full configuration options look like this:

```js
const gatewaySchema = stitchSchemas({
subschemas: [...],
typeMergingOptions: {
validationSettings: {
validationLevel: 'error',
strictNullComparison: false, // << gateway "String" may proxy subschema "String!"
proxiableScalars: {
ID: ['String'], // << gateway "ID" may proxy subschema "String"
}
},
validationScopes: {
// scope to specific element paths
'User.id': {
validationLevel: 'warn',
strictNullComparison: true,
},
}
},
});
```

### Patch Changes

- Updated dependencies [0194118f]
- @graphql-tools/merge@6.2.10

## 7.3.0

### Minor Changes
4 changes: 2 additions & 2 deletions packages/stitch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphql-tools/stitch",
"version": "7.3.0",
"version": "7.4.0",
"description": "A set of utils for faster development of GraphQL tools",
"repository": {
"type": "git",
@@ -27,7 +27,7 @@
"dependencies": {
"@graphql-tools/batch-delegate": "^7.0.0",
"@graphql-tools/delegate": "^7.0.10",
"@graphql-tools/merge": "^6.2.7",
"@graphql-tools/merge": "^6.2.10",
"@graphql-tools/schema": "^7.1.2",
"@graphql-tools/utils": "^7.2.4",
"@graphql-tools/wrap": "^7.0.3",
Loading