Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated link packages to use Apollo 3 #561

Merged
merged 4 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/aws-appsync-auth-link/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-appsync-auth-link",
"version": "2.0.3",
"version": "3.0.0",
"main": "lib/index.js",
"license": "Apache-2.0",
"description": "AWS Mobile AppSync Auth Link for JavaScript",
Expand All @@ -19,7 +19,7 @@
"test-watch": "jest --watch"
},
"dependencies": {
"apollo-link": "1.2.5",
"@apollo/client": "^3.2.0",
"aws-sdk": "^2.518.0",
"debug": "2.6.9"
}
Expand Down
4 changes: 1 addition & 3 deletions packages/aws-appsync-auth-link/src/auth-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { Observable, Operation, NextLink } from 'apollo-link';
import { ApolloLink } from 'apollo-link';
import { ExecutionResult } from 'graphql';
import { ApolloLink, Observable } from '@apollo/client';
import { print } from 'graphql/language/printer';

import { Signer } from './signer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AUTH_TYPE } from "aws-appsync-auth-link";
import { execute } from "apollo-link";
import { execute } from "@apollo/client";
import gql from 'graphql-tag';
import { AppSyncRealTimeSubscriptionHandshakeLink } from '../../src/realtime-subscription-handshake-link';

Expand Down Expand Up @@ -75,7 +75,7 @@ describe("RealTime subscription link", () => {
region: 'us-east-1',
url: 'https://xxxxx.appsync-api.amazonaws.com/graphql'
});

execute(link, { query }).subscribe({
error: (err) => {
console.log({ err });
Expand Down Expand Up @@ -112,7 +112,7 @@ describe("RealTime subscription link", () => {
region: 'us-east-1',
url: 'https://xxxxx.appsync-api.amazonaws.com/graphql'
});

execute(link, { query }).subscribe({
error: (err) => {
console.log({ err });
Expand Down Expand Up @@ -149,7 +149,7 @@ describe("RealTime subscription link", () => {
region: 'us-east-1',
url: 'https://xxxxx.appsync-api.amazonaws.com/graphql'
});

execute(link, { query }).subscribe({
error: (err) => {
console.log({ err });
Expand Down
9 changes: 3 additions & 6 deletions packages/aws-appsync-subscription-link/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-appsync-subscription-link",
"version": "2.2.1",
"version": "3.0.0",
"main": "lib/index.js",
"license": "Apache-2.0",
"description": "AWS Mobile AppSync SDK for JavaScript",
Expand All @@ -19,10 +19,7 @@
"test-watch": "jest --watch"
},
"dependencies": {
"apollo-link": "1.2.5",
"apollo-link-context": "1.0.11",
"apollo-link-http": "1.5.8",
"apollo-link-retry": "2.2.7",
"@apollo/client": "^3.2.0",
"aws-appsync-auth-link": "^2.0.3",
"debug": "2.6.9",
"url": "^0.11.0"
Expand All @@ -31,6 +28,6 @@
"@redux-offline/redux-offline": "2.5.2-native.0"
},
"peerDependencies": {
"apollo-client": "2.x"
"@apollo/client": "3.x"
}
}
3 changes: 1 addition & 2 deletions packages/aws-appsync-subscription-link/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {
SubscriptionHandshakeLink,
CONTROL_EVENTS_KEY
} from "./subscription-handshake-link";
import { ApolloLink, Observable } from "apollo-link";
import { createHttpLink } from "apollo-link-http";
import { ApolloLink, Observable, createHttpLink } from "@apollo/client";
import { getMainDefinition } from "apollo-utilities";
import { NonTerminatingLink } from "./non-terminating-link";
import { OperationDefinitionNode } from "graphql";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { createHttpLink, FetchOptions } from 'apollo-link-http';
import { createHttpLink, HttpOptions } from '@apollo/client';
import { NonTerminatingLink } from './non-terminating-link';

export class NonTerminatingHttpLink extends NonTerminatingLink {
constructor(contextKey: string, options: FetchOptions) {
constructor(contextKey: string, options: HttpOptions) {
const link = createHttpLink(options);

super(contextKey, { link });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { ApolloLink, NextLink } from 'apollo-link';
import { setContext } from 'apollo-link-context';
import { ApolloLink, NextLink } from '@apollo/client';
import { setContext } from '@apollo/client/link/context';

export class NonTerminatingLink extends ApolloLink {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { ApolloLink, Observable, Operation, FetchResult } from "apollo-link";
import { ApolloLink, Observable, Operation, FetchResult } from "@apollo/client";

import { rootLogger } from "./utils";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { ApolloLink, Observable, Operation, FetchResult } from "apollo-link";
import { ApolloLink, Observable, Operation, FetchResult, ApolloError } from "@apollo/client";

import { rootLogger } from "./utils";
import * as Paho from './vendor/paho-mqtt';
import { ApolloError } from "apollo-client";
import { FieldNode } from "graphql";
import { getMainDefinition } from "apollo-utilities";

Expand Down