api-core-lib 11.7.7 → 11.8.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 +6 -36
- package/dist/index.d.ts +6 -36
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method } from 'axios';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
3
|
+
interface Logger {
|
|
4
|
+
debug: (message: string, ...args: any[]) => void;
|
|
5
|
+
info: (message: string, ...args: any[]) => void;
|
|
6
|
+
warn: (message: string, ...args: any[]) => void;
|
|
7
|
+
error: (message: string, ...args: any[]) => void;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
/**
|
|
@@ -246,17 +241,6 @@ interface ApiClientConfig {
|
|
|
246
241
|
maxQueueSize?: number;
|
|
247
242
|
}
|
|
248
243
|
|
|
249
|
-
/**
|
|
250
|
-
* @file src/core/client.ts
|
|
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.
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Creates and configures a new Axios instance with advanced features.
|
|
259
|
-
*/
|
|
260
244
|
declare function createApiClient(config: ApiClientConfig): AxiosInstance;
|
|
261
245
|
|
|
262
246
|
/**
|
|
@@ -470,11 +454,6 @@ type ModuleActions<TModule extends ApiModuleConfig> = {
|
|
|
470
454
|
[K in keyof TModule['actions']]: TModule['actions'][K] extends ActionConfig<infer TInput, infer TOutput> ? ExecutableAction<TInput, TOutput> : never;
|
|
471
455
|
};
|
|
472
456
|
|
|
473
|
-
/**
|
|
474
|
-
* A factory function to create a reusable set of API services for a specific endpoint.
|
|
475
|
-
* It provides full CRUD operations plus advanced features like bulk deletion and file uploads,
|
|
476
|
-
* with intelligent, dynamic URL building.
|
|
477
|
-
*/
|
|
478
457
|
declare function createApiServices<T>(axiosInstance: AxiosInstance, baseEndpoint: string): {
|
|
479
458
|
get: (id?: string | number, config?: ActionOptions) => Promise<StandardResponse<T>>;
|
|
480
459
|
getWithQuery: (query: string, config?: RequestConfig) => Promise<StandardResponse<T>>;
|
|
@@ -561,16 +540,7 @@ declare class CacheManager {
|
|
|
561
540
|
}
|
|
562
541
|
declare const cacheManager: CacheManager;
|
|
563
542
|
|
|
564
|
-
|
|
565
|
-
* A smart response processor that normalizes API responses.
|
|
566
|
-
* It intelligently unwraps nested data from standard API envelopes
|
|
567
|
-
* (like { success: true, data: {...} }) and provides direct access
|
|
568
|
-
* to the core data, while still handling errors consistently.
|
|
569
|
-
*
|
|
570
|
-
* @param responseOrError The raw Axios response or a pre-processed ApiError.
|
|
571
|
-
* @returns A standardized `StandardResponse` object with direct access to `.data`.
|
|
572
|
-
*/
|
|
573
|
-
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError, log?: boolean) => StandardResponse<T>;
|
|
543
|
+
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
|
|
574
544
|
|
|
575
545
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
|
|
576
546
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method } from 'axios';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
3
|
+
interface Logger {
|
|
4
|
+
debug: (message: string, ...args: any[]) => void;
|
|
5
|
+
info: (message: string, ...args: any[]) => void;
|
|
6
|
+
warn: (message: string, ...args: any[]) => void;
|
|
7
|
+
error: (message: string, ...args: any[]) => void;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
/**
|
|
@@ -246,17 +241,6 @@ interface ApiClientConfig {
|
|
|
246
241
|
maxQueueSize?: number;
|
|
247
242
|
}
|
|
248
243
|
|
|
249
|
-
/**
|
|
250
|
-
* @file src/core/client.ts
|
|
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.
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Creates and configures a new Axios instance with advanced features.
|
|
259
|
-
*/
|
|
260
244
|
declare function createApiClient(config: ApiClientConfig): AxiosInstance;
|
|
261
245
|
|
|
262
246
|
/**
|
|
@@ -470,11 +454,6 @@ type ModuleActions<TModule extends ApiModuleConfig> = {
|
|
|
470
454
|
[K in keyof TModule['actions']]: TModule['actions'][K] extends ActionConfig<infer TInput, infer TOutput> ? ExecutableAction<TInput, TOutput> : never;
|
|
471
455
|
};
|
|
472
456
|
|
|
473
|
-
/**
|
|
474
|
-
* A factory function to create a reusable set of API services for a specific endpoint.
|
|
475
|
-
* It provides full CRUD operations plus advanced features like bulk deletion and file uploads,
|
|
476
|
-
* with intelligent, dynamic URL building.
|
|
477
|
-
*/
|
|
478
457
|
declare function createApiServices<T>(axiosInstance: AxiosInstance, baseEndpoint: string): {
|
|
479
458
|
get: (id?: string | number, config?: ActionOptions) => Promise<StandardResponse<T>>;
|
|
480
459
|
getWithQuery: (query: string, config?: RequestConfig) => Promise<StandardResponse<T>>;
|
|
@@ -561,16 +540,7 @@ declare class CacheManager {
|
|
|
561
540
|
}
|
|
562
541
|
declare const cacheManager: CacheManager;
|
|
563
542
|
|
|
564
|
-
|
|
565
|
-
* A smart response processor that normalizes API responses.
|
|
566
|
-
* It intelligently unwraps nested data from standard API envelopes
|
|
567
|
-
* (like { success: true, data: {...} }) and provides direct access
|
|
568
|
-
* to the core data, while still handling errors consistently.
|
|
569
|
-
*
|
|
570
|
-
* @param responseOrError The raw Axios response or a pre-processed ApiError.
|
|
571
|
-
* @returns A standardized `StandardResponse` object with direct access to `.data`.
|
|
572
|
-
*/
|
|
573
|
-
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError, log?: boolean) => StandardResponse<T>;
|
|
543
|
+
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
|
|
574
544
|
|
|
575
545
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
|
|
576
546
|
|