api-core-lib 11.7.6 → 11.7.7

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method } from 'axios';
2
2
 
3
+ declare class Logger {
4
+ private level;
5
+ private isDev;
6
+ constructor(level?: LogLevel);
7
+ private getColor;
8
+ private shouldLog;
9
+ debug(message: string, ...optional: any[]): void;
10
+ info(message: string, ...optional: any[]): void;
11
+ warn(message: string, ...optional: any[]): void;
12
+ error(message: string, ...optional: any[]): void;
13
+ }
14
+
3
15
  /**
4
16
  * @file src/types.ts
5
17
  * @description This file serves as the central source for all data types and interfaces
@@ -192,25 +204,11 @@ interface RefreshTokenConfig {
192
204
  * 'error': Logs only critical errors.
193
205
  * 'silent': Disables all logging.
194
206
  */
195
- type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent' | "log";
207
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
196
208
  /**
197
209
  * An interface for a custom logger, compatible with the standard `console` object.
198
210
  * It now includes a `debug` method for more granular logging.
199
211
  */
200
- interface Logger {
201
- /** Logs a standard message. In our wrapper, this is often an alias for `info` or `debug`. */
202
- log(message?: any, ...optionalParams: any[]): void;
203
- /** Logs an informational message. */
204
- info(message?: any, ...optionalParams: any[]): void;
205
- /** Logs a warning message. */
206
- warn(message?: any, ...optionalParams: any[]): void;
207
- /** Logs an error message. */
208
- error(message?: any, ...optionalParams: any[]): void;
209
- /**
210
- * Logs a debug message, typically for verbose, development-only output.
211
- */
212
- debug(message?: any, ...optionalParams: any[]): void;
213
- }
214
212
  /**
215
213
  * The main configuration object for the `createApiClient` factory function.
216
214
  */
@@ -572,7 +570,7 @@ declare const cacheManager: CacheManager;
572
570
  * @param responseOrError The raw Axios response or a pre-processed ApiError.
573
571
  * @returns A standardized `StandardResponse` object with direct access to `.data`.
574
572
  */
575
- declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
573
+ declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError, log?: boolean) => StandardResponse<T>;
576
574
 
577
575
  declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
578
576
 
@@ -629,4 +627,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
629
627
  setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
630
628
  }
631
629
 
632
- export { type ActionConfig, type ActionOptions, type ActionState, type ApiClientConfig, type ApiError, type ApiModuleConfig, type ApiResourceStatus, type ApiResponse, type ExecutableAction, type LogLevel, type Logger, type Middleware, type MiddlewareContext, type ModuleActions, type PaginationMeta, type QueryOptions, type RefreshTokenConfig, type RequestConfig, type StandardResponse, type TokenManager, type Tokens, type UseApiActions, type UseApiConfig, type UseApiModuleOptions, type UseApiModuleReturn, type UseApiQuery, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule };
630
+ export { type ActionConfig, type ActionOptions, type ActionState, type ApiClientConfig, type ApiError, type ApiModuleConfig, type ApiResourceStatus, type ApiResponse, type ExecutableAction, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type PaginationMeta, type QueryOptions, type RefreshTokenConfig, type RequestConfig, type StandardResponse, type TokenManager, type Tokens, type UseApiActions, type UseApiConfig, type UseApiModuleOptions, type UseApiModuleReturn, type UseApiQuery, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method } from 'axios';
2
2
 
3
+ declare class Logger {
4
+ private level;
5
+ private isDev;
6
+ constructor(level?: LogLevel);
7
+ private getColor;
8
+ private shouldLog;
9
+ debug(message: string, ...optional: any[]): void;
10
+ info(message: string, ...optional: any[]): void;
11
+ warn(message: string, ...optional: any[]): void;
12
+ error(message: string, ...optional: any[]): void;
13
+ }
14
+
3
15
  /**
4
16
  * @file src/types.ts
5
17
  * @description This file serves as the central source for all data types and interfaces
@@ -192,25 +204,11 @@ interface RefreshTokenConfig {
192
204
  * 'error': Logs only critical errors.
193
205
  * 'silent': Disables all logging.
194
206
  */
195
- type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent' | "log";
207
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
196
208
  /**
197
209
  * An interface for a custom logger, compatible with the standard `console` object.
198
210
  * It now includes a `debug` method for more granular logging.
199
211
  */
200
- interface Logger {
201
- /** Logs a standard message. In our wrapper, this is often an alias for `info` or `debug`. */
202
- log(message?: any, ...optionalParams: any[]): void;
203
- /** Logs an informational message. */
204
- info(message?: any, ...optionalParams: any[]): void;
205
- /** Logs a warning message. */
206
- warn(message?: any, ...optionalParams: any[]): void;
207
- /** Logs an error message. */
208
- error(message?: any, ...optionalParams: any[]): void;
209
- /**
210
- * Logs a debug message, typically for verbose, development-only output.
211
- */
212
- debug(message?: any, ...optionalParams: any[]): void;
213
- }
214
212
  /**
215
213
  * The main configuration object for the `createApiClient` factory function.
216
214
  */
@@ -572,7 +570,7 @@ declare const cacheManager: CacheManager;
572
570
  * @param responseOrError The raw Axios response or a pre-processed ApiError.
573
571
  * @returns A standardized `StandardResponse` object with direct access to `.data`.
574
572
  */
575
- declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
573
+ declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError, log?: boolean) => StandardResponse<T>;
576
574
 
577
575
  declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
578
576
 
@@ -629,4 +627,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
629
627
  setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
630
628
  }
631
629
 
632
- export { type ActionConfig, type ActionOptions, type ActionState, type ApiClientConfig, type ApiError, type ApiModuleConfig, type ApiResourceStatus, type ApiResponse, type ExecutableAction, type LogLevel, type Logger, type Middleware, type MiddlewareContext, type ModuleActions, type PaginationMeta, type QueryOptions, type RefreshTokenConfig, type RequestConfig, type StandardResponse, type TokenManager, type Tokens, type UseApiActions, type UseApiConfig, type UseApiModuleOptions, type UseApiModuleReturn, type UseApiQuery, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule };
630
+ export { type ActionConfig, type ActionOptions, type ActionState, type ApiClientConfig, type ApiError, type ApiModuleConfig, type ApiResourceStatus, type ApiResponse, type ExecutableAction, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type PaginationMeta, type QueryOptions, type RefreshTokenConfig, type RequestConfig, type StandardResponse, type TokenManager, type Tokens, type UseApiActions, type UseApiConfig, type UseApiModuleOptions, type UseApiModuleReturn, type UseApiQuery, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule };