@arascreative/erp-client 2.0.0 → 3.1.0
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/generated/api.d.ts +183 -89
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/generated/api.js +111 -77
- package/dist/generated/zod.d.ts +38 -24
- package/dist/generated/zod.d.ts.map +1 -1
- package/dist/generated/zod.js +17 -9
- package/package.json +1 -1
package/dist/generated/api.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
8
8
|
;
|
|
9
9
|
export const getGetAntiforgeryTokenUrl = () => {
|
|
10
|
-
return `/identity/antiforgery`;
|
|
10
|
+
return `/api/v1/identity/antiforgery`;
|
|
11
11
|
};
|
|
12
12
|
export const getAntiforgeryToken = async (options) => {
|
|
13
13
|
const res = await fetch(getGetAntiforgeryTokenUrl(), {
|
|
@@ -20,7 +20,7 @@ export const getAntiforgeryToken = async (options) => {
|
|
|
20
20
|
};
|
|
21
21
|
export const getGetAntiforgeryTokenQueryKey = () => {
|
|
22
22
|
return [
|
|
23
|
-
`/identity/antiforgery`
|
|
23
|
+
`/api/v1/identity/antiforgery`
|
|
24
24
|
];
|
|
25
25
|
};
|
|
26
26
|
export const getGetAntiforgeryTokenQueryOptions = (options) => {
|
|
@@ -39,7 +39,7 @@ export function useGetAntiforgeryToken(options, queryClient) {
|
|
|
39
39
|
return query;
|
|
40
40
|
}
|
|
41
41
|
export const getLoginUrl = () => {
|
|
42
|
-
return `/identity/login`;
|
|
42
|
+
return `/api/v1/identity/login`;
|
|
43
43
|
};
|
|
44
44
|
export const login = async (loginBody, options) => {
|
|
45
45
|
const res = await fetch(getLoginUrl(), {
|
|
@@ -73,7 +73,7 @@ export const useLogin = (options, queryClient) => {
|
|
|
73
73
|
return useMutation(mutationOptions, queryClient);
|
|
74
74
|
};
|
|
75
75
|
export const getGetCurrentUserUrl = () => {
|
|
76
|
-
return `/identity/me`;
|
|
76
|
+
return `/api/v1/identity/me`;
|
|
77
77
|
};
|
|
78
78
|
export const getCurrentUser = async (options) => {
|
|
79
79
|
const res = await fetch(getGetCurrentUserUrl(), {
|
|
@@ -86,7 +86,7 @@ export const getCurrentUser = async (options) => {
|
|
|
86
86
|
};
|
|
87
87
|
export const getGetCurrentUserQueryKey = () => {
|
|
88
88
|
return [
|
|
89
|
-
`/identity/me`
|
|
89
|
+
`/api/v1/identity/me`
|
|
90
90
|
];
|
|
91
91
|
};
|
|
92
92
|
export const getGetCurrentUserQueryOptions = (options) => {
|
|
@@ -105,7 +105,7 @@ export function useGetCurrentUser(options, queryClient) {
|
|
|
105
105
|
return query;
|
|
106
106
|
}
|
|
107
107
|
export const getLogoutUrl = () => {
|
|
108
|
-
return `/identity/logout`;
|
|
108
|
+
return `/api/v1/identity/logout`;
|
|
109
109
|
};
|
|
110
110
|
export const logout = async (options) => {
|
|
111
111
|
const res = await fetch(getLogoutUrl(), {
|
|
@@ -136,7 +136,7 @@ export const useLogout = (options, queryClient) => {
|
|
|
136
136
|
return useMutation(mutationOptions, queryClient);
|
|
137
137
|
};
|
|
138
138
|
export const getCreateOwnerUrl = () => {
|
|
139
|
-
return `/identity/owner`;
|
|
139
|
+
return `/api/v1/identity/owner`;
|
|
140
140
|
};
|
|
141
141
|
export const createOwner = async (createOwnerBody, options) => {
|
|
142
142
|
const res = await fetch(getCreateOwnerUrl(), {
|
|
@@ -177,7 +177,7 @@ export const getSearchAddressesUrl = (params) => {
|
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
const stringifiedParams = normalizedParams.toString();
|
|
180
|
-
return stringifiedParams.length > 0 ? `/addresses/search?${stringifiedParams}` : `/addresses/search`;
|
|
180
|
+
return stringifiedParams.length > 0 ? `/api/v1/addresses/search?${stringifiedParams}` : `/api/v1/addresses/search`;
|
|
181
181
|
};
|
|
182
182
|
export const searchAddresses = async (params, options) => {
|
|
183
183
|
const res = await fetch(getSearchAddressesUrl(params), {
|
|
@@ -190,7 +190,7 @@ export const searchAddresses = async (params, options) => {
|
|
|
190
190
|
};
|
|
191
191
|
export const getSearchAddressesQueryKey = (params) => {
|
|
192
192
|
return [
|
|
193
|
-
`/addresses/search`, ...(params ? [params] : [])
|
|
193
|
+
`/api/v1/addresses/search`, ...(params ? [params] : [])
|
|
194
194
|
];
|
|
195
195
|
};
|
|
196
196
|
export const getSearchAddressesQueryOptions = (params, options) => {
|
|
@@ -208,8 +208,42 @@ export function useSearchAddresses(params, options, queryClient) {
|
|
|
208
208
|
query.queryKey = queryOptions.queryKey;
|
|
209
209
|
return query;
|
|
210
210
|
}
|
|
211
|
+
export const getUploadStockItemImageUrl = () => {
|
|
212
|
+
return `/api/v1/stock-items/image`;
|
|
213
|
+
};
|
|
214
|
+
export const uploadStockItemImage = async (uploadStockItemImageBody, options) => {
|
|
215
|
+
const res = await fetch(getUploadStockItemImageUrl(), {
|
|
216
|
+
...options,
|
|
217
|
+
method: 'POST',
|
|
218
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
219
|
+
body: JSON.stringify(uploadStockItemImageBody)
|
|
220
|
+
});
|
|
221
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
222
|
+
const data = body ? JSON.parse(body) : {};
|
|
223
|
+
return { data, status: res.status, headers: res.headers };
|
|
224
|
+
};
|
|
225
|
+
export const getUploadStockItemImageMutationOptions = (options) => {
|
|
226
|
+
const mutationKey = ['uploadStockItemImage'];
|
|
227
|
+
const { mutation: mutationOptions, fetch: fetchOptions } = options ?
|
|
228
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
229
|
+
options
|
|
230
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
231
|
+
: { mutation: { mutationKey, }, fetch: undefined };
|
|
232
|
+
const mutationFn = (props) => {
|
|
233
|
+
const { data } = props ?? {};
|
|
234
|
+
return uploadStockItemImage(data, fetchOptions);
|
|
235
|
+
};
|
|
236
|
+
return { mutationFn, ...mutationOptions };
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* @summary Upload stock item image
|
|
240
|
+
*/
|
|
241
|
+
export const useUploadStockItemImage = (options, queryClient) => {
|
|
242
|
+
const mutationOptions = getUploadStockItemImageMutationOptions(options);
|
|
243
|
+
return useMutation(mutationOptions, queryClient);
|
|
244
|
+
};
|
|
211
245
|
export const getInitiateUploadUrl = () => {
|
|
212
|
-
return `/files/initiate-upload`;
|
|
246
|
+
return `/api/v1/files/initiate-upload`;
|
|
213
247
|
};
|
|
214
248
|
export const initiateUpload = async (initiateUploadBody, options) => {
|
|
215
249
|
const res = await fetch(getInitiateUploadUrl(), {
|
|
@@ -243,7 +277,7 @@ export const useInitiateUpload = (options, queryClient) => {
|
|
|
243
277
|
return useMutation(mutationOptions, queryClient);
|
|
244
278
|
};
|
|
245
279
|
export const getUploadFileUrl = () => {
|
|
246
|
-
return `/files/upload`;
|
|
280
|
+
return `/api/v1/files/upload`;
|
|
247
281
|
};
|
|
248
282
|
export const uploadFile = async (uploadFileBody, options) => {
|
|
249
283
|
const res = await fetch(getUploadFileUrl(), {
|
|
@@ -277,7 +311,7 @@ export const useUploadFile = (options, queryClient) => {
|
|
|
277
311
|
return useMutation(mutationOptions, queryClient);
|
|
278
312
|
};
|
|
279
313
|
export const getToggleWarehouseStatusUrl = (id) => {
|
|
280
|
-
return `/warehouses/${id}/toggle-status`;
|
|
314
|
+
return `/api/v1/warehouses/${id}/toggle-status`;
|
|
281
315
|
};
|
|
282
316
|
export const toggleWarehouseStatus = async (id, options) => {
|
|
283
317
|
const res = await fetch(getToggleWarehouseStatusUrl(id), {
|
|
@@ -309,7 +343,7 @@ export const useToggleWarehouseStatus = (options, queryClient) => {
|
|
|
309
343
|
return useMutation(mutationOptions, queryClient);
|
|
310
344
|
};
|
|
311
345
|
export const getChangeStockItemStatusUrl = (id) => {
|
|
312
|
-
return `/stock-items/${id}/status`;
|
|
346
|
+
return `/api/v1/stock-items/${id}/status`;
|
|
313
347
|
};
|
|
314
348
|
export const changeStockItemStatus = async (id, changeStockItemStatusBody, options) => {
|
|
315
349
|
const res = await fetch(getChangeStockItemStatusUrl(id), {
|
|
@@ -343,7 +377,7 @@ export const useChangeStockItemStatus = (options, queryClient) => {
|
|
|
343
377
|
return useMutation(mutationOptions, queryClient);
|
|
344
378
|
};
|
|
345
379
|
export const getCompleteUploadUrl = (id) => {
|
|
346
|
-
return `/files/${id}/complete`;
|
|
380
|
+
return `/api/v1/files/${id}/complete`;
|
|
347
381
|
};
|
|
348
382
|
export const completeUpload = async (id, completeUploadBody, options) => {
|
|
349
383
|
const res = await fetch(getCompleteUploadUrl(id), {
|
|
@@ -384,7 +418,7 @@ export const getGetFileAccessUrlUrl = (id, params) => {
|
|
|
384
418
|
}
|
|
385
419
|
});
|
|
386
420
|
const stringifiedParams = normalizedParams.toString();
|
|
387
|
-
return stringifiedParams.length > 0 ? `/files/${id}/access-url?${stringifiedParams}` : `/files/${id}/access-url`;
|
|
421
|
+
return stringifiedParams.length > 0 ? `/api/v1/files/${id}/access-url?${stringifiedParams}` : `/api/v1/files/${id}/access-url`;
|
|
388
422
|
};
|
|
389
423
|
export const getFileAccessUrl = async (id, params, options) => {
|
|
390
424
|
const res = await fetch(getGetFileAccessUrlUrl(id, params), {
|
|
@@ -397,7 +431,7 @@ export const getFileAccessUrl = async (id, params, options) => {
|
|
|
397
431
|
};
|
|
398
432
|
export const getGetFileAccessUrlQueryKey = (id, params) => {
|
|
399
433
|
return [
|
|
400
|
-
`/files/${id}/access-url`, ...(params ? [params] : [])
|
|
434
|
+
`/api/v1/files/${id}/access-url`, ...(params ? [params] : [])
|
|
401
435
|
];
|
|
402
436
|
};
|
|
403
437
|
export const getGetFileAccessUrlQueryOptions = (id, params, options) => {
|
|
@@ -416,7 +450,7 @@ export function useGetFileAccessUrl(id, params, options, queryClient) {
|
|
|
416
450
|
return query;
|
|
417
451
|
}
|
|
418
452
|
export const getGetWarehouseByIdUrl = (id) => {
|
|
419
|
-
return `/warehouses/${id}`;
|
|
453
|
+
return `/api/v1/warehouses/${id}`;
|
|
420
454
|
};
|
|
421
455
|
export const getWarehouseById = async (id, options) => {
|
|
422
456
|
const res = await fetch(getGetWarehouseByIdUrl(id), {
|
|
@@ -429,7 +463,7 @@ export const getWarehouseById = async (id, options) => {
|
|
|
429
463
|
};
|
|
430
464
|
export const getGetWarehouseByIdQueryKey = (id) => {
|
|
431
465
|
return [
|
|
432
|
-
`/warehouses/${id}`
|
|
466
|
+
`/api/v1/warehouses/${id}`
|
|
433
467
|
];
|
|
434
468
|
};
|
|
435
469
|
export const getGetWarehouseByIdQueryOptions = (id, options) => {
|
|
@@ -448,7 +482,7 @@ export function useGetWarehouseById(id, options, queryClient) {
|
|
|
448
482
|
return query;
|
|
449
483
|
}
|
|
450
484
|
export const getUpdateWarehouseUrl = (id) => {
|
|
451
|
-
return `/warehouses/${id}`;
|
|
485
|
+
return `/api/v1/warehouses/${id}`;
|
|
452
486
|
};
|
|
453
487
|
export const updateWarehouse = async (id, updateWarehouseBody, options) => {
|
|
454
488
|
const res = await fetch(getUpdateWarehouseUrl(id), {
|
|
@@ -482,7 +516,7 @@ export const useUpdateWarehouse = (options, queryClient) => {
|
|
|
482
516
|
return useMutation(mutationOptions, queryClient);
|
|
483
517
|
};
|
|
484
518
|
export const getDeleteWarehouseUrl = (id) => {
|
|
485
|
-
return `/warehouses/${id}`;
|
|
519
|
+
return `/api/v1/warehouses/${id}`;
|
|
486
520
|
};
|
|
487
521
|
export const deleteWarehouse = async (id, options) => {
|
|
488
522
|
const res = await fetch(getDeleteWarehouseUrl(id), {
|
|
@@ -514,7 +548,7 @@ export const useDeleteWarehouse = (options, queryClient) => {
|
|
|
514
548
|
return useMutation(mutationOptions, queryClient);
|
|
515
549
|
};
|
|
516
550
|
export const getUpdateStockItemUrl = (id) => {
|
|
517
|
-
return `/stock-items/${id}`;
|
|
551
|
+
return `/api/v1/stock-items/${id}`;
|
|
518
552
|
};
|
|
519
553
|
export const updateStockItem = async (id, updateStockItemBody, options) => {
|
|
520
554
|
const res = await fetch(getUpdateStockItemUrl(id), {
|
|
@@ -548,7 +582,7 @@ export const useUpdateStockItem = (options, queryClient) => {
|
|
|
548
582
|
return useMutation(mutationOptions, queryClient);
|
|
549
583
|
};
|
|
550
584
|
export const getDeleteStockItemUrl = (id) => {
|
|
551
|
-
return `/stock-items/${id}`;
|
|
585
|
+
return `/api/v1/stock-items/${id}`;
|
|
552
586
|
};
|
|
553
587
|
export const deleteStockItem = async (id, options) => {
|
|
554
588
|
const res = await fetch(getDeleteStockItemUrl(id), {
|
|
@@ -580,7 +614,7 @@ export const useDeleteStockItem = (options, queryClient) => {
|
|
|
580
614
|
return useMutation(mutationOptions, queryClient);
|
|
581
615
|
};
|
|
582
616
|
export const getGetStoredFileByIdUrl = (id) => {
|
|
583
|
-
return `/files/${id}`;
|
|
617
|
+
return `/api/v1/files/${id}`;
|
|
584
618
|
};
|
|
585
619
|
export const getStoredFileById = async (id, options) => {
|
|
586
620
|
const res = await fetch(getGetStoredFileByIdUrl(id), {
|
|
@@ -593,7 +627,7 @@ export const getStoredFileById = async (id, options) => {
|
|
|
593
627
|
};
|
|
594
628
|
export const getGetStoredFileByIdQueryKey = (id) => {
|
|
595
629
|
return [
|
|
596
|
-
`/files/${id}`
|
|
630
|
+
`/api/v1/files/${id}`
|
|
597
631
|
];
|
|
598
632
|
};
|
|
599
633
|
export const getGetStoredFileByIdQueryOptions = (id, options) => {
|
|
@@ -612,7 +646,7 @@ export function useGetStoredFileById(id, options, queryClient) {
|
|
|
612
646
|
return query;
|
|
613
647
|
}
|
|
614
648
|
export const getDeleteStoredFileUrl = (id) => {
|
|
615
|
-
return `/files/${id}`;
|
|
649
|
+
return `/api/v1/files/${id}`;
|
|
616
650
|
};
|
|
617
651
|
export const deleteStoredFile = async (id, options) => {
|
|
618
652
|
const res = await fetch(getDeleteStoredFileUrl(id), {
|
|
@@ -643,44 +677,12 @@ export const useDeleteStoredFile = (options, queryClient) => {
|
|
|
643
677
|
const mutationOptions = getDeleteStoredFileMutationOptions(options);
|
|
644
678
|
return useMutation(mutationOptions, queryClient);
|
|
645
679
|
};
|
|
646
|
-
export const getGetHealthUrl = () => {
|
|
647
|
-
return `/health`;
|
|
648
|
-
};
|
|
649
|
-
export const getHealth = async (options) => {
|
|
650
|
-
const res = await fetch(getGetHealthUrl(), {
|
|
651
|
-
...options,
|
|
652
|
-
method: 'GET'
|
|
653
|
-
});
|
|
654
|
-
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
655
|
-
const data = body ? JSON.parse(body) : {};
|
|
656
|
-
return { data, status: res.status, headers: res.headers };
|
|
657
|
-
};
|
|
658
|
-
export const getGetHealthQueryKey = () => {
|
|
659
|
-
return [
|
|
660
|
-
`/health`
|
|
661
|
-
];
|
|
662
|
-
};
|
|
663
|
-
export const getGetHealthQueryOptions = (options) => {
|
|
664
|
-
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
665
|
-
const queryKey = queryOptions?.queryKey ?? getGetHealthQueryKey();
|
|
666
|
-
const queryFn = ({ signal }) => getHealth({ signal, ...fetchOptions });
|
|
667
|
-
return { queryKey, queryFn, ...queryOptions };
|
|
668
|
-
};
|
|
669
|
-
/**
|
|
670
|
-
* @summary Health check
|
|
671
|
-
*/
|
|
672
|
-
export function useGetHealth(options, queryClient) {
|
|
673
|
-
const queryOptions = getGetHealthQueryOptions(options);
|
|
674
|
-
const query = useQuery(queryOptions, queryClient);
|
|
675
|
-
query.queryKey = queryOptions.queryKey;
|
|
676
|
-
return query;
|
|
677
|
-
}
|
|
678
680
|
;
|
|
679
|
-
export const
|
|
680
|
-
return `/customers`;
|
|
681
|
+
export const getGetApiV1CustomersUrl = () => {
|
|
682
|
+
return `/api/v1/customers`;
|
|
681
683
|
};
|
|
682
|
-
export const
|
|
683
|
-
const res = await fetch(
|
|
684
|
+
export const getApiV1Customers = async (options) => {
|
|
685
|
+
const res = await fetch(getGetApiV1CustomersUrl(), {
|
|
684
686
|
...options,
|
|
685
687
|
method: 'GET'
|
|
686
688
|
});
|
|
@@ -688,25 +690,25 @@ export const getCustomers = async (options) => {
|
|
|
688
690
|
const data = body ? JSON.parse(body) : {};
|
|
689
691
|
return { data, status: res.status, headers: res.headers };
|
|
690
692
|
};
|
|
691
|
-
export const
|
|
693
|
+
export const getGetApiV1CustomersQueryKey = () => {
|
|
692
694
|
return [
|
|
693
|
-
`/customers`
|
|
695
|
+
`/api/v1/customers`
|
|
694
696
|
];
|
|
695
697
|
};
|
|
696
|
-
export const
|
|
698
|
+
export const getGetApiV1CustomersQueryOptions = (options) => {
|
|
697
699
|
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
698
|
-
const queryKey = queryOptions?.queryKey ??
|
|
699
|
-
const queryFn = ({ signal }) =>
|
|
700
|
+
const queryKey = queryOptions?.queryKey ?? getGetApiV1CustomersQueryKey();
|
|
701
|
+
const queryFn = ({ signal }) => getApiV1Customers({ signal, ...fetchOptions });
|
|
700
702
|
return { queryKey, queryFn, ...queryOptions };
|
|
701
703
|
};
|
|
702
|
-
export function
|
|
703
|
-
const queryOptions =
|
|
704
|
+
export function useGetApiV1Customers(options, queryClient) {
|
|
705
|
+
const queryOptions = getGetApiV1CustomersQueryOptions(options);
|
|
704
706
|
const query = useQuery(queryOptions, queryClient);
|
|
705
707
|
query.queryKey = queryOptions.queryKey;
|
|
706
708
|
return query;
|
|
707
709
|
}
|
|
708
710
|
export const getCreateWarehouseUrl = () => {
|
|
709
|
-
return `/warehouses`;
|
|
711
|
+
return `/api/v1/warehouses`;
|
|
710
712
|
};
|
|
711
713
|
export const createWarehouse = async (createWarehouseBody, options) => {
|
|
712
714
|
const res = await fetch(getCreateWarehouseUrl(), {
|
|
@@ -748,7 +750,7 @@ export const getListWarehousesUrl = (params) => {
|
|
|
748
750
|
}
|
|
749
751
|
});
|
|
750
752
|
const stringifiedParams = normalizedParams.toString();
|
|
751
|
-
return stringifiedParams.length > 0 ? `/warehouses?${stringifiedParams}` : `/warehouses`;
|
|
753
|
+
return stringifiedParams.length > 0 ? `/api/v1/warehouses?${stringifiedParams}` : `/api/v1/warehouses`;
|
|
752
754
|
};
|
|
753
755
|
export const listWarehouses = async (params, options) => {
|
|
754
756
|
const res = await fetch(getListWarehousesUrl(params), {
|
|
@@ -761,7 +763,7 @@ export const listWarehouses = async (params, options) => {
|
|
|
761
763
|
};
|
|
762
764
|
export const getListWarehousesQueryKey = (params) => {
|
|
763
765
|
return [
|
|
764
|
-
`/warehouses`, ...(params ? [params] : [])
|
|
766
|
+
`/api/v1/warehouses`, ...(params ? [params] : [])
|
|
765
767
|
];
|
|
766
768
|
};
|
|
767
769
|
export const getListWarehousesQueryOptions = (params, options) => {
|
|
@@ -788,7 +790,7 @@ export const getListStockMovementsUrl = (params) => {
|
|
|
788
790
|
}
|
|
789
791
|
});
|
|
790
792
|
const stringifiedParams = normalizedParams.toString();
|
|
791
|
-
return stringifiedParams.length > 0 ? `/stock-movements?${stringifiedParams}` : `/stock-movements`;
|
|
793
|
+
return stringifiedParams.length > 0 ? `/api/v1/stock-movements?${stringifiedParams}` : `/api/v1/stock-movements`;
|
|
792
794
|
};
|
|
793
795
|
export const listStockMovements = async (params, options) => {
|
|
794
796
|
const res = await fetch(getListStockMovementsUrl(params), {
|
|
@@ -801,7 +803,7 @@ export const listStockMovements = async (params, options) => {
|
|
|
801
803
|
};
|
|
802
804
|
export const getListStockMovementsQueryKey = (params) => {
|
|
803
805
|
return [
|
|
804
|
-
`/stock-movements`, ...(params ? [params] : [])
|
|
806
|
+
`/api/v1/stock-movements`, ...(params ? [params] : [])
|
|
805
807
|
];
|
|
806
808
|
};
|
|
807
809
|
export const getListStockMovementsQueryOptions = (params, options) => {
|
|
@@ -820,7 +822,7 @@ export function useListStockMovements(params, options, queryClient) {
|
|
|
820
822
|
return query;
|
|
821
823
|
}
|
|
822
824
|
export const getCreateStockItemUrl = () => {
|
|
823
|
-
return `/stock-items`;
|
|
825
|
+
return `/api/v1/stock-items`;
|
|
824
826
|
};
|
|
825
827
|
export const createStockItem = async (createStockItemBody, options) => {
|
|
826
828
|
const res = await fetch(getCreateStockItemUrl(), {
|
|
@@ -862,7 +864,7 @@ export const getListStockItemsUrl = (params) => {
|
|
|
862
864
|
}
|
|
863
865
|
});
|
|
864
866
|
const stringifiedParams = normalizedParams.toString();
|
|
865
|
-
return stringifiedParams.length > 0 ? `/stock-items?${stringifiedParams}` : `/stock-items`;
|
|
867
|
+
return stringifiedParams.length > 0 ? `/api/v1/stock-items?${stringifiedParams}` : `/api/v1/stock-items`;
|
|
866
868
|
};
|
|
867
869
|
export const listStockItems = async (params, options) => {
|
|
868
870
|
const res = await fetch(getListStockItemsUrl(params), {
|
|
@@ -875,7 +877,7 @@ export const listStockItems = async (params, options) => {
|
|
|
875
877
|
};
|
|
876
878
|
export const getListStockItemsQueryKey = (params) => {
|
|
877
879
|
return [
|
|
878
|
-
`/stock-items`, ...(params ? [params] : [])
|
|
880
|
+
`/api/v1/stock-items`, ...(params ? [params] : [])
|
|
879
881
|
];
|
|
880
882
|
};
|
|
881
883
|
export const getListStockItemsQueryOptions = (params, options) => {
|
|
@@ -894,7 +896,7 @@ export function useListStockItems(params, options, queryClient) {
|
|
|
894
896
|
return query;
|
|
895
897
|
}
|
|
896
898
|
export const getCreateBatchUrl = () => {
|
|
897
|
-
return `/batches`;
|
|
899
|
+
return `/api/v1/batches`;
|
|
898
900
|
};
|
|
899
901
|
export const createBatch = async (createBatchBody, options) => {
|
|
900
902
|
const res = await fetch(getCreateBatchUrl(), {
|
|
@@ -927,6 +929,38 @@ export const useCreateBatch = (options, queryClient) => {
|
|
|
927
929
|
const mutationOptions = getCreateBatchMutationOptions(options);
|
|
928
930
|
return useMutation(mutationOptions, queryClient);
|
|
929
931
|
};
|
|
932
|
+
export const getGetHealthUrl = () => {
|
|
933
|
+
return `/health`;
|
|
934
|
+
};
|
|
935
|
+
export const getHealth = async (options) => {
|
|
936
|
+
const res = await fetch(getGetHealthUrl(), {
|
|
937
|
+
...options,
|
|
938
|
+
method: 'GET'
|
|
939
|
+
});
|
|
940
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
941
|
+
const data = body ? JSON.parse(body) : {};
|
|
942
|
+
return { data, status: res.status, headers: res.headers };
|
|
943
|
+
};
|
|
944
|
+
export const getGetHealthQueryKey = () => {
|
|
945
|
+
return [
|
|
946
|
+
`/health`
|
|
947
|
+
];
|
|
948
|
+
};
|
|
949
|
+
export const getGetHealthQueryOptions = (options) => {
|
|
950
|
+
const { query: queryOptions, fetch: fetchOptions } = options ?? {};
|
|
951
|
+
const queryKey = queryOptions?.queryKey ?? getGetHealthQueryKey();
|
|
952
|
+
const queryFn = ({ signal }) => getHealth({ signal, ...fetchOptions });
|
|
953
|
+
return { queryKey, queryFn, ...queryOptions };
|
|
954
|
+
};
|
|
955
|
+
/**
|
|
956
|
+
* @summary Health check
|
|
957
|
+
*/
|
|
958
|
+
export function useGetHealth(options, queryClient) {
|
|
959
|
+
const queryOptions = getGetHealthQueryOptions(options);
|
|
960
|
+
const query = useQuery(queryOptions, queryClient);
|
|
961
|
+
query.queryKey = queryOptions.queryKey;
|
|
962
|
+
return query;
|
|
963
|
+
}
|
|
930
964
|
export const getGetUrl = () => {
|
|
931
965
|
return `/`;
|
|
932
966
|
};
|
package/dist/generated/zod.d.ts
CHANGED
|
@@ -214,6 +214,23 @@ export declare const searchAddressesResponse: zod.ZodArray<zod.ZodObject<{
|
|
|
214
214
|
subDistrictName: string;
|
|
215
215
|
zipCode: string;
|
|
216
216
|
}>, "many">;
|
|
217
|
+
/**
|
|
218
|
+
* Uploads an image to storage using the `stock-item.image` purpose and returns the file id. The returned file id can be sent as `imageFileId` when creating or updating a stock item.
|
|
219
|
+
* @summary Upload stock item image
|
|
220
|
+
*/
|
|
221
|
+
export declare const uploadStockItemImageBody: zod.ZodObject<{
|
|
222
|
+
originalName: zod.ZodString;
|
|
223
|
+
mimeType: zod.ZodString;
|
|
224
|
+
contentBase64: zod.ZodString;
|
|
225
|
+
}, "strip", zod.ZodTypeAny, {
|
|
226
|
+
mimeType: string;
|
|
227
|
+
originalName: string;
|
|
228
|
+
contentBase64: string;
|
|
229
|
+
}, {
|
|
230
|
+
mimeType: string;
|
|
231
|
+
originalName: string;
|
|
232
|
+
contentBase64: string;
|
|
233
|
+
}>;
|
|
217
234
|
/**
|
|
218
235
|
* Creates a pending file metadata record and generates a presigned S3 upload URL for direct client-to-storage upload.
|
|
219
236
|
* @summary Initiate direct file upload to storage
|
|
@@ -226,16 +243,16 @@ export declare const initiateUploadBody: zod.ZodObject<{
|
|
|
226
243
|
purpose: zod.ZodString;
|
|
227
244
|
expiresInSeconds: zod.ZodOptional<zod.ZodNumber>;
|
|
228
245
|
}, "strip", zod.ZodTypeAny, {
|
|
229
|
-
originalName: string;
|
|
230
246
|
mimeType: string;
|
|
231
247
|
sizeBytes: number;
|
|
248
|
+
originalName: string;
|
|
232
249
|
checksum: string;
|
|
233
250
|
purpose: string;
|
|
234
251
|
expiresInSeconds?: number | undefined;
|
|
235
252
|
}, {
|
|
236
|
-
originalName: string;
|
|
237
253
|
mimeType: string;
|
|
238
254
|
sizeBytes: number;
|
|
255
|
+
originalName: string;
|
|
239
256
|
checksum: string;
|
|
240
257
|
purpose: string;
|
|
241
258
|
expiresInSeconds?: number | undefined;
|
|
@@ -249,19 +266,16 @@ export declare const uploadFileBody: zod.ZodObject<{
|
|
|
249
266
|
mimeType: zod.ZodString;
|
|
250
267
|
contentBase64: zod.ZodString;
|
|
251
268
|
purpose: zod.ZodString;
|
|
252
|
-
uploadedBy: zod.ZodOptional<zod.ZodString>;
|
|
253
269
|
}, "strip", zod.ZodTypeAny, {
|
|
254
|
-
originalName: string;
|
|
255
270
|
mimeType: string;
|
|
271
|
+
originalName: string;
|
|
256
272
|
purpose: string;
|
|
257
273
|
contentBase64: string;
|
|
258
|
-
uploadedBy?: string | undefined;
|
|
259
274
|
}, {
|
|
260
|
-
originalName: string;
|
|
261
275
|
mimeType: string;
|
|
276
|
+
originalName: string;
|
|
262
277
|
purpose: string;
|
|
263
278
|
contentBase64: string;
|
|
264
|
-
uploadedBy?: string | undefined;
|
|
265
279
|
}>;
|
|
266
280
|
/**
|
|
267
281
|
* Toggles the active state of a warehouse. Soft-deleted warehouses cannot be toggled.
|
|
@@ -571,10 +585,10 @@ export declare const getStoredFileByIdResponse: zod.ZodObject<{
|
|
|
571
585
|
expiresAt: string;
|
|
572
586
|
status: string;
|
|
573
587
|
id: string;
|
|
574
|
-
storageKey: string;
|
|
575
|
-
originalName: string;
|
|
576
588
|
mimeType: string;
|
|
577
589
|
sizeBytes: number;
|
|
590
|
+
storageKey: string;
|
|
591
|
+
originalName: string;
|
|
578
592
|
checksum: string;
|
|
579
593
|
visibility: string;
|
|
580
594
|
purpose: string;
|
|
@@ -586,10 +600,10 @@ export declare const getStoredFileByIdResponse: zod.ZodObject<{
|
|
|
586
600
|
expiresAt: string;
|
|
587
601
|
status: string;
|
|
588
602
|
id: string;
|
|
589
|
-
storageKey: string;
|
|
590
|
-
originalName: string;
|
|
591
603
|
mimeType: string;
|
|
592
604
|
sizeBytes: number;
|
|
605
|
+
storageKey: string;
|
|
606
|
+
originalName: string;
|
|
593
607
|
checksum: string;
|
|
594
608
|
visibility: string;
|
|
595
609
|
purpose: string;
|
|
@@ -609,19 +623,6 @@ export declare const deleteStoredFileParams: zod.ZodObject<{
|
|
|
609
623
|
}, {
|
|
610
624
|
id: string;
|
|
611
625
|
}>;
|
|
612
|
-
/**
|
|
613
|
-
* @summary Health check
|
|
614
|
-
*/
|
|
615
|
-
export declare const getHealthResponse: zod.ZodObject<{
|
|
616
|
-
status: zod.ZodString;
|
|
617
|
-
timestamp: zod.ZodString;
|
|
618
|
-
}, "strip", zod.ZodTypeAny, {
|
|
619
|
-
status: string;
|
|
620
|
-
timestamp: string;
|
|
621
|
-
}, {
|
|
622
|
-
status: string;
|
|
623
|
-
timestamp: string;
|
|
624
|
-
}>;
|
|
625
626
|
/**
|
|
626
627
|
* Creates a new warehouse with an address resolved from the Address service and an initial active state.
|
|
627
628
|
* @summary Create a new warehouse
|
|
@@ -1111,6 +1112,19 @@ export declare const createBatchBody: zod.ZodObject<{
|
|
|
1111
1112
|
receivedBy?: string | null | undefined;
|
|
1112
1113
|
expiresOn?: string | null | undefined;
|
|
1113
1114
|
}>;
|
|
1115
|
+
/**
|
|
1116
|
+
* @summary Health check
|
|
1117
|
+
*/
|
|
1118
|
+
export declare const getHealthResponse: zod.ZodObject<{
|
|
1119
|
+
status: zod.ZodString;
|
|
1120
|
+
timestamp: zod.ZodString;
|
|
1121
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1122
|
+
status: string;
|
|
1123
|
+
timestamp: string;
|
|
1124
|
+
}, {
|
|
1125
|
+
status: string;
|
|
1126
|
+
timestamp: string;
|
|
1127
|
+
}>;
|
|
1114
1128
|
/**
|
|
1115
1129
|
* @summary API welcome message
|
|
1116
1130
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../src/generated/zod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;EAGtC,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;EAGpB,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUxB,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAA;AAGF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;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;EAEtB,CAAA"}
|
package/dist/generated/zod.js
CHANGED
|
@@ -78,6 +78,15 @@ export const searchAddressesResponseItem = zod.object({
|
|
|
78
78
|
"zipCode": zod.string()
|
|
79
79
|
});
|
|
80
80
|
export const searchAddressesResponse = zod.array(searchAddressesResponseItem);
|
|
81
|
+
/**
|
|
82
|
+
* Uploads an image to storage using the `stock-item.image` purpose and returns the file id. The returned file id can be sent as `imageFileId` when creating or updating a stock item.
|
|
83
|
+
* @summary Upload stock item image
|
|
84
|
+
*/
|
|
85
|
+
export const uploadStockItemImageBody = zod.object({
|
|
86
|
+
"originalName": zod.string(),
|
|
87
|
+
"mimeType": zod.string(),
|
|
88
|
+
"contentBase64": zod.string()
|
|
89
|
+
});
|
|
81
90
|
/**
|
|
82
91
|
* Creates a pending file metadata record and generates a presigned S3 upload URL for direct client-to-storage upload.
|
|
83
92
|
* @summary Initiate direct file upload to storage
|
|
@@ -98,8 +107,7 @@ export const uploadFileBody = zod.object({
|
|
|
98
107
|
"originalName": zod.string(),
|
|
99
108
|
"mimeType": zod.string(),
|
|
100
109
|
"contentBase64": zod.string(),
|
|
101
|
-
"purpose": zod.string()
|
|
102
|
-
"uploadedBy": zod.string().optional()
|
|
110
|
+
"purpose": zod.string()
|
|
103
111
|
});
|
|
104
112
|
/**
|
|
105
113
|
* Toggles the active state of a warehouse. Soft-deleted warehouses cannot be toggled.
|
|
@@ -253,13 +261,6 @@ export const getStoredFileByIdResponse = zod.object({
|
|
|
253
261
|
export const deleteStoredFileParams = zod.object({
|
|
254
262
|
"id": zod.string()
|
|
255
263
|
});
|
|
256
|
-
/**
|
|
257
|
-
* @summary Health check
|
|
258
|
-
*/
|
|
259
|
-
export const getHealthResponse = zod.object({
|
|
260
|
-
"status": zod.string(),
|
|
261
|
-
"timestamp": zod.string()
|
|
262
|
-
});
|
|
263
264
|
/**
|
|
264
265
|
* Creates a new warehouse with an address resolved from the Address service and an initial active state.
|
|
265
266
|
* @summary Create a new warehouse
|
|
@@ -395,6 +396,13 @@ export const createBatchBody = zod.object({
|
|
|
395
396
|
"receivedBy": zod.string().nullish(),
|
|
396
397
|
"recordedBy": zod.string().nullish()
|
|
397
398
|
});
|
|
399
|
+
/**
|
|
400
|
+
* @summary Health check
|
|
401
|
+
*/
|
|
402
|
+
export const getHealthResponse = zod.object({
|
|
403
|
+
"status": zod.string(),
|
|
404
|
+
"timestamp": zod.string()
|
|
405
|
+
});
|
|
398
406
|
/**
|
|
399
407
|
* @summary API welcome message
|
|
400
408
|
*/
|