@8base/app-provider
Advanced tools
Comparing version 0.35.1 to 0.36.0
@@ -27,6 +27,6 @@ "use strict"; | ||
const apollo_cache_inmemory_1 = require("apollo-cache-inmemory"); | ||
const auth_1 = require("@8base/auth"); | ||
const react_auth_1 = require("@8base/react-auth"); | ||
const apollo_client_1 = require("@8base/apollo-client"); | ||
const FragmentsSchemaContainer_1 = require("./FragmentsSchemaContainer"); | ||
const ApolloContainer = auth_1.withAuth((_a = class ApolloContainer extends react_1.default.Component { | ||
const ApolloContainer = react_auth_1.withAuth((_a = class ApolloContainer extends react_1.default.Component { | ||
constructor() { | ||
@@ -55,17 +55,18 @@ super(...arguments); | ||
this.onIdTokenExpired = () => __awaiter(this, void 0, void 0, function* () { | ||
const { auth: { setAuthState, renewToken }, } = this.props; | ||
const { idToken } = yield renewToken({}); | ||
yield setAuthState({ token: idToken }); | ||
const { auth: { authClient }, } = this.props; | ||
const { idToken } = yield authClient.checkSession({}); | ||
authClient.setState({ token: idToken }); | ||
}); | ||
this.onAuthError = () => __awaiter(this, void 0, void 0, function* () { | ||
const { auth: { purgeAuthState, logout }, } = this.props; | ||
yield purgeAuthState(); | ||
if (typeof logout === 'function') { | ||
yield logout(); | ||
} | ||
const { auth: { authClient }, } = this.props; | ||
yield this.client.clearStore(); | ||
authClient.batch(() => { | ||
authClient.purgeAuthState(); | ||
authClient.logout(); | ||
}); | ||
}); | ||
this.getAuthState = () => __awaiter(this, void 0, void 0, function* () { | ||
this.getAuthState = () => { | ||
const { auth: { authState }, } = this.props; | ||
return authState; | ||
}); | ||
}; | ||
this.renderContent = ({ loading, introspectionQueryResultData, }) => { | ||
@@ -72,0 +73,0 @@ if (loading) { |
import React from 'react'; | ||
import { IAuthClient, IAuthorizable } from '@8base/utils'; | ||
import { ISubscribableAuthClient } from '@8base/auth'; | ||
import { ApolloContainerPassedProps } from './types'; | ||
export declare type AppProviderProps = ApolloContainerPassedProps & { | ||
authClient?: IAuthClient & IAuthorizable; | ||
authClient?: ISubscribableAuthClient; | ||
children: React.ReactNode | ((renderProps: { | ||
@@ -7,0 +7,0 @@ loading: boolean; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const react_1 = __importDefault(require("react")); | ||
const auth_1 = require("@8base/auth"); | ||
const react_auth_1 = require("@8base/react-auth"); | ||
const ApolloContainer_1 = require("./ApolloContainer"); | ||
@@ -22,3 +22,3 @@ const table_schema_provider_1 = require("@8base/table-schema-provider"); | ||
*/ | ||
const AppProvider = ({ uri, authClient, onRequestSuccess, onRequestError, extendLinks, children, autoSignUp, authProfileId, introspectionQueryResultData, tablesList, applicationsList, }) => !!authClient ? (react_1.default.createElement(auth_1.AuthProvider, { authClient: authClient }, | ||
const AppProvider = ({ uri, authClient, onRequestSuccess, onRequestError, extendLinks, children, autoSignUp, authProfileId, introspectionQueryResultData, tablesList, applicationsList, }) => !!authClient ? (react_1.default.createElement(react_auth_1.AuthProvider, { authClient: authClient }, | ||
react_1.default.createElement(ApolloContainer_1.ApolloContainer, { withAuth: true, uri: uri, extendLinks: extendLinks, onRequestSuccess: onRequestSuccess, onRequestError: onRequestError, autoSignUp: autoSignUp, authProfileId: authProfileId, introspectionQueryResultData: introspectionQueryResultData }, | ||
@@ -25,0 +25,0 @@ react_1.default.createElement(table_schema_provider_1.TableSchemaProvider, { tablesList: tablesList, applicationsList: applicationsList }, children)))) : (react_1.default.createElement(ApolloContainer_1.ApolloContainer, { withAuth: false, uri: uri, extendLinks: extendLinks, onRequestSuccess: onRequestSuccess, onRequestError: onRequestError, introspectionQueryResultData: introspectionQueryResultData }, |
export { AppProvider } from './AppProvider'; | ||
export { EightBaseAppProvider } from './EightBaseAppProvider.__deprecated'; | ||
export { FragmentsSchemaContainer } from './FragmentsSchemaContainer'; | ||
export * from '@8base/auth'; | ||
export * from '@8base/react-auth'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
exports.FragmentsSchemaContainer = FragmentsSchemaContainer_1.FragmentsSchemaContainer; | ||
__export(require("@8base/auth")); | ||
__export(require("@8base/react-auth")); | ||
//# sourceMappingURL=index.js.map |
import { ApolloLink } from 'apollo-link'; | ||
import { AuthState, TableSchema, Application } from '@8base/utils'; | ||
import { IAuthState, TableSchema, Application } from '@8base/utils'; | ||
export declare type ApolloContainerPassedProps = { | ||
@@ -14,3 +14,3 @@ uri: string; | ||
extendLinks?: (links: ApolloLink[], options: { | ||
getAuthState?: () => Promise<AuthState>; | ||
getAuthState?: () => IAuthState; | ||
}) => ApolloLink[]; | ||
@@ -17,0 +17,0 @@ introspectionQueryResultData?: Object; |
{ | ||
"name": "@8base/app-provider", | ||
"version": "0.35.1", | ||
"version": "0.36.0", | ||
"repository": "https://github.com/8base/sdk", | ||
@@ -22,6 +22,7 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/app-provider#readme", | ||
"dependencies": { | ||
"@8base/apollo-client": "^0.35.1", | ||
"@8base/auth": "^0.35.1", | ||
"@8base/table-schema-provider": "^0.35.1", | ||
"@8base/utils": "^0.35.1", | ||
"@8base/apollo-client": "^0.36.0", | ||
"@8base/auth": "^0.36.0", | ||
"@8base/react-auth": "^0.36.0", | ||
"@8base/table-schema-provider": "^0.36.0", | ||
"@8base/utils": "^0.36.0", | ||
"apollo-cache-inmemory": "^1.5.1", | ||
@@ -32,3 +33,3 @@ "ramda": "^0.26.1", | ||
"devDependencies": { | ||
"@8base/web-auth0-auth-client": "^0.35.1", | ||
"@8base/web-auth0-auth-client": "^0.36.0", | ||
"@types/graphql": "^0.13.0", | ||
@@ -35,0 +36,0 @@ "@types/jest": "^24.0.13", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
28828
318
13
+ Added@8base/react-auth@^0.36.0
+ Added@8base/api-token-auth-client@0.36.6(transitive)
+ Added@8base/apollo-client@0.36.6(transitive)
+ Added@8base/apollo-links@0.36.6(transitive)
+ Added@8base/auth@0.36.6(transitive)
+ Added@8base/react-auth@0.36.6(transitive)
+ Added@8base/table-schema-provider@0.36.6(transitive)
+ Added@8base/utils@0.36.6(transitive)
+ Added@8base/web-auth0-auth-client@0.36.6(transitive)
+ Addedapollo-link-ws@1.0.20(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedauth0-js@9.28.0(transitive)
+ Addedbacko2@1.0.2(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedcookiejar@2.1.4(transitive)
+ Addedcrypto-js@4.2.0(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddezalgo@1.0.4(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedeventemitter3@3.1.2(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedformidable@2.1.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.6(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhexoid@1.0.0(transitive)
+ Addedidtoken-verifier@2.2.4(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjs-cookie@2.2.1(transitive)
+ Addedjsbn@1.1.0(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedmethods@1.1.2(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedms@2.1.3(transitive)
+ Addedobject-inspect@1.13.3(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedqs@6.13.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsubscriptions-transport-ws@0.9.19(transitive)
+ Addedsuperagent@7.1.6(transitive)
+ Addedunfetch@4.2.0(transitive)
+ Addedurl-join@4.0.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwinchan@0.2.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedws@7.5.10(transitive)
- Removed@8base/apollo-client@0.35.1(transitive)
- Removed@8base/apollo-links@0.35.1(transitive)
- Removed@8base/auth@0.35.1(transitive)
- Removed@8base/table-schema-provider@0.35.1(transitive)
- Removed@8base/utils@0.35.1(transitive)
Updated@8base/apollo-client@^0.36.0
Updated@8base/auth@^0.36.0
Updated@8base/utils@^0.36.0