Skip to content

Commit

Permalink
feat(apollo client): migrate to Apollo Client v3
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Changes the dependency on Apollo Client from v2 to v3

fix #34
  • Loading branch information
eturino committed Aug 19, 2020
1 parent f27103f commit 66c74c7
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 1,613 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can build the link by calling the `withScalars()` function, passing to it th

```typescript
import { withScalars } from "apollo-link-scalars";
import { ApolloLink, HttpLink } from "@apollo/client";
import { ApolloLink, HttpLink } from "@apollo/client/core";
import { schema } from "./my-schema";

const link = ApolloLink.from([
Expand Down Expand Up @@ -79,7 +79,7 @@ withScalars({
### Example of loading a schema

```typescript
import { gql } from "@apollo/client";
import { gql } from "@apollo/client/core";
import { GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "apollo-link-scalars";

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
},
"dependencies": {
"@apollo/client": "^3.0.2",
"@graphql-tools/schema": "^6.0.18",
"lodash.clonedeep": "^4.5.0",
"lodash.every": "^4.6.0",
"lodash.flatmap": "^4.5.0",
Expand Down Expand Up @@ -91,11 +92,9 @@
"@types/lodash.reduce": "^4.6.6",
"@types/lodash.uniqby": "^4.7.6",
"@types/react": "^16.9.43",
"apollo-server-testing": "^2.12.0",
"cz-conventional-changelog": "^3.1.0",
"gh-pages": "^3.1.0",
"github-release-from-changelog": "^2.1.1",
"graphql-tools": "^6.0.10",
"husky": "^4.2.5",
"inquirer": "^7.3.3",
"install-peers-cli": "^2.2.0",
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/builtin-scalars.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/ignore-non-nullability.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/interfaces.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/scalar-array-from-query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/scalar-from-object.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/scalar-from-query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/serialize-from-nested.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import cloneDeep from "lodash.clonedeep";
import isNumber from "lodash.isnumber";
import isString from "lodash.isstring";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/serialize-from-query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import cloneDeep from "lodash.clonedeep";
import isNumber from "lodash.isnumber";
import isString from "lodash.isstring";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/unions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql, GraphQLScalarType, Kind } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/validate-enums-from-query.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { gql, ApolloLink, DocumentNode, execute, GraphQLRequest, Observable } from "@apollo/client";
import { ApolloLink, DocumentNode, execute, gql, GraphQLRequest, Observable } from "@apollo/client/core";
import { getOperationName } from "@apollo/client/utilities";
import { graphql } from "graphql";
import { makeExecutableSchema } from "graphql-tools";
import { withScalars } from "..";
import { makeExecutableSchema, withScalars } from "..";

const typeDefs = gql`
type Query {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeExecutableSchema } from "graphql-tools";
import { makeExecutableSchema } from "@graphql-tools/schema";
import { isNone } from "./lib/is-none";
import { ScalarApolloLink, withScalars } from "./lib/link";
import { mapIfArray } from "./lib/map-if-array";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApolloLink, FetchResult, NextLink, Observable, Operation } from "@apollo/client";
import { ApolloLink, FetchResult, NextLink, Observable, Operation } from "@apollo/client/core";
import { GraphQLSchema, isInputType, isLeafType, NamedTypeNode, TypeNode } from "graphql";
import pickBy from "lodash.pickby";
import { ZenObservable } from "zen-observable-ts";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/treat-result.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FetchResult, Operation } from "@apollo/client";
import { FetchResult, Operation } from "@apollo/client/core";
import { GraphQLObjectType, GraphQLSchema, OperationDefinitionNode } from "graphql";
import { FunctionsMap } from "..";
import { fragmentReducer } from "./fragment-reducer";
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"resolveJsonModule": true,
"declaration": true,
"inlineSourceMap": true,
"skipLibCheck": false,
"skipLibCheck": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"strict": true /* Enable all strict type-checking options. */,
/* Strict Type-Checking Options */
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"object-literal-sort-keys": [false],
"no-console": [false],
"interface-over-type-literal": [false],
"no-submodule-imports": ["@apollo/client/utilities"]
"no-submodule-imports": ["@apollo/client/utilities", "@apollo/client/core"]
}
}

0 comments on commit 66c74c7

Please sign in to comment.