api-core-lib 12.0.4 → 12.0.6
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/apiModule.types-2yhaJWN3.d.cts +257 -0
- package/dist/apiModule.types-2yhaJWN3.d.ts +257 -0
- package/dist/index.cjs +1151 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.mts → index.d.cts} +59 -310
- package/dist/index.d.ts +59 -310
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +342 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +35 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +1 -0
- package/dist/server.js.map +1 -0
- package/package.json +29 -19
- package/dist/index.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,262 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, Method, AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { A as ApiClientConfig, a as ActionConfigModule, S as StandardResponse, b as ActionOptions, R as RequestConfig, c as ActionStateModule, Q as QueryOptions, U as UseApiConfig, d as ApiError, e as ApiModuleConfig, f as UseApiModuleOptions, g as UseApiModuleReturn, h as UseApiQuery, L as LogLevel } from './apiModule.types-2yhaJWN3.js';
|
|
3
|
+
export { l as ActionConfig, n as ActionState, E as ExecutableAction, o as ExecuteOptions, I as InputOf, j as Middleware, M as MiddlewareContext, p as ModuleActions, q as ModuleStates, O as OutputOf, P as PaginationMeta, k as RefreshTokenConfig, i as TokenManager, T as Tokens, m as UseApiState, V as ValidationError } from './apiModule.types-2yhaJWN3.js';
|
|
2
4
|
import * as React$1 from 'react';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* يمثل معلومات الترقيم (Pagination) التي قد تعود من ה-API.
|
|
7
|
-
*/
|
|
8
|
-
interface PaginationMeta {
|
|
9
|
-
itemsPerPage: number;
|
|
10
|
-
totalItems: number;
|
|
11
|
-
currentPage: number;
|
|
12
|
-
totalPages: number;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* يمثل خطأ تحقق واحد لحقل معين.
|
|
17
|
-
*/
|
|
18
|
-
interface ValidationError {
|
|
19
|
-
field: string;
|
|
20
|
-
message: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* يمثل كائن الخطأ الموحد الذي تنتجه المكتبة.
|
|
24
|
-
*/
|
|
25
|
-
interface ApiError {
|
|
26
|
-
message: string;
|
|
27
|
-
status: number;
|
|
28
|
-
code?: string;
|
|
29
|
-
errors?: ValidationError[];
|
|
30
|
-
requestId?: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* الكائن القياسي والموحد الذي تعيده جميع دوال المكتبة.
|
|
34
|
-
* هذا هو النوع الأساسي الذي سيتعامل معه المطورون.
|
|
35
|
-
* @template T نوع البيانات الأساسية.
|
|
36
|
-
*/
|
|
37
|
-
interface StandardResponse<T> {
|
|
38
|
-
data: T | null;
|
|
39
|
-
links?: Record<string, string | null>;
|
|
40
|
-
meta?: PaginationMeta | Record<string, any>;
|
|
41
|
-
rawResponse: any;
|
|
42
|
-
error: ApiError | null;
|
|
43
|
-
loading: boolean;
|
|
44
|
-
success: boolean;
|
|
45
|
-
message?: string;
|
|
46
|
-
validationErrors?: ValidationError[];
|
|
47
|
-
}
|
|
48
|
-
interface Tokens {
|
|
49
|
-
accessToken: string | null;
|
|
50
|
-
refreshToken: string | null;
|
|
51
|
-
expiresAt?: number;
|
|
52
|
-
tokenType?: string;
|
|
53
|
-
}
|
|
54
|
-
interface TokenManager {
|
|
55
|
-
getTokens(): Promise<Tokens>;
|
|
56
|
-
setTokens(tokens: Tokens): Promise<void>;
|
|
57
|
-
clearTokens(): Promise<void>;
|
|
58
|
-
isHttpOnly(): boolean;
|
|
59
|
-
}
|
|
60
|
-
interface MiddlewareContext {
|
|
61
|
-
req: InternalAxiosRequestConfig;
|
|
62
|
-
res?: AxiosResponse;
|
|
63
|
-
error?: any;
|
|
64
|
-
custom?: Record<string, any>;
|
|
65
|
-
}
|
|
66
|
-
type Middleware = (context: MiddlewareContext, next: () => Promise<void>) => Promise<void>;
|
|
67
|
-
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
68
|
-
interface RefreshTokenConfig {
|
|
69
|
-
path: string;
|
|
70
|
-
buildRequestBody?: (refreshToken: string) => Record<string, any>;
|
|
71
|
-
buildRequestHeaders?: (currentTokens: Tokens) => Record<string, string>;
|
|
72
|
-
extractTokens: (responseData: any) => {
|
|
73
|
-
accessToken: string;
|
|
74
|
-
refreshToken?: string;
|
|
75
|
-
expiresIn: number;
|
|
76
|
-
tokenType?: string;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
interface ApiClientConfig {
|
|
80
|
-
baseURL?: string;
|
|
81
|
-
tokenManager: TokenManager;
|
|
82
|
-
timeout?: number;
|
|
83
|
-
headers?: Record<string, string>;
|
|
84
|
-
withCredentials?: boolean;
|
|
85
|
-
refreshTokenConfig?: RefreshTokenConfig;
|
|
86
|
-
onRefreshError?: (error: any) => void;
|
|
87
|
-
middleware?: Middleware[];
|
|
88
|
-
logLevel?: LogLevel;
|
|
89
|
-
defaultIsPublic?: boolean;
|
|
90
|
-
maxTokenRefreshRetries?: number;
|
|
91
|
-
maxQueueSize?: number;
|
|
92
|
-
}
|
|
93
|
-
interface RequestConfig extends AxiosRequestConfig {
|
|
94
|
-
isPublic?: boolean;
|
|
95
|
-
cancelTokenKey?: string;
|
|
96
|
-
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|
97
|
-
onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;
|
|
98
|
-
}
|
|
99
|
-
interface QueryOptions {
|
|
100
|
-
page?: number;
|
|
101
|
-
limit?: number;
|
|
102
|
-
search?: string;
|
|
103
|
-
sortBy?: {
|
|
104
|
-
key: string;
|
|
105
|
-
direction: 'asc' | 'desc';
|
|
106
|
-
}[];
|
|
107
|
-
filter?: Record<string, any>;
|
|
108
|
-
[key: string]: any;
|
|
109
|
-
}
|
|
110
|
-
interface ActionOptions extends RequestConfig {
|
|
111
|
-
endpoint?: string;
|
|
112
|
-
refetch?: boolean;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* يمثل إعدادات إجراء واحد داخل الموديول.
|
|
116
|
-
*/
|
|
117
|
-
interface ActionConfig<TInput = any, TOutput = any> {
|
|
118
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
119
|
-
path: string;
|
|
120
|
-
description?: string;
|
|
121
|
-
isList?: boolean;
|
|
122
|
-
invalidates?: string[];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* [مُحدَّث] يمثل الحالة التفاعلية الكاملة لإجراء واحد.
|
|
126
|
-
* هذا هو النوع الذي يتم إرجاعه في `states` من الهوك.
|
|
127
|
-
*/
|
|
128
|
-
interface ActionStateModule<TOutput> {
|
|
129
|
-
data: TOutput | null;
|
|
130
|
-
links?: Record<string, string | null>;
|
|
131
|
-
meta?: PaginationMeta | Record<string, any>;
|
|
132
|
-
error: ApiError | null;
|
|
133
|
-
loading: boolean;
|
|
134
|
-
success: boolean;
|
|
135
|
-
called: boolean;
|
|
136
|
-
message?: string;
|
|
137
|
-
validationErrors?: ValidationError[];
|
|
138
|
-
rawResponse: any | null;
|
|
139
|
-
isStale?: boolean;
|
|
140
|
-
lastSuccessAt?: number;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* الكائن الموحد الذي يتم إرجاعه لكل إجراء، ويحتوي على حالته ومنفذه وأدوات التحكم.
|
|
144
|
-
*/
|
|
145
|
-
interface ExecutableAction<TInput, TOutput> {
|
|
146
|
-
state: ActionStateModule<TOutput>;
|
|
147
|
-
execute: (input?: TInput, options?: {
|
|
148
|
-
pathParams?: Record<string, any>;
|
|
149
|
-
config?: AxiosRequestConfig;
|
|
150
|
-
query?: QueryOptions;
|
|
151
|
-
}) => Promise<StandardResponse<TOutput>>;
|
|
152
|
-
reset: () => void;
|
|
153
|
-
query?: UseApiQuery;
|
|
154
|
-
}
|
|
155
|
-
type UseApiState<T> = StandardResponse<T>;
|
|
156
|
-
interface UseApiQuery {
|
|
157
|
-
/** The current query options state. */
|
|
158
|
-
options: QueryOptions;
|
|
159
|
-
/** A function to set the entire query options object at once. */
|
|
160
|
-
setOptions: React__default.Dispatch<React__default.SetStateAction<QueryOptions>>;
|
|
161
|
-
/** Sets the current page number. */
|
|
162
|
-
setPage: (page: number) => void;
|
|
163
|
-
/** Sets the number of items per page and resets to the first page. */
|
|
164
|
-
setLimit: (limit: number) => void;
|
|
165
|
-
/** Sets the search term and resets to the first page. */
|
|
166
|
-
setSearchTerm: (search: string) => void;
|
|
167
|
-
/** Sets the sorting configuration. */
|
|
168
|
-
setSorting: (sortBy: {
|
|
169
|
-
key: string;
|
|
170
|
-
direction: 'asc' | 'desc';
|
|
171
|
-
}[]) => void;
|
|
172
|
-
/** Sets the filter object and resets to the first page. */
|
|
173
|
-
setFilters: (filter: Record<string, any>) => void;
|
|
174
|
-
/** Sets a single, custom query parameter. */
|
|
175
|
-
setQueryParam: (key: string, value: any) => void;
|
|
176
|
-
/** Resets the query options to their initial state. */
|
|
177
|
-
reset: () => void;
|
|
178
|
-
}
|
|
179
|
-
interface UseApiConfig<T> {
|
|
180
|
-
endpoint: string;
|
|
181
|
-
initialData?: T | null;
|
|
182
|
-
initialQuery?: QueryOptions;
|
|
183
|
-
enabled?: boolean;
|
|
184
|
-
refetchAfterChange?: boolean;
|
|
185
|
-
requestConfig?: RequestConfig;
|
|
186
|
-
pathParams?: Record<string, string | number>;
|
|
187
|
-
encodeQuery?: boolean;
|
|
188
|
-
onSuccess?: (message: string, data?: T) => void;
|
|
189
|
-
onError?: (message: string, error?: ApiError) => void;
|
|
190
|
-
}
|
|
5
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
191
6
|
|
|
192
7
|
declare function createApiClient(config: ApiClientConfig): AxiosInstance;
|
|
193
8
|
|
|
194
|
-
/** @description Extends the base ActionState with an `isStale` flag for automatic refetching. */
|
|
195
|
-
interface ActionState<TOutput> extends ActionStateModule<TOutput> {
|
|
196
|
-
isStale?: boolean;
|
|
197
|
-
}
|
|
198
|
-
/** @description Defines the configuration for a single API action within a module. */
|
|
199
|
-
interface ActionConfigModule<TInput = unknown, TOutput = unknown> {
|
|
200
|
-
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
201
|
-
path: string;
|
|
202
|
-
description?: string;
|
|
203
|
-
hasQuery?: boolean;
|
|
204
|
-
autoFetch?: boolean;
|
|
205
|
-
invalidates?: string[];
|
|
206
|
-
_input?: TInput;
|
|
207
|
-
_output?: TOutput;
|
|
208
|
-
}
|
|
209
|
-
/** @description Defines the complete structure of an API module. */
|
|
210
|
-
interface ApiModuleConfig<TActions extends Record<string, ActionConfigModule<any, any>>> {
|
|
211
|
-
baseEndpoint: string;
|
|
212
|
-
actions: TActions;
|
|
213
|
-
}
|
|
214
|
-
/** @description Configuration options passed directly to the `useApiModule` hook. */
|
|
215
|
-
interface UseApiModuleOptions {
|
|
216
|
-
onSuccess?: (actionName: string, message: string, data: unknown) => void;
|
|
217
|
-
onError?: (actionName: string, message: string, error?: ApiError | null) => void;
|
|
218
|
-
refetchOnWindowFocus?: boolean;
|
|
219
|
-
pathParams?: Record<string, any>;
|
|
220
|
-
enabled?: boolean;
|
|
221
|
-
hydratedState?: string;
|
|
222
|
-
}
|
|
223
|
-
/** A utility type to infer the Input type (`TInput`) from an ActionConfigModule. */
|
|
224
|
-
type InputOf<TActionConfig> = TActionConfig extends ActionConfigModule<infer TInput, any> ? TInput : never;
|
|
225
|
-
/** A utility type to infer the Output type (`TOutput`) from an ActionConfigModule. */
|
|
226
|
-
type OutputOf<TActionConfig> = TActionConfig extends ActionConfigModule<any, infer TOutput> ? TOutput : never;
|
|
227
|
-
/** @description Defines the options for the `execute` function, enabling optimistic updates. */
|
|
228
|
-
interface ExecuteOptions<TInput, TOutput, TContext = unknown> {
|
|
229
|
-
pathParams?: Record<string, any>;
|
|
230
|
-
config?: AxiosRequestConfig;
|
|
231
|
-
onMutate?: (variables: TInput) => TContext | Promise<TContext>;
|
|
232
|
-
onSuccess?: (data: TOutput, context?: TContext) => void;
|
|
233
|
-
onError?: (error: ApiError, context?: TContext) => void;
|
|
234
|
-
}
|
|
235
|
-
/** @description A fully-typed object representing the callable actions for a module. */
|
|
236
|
-
type ModuleActions<TActions extends Record<string, ActionConfigModule<any, any>>> = {
|
|
237
|
-
[K in keyof TActions]: {
|
|
238
|
-
execute: <TContext = unknown>(input?: InputOf<TActions[K]>, options?: ExecuteOptions<InputOf<TActions[K]>, OutputOf<TActions[K]>, TContext>) => Promise<StandardResponse<OutputOf<TActions[K]>>>;
|
|
239
|
-
reset: (input?: InputOf<TActions[K]>, options?: {
|
|
240
|
-
pathParams?: Record<string, any>;
|
|
241
|
-
}) => void;
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
/** @description A fully-typed object representing the reactive states for each action in a module. */
|
|
245
|
-
type ModuleStates<TActions extends Record<string, ActionConfigModule<any, any>>> = {
|
|
246
|
-
[K in keyof TActions]: ActionState<OutputOf<TActions[K]>>;
|
|
247
|
-
};
|
|
248
|
-
/** @description The complete, fully-typed return object of the `useApiModule` hook. */
|
|
249
|
-
interface UseApiModuleReturn<TActions extends Record<string, ActionConfigModule<any, any>>> {
|
|
250
|
-
states: ModuleStates<TActions>;
|
|
251
|
-
actions: ModuleActions<TActions>;
|
|
252
|
-
queries: {
|
|
253
|
-
[K in keyof TActions]?: TActions[K] extends {
|
|
254
|
-
hasQuery: true;
|
|
255
|
-
} ? UseApiQuery : never;
|
|
256
|
-
};
|
|
257
|
-
dehydrate: () => string;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
9
|
/**
|
|
261
10
|
* A factory function to create a reusable set of API services for a specific endpoint.
|
|
262
11
|
* It provides full CRUD operations plus advanced features like bulk deletion and file uploads,
|
|
@@ -289,14 +38,6 @@ declare function callDynamicApi(axiosInstance: AxiosInstance, baseEndpoint: stri
|
|
|
289
38
|
config?: AxiosRequestConfig;
|
|
290
39
|
}): Promise<StandardResponse<any>>;
|
|
291
40
|
|
|
292
|
-
/**
|
|
293
|
-
* [نسخة مطورة] يبني سلسلة استعلام (query string) من كائن الخيارات.
|
|
294
|
-
* يدعم الآن الفلاتر المتداخلة (filter[key]=value) والترتيب المتعدد.
|
|
295
|
-
* @param options - كائن خيارات الاستعلام (فلترة, ترتيب, ...).
|
|
296
|
-
* @returns سلسلة استعلام جاهزة للإضافة للرابط.
|
|
297
|
-
*/
|
|
298
|
-
declare function buildPaginateQuery(options: QueryOptions): string;
|
|
299
|
-
|
|
300
41
|
/**
|
|
301
42
|
* Defines a single custom API action.
|
|
302
43
|
* @template TRequest - The type of the data sent in the request body/params.
|
|
@@ -331,6 +72,60 @@ declare function createApiActions<TActions extends Record<string, {
|
|
|
331
72
|
[K in keyof TActions]: ApiAction<TActions[K]['requestType'], TActions[K]['responseType']>;
|
|
332
73
|
};
|
|
333
74
|
|
|
75
|
+
declare class GlobalStateManager {
|
|
76
|
+
private store;
|
|
77
|
+
/**
|
|
78
|
+
* يحصل على لقطة (snapshot) للحالة الحالية لمفتاح معين.
|
|
79
|
+
*/
|
|
80
|
+
getSnapshot<T>(key: string): ActionStateModule<T>;
|
|
81
|
+
/**
|
|
82
|
+
* يسجل دالة callback للاستماع إلى التغييرات على مفتاح معين.
|
|
83
|
+
* @returns دالة لإلغاء الاشتراك.
|
|
84
|
+
*/
|
|
85
|
+
subscribe(key: string, callback: () => void): () => void;
|
|
86
|
+
/**
|
|
87
|
+
* يحدّث الحالة لمفتاح معين ويقوم بإعلام جميع المشتركين.
|
|
88
|
+
*/
|
|
89
|
+
setState<T>(key: string, updater: (prevState: ActionStateModule<T>) => ActionStateModule<T>): void;
|
|
90
|
+
/**
|
|
91
|
+
* يجعل البيانات المرتبطة بمفتاح معين "قديمة" (stale).
|
|
92
|
+
*/
|
|
93
|
+
invalidate(key: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* [نسخة محدثة وأكثر قوة]
|
|
96
|
+
* يجعل كل البيانات التي تبدأ بمفتاح معين "قديمة" (stale).
|
|
97
|
+
* @example invalidateByPrefix('myModule/list::') سيبطل كل صفحات القائمة.
|
|
98
|
+
*/
|
|
99
|
+
invalidateByPrefix(prefix: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Serializes the current state of the query store into a JSON string.
|
|
102
|
+
* This is used on the server to pass the initial state to the client.
|
|
103
|
+
* @returns A JSON string representing the dehydrated state.
|
|
104
|
+
*/
|
|
105
|
+
dehydrate(): string;
|
|
106
|
+
/**
|
|
107
|
+
* Merges a dehydrated state object into the current store.
|
|
108
|
+
* This is used on the client to hydrate the state received from the server.
|
|
109
|
+
* @param hydratedState - A JSON string from the `dehydrate` method.
|
|
110
|
+
*/
|
|
111
|
+
rehydrate(hydratedState: string): void;
|
|
112
|
+
}
|
|
113
|
+
declare const globalStateManager: GlobalStateManager;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* [نسخة مطورة] يبني سلسلة استعلام (query string) من كائن الخيارات.
|
|
117
|
+
* يدعم الآن الفلاتر المتداخلة (filter[key]=value) والترتيب المتعدد.
|
|
118
|
+
* @param options - كائن خيارات الاستعلام (فلترة, ترتيب, ...).
|
|
119
|
+
* @returns سلسلة استعلام جاهزة للإضافة للرابط.
|
|
120
|
+
*/
|
|
121
|
+
declare function buildPaginateQuery(options: QueryOptions): string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* [النسخة النهائية والمضمونة]
|
|
125
|
+
* تستخدم دوال حماية النوع المخصصة للقضاء على أخطاء 'never' بشكل نهائي.
|
|
126
|
+
*/
|
|
127
|
+
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | AxiosError) => StandardResponse<T>;
|
|
128
|
+
|
|
334
129
|
interface CacheItem<T> {
|
|
335
130
|
data: T;
|
|
336
131
|
timestamp: number;
|
|
@@ -352,12 +147,6 @@ declare class CacheManager {
|
|
|
352
147
|
}
|
|
353
148
|
declare const cacheManager: CacheManager;
|
|
354
149
|
|
|
355
|
-
/**
|
|
356
|
-
* [النسخة النهائية والمضمونة]
|
|
357
|
-
* تستخدم دوال حماية النوع المخصصة للقضاء على أخطاء 'never' بشكل نهائي.
|
|
358
|
-
*/
|
|
359
|
-
declare const processResponse: <T>(responseOrError: AxiosResponse<any> | AxiosError) => StandardResponse<T>;
|
|
360
|
-
|
|
361
150
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): any;
|
|
362
151
|
|
|
363
152
|
/**
|
|
@@ -466,46 +255,6 @@ declare const ApiModuleProvider: React$1.Provider<UseApiModuleReturn<any> | null
|
|
|
466
255
|
declare function useModuleContext<TModule extends ApiModuleConfig<any>>(): UseApiModuleReturn<TModule['actions']>;
|
|
467
256
|
declare function useApiModule<TActions extends Record<string, ActionConfigModule<any, any>>>(axiosInstance: AxiosInstance, moduleConfig: ApiModuleConfig<TActions>, options?: UseApiModuleOptions): UseApiModuleReturn<TActions>;
|
|
468
257
|
|
|
469
|
-
declare class GlobalStateManager {
|
|
470
|
-
private store;
|
|
471
|
-
/**
|
|
472
|
-
* يحصل على لقطة (snapshot) للحالة الحالية لمفتاح معين.
|
|
473
|
-
*/
|
|
474
|
-
getSnapshot<T>(key: string): ActionStateModule<T>;
|
|
475
|
-
/**
|
|
476
|
-
* يسجل دالة callback للاستماع إلى التغييرات على مفتاح معين.
|
|
477
|
-
* @returns دالة لإلغاء الاشتراك.
|
|
478
|
-
*/
|
|
479
|
-
subscribe(key: string, callback: () => void): () => void;
|
|
480
|
-
/**
|
|
481
|
-
* يحدّث الحالة لمفتاح معين ويقوم بإعلام جميع المشتركين.
|
|
482
|
-
*/
|
|
483
|
-
setState<T>(key: string, updater: (prevState: ActionStateModule<T>) => ActionStateModule<T>): void;
|
|
484
|
-
/**
|
|
485
|
-
* يجعل البيانات المرتبطة بمفتاح معين "قديمة" (stale).
|
|
486
|
-
*/
|
|
487
|
-
invalidate(key: string): void;
|
|
488
|
-
/**
|
|
489
|
-
* [نسخة محدثة وأكثر قوة]
|
|
490
|
-
* يجعل كل البيانات التي تبدأ بمفتاح معين "قديمة" (stale).
|
|
491
|
-
* @example invalidateByPrefix('myModule/list::') سيبطل كل صفحات القائمة.
|
|
492
|
-
*/
|
|
493
|
-
invalidateByPrefix(prefix: string): void;
|
|
494
|
-
/**
|
|
495
|
-
* Serializes the current state of the query store into a JSON string.
|
|
496
|
-
* This is used on the server to pass the initial state to the client.
|
|
497
|
-
* @returns A JSON string representing the dehydrated state.
|
|
498
|
-
*/
|
|
499
|
-
dehydrate(): string;
|
|
500
|
-
/**
|
|
501
|
-
* Merges a dehydrated state object into the current store.
|
|
502
|
-
* This is used on the client to hydrate the state received from the server.
|
|
503
|
-
* @param hydratedState - A JSON string from the `dehydrate` method.
|
|
504
|
-
*/
|
|
505
|
-
rehydrate(hydratedState: string): void;
|
|
506
|
-
}
|
|
507
|
-
declare const globalStateManager: GlobalStateManager;
|
|
508
|
-
|
|
509
258
|
/**
|
|
510
259
|
* @file src/hooks/useApi.types.ts
|
|
511
260
|
* @description This file defines the professional, publicly-facing types for the `useApi` hook,
|
|
@@ -587,4 +336,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
|
|
|
587
336
|
setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
|
|
588
337
|
}
|
|
589
338
|
|
|
590
|
-
export {
|
|
339
|
+
export { ActionConfigModule, ActionOptions, ActionStateModule, ApiClientConfig, ApiError, ApiModuleConfig, ApiModuleProvider, type ApiResourceStatus, LogLevel, QueryOptions, RequestConfig, StandardResponse, type UseApiActions, UseApiConfig, UseApiModuleOptions, UseApiModuleReturn, UseApiQuery, type UseApiRecordActions, type UseApiRecordConfig, type UseApiRecordReturn, type UseApiRecordState, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, buildPaginateQuery, cacheManager, callDynamicApi, createApiActions, createApiClient, createApiServices, globalStateManager, processResponse, useApi, useApiModule, useApiRecord, useDeepCompareEffect, useModuleContext };
|