@arascreative/erp-api-client 2.0.0 → 3.0.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.d.mts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface AntiforgeryTokenResponse {
|
|
|
32
32
|
type ConsumeBatchRequestExternalReferenceNo = null | string;
|
|
33
33
|
type ConsumeBatchRequestNote = null | string;
|
|
34
34
|
interface ConsumeBatchRequest {
|
|
35
|
+
warehouseId: string;
|
|
35
36
|
quantity: number;
|
|
36
37
|
sourceType: ConsumeBatchSourceType;
|
|
37
38
|
externalReferenceNo?: ConsumeBatchRequestExternalReferenceNo;
|
|
@@ -1211,34 +1212,34 @@ declare const useCreateBatch: <TError = AxiosError<ProblemDetails>, TContext = u
|
|
|
1211
1212
|
data: CreateBatchRequest;
|
|
1212
1213
|
}, TContext>;
|
|
1213
1214
|
/**
|
|
1214
|
-
* Consumes
|
|
1215
|
-
* @summary Consume
|
|
1215
|
+
* Consumes an item's unreserved batches in FIFO order within the requested warehouse and records a movement for each batch. Returns 400 for invalid input or inactive item/warehouse and 409 when stock is insufficient.
|
|
1216
|
+
* @summary Consume item stock
|
|
1216
1217
|
*/
|
|
1217
|
-
declare const consumeBatch: (
|
|
1218
|
+
declare const consumeBatch: (itemId: string, consumeBatchRequest: ConsumeBatchRequest, options?: AxiosRequestConfig) => Promise<AxiosResponse<void>>;
|
|
1218
1219
|
declare const getConsumeBatchMutationOptions: <TError = AxiosError<ProblemDetails>, TContext = unknown>(options?: {
|
|
1219
1220
|
mutation?: UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1220
|
-
|
|
1221
|
+
itemId: string;
|
|
1221
1222
|
data: ConsumeBatchRequest;
|
|
1222
1223
|
}, TContext>;
|
|
1223
1224
|
axios?: AxiosRequestConfig;
|
|
1224
1225
|
}) => UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1225
|
-
|
|
1226
|
+
itemId: string;
|
|
1226
1227
|
data: ConsumeBatchRequest;
|
|
1227
1228
|
}, TContext>;
|
|
1228
1229
|
type ConsumeBatchMutationResult = NonNullable<Awaited<ReturnType<typeof consumeBatch>>>;
|
|
1229
1230
|
type ConsumeBatchMutationBody = ConsumeBatchRequest;
|
|
1230
1231
|
type ConsumeBatchMutationError = AxiosError<ProblemDetails>;
|
|
1231
1232
|
/**
|
|
1232
|
-
* @summary Consume
|
|
1233
|
+
* @summary Consume item stock
|
|
1233
1234
|
*/
|
|
1234
1235
|
declare const useConsumeBatch: <TError = AxiosError<ProblemDetails>, TContext = unknown>(options?: {
|
|
1235
1236
|
mutation?: UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1236
|
-
|
|
1237
|
+
itemId: string;
|
|
1237
1238
|
data: ConsumeBatchRequest;
|
|
1238
1239
|
}, TContext>;
|
|
1239
1240
|
axios?: AxiosRequestConfig;
|
|
1240
1241
|
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1241
|
-
|
|
1242
|
+
itemId: string;
|
|
1242
1243
|
data: ConsumeBatchRequest;
|
|
1243
1244
|
}, TContext>;
|
|
1244
1245
|
/**
|
|
@@ -2315,13 +2316,14 @@ declare const createBatchBody: zod.ZodObject<{
|
|
|
2315
2316
|
receivedBy: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
2316
2317
|
}, zod.z.core.$strict>;
|
|
2317
2318
|
/**
|
|
2318
|
-
* Consumes
|
|
2319
|
-
* @summary Consume
|
|
2319
|
+
* Consumes an item's unreserved batches in FIFO order within the requested warehouse and records a movement for each batch. Returns 400 for invalid input or inactive item/warehouse and 409 when stock is insufficient.
|
|
2320
|
+
* @summary Consume item stock
|
|
2320
2321
|
*/
|
|
2321
2322
|
declare const consumeBatchParams: zod.ZodObject<{
|
|
2322
|
-
|
|
2323
|
+
itemId: zod.ZodUUID;
|
|
2323
2324
|
}, zod.z.core.$strict>;
|
|
2324
2325
|
declare const consumeBatchBody: zod.ZodObject<{
|
|
2326
|
+
warehouseId: zod.ZodUUID;
|
|
2325
2327
|
quantity: zod.ZodNumber;
|
|
2326
2328
|
sourceType: zod.ZodEnum<{
|
|
2327
2329
|
LOAN_OUT: "LOAN_OUT";
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface AntiforgeryTokenResponse {
|
|
|
32
32
|
type ConsumeBatchRequestExternalReferenceNo = null | string;
|
|
33
33
|
type ConsumeBatchRequestNote = null | string;
|
|
34
34
|
interface ConsumeBatchRequest {
|
|
35
|
+
warehouseId: string;
|
|
35
36
|
quantity: number;
|
|
36
37
|
sourceType: ConsumeBatchSourceType;
|
|
37
38
|
externalReferenceNo?: ConsumeBatchRequestExternalReferenceNo;
|
|
@@ -1211,34 +1212,34 @@ declare const useCreateBatch: <TError = AxiosError<ProblemDetails>, TContext = u
|
|
|
1211
1212
|
data: CreateBatchRequest;
|
|
1212
1213
|
}, TContext>;
|
|
1213
1214
|
/**
|
|
1214
|
-
* Consumes
|
|
1215
|
-
* @summary Consume
|
|
1215
|
+
* Consumes an item's unreserved batches in FIFO order within the requested warehouse and records a movement for each batch. Returns 400 for invalid input or inactive item/warehouse and 409 when stock is insufficient.
|
|
1216
|
+
* @summary Consume item stock
|
|
1216
1217
|
*/
|
|
1217
|
-
declare const consumeBatch: (
|
|
1218
|
+
declare const consumeBatch: (itemId: string, consumeBatchRequest: ConsumeBatchRequest, options?: AxiosRequestConfig) => Promise<AxiosResponse<void>>;
|
|
1218
1219
|
declare const getConsumeBatchMutationOptions: <TError = AxiosError<ProblemDetails>, TContext = unknown>(options?: {
|
|
1219
1220
|
mutation?: UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1220
|
-
|
|
1221
|
+
itemId: string;
|
|
1221
1222
|
data: ConsumeBatchRequest;
|
|
1222
1223
|
}, TContext>;
|
|
1223
1224
|
axios?: AxiosRequestConfig;
|
|
1224
1225
|
}) => UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1225
|
-
|
|
1226
|
+
itemId: string;
|
|
1226
1227
|
data: ConsumeBatchRequest;
|
|
1227
1228
|
}, TContext>;
|
|
1228
1229
|
type ConsumeBatchMutationResult = NonNullable<Awaited<ReturnType<typeof consumeBatch>>>;
|
|
1229
1230
|
type ConsumeBatchMutationBody = ConsumeBatchRequest;
|
|
1230
1231
|
type ConsumeBatchMutationError = AxiosError<ProblemDetails>;
|
|
1231
1232
|
/**
|
|
1232
|
-
* @summary Consume
|
|
1233
|
+
* @summary Consume item stock
|
|
1233
1234
|
*/
|
|
1234
1235
|
declare const useConsumeBatch: <TError = AxiosError<ProblemDetails>, TContext = unknown>(options?: {
|
|
1235
1236
|
mutation?: UseMutationOptions<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1236
|
-
|
|
1237
|
+
itemId: string;
|
|
1237
1238
|
data: ConsumeBatchRequest;
|
|
1238
1239
|
}, TContext>;
|
|
1239
1240
|
axios?: AxiosRequestConfig;
|
|
1240
1241
|
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof consumeBatch>>, TError, {
|
|
1241
|
-
|
|
1242
|
+
itemId: string;
|
|
1242
1243
|
data: ConsumeBatchRequest;
|
|
1243
1244
|
}, TContext>;
|
|
1244
1245
|
/**
|
|
@@ -2315,13 +2316,14 @@ declare const createBatchBody: zod.ZodObject<{
|
|
|
2315
2316
|
receivedBy: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
2316
2317
|
}, zod.z.core.$strict>;
|
|
2317
2318
|
/**
|
|
2318
|
-
* Consumes
|
|
2319
|
-
* @summary Consume
|
|
2319
|
+
* Consumes an item's unreserved batches in FIFO order within the requested warehouse and records a movement for each batch. Returns 400 for invalid input or inactive item/warehouse and 409 when stock is insufficient.
|
|
2320
|
+
* @summary Consume item stock
|
|
2320
2321
|
*/
|
|
2321
2322
|
declare const consumeBatchParams: zod.ZodObject<{
|
|
2322
|
-
|
|
2323
|
+
itemId: zod.ZodUUID;
|
|
2323
2324
|
}, zod.z.core.$strict>;
|
|
2324
2325
|
declare const consumeBatchBody: zod.ZodObject<{
|
|
2326
|
+
warehouseId: zod.ZodUUID;
|
|
2325
2327
|
quantity: zod.ZodNumber;
|
|
2326
2328
|
sourceType: zod.ZodEnum<{
|
|
2327
2329
|
LOAN_OUT: "LOAN_OUT";
|
package/dist/index.js
CHANGED
|
@@ -772,15 +772,15 @@ var useCreateBatch = (options, queryClient) => {
|
|
|
772
772
|
const mutationOptions = getCreateBatchMutationOptions(options);
|
|
773
773
|
return (0, import_react_query.useMutation)(mutationOptions, queryClient);
|
|
774
774
|
};
|
|
775
|
-
var consumeBatch = (
|
|
776
|
-
return import_axios.default.post(`/api/batches/${
|
|
775
|
+
var consumeBatch = (itemId, consumeBatchRequest, options) => {
|
|
776
|
+
return import_axios.default.post(`/api/batches/${itemId}/consume`, consumeBatchRequest, options);
|
|
777
777
|
};
|
|
778
778
|
var getConsumeBatchMutationOptions = (options) => {
|
|
779
779
|
const mutationKey = ["consumeBatch"];
|
|
780
780
|
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 };
|
|
781
781
|
const mutationFn = (props) => {
|
|
782
|
-
const {
|
|
783
|
-
return consumeBatch(
|
|
782
|
+
const { itemId, data } = props ?? {};
|
|
783
|
+
return consumeBatch(itemId, data, axiosOptions);
|
|
784
784
|
};
|
|
785
785
|
return { mutationFn, ...mutationOptions };
|
|
786
786
|
};
|
|
@@ -1605,9 +1605,10 @@ var createBatchBody = zod.strictObject({
|
|
|
1605
1605
|
receivedBy: zod.string().nullish()
|
|
1606
1606
|
});
|
|
1607
1607
|
var consumeBatchParams = zod.strictObject({
|
|
1608
|
-
|
|
1608
|
+
itemId: zod.uuid().describe("Stock item identifier.")
|
|
1609
1609
|
});
|
|
1610
1610
|
var consumeBatchBody = zod.strictObject({
|
|
1611
|
+
warehouseId: zod.uuid(),
|
|
1611
1612
|
quantity: zod.number(),
|
|
1612
1613
|
sourceType: zod.enum([
|
|
1613
1614
|
"LOAN_OUT",
|