@ventlio/tanstack-query 0.5.4 → 0.5.5

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.
Files changed (77) hide show
  1. package/dist/config/bootstrapQueryRequest.d.ts +4 -4
  2. package/dist/config/bootstrapQueryRequest.js +15 -15
  3. package/dist/config/config.interface.d.ts +4 -4
  4. package/dist/config/index.d.ts +6 -6
  5. package/dist/config/useEnvironmentVariables.d.ts +2 -2
  6. package/dist/config/useEnvironmentVariables.js +8 -8
  7. package/dist/config/useQueryConfig.d.ts +2 -2
  8. package/dist/config/useQueryConfig.js +5 -5
  9. package/dist/config/useQueryHeaders.d.ts +2 -2
  10. package/dist/config/useQueryHeaders.js +9 -9
  11. package/dist/config/useReactNativeEnv.d.ts +5 -5
  12. package/dist/config/useReactNativeEnv.js +6 -6
  13. package/dist/helpers/index.d.ts +2 -2
  14. package/dist/helpers/scrollToTop.d.ts +1 -1
  15. package/dist/helpers/scrollToTop.js +5 -5
  16. package/dist/helpers/timeFuncs.d.ts +1 -1
  17. package/dist/helpers/timeFuncs.js +7 -7
  18. package/dist/hooks/index.d.ts +1 -1
  19. package/dist/hooks/useUploadProgress.d.ts +5 -5
  20. package/dist/hooks/useUploadProgress.js +8 -8
  21. package/dist/index.d.ts +8 -8
  22. package/dist/index.mjs +907 -830
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/model/index.d.ts +4 -4
  25. package/dist/model/model.interface.d.ts +11 -11
  26. package/dist/model/useKeyTrackerModel.d.ts +4 -4
  27. package/dist/model/useKeyTrackerModel.js +14 -14
  28. package/dist/model/useQueryModel.d.ts +2 -2
  29. package/dist/model/useQueryModel.js +115 -115
  30. package/dist/model/useRefetchQuery.d.ts +3 -3
  31. package/dist/model/useRefetchQuery.js +10 -10
  32. package/dist/queries/index.d.ts +6 -6
  33. package/dist/queries/queries.interface.d.ts +17 -17
  34. package/dist/queries/useDeleteRequest.d.ts +60 -60
  35. package/dist/queries/useDeleteRequest.js +86 -71
  36. package/dist/queries/useDeleteRequest.js.map +1 -1
  37. package/dist/queries/useGetInfiniteRequest.d.ts +108 -110
  38. package/dist/queries/useGetInfiniteRequest.js +117 -102
  39. package/dist/queries/useGetInfiniteRequest.js.map +1 -1
  40. package/dist/queries/useGetRequest.d.ts +73 -74
  41. package/dist/queries/useGetRequest.js +148 -133
  42. package/dist/queries/useGetRequest.js.map +1 -1
  43. package/dist/queries/usePatchRequest.d.ts +86 -86
  44. package/dist/queries/usePatchRequest.js +86 -70
  45. package/dist/queries/usePatchRequest.js.map +1 -1
  46. package/dist/queries/usePostRequest.d.ts +149 -157
  47. package/dist/queries/usePostRequest.js +94 -78
  48. package/dist/queries/usePostRequest.js.map +1 -1
  49. package/dist/queries/usePutRequest.d.ts +86 -86
  50. package/dist/request/axios-instance.d.ts +3 -3
  51. package/dist/request/axios-instance.js +6 -6
  52. package/dist/request/buildFormData.d.ts +1 -1
  53. package/dist/request/buildFormData.js +40 -40
  54. package/dist/request/index.d.ts +6 -6
  55. package/dist/request/make-request.d.ts +2 -2
  56. package/dist/request/make-request.js +80 -80
  57. package/dist/request/request.enum.d.ts +11 -11
  58. package/dist/request/request.enum.js +12 -12
  59. package/dist/request/request.interface.d.ts +48 -48
  60. package/dist/request/transformer.d.ts +7 -7
  61. package/dist/request/transformer.js +18 -18
  62. package/dist/stores/index.d.ts +2 -2
  63. package/dist/stores/useHeaderStore.d.ts +7 -7
  64. package/dist/stores/useHeaderStore.js +5 -5
  65. package/dist/stores/usePauseFutureRequests.d.ts +7 -7
  66. package/dist/stores/usePauseFutureRequests.js +13 -13
  67. package/dist/types/index.d.ts +34 -29
  68. package/package.json +2 -2
  69. package/src/queries/useDeleteRequest.ts +24 -5
  70. package/src/queries/useGetInfiniteRequest.ts +21 -2
  71. package/src/queries/useGetRequest.ts +26 -9
  72. package/src/queries/usePatchRequest.ts +21 -1
  73. package/src/queries/usePostRequest.ts +21 -1
  74. package/src/queries/usePutRequest.ts +21 -1
  75. package/src/request/make-request.ts +2 -2
  76. package/src/request/transformer.ts +1 -1
  77. package/src/types/index.ts +5 -1
@@ -12,84 +12,100 @@ import 'axios';
12
12
  import { makeRequest } from '../request/make-request.js';
13
13
  import { HttpMethod } from '../request/request.enum.js';
14
14
 
15
- const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelectors, }) => {
16
- const { API_URL, TIMEOUT } = useEnvironmentVariables();
17
- const config = useQueryConfig();
18
- const globalHeaders = useHeaderStore((state) => state.headers);
19
- const { isApp } = useReactNativeEnv();
20
- const { uploadProgressPercent, onUploadProgress } = useUploadProgress();
21
- const [requestPayload, setRequestPayload] = useState();
22
- const isFutureMutationsPaused = usePauseFutureRequests((state) => state.isFutureMutationsPaused);
23
- const sendRequest = async (res, rej, postData) => {
24
- // get request headers
25
- const { data, requestConfig } = postData;
26
- delete requestConfig?.body;
27
- const requestOptions = {
28
- path,
29
- body: data,
30
- method: HttpMethod.POST,
31
- isFormData,
32
- headers: { ...globalHeaders, ...headers },
33
- baseURL: baseUrl ?? API_URL,
34
- timeout: TIMEOUT,
35
- appFileConfig: {
36
- isApp,
37
- fileSelectors,
38
- },
39
- onUploadProgress,
40
- ...requestConfig,
41
- };
42
- let shouldContinue = true;
43
- if (config.options?.mutationMiddleware) {
44
- shouldContinue = await config.options.mutationMiddleware({
45
- mutationKey: [path, { type: 'mutation' }],
46
- ...requestOptions,
47
- });
48
- }
49
- if (shouldContinue) {
50
- const postResponse = await makeRequest(requestOptions);
51
- if (postResponse.status) {
52
- // scroll to top after success
53
- if (config.options?.context !== 'app') {
54
- scrollToTop();
55
- }
56
- res(postResponse);
57
- }
58
- else {
59
- // scroll to top after error
60
- if (config.options?.context !== 'app') {
61
- scrollToTop();
62
- }
63
- rej(postResponse);
64
- }
65
- }
66
- else {
67
- rej(null);
68
- }
69
- };
70
- // register post mutation
71
- const mutation = useMutation({
72
- mutationKey: [path, { type: 'mutation' }],
73
- mutationFn: async (postData) => new Promise((res, rej) => sendRequest(res, rej, postData)),
74
- });
75
- const post = async (data, options) => {
76
- if (!isFutureMutationsPaused) {
77
- const { requestConfig, ...otherOptions } = options ?? {};
78
- return mutation.mutateAsync({ data, requestConfig }, otherOptions);
79
- }
80
- else {
81
- setRequestPayload({ data, options });
82
- return undefined;
83
- }
84
- };
85
- useEffect(() => {
86
- if (!isFutureMutationsPaused && requestPayload) {
87
- post(requestPayload.data, requestPayload.options);
88
- setRequestPayload(undefined);
89
- }
90
- // eslint-disable-next-line react-hooks/exhaustive-deps
91
- }, [isFutureMutationsPaused]);
92
- return { post, uploadProgressPercent, ...mutation, isLoading: mutation.isPending || isFutureMutationsPaused };
15
+ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelectors, }) => {
16
+ const { API_URL, TIMEOUT } = useEnvironmentVariables();
17
+ const config = useQueryConfig();
18
+ const globalHeaders = useHeaderStore((state) => state.headers);
19
+ const { isApp } = useReactNativeEnv();
20
+ const { uploadProgressPercent, onUploadProgress } = useUploadProgress();
21
+ const [requestPayload, setRequestPayload] = useState();
22
+ const isFutureMutationsPaused = usePauseFutureRequests((state) => state.isFutureMutationsPaused);
23
+ const sendRequest = async (res, rej, postData) => {
24
+ // get request headers
25
+ const { data, requestConfig } = postData;
26
+ delete requestConfig?.body;
27
+ const requestOptions = {
28
+ path,
29
+ body: data,
30
+ method: HttpMethod.POST,
31
+ isFormData,
32
+ headers: { ...globalHeaders, ...headers },
33
+ baseURL: baseUrl ?? API_URL,
34
+ timeout: TIMEOUT,
35
+ appFileConfig: {
36
+ isApp,
37
+ fileSelectors,
38
+ },
39
+ onUploadProgress,
40
+ ...requestConfig,
41
+ };
42
+ let shouldContinue = true;
43
+ if (config.options?.mutationMiddleware) {
44
+ shouldContinue = await config.options.mutationMiddleware({
45
+ mutationKey: [path, { type: 'mutation' }],
46
+ ...requestOptions,
47
+ });
48
+ }
49
+ if (shouldContinue) {
50
+ let postResponse;
51
+ if (config.options?.middleware) {
52
+ // perform global middleware
53
+ const middlewareResponse = await config.options.middleware(async () => await makeRequest(requestOptions), {
54
+ path,
55
+ baseUrl: baseUrl ?? API_URL,
56
+ body: data,
57
+ });
58
+ if (!middlewareResponse) {
59
+ rej();
60
+ return;
61
+ }
62
+ postResponse = middlewareResponse;
63
+ }
64
+ else {
65
+ postResponse = await makeRequest(requestOptions);
66
+ }
67
+ if (postResponse.status) {
68
+ // scroll to top after success
69
+ if (config.options?.context !== 'app') {
70
+ scrollToTop();
71
+ }
72
+ res(postResponse);
73
+ }
74
+ else {
75
+ // scroll to top after error
76
+ if (config.options?.context !== 'app') {
77
+ scrollToTop();
78
+ }
79
+ rej(postResponse);
80
+ }
81
+ }
82
+ else {
83
+ rej(null);
84
+ }
85
+ };
86
+ // register post mutation
87
+ const mutation = useMutation({
88
+ mutationKey: [path, { type: 'mutation' }],
89
+ mutationFn: async (postData) => new Promise((res, rej) => sendRequest(res, rej, postData)),
90
+ });
91
+ const post = async (data, options) => {
92
+ if (!isFutureMutationsPaused) {
93
+ const { requestConfig, ...otherOptions } = options ?? {};
94
+ return mutation.mutateAsync({ data, requestConfig }, otherOptions);
95
+ }
96
+ else {
97
+ setRequestPayload({ data, options });
98
+ return undefined;
99
+ }
100
+ };
101
+ useEffect(() => {
102
+ if (!isFutureMutationsPaused && requestPayload) {
103
+ post(requestPayload.data, requestPayload.options);
104
+ setRequestPayload(undefined);
105
+ }
106
+ // eslint-disable-next-line react-hooks/exhaustive-deps
107
+ }, [isFutureMutationsPaused]);
108
+ return { post, uploadProgressPercent, ...mutation, isLoading: mutation.isPending || isFutureMutationsPaused };
93
109
  };
94
110
 
95
111
  export { usePostRequest };
@@ -1 +1 @@
1
- {"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,86 +1,86 @@
1
- import type { MutateOptions } from '@tanstack/react-query';
2
- import type { IRequestError, IRequestSuccess } from '../request/request.interface';
3
- import type { DefaultRequestOptions } from './queries.interface';
4
- export declare const usePutRequest: <TResponse>({ path, baseUrl, headers }: {
5
- path: string;
6
- } & DefaultRequestOptions) => {
7
- isLoading: boolean;
8
- data: undefined;
9
- variables: undefined;
10
- error: null;
11
- isError: false;
12
- isIdle: true;
13
- isPending: false;
14
- isSuccess: false;
15
- status: "idle";
16
- mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
17
- reset: () => void;
18
- context: unknown;
19
- failureCount: number;
20
- failureReason: IRequestError | null;
21
- isPaused: boolean;
22
- submittedAt: number;
23
- mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
24
- put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
25
- uploadProgressPercent: number;
26
- } | {
27
- isLoading: boolean;
28
- data: undefined;
29
- variables: void;
30
- error: null;
31
- isError: false;
32
- isIdle: false;
33
- isPending: true;
34
- isSuccess: false;
35
- status: "pending";
36
- mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
37
- reset: () => void;
38
- context: unknown;
39
- failureCount: number;
40
- failureReason: IRequestError | null;
41
- isPaused: boolean;
42
- submittedAt: number;
43
- mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
44
- put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
45
- uploadProgressPercent: number;
46
- } | {
47
- isLoading: boolean;
48
- data: undefined;
49
- error: IRequestError;
50
- variables: void;
51
- isError: true;
52
- isIdle: false;
53
- isPending: false;
54
- isSuccess: false;
55
- status: "error";
56
- mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
57
- reset: () => void;
58
- context: unknown;
59
- failureCount: number;
60
- failureReason: IRequestError | null;
61
- isPaused: boolean;
62
- submittedAt: number;
63
- mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
64
- put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
65
- uploadProgressPercent: number;
66
- } | {
67
- isLoading: boolean;
68
- data: IRequestSuccess<TResponse>;
69
- error: null;
70
- variables: void;
71
- isError: false;
72
- isIdle: false;
73
- isPending: false;
74
- isSuccess: true;
75
- status: "success";
76
- mutate: import("@tanstack/react-query/build/legacy/types").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
77
- reset: () => void;
78
- context: unknown;
79
- failureCount: number;
80
- failureReason: IRequestError | null;
81
- isPaused: boolean;
82
- submittedAt: number;
83
- mutateAsync: import("@tanstack/react-query/build/legacy/types").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
84
- put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
85
- uploadProgressPercent: number;
86
- };
1
+ import type { MutateOptions } from '@tanstack/react-query';
2
+ import type { IRequestError, IRequestSuccess } from '../request/request.interface';
3
+ import type { DefaultRequestOptions } from './queries.interface';
4
+ export declare const usePutRequest: <TResponse>({ path, baseUrl, headers }: {
5
+ path: string;
6
+ } & DefaultRequestOptions) => {
7
+ isLoading: boolean;
8
+ data: undefined;
9
+ variables: undefined;
10
+ error: null;
11
+ isError: false;
12
+ isIdle: true;
13
+ isPending: false;
14
+ isSuccess: false;
15
+ status: "idle";
16
+ mutate: import("@tanstack/react-query").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
17
+ reset: () => void;
18
+ context: unknown;
19
+ failureCount: number;
20
+ failureReason: IRequestError | null;
21
+ isPaused: boolean;
22
+ submittedAt: number;
23
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
24
+ put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
25
+ uploadProgressPercent: number;
26
+ } | {
27
+ isLoading: boolean;
28
+ data: undefined;
29
+ variables: void;
30
+ error: null;
31
+ isError: false;
32
+ isIdle: false;
33
+ isPending: true;
34
+ isSuccess: false;
35
+ status: "pending";
36
+ mutate: import("@tanstack/react-query").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
37
+ reset: () => void;
38
+ context: unknown;
39
+ failureCount: number;
40
+ failureReason: IRequestError | null;
41
+ isPaused: boolean;
42
+ submittedAt: number;
43
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
44
+ put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
45
+ uploadProgressPercent: number;
46
+ } | {
47
+ isLoading: boolean;
48
+ data: undefined;
49
+ error: IRequestError;
50
+ variables: void;
51
+ isError: true;
52
+ isIdle: false;
53
+ isPending: false;
54
+ isSuccess: false;
55
+ status: "error";
56
+ mutate: import("@tanstack/react-query").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
57
+ reset: () => void;
58
+ context: unknown;
59
+ failureCount: number;
60
+ failureReason: IRequestError | null;
61
+ isPaused: boolean;
62
+ submittedAt: number;
63
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
64
+ put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
65
+ uploadProgressPercent: number;
66
+ } | {
67
+ isLoading: boolean;
68
+ data: IRequestSuccess<TResponse>;
69
+ error: null;
70
+ variables: void;
71
+ isError: false;
72
+ isIdle: false;
73
+ isPending: false;
74
+ isSuccess: true;
75
+ status: "success";
76
+ mutate: import("@tanstack/react-query").UseMutateFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
77
+ reset: () => void;
78
+ context: unknown;
79
+ failureCount: number;
80
+ failureReason: IRequestError | null;
81
+ isPaused: boolean;
82
+ submittedAt: number;
83
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<IRequestSuccess<TResponse>, IRequestError, void, unknown>;
84
+ put: (data: any, options?: MutateOptions<IRequestSuccess<TResponse>, IRequestError, void, unknown> | undefined) => Promise<IRequestSuccess<TResponse> | undefined>;
85
+ uploadProgressPercent: number;
86
+ };
@@ -1,3 +1,3 @@
1
- import type { AxiosInstance } from 'axios';
2
- import type { IMakeRequest } from './request.interface';
3
- export declare const axiosInstance: ({ baseURL, timeout, headers }: Partial<IMakeRequest>) => AxiosInstance;
1
+ import type { AxiosInstance } from 'axios';
2
+ import type { IMakeRequest } from './request.interface';
3
+ export declare const axiosInstance: ({ baseURL, timeout, headers }: Partial<IMakeRequest>) => AxiosInstance;
@@ -1,11 +1,11 @@
1
1
  import axios from 'axios';
2
2
 
3
- const axiosInstance = ({ baseURL, timeout, headers }) => {
4
- return axios.create({
5
- baseURL,
6
- timeout,
7
- headers,
8
- });
3
+ const axiosInstance = ({ baseURL, timeout, headers }) => {
4
+ return axios.create({
5
+ baseURL,
6
+ timeout,
7
+ headers,
8
+ });
9
9
  };
10
10
 
11
11
  export { axiosInstance };
@@ -1 +1 @@
1
- export declare const buildFormData: (body: Record<string, any>) => FormData;
1
+ export declare const buildFormData: (body: Record<string, any>) => FormData;
@@ -1,43 +1,43 @@
1
- const buildFormData = (body) => {
2
- const formData = new FormData();
3
- const handleArrayValue = (key, value) => {
4
- for (const item of value) {
5
- if (item instanceof File) {
6
- formData.append(key, item);
7
- }
8
- else if (item instanceof Object) {
9
- formData.append(key, JSON.stringify(item));
10
- }
11
- else {
12
- formData.append(key, item);
13
- }
14
- }
15
- };
16
- const handleObjectValue = (key, value) => {
17
- if (value instanceof File) {
18
- formData.append(key, value);
19
- }
20
- else {
21
- formData.append(key, JSON.stringify(value));
22
- }
23
- };
24
- const handlePrimitiveValue = (key, value) => {
25
- formData.append(key, value);
26
- };
27
- const bodyKeys = Object.keys(body);
28
- bodyKeys.forEach((key) => {
29
- const inputValue = body[key];
30
- if (Array.isArray(inputValue) && inputValue.length > 0) {
31
- handleArrayValue(key, inputValue);
32
- }
33
- else if (inputValue instanceof Object) {
34
- handleObjectValue(key, inputValue);
35
- }
36
- else {
37
- handlePrimitiveValue(key, inputValue);
38
- }
39
- });
40
- return formData;
1
+ const buildFormData = (body) => {
2
+ const formData = new FormData();
3
+ const handleArrayValue = (key, value) => {
4
+ for (const item of value) {
5
+ if (item instanceof File) {
6
+ formData.append(key, item);
7
+ }
8
+ else if (item instanceof Object) {
9
+ formData.append(key, JSON.stringify(item));
10
+ }
11
+ else {
12
+ formData.append(key, item);
13
+ }
14
+ }
15
+ };
16
+ const handleObjectValue = (key, value) => {
17
+ if (value instanceof File) {
18
+ formData.append(key, value);
19
+ }
20
+ else {
21
+ formData.append(key, JSON.stringify(value));
22
+ }
23
+ };
24
+ const handlePrimitiveValue = (key, value) => {
25
+ formData.append(key, value);
26
+ };
27
+ const bodyKeys = Object.keys(body);
28
+ bodyKeys.forEach((key) => {
29
+ const inputValue = body[key];
30
+ if (Array.isArray(inputValue) && inputValue.length > 0) {
31
+ handleArrayValue(key, inputValue);
32
+ }
33
+ else if (inputValue instanceof Object) {
34
+ handleObjectValue(key, inputValue);
35
+ }
36
+ else {
37
+ handlePrimitiveValue(key, inputValue);
38
+ }
39
+ });
40
+ return formData;
41
41
  };
42
42
 
43
43
  export { buildFormData };
@@ -1,6 +1,6 @@
1
- export * from './axios-instance';
2
- export * from './buildFormData';
3
- export * from './make-request';
4
- export * from './request.enum';
5
- export * from './request.interface';
6
- export * from './transformer';
1
+ export * from './axios-instance';
2
+ export * from './buildFormData';
3
+ export * from './make-request';
4
+ export * from './request.enum';
5
+ export * from './request.interface';
6
+ export * from './transformer';
@@ -1,2 +1,2 @@
1
- import type { IMakeRequest } from './request.interface';
2
- export declare function makeRequest<TResponse>({ body, method, path, isFormData, headers, baseURL, timeout, appFileConfig, onUploadProgress, }: IMakeRequest): Promise<import("./request.interface").IRequestError>;
1
+ import type { IMakeRequest, IRequestError, IRequestSuccess } from './request.interface';
2
+ export declare function makeRequest<TResponse>({ body, method, path, isFormData, headers, baseURL, timeout, appFileConfig, onUploadProgress, }: IMakeRequest): Promise<IRequestSuccess<TResponse> | IRequestError>;