api-core-lib 12.0.23 → 12.0.25
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/bin/generate.js +19 -0
- package/dist/{apiModule.types-D0LSWRW8.d.cts → apiModule.types-Bn0tJF7b.d.cts} +14 -8
- package/dist/{apiModule.types-D0LSWRW8.d.ts → apiModule.types-Bn0tJF7b.d.ts} +14 -8
- package/dist/client.cjs +29 -6
- package/dist/client.d.cts +12 -5
- package/dist/client.d.ts +12 -5
- package/dist/client.js +29 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/{useApiRecord.types-C7T0gsX_.d.ts → useApiRecord.types-CWhwCAB6.d.ts} +1 -1
- package/dist/{useApiRecord.types-DXv1-ly6.d.cts → useApiRecord.types-NZtPRga3.d.cts} +1 -1
- package/package.json +10 -3
package/bin/generate.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// bin/generate.js
|
|
4
|
+
|
|
5
|
+
const { program } = require('commander');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { runGenerator } = require('../dist/generator'); // سنقوم بإنشاء هذا الملف
|
|
8
|
+
|
|
9
|
+
console.log('API Core Lib - Code Generator');
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.option('-o, --output <path>', 'Output directory for generated files', 'src/lib/api-generated')
|
|
13
|
+
.option('--env-path <path>', '.env file path', path.resolve(process.cwd(), '.env'))
|
|
14
|
+
.action((options) => {
|
|
15
|
+
const absoluteOutputPath = path.resolve(process.cwd(), options.output);
|
|
16
|
+
runGenerator({ ...options, output: absoluteOutputPath });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
program.parse(process.argv);
|
|
@@ -218,13 +218,14 @@ interface ApiModuleConfig<TActions extends Record<string, ActionConfigModule<any
|
|
|
218
218
|
actions: TActions;
|
|
219
219
|
}
|
|
220
220
|
/** @description Configuration options passed directly to the `useApiModule` hook. */
|
|
221
|
-
interface UseApiModuleOptions {
|
|
221
|
+
interface UseApiModuleOptions<TExtra = {}> {
|
|
222
222
|
onSuccess?: (actionName: string, message: string, data: unknown) => void;
|
|
223
223
|
onError?: (actionName: string, message: string, error?: ApiError | null) => void;
|
|
224
224
|
refetchOnWindowFocus?: boolean;
|
|
225
225
|
pathParams?: Record<string, any>;
|
|
226
226
|
enabled?: boolean;
|
|
227
227
|
hydratedState?: string;
|
|
228
|
+
extraContextData?: TExtra;
|
|
228
229
|
}
|
|
229
230
|
/** A utility type to infer the Input type (`TInput`) from an ActionConfigModule. */
|
|
230
231
|
type InputOf<TActionConfig> = TActionConfig extends ActionConfigModule<infer TInput, any> ? TInput : never;
|
|
@@ -252,17 +253,22 @@ type ModuleActions<TActions extends Record<string, ActionConfigModule<any, any>>
|
|
|
252
253
|
type ModuleStates<TActions extends Record<string, ActionConfigModule<any, any>>> = {
|
|
253
254
|
[K in keyof TActions]: ActionState<OutputOf<TActions[K]>>;
|
|
254
255
|
};
|
|
255
|
-
/**
|
|
256
|
-
|
|
256
|
+
/**
|
|
257
|
+
/** @description The complete, fully-typed return object of the `useApiModule` hook.
|
|
258
|
+
*/
|
|
259
|
+
type ActionsWithQuery<TActions extends Record<string, any>> = {
|
|
260
|
+
[K in keyof TActions]: TActions[K] extends {
|
|
261
|
+
hasQuery: true;
|
|
262
|
+
} ? K : never;
|
|
263
|
+
}[keyof TActions];
|
|
264
|
+
type UseApiModuleReturn<TActions extends Record<string, any>, TExtra = {}> = {
|
|
257
265
|
states: ModuleStates<TActions>;
|
|
258
266
|
actions: ModuleActions<TActions>;
|
|
259
267
|
queries: {
|
|
260
|
-
[K in
|
|
261
|
-
hasQuery: true;
|
|
262
|
-
} ? UseApiQuery : never;
|
|
268
|
+
[K in ActionsWithQuery<TActions>]: UseApiQuery;
|
|
263
269
|
};
|
|
264
270
|
dehydrate: () => string;
|
|
265
|
-
}
|
|
271
|
+
} & TExtra;
|
|
266
272
|
/**
|
|
267
273
|
* يصف دوال `execute` و `reset` لإجراء واحد.
|
|
268
274
|
* هذا النوع عام (generic) ليتناسب مع أنواع الإدخال والإخراج المختلفة لكل إجراء.
|
|
@@ -281,4 +287,4 @@ type ActionMethods<TAction extends ActionConfigModule<any, any>> = {
|
|
|
281
287
|
}) => void;
|
|
282
288
|
};
|
|
283
289
|
|
|
284
|
-
export type { ActionConfigModule as A, ExecutableAction as E, InputOf as I, LogLevel as L,
|
|
290
|
+
export type { ActionConfigModule as A, ExecutableAction as E, InputOf as I, LogLevel as L, ModuleStates as M, OutputOf as O, PaginationMeta as P, QueryOptions as Q, RequestConfig as R, StandardResponse as S, Tokens as T, UseApiConfig as U, ValidationError as V, ApiModuleConfig as a, UseApiModuleOptions as b, UseApiModuleReturn as c, ModuleActions as d, UseApiQuery as e, ApiClientConfig as f, ActionOptions as g, ActionStateModule as h, ApiError as i, TokenManager as j, MiddlewareContext as k, Middleware as l, RefreshTokenConfig as m, ActionConfig as n, UseApiState as o, ActionState as p, ExecuteOptions as q, ActionsWithQuery as r, ActionMethods as s, t };
|
|
@@ -218,13 +218,14 @@ interface ApiModuleConfig<TActions extends Record<string, ActionConfigModule<any
|
|
|
218
218
|
actions: TActions;
|
|
219
219
|
}
|
|
220
220
|
/** @description Configuration options passed directly to the `useApiModule` hook. */
|
|
221
|
-
interface UseApiModuleOptions {
|
|
221
|
+
interface UseApiModuleOptions<TExtra = {}> {
|
|
222
222
|
onSuccess?: (actionName: string, message: string, data: unknown) => void;
|
|
223
223
|
onError?: (actionName: string, message: string, error?: ApiError | null) => void;
|
|
224
224
|
refetchOnWindowFocus?: boolean;
|
|
225
225
|
pathParams?: Record<string, any>;
|
|
226
226
|
enabled?: boolean;
|
|
227
227
|
hydratedState?: string;
|
|
228
|
+
extraContextData?: TExtra;
|
|
228
229
|
}
|
|
229
230
|
/** A utility type to infer the Input type (`TInput`) from an ActionConfigModule. */
|
|
230
231
|
type InputOf<TActionConfig> = TActionConfig extends ActionConfigModule<infer TInput, any> ? TInput : never;
|
|
@@ -252,17 +253,22 @@ type ModuleActions<TActions extends Record<string, ActionConfigModule<any, any>>
|
|
|
252
253
|
type ModuleStates<TActions extends Record<string, ActionConfigModule<any, any>>> = {
|
|
253
254
|
[K in keyof TActions]: ActionState<OutputOf<TActions[K]>>;
|
|
254
255
|
};
|
|
255
|
-
/**
|
|
256
|
-
|
|
256
|
+
/**
|
|
257
|
+
/** @description The complete, fully-typed return object of the `useApiModule` hook.
|
|
258
|
+
*/
|
|
259
|
+
type ActionsWithQuery<TActions extends Record<string, any>> = {
|
|
260
|
+
[K in keyof TActions]: TActions[K] extends {
|
|
261
|
+
hasQuery: true;
|
|
262
|
+
} ? K : never;
|
|
263
|
+
}[keyof TActions];
|
|
264
|
+
type UseApiModuleReturn<TActions extends Record<string, any>, TExtra = {}> = {
|
|
257
265
|
states: ModuleStates<TActions>;
|
|
258
266
|
actions: ModuleActions<TActions>;
|
|
259
267
|
queries: {
|
|
260
|
-
[K in
|
|
261
|
-
hasQuery: true;
|
|
262
|
-
} ? UseApiQuery : never;
|
|
268
|
+
[K in ActionsWithQuery<TActions>]: UseApiQuery;
|
|
263
269
|
};
|
|
264
270
|
dehydrate: () => string;
|
|
265
|
-
}
|
|
271
|
+
} & TExtra;
|
|
266
272
|
/**
|
|
267
273
|
* يصف دوال `execute` و `reset` لإجراء واحد.
|
|
268
274
|
* هذا النوع عام (generic) ليتناسب مع أنواع الإدخال والإخراج المختلفة لكل إجراء.
|
|
@@ -281,4 +287,4 @@ type ActionMethods<TAction extends ActionConfigModule<any, any>> = {
|
|
|
281
287
|
}) => void;
|
|
282
288
|
};
|
|
283
289
|
|
|
284
|
-
export type { ActionConfigModule as A, ExecutableAction as E, InputOf as I, LogLevel as L,
|
|
290
|
+
export type { ActionConfigModule as A, ExecutableAction as E, InputOf as I, LogLevel as L, ModuleStates as M, OutputOf as O, PaginationMeta as P, QueryOptions as Q, RequestConfig as R, StandardResponse as S, Tokens as T, UseApiConfig as U, ValidationError as V, ApiModuleConfig as a, UseApiModuleOptions as b, UseApiModuleReturn as c, ModuleActions as d, UseApiQuery as e, ApiClientConfig as f, ActionOptions as g, ActionStateModule as h, ApiError as i, TokenManager as j, MiddlewareContext as k, Middleware as l, RefreshTokenConfig as m, ActionConfig as n, UseApiState as o, ActionState as p, ExecuteOptions as q, ActionsWithQuery as r, ActionMethods as s, t };
|
package/dist/client.cjs
CHANGED
|
@@ -741,7 +741,15 @@ function useModuleContext() {
|
|
|
741
741
|
return context;
|
|
742
742
|
}
|
|
743
743
|
function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
744
|
-
const {
|
|
744
|
+
const {
|
|
745
|
+
refetchOnWindowFocus = true,
|
|
746
|
+
onSuccess,
|
|
747
|
+
onError,
|
|
748
|
+
pathParams: modulePathParams,
|
|
749
|
+
enabled = true,
|
|
750
|
+
hydratedState,
|
|
751
|
+
extraContextData
|
|
752
|
+
} = options;
|
|
745
753
|
const pathParamsString = (0, import_react4.useMemo)(() => JSON.stringify(modulePathParams || {}), [modulePathParams]);
|
|
746
754
|
const [queryOptions, setQueryOptions] = (0, import_react4.useState)({});
|
|
747
755
|
const savedCallbacks = (0, import_react4.useRef)({ onSuccess, onError });
|
|
@@ -864,18 +872,28 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
|
864
872
|
return builtQueries;
|
|
865
873
|
}, [queryOptions, moduleConfig.actions]);
|
|
866
874
|
const states = {};
|
|
875
|
+
function isActionWithQuery(key, actions2) {
|
|
876
|
+
return actions2[key]?.hasQuery === true;
|
|
877
|
+
}
|
|
867
878
|
for (const actionName in moduleConfig.actions) {
|
|
868
879
|
if (Object.prototype.hasOwnProperty.call(moduleConfig.actions, actionName)) {
|
|
869
880
|
const actionConfig = moduleConfig.actions[actionName];
|
|
870
881
|
if (actionConfig.cacheResponse !== false) {
|
|
871
|
-
|
|
872
|
-
|
|
882
|
+
let queryOptions2;
|
|
883
|
+
if (isActionWithQuery(actionName, moduleConfig.actions)) {
|
|
884
|
+
queryOptions2 = queries[actionName]?.options;
|
|
885
|
+
}
|
|
886
|
+
const input = queryOptions2;
|
|
873
887
|
const pathParams = JSON.parse(pathParamsString);
|
|
874
|
-
const cacheKey = generateCacheKey(
|
|
888
|
+
const cacheKey = generateCacheKey(
|
|
889
|
+
moduleConfig.baseEndpoint,
|
|
890
|
+
actionName,
|
|
891
|
+
input,
|
|
892
|
+
{ pathParams }
|
|
893
|
+
);
|
|
875
894
|
states[actionName] = useApiActionState(
|
|
876
895
|
actionConfig,
|
|
877
896
|
cacheKey,
|
|
878
|
-
// [تصحيح] مرر `execute` مباشرة
|
|
879
897
|
actions[actionName].execute,
|
|
880
898
|
input,
|
|
881
899
|
enabled
|
|
@@ -913,7 +931,12 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
|
913
931
|
const dehydrate = (0, import_react4.useMemo)(() => {
|
|
914
932
|
return () => globalStateManager.dehydrate();
|
|
915
933
|
}, []);
|
|
916
|
-
|
|
934
|
+
const baseApiReturn = { actions, states, queries, dehydrate };
|
|
935
|
+
const finalApiReturn = (0, import_react4.useMemo)(() => ({
|
|
936
|
+
...baseApiReturn,
|
|
937
|
+
...extraContextData || {}
|
|
938
|
+
}), [baseApiReturn, extraContextData]);
|
|
939
|
+
return finalApiReturn;
|
|
917
940
|
}
|
|
918
941
|
// Annotate the CommonJS export names for ESM import in node:
|
|
919
942
|
0 && (module.exports = {
|
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { U as UseApiConfig, A as ActionConfigModule, a as ApiModuleConfig, b as UseApiModuleOptions, c as UseApiModuleReturn } from './apiModule.types-
|
|
3
|
-
import { U as UseApiRecordConfig, a as UseApiRecordReturn } from './useApiRecord.types-
|
|
2
|
+
import { U as UseApiConfig, A as ActionConfigModule, a as ApiModuleConfig, b as UseApiModuleOptions, c as UseApiModuleReturn, M as ModuleStates, d as ModuleActions, e as UseApiQuery } from './apiModule.types-Bn0tJF7b.cjs';
|
|
3
|
+
import { U as UseApiRecordConfig, a as UseApiRecordReturn } from './useApiRecord.types-NZtPRga3.cjs';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): any;
|
|
@@ -21,8 +21,15 @@ type EffectCallback = () => (void | (() => void));
|
|
|
21
21
|
type DependencyList = readonly any[];
|
|
22
22
|
declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): void;
|
|
23
23
|
|
|
24
|
-
declare const ApiModuleProvider: React.Provider<
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
declare const ApiModuleProvider: React.Provider<{
|
|
25
|
+
states: ModuleStates<any>;
|
|
26
|
+
actions: ModuleActions<any>;
|
|
27
|
+
queries: {
|
|
28
|
+
[x: string]: UseApiQuery;
|
|
29
|
+
};
|
|
30
|
+
dehydrate: () => string;
|
|
31
|
+
} | null>;
|
|
32
|
+
declare function useModuleContext<TModule extends ApiModuleConfig<any>, TExtra = {}>(): UseApiModuleReturn<TModule['actions'], TExtra>;
|
|
33
|
+
declare function useApiModule<TActions extends Record<string, ActionConfigModule<any, any>>, TExtra extends object = {}>(axiosInstance: AxiosInstance, moduleConfig: ApiModuleConfig<TActions>, options?: UseApiModuleOptions<TExtra>): UseApiModuleReturn<TActions, TExtra>;
|
|
27
34
|
|
|
28
35
|
export { ApiModuleProvider, useApi, useApiModule, useApiRecord, useDeepCompareEffect, useModuleContext };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { U as UseApiConfig, A as ActionConfigModule, a as ApiModuleConfig, b as UseApiModuleOptions, c as UseApiModuleReturn } from './apiModule.types-
|
|
3
|
-
import { U as UseApiRecordConfig, a as UseApiRecordReturn } from './useApiRecord.types-
|
|
2
|
+
import { U as UseApiConfig, A as ActionConfigModule, a as ApiModuleConfig, b as UseApiModuleOptions, c as UseApiModuleReturn, M as ModuleStates, d as ModuleActions, e as UseApiQuery } from './apiModule.types-Bn0tJF7b.js';
|
|
3
|
+
import { U as UseApiRecordConfig, a as UseApiRecordReturn } from './useApiRecord.types-CWhwCAB6.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
declare function useApi<T>(axiosInstance: AxiosInstance, config: UseApiConfig<T>): any;
|
|
@@ -21,8 +21,15 @@ type EffectCallback = () => (void | (() => void));
|
|
|
21
21
|
type DependencyList = readonly any[];
|
|
22
22
|
declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): void;
|
|
23
23
|
|
|
24
|
-
declare const ApiModuleProvider: React.Provider<
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
declare const ApiModuleProvider: React.Provider<{
|
|
25
|
+
states: ModuleStates<any>;
|
|
26
|
+
actions: ModuleActions<any>;
|
|
27
|
+
queries: {
|
|
28
|
+
[x: string]: UseApiQuery;
|
|
29
|
+
};
|
|
30
|
+
dehydrate: () => string;
|
|
31
|
+
} | null>;
|
|
32
|
+
declare function useModuleContext<TModule extends ApiModuleConfig<any>, TExtra = {}>(): UseApiModuleReturn<TModule['actions'], TExtra>;
|
|
33
|
+
declare function useApiModule<TActions extends Record<string, ActionConfigModule<any, any>>, TExtra extends object = {}>(axiosInstance: AxiosInstance, moduleConfig: ApiModuleConfig<TActions>, options?: UseApiModuleOptions<TExtra>): UseApiModuleReturn<TActions, TExtra>;
|
|
27
34
|
|
|
28
35
|
export { ApiModuleProvider, useApi, useApiModule, useApiRecord, useDeepCompareEffect, useModuleContext };
|
package/dist/client.js
CHANGED
|
@@ -702,7 +702,15 @@ function useModuleContext() {
|
|
|
702
702
|
return context;
|
|
703
703
|
}
|
|
704
704
|
function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
705
|
-
const {
|
|
705
|
+
const {
|
|
706
|
+
refetchOnWindowFocus = true,
|
|
707
|
+
onSuccess,
|
|
708
|
+
onError,
|
|
709
|
+
pathParams: modulePathParams,
|
|
710
|
+
enabled = true,
|
|
711
|
+
hydratedState,
|
|
712
|
+
extraContextData
|
|
713
|
+
} = options;
|
|
706
714
|
const pathParamsString = useMemo3(() => JSON.stringify(modulePathParams || {}), [modulePathParams]);
|
|
707
715
|
const [queryOptions, setQueryOptions] = useState3({});
|
|
708
716
|
const savedCallbacks = useRef4({ onSuccess, onError });
|
|
@@ -825,18 +833,28 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
|
825
833
|
return builtQueries;
|
|
826
834
|
}, [queryOptions, moduleConfig.actions]);
|
|
827
835
|
const states = {};
|
|
836
|
+
function isActionWithQuery(key, actions2) {
|
|
837
|
+
return actions2[key]?.hasQuery === true;
|
|
838
|
+
}
|
|
828
839
|
for (const actionName in moduleConfig.actions) {
|
|
829
840
|
if (Object.prototype.hasOwnProperty.call(moduleConfig.actions, actionName)) {
|
|
830
841
|
const actionConfig = moduleConfig.actions[actionName];
|
|
831
842
|
if (actionConfig.cacheResponse !== false) {
|
|
832
|
-
|
|
833
|
-
|
|
843
|
+
let queryOptions2;
|
|
844
|
+
if (isActionWithQuery(actionName, moduleConfig.actions)) {
|
|
845
|
+
queryOptions2 = queries[actionName]?.options;
|
|
846
|
+
}
|
|
847
|
+
const input = queryOptions2;
|
|
834
848
|
const pathParams = JSON.parse(pathParamsString);
|
|
835
|
-
const cacheKey = generateCacheKey(
|
|
849
|
+
const cacheKey = generateCacheKey(
|
|
850
|
+
moduleConfig.baseEndpoint,
|
|
851
|
+
actionName,
|
|
852
|
+
input,
|
|
853
|
+
{ pathParams }
|
|
854
|
+
);
|
|
836
855
|
states[actionName] = useApiActionState(
|
|
837
856
|
actionConfig,
|
|
838
857
|
cacheKey,
|
|
839
|
-
// [تصحيح] مرر `execute` مباشرة
|
|
840
858
|
actions[actionName].execute,
|
|
841
859
|
input,
|
|
842
860
|
enabled
|
|
@@ -874,7 +892,12 @@ function useApiModule(axiosInstance, moduleConfig, options = {}) {
|
|
|
874
892
|
const dehydrate = useMemo3(() => {
|
|
875
893
|
return () => globalStateManager.dehydrate();
|
|
876
894
|
}, []);
|
|
877
|
-
|
|
895
|
+
const baseApiReturn = { actions, states, queries, dehydrate };
|
|
896
|
+
const finalApiReturn = useMemo3(() => ({
|
|
897
|
+
...baseApiReturn,
|
|
898
|
+
...extraContextData || {}
|
|
899
|
+
}), [baseApiReturn, extraContextData]);
|
|
900
|
+
return finalApiReturn;
|
|
878
901
|
}
|
|
879
902
|
export {
|
|
880
903
|
ApiModuleProvider,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, Method, AxiosResponse, AxiosError } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export { c as UseApiRecordActions, U as UseApiRecordConfig, a as UseApiRecordReturn, b as UseApiRecordState } from './useApiRecord.types-
|
|
2
|
+
import { f as ApiClientConfig, A as ActionConfigModule, S as StandardResponse, g as ActionOptions, R as RequestConfig, h as ActionStateModule, Q as QueryOptions, e as UseApiQuery, i as ApiError, L as LogLevel } from './apiModule.types-Bn0tJF7b.cjs';
|
|
3
|
+
export { n as ActionConfig, s as ActionMethods, p as ActionState, r as ActionsWithQuery, a as ApiModuleConfig, E as ExecutableAction, q as ExecuteOptions, I as InputOf, l as Middleware, k as MiddlewareContext, d as ModuleActions, M as ModuleStates, O as OutputOf, P as PaginationMeta, m as RefreshTokenConfig, j as TokenManager, T as Tokens, U as UseApiConfig, b as UseApiModuleOptions, c as UseApiModuleReturn, o as UseApiState, V as ValidationError, t } from './apiModule.types-Bn0tJF7b.cjs';
|
|
4
|
+
export { c as UseApiRecordActions, U as UseApiRecordConfig, a as UseApiRecordReturn, b as UseApiRecordState } from './useApiRecord.types-NZtPRga3.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
7
|
declare function createApiClient(config: ApiClientConfig): AxiosInstance;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, Method, AxiosResponse, AxiosError } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export { c as UseApiRecordActions, U as UseApiRecordConfig, a as UseApiRecordReturn, b as UseApiRecordState } from './useApiRecord.types-
|
|
2
|
+
import { f as ApiClientConfig, A as ActionConfigModule, S as StandardResponse, g as ActionOptions, R as RequestConfig, h as ActionStateModule, Q as QueryOptions, e as UseApiQuery, i as ApiError, L as LogLevel } from './apiModule.types-Bn0tJF7b.js';
|
|
3
|
+
export { n as ActionConfig, s as ActionMethods, p as ActionState, r as ActionsWithQuery, a as ApiModuleConfig, E as ExecutableAction, q as ExecuteOptions, I as InputOf, l as Middleware, k as MiddlewareContext, d as ModuleActions, M as ModuleStates, O as OutputOf, P as PaginationMeta, m as RefreshTokenConfig, j as TokenManager, T as Tokens, U as UseApiConfig, b as UseApiModuleOptions, c as UseApiModuleReturn, o as UseApiState, V as ValidationError, t } from './apiModule.types-Bn0tJF7b.js';
|
|
4
|
+
export { c as UseApiRecordActions, U as UseApiRecordConfig, a as UseApiRecordReturn, b as UseApiRecordState } from './useApiRecord.types-CWhwCAB6.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
7
|
declare function createApiClient(config: ApiClientConfig): AxiosInstance;
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { A as ActionConfigModule, a as ApiModuleConfig, I as InputOf } from './apiModule.types-
|
|
2
|
+
import { A as ActionConfigModule, a as ApiModuleConfig, I as InputOf } from './apiModule.types-Bn0tJF7b.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { A as ActionConfigModule, a as ApiModuleConfig, I as InputOf } from './apiModule.types-
|
|
2
|
+
import { A as ActionConfigModule, a as ApiModuleConfig, I as InputOf } from './apiModule.types-Bn0tJF7b.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { R as RequestConfig,
|
|
2
|
+
import { R as RequestConfig, i as ApiError, S as StandardResponse, g as ActionOptions } from './apiModule.types-Bn0tJF7b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents the internal state of the `useApiRecord` hook.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { R as RequestConfig,
|
|
2
|
+
import { R as RequestConfig, i as ApiError, S as StandardResponse, g as ActionOptions } from './apiModule.types-Bn0tJF7b.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents the internal state of the `useApiRecord` hook.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "api-core-lib",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.25",
|
|
4
4
|
"description": "A flexible and powerful API client library for modern web applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"main": "./dist/index.cjs",
|
|
26
26
|
"module": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
|
-
|
|
28
|
+
"bin": {
|
|
29
|
+
"api-core-generate": "./bin/generate.js"
|
|
30
|
+
},
|
|
29
31
|
"scripts": {
|
|
30
32
|
"build": "tsup",
|
|
31
33
|
"dev": "tsup --watch"
|
|
@@ -42,7 +44,12 @@
|
|
|
42
44
|
"colorette": "^2.0.20",
|
|
43
45
|
"fast-deep-equal": "^3.1.3",
|
|
44
46
|
"path": "^0.12.7",
|
|
45
|
-
"uuid": "^9.0.1"
|
|
47
|
+
"uuid": "^9.0.1",
|
|
48
|
+
|
|
49
|
+
"chalk": "^4.1.2",
|
|
50
|
+
"commander": "^9.4.1",
|
|
51
|
+
"dotenv": "^16.0.3",
|
|
52
|
+
"openapi-typescript": "^6.2.4"
|
|
46
53
|
},
|
|
47
54
|
|
|
48
55
|
"devDependencies": {
|