/** * Logger interface for the Medusa client. */ export type Logger = { /** * Log error messages. */ error: (...messages: string[]) => void; /** * Log warning messages. */ warn: (...messages: string[]) => void; /** * Log info messages. */ info: (...messages: string[]) => void; /** * Log debug messages. */ debug: (...messages: string[]) => void; }; /** * Configuration options for the Medusa client. */ export type Config = { /** * The base URL of the Medusa server. */ baseUrl: string; /** * Default headers to include with every request. */ globalHeaders?: ClientHeaders; /** * The publishable API key for storefront authentication. */ publishableKey?: string; /** * The secret API key for admin authentication. */ apiKey?: string; /** * Authentication configuration. */ auth?: { /** * The authentication type: "jwt" or "session". */ type?: "jwt" | "session"; /** * The storage key for JWT tokens. */ jwtTokenStorageKey?: string; /** * The storage method for JWT tokens. */ jwtTokenStorageMethod?: "local" | "session" | "memory" | "custom" | "nostore"; /** * The credentials mode for fetch requests. */ fetchCredentials?: "include" | "omit" | "same-origin"; /** * Custom storage implementation for JWT tokens. */ storage?: CustomStorage; }; /** * Custom logger instance. */ logger?: Logger; /** * Whether to enable debug logging. */ debug?: boolean; }; /** * A type that can be either a value or a promise resolving to that value. */ export type Awaitable = T | Promise; /** * Custom storage interface for JWT token storage. */ export interface CustomStorage { /** * Retrieve an item from storage. */ getItem(key: string): Awaitable; /** * Store an item in storage. */ setItem(key: string, value: string): Awaitable; /** * Remove an item from storage. */ removeItem(key: string): Awaitable; } /** * Parameters for the native fetch function. */ export type FetchParams = Parameters; /** * Headers object for client requests, with optional caching tags for Next.js. */ export type ClientHeaders = Record; /** * Input parameter for fetch operations. */ export type FetchInput = FetchParams[0]; /** * Arguments for fetch operations with extended options. */ export type FetchArgs = Omit & { /** * Query parameters to append to the URL. */ query?: Record; /** * Request headers. */ headers?: ClientHeaders; /** * Request body data. */ body?: RequestInit["body"] | Record; }; /** * Client fetch function type. */ export type ClientFetch = (input: FetchInput, init?: FetchArgs) => Promise; /** * Server-sent event message structure. */ export interface ServerSentEventMessage { /** Ignored by the client. */ comment?: string; /** A string identifying the type of event described. */ event?: string; /** The data field for the message. Split by new lines. */ data?: string; /** The event ID to set the {@linkcode EventSource} object's last event ID value. */ id?: string | number; /** The reconnection time. */ retry?: number; } export interface FetchStreamResponse { stream: AsyncGenerator; abort: () => void; } //# sourceMappingURL=types.d.ts.map