api-core-lib 12.10.4 → 12.11.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 +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -270,6 +270,22 @@ declare function createApiServices<T>(axiosInstance: AxiosInstance, baseEndpoint
|
|
|
270
270
|
bulkDelete: (ids: Array<string | number>, config?: ActionOptions) => Promise<StandardResponse<any>>;
|
|
271
271
|
upload: (file: File, additionalData?: Record<string, any>, config?: ActionOptions) => Promise<StandardResponse<any>>;
|
|
272
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* [نسخة محدثة ومحسّنة]
|
|
275
|
+
* دالة عامة وصريحة لتنفيذ أي طلب API.
|
|
276
|
+
* تستقبل وسائط منظمة بدلاً من محاولة تخمينها.
|
|
277
|
+
*
|
|
278
|
+
* @param axiosInstance - نسخة Axios.
|
|
279
|
+
* @param baseEndpoint - نقطة النهاية الأساسية للموديول.
|
|
280
|
+
* @param actionConfig - إعدادات الإجراء المحدد.
|
|
281
|
+
* @param params - كائن يحتوي على جميع البارامترات اللازمة للطلب.
|
|
282
|
+
* @returns Promise<StandardResponse<any>>
|
|
283
|
+
*/
|
|
284
|
+
declare function callDynamicApi(axiosInstance: AxiosInstance, baseEndpoint: string, actionConfig: ActionConfigModule<any, any>, params: {
|
|
285
|
+
pathParams?: Record<string, string | number>;
|
|
286
|
+
body?: any;
|
|
287
|
+
config?: AxiosRequestConfig;
|
|
288
|
+
}): Promise<StandardResponse<any>>;
|
|
273
289
|
|
|
274
290
|
/**
|
|
275
291
|
* [نسخة مطورة] يبني سلسلة استعلام (query string) من كائن الخيارات.
|
|
@@ -448,6 +464,34 @@ declare const ApiModuleProvider: React$1.Provider<UseApiModuleReturn<any> | null
|
|
|
448
464
|
declare function useModuleContext<TActions extends Record<string, ActionConfigModule<any, any>>>(): UseApiModuleReturn<TActions>;
|
|
449
465
|
declare function useApiModule<TActions extends Record<string, ActionConfigModule<any, any>>>(axiosInstance: AxiosInstance, moduleConfig: ApiModuleConfig<TActions>, options?: UseApiModuleOptions): UseApiModuleReturn<TActions>;
|
|
450
466
|
|
|
467
|
+
declare class GlobalStateManager {
|
|
468
|
+
private store;
|
|
469
|
+
/**
|
|
470
|
+
* يحصل على لقطة (snapshot) للحالة الحالية لمفتاح معين.
|
|
471
|
+
*/
|
|
472
|
+
getSnapshot<T>(key: string): ActionStateModule<T>;
|
|
473
|
+
/**
|
|
474
|
+
* يسجل دالة callback للاستماع إلى التغييرات على مفتاح معين.
|
|
475
|
+
* @returns دالة لإلغاء الاشتراك.
|
|
476
|
+
*/
|
|
477
|
+
subscribe(key: string, callback: () => void): () => void;
|
|
478
|
+
/**
|
|
479
|
+
* يحدّث الحالة لمفتاح معين ويقوم بإعلام جميع المشتركين.
|
|
480
|
+
*/
|
|
481
|
+
setState<T>(key: string, updater: (prevState: ActionStateModule<T>) => ActionStateModule<T>): void;
|
|
482
|
+
/**
|
|
483
|
+
* يجعل البيانات المرتبطة بمفتاح معين "قديمة" (stale).
|
|
484
|
+
*/
|
|
485
|
+
invalidate(key: string): void;
|
|
486
|
+
/**
|
|
487
|
+
* [نسخة محدثة وأكثر قوة]
|
|
488
|
+
* يجعل كل البيانات التي تبدأ بمفتاح معين "قديمة" (stale).
|
|
489
|
+
* @example invalidateByPrefix('myModule/list::') سيبطل كل صفحات القائمة.
|
|
490
|
+
*/
|
|
491
|
+
invalidateByPrefix(prefix: string): void;
|
|
492
|
+
}
|
|
493
|
+
declare const globalStateManager: GlobalStateManager;
|
|
494
|
+
|
|
451
495
|
/**
|
|
452
496
|
* @file src/hooks/useApi.types.ts
|
|
453
497
|
* @description This file defines the professional, publicly-facing types for the `useApi` hook,
|
|
@@ -529,4 +573,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
|
|
|
529
573
|
setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
|
|
530
574
|
}
|
|
531
575
|
|
|
532
|
-
export { type ActionConfig, type ActionConfigModule, type ActionOptions, type ActionState, type ActionStateModule, type ApiClientConfig, type ApiError, type ApiModuleConfig, ApiModuleProvider, type ApiResourceStatus, type ExecutableAction, type ExecuteOptions, type InputOf, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type ModuleStates, type OutputOf, 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 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, useModuleContext };
|
|
576
|
+
export { type ActionConfig, type ActionConfigModule, type ActionOptions, type ActionState, type ActionStateModule, type ApiClientConfig, type ApiError, type ApiModuleConfig, ApiModuleProvider, type ApiResourceStatus, type ExecutableAction, type ExecuteOptions, type InputOf, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type ModuleStates, type OutputOf, 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 UseApiRecordActions, type UseApiRecordConfig, type UseApiRecordReturn, type UseApiRecordState, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, callDynamicApi, createApiActions, createApiClient, createApiServices, globalStateManager, processResponse, useApi, useApiModule, useApiRecord, useDeepCompareEffect, useModuleContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -270,6 +270,22 @@ declare function createApiServices<T>(axiosInstance: AxiosInstance, baseEndpoint
|
|
|
270
270
|
bulkDelete: (ids: Array<string | number>, config?: ActionOptions) => Promise<StandardResponse<any>>;
|
|
271
271
|
upload: (file: File, additionalData?: Record<string, any>, config?: ActionOptions) => Promise<StandardResponse<any>>;
|
|
272
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* [نسخة محدثة ومحسّنة]
|
|
275
|
+
* دالة عامة وصريحة لتنفيذ أي طلب API.
|
|
276
|
+
* تستقبل وسائط منظمة بدلاً من محاولة تخمينها.
|
|
277
|
+
*
|
|
278
|
+
* @param axiosInstance - نسخة Axios.
|
|
279
|
+
* @param baseEndpoint - نقطة النهاية الأساسية للموديول.
|
|
280
|
+
* @param actionConfig - إعدادات الإجراء المحدد.
|
|
281
|
+
* @param params - كائن يحتوي على جميع البارامترات اللازمة للطلب.
|
|
282
|
+
* @returns Promise<StandardResponse<any>>
|
|
283
|
+
*/
|
|
284
|
+
declare function callDynamicApi(axiosInstance: AxiosInstance, baseEndpoint: string, actionConfig: ActionConfigModule<any, any>, params: {
|
|
285
|
+
pathParams?: Record<string, string | number>;
|
|
286
|
+
body?: any;
|
|
287
|
+
config?: AxiosRequestConfig;
|
|
288
|
+
}): Promise<StandardResponse<any>>;
|
|
273
289
|
|
|
274
290
|
/**
|
|
275
291
|
* [نسخة مطورة] يبني سلسلة استعلام (query string) من كائن الخيارات.
|
|
@@ -448,6 +464,34 @@ declare const ApiModuleProvider: React$1.Provider<UseApiModuleReturn<any> | null
|
|
|
448
464
|
declare function useModuleContext<TActions extends Record<string, ActionConfigModule<any, any>>>(): UseApiModuleReturn<TActions>;
|
|
449
465
|
declare function useApiModule<TActions extends Record<string, ActionConfigModule<any, any>>>(axiosInstance: AxiosInstance, moduleConfig: ApiModuleConfig<TActions>, options?: UseApiModuleOptions): UseApiModuleReturn<TActions>;
|
|
450
466
|
|
|
467
|
+
declare class GlobalStateManager {
|
|
468
|
+
private store;
|
|
469
|
+
/**
|
|
470
|
+
* يحصل على لقطة (snapshot) للحالة الحالية لمفتاح معين.
|
|
471
|
+
*/
|
|
472
|
+
getSnapshot<T>(key: string): ActionStateModule<T>;
|
|
473
|
+
/**
|
|
474
|
+
* يسجل دالة callback للاستماع إلى التغييرات على مفتاح معين.
|
|
475
|
+
* @returns دالة لإلغاء الاشتراك.
|
|
476
|
+
*/
|
|
477
|
+
subscribe(key: string, callback: () => void): () => void;
|
|
478
|
+
/**
|
|
479
|
+
* يحدّث الحالة لمفتاح معين ويقوم بإعلام جميع المشتركين.
|
|
480
|
+
*/
|
|
481
|
+
setState<T>(key: string, updater: (prevState: ActionStateModule<T>) => ActionStateModule<T>): void;
|
|
482
|
+
/**
|
|
483
|
+
* يجعل البيانات المرتبطة بمفتاح معين "قديمة" (stale).
|
|
484
|
+
*/
|
|
485
|
+
invalidate(key: string): void;
|
|
486
|
+
/**
|
|
487
|
+
* [نسخة محدثة وأكثر قوة]
|
|
488
|
+
* يجعل كل البيانات التي تبدأ بمفتاح معين "قديمة" (stale).
|
|
489
|
+
* @example invalidateByPrefix('myModule/list::') سيبطل كل صفحات القائمة.
|
|
490
|
+
*/
|
|
491
|
+
invalidateByPrefix(prefix: string): void;
|
|
492
|
+
}
|
|
493
|
+
declare const globalStateManager: GlobalStateManager;
|
|
494
|
+
|
|
451
495
|
/**
|
|
452
496
|
* @file src/hooks/useApi.types.ts
|
|
453
497
|
* @description This file defines the professional, publicly-facing types for the `useApi` hook,
|
|
@@ -529,4 +573,4 @@ interface UseApiResourceReturn<T, TCreate, TUpdate, TPathParams> {
|
|
|
529
573
|
setQuery: React.Dispatch<React.SetStateAction<QueryOptions>>;
|
|
530
574
|
}
|
|
531
575
|
|
|
532
|
-
export { type ActionConfig, type ActionConfigModule, type ActionOptions, type ActionState, type ActionStateModule, type ApiClientConfig, type ApiError, type ApiModuleConfig, ApiModuleProvider, type ApiResourceStatus, type ExecutableAction, type ExecuteOptions, type InputOf, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type ModuleStates, type OutputOf, 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 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, useModuleContext };
|
|
576
|
+
export { type ActionConfig, type ActionConfigModule, type ActionOptions, type ActionState, type ActionStateModule, type ApiClientConfig, type ApiError, type ApiModuleConfig, ApiModuleProvider, type ApiResourceStatus, type ExecutableAction, type ExecuteOptions, type InputOf, type LogLevel, type Middleware, type MiddlewareContext, type ModuleActions, type ModuleStates, type OutputOf, 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 UseApiRecordActions, type UseApiRecordConfig, type UseApiRecordReturn, type UseApiRecordState, type UseApiResourceActions, type UseApiResourceConfig, type UseApiResourceReturn, type UseApiResourceState, type UseApiReturn, type UseApiState, type ValidationError, buildPaginateQuery, cacheManager, callDynamicApi, createApiActions, createApiClient, createApiServices, globalStateManager, processResponse, useApi, useApiModule, useApiRecord, useDeepCompareEffect, useModuleContext };
|