UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

73 lines 3.83 kB
import { z } from 'zod'; import { BaseResponseSchema } from '../../../core/schemas'; /** Item category entity - key field only, passthrough for API flexibility */ export const ItemCategoryEntitySchema = z.object({ itemCategoryUid: z.number() }).passthrough(); /** Lookup category entity - key field only */ export const LookupCategoryEntitySchema = z.object({ itemCategoryUid: z.number() }).passthrough(); /** Sub-category - key field only */ export const SubCategorySchema = z.object({ itemCategoryUid: z.number() }).passthrough(); /** Lookup category with subcategories - key field only */ export const LookupCategoryWithSubsSchema = z.object({ itemCategoryUid: z.number() }).passthrough(); /** Category - key field only */ export const CategorySchema = z.object({ itemCategoryUid: z.number() }).passthrough(); // Parameter schemas for category endpoints export const CategoryListParamsSchema = z.object({ limit: z.coerce.number().int().positive().optional(), offset: z.coerce.number().int().min(0).optional(), displayOnWebFlag: z.enum(['Y', 'N']).optional(), deleteFlag: z.enum(['Y', 'N']).optional(), masterCategoryFlag: z.string().optional(), parentCategoryFlag: z.string().optional(), orderBy: z.string().optional(), q: z.string().optional(), }); export const CategoryLookupParamsSchema = z.object({ itemCategoryUid: z.coerce.number().optional(), itemCategoryId: z.string().optional(), includeSubCategories: z.boolean().optional(), displayOnWebFlag: z.enum(['Y', 'N']).optional(), deleteFlag: z.enum(['Y', 'N']).optional(), }); export const CategoryPreCacheParamsSchema = z.object({ itemCategoryUid: z.coerce.number(), }); export const CategoryDetailsParamsSchema = z.object({ path: z.string().optional(), rootItemCategoryId: z.string().optional(), orderBy: z.string().optional(), classId5List: z.string().optional(), productCollection: z.string().optional(), filters: z.string().optional(), childrenLimit: z.coerce.number().int().positive().optional(), childrenOffset: z.coerce.number().int().min(0).optional(), childrenFilter: z.string().optional(), }); export const CategoryItemsParamsSchema = z.object({ limit: z.coerce.number().int().positive().optional(), offset: z.coerce.number().int().min(0).optional(), sortBy: z.string().optional(), filters: z.string().optional(), fields: z.string().optional(), displayOnWebFlag: z.string().optional(), classId5List: z.string().optional(), classId5ExcludeList: z.string().optional(), tags: z.string().optional(), q: z.string().optional(), includeStock: z.enum(['Y', 'N']).optional(), cacheTtl: z.coerce.number().int().min(0).optional(), }); /** Category item - key field only */ export const CategoryItemSchema = z.object({ invMastUid: z.number() }).passthrough(); /** Category filter - key field only */ export const CategoryFilterSchema = z.object({ attributeId: z.string() }).passthrough(); /** Category image - key field only */ export const CategoryImageSchema = z.object({ imageUid: z.number() }).passthrough(); // Response schemas using BaseResponseSchema (8-field format) export const CategoryResponseSchema = BaseResponseSchema(CategorySchema); export const CategoryListResponseSchema = BaseResponseSchema(z.array(ItemCategoryEntitySchema)); export const CategoryLookupResponseSchema = BaseResponseSchema(LookupCategoryWithSubsSchema); export const CategoryPreCacheResponseSchema = BaseResponseSchema(z.boolean()); export const CategoryItemsResponseSchema = BaseResponseSchema(z.array(CategoryItemSchema)); export const CategoryFiltersResponseSchema = BaseResponseSchema(z.array(CategoryFilterSchema)); export const CategoryImagesResponseSchema = BaseResponseSchema(z.array(CategoryImageSchema)); //# sourceMappingURL=categories.js.map