api-core-lib 11.5.5 → 11.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -88,6 +88,7 @@ interface MiddlewareContext {
|
|
|
88
88
|
req: InternalAxiosRequestConfig;
|
|
89
89
|
res?: AxiosResponse;
|
|
90
90
|
error?: any;
|
|
91
|
+
logger: Logger;
|
|
91
92
|
custom?: Record<string, any>;
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
@@ -229,27 +230,28 @@ interface ApiClientConfig {
|
|
|
229
230
|
/** A callback function executed if the token refresh process fails. */
|
|
230
231
|
onRefreshError?: (error: any) => void;
|
|
231
232
|
/** A custom logger instance. Defaults to the browser `console`. */
|
|
233
|
+
logger?: Logger;
|
|
232
234
|
/** An array of middleware functions to be executed with every request. */
|
|
233
235
|
middleware?: Middleware[];
|
|
234
236
|
/**
|
|
235
237
|
* Sets the verbosity of the internal logger.
|
|
236
238
|
* @default 'info'
|
|
237
239
|
*/
|
|
240
|
+
logLevel?: LogLevel;
|
|
238
241
|
/**
|
|
239
242
|
* If true, all requests will be treated as public by default.
|
|
240
243
|
* A request can override this by explicitly setting `isPublic: false`.
|
|
241
244
|
* @default false
|
|
242
245
|
*/
|
|
243
|
-
logRequests?: boolean;
|
|
244
246
|
defaultIsPublic?: boolean;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
/**
|
|
248
250
|
* @file src/core/client.ts
|
|
249
|
-
* @description
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
251
|
+
* @description This is the heart of the API client library.
|
|
252
|
+
* The `createApiClient` function constructs and configures a sophisticated Axios instance.
|
|
253
|
+
* It features intelligent, security-first token management, a flexible middleware system,
|
|
254
|
+
* and customizable logging, all designed to work seamlessly in modern web frameworks like Next.js.
|
|
253
255
|
*/
|
|
254
256
|
|
|
255
257
|
/**
|
|
@@ -568,7 +570,7 @@ declare const cacheManager: CacheManager;
|
|
|
568
570
|
* @param responseOrError The raw Axios response or a pre-processed ApiError.
|
|
569
571
|
* @returns A standardized `StandardResponse` object with direct access to `.data`.
|
|
570
572
|
*/
|
|
571
|
-
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError
|
|
573
|
+
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
|
|
572
574
|
|
|
573
575
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
|
|
574
576
|
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,7 @@ interface MiddlewareContext {
|
|
|
88
88
|
req: InternalAxiosRequestConfig;
|
|
89
89
|
res?: AxiosResponse;
|
|
90
90
|
error?: any;
|
|
91
|
+
logger: Logger;
|
|
91
92
|
custom?: Record<string, any>;
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
@@ -229,27 +230,28 @@ interface ApiClientConfig {
|
|
|
229
230
|
/** A callback function executed if the token refresh process fails. */
|
|
230
231
|
onRefreshError?: (error: any) => void;
|
|
231
232
|
/** A custom logger instance. Defaults to the browser `console`. */
|
|
233
|
+
logger?: Logger;
|
|
232
234
|
/** An array of middleware functions to be executed with every request. */
|
|
233
235
|
middleware?: Middleware[];
|
|
234
236
|
/**
|
|
235
237
|
* Sets the verbosity of the internal logger.
|
|
236
238
|
* @default 'info'
|
|
237
239
|
*/
|
|
240
|
+
logLevel?: LogLevel;
|
|
238
241
|
/**
|
|
239
242
|
* If true, all requests will be treated as public by default.
|
|
240
243
|
* A request can override this by explicitly setting `isPublic: false`.
|
|
241
244
|
* @default false
|
|
242
245
|
*/
|
|
243
|
-
logRequests?: boolean;
|
|
244
246
|
defaultIsPublic?: boolean;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
/**
|
|
248
250
|
* @file src/core/client.ts
|
|
249
|
-
* @description
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
251
|
+
* @description This is the heart of the API client library.
|
|
252
|
+
* The `createApiClient` function constructs and configures a sophisticated Axios instance.
|
|
253
|
+
* It features intelligent, security-first token management, a flexible middleware system,
|
|
254
|
+
* and customizable logging, all designed to work seamlessly in modern web frameworks like Next.js.
|
|
253
255
|
*/
|
|
254
256
|
|
|
255
257
|
/**
|
|
@@ -568,7 +570,7 @@ declare const cacheManager: CacheManager;
|
|
|
568
570
|
* @param responseOrError The raw Axios response or a pre-processed ApiError.
|
|
569
571
|
* @returns A standardized `StandardResponse` object with direct access to `.data`.
|
|
570
572
|
*/
|
|
571
|
-
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError
|
|
573
|
+
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
|
|
572
574
|
|
|
573
575
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
|
|
574
576
|
|