UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

322 lines 14.6 kB
import { z } from 'zod'; import type { BaseResponse } from '../../../core/base-client'; import { Warehouse, WarehouseListParams, CreateWarehouseRequest, UpdateWarehouseRequest, EnableWarehouseRequest, InventoryAvailability, InventoryAvailabilityParams, InventoryAdjustRequest, InventoryReceiveRequest, ReplenishmentInfo, ReplenishmentParams, ReplenishRequest, TransferRequest, UsageRequest, WarehouseUserListParams, CreateWarehouseUserRequest, UpdateWarehouseUserRequest, WarehouseUser } from '../schemas'; import type { VMIClient } from '../client'; type ExecuteRequest = VMIClient['executeRequest']; /** * Creates the warehouse resource methods * OpenAPI Path: /warehouse → warehouse.* * @description Methods for CRUD operations on warehouses and warehouse configuration */ export declare function createWarehouseResource(executeRequest: ExecuteRequest): { /** * List warehouses with filtering and pagination * @description Returns warehouses with optional filtering by customer, user access, and status * @param params Optional filtering and pagination parameters * @returns Array of warehouse objects with pagination metadata * @throws ValidationError When parameters are invalid or response is malformed */ list: (params?: WarehouseListParams) => Promise<{ params: Record<string, unknown> | unknown[]; data: z.objectInputType<{ warehouseUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">[]; options: Record<string, unknown> | unknown[]; status: number; message: string; count: number; total: number; totalResults: number; }>; /** * Get warehouse details by ID * @description Returns detailed information for a specific warehouse * @param warehouseUid Warehouse unique identifier * @returns Warehouse details * @throws ValidationError When response is malformed */ get: (warehouseUid: number) => Promise<{ params: Record<string, unknown> | unknown[]; data: { warehouseUid: number; } & { [k: string]: unknown; }; options: Record<string, unknown> | unknown[]; status: number; message: string; count: number; total: number; totalResults: number; }>; /** * Create a new warehouse * @description Creates a new warehouse with specified configuration * @param request Warehouse creation data * @returns Created warehouse information * @throws ValidationError When request is invalid or response is malformed */ create: (request: CreateWarehouseRequest) => Promise<{ params: Record<string, unknown> | unknown[]; data: { warehouseUid: number; } & { [k: string]: unknown; }; options: Record<string, unknown> | unknown[]; status: number; message: string; count: number; total: number; totalResults: number; }>; /** * Update an existing warehouse * @description Updates warehouse information with provided data * @param warehouseUid Warehouse unique identifier * @param request Warehouse update data * @returns Updated warehouse information * @throws ValidationError When request is invalid or response is malformed */ update: (warehouseUid: number, request: UpdateWarehouseRequest) => Promise<{ params: Record<string, unknown> | unknown[]; data: { warehouseUid: number; } & { [k: string]: unknown; }; options: Record<string, unknown> | unknown[]; status: number; message: string; count: number; total: number; totalResults: number; }>; /** * Soft delete a warehouse * @description Marks warehouse as deleted (sets status_cd to 700) without removing data * @param warehouseUid Warehouse unique identifier * @returns Boolean indicating successful deletion * @throws ValidationError When response is malformed */ delete: (warehouseUid: number) => Promise<boolean>; /** * Enable, disable, or delete a warehouse * @description Changes warehouse status using status codes (704=active, 705=inactive, 700=deleted) * @param warehouseUid Warehouse unique identifier * @param request Status change request with new status code * @returns Updated warehouse information * @throws ValidationError When request is invalid or response is malformed */ enable: (warehouseUid: number, request: EnableWarehouseRequest) => Promise<BaseResponse<Warehouse>>; /** * Warehouse availability endpoints * @description Methods for checking inventory availability in warehouses */ availability: { /** * Check inventory availability with search * @description Searches inventory items in a warehouse with query string matching * @param warehouseUid Warehouse unique identifier * @param params Search parameters including required query string * @returns Array of available inventory items matching search criteria * @throws ValidationError When parameters are invalid or response is malformed */ get: (warehouseUid: number, params: InventoryAvailabilityParams) => Promise<BaseResponse<InventoryAvailability[]>>; }; /** * Warehouse adjust endpoints * @description Methods for adjusting inventory quantities */ adjust: { /** * Adjust inventory quantities * @description Sets absolute inventory quantities (not relative changes) with optional reason tracking * @param warehouseUid Warehouse unique identifier * @param request Adjustment request containing array of inventory adjustments * @returns Success response * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: InventoryAdjustRequest) => Promise<boolean>; }; /** * Warehouse receive endpoints * @description Methods for receiving inventory into warehouses */ receive: { /** * Receive inventory into warehouse * @description Records received inventory with optional purchase order and lot tracking * @param warehouseUid Warehouse unique identifier * @param request Receive request containing array of inventory receipts * @returns Success response * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: InventoryReceiveRequest) => Promise<boolean>; }; /** * Warehouse replenish endpoints * @description Methods for warehouse replenishment operations */ replenish: { /** * Get replenishment information * @description Returns items that need replenishment based on min/max quantities * @param warehouseUid Warehouse unique identifier * @param params Optional filtering by distributor * @returns Replenishment information with suggested order quantities * @throws ValidationError When parameters are invalid or response is malformed */ get: (warehouseUid: number, params?: ReplenishmentParams) => Promise<BaseResponse<ReplenishmentInfo>>; /** * Execute inventory replenishment * @description Places replenishment orders based on min/max/reorder quantities * @param warehouseUid Warehouse unique identifier * @param request Replenishment request with distributor and items to restock * @returns Success response * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: ReplenishRequest) => Promise<boolean>; }; /** * Warehouse transfer endpoints * @description Methods for transferring inventory between warehouses */ transfer: { /** * Transfer inventory between warehouses * @description Moves inventory from one warehouse to another with quantity tracking * @param warehouseUid Source warehouse unique identifier * @param request Transfer request with destination warehouse and items to transfer * @returns Success response * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: TransferRequest) => Promise<boolean>; }; /** * Warehouse usage endpoints * @description Methods for recording inventory usage */ usage: { /** * Record inventory usage * @description Automatically decrements inventory and creates usage records for job tracking * @param warehouseUid Warehouse unique identifier * @param request Usage request with job information and consumed items * @returns Success response * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: UsageRequest) => Promise<boolean>; }; /** * Warehouse users endpoints * @description Methods for managing user access permissions to warehouses */ users: { /** * List users with access to specific warehouse * @description Returns users who have access to a warehouse with optional status filtering * @param warehouseUid Warehouse unique identifier * @param params Optional filtering and pagination parameters * @returns Array of warehouse user access records * @throws ValidationError When parameters are invalid or response is malformed */ list: (warehouseUid: number, params?: WarehouseUserListParams) => Promise<BaseResponse<unknown[]>>; /** * Create or update warehouse user access * @description Grants or updates user access to a warehouse with optional primary user designation * @param warehouseUid Warehouse unique identifier * @param request User access request data * @returns Created or updated warehouse user access information * @throws ValidationError When request is invalid or response is malformed */ create: (warehouseUid: number, request: CreateWarehouseUserRequest) => Promise<unknown>; /** * Get warehouse user assignment details * @description Returns user assignment details for a specific user in a warehouse * @param warehouseUid Warehouse unique identifier * @param usersId User unique identifier * @returns Warehouse user assignment details * @throws ValidationError When response is malformed */ get: (warehouseUid: number, usersId: number) => Promise<BaseResponse<WarehouseUser>>; /** * Update warehouse user assignment * @description Updates user assignment status or primary user designation * @param warehouseUid Warehouse unique identifier * @param usersId User unique identifier * @param request Update request data * @returns Updated warehouse user assignment * @throws ValidationError When request is invalid or response is malformed */ update: (warehouseUid: number, usersId: number, request: UpdateWarehouseUserRequest) => Promise<BaseResponse<WarehouseUser>>; /** * Remove user from warehouse * @description Removes user access from warehouse (sets status_cd to 700) * @param warehouseUid Warehouse unique identifier * @param usersId User unique identifier * @returns Boolean indicating successful removal * @throws ValidationError When response is malformed */ delete: (warehouseUid: number, usersId: number) => Promise<boolean>; }; }; /** * Creates the warehouseData resource methods (data-only versions) */ export declare function createWarehouseDataResource(warehouse: ReturnType<typeof createWarehouseResource>): { list: (params?: WarehouseListParams) => Promise<z.objectInputType<{ warehouseUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">[]>; get: (warehouseUid: number) => Promise<{ warehouseUid: number; } & { [k: string]: unknown; }>; create: (request: CreateWarehouseRequest) => Promise<{ warehouseUid: number; } & { [k: string]: unknown; }>; update: (warehouseUid: number, request: UpdateWarehouseRequest) => Promise<{ warehouseUid: number; } & { [k: string]: unknown; }>; enable: (warehouseUid: number, request: EnableWarehouseRequest) => Promise<z.objectOutputType<{ warehouseUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">>; availability: { get: (warehouseUid: number, params: InventoryAvailabilityParams) => Promise<z.objectOutputType<{ invMastUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">[]>; }; replenish: { get: (warehouseUid: number, params?: ReplenishmentParams) => Promise<z.objectOutputType<{ warehouseUid: z.ZodNumber; replenishmentItems: z.ZodOptional<z.ZodArray<z.ZodObject<{ invMastUid: z.ZodNumber; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ invMastUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ invMastUid: z.ZodNumber; }, z.ZodTypeAny, "passthrough">>, "many">>; }, z.ZodTypeAny, "passthrough">>; }; users: { list: (warehouseUid: number, params?: WarehouseUserListParams) => Promise<unknown[]>; create: (warehouseUid: number, request: CreateWarehouseUserRequest) => Promise<unknown>; get: (warehouseUid: number, usersId: number) => Promise<z.objectOutputType<{ warehouseUid: z.ZodNumber; usersId: z.ZodNumber; }, z.ZodTypeAny, "passthrough">>; update: (warehouseUid: number, usersId: number, request: UpdateWarehouseUserRequest) => Promise<z.objectOutputType<{ warehouseUid: z.ZodNumber; usersId: z.ZodNumber; }, z.ZodTypeAny, "passthrough">>; }; }; export type WarehouseResource = ReturnType<typeof createWarehouseResource>; export type WarehouseDataResource = ReturnType<typeof createWarehouseDataResource>; export {}; //# sourceMappingURL=warehouse.d.ts.map