Skip to content

Commit

Permalink
Bump node-fetch from 2.7.0 to 3.3.2 in /_examples/federation (#2916)
Browse files Browse the repository at this point in the history
* Bump node-fetch from 2.7.0 to 3.3.2 in /_examples/federation

Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.7.0 to 3.3.2.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](node-fetch/node-fetch@v2.7.0...v3.3.2)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Try updating require to import

Signed-off-by: Steve Coffman <[email protected]>

* Try updating Apollo server and gateway

Signed-off-by: Steve Coffman <[email protected]>

* Change import to @apollo/server

Signed-off-by: Steve Coffman <[email protected]>

* Change versions of everything in npm

Signed-off-by: Steve Coffman <[email protected]>

* Rever to node 16

Signed-off-by: Steve Coffman <[email protected]>

* Switch to apollo Link

Signed-off-by: Steve Coffman <[email protected]>

* Use more better newer thingy

Signed-off-by: Steve Coffman <[email protected]>

* Change federation node version back to 16

Signed-off-by: Steve Coffman <[email protected]>

* Apollo Link uses uri now instead of link

Signed-off-by: Steve Coffman <[email protected]>

* Change inmemory cache import

Signed-off-by: Steve Coffman <[email protected]>

* Remove node fetch from integration test

Signed-off-by: Steve Coffman <[email protected]>

* Add cross fetch

Signed-off-by: Steve Coffman <[email protected]>

* Adjust cross fetch to dev dependency

Signed-off-by: Steve Coffman <[email protected]>

* Fixup package-lock

Signed-off-by: Steve Coffman <[email protected]>

* Try again

Signed-off-by: Steve Coffman <[email protected]>

* Switch to node 18 to get fetch

Signed-off-by: Steve Coffman <[email protected]>

* Add type module to package.json

Signed-off-by: Steve Coffman <[email protected]>

* export default

Signed-off-by: Steve Coffman <[email protected]>

* Re-order?

Signed-off-by: Steve Coffman <[email protected]>

* Add external

Signed-off-by: Steve Coffman <[email protected]>

* add experimental vm modules to jest

Signed-off-by: Steve Coffman <[email protected]>

* Update git ignore for node_modules

Signed-off-by: Steve Coffman <[email protected]>

* Add some more jest stuff

Signed-off-by: Steve Coffman <[email protected]>

* refmt and regenerate

Signed-off-by: Steve Coffman <[email protected]>

* Add rehackt to dev dependencies

Signed-off-by: Steve Coffman <[email protected]>

* Change to core import

Signed-off-by: Steve Coffman <[email protected]>

* Aaaand do it over here too

Signed-off-by: Steve Coffman <[email protected]>

* Some of each

Signed-off-by: Steve Coffman <[email protected]>

* Move to different HTTP Link

Signed-off-by: Steve Coffman <[email protected]>

* Try again

Signed-off-by: Steve Coffman <[email protected]>

* add gql from apollo core

Signed-off-by: Steve Coffman <[email protected]>

* Change link to uri

Signed-off-by: Steve Coffman <[email protected]>

* Try just passing a string

Signed-off-by: Steve Coffman <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Steve Coffman <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Steve Coffman <[email protected]>
Co-authored-by: Steve Coffman <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2024
1 parent 9a3694e commit e223f1d
Show file tree
Hide file tree
Showing 15 changed files with 7,560 additions and 781 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check-federation
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ curl -s --connect-timeout 5 \
sleep 1

echo "### running jest integration spec"
./node_modules/.bin/jest --color
export NODE_OPTIONS="--experimental-vm-modules"
npx jest --color

2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
coverage:
strategy:
matrix:
go: ["1.21", "1.22"]
go: ["1.22"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
go: ["1.21", "1.22"]
node: [20]
node: [18]
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
Expand All @@ -34,7 +34,7 @@ jobs:
strategy:
matrix:
go: ["1.21", "1.22"]
node: [20]
node: [18]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
*.out
gqlgen
*.exe

node_modules
2 changes: 1 addition & 1 deletion _examples/chat/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const apolloClient = new ApolloClient({

if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('./App').default;
const NextApp = import('./App').default;
render(<NextApp/>);
})
}
Expand Down
24 changes: 13 additions & 11 deletions _examples/federation/gateway/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
const { ApolloServer } = require('apollo-server');
const { ApolloGateway } = require("@apollo/gateway");
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
import { ApolloGateway,IntrospectAndCompose } from '@apollo/gateway';

