Skip to content

Exports

Jiří Čermák edited this page Jun 2, 2022 · 16 revisions

@ackee/petrus - v5.3.6

Table of contents

Enumerations

Interfaces

Type Aliases

Other Variables

Redux Action Variables

Redux Selector Variables

HOC Functions

Other Functions

React Component Functions

React Hook Functions

Redux Saga Functions

Redux Selector Functions

Utilities Functions

Type Aliases

PetrusCredentials

Ƭ PetrusCredentials: any

Defined in

src/types/index.ts:16


PetrusLogger

Ƭ PetrusLogger: Object

Type declaration

Name Type
error Console["error"]

Defined in

src/types/index.ts:10


PetrusOAuth

Ƭ PetrusOAuth: Object

Type declaration

Name Type
searchParams Record<string, any>

Defined in

src/types/index.ts:32


PetrusTokens

Ƭ PetrusTokens: Object

Type declaration

Name Type
accessToken { expiration?: string | null ; token: string } & Record<string, any>
refreshToken? { token: string } & Record<string, any>

Defined in

src/types/index.ts:18


PetrusUser

Ƭ PetrusUser: any

Defined in

src/types/index.ts:14


StorageDriver

Ƭ StorageDriver: Object

Type declaration

Name Type
get <Key, Value>(k: Key) => HandlerReturnValue<void | Value>
remove <Key>(k: Key) => HandlerReturnValue<void>
set <Key, Value>(k: Key, v: Value) => HandlerReturnValue<void>

Defined in

src/config/types.ts:3

Other Variables

storageDrivers

Const storageDrivers: Object

Type declaration

Name Type
indexedDB { get: <Key>(key: Key) => Promise<any> ; remove: <Key>(key: Key) => Promise<void> ; set: <Key, Value>(key: Key, val: Value) => Promise<void | IDBValidKey> }
indexedDB.get [object Object]
indexedDB.remove [object Object]
indexedDB.set [object Object]
resetStorage { get: () => null ; set: () => void ; remove: <Key>(key: Key) => Promise<void> }
resetStorage.get () => null
resetStorage.set () => void
resetStorage.remove [object Object]
sessionStorage { get: <Key>(key: Key) => any ; remove: <Key>(key: Key) => void ; set: <Key, Value>(key: Key, values: Value) => void }
sessionStorage.get [object Object]
sessionStorage.remove [object Object]
sessionStorage.set [object Object]

Defined in

src/config/index.ts:5


Redux Action Variables

accessTokenAvailable

Const accessTokenAvailable: ActionCreatorWithPayload<{ expiration?: null | string ; token: string } & Record<string, any>, "@@petrus/ACCESS_TOKEN_AVAILABLE">

Defined in

src/services/actions/accessTokenAvailability.ts:13


accessTokenUnavailable

Const accessTokenUnavailable: ActionCreatorWithoutPayload<"@@petrus/ACCESS_TOKEN_UNAVAILABLE">

Defined in

src/services/actions/accessTokenAvailability.ts:20


authSessionEnd

Const authSessionEnd: ActionCreatorWithoutPayload<"@@petrus/AUTH_SESSION_END">

Defined in

src/services/actions/authSession.ts:19


authSessionPause

Const authSessionPause: ActionCreatorWithoutPayload<"@@petrus/AUTH_SESSION_PAUSE">

Defined in

src/services/actions/authSession.ts:24


authSessionResume

Const authSessionResume: ActionCreatorWithoutPayload<"@@petrus/AUTH_SESSION_RESUME">

Defined in

src/services/actions/authSession.ts:29


authSessionStart

Const authSessionStart: ActionCreatorWithoutPayload<"@@petrus/AUTH_SESSION_START">

Defined in

src/services/actions/authSession.ts:14


checkAccessTokenExpiration

Const checkAccessTokenExpiration: ActionCreatorWithoutPayload<"@@petrus/CHECK_ACCESS_TOKEN_EXPIRATION">

Defined in

src/modules/tokens/modules/refreshment/actions/general.ts:11


login

Const login: Object

Type declaration

Name Type
cancel ActionCreatorWithoutPayload<"@@petrus/LOGIN_CANCEL">
failure ActionCreatorWithPayload<Error, "@@petrus/LOGIN_FAILURE">
request ActionCreatorWithPayload<any, "@@petrus/LOGIN_REQUEST">
reset ActionCreatorWithoutPayload<"@@petrus/LOGIN_RESET">
success ActionCreatorWithoutPayload<"@@petrus/LOGIN_SUCCESS">
types { CANCEL: "@@petrus/LOGIN_CANCEL" ; FAILURE: "@@petrus/LOGIN_FAILURE" ; REQUEST: "@@petrus/LOGIN_REQUEST" ; RESET: "@@petrus/LOGIN_RESET" ; SUCCESS: "@@petrus/LOGIN_SUCCESS" }
types.CANCEL "@@petrus/LOGIN_CANCEL"
types.FAILURE "@@petrus/LOGIN_FAILURE"
types.REQUEST "@@petrus/LOGIN_REQUEST"
types.RESET "@@petrus/LOGIN_RESET"
types.SUCCESS "@@petrus/LOGIN_SUCCESS"

