English
@kaiord/core / sleepRecordSchema
Variable: sleepRecordSchema
constsleepRecordSchema:ZodObject<{endTime:ZodISODateTime;externalId:ZodOptional<ZodString>;kaiordRecordId:ZodOptional<ZodString>;kind:ZodLiteral<"sleep">;restingHeartRate:ZodOptional<ZodNumber>;score:ZodOptional<ZodNumber>;sourceBridgeId:ZodOptional<ZodString>;stages:ZodArray<ZodObject<{durationSeconds:ZodNumber;stage:ZodEnum<{awake:"awake";deep:"deep";light:"light";rem:"rem"; }>;startTime:ZodISODateTime; },$strip>>;startTime:ZodISODateTime;totalDurationSeconds:ZodOptional<ZodNumber>;version:ZodString; },$strip>
Defined in: packages/core/src/domain/schemas/health/sleep.ts:35
Zod schema for extensions.health.sleep — a single overnight sleep session with REM/deep/light/awake stages, total duration, and optional sleep score / resting heart rate.
stages: [] means the stages were not recorded (e.g. a hand-entered night), so the stage-sum check only applies when stages are present. An absent totalDurationSeconds means the duration was not recorded (e.g. only a score was entered); it is never stored as 0.
version is constrained to 2.x so future additive evolution within the v2 line is accepted without bumping the canonical KRD version.