UNPKG

trainingpeaks-sdk

Version:
31 lines (30 loc) 1.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetWorkoutsListParamsSchema = exports.GetWorkoutsListApiResponseSchema = exports.ApiWorkoutItemSchema = void 0; const zod_1 = require("zod"); exports.ApiWorkoutItemSchema = zod_1.z.object({ workoutId: zod_1.z.number(), athleteId: zod_1.z.number(), title: zod_1.z.string(), workoutTypeValueId: zod_1.z.number(), code: zod_1.z.string().nullable(), workoutDay: zod_1.z.string().refine((val) => { const date = new Date(val); return !isNaN(date.getTime()); }, { message: 'workoutDay must be a valid date string (ISO datetime or YYYY-MM-DD format)', }), startTime: zod_1.z.string().datetime().nullable(), startTimePlanned: zod_1.z.string().datetime().nullable(), isItAnOr: zod_1.z.boolean(), }); exports.GetWorkoutsListApiResponseSchema = zod_1.z.array(exports.ApiWorkoutItemSchema); exports.GetWorkoutsListParamsSchema = zod_1.z.object({ athleteId: zod_1.z.string(), startDate: zod_1.z .string() .regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be in YYYY-MM-DD format'), endDate: zod_1.z .string() .regex(/^\d{4}-\d{2}-\d{2}$/, 'Must be in YYYY-MM-DD format'), });