@apollo/gateway
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -80,3 +80,3 @@ "use strict"; | ||
.join('\n')}`); | ||
let { schema, errors } = federation_1.composeServices(services); | ||
let { schema, errors } = federation_1.composeAndValidate(services); | ||
if (errors && errors.length > 0) { | ||
@@ -83,0 +83,0 @@ throw new apollo_graphql_1.GraphQLSchemaValidationError(errors); |
{ | ||
"name": "@apollo/gateway", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Apollo Gateway", | ||
@@ -19,3 +19,3 @@ "author": "opensource@apollographql.com", | ||
"dependencies": { | ||
"@apollo/federation": "^0.2.0", | ||
"@apollo/federation": "^0.3.0", | ||
"apollo-env": "^0.5.0", | ||
@@ -31,3 +31,3 @@ "apollo-graphql": "^0.3.0", | ||
}, | ||
"gitHead": "1e316c43a41ec90c7499b302e18fadbf9853a217" | ||
"gitHead": "8e3e7256d40768939b1b8353b2c7716f21cf1a5d" | ||
} |
@@ -10,4 +10,4 @@ import gql from 'graphql-tag'; | ||
extend type Furniture @key(fields: "sku") { | ||
sku: String! @external | ||
extend type Furniture implements Product @key(fields: "upc") { | ||
upc: String! @external | ||
inStock: Boolean | ||
@@ -17,3 +17,3 @@ isHeavy: Boolean | ||
extend type Book @key(fields: "isbn") { | ||
extend type Book implements Product @key(fields: "isbn") { | ||
isbn: String! @external | ||
@@ -26,5 +26,5 @@ inStock: Boolean | ||
const inventory = [ | ||
{ sku: 'TABLE1', inStock: true, isHeavy: false }, | ||
{ sku: 'COUCH1', inStock: false, isHeavy: true }, | ||
{ sku: 'CHAIR1', inStock: true, isHeavy: false }, | ||
{ upc: '1', inStock: true, isHeavy: false }, | ||
{ upc: '2', inStock: false, isHeavy: true }, | ||
{ upc: '3', inStock: true, isHeavy: false }, | ||
{ isbn: '0262510871', inStock: true, isCheckedOut: true }, | ||
@@ -37,8 +37,8 @@ { isbn: '0136291554', inStock: false, isCheckedOut: false }, | ||
Furniture: { | ||
__resolveObject(object) { | ||
return inventory.find(product => product.sku === object.sku); | ||
__resolveReference(object) { | ||
return inventory.find(product => product.upc === object.upc); | ||
}, | ||
}, | ||
Book: { | ||
__resolveObject(object) { | ||
__resolveReference(object) { | ||
return inventory.find(product => product.isbn === object.isbn); | ||
@@ -45,0 +45,0 @@ }, |
@@ -23,3 +23,2 @@ import gql from 'graphql-tag'; | ||
upc: String! | ||
sku: String! | ||
name: String | ||
@@ -31,3 +30,2 @@ price: String | ||
upc: String! | ||
sku: String! | ||
name: String | ||
@@ -43,3 +41,2 @@ price: String | ||
upc: String! | ||
sku: String! | ||
name(delimeter: String = " "): String @requires(fields: "title year") | ||
@@ -91,10 +88,8 @@ price: String | ||
Furniture: { | ||
__resolveObject(object) { | ||
return products.find( | ||
product => product.upc === object.upc || product.sku === object.sku, | ||
); | ||
__resolveReference(object) { | ||
return products.find(product => product.upc === object.upc); | ||
}, | ||
}, | ||
Book: { | ||
__resolveObject(object) { | ||
__resolveReference(object) { | ||
if (object.isbn) { | ||
@@ -101,0 +96,0 @@ const fetchedObject = products.find( |
@@ -14,3 +14,2 @@ import gql from 'graphql-tag'; | ||
upc | ||
sku | ||
name | ||
@@ -34,3 +33,2 @@ price | ||
upc, | ||
sku: 'TABLE1', | ||
name: 'Table', | ||
@@ -37,0 +35,0 @@ price: '899', |
@@ -10,3 +10,3 @@ import { | ||
import { GraphQLSchemaValidationError } from 'apollo-graphql'; | ||
import { composeServices, ServiceDefinition } from '@apollo/federation'; | ||
import { composeAndValidate, ServiceDefinition } from '@apollo/federation'; | ||
import loglevel, { Logger } from 'loglevel'; | ||
@@ -109,3 +109,3 @@ import loglevelDebug from 'loglevel-debug'; | ||
let { schema, errors } = composeServices(services); | ||
let { schema, errors } = composeAndValidate(services); | ||
@@ -112,0 +112,0 @@ if (errors && errors.length > 0) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310754
7406
+ Added@apollo/federation@0.3.1(transitive)
- Removed@apollo/federation@0.2.0(transitive)
Updated@apollo/federation@^0.3.0