@arascreative/erp-api-client 1.1.0 → 1.2.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/index.mjs CHANGED
@@ -174,6 +174,93 @@ function useSearchAddresses(params, options, queryClient) {
174
174
  query.queryKey = queryOptions.queryKey;
175
175
  return query;
176
176
  }
177
+ var createCatalogItem = (upsertCatalogItemRequest, options) => {
178
+ return axios.post(`/api/catalog`, upsertCatalogItemRequest, options);
179
+ };
180
+ var getCreateCatalogItemMutationOptions = (options) => {
181
+ const mutationKey = ["createCatalogItem"];
182
+ const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: void 0 };
183
+ const mutationFn = (props) => {
184
+ const { data } = props ?? {};
185
+ return createCatalogItem(data, axiosOptions);
186
+ };
187
+ return { mutationFn, ...mutationOptions };
188
+ };
189
+ var useCreateCatalogItem = (options, queryClient) => {
190
+ const mutationOptions = getCreateCatalogItemMutationOptions(options);
191
+ return useMutation(mutationOptions, queryClient);
192
+ };
193
+ var listCatalogItems = (params, options) => {
194
+ return axios.get(`/api/catalog`, {
195
+ ...options,
196
+ params: { ...params, ...options?.params }
197
+ });
198
+ };
199
+ var getListCatalogItemsQueryKey = (params) => {
200
+ return [`/api/catalog`, ...params ? [params] : []];
201
+ };
202
+ var getListCatalogItemsQueryOptions = (params, options) => {
203
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
204
+ const queryKey = queryOptions?.queryKey ?? getListCatalogItemsQueryKey(params);
205
+ const queryFn = ({ signal }) => listCatalogItems(params, { signal, ...axiosOptions });
206
+ return { queryKey, queryFn, ...queryOptions };
207
+ };
208
+ function useListCatalogItems(params, options, queryClient) {
209
+ const queryOptions = getListCatalogItemsQueryOptions(params, options);
210
+ const query = useQuery(queryOptions, queryClient);
211
+ query.queryKey = queryOptions.queryKey;
212
+ return query;
213
+ }
214
+ var updateCatalogItem = (id, upsertCatalogItemRequest, options) => {
215
+ return axios.put(`/api/catalog/${id}`, upsertCatalogItemRequest, options);
216
+ };
217
+ var getUpdateCatalogItemMutationOptions = (options) => {
218
+ const mutationKey = ["updateCatalogItem"];
219
+ const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: void 0 };
220
+ const mutationFn = (props) => {
221
+ const { id, data } = props ?? {};
222
+ return updateCatalogItem(id, data, axiosOptions);
223
+ };
224
+ return { mutationFn, ...mutationOptions };
225
+ };
226
+ var useUpdateCatalogItem = (options, queryClient) => {
227
+ const mutationOptions = getUpdateCatalogItemMutationOptions(options);
228
+ return useMutation(mutationOptions, queryClient);
229
+ };
230
+ var getCatalogItem = (id, options) => {
231
+ return axios.get(`/api/catalog/${id}`, options);
232
+ };
233
+ var getGetCatalogItemQueryKey = (id) => {
234
+ return [`/api/catalog/${id}`];
235
+ };
236
+ var getGetCatalogItemQueryOptions = (id, options) => {
237
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
238
+ const queryKey = queryOptions?.queryKey ?? getGetCatalogItemQueryKey(id);
239
+ const queryFn = ({ signal }) => getCatalogItem(id, { signal, ...axiosOptions });
240
+ return { queryKey, queryFn, enabled: !!id, ...queryOptions };
241
+ };
242
+ function useGetCatalogItem(id, options, queryClient) {
243
+ const queryOptions = getGetCatalogItemQueryOptions(id, options);
244
+ const query = useQuery(queryOptions, queryClient);
245
+ query.queryKey = queryOptions.queryKey;
246
+ return query;
247
+ }
248
+ var deleteCatalogItem = (id, options) => {
249
+ return axios.delete(`/api/catalog/${id}`, options);
250
+ };
251
+ var getDeleteCatalogItemMutationOptions = (options) => {
252
+ const mutationKey = ["deleteCatalogItem"];
253
+ const { mutation: mutationOptions, axios: axiosOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, axios: void 0 };
254
+ const mutationFn = (props) => {
255
+ const { id } = props ?? {};
256
+ return deleteCatalogItem(id, axiosOptions);
257
+ };
258
+ return { mutationFn, ...mutationOptions };
259
+ };
260
+ var useDeleteCatalogItem = (options, queryClient) => {
261
+ const mutationOptions = getDeleteCatalogItemMutationOptions(options);
262
+ return useMutation(mutationOptions, queryClient);
263
+ };
177
264
  var createStockItems = (createStockItemCommand, options) => {
178
265
  return axios.post(`/api/stock-items`, createStockItemCommand, options);
179
266
  };
