UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

102 lines 5.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataRefreshResponseSchemaResponse = exports.WebAllowanceResponseSchema = exports.SalesrepCustomersResponseSchema = exports.CustomerContactsResponseSchema = exports.CustomerLookupResponseSchema = exports.CustomerResponseSchema = exports.CustomerListResponseSchema = exports.DataRefreshResponseSchema = exports.SalesrepCustomerSchema = exports.WebAllowanceSchema = exports.PaginationOptionsSchema = exports.CustomerContactSchema = exports.CustomerLookupSchema = exports.CustomerLookupParamsSchema = exports.CustomerListParamsSchema = exports.CustomerSchema = void 0; const zod_1 = require("zod"); const schemas_1 = require("../../../core/schemas"); // Customer record schema - based on Customer.json exports.CustomerSchema = zod_1.z.object({ customerId: zod_1.z.coerce.number(), companyId: zod_1.z.string().max(8), customerName: zod_1.z.string().max(255).nullable(), class1Id: zod_1.z.string().max(8).nullable(), class2Id: zod_1.z.string().max(8).nullable(), class3Id: zod_1.z.string().max(8).nullable(), class4Id: zod_1.z.string().max(8).nullable(), class5Id: zod_1.z.string().max(8).nullable(), webEnabledFlag: zod_1.z.string().max(1), deleteFlag: zod_1.z.string().max(1), salesRepId: zod_1.z.string().max(16).nullable(), poNoRequired: zod_1.z.string().max(1), termsId: zod_1.z.string().max(2).nullable(), taxableFlag: zod_1.z.string().max(1), termsDesc: zod_1.z.string().nullable(), userDefined: zod_1.z.object({}).passthrough(), // Allows any additional properties }); exports.CustomerListParamsSchema = schemas_1.BaseGetParamsSchema.extend({ class5Id: zod_1.z.string().optional(), limit: zod_1.z.coerce.number().optional(), offset: zod_1.z.coerce.number().optional(), orderBy: zod_1.z.string().optional(), q: zod_1.z.string().optional(), }); exports.CustomerLookupParamsSchema = schemas_1.BaseGetParamsSchema.extend({ q: zod_1.z.string(), limit: zod_1.z.coerce.number().optional(), offset: zod_1.z.coerce.number().optional(), }); // Customer lookup record schema - based on Customer.json exports.CustomerLookupSchema = zod_1.z.object({ customerId: zod_1.z.coerce.number(), customerName: zod_1.z.string().max(255).nullable(), }); // Customer contact record schema - based on Customer.json exports.CustomerContactSchema = zod_1.z.object({ id: zod_1.z.string(), emailAddress: zod_1.z.string().nullable(), firstName: zod_1.z.string(), lastName: zod_1.z.string(), addressId: zod_1.z.coerce.number(), addressClass5Id: zod_1.z.string().nullable(), }); // Pagination options schema - based on Customer.json exports.PaginationOptionsSchema = zod_1.z.object({ limit: zod_1.z.coerce.number().min(1).default(10), offset: zod_1.z.coerce.number().min(0).default(0), filterList: zod_1.z .object({ delete_flag: zod_1.z.array(zod_1.z.string()).optional(), customer_type_cd: zod_1.z.coerce.number().optional(), }) .passthrough(), // Allow additional filters }); // Web allowance schema - based on Contacts.json exports.WebAllowanceSchema = zod_1.z.object({ webAllowance: zod_1.z.number(), orderStartDate: zod_1.z.string().nullable(), // Y-m-d format or null id: zod_1.z.string(), customerId: zod_1.z.coerce.number(), }); // Salesrep customer schema - based on Contacts.json exports.SalesrepCustomerSchema = zod_1.z.object({ customerId: zod_1.z.coerce.number(), companyId: zod_1.z.string().max(8), customerName: zod_1.z.string().max(255).nullable(), class1Id: zod_1.z.string().max(8).nullable(), class2Id: zod_1.z.string().max(8).nullable(), class3Id: zod_1.z.string().max(8).nullable(), class4Id: zod_1.z.string().max(8).nullable(), class5Id: zod_1.z.string().max(8).nullable(), webEnabledFlag: zod_1.z.string().max(1), deleteFlag: zod_1.z.string().max(1), salesRepId: zod_1.z.string().max(16).nullable(), poNoRequired: zod_1.z.string().max(1), termsId: zod_1.z.string().max(2).nullable(), taxableFlag: zod_1.z.string().max(1), termsDesc: zod_1.z.string().nullable(), userDefined: zod_1.z.object({}).passthrough(), }); // Data refresh schemas exports.DataRefreshResponseSchema = zod_1.z.object({ message: zod_1.z.string(), timestamp: zod_1.z.string(), jobId: zod_1.z.string(), }); // Response schemas using BaseResponseSchema (8-field format) exports.CustomerListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CustomerSchema)); exports.CustomerResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.CustomerSchema); exports.CustomerLookupResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CustomerLookupSchema)); exports.CustomerContactsResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.CustomerContactSchema)); exports.SalesrepCustomersResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.SalesrepCustomerSchema)); exports.WebAllowanceResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.WebAllowanceSchema); exports.DataRefreshResponseSchemaResponse = (0, schemas_1.BaseResponseSchema)(exports.DataRefreshResponseSchema); //# sourceMappingURL=customers.js.map