@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
75 lines • 3.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShipToAddressResponseSchema = exports.ShipToAddressListResponseSchema = exports.AddressListResponseSchema = exports.ShipToAddressListParamsSchema = exports.ShipToAddressCreateParamsSchema = exports.ShipToAddressSchema = exports.AddressSubSchema = exports.AddressListParamsSchema = exports.AddressSchema = void 0;
const zod_1 = require("zod");
const schemas_1 = require("../../../core/schemas");
// Address schemas
exports.AddressSchema = zod_1.z.object({
addressId: zod_1.z.coerce.number(),
customerId: zod_1.z.coerce.number(),
addressName: zod_1.z.string(),
address1: zod_1.z.string(),
address2: zod_1.z.string().optional(),
city: zod_1.z.string(),
state: zod_1.z.string(),
zipCode: zod_1.z.string(),
country: zod_1.z.string(),
phoneNumber: zod_1.z.string().optional(),
faxNumber: zod_1.z.string().optional(),
isPrimary: zod_1.z.boolean().optional(),
});
exports.AddressListParamsSchema = schemas_1.BaseGetParamsSchema.extend({
q: zod_1.z.string(),
limit: zod_1.z.coerce.number().optional(),
offset: zod_1.z.coerce.number().optional(),
});
// Address sub-schema - based on ShipTo.json
exports.AddressSubSchema = zod_1.z.object({
id: zod_1.z.coerce.number(),
name: zod_1.z.string().nullable(),
mailAddress1: zod_1.z.string().nullable(),
mailAddress2: zod_1.z.string().nullable(),
mailCity: zod_1.z.string().nullable(),
mailState: zod_1.z.string().nullable(),
mailPostalCode: zod_1.z.string().nullable(),
mailCountry: zod_1.z.string().nullable(),
physAddress1: zod_1.z.string().nullable(),
physAddress2: zod_1.z.string().nullable(),
physCity: zod_1.z.string().nullable(),
physState: zod_1.z.string().nullable(),
physPostalCode: zod_1.z.string().nullable(),
physCountry: zod_1.z.string().nullable(),
});
// Ship-to address schema - based on ShipTo.json
exports.ShipToAddressSchema = zod_1.z.object({
shipToId: zod_1.z.coerce.number(),
customerId: zod_1.z.coerce.number(),
companyId: zod_1.z.string().max(8),
defaultBranch: zod_1.z.string().max(8),
defaultCarrierId: zod_1.z.coerce.number().nullable(),
address: exports.AddressSubSchema,
});
exports.ShipToAddressCreateParamsSchema = zod_1.z.object({
shipToName: zod_1.z.string().min(1),
address1: zod_1.z.string().min(1),
address2: zod_1.z.string().optional(),
city: zod_1.z.string().min(1),
state: zod_1.z.string().min(1),
zipCode: zod_1.z.string().min(1),
country: zod_1.z.string().min(1),
contactName: zod_1.z.string().optional(),
phoneNumber: zod_1.z.string().optional(),
deliveryInstructions: zod_1.z.string().optional(),
isDefault: zod_1.z.boolean().optional(),
});
// Ship-to list parameters schema - based on ShipTo.json
exports.ShipToAddressListParamsSchema = schemas_1.BaseGetParamsSchema.extend({
limit: zod_1.z.coerce.number().min(1).optional().default(10),
offset: zod_1.z.coerce.number().min(0).optional().default(0),
orderBy: zod_1.z.string().optional().default('date_created|DESC'),
});
// Response schemas using BaseResponseSchema (8-field format)
exports.AddressListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.AddressSchema));
exports.ShipToAddressListResponseSchema = (0, schemas_1.BaseResponseSchema)(zod_1.z.array(exports.ShipToAddressSchema));
exports.ShipToAddressResponseSchema = (0, schemas_1.BaseResponseSchema)(exports.ShipToAddressSchema);
//# sourceMappingURL=addresses.js.map