@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
76 lines • 5.04 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CategoryImagesResponseSchema = exports.CategoryFiltersResponseSchema = exports.CategoryItemsResponseSchema = exports.CategoryPreCacheResponseSchema = exports.CategoryLookupResponseSchema = exports.CategoryListResponseSchema = exports.CategoryResponseSchema = exports.CategoryImageSchema = exports.CategoryFilterSchema = exports.CategoryItemSchema = exports.CategoryItemsParamsSchema = exports.CategoryDetailsParamsSchema = exports.CategoryPreCacheParamsSchema = exports.CategoryLookupParamsSchema = exports.CategoryListParamsSchema = exports.CategorySchema = exports.LookupCategoryWithSubsSchema = exports.SubCategorySchema = exports.LookupCategoryEntitySchema = exports.ItemCategoryEntitySchema = void 0;
const zod_1 = require("zod");
const schemas_1 = require("../../../core/schemas");
/** Item category entity - key field only, passthrough for API flexibility */
exports.ItemCategoryEntitySchema = zod_1.z.object({ itemCategoryUid: zod_1.z.number() }).passthrough();
/** Lookup category entity - key field only */
exports.LookupCategoryEntitySchema = zod_1.z.object({ itemCategoryUid: zod_1.z.number() }).passthrough();
/** Sub-category - key field only */
exports.SubCategorySchema = zod_1.z.object({ itemCategoryUid: zod_1.z.number() }).passthrough();
/** Lookup category with subcategories - key field only */
exports.LookupCategoryWithSubsSchema = zod_1.z.object({ itemCategoryUid: zod_1.z.number() }).passthrough();
/** Category - key field only */
exports.CategorySchema = zod_1.z.object({ itemCategoryUid: zod_1.z.number() }).passthrough();
// Parameter schemas for category endpoints
exports.CategoryListParamsSchema = zod_1.z.object({
limit: zod_1.z.coerce.number().int().positive().optional(),
offset: zod_1.z.coerce.number().int().min(0).optional(),
displayOnWebFlag: zod_1.z.enum(['Y', 'N']).optional(),
deleteFlag: zod_1.z.enum(['Y', 'N']).optional(),
masterCategoryFlag: zod_1.z.string().optional(),
parentCategoryFlag: zod_1.z.string().optional(),
orderBy: zod_1.z.string().optional(),
q: zod_1.z.string().optional(),
});
exports.CategoryLookupParamsSchema = zod_1.z.object({
itemCategoryUid: zod_1.z.coerce.number().optional(),
itemCategoryId: zod_1.z.string().optional(),
includeSubCategories: zod_1.z.boolean().optional(),
displayOnWebFlag: zod_1.z.enum(['Y', 'N']).optional(),
deleteFlag: zod_1.z.enum(['Y', 'N']).optional(),
});
exports.CategoryPreCacheParamsSchema = zod_1.z.object({
itemCategoryUid: zod_1.z.coerce.number(),
});
exports.CategoryDetailsParamsSchema = zod_1.z.object({
path: zod_1.z.string().optional(),
rootItemCategoryId: zod_1.z.string().optional(),
orderBy: zod_1.z.string().optional(),
classId5List: zod_1.z.string().optional(),
productCollection: zod_1.z.string().optional(),
filters: zod_1.z.string().optional(),
childrenLimit: zod_1.z.coerce.number().int().positive().optional(),
childrenOffset: zod_1.z.coerce.number().int().min(0).optional(),
childrenFilter: zod_1.z.string().optional(),
});
exports.CategoryItemsParamsSchema = zod_1.z.object({
limit: zod_1.z.coerce.number().int().positive().optional(),
offset: zod_1.z.coerce.number().int().min(0).optional(),
sortBy: zod_1.z.string().optional(),
filters: zod_1.z.string().optional(),
fields: zod_1.z.string().optional(),
displayOnWebFlag: zod_1.z.string().optional(),
classId5List: zod_1.z.string().optional(),
classId5ExcludeList: zod_1.z.string().optional(),
tags: zod_1.z.string().optional(),
q: zod_1.z.string().optional(),
includeStock: zod_1.z.enum(['Y', 'N']).optional(),
cacheTtl: zod_1.z.coerce.number().int().min(0).optional(),
});
/** Category item - key field only */
exports.CategoryItemSchema = zod_1.z.object({ invMastUid: zod_1.z.number() }).passthrough();
/** Category filter - key field only */
exports.CategoryFilterSchema = zod_1.z.object({ attributeId: zod_1.z.string() }).passthrough();
/** Category image - key field only */
exports.CategoryImageSchema = zod_1.z.object({ imageUid: zod_1.z.number() }).passthrough();
// Response schemas using BaseResponseSchema (8-field format)
exports.CategoryResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.CategorySchema);
exports.CategoryListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.ItemCategoryEntitySchema));
exports.CategoryLookupResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.LookupCategoryWithSubsSchema);
exports.CategoryPreCacheResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.boolean());
exports.CategoryItemsResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CategoryItemSchema));
exports.CategoryFiltersResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CategoryFilterSchema));
exports.CategoryImagesResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CategoryImageSchema));
//# sourceMappingURL=categories.js.map