@8base/apollo-client
Advanced tools
Comparing version 2.6.6 to 2.7.0-beta.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.7.0-beta.0](https://github.com/8base/sdk/compare/v2.6.6...v2.7.0-beta.0) (2022-06-22) | ||
**Note:** Version bump only for package @8base/apollo-client | ||
## [2.6.6](https://github.com/8base/sdk/compare/v2.6.5...v2.6.6) (2022-03-18) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -13,15 +12,8 @@ var t = {}; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
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 graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
exports.gql = graphql_tag_1.default; | ||
import { AuthLink, SuccessLink, SignUpLink, SubscriptionLink, isSubscriptionRequest } from '@8base/apollo-links'; | ||
import { SDKError, ERROR_CODES, PACKAGES } from '@8base/utils'; | ||
import { ApolloClient as OriginalApolloClient, InMemoryCache, ApolloLink, } from '@apollo/client'; | ||
import { BatchHttpLink } from '@apollo/client/link/batch-http'; | ||
import { onError as createErrorLink } from '@apollo/client/link/error'; | ||
import gql from 'graphql-tag'; | ||
/** | ||
@@ -43,3 +35,3 @@ * Extended Apollo Client by 8base several links. | ||
*/ | ||
class ApolloClient extends client_1.ApolloClient { | ||
class ApolloClient extends OriginalApolloClient { | ||
constructor(config) { | ||
@@ -49,9 +41,9 @@ 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 client_1.InMemoryCache(); | ||
cache = new InMemoryCache(); | ||
} | ||
const batchHttpLink = new batch_http_1.BatchHttpLink({ uri }); | ||
const batchHttpLink = new BatchHttpLink({ uri }); | ||
let links = [batchHttpLink]; | ||
if (withSubscriptions && getAuthState) { | ||
links = [ | ||
client_1.ApolloLink.split(apollo_links_1.isSubscriptionRequest, new apollo_links_1.SubscriptionLink({ | ||
ApolloLink.split(isSubscriptionRequest, new SubscriptionLink({ | ||
uri: 'wss://ws.8base.com', | ||
@@ -65,3 +57,3 @@ getAuthState, | ||
if (withAuth) { | ||
const authLink = new apollo_links_1.AuthLink({ | ||
const authLink = new AuthLink({ | ||
// @ts-ignore | ||
@@ -78,5 +70,5 @@ getAuthState, | ||
if (!authProfileId) { | ||
throw new utils_1.SDKError(utils_1.ERROR_CODES.MISSING_PARAMETER, utils_1.PACKAGES.APOLLO_CLIENT, 'Please provide authProfileId if you want to enable auto sign up.'); | ||
throw new SDKError(ERROR_CODES.MISSING_PARAMETER, PACKAGES.APOLLO_CLIENT, 'Please provide authProfileId if you want to enable auto sign up.'); | ||
} | ||
const signUpLink = new apollo_links_1.SignUpLink({ | ||
const signUpLink = new SignUpLink({ | ||
authProfileId, | ||
@@ -90,6 +82,6 @@ // @ts-ignore | ||
if (typeof onRequestSuccess === 'function') { | ||
links = [new apollo_links_1.SuccessLink({ successHandler: onRequestSuccess }), ...links]; | ||
links = [new SuccessLink({ successHandler: onRequestSuccess }), ...links]; | ||
} | ||
if (typeof onRequestError === 'function') { | ||
links = [error_1.onError(onRequestError), ...links]; | ||
links = [createErrorLink(onRequestError), ...links]; | ||
} | ||
@@ -99,7 +91,7 @@ if (typeof extendLinks === 'function') { | ||
} | ||
const link = client_1.ApolloLink.from(links); | ||
const link = ApolloLink.from(links); | ||
super(Object.assign({ cache, link }, rest)); | ||
} | ||
} | ||
exports.ApolloClient = ApolloClient; | ||
export { ApolloClient, gql, InMemoryCache }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@8base/apollo-client", | ||
"version": "2.6.6", | ||
"version": "2.7.0-beta.0", | ||
"repository": "https://github.com/8base/sdk", | ||
@@ -18,4 +18,4 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/core/apollo-client", | ||
"dependencies": { | ||
"@8base/apollo-links": "^2.6.6", | ||
"@8base/utils": "^2.6.6" | ||
"@8base/apollo-links": "^2.7.0-beta.0", | ||
"@8base/utils": "^2.7.0-beta.0" | ||
}, | ||
@@ -46,2 +46,25 @@ "devDependencies": { | ||
], | ||
"moduleNameMapper": { | ||
"8base-sdk": "<rootDir>/../../core/8base-sdk/src/index.ts", | ||
"@8base/api-client": "<rootDir>/../../core/api-client/src/index.ts", | ||
"@8base/api-token-auth-client": "<rootDir>/../../core/api-token-auth-client/src/index.ts", | ||
"@8base/apollo-client": "<rootDir>/../../core/apollo-client/src/index.ts", | ||
"@8base/apollo-links": "<rootDir>/../../core/apollo-links/src/index.ts", | ||
"@8base/auth": "<rootDir>/../../core/auth/src/index.ts", | ||
"@8base/utils": "<rootDir>/../../core/utils/src/index.ts", | ||
"@8base/validate": "<rootDir>/../../core/validate/src/index.ts", | ||
"@8base/web-auth0-auth-client": "<rootDir>/../../core/web-auth0-auth-client/src/index.ts", | ||
"@8base/web-cognito-auth-client": "<rootDir>/../../core/web-cognito-auth-client/src/index.ts", | ||
"@8base/web-native-auth-client": "<rootDir>/../../core/web-native-auth-client/src/index.ts", | ||
"@8base/web-oauth-client": "<rootDir>/../../core/web-oauth-client/src/index.ts", | ||
"8base-react-sdk": "<rootDir>/../../react/8base-react-sdk/src/index.ts", | ||
"@8base-react/app-provider": "<rootDir>/../../react/app-provider/src/index.ts", | ||
"@8base-react/auth": "<rootDir>/../../react/auth/src/index.ts", | ||
"@8base-react/crud": "<rootDir>/../../react/crud/src/index.ts", | ||
"@8base-react/file-input": "<rootDir>/../../react/file-input/src/index.ts", | ||
"@8base-react/forms": "<rootDir>/../../react/forms/src/index.ts", | ||
"@8base-react/permissions-provider": "<rootDir>/../../react/permissions-provider/src/index.ts", | ||
"@8base-react/table-schema-provider": "<rootDir>/../../react/table-schema-provider/src/index.ts", | ||
"@8base-react/utils": "<rootDir>/../../react/utils/src/index.ts" | ||
}, | ||
"moduleFileExtensions": [ | ||
@@ -48,0 +71,0 @@ "ts", |
Sorry, the diff of this file is not supported yet
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18599
1
147
1
+ Added@8base/apollo-links@2.7.0-beta.0(transitive)
+ Added@8base/utils@2.7.0-beta.0(transitive)
- Removed@8base/apollo-links@2.6.6(transitive)
- Removed@8base/utils@2.6.6(transitive)
- Removedgraphql@14.7.0(transitive)
- Removedgraphql-prettier@1.0.6(transitive)
Updated@8base/utils@^2.7.0-beta.0