UNPKG

auth0-api-client

Version:

A Node.js module for making authenticated API calls using Auth0 Machine-to-Machine JWT tokens

62 lines 1.67 kB
import { AxiosRequestConfig } from 'axios'; export interface WebDataExporterConfig { auth0Domain: string; auth0ClientId: string; auth0ClientSecret: string; auth0Audience: string; apiBaseUrl: string; } export interface RequestOptions { timeout?: number; headers?: Record<string, string>; axiosConfig?: AxiosRequestConfig; } export interface ApiResponse<T = any> { success: true; data: T; status: number; headers: any; } export interface ApiError { success: false; error: { message: string; status?: number; data?: any; type?: string; }; } export type ApiResult<T = any> = ApiResponse<T> | ApiError; export declare enum EventType { LOGIN = "login", LOGOUT = "logout", SIGNUP = "signup", PASSWORD_CHANGE = "password_change", PROFILE_UPDATE = "profile_update", API_ACCESS = "api_access" } export declare class Auth0Event { message: string; timestamp: Date; eventType: EventType; constructor(message: string, timestamp: Date, eventType: EventType); toJSON(): { message: string; timestamp: string; eventType: EventType; }; } export declare class WebDataExporter { private auth0Config; private apiBaseUrl; private accessToken; private tokenExpiry; private managementClient; constructor(config: WebDataExporterConfig); private validateConfig; getAccessToken(): Promise<string>; postData<T = any>(endpoint: string, data: Auth0Event, options?: RequestOptions): Promise<ApiResult<T>>; clearToken(): void; } export default WebDataExporter; //# sourceMappingURL=index.d.ts.map