@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
88 lines • 5.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StockDetailsResponseSchema = exports.BinInfoListResponseSchema = exports.AccessoryListResponseSchema = exports.ProductPreCacheResponseSchema = exports.ProductLookupResponseSchema = exports.ProductListResponseSchema = exports.ProductDetailResponseSchema = exports.ProductResponseSchema = exports.StockDetailsSchema = exports.StockSummarySchema = exports.StockLocationSchema = exports.BinInfoSchema = exports.AccessorySchema = exports.AlternateCodeSchema = exports.ProductPreCacheParamsSchema = exports.ProductLookupParamsSchema = exports.ProductDetailParamsSchema = exports.ProductListParamsSchema = exports.ProductSearchParamsSchema = exports.ProductLookupSchema = exports.ProductDetailSchema = exports.ProductSchema = exports.SortParamsSchema = void 0;
const zod_1 = require("zod");
const schemas_1 = require("../../../core/schemas");
// Extended sort params for items service
exports.SortParamsSchema = zod_1.z.object({
orderBy: zod_1.z.string().optional(),
sortBy: zod_1.z.string().optional(),
sortOrder: zod_1.z.enum(['asc', 'desc']).optional(),
});
/** Product - key field only, passthrough for API flexibility */
exports.ProductSchema = zod_1.z.object({ invMastUid: zod_1.z.coerce.number() }).passthrough();
/** Product detail - key field only, passthrough for API flexibility */
exports.ProductDetailSchema = zod_1.z.object({ invMastUid: zod_1.z.coerce.number() }).passthrough();
/** Product lookup - key field only, passthrough for API flexibility */
exports.ProductLookupSchema = zod_1.z.object({ invMastUid: zod_1.z.coerce.number() }).passthrough();
// Parameter schemas for product endpoints
exports.ProductSearchParamsSchema = zod_1.z.object({
q: zod_1.z.string(),
limit: zod_1.z.coerce.number().int().positive().optional(),
offset: zod_1.z.coerce.number().int().min(0).optional(),
statusCd: zod_1.z.coerce.number().optional(),
onlineCd: zod_1.z.coerce.number().optional(),
orderBy: zod_1.z.string().optional(),
displayOnWebFlag: zod_1.z.string().optional(),
brandId: zod_1.z.string().optional(),
categoryPath: zod_1.z.string().optional(),
minPrice: zod_1.z.coerce.number().optional(),
maxPrice: zod_1.z.coerce.number().optional(),
inStock: zod_1.z.boolean().optional(),
});
exports.ProductListParamsSchema = zod_1.z.object({
limit: zod_1.z.coerce.number().int().positive().optional(),
offset: zod_1.z.coerce.number().int().min(0).optional(),
statusCd: zod_1.z.coerce.number().optional(),
onlineCd: zod_1.z.coerce.number().optional(),
orderBy: zod_1.z.string().optional(),
displayOnWebFlag: zod_1.z.string().optional(),
q: zod_1.z.string().optional(),
brandId: zod_1.z.string().optional(),
categoryPath: zod_1.z.string().optional(),
minPrice: zod_1.z.coerce.number().optional(),
maxPrice: zod_1.z.coerce.number().optional(),
inStock: zod_1.z.boolean().optional(),
});
exports.ProductDetailParamsSchema = zod_1.z.object({
invMastUid: zod_1.z.coerce.number(),
includeCategories: zod_1.z.boolean().optional(),
includeAttributes: zod_1.z.boolean().optional(),
includeImages: zod_1.z.boolean().optional(),
includeAccessories: zod_1.z.boolean().optional(),
includeAlternateCodes: zod_1.z.boolean().optional(),
includeStock: zod_1.z.boolean().optional(),
});
exports.ProductLookupParamsSchema = zod_1.z.object({
q: zod_1.z.string(), // REQUIRED parameter per OpenAPI spec
limit: zod_1.z.coerce.number().int().positive().optional(),
offset: zod_1.z.coerce.number().int().min(0).optional(),
statusCd: zod_1.z.coerce.number().optional(),
onlineCd: zod_1.z.coerce.number().optional(),
orderBy: zod_1.z.string().optional(),
});
exports.ProductPreCacheParamsSchema = zod_1.z.object({
invMastUid: zod_1.z.coerce.number(),
});
/** Alternate code - key field only, passthrough for API flexibility */
exports.AlternateCodeSchema = zod_1.z.object({ alternateCodeUid: zod_1.z.number() }).passthrough();
/** Accessory - key field only, passthrough for API flexibility */
exports.AccessorySchema = zod_1.z.object({ accessoryUid: zod_1.z.number() }).passthrough();
/** Bin info - key field only, passthrough for API flexibility */
exports.BinInfoSchema = zod_1.z.object({ invBinUid: zod_1.z.coerce.number() }).passthrough();
/** Stock location - key field only, passthrough for API flexibility */
exports.StockLocationSchema = zod_1.z.object({ locationId: zod_1.z.number() }).passthrough();
/** Stock summary - passthrough for API flexibility */
exports.StockSummarySchema = zod_1.z.object({}).passthrough();
/** Stock details - passthrough for API flexibility */
exports.StockDetailsSchema = zod_1.z.object({}).passthrough();
// Response schemas using BaseResponseSchema (8-field format)
exports.ProductResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.ProductSchema);
exports.ProductDetailResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.ProductDetailSchema);
exports.ProductListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.ProductSchema));
exports.ProductLookupResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.ProductLookupSchema));
exports.ProductPreCacheResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.boolean());
exports.AccessoryListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.AccessorySchema));
exports.BinInfoListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.BinInfoSchema));
exports.StockDetailsResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.StockDetailsSchema);
//# sourceMappingURL=invMast.js.map