const gateway = new ApolloGateway({
serviceList: [
{ name: 'accounts', url: 'http://localhost:4001/query' },
{ name: 'products', url: 'http://localhost:4002/query' },
{ name: 'reviews', url: 'http://localhost:4003/query' }
],
supergraphSdl: new IntrospectAndCompose({
subgraphs: [
{ name: 'accounts', url: 'http://localhost:4001/query' },
{ name: 'products', url: 'http://localhost:4002/query' },
{ name: 'reviews', url: 'http://localhost:4003/query' }
],
}),
});

const server = new ApolloServer({
gateway,

subscriptions: false,
});

server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
// Note the top-level `await`!
const { url } = await startStandaloneServer(server);
console.log(`🚀 Server ready at ${url}`);
15 changes: 7 additions & 8 deletions _examples/federation/integration-test.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
const {InMemoryCache} = require("apollo-cache-inmemory");
const {HttpLink} = require("apollo-link-http");
const {ApolloClient} = require("apollo-client");
const fetch = require("node-fetch");
const gql = require('graphql-tag');
import {jest} from '@jest/globals';
import { InMemoryCache, ApolloClient} from '@apollo/client/core';
import { gql } from '@apollo/client/core';

var uri = process.env.SERVER_URL || 'http://localhost:4000/';

const client = new ApolloClient({
link: new HttpLink({uri, fetch}),
uri: uri,
cache: new InMemoryCache(),
});

describe('Json', () => {
it('can join across services', async () => {
console.log(uri)
let res = await client.query({
query: gql`query {
query: gql(`query {
me {
username
reviews {
Expand All @@ -25,7 +24,7 @@ describe('Json', () => {
}
}
}
}`,
}`),
});

expect(res.data).toEqual({
Expand Down
3 changes: 2 additions & 1 deletion _examples/federation/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
export default {
transform: {},
testEnvironment: "node",
testMatch: ["<rootDir>/**/*-test.js"],
testPathIgnorePatterns: ["<rootDir>/node_modules/"],
Expand Down
14 changes: 7 additions & 7 deletions _examples/federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"version": "1.0.0",
"description": "",
"main": "gateway/index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@apollo/gateway": "^0.42.0",
"apollo-server": "^3.3.0",
"graphql": "^15.6.1"
"@apollo/gateway": "^2.7.1",
"@apollo/server": "^4.10.0",
"graphql": "^16.8.1"
},
"devDependencies": {
"apollo-cache-inmemory": "^1.6.5",
"apollo-client": "^2.6.8",
"apollo-link-http": "^1.5.16",
"@apollo/client": "^3.9.4",
"cross-fetch": "^4.0.0",
"jest": "^29.7.0",
"node-fetch": "^2.6.0"
"node-fetch": "^3.3.2"
}
}
101 changes: 97 additions & 4 deletions _examples/federation/reviews/graph/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions _examples/federation/reviews/graph/schema.graphqls
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
type Review {
body: String!
author: User! @provides(fields: "username")
product: Product!
extend type EmailHost @key(fields: "id") {
id: String! @external
}

extend type EmailHost @key(fields: "id") {
extend type Manufacturer @key(fields: "id") {
id: String! @external
}

extend type Product @key(fields: " manufacturer{ id} id") {
id: String! @external
manufacturer: Manufacturer! @external
reviews: [Review]
}

extend type User @key(fields: "id") {
id: ID! @external
host: EmailHost! @external
email: String! @external
username: String! @external
reviews: [Review] @requires(fields: "host {id} email")
}

extend type Manufacturer @key(fields: "id") {
id: String! @external
type Review {
body: String!
author: User! @provides(fields: "username")
product: Product!
}

extend type Product @key(fields: " manufacturer{ id} id") {
id: String! @external
manufacturer: Manufacturer! @external
reviews: [Review]
}

6 changes: 6 additions & 0 deletions _examples/federation/reviews/graph/schema.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e223f1d

Please sign in to comment.