Defined in

src/modules/auth-session/actions/login.ts:16


logout

Const logout: Object

Type declaration

Name Type
cancel ActionCreatorWithoutPayload<"@@petrus/LOGOUT_CANCEL">
failure ActionCreatorWithPayload<Error, "@@petrus/LOGOUT_FAILURE">
request ActionCreatorWithoutPayload<"@@petrus/LOGOUT_REQUEST">
reset ActionCreatorWithoutPayload<"@@petrus/LOGOUT_RESET">
success ActionCreatorWithoutPayload<"@@petrus/LOGOUT_SUCCESS">
types { CANCEL: "@@petrus/LOGOUT_CANCEL" ; FAILURE: "@@petrus/LOGOUT_FAILURE" ; REQUEST: "@@petrus/LOGOUT_REQUEST" ; RESET: "@@petrus/LOGOUT_RESET" ; SUCCESS: "@@petrus/LOGOUT_SUCCESS" }
types.CANCEL "@@petrus/LOGOUT_CANCEL"
types.FAILURE "@@petrus/LOGOUT_FAILURE"
types.REQUEST "@@petrus/LOGOUT_REQUEST"
types.RESET "@@petrus/LOGOUT_RESET"
types.SUCCESS "@@petrus/LOGOUT_SUCCESS"

Defined in

src/modules/auth-session/actions/logout.ts:15


retrieveTokensRequest

Const retrieveTokensRequest: ActionCreatorWithoutPayload<"@@petrus/RETRIEVE_TOKENS_REQUEST">

Defined in

src/modules/tokens/modules/retrieval/actions/index.ts:12


retrieveTokensResolve

Const retrieveTokensResolve: ActionCreatorWithPayload<boolean, "@@petrus/RETRIEVE_TOKENS_RESOLVE">

Defined in

src/modules/tokens/modules/retrieval/actions/index.ts:19


setTokensPersistence

Const setTokensPersistence: ActionCreatorWithPayload<TokensPersistence, "@@petrus/SET_TOKENS_PERSISTENCE">

Defined in

src/modules/tokens/modules/storage/actions/index.ts:12


setUserWithTokens

Const setUserWithTokens: ActionCreatorWithPreparedPayload<[user: any, tokens: PetrusTokens], { tokens: PetrusTokens ; user: any }, "@@petrus/SET_USER_WITH_TOKENS", never, never>

Defined in

src/modules/auth-session/actions/setUserWithTokens.ts:8


terminate

Const terminate: ActionCreatorWithoutPayload<"@@petrus/TERMINATE">

Defined in

src/services/actions/control.ts:11


Redux Selector Variables

accessTokenSelector

Const accessTokenSelector: (state: never, ...params: []) => null | { expiration?: null | string ; token: string } & Record<string, any> & OutputSelectorFields<(...args: [null | PetrusTokens]) => { expiration?: null | string ; token: string } & Record<string, any> & { clearCache: () => void }> & { clearCache: () => void }

Defined in

src/services/selectors/tokens.ts:17


tokensPersistenceSelector

Const tokensPersistenceSelector: (state: {}, ...params: []) => TokensPersistence & OutputSelectorFields<(...args: [PetrusEntitiesState<unknown>]) => NONE & { clearCache: () => void } & LOCAL & { clearCache: () => void } & SESSION & { clearCache: () => void }> & { clearCache: () => void }

Defined in

src/services/selectors/tokens.ts:12


tokensSelector

Const tokensSelector: (state: {}, ...params: []) => null | PetrusTokens & OutputSelectorFields<(...args: [PetrusEntitiesState<unknown>]) => PetrusTokens & { clearCache: () => void }> & { clearCache: () => void }

Defined in

src/services/selectors/tokens.ts:7

HOC Functions

authorizable

authorizable(AuthorizableComponent, Firewall, Loader?): (props: any) => Element

Use Authenticated component instead.

deprecated

Parameters

Name Type Default value
AuthorizableComponent any undefined
Firewall any undefined
Loader () => Element MockAppLoader

Returns

fn

▸ (props): Element

Parameters
Name Type
props any
Returns

Element

Name Type
displayName string

Defined in

src/HOC/authorizable.jsx:13


Other Functions

configure

configure<User, Credentials, AppState>(customConfig): Object

Type parameters

Name Type
User extends unknown = any
Credentials extends unknown = any
AppState extends Record<string, any> = Record<string, any>

Parameters

Name Type
customConfig PetrusCustomConfig<User, Credentials, PetrusConfig<User, Credentials, PetrusLogger>>

Returns

Object

Name Type
reducer Reducer<CombinedState<Object>, AnyAction>
saga () => Generator<TakeEffect | CancelEffect | ForkEffect<Generator<AllEffect<Generator<AllEffect<Generator<any, void, any>>, void, unknown> | Generator<AllEffect<false | Generator<AllEffect<Generator<TakeEffect | CancelEffect | ForkEffect<void>, void, Task>>, void, unknown> | Generator<PutEffect<{ payload: undefined ; type: "@@petrus/RETRIEVE_TOKENS_REQUEST" }> | Generator<null | void | Record<string, any>, boolean, never> | PutEffect<{ payload: boolean ; type: "@@petrus/RETRIEVE_TOKENS_RESOLVE" }>, void, boolean>>, void, unknown>>, void, unknown>>, void, Task>

Defined in

src/configure/index.ts:11


React Component Functions

Authenticated

Authenticated(__namedParameters): null | Element

Parameters

Name Type
__namedParameters AuthenticatedProps

Returns

null | Element

Defined in

src/components/Authenticated/Authenticated.tsx:16


React Hook Functions

useAuthenticated

useAuthenticated(): FlowType

Returns

FlowType

Defined in

src/hooks/useAuthenticated.ts:8


Redux Saga Functions

getAccessToken

getAccessToken(): Generator<TakeEffect | SelectEffect | PutEffect<{ payload: RefreshTokensRequestPayload ; type: "@@petrus/REFRESH_TOKENS_REQUEST" }> | RaceEffect<ActionCreatorWithoutPayload<"@@petrus/REFRESH_TOKENS_SUCCESS"> | ActionCreatorWithPayload<Error, "@@petrus/REFRESH_TOKENS_FAILURE">>, null | { expiration?: null | string ; token: string } & Record<string, any>, PetrusEntitiesState<any> & ApiState & { expiration?: null | string ; token: string } & Record<string, any> & Partial<{ failure: ActionCreatorWithPayload<Error, "@@petrus/REFRESH_TOKENS_FAILURE"> = refreshTokens.failure; success: ActionCreatorWithoutPayload<"@@petrus/REFRESH_TOKENS_SUCCESS"> = refreshTokens.success }> & { payload: { expiration?: null | string ; token: string } & Record<string, any> ; type: "@@petrus/ACCESS_TOKEN_AVAILABLE" }>

Returns

Generator<TakeEffect | SelectEffect | PutEffect<{ payload: RefreshTokensRequestPayload ; type: "@@petrus/REFRESH_TOKENS_REQUEST" }> | RaceEffect<ActionCreatorWithoutPayload<"@@petrus/REFRESH_TOKENS_SUCCESS"> | ActionCreatorWithPayload<Error, "@@petrus/REFRESH_TOKENS_FAILURE">>, null | { expiration?: null | string ; token: string } & Record<string, any>, PetrusEntitiesState<any> & ApiState & { expiration?: null | string ; token: string } & Record<string, any> & Partial<{ failure: ActionCreatorWithPayload<Error, "@@petrus/REFRESH_TOKENS_FAILURE"> = refreshTokens.failure; success: ActionCreatorWithoutPayload<"@@petrus/REFRESH_TOKENS_SUCCESS"> = refreshTokens.success }> & { payload: { expiration?: null | string ; token: string } & Record<string, any> ; type: "@@petrus/ACCESS_TOKEN_AVAILABLE" }>

Defined in

src/services/sagas/getAccessToken.ts:50


retrieveTokens

retrieveTokens(): Generator<PutEffect<{ payload: undefined ; type: "@@petrus/RETRIEVE_TOKENS_REQUEST" }> | Generator<null | void | Record<string, any>, boolean, never> | PutEffect<{ payload: boolean ; type: "@@petrus/RETRIEVE_TOKENS_RESOLVE" }>, void, boolean>

Returns

Generator<PutEffect<{ payload: undefined ; type: "@@petrus/RETRIEVE_TOKENS_REQUEST" }> | Generator<null | void | Record<string, any>, boolean, never> | PutEffect<{ payload: boolean ; type: "@@petrus/RETRIEVE_TOKENS_RESOLVE" }>, void, boolean>

Defined in

src/modules/tokens/modules/retrieval/sagas/retrieveTokens.ts:80


withAuthSession

withAuthSession<Fn>(task): Generator<TakeEffect | CancelEffect | ForkEffect<void>, void, Task>

Type parameters

Name Type
Fn extends DefaultFn

Parameters

Name Type
task Fn

Returns

Generator<TakeEffect | CancelEffect | ForkEffect<void>, void, Task>

Defined in

src/services/sagas/withAuthSession.ts:21


Redux Selector Functions

apiSelector

apiSelector<AppState>(state, apiKey): ApiState

Type parameters

Name
AppState

Parameters

Name Type
state AppState
apiKey ApiKeys

Returns

ApiState

Defined in

src/services/selectors/api.ts:7


entitiesSelector

entitiesSelector<AppState, User>(state): PetrusEntitiesState<User>

Type parameters

Name Type
AppState AppState
User extends unknown = any

Parameters

Name Type
state AppState

Returns

PetrusEntitiesState<User>

Defined in

src/services/selectors/entities.ts:7


Utilities Functions

createExpirationDate

createExpirationDate(expiresIn): null | string

creates an access token expiration date from expiration timeout value

Parameters

Name Type Description
expiresIn undefined | null | string | number value in ms when access token expires

Returns

null | string

Access token expiration date in ISO string format.

Defined in

src/modules/oAuth/utils/createExpirationDate.ts:7

@ackee/petrus - v6.0.0

Clone this wiki locally