api-core-lib 12.7.4 → 12.8.4

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,41 +1,25 @@
1
- import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method } from 'axios';
2
- import { Dispatch, SetStateAction } from 'react';
1
+ import { InternalAxiosRequestConfig, AxiosResponse, AxiosRequestConfig, AxiosProgressEvent, AxiosInstance, Method, AxiosError } from 'axios';
2
+ import React$1, { Dispatch, SetStateAction } from 'react';
3
3
 
4
4
  /**
5
- * @file src/types.ts
6
- * @description This file serves as the central source for all data types and interfaces
7
- * used throughout the library. Defining types here ensures consistency, type safety,
8
- * and provides a clear API contract for the end-user.
9
- */
10
-
11
- /**
12
- * Defines the structure for pagination metadata returned by the API.
5
+ * يمثل معلومات الترقيم (Pagination) التي قد تعود من ה-API.
13
6
  */
14
7
  interface PaginationMeta {
15
8
  itemsPerPage: number;
16
9
  totalItems: number;
17
10
  currentPage: number;
18
11
  totalPages: number;
12
+ [key: string]: any;
19
13
  }
20
14
  /**
21
- * Represents the standard wrapper that an API might use for its responses.
22
- * @template T The type of the core data payload.
23
- */
24
- interface ApiResponse<T = any> {
25
- success?: boolean;
26
- data: T;
27
- message?: string;
28
- meta?: PaginationMeta;
29
- }
30
- /**
31
- * Defines the structure for a single field validation error.
15
+ * يمثل خطأ تحقق واحد لحقل معين.
32
16
  */
33
17
  interface ValidationError {
34
18
  field: string;
35
19
  message: string;
36
20
  }
37
21
  /**
38
- * Represents the unified error object produced by the library for any failed request.
22
+ * يمثل كائن الخطأ الموحد الذي تنتجه المكتبة.
39
23
  */
40
24
  interface ApiError {
41
25
  message: string;
@@ -45,12 +29,14 @@ interface ApiError {
45
29
  requestId?: string;
46
30
  }
47
31
  /**
48
- * The standardized, final response object that every library function returns.
49
- * This is the primary type developers will interact with.
50
- * @template T The type of the final, unwrapped data.
32
+ * الكائن القياسي والموحد الذي تعيده جميع دوال المكتبة.
33
+ * هذا هو النوع الأساسي الذي سيتعامل معه المطورون.
34
+ * @template T نوع البيانات الأساسية.
51
35
  */
52
36
  interface StandardResponse<T> {
53
37
  data: T | null;
38
+ links?: Record<string, string | null>;
39
+ meta?: PaginationMeta | Record<string, any>;
54
40
  rawResponse: any;
55
41
  error: ApiError | null;
56
42
  loading: boolean;
@@ -58,128 +44,30 @@ interface StandardResponse<T> {
58
44
  message?: string;
59
45
  validationErrors?: ValidationError[];
60
46
  }
61
- /**
62
- * Represents the set of authentication tokens managed by the library.
63
- */
64
47
  interface Tokens {
65
48
  accessToken: string | null;
66
49
  refreshToken: string | null;
67
50
  expiresAt?: number;
68
51
  tokenType?: string;
69
52
  }
70
- /**
71
- * An interface for a token manager, allowing the logic for token storage to be decoupled.
72
- * Consumers of the library can provide their own implementation (e.g., LocalStorage, Cookies).
73
- */
74
53
  interface TokenManager {
75
54
  getTokens(): Promise<Tokens>;
76
55
  setTokens(tokens: Tokens): Promise<void>;
77
56
  clearTokens(): Promise<void>;
78
- /**
79
- * Determines the operating context.
80
- * @returns `true` if tokens are in secure httpOnly cookies (server-side context).
81
- * @returns `false` if tokens are accessible from the client (e.g., localStorage).
82
- */
83
57
  isHttpOnly(): boolean;
84
58
  }
85
- /**
86
- * The context object passed to each middleware function in the pipeline.
87
- */
88
59
  interface MiddlewareContext {
89
60
  req: InternalAxiosRequestConfig;
90
61
  res?: AxiosResponse;
91
62
  error?: any;
92
63
  custom?: Record<string, any>;
93
64
  }
94
- /**
95
- * Defines the signature for a middleware function.
96
- */
97
65
  type Middleware = (context: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
98
- /**
99
- * Extends the default Axios request configuration with custom properties for the library.
100
- */
101
- interface RequestConfig extends AxiosRequestConfig {
102
- /** If true, the request will bypass the token injection logic. */
103
- isPublic?: boolean;
104
- /** A key for managing request cancellation. */
105
- cancelTokenKey?: string;
106
- /** Callback for upload progress events. */
107
- onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
108
- /** Callback for download progress events. */
109
- onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
110
- }
111
- /**
112
- * Defines a flexible query options interface for pagination, sorting, filtering, and searching.
113
- * Supports standard keys as well as any custom top-level query parameters.
114
- * @example { page: 1, limit: 10, search: 'term', status: 'published' }
115
- */
116
- interface QueryOptions {
117
- page?: number;
118
- limit?: number;
119
- search?: string;
120
- sortBy?: {
121
- key: string;
122
- direction: 'asc' | 'desc';
123
- }[];
124
- filter?: Record<string, any>;
125
- [key: string]: any;
126
- }
127
- /**
128
- * Defines additional options for action methods like create, update, or delete.
129
- */
130
- interface ActionOptions extends RequestConfig {
131
- /**
132
- * Overrides the default endpoint for a specific action. Useful for specialized routes.
133
- * @example update('123', { status: 'active' }, { endpoint: '/items/123/activate' })
134
- */
135
- endpoint?: string;
136
- /**
137
- * Overrides the `refetchAfterChange` setting for a single action.
138
- */
139
- refetch?: boolean;
140
- }
141
- /**
142
- * The main configuration object for the `useApi` hook.
143
- * @template T The data type the hook will manage.
144
- */
145
- interface UseApiConfig<T> {
146
- /** The base API endpoint for the resource (e.g., '/users'). */
147
- endpoint: string;
148
- /** Initial data to populate the state before the first fetch. */
149
- initialData?: T | null;
150
- /** Default query options to use for the initial fetch. */
151
- initialQuery?: QueryOptions;
152
- /** If false, the hook will not fetch data automatically on mount. */
153
- enabled?: boolean;
154
- /** If true, data will be refetched automatically after a successful create, update, or delete action. */
155
- refetchAfterChange?: boolean;
156
- /** A default `RequestConfig` to apply to all GET requests made by the hook. */
157
- requestConfig?: RequestConfig;
158
- /**
159
- * [NEW] كائن يحتوي على قيم المتغيرات في قالب المسار.
160
- */
161
- pathParams?: Record<string, string | number>;
162
- encodeQuery?: boolean;
163
- /** Callback function executed on a successful action. */
164
- onSuccess?: (message: string, data?: T) => void;
165
- /** Callback function executed on a failed action. */
166
- onError?: (message: string, error?: ApiError) => void;
167
- }
168
- /**
169
- * Defines the configuration for the automatic token refresh mechanism.
170
- */
66
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
171
67
  interface RefreshTokenConfig {
172
- /** The API path for the token refresh endpoint (e.g., '/auth/refresh'). */
173
68
  path: string;
174
- /** A function to build the request body for the refresh call. */
175
69
  buildRequestBody?: (refreshToken: string) => Record<string, any>;
176
- /** A function to build any custom headers for the refresh call. */
177
70
  buildRequestHeaders?: (currentTokens: Tokens) => Record<string, string>;
178
- /**
179
- * A function to extract the new tokens from the refresh API's response data.
180
- * @param responseData The raw data from the refresh API response.
181
- * @returns An object containing the new token details.
182
- */
183
71
  extractTokens: (responseData: any) => {
184
72
  accessToken: string;
185
73
  refreshToken?: string;
@@ -187,125 +75,44 @@ interface RefreshTokenConfig {
187
75
  tokenType?: string;
188
76
  };
189
77
  }
190
- /**
191
- * Defines the available levels for logging.
192
- * 'debug': Logs everything.
193
- * 'info': Logs standard requests and responses.
194
- * 'warn': Logs warnings and errors.
195
- * 'error': Logs only critical errors.
196
- * 'silent': Disables all logging.
197
- */
198
- type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
199
- /**
200
- * An interface for a custom logger, compatible with the standard `console` object.
201
- * It now includes a `debug` method for more granular logging.
202
- */
203
- /**
204
- * The main configuration object for the `createApiClient` factory function.
205
- */
206
78
  interface ApiClientConfig {
207
- /** The base URL for all API requests. */
208
79
  baseURL?: string;
209
- /** The token manager instance responsible for handling token storage. */
210
80
  tokenManager: TokenManager;
211
- /** The request timeout in milliseconds. */
212
81
  timeout?: number;
213
- /** Default headers to be sent with every request. */
214
82
  headers?: Record<string, string>;
215
- /** If true, cookies will be sent with cross-origin requests. */
216
83
  withCredentials?: boolean;
217
- /** Configuration for the automatic token refresh mechanism. */
218
84
  refreshTokenConfig?: RefreshTokenConfig;
219
- /** A callback function executed if the token refresh process fails. */
220
85
  onRefreshError?: (error: any) => void;
221
- /** A custom logger instance. Defaults to the browser `console`. */
222
- /** An array of middleware functions to be executed with every request. */
223
86
  middleware?: Middleware[];
224
- /**
225
- * Sets the verbosity of the internal logger.
226
- * @default 'info'
227
- */
228
87
  logLevel?: LogLevel;
229
- /**
230
- * If true, all requests will be treated as public by default.
231
- * A request can override this by explicitly setting `isPublic: false`.
232
- * @default false
233
- */
234
88
  defaultIsPublic?: boolean;
235
89
  maxTokenRefreshRetries?: number;
236
90
  maxQueueSize?: number;
237
91
  }
238
-
239
- declare function createApiClient(config: ApiClientConfig): AxiosInstance;
240
-
241
- /**
242
- * @file src/hooks/useApi.types.ts
243
- * @description This file defines the professional, publicly-facing types for the `useApi` hook,
244
- * providing a clean and stable contract for consumers.
245
- */
246
-
247
- /**
248
- * Configuration object for the `useApi` hook.
249
- * @template T The type of the data entity.
250
- */
251
- /**
252
- * The primary state object managed by the `useApi` hook.
253
- * It contains the fetched data, loading status, and any potential errors.
254
- * @template T The type of the data entity being managed.
255
- */
256
- type UseApiState<T> = StandardResponse<T>;
257
- /**
258
- * A collection of callable functions for performing CRUD and other operations.
259
- * These actions automatically handle state updates like loading and refetching.
260
- * @template T The type of the data entity being managed.
261
- */
262
- interface UseApiActions<T, TListItem = T extends (infer U)[] ? U : T> {
263
- fetch: (querryOptions?: QueryOptions) => Promise<void>;
264
- create: (newItem: Partial<TListItem>, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
265
- put: (id: string | number, item: TListItem, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
266
- update: (id: string | number, updatedItem: Partial<TListItem>, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
267
- remove: (id: string | number, options?: ActionOptions) => Promise<StandardResponse<any>>;
268
- bulkRemove: (ids: Array<string | number>, options?: ActionOptions) => Promise<StandardResponse<any>>;
92
+ interface RequestConfig extends AxiosRequestConfig {
93
+ isPublic?: boolean;
94
+ cancelTokenKey?: string;
95
+ onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
96
+ onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
269
97
  }
270
- /**
271
- * A collection of functions and properties for controlling the query parameters
272
- * used for fetching data, such as pagination, sorting, and filtering.
273
- */
274
- interface UseApiQuery {
275
- /** The current query options state. */
276
- options: QueryOptions;
277
- /** A function to set the entire query options object at once. */
278
- setOptions: React.Dispatch<React.SetStateAction<QueryOptions>>;
279
- /** Sets the current page number. */
280
- setPage: (page: number) => void;
281
- /** Sets the number of items per page and resets to the first page. */
282
- setLimit: (limit: number) => void;
283
- /** Sets the search term and resets to the first page. */
284
- setSearchTerm: (search: string) => void;
285
- /** Sets the sorting configuration. */
286
- setSorting: (sortBy: {
98
+ interface QueryOptions {
99
+ page?: number;
100
+ limit?: number;
101
+ search?: string;
102
+ sortBy?: {
287
103
  key: string;
288
104
  direction: 'asc' | 'desc';
289
- }[]) => void;
290
- /** Sets the filter object and resets to the first page. */
291
- setFilters: (filter: Record<string, any>) => void;
292
- /** Sets a single, custom query parameter. */
293
- setQueryParam: (key: string, value: any) => void;
294
- /** Resets the query options to their initial state. */
295
- reset: () => void;
105
+ }[];
106
+ filter?: Record<string, any>;
107
+ [key: string]: any;
108
+ }
109
+ interface ActionOptions extends RequestConfig {
110
+ endpoint?: string;
111
+ refetch?: boolean;
296
112
  }
297
113
  /**
298
- * The complete return type of the `useApi` hook.
299
- * It encapsulates the state, actions, and query controls for a given API resource.
300
- * @template T The type of the data entity being managed.
114
+ * يمثل إعدادات إجراء واحد داخل الموديول.
301
115
  */
302
- interface UseApiReturn<T> {
303
- state: UseApiState<T>;
304
- setState: React.Dispatch<React.SetStateAction<UseApiState<T>>>;
305
- actions: UseApiActions<T>;
306
- query: UseApiQuery;
307
- }
308
-
309
116
  interface ActionConfig<TInput = any, TOutput = any> {
310
117
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
311
118
  path: string;
@@ -313,10 +120,9 @@ interface ActionConfig<TInput = any, TOutput = any> {
313
120
  isList?: boolean;
314
121
  invalidates?: string[];
315
122
  }
316
- interface ApiModuleConfig {
317
- baseEndpoint: string;
318
- actions: Record<string, ActionConfig<any, any>>;
319
- }
123
+ /**
124
+ * خيارات الإعداد لهوك useApiModule.
125
+ */
320
126
  interface UseApiModuleOptions {
321
127
  onSuccess?: (actionName: string, message: string, data: any) => void;
322
128
  onError?: (actionName: string, message: string, error?: ApiError | null) => void;
@@ -325,39 +131,90 @@ interface UseApiModuleOptions {
325
131
  refetchOnWindowFocus?: boolean;
326
132
  pathParams?: Record<string, any>;
327
133
  }
134
+ /**
135
+ * [مُحدَّث] يمثل الحالة التفاعلية الكاملة لإجراء واحد.
136
+ * هذا هو النوع الذي يتم إرجاعه في `states` من الهوك.
137
+ */
328
138
  interface ActionState<TOutput> {
329
139
  data: TOutput | null;
140
+ links?: Record<string, string | null>;
141
+ meta?: PaginationMeta | Record<string, any>;
330
142
  error: ApiError | null;
331
143
  loading: boolean;
332
144
  success: boolean;
333
145
  called: boolean;
334
- response: StandardResponse<TOutput> | null;
146
+ message?: string;
147
+ validationErrors?: ValidationError[];
148
+ rawResponse: any | null;
335
149
  }
336
150
  /**
337
- * The unified object for a single action, containing its state, executor, and controls.
338
- * This is the new, more ergonomic return structure.
151
+ * الكائن الموحد الذي يتم إرجاعه لكل إجراء، ويحتوي على حالته ومنفذه وأدوات التحكم.
339
152
  */
340
153
  interface ExecutableAction<TInput, TOutput> {
341
- /** The reactive state for this specific action. */
342
154
  state: ActionState<TOutput>;
343
- /** The stable function to execute the API call. */
344
155
  execute: (input?: TInput, options?: {
345
156
  pathParams?: Record<string, any>;
346
157
  config?: AxiosRequestConfig;
347
158
  query?: QueryOptions;
348
159
  }) => Promise<StandardResponse<TOutput>>;
349
- /** A stable function to reset the action's state to its initial value. */
350
160
  reset: () => void;
351
- /** Query controls (pagination, sorting, etc.) available only if `isList: true`. */
352
161
  query?: UseApiQuery;
353
162
  }
354
163
  /**
355
- * The final, fully-typed object returned by the useApiModule hook.
356
- * It's a dictionary of executable actions.
164
+ * النوع النهائي الذي يعيده هوك useApiModule.
357
165
  */
358
166
  type ModuleActions<TModule extends ApiModuleConfig> = {
359
167
  [K in keyof TModule['actions']]: TModule['actions'][K] extends ActionConfig<infer TInput, infer TOutput> ? ExecutableAction<TInput, TOutput> : never;
360
168
  };
169
+ type UseApiState<T> = StandardResponse<T>;
170
+ interface UseApiQuery {
171
+ /** The current query options state. */
172
+ options: QueryOptions;
173
+ /** A function to set the entire query options object at once. */
174
+ setOptions: React$1.Dispatch<React$1.SetStateAction<QueryOptions>>;
175
+ /** Sets the current page number. */
176
+ setPage: (page: number) => void;
177
+ /** Sets the number of items per page and resets to the first page. */
178
+ setLimit: (limit: number) => void;
179
+ /** Sets the search term and resets to the first page. */
180
+ setSearchTerm: (search: string) => void;
181
+ /** Sets the sorting configuration. */
182
+ setSorting: (sortBy: {
183
+ key: string;
184
+ direction: 'asc' | 'desc';
185
+ }[]) => void;
186
+ /** Sets the filter object and resets to the first page. */
187
+ setFilters: (filter: Record<string, any>) => void;
188
+ /** Sets a single, custom query parameter. */
189
+ setQueryParam: (key: string, value: any) => void;
190
+ /** Resets the query options to their initial state. */
191
+ reset: () => void;
192
+ }
193
+ interface UseApiConfig<T> {
194
+ endpoint: string;
195
+ initialData?: T | null;
196
+ initialQuery?: QueryOptions;
197
+ enabled?: boolean;
198
+ refetchAfterChange?: boolean;
199
+ requestConfig?: RequestConfig;
200
+ pathParams?: Record<string, string | number>;
201
+ encodeQuery?: boolean;
202
+ onSuccess?: (message: string, data?: T) => void;
203
+ onError?: (message: string, error?: ApiError) => void;
204
+ }
205
+ interface ActionConfigModule<TInput = any, TOutput = any> {
206
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
207
+ path: string;
208
+ description?: string;
209
+ isList?: boolean;
210
+ invalidates?: string[];
211
+ }
212
+ interface ApiModuleConfig {
213
+ baseEndpoint: string;
214
+ actions: Record<string, ActionConfigModule<any, any>>;
215
+ }
216
+
217
+ declare function createApiClient(config: ApiClientConfig): AxiosInstance;
361
218
 
362
219
  /**
363
220
  * A factory function to create a reusable set of API services for a specific endpoint.
@@ -376,23 +233,12 @@ declare function createApiServices<T>(axiosInstance: AxiosInstance, baseEndpoint
376
233
  };
377
234
 
378
235
  /**
379
- * @file src/core/utils.ts
380
- * @description
381
- * يحتوي هذا الملف على مجموعة من الدوال المساعدة المستخدمة في جميع أنحاء المكتبة،
382
- * مثل بناء سلاسل الاستعلام (query strings) وإدارة إلغاء الطلبات،
383
- * بالإضافة إلى دوال التحقق من الأنواع (type guards).
384
- */
385
-
386
- interface BuildQueryOptions {
387
- encode?: boolean;
388
- }
389
- /**
390
- * يبني سلسلة استعلام (query string) من كائن الخيارات.
236
+ * [نسخة مطورة] يبني سلسلة استعلام (query string) من كائن الخيارات.
237
+ * يدعم الآن الفلاتر المتداخلة (filter[key]=value) والترتيب المتعدد.
391
238
  * @param options - كائن خيارات الاستعلام (فلترة, ترتيب, ...).
392
- * @param config - إعدادات إضافية مثل التحكم في التشفير.
393
239
  * @returns سلسلة استعلام جاهزة للإضافة للرابط.
394
240
  */
395
- declare function buildPaginateQuery(options: QueryOptions, config?: BuildQueryOptions): string;
241
+ declare function buildPaginateQuery(options: QueryOptions): string;
396
242
 
397
243
  /**
398
244
  * Defines a single custom API action.
@@ -439,23 +285,23 @@ declare class CacheManager {
439
285
  set<T>(key: string, data: T, duration?: number): void;
440
286
  get<T>(key: string): T | null;
441
287
  /**
442
- * [دالة جديدة] تعيد عنصر الـ Cache بالكامل (البيانات + معلومات إضافية)
443
- * دون حذفه عند انتهاء الصلاحية. هذا يسمح لنا بتطبيق منطق stale-while-revalidate.
288
+ * [FIX] تم تحويلها إلى دالة عامة (generic) لتعيد النوع الصحيح.
289
+ * الآن بدلًا من إرجاع CacheItem<unknown>، ستُرجع CacheItem<T>.
444
290
  */
445
291
  getWithMeta<T>(key: string): CacheItem<T> | null;
446
292
  delete(key: string): void;
447
293
  clear(): void;
448
- /**
449
- * [دالة جديدة] تقوم بإبطال (حذف) جميع عناصر الـ Cache التي تبدأ ببادئة معينة.
450
- * أساسية لعملية invalidation التلقائية.
451
- */
452
294
  invalidateByPrefix(prefix: string): void;
453
295
  }
454
296
  declare const cacheManager: CacheManager;
455
297
 
456
- declare const processResponse: <T>(responseOrError: AxiosResponse<any> | ApiError) => StandardResponse<T>;
298
+ /**
299
+ * [النسخة النهائية والمضمونة]
300
+ * تستخدم دوال حماية النوع المخصصة للقضاء على أخطاء 'never' بشكل نهائي.
301
+ */
302
+ declare const processResponse: <T>(responseOrError: AxiosResponse<any> | AxiosError) => StandardResponse<T>;
457
303
 
458
- declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): UseApiReturn<T>;
304
+ declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): any;
459
305
 
460
306
  declare function useApiModule<TModule extends ApiModuleConfig>(axiosInstance: AxiosInstance, moduleConfig: TModule, options?: UseApiModuleOptions): any;
461
307
 
@@ -561,6 +407,41 @@ type EffectCallback = () => (void | (() => void));
561
407
  type DependencyList = readonly any[];
562
408
  declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): void;
563
409
 
410
+ /**
411
+ * @file src/hooks/useApi.types.ts
412
+ * @description This file defines the professional, publicly-facing types for the `useApi` hook,
413
+ * providing a clean and stable contract for consumers.
414
+ */
415
+
416
+ /**
417
+ * Configuration object for the `useApi` hook.
418
+ * @template T The type of the data entity.
419
+ */
420
+ /**
421
+ * A collection of callable functions for performing CRUD and other operations.
422
+ * These actions automatically handle state updates like loading and refetching.
423
+ * @template T The type of the data entity being managed.
424
+ */
425
+ interface UseApiActions<T, TListItem = T extends (infer U)[] ? U : T> {
426
+ fetch: (querryOptions?: QueryOptions) => Promise<void>;
427
+ create: (newItem: Partial<TListItem>, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
428
+ put: (id: string | number, item: TListItem, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
429
+ update: (id: string | number, updatedItem: Partial<TListItem>, options?: ActionOptions) => Promise<StandardResponse<TListItem>>;
430
+ remove: (id: string | number, options?: ActionOptions) => Promise<StandardResponse<any>>;
431
+ bulkRemove: (ids: Array<string | number>, options?: ActionOptions) => Promise<StandardResponse<any>>;
432
+ }
433
+ /**
434
+ * The complete return type of the `useApi` hook.
435
+ * It encapsulates the state, actions, and query controls for a given API resource.
436
+ * @template T The type of the data entity being managed.
437
+ */
438
+ interface UseApiReturn<T> {
439
+ state: UseApiState<T>;
440
+ setState: React.Dispatch<React.SetStateAction<UseApiState<T>>>;
441
+ actions: UseApiActions<T>;
442
+ query: UseApiQuery;
443
+ }
444
+
564
445
  type ApiResourceStatus = 'idle' | 'loading' | 'success' | 'error';
565
446
  interface UseApiResourceState<T> {
566
447
  data: T | T[] | null;
@@ -607,4 +488,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
607
488
  setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
608
489
  }
609
490
 
610
- 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 UseApiQuery, type UseApiRecordActions, type UseApiRecordConfig, type UseApiRecordReturn, type UseApiRecordState, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule, useApiRecord, useDeepCompareEffect };
491
+ export { type ActionConfig, type ActionConfigModule, type ActionOptions, type ActionState, type ApiClientConfig, type ApiError, type ApiModuleConfig, type ApiResourceStatus, 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 UseApiQuery, type UseApiRecordActions, type UseApiRecordConfig, type UseApiRecordReturn, type UseApiRecordState, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, createApiActions, createApiClient, createApiServices, processResponse, useApi, useApiModule, useApiRecord, useDeepCompareEffect };