Skip to content

Commit

Permalink
Merge pull request #145 from andreawyss/fix-index-d-ts
Browse files Browse the repository at this point in the history
add missing definitions to index.d.ts
  • Loading branch information
maxmantz authored Mar 13, 2019
2 parents 9da70a0 + 8d56340 commit 9bd0693
Showing 1 changed file with 74 additions and 55 deletions.
129 changes: 74 additions & 55 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,87 @@
declare module 'redux-oidc' {
import { UserManager, UserManagerSettings, User } from 'oidc-client';
import { Map, fromJS } from 'immutable';
import { Middleware, Store } from 'redux';
import * as React from 'react';
declare module "redux-oidc" {
import { UserManager, UserManagerSettings, User } from "oidc-client";
import { Map, fromJS } from "immutable";
import { Middleware, Store } from "redux";
import * as React from "react";

export interface BaseAction {
readonly type: string;
}
export interface BaseAction {
readonly type: string;
}

export interface Action<Payload> extends BaseAction {
readonly payload?: Payload;
readonly error?: boolean;
}
export interface Action<Payload> extends BaseAction {
readonly payload?: Payload;
readonly error?: boolean;
}

export interface UserState {
readonly user?: User;
readonly isLoadingUser: boolean;
}
export interface UserState {
readonly user?: User;
readonly isLoadingUser: boolean;
}

export interface CallbackComponentProps {
readonly userManager: UserManager;
readonly successCallback: (user: User) => void;
readonly errorCallback?: (error: Error) => void;
readonly route?: string;
}
export interface CallbackComponentProps {
readonly userManager: UserManager;
readonly successCallback: (user: User) => void;
readonly errorCallback?: (error: Error) => void;
readonly route?: string;
}

export class CallbackComponent extends React.Component<CallbackComponentProps> { }
export class CallbackComponent extends React.Component<
CallbackComponentProps
> {}

export class SignoutCallbackComponent extends React.Component<CallbackComponentProps> { }
export class SignoutCallbackComponent extends React.Component<
CallbackComponentProps
> {}

export interface OidcProviderProps<TSTate> {
readonly userManager: UserManager;
readonly store: Store<TSTate>;
}
export interface OidcProviderProps<TSTate> {
readonly userManager: UserManager;
readonly store: Store<TSTate>;
}

export class OidcProvider<TState> extends React.Component<OidcProviderProps<TState>> { }
export class OidcProvider<TState> extends React.Component<
OidcProviderProps<TState>
> {}

// Components
export function createUserManager(options: UserManagerSettings): UserManager;
export function processSilentRenew(): void;
export function loadUser<TStore>(store: TStore, userManager: UserManager): Promise<User>;
export function reducer(state: UserState | undefined, action: Action<User | Error>): UserState;
export function immutableReducer(state: Map<string, any>, action: Action<User | Error>): Map<string, any>;
// Components
export function createUserManager(options: UserManagerSettings): UserManager;
export function processSilentRenew(): void;
export function loadUser<TStore>(
store: TStore,
userManager: UserManager
): Promise<User>;
export function reducer(
state: UserState | undefined,
action: Action<User | Error>
): UserState;
export function immutableReducer(
state: Map<string, any>,
action: Action<User | Error>
): Map<string, any>;

// Constants
export const USER_EXPIRED: string;
export const REDIRECT_SUCCESS: string;
export const USER_LOADED: string;
export const SILENT_RENEW_ERROR: string;
export const SESSION_TERMINATED: string;
export const USER_EXPIRING: string;
export const USER_FOUND: string;
export const LOADING_USER: string;
export const USER_SIGNED_OUT: string;
// Constants
export const USER_EXPIRED: string;
export const REDIRECT_SUCCESS: string;
export const USER_LOADED: string;
export const SILENT_RENEW_ERROR: string;
export const SESSION_TERMINATED: string;
export const USER_EXPIRING: string;
export const USER_FOUND: string;
export const LOADING_USER: string;
export const LOAD_USER_ERROR: string;
export const USER_SIGNED_OUT: string;

// Actions
export function userExpired(): BaseAction;
export function redirectSuccess(): Action<User>;
export function userFound(): Action<User>;
export function silentRenewError(): Action<Error>;
export function sessionTerminated(): BaseAction;
export function userExpiring(): BaseAction;
export function loadingUser(): BaseAction;
export function userSignedOut(): BaseAction;
// Actions
export function userExpired(): BaseAction;
export function redirectSuccess(): Action<User>;
export function userFound(): Action<User>;
export function silentRenewError(): Action<Error>;
export function sessionTerminated(): BaseAction;
export function userExpiring(): BaseAction;
export function loadingUser(): BaseAction;
export function loadUserError(): BaseAction;
export function userSignedOut(): BaseAction;

export default function createOidcMiddleware(userManager: UserManager): Middleware;
export default function createOidcMiddleware(
userManager: UserManager
): Middleware;
}

0 comments on commit 9bd0693

Please sign in to comment.