Skip to content

Latest commit

 

History

History
372 lines (335 loc) · 11.6 KB

File metadata and controls

372 lines (335 loc) · 11.6 KB

API Report File for "@forgerock/oidc-client"

Do not edit this file. It is a report generated by API Extractor.

import { ActionTypes } from '@forgerock/sdk-request-middleware';
import type { AsyncLegacyConfigOptions } from '@forgerock/sdk-types';
import { BaseQueryFn } from '@reduxjs/toolkit/query';
import { CombinedState } from '@reduxjs/toolkit/query';
import { CustomLogger } from '@forgerock/sdk-logger';
import { EnhancedStore } from '@reduxjs/toolkit';
import { FetchArgs } from '@reduxjs/toolkit/query';
import type { FetchBaseQueryError } from '@reduxjs/toolkit/query';
import { FetchBaseQueryMeta } from '@reduxjs/toolkit/query';
import { GenericError } from '@forgerock/sdk-types';
import { GetAuthorizationUrlOptions } from '@forgerock/sdk-types';
import { logger } from '@forgerock/sdk-logger';
import { LogLevel } from '@forgerock/sdk-logger';
import { LogMessage } from '@forgerock/sdk-logger';
import { MutationDefinition } from '@reduxjs/toolkit/query';
import { QueryDefinition } from '@reduxjs/toolkit/query';
import { RequestMiddleware } from '@forgerock/sdk-request-middleware';
import { ResponseType as ResponseType_2 } from '@forgerock/sdk-types';
import { StorageConfig } from '@forgerock/storage';
import { StoreEnhancer } from '@reduxjs/toolkit';
import { ThunkDispatch } from '@reduxjs/toolkit';
import { Tuple } from '@reduxjs/toolkit';
import { UnknownAction } from '@reduxjs/toolkit';
import { Unsubscribe } from '@reduxjs/toolkit';
import { WellknownResponse } from '@forgerock/sdk-types';

export { ActionTypes }

// @public (undocumented)
export type AppDispatch = ReturnType<ClientStore['dispatch']>;

// @public (undocumented)
export interface AuthorizationError {
    // (undocumented)
    error: string;
    // (undocumented)
    error_description: string;
    // (undocumented)
    redirectUrl?: string;
    // (undocumented)
    type: 'auth_error' | 'argument_error' | 'network_error' | 'unknown_error' | 'wellknown_error';
}

// @public (undocumented)
export interface AuthorizationSuccess {
    // (undocumented)
    code: string;
    // (undocumented)
    state: string;
}

// @public (undocumented)
export interface AuthorizeErrorResponse {
    // (undocumented)
    code?: string;
    // (undocumented)
    details?: [
        {
        code: string;
        message: string;
    }
    ];
    // (undocumented)
    id?: string;
    // (undocumented)
    message?: string;
}

// @public (undocumented)
export interface AuthorizeSuccessResponse {
    // (undocumented)
    authorizeResponse?: {
        code: string;
        state: string;
    };
    // (undocumented)
    createdAt?: string;
    // (undocumented)
    _embedded?: {
        [key: string]: unknown;
    };
    // (undocumented)
    environment?: {
        id: string;
    };
    // (undocumented)
    expiresAt?: string;
    // (undocumented)
    id?: string;
    // (undocumented)
    _links?: {
        [key: string]: {
            href: string;
        };
    };
    // (undocumented)
    resumeUrl?: string;
    // (undocumented)
    session?: {
        id: string;
    };
    // (undocumented)
    status?: string;
}

// @public (undocumented)
export type BuildAuthorizationData = [string, GetAuthorizationUrlOptions];

// @public (undocumented)
export type ClientStore = ReturnType<typeof createClientStore>;

// @public
export function createClientStore<ActionType extends ActionTypes>(input: {
    requestMiddleware?: RequestMiddleware<ActionType, unknown>[];
    logger?: ReturnType<typeof logger>;
}): EnhancedStore<    {
oidc: CombinedState<    {
authorizeFetch: MutationDefinition<    {
url: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, AuthorizeSuccessResponse, "oidc", unknown>;
authorizeIframe: MutationDefinition<    {
url: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, AuthorizationSuccess, "oidc", unknown>;
endSession: MutationDefinition<    {
idToken: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, null, "oidc", unknown>;
exchange: MutationDefinition<    {
code: string;
config: OidcConfig;
endpoint: string;
verifier?: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, TokenExchangeResponse, "oidc", unknown>;
revoke: MutationDefinition<    {
accessToken: string;
clientId?: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, object, "oidc", unknown>;
userInfo: MutationDefinition<    {
accessToken: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, UserInfoResponse, "oidc", unknown>;
}, never, "oidc">;
wellknown: CombinedState<    {
configuration: QueryDefinition<string, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, WellknownResponse, "wellknown", unknown>;
}, never, "wellknown">;
}, UnknownAction, Tuple<[StoreEnhancer<    {
dispatch: ThunkDispatch<    {
oidc: CombinedState<    {
authorizeFetch: MutationDefinition<    {
url: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, AuthorizeSuccessResponse, "oidc", unknown>;
authorizeIframe: MutationDefinition<    {
url: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, AuthorizationSuccess, "oidc", unknown>;
endSession: MutationDefinition<    {
idToken: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, null, "oidc", unknown>;
exchange: MutationDefinition<    {
code: string;
config: OidcConfig;
endpoint: string;
verifier?: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, TokenExchangeResponse, "oidc", unknown>;
revoke: MutationDefinition<    {
accessToken: string;
clientId?: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, object, "oidc", unknown>;
userInfo: MutationDefinition<    {
accessToken: string;
endpoint: string;
}, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, UserInfoResponse, "oidc", unknown>;
}, never, "oidc">;
wellknown: CombinedState<    {
configuration: QueryDefinition<string, BaseQueryFn<string | FetchArgs, unknown, FetchBaseQueryError, {}, FetchBaseQueryMeta>, never, WellknownResponse, "wellknown", unknown>;
}, never, "wellknown">;
}, {
requestMiddleware: RequestMiddleware<ActionType, unknown>[] | undefined;
logger: {
changeLevel: (level: LogLevel) => void;
error: (...args: LogMessage[]) => void;
warn: (...args: LogMessage[]) => void;
info: (...args: LogMessage[]) => void;
debug: (...args: LogMessage[]) => void;
} | undefined;
}, UnknownAction>;
}>, StoreEnhancer]>>;

export { CustomLogger }

export { GenericError }

export { GetAuthorizationUrlOptions }

// @public (undocumented)
export interface GetTokensOptions {
    // (undocumented)
    authorizeOptions?: GetAuthorizationUrlOptions;
    // (undocumented)
    backgroundRenew?: boolean;
    // (undocumented)
    forceRenew?: boolean;
    // (undocumented)
    storageOptions?: Partial<StorageConfig>;
}

export { LogLevel }

// @public (undocumented)
export type LogoutErrorResult = {
    error: string;
    sessionResponse: GenericError | null;
    revokeResponse: GenericError | null;
    deleteResponse: GenericError | null;
};

// @public (undocumented)
export type LogoutSuccessResult = RevokeSuccessResult & {
    sessionResponse: null;
};

// @public (undocumented)
export interface OauthTokens {
    // (undocumented)
    accessToken: string;
    // (undocumented)
    expiresAt?: number;
    // (undocumented)
    expiryTimestamp?: number;
    // (undocumented)
    idToken: string;
    // (undocumented)
    refreshToken?: string;
}

// @public
export function oidc<ActionType extends ActionTypes = ActionTypes>(input: {
    config: OidcConfig;
    requestMiddleware?: RequestMiddleware<ActionType>[];
    logger?: {
        level: LogLevel;
        custom?: CustomLogger;
    };
    storage?: Partial<StorageConfig>;
}): Promise<{
    error: string;
    type: string;
    subscribe?: undefined;
    authorize?: undefined;
    token?: undefined;
    user?: undefined;
} | {
    subscribe: (listener: () => void) => Unsubscribe;
    authorize: {
        url: (options?: GetAuthorizationUrlOptions) => Promise<string | GenericError>;
        background: (options?: GetAuthorizationUrlOptions) => Promise<AuthorizationSuccess | AuthorizationError>;
    };
    token: {
        exchange: (code: string, state: string, options?: Partial<StorageConfig>) => Promise<OauthTokens | TokenExchangeErrorResponse | GenericError>;
        get: (options?: GetTokensOptions) => Promise<OauthTokens | TokenExchangeErrorResponse | AuthorizationError | GenericError>;
        revoke: () => Promise<GenericError | RevokeSuccessResult | RevokeErrorResult>;
    };
    user: {
        info: () => Promise<GenericError | UserInfoResponse>;
        logout: () => Promise<GenericError | LogoutSuccessResult | LogoutErrorResult>;
    };
    error?: undefined;
    type?: undefined;
}>;

// @public (undocumented)
export type OidcClient = Awaited<ReturnType<typeof oidc>>;

// @public (undocumented)
export interface OidcConfig extends AsyncLegacyConfigOptions {
    // (undocumented)
    clientId: string;
    // (undocumented)
    redirectUri: string;
    // (undocumented)
    responseType?: ResponseType_2;
    // (undocumented)
    scope: string;
    // (undocumented)
    serverConfig: {
        wellknown: string;
        timeout?: number;
    };
}

// @public (undocumented)
export type OptionalAuthorizeOptions = Partial<GetAuthorizationUrlOptions>;

export { RequestMiddleware }

export { ResponseType_2 as ResponseType }

// @public (undocumented)
export type RevokeErrorResult = {
    error: string;
    revokeResponse: GenericError | null;
    deleteResponse: GenericError | null;
};

// @public (undocumented)
export type RevokeSuccessResult = {
    revokeResponse: null;
    deleteResponse: null;
};

// @public (undocumented)
export type RootState = ReturnType<ClientStore['getState']>;

export { StorageConfig }

// @public (undocumented)
export interface TokenExchangeErrorResponse {
    // (undocumented)
    error: string;
    // (undocumented)
    message: string;
    // (undocumented)
    type: 'exchange_error' | 'network_error' | 'state_error' | 'unknown_error';
}

// @public (undocumented)
export interface TokenExchangeResponse {
    // (undocumented)
    access_token: string;
    // (undocumented)
    expires_in?: number;
    // (undocumented)
    id_token: string;
    // (undocumented)
    refresh_token?: string;
    // (undocumented)
    scope?: string;
    // (undocumented)
    token_type?: string;
}

// @public (undocumented)
export interface TokenRequestOptions {
    // (undocumented)
    code: string;
    // (undocumented)
    config: OidcConfig;
    // (undocumented)
    endpoint: string;
    // (undocumented)
    verifier?: string;
}

// @public (undocumented)
export type UserInfoResponse = {
    sub: string;
    [key: string]: unknown;
};

export { WellknownResponse }

// (No @packageDocumentation comment for this package)