@@ -760,6 +847,222 @@ var searchAddressesResponseItem = zod.strictObject({
760
847
  zipCode: zod.string().optional()
761
848
  });
762
849
  var searchAddressesResponse = zod.array(searchAddressesResponseItem);
850
+ var createCatalogItemBody = zod.strictObject({
851
+ categoryId: zod.uuid(),
852
+ name: zod.string(),
853
+ slug: zod.string(),
854
+ status: zod.string(),
855
+ classification: zod.string(),
856
+ variants: zod.array(
857
+ zod.strictObject({
858
+ id: zod.uuid().nullish(),
859
+ code: zod.string(),
860
+ itemId: zod.uuid(),
861
+ multiplier: zod.number(),
862
+ attributes: zod.array(
863
+ zod.strictObject({
864
+ name: zod.string(),
865
+ value: zod.string()
866
+ })
867
+ ),
868
+ weight: zod.strictObject({
869
+ value: zod.number(),
870
+ unit: zod.string()
871
+ }),
872
+ price: zod.strictObject({
873
+ baseAmount: zod.number(),
874
+ baseCurrency: zod.string(),
875
+ sale: zod.union([
876
+ zod.null(),
877
+ zod.strictObject({
878
+ amount: zod.number(),
879
+ currency: zod.string(),
880
+ startAt: zod.iso.datetime({}),
881
+ endAt: zod.iso.datetime({})
882
+ })
883
+ ]).optional(),
884
+ wholesale: zod.array(
885
+ zod.strictObject({
886
+ minQty: zod.number(),
887
+ amount: zod.number(),
888
+ currency: zod.string()
889
+ })
890
+ ).nullish()
891
+ })
892
+ })
893
+ )
894
+ });
895
+ var listCatalogItemsQueryPageDefault = 1;
896
+ var listCatalogItemsQueryPageSizeDefault = 10;
897
+ var listCatalogItemsQueryParams = zod.strictObject({
898
+ page: zod.coerce.number().default(listCatalogItemsQueryPageDefault),
899
+ pageSize: zod.coerce.number().default(listCatalogItemsQueryPageSizeDefault)
900
+ });
901
+ var listCatalogItemsResponse = zod.strictObject({
902
+ items: zod.array(
903
+ zod.strictObject({
904
+ id: zod.uuid(),
905
+ categoryId: zod.uuid(),
906
+ name: zod.string(),
907
+ slug: zod.string(),
908
+ status: zod.string(),
909
+ classification: zod.string(),
910
+ variantCount: zod.number()
911
+ })
912
+ ),
913
+ page: zod.number(),
914
+ pageSize: zod.number(),
915
+ totalCount: zod.number(),
916
+ totalPages: zod.number().optional(),
917
+ hasNextPage: zod.boolean().optional(),
918
+ hasPreviousPage: zod.boolean().optional()
919
+ });
920
+ var updateCatalogItemParams = zod.strictObject({
921
+ id: zod.uuid()
922
+ });
923
+ var updateCatalogItemBody = zod.strictObject({
924
+ categoryId: zod.uuid(),
925
+ name: zod.string(),
926
+ slug: zod.string(),
927
+ status: zod.string(),
928
+ classification: zod.string(),
929
+ variants: zod.array(
930
+ zod.strictObject({
931
+ id: zod.uuid().nullish(),
932
+ code: zod.string(),
933
+ itemId: zod.uuid(),
934
+ multiplier: zod.number(),
935
+ attributes: zod.array(
936
+ zod.strictObject({
937
+ name: zod.string(),
938
+ value: zod.string()
939
+ })
940
+ ),
941
+ weight: zod.strictObject({
942
+ value: zod.number(),
943
+ unit: zod.string()
944
+ }),
945
+ price: zod.strictObject({
946
+ baseAmount: zod.number(),
947
+ baseCurrency: zod.string(),
948
+ sale: zod.union([
949
+ zod.null(),
950
+ zod.strictObject({
951
+ amount: zod.number(),
952
+ currency: zod.string(),
953
+ startAt: zod.iso.datetime({}),
954
+ endAt: zod.iso.datetime({})
955
+ })
956
+ ]).optional(),
957
+ wholesale: zod.array(
958
+ zod.strictObject({
959
+ minQty: zod.number(),
960
+ amount: zod.number(),
961
+ currency: zod.string()
962
+ })
963
+ ).nullish()
964
+ })
965
+ })
966
+ )
967
+ });
968
+ var updateCatalogItemResponse = zod.strictObject({
969
+ id: zod.uuid(),
970
+ categoryId: zod.uuid(),
971
+ name: zod.string(),
972
+ slug: zod.string(),
973
+ status: zod.string(),
974
+ classification: zod.string(),
975
+ variants: zod.array(
976
+ zod.strictObject({
977
+ id: zod.uuid().nullish(),
978
+ code: zod.string(),
979
+ itemId: zod.uuid(),
980
+ multiplier: zod.number(),
981
+ attributes: zod.array(
982
+ zod.strictObject({
983
+ name: zod.string(),
984
+ value: zod.string()
985
+ })
986
+ ),
987
+ weight: zod.strictObject({
988
+ value: zod.number(),
989
+ unit: zod.string()
990
+ }),
991
+ price: zod.strictObject({
992
+ baseAmount: zod.number(),
993
+ baseCurrency: zod.string(),
994
+ sale: zod.union([
995
+ zod.null(),
996
+ zod.strictObject({
997
+ amount: zod.number(),
998
+ currency: zod.string(),
999
+ startAt: zod.iso.datetime({}),
1000
+ endAt: zod.iso.datetime({})
1001
+ })
1002
+ ]).optional(),
1003
+ wholesale: zod.array(
1004
+ zod.strictObject({
1005
+ minQty: zod.number(),
1006
+ amount: zod.number(),
1007
+ currency: zod.string()
1008
+ })
1009
+ ).nullish()
1010
+ })
1011
+ })
1012
+ )
1013
+ });
1014
+ var getCatalogItemParams = zod.strictObject({
1015
+ id: zod.uuid()
1016
+ });
1017
+ var getCatalogItemResponse = zod.strictObject({
1018
+ id: zod.uuid(),
1019
+ categoryId: zod.uuid(),
1020
+ name: zod.string(),
1021
+ slug: zod.string(),
1022
+ status: zod.string(),
1023
+ classification: zod.string(),
1024
+ variants: zod.array(
1025
+ zod.strictObject({
1026
+ id: zod.uuid().nullish(),
1027
+ code: zod.string(),
1028
+ itemId: zod.uuid(),
1029
+ multiplier: zod.number(),
1030
+ attributes: zod.array(
1031
+ zod.strictObject({
1032
+ name: zod.string(),
1033
+ value: zod.string()
1034
+ })
1035
+ ),
1036
+ weight: zod.strictObject({
1037
+ value: zod.number(),
1038
+ unit: zod.string()
1039
+ }),
1040
+ price: zod.strictObject({
1041
+ baseAmount: zod.number(),
1042
+ baseCurrency: zod.string(),
1043
+ sale: zod.union([
1044
+ zod.null(),
1045
+ zod.strictObject({
1046
+ amount: zod.number(),
1047
+ currency: zod.string(),
1048
+ startAt: zod.iso.datetime({}),
1049
+ endAt: zod.iso.datetime({})
1050
+ })
1051
+ ]).optional(),
1052
+ wholesale: zod.array(
1053
+ zod.strictObject({
1054
+ minQty: zod.number(),
1055
+ amount: zod.number(),
1056
+ currency: zod.string()
1057
+ })
1058
+ ).nullish()
1059
+ })
1060
+ })
1061
+ )
1062
+ });
1063
+ var deleteCatalogItemParams = zod.strictObject({
1064
+ id: zod.uuid()
1065
+ });
763
1066
  var createStockItemsBody = zod.strictObject({
764
1067
  name: zod.string(),
765
1068
  sku: zod.string(),
@@ -1006,12 +1309,16 @@ export {
1006
1309
  consumeBatchParams,
1007
1310
  createBatch,
1008
1311
  createBatchBody,
1312
+ createCatalogItem,
1313
+ createCatalogItemBody,
1009
1314
  createStockItems,
1010
1315
  createStockItemsBody,
1011
1316
  createWarehouse,
1012
1317
  createWarehouseBody,
1013
1318
  deleteApiIdentityAdminRolesId,
1014
1319
  deleteApiIdentityAdminRolesIdParams,
1320
+ deleteCatalogItem,
1321
+ deleteCatalogItemParams,
1015
1322
  deleteWarehouse,
1016
1323
  deleteWarehouseParams,
1017
1324
  getApiIdentityAdminPermissions,
@@ -1040,11 +1347,16 @@ export {
1040
1347
  getApiIdentityManage2faResponse,
1041
1348
  getApiIdentityManageInfo,
1042
1349
  getApiIdentityManageInfoResponse,
1350
+ getCatalogItem,
1351
+ getCatalogItemParams,
1352
+ getCatalogItemResponse,
1043
1353
  getConsumeBatchMutationOptions,
1044
1354
  getCreateBatchMutationOptions,
1355
+ getCreateCatalogItemMutationOptions,
1045
1356
  getCreateStockItemsMutationOptions,
1046
1357
  getCreateWarehouseMutationOptions,
1047
1358
  getDeleteApiIdentityAdminRolesIdMutationOptions,
1359
+ getDeleteCatalogItemMutationOptions,
1048
1360
  getDeleteWarehouseMutationOptions,
1049
1361
  getGetApiIdentityAdminPermissionsQueryKey,
1050
1362
  getGetApiIdentityAdminPermissionsQueryOptions,
@@ -1064,6 +1376,8 @@ export {
1064
1376
  getGetApiIdentityManage2faQueryOptions,
1065
1377
  getGetApiIdentityManageInfoQueryKey,
1066
1378
  getGetApiIdentityManageInfoQueryOptions,
1379
+ getGetCatalogItemQueryKey,
1380
+ getGetCatalogItemQueryOptions,
1067
1381
  getGetHealthQueryKey,
1068
1382
  getGetHealthQueryOptions,
1069
1383
  getGetWarehouseByIdQueryKey,
@@ -1071,6 +1385,8 @@ export {
1071
1385
  getGetWarehouseOptionsQueryKey,
1072
1386
  getGetWarehouseOptionsQueryOptions,
1073
1387
  getHealth,
1388
+ getListCatalogItemsQueryKey,
1389
+ getListCatalogItemsQueryOptions,
1074
1390
  getListStockItemsQueryKey,
1075
1391
  getListStockItemsQueryOptions,
1076
1392
  getListStockMovementsQueryKey,
@@ -1092,6 +1408,7 @@ export {
1092
1408
  getSearchAddressesQueryKey,
1093
1409
  getSearchAddressesQueryOptions,
1094
1410
  getToggleWarehouseStatusMutationOptions,
1411
+ getUpdateCatalogItemMutationOptions,
1095
1412
  getUpdateWarehouseMutationOptions,
1096
1413
  getWarehouseById,
1097
1414
  getWarehouseByIdParams,
@@ -1099,6 +1416,11 @@ export {
1099
1416
  getWarehouseOptions,
1100
1417
  getWarehouseOptionsResponse,
1101
1418
  getWarehouseOptionsResponseItem,
1419
+ listCatalogItems,
1420
+ listCatalogItemsQueryPageDefault,
1421
+ listCatalogItemsQueryPageSizeDefault,
1422
+ listCatalogItemsQueryParams,
1423
+ listCatalogItemsResponse,
1102
1424
  listStockItems,
1103
1425
  listStockItemsQueryDescendingDefault,
1104
1426
  listStockItemsQueryPageDefault,
@@ -1153,14 +1475,20 @@ export {
1153
1475
  searchAddressesResponseItem,
1154
1476
  toggleWarehouseStatus,
1155
1477
  toggleWarehouseStatusParams,
1478
+ updateCatalogItem,
1479
+ updateCatalogItemBody,
1480
+ updateCatalogItemParams,
1481
+ updateCatalogItemResponse,
1156
1482
  updateWarehouse,
1157
1483
  updateWarehouseBody,
1158
1484
  updateWarehouseParams,
1159
1485
  useConsumeBatch,
1160
1486
  useCreateBatch,
1487
+ useCreateCatalogItem,
1161
1488
  useCreateStockItems,
1162
1489
  useCreateWarehouse,
1163
1490
  useDeleteApiIdentityAdminRolesId,
1491
+ useDeleteCatalogItem,
1164
1492
  useDeleteWarehouse,
1165
1493
  useGetApiIdentityAdminPermissions,
1166
1494
  useGetApiIdentityAdminRoles,
@@ -1171,9 +1499,11 @@ export {
1171
1499
  useGetApiIdentityAntiforgery,
1172
1500
  useGetApiIdentityManage2fa,
1173
1501
  useGetApiIdentityManageInfo,
1502
+ useGetCatalogItem,
1174
1503
  useGetHealth,
1175
1504
  useGetWarehouseById,
1176
1505
  useGetWarehouseOptions,
1506
+ useListCatalogItems,
1177
1507
  useListStockItems,
1178
1508
  useListStockMovements,
1179
1509
  useListWarehouses,
@@ -1191,6 +1521,7 @@ export {
1191
1521
  usePutApiIdentityAdminUsersIdRoles,
1192
1522
  useSearchAddresses,
1193
1523
  useToggleWarehouseStatus,
1524
+ useUpdateCatalogItem,
1194
1525
  useUpdateWarehouse
1195
1526
  };
1196
1527
  //# sourceMappingURL=index.mjs.map