@8base/apollo-client
Advanced tools
Comparing version 1.4.0 to 2.0.0
@@ -0,7 +1,5 @@ | ||
import { IAuthState } from '@8base/utils'; | ||
import { ApolloClientOptions as OriginalApolloClientOptions, ApolloClient as OriginalApolloClient, InMemoryCache, ApolloLink, Operation } from '@apollo/client'; | ||
import { ErrorHandler } from '@apollo/client/link/error'; | ||
import gql from 'graphql-tag'; | ||
import { ApolloClientOptions as OriginalApolloClientOptions, ApolloClient as OriginalApolloClient } from 'apollo-client'; | ||
import { InMemoryCache } from 'apollo-cache-inmemory'; | ||
import { ApolloLink, Operation } from 'apollo-link'; | ||
import { ErrorHandler } from 'apollo-link-error'; | ||
import { IAuthState } from '@8base/utils'; | ||
declare type ApolloClientCommon = { | ||
@@ -8,0 +6,0 @@ uri: string; |
@@ -17,13 +17,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InMemoryCache = exports.gql = exports.ApolloClient = void 0; | ||
const apollo_links_1 = require("@8base/apollo-links"); | ||
const utils_1 = require("@8base/utils"); | ||
const client_1 = require("@apollo/client"); | ||
Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: function () { return client_1.InMemoryCache; } }); | ||
const batch_http_1 = require("@apollo/client/link/batch-http"); | ||
const error_1 = require("@apollo/client/link/error"); | ||
const utilities_1 = require("@apollo/client/utilities"); | ||
const graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
exports.gql = graphql_tag_1.default; | ||
const apollo_client_1 = require("apollo-client"); | ||
const apollo_cache_inmemory_1 = require("apollo-cache-inmemory"); | ||
exports.InMemoryCache = apollo_cache_inmemory_1.InMemoryCache; | ||
const apollo_link_1 = require("apollo-link"); | ||
const apollo_link_batch_http_1 = require("apollo-link-batch-http"); | ||
const apollo_links_1 = require("@8base/apollo-links"); | ||
const apollo_link_error_1 = require("apollo-link-error"); | ||
const apollo_utilities_1 = require("apollo-utilities"); | ||
const utils_1 = require("@8base/utils"); | ||
/** | ||
@@ -45,3 +44,3 @@ * Extended Apollo Client by 8base several links. | ||
*/ | ||
class ApolloClient extends apollo_client_1.ApolloClient { | ||
class ApolloClient extends client_1.ApolloClient { | ||
constructor(config) { | ||
@@ -51,10 +50,10 @@ const { uri, getAuthState, getRefreshTokenParameters, onAuthSuccess, onAuthError, onIdTokenExpired, onRequestSuccess, onRequestError, extendLinks, withAuth = true, autoSignUp = false, withSubscriptions = false, authProfileId } = config, rest = __rest(config, ["uri", "getAuthState", "getRefreshTokenParameters", "onAuthSuccess", "onAuthError", "onIdTokenExpired", "onRequestSuccess", "onRequestError", "extendLinks", "withAuth", "autoSignUp", "withSubscriptions", "authProfileId"]); | ||
if (!cache) { | ||
cache = new apollo_cache_inmemory_1.InMemoryCache(); | ||
cache = new client_1.InMemoryCache(); | ||
} | ||
const batchHttpLink = new apollo_link_batch_http_1.BatchHttpLink({ uri }); | ||
const batchHttpLink = new batch_http_1.BatchHttpLink({ uri }); | ||
let links = [batchHttpLink]; | ||
if (withSubscriptions && getAuthState) { | ||
links = [ | ||
apollo_link_1.ApolloLink.split(({ query }) => { | ||
const definition = apollo_utilities_1.getMainDefinition(query); | ||
client_1.ApolloLink.split(({ query }) => { | ||
const definition = utilities_1.getMainDefinition(query); | ||
return definition.kind === 'OperationDefinition' && definition.operation === 'subscription'; | ||
@@ -96,3 +95,3 @@ }, new apollo_links_1.SubscriptionLink({ | ||
if (typeof onRequestError === 'function') { | ||
links = [apollo_link_error_1.onError(onRequestError), ...links]; | ||
links = [error_1.onError(onRequestError), ...links]; | ||
} | ||
@@ -102,3 +101,3 @@ if (typeof extendLinks === 'function') { | ||
} | ||
const link = apollo_link_1.ApolloLink.from(links); | ||
const link = client_1.ApolloLink.from(links); | ||
super(Object.assign({ cache, link }, rest)); | ||
@@ -105,0 +104,0 @@ } |
{ | ||
"name": "@8base/apollo-client", | ||
"version": "1.4.0", | ||
"version": "2.0.0", | ||
"repository": "https://github.com/8base/sdk", | ||
"homepage": "https://github.com/8base/sdk/tree/master/packages/apollo-client#readme", | ||
"homepage": "https://github.com/8base/sdk/tree/master/packages-core/apollo-client#readme", | ||
"main": "dist/index.js", | ||
"module": "dist/index.js", | ||
"scripts": { | ||
"build": "../../bin/build-package.sh", | ||
"watch": "../../bin/watch-package.sh", | ||
"build": "../../../bin/build-package.sh", | ||
"watch": "../../../bin/watch-package.sh", | ||
"test": "NPM_ENV=test jest" | ||
}, | ||
"peerDependencies": { | ||
"apollo-client": "^2.6.3", | ||
"graphql": "^14.0.0" | ||
"@apollo/client": "^3.3.7", | ||
"graphql": "^15.5.0" | ||
}, | ||
"dependencies": { | ||
"@8base/apollo-links": "^1.4.0", | ||
"@8base/utils": "^1.4.0", | ||
"apollo-cache-inmemory": "^1.5.1", | ||
"apollo-link": "1.2.11", | ||
"apollo-link-batch-http": "^1.2.11", | ||
"apollo-link-error": "^1.1.10", | ||
"apollo-utilities": "^1.3.2", | ||
"graphql-tag": "^2.10.0" | ||
"@8base/apollo-links": "^2.0.0", | ||
"@8base/utils": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/graphql": "^14.2.0", | ||
"@types/jest": "^24.0.13", | ||
"apollo-client": "^2.6.3", | ||
"graphql": "^14.3.1", | ||
"jest": "24.7.1", | ||
"jest-fetch-mock": "^2.1.0", | ||
"prettier": "^1.16.4", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.5.1" | ||
"@apollo/client": "^3.3.7", | ||
"@types/graphql": "^14.5.0", | ||
"@types/jest": "^26.0.20", | ||
"graphql": "^15.5.0", | ||
"jest": "26.6.3", | ||
"jest-fetch-mock": "^3.0.3", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.4.4", | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -41,3 +35,3 @@ "jest": { | ||
"ts-jest": { | ||
"tsConfig": "<rootDir>/tsconfig.json" | ||
"tsconfig": "<rootDir>/tsconfig.json" | ||
} | ||
@@ -44,0 +38,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
No website
QualityPackage does not have a website.
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
4
8
15195
159
+ Added@8base/apollo-links@2.6.6(transitive)
+ Added@8base/utils@2.6.6(transitive)
+ Added@apollo/client@3.12.4(transitive)
+ Added@graphql-typed-document-node/core@3.2.0(transitive)
+ Added@wry/caches@1.0.1(transitive)
+ Added@wry/context@0.7.4(transitive)
+ Added@wry/equality@0.5.7(transitive)
+ Added@wry/trie@0.5.0(transitive)
+ Addedgraphql@15.9.0(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedoptimism@0.18.1(transitive)
+ Addedprettier@2.8.8(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedramda@0.27.2(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedrehackt@0.1.0(transitive)
+ Addedresponse-iterator@0.2.11(transitive)
+ Addedsubscriptions-transport-ws@0.9.19(transitive)
+ Addedsymbol-observable@4.0.0(transitive)
+ Addedts-invariant@0.10.3(transitive)
+ Addedws@7.5.10(transitive)
+ Addedzen-observable-ts@1.2.5(transitive)
- Removedapollo-cache-inmemory@^1.5.1
- Removedapollo-link@1.2.11
- Removedapollo-link-batch-http@^1.2.11
- Removedapollo-link-error@^1.1.10
- Removedapollo-utilities@^1.3.2
- Removedgraphql-tag@^2.10.0
- Removed@8base/apollo-link-ws@1.0.20(transitive)
- Removed@8base/apollo-links@1.6.2(transitive)
- Removed@8base/subscriptions-transport-ws@0.9.16(transitive)
- Removed@8base/utils@1.6.2(transitive)
- Removed@types/node@22.10.5(transitive)
- Removed@types/zen-observable@0.8.7(transitive)
- Removed@wry/context@0.4.4(transitive)
- Removed@wry/equality@0.1.11(transitive)
- Removedapollo-cache@1.3.5(transitive)
- Removedapollo-cache-inmemory@1.6.6(transitive)
- Removedapollo-client@2.6.10(transitive)
- Removedapollo-link@1.2.111.2.14(transitive)
- Removedapollo-link-batch@1.1.15(transitive)
- Removedapollo-link-batch-http@1.2.14(transitive)
- Removedapollo-link-error@1.1.13(transitive)
- Removedapollo-link-http-common@0.2.16(transitive)
- Removedapollo-utilities@1.3.4(transitive)
- Removedasync-limiter@1.0.1(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedoptimism@0.10.3(transitive)
- Removedos@0.1.2(transitive)
- Removedprettier@1.19.1(transitive)
- Removedramda@0.26.1(transitive)
- Removedts-invariant@0.3.30.4.4(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedws@5.2.4(transitive)
Updated@8base/apollo-links@^2.0.0
Updated@8base/utils@^2.0.0