graphql-http-ws-client
Advanced tools
Comparing version 1.1.1 to 2.0.0
{ | ||
"name": "graphql-http-ws-client", | ||
"version": "1.1.1", | ||
"version": "2.0.0", | ||
"private": false, | ||
"license": "MIT", | ||
"type": "module", | ||
"author": { | ||
@@ -14,18 +15,10 @@ "name": "John Murphy-Teixidor", | ||
}, | ||
"scripts": { | ||
"build": "npx babel --plugins @babel/plugin-transform-modules-commonjs --out-dir cjs src" | ||
}, | ||
"dependencies": { | ||
"@apollo/client": "^3.3.7" | ||
"@apollo/client": "^3.4.16" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"@babel/plugin-transform-modules-commonjs": "^7.12.1", | ||
"@babel/preset-env": "^7.12.11", | ||
"apollo-cache-persist": "^0.1.1", | ||
"cross-fetch": "^3.0.6", | ||
"graphql": "^15.5.0", | ||
"subscriptions-transport-ws": "^0.9.18", | ||
"ws": "^7.4.2" | ||
"graphql": "^15.6.1", | ||
"subscriptions-transport-ws": "^0.9.19", | ||
"node-fetch": "^3.0.0", | ||
"ws": "^8.2.3" | ||
}, | ||
@@ -36,7 +29,3 @@ "peerDependencies": { | ||
}, | ||
"exports": { | ||
"require": "./cjs/index.js", | ||
"import": "./src/index.js" | ||
} | ||
"main": "src/exports.js" | ||
} | ||
@@ -5,3 +5,3 @@ ## GraphQL client over HTTP/WS | ||
import {createGraphQLClient, gql} from "graphql-http-ws-client"; | ||
import { createGraphQLClient } from "graphql-http-ws-client"; | ||
import WebSocket from "ws"; | ||
@@ -19,3 +19,3 @@ import fetch from "node-fetch"; | ||
import {createGraphQLClient, gql} from "graphql-http-ws-client"; | ||
import { createGraphQLClient } from "graphql-http-ws-client"; | ||
import fetch from "node-fetch"; | ||
@@ -32,3 +32,3 @@ | ||
import {createGraphQLClient, gql} from "graphql-http-ws-client"; | ||
import { createGraphQLClient } from "graphql-http-ws-client"; | ||
import WebSocket from "ws"; | ||
@@ -94,9 +94,10 @@ import fetch from "node-fetch"; | ||
#### v1.1 | ||
#### v2.0 | ||
- Changed package type to module | ||
- Passed-in queries and mutations are now automatically wrapped with gql() tag, if they are not already wrapped | ||
#### v1.0 | ||
#### v0.3 | ||
- Bundles CJS and ESM versions of module | ||
- Queries and mutations can now be passed as strings instead of being wrapped in the `gql` tag | ||
@@ -103,0 +104,0 @@ #### v0.2 |
@@ -1,2 +0,3 @@ | ||
import {ApolloClient, gql} from "@apollo/client/core/core.cjs.js"; | ||
import { ApolloClient } from "@apollo/client/core/core.cjs.js"; | ||
import gql from "graphql-tag"; | ||
@@ -3,0 +4,0 @@ class ApolloClientWithGQL extends ApolloClient { |
@@ -0,3 +1,3 @@ | ||
import { InMemoryCache } from "@apollo/client/cache/cache.cjs.js"; | ||
import ApolloClientWithGQL from "./ApolloClientWithGQL.js"; | ||
import {InMemoryCache} from "@apollo/client/cache/cache.cjs.js"; | ||
import createGraphQLLinks from "./createGraphQLLinks.js"; | ||
@@ -30,3 +30,1 @@ | ||
}; | ||
@@ -1,6 +0,6 @@ | ||
import {concat, split} from '@apollo/client/link/core/core.cjs.js'; | ||
import {WebSocketLink} from "@apollo/client/link/ws/ws.cjs.js"; | ||
import {HttpLink} from "@apollo/client/link/http/http.cjs.js"; | ||
import {RetryLink} from "@apollo/client/link/retry/retry.cjs.js"; | ||
import {getMainDefinition} from "@apollo/client/utilities/utilities.cjs.js" | ||
import { getMainDefinition } from "@apollo/client/utilities/utilities.cjs.js"; | ||
import { concat, split } from "@apollo/client/link/core/core.cjs.js"; | ||
import { RetryLink } from "@apollo/client/link/retry/retry.cjs.js"; | ||
import { HttpLink } from "@apollo/client/link/http/http.cjs.js"; | ||
import { WebSocketLink } from "@apollo/client/link/ws/ws.cjs.js"; | ||
import { SubscriptionClient } from "subscriptions-transport-ws"; | ||
@@ -22,7 +22,6 @@ | ||
let httpLink = null; | ||
if(options.createHTTPLink) { | ||
const httpLinkOptions = { | ||
uri: graphQLURL, | ||
...options.httpLinkOptions | ||
...options.httpLinkOptions | ||
}; | ||
@@ -44,9 +43,9 @@ | ||
if(typeof options.ws !== 'function' && (typeof window !== 'object' || typeof window.WebSocket !== 'function')) | ||
if(typeof options.websocket !== 'function' && (typeof window !== 'object' || typeof window.WebSocket !== 'function')) | ||
throw new Error(`Missing websocket implementation on window.WebSocket or options.websocket`); | ||
const websocketImplementation = (typeof options.ws === 'function') ? options.ws : window.WebSocket; | ||
const websocketImplementation = (typeof options.websocket === 'function') ? options.websocket : window.WebSocket; | ||
subscriptionClient = new SubscriptionClient(httpURLToWS(graphQLURL), wsLinkOptions, websocketImplementation); | ||
wsLink = new WebSocketLink(subscriptionClient); | ||
@@ -56,3 +55,3 @@ } | ||
let transportLink = null; | ||
if(httpLink !== null && wsLink !== null) { // httpLink and websocketLink exist | ||
if(httpLink !== null && wsLink !== null) { // httpLink and wsLink exist | ||
transportLink = split(({ query }) => { | ||
@@ -59,0 +58,0 @@ const { kind, operation } = getMainDefinition(query); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
4
106
Yes
8995
6
143
1
Updated@apollo/client@^3.4.16