Skip to content

@kaiord/core


@kaiord/core / healthExtensionPayloadSchema

Variable: healthExtensionPayloadSchema

const healthExtensionPayloadSchema: ZodDiscriminatedUnion<[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: ZodNumber; version: ZodString; }, $strip>, ZodObject<{ externalId: ZodOptional<ZodString>; kaiordRecordId: ZodOptional<ZodString>; kind: ZodLiteral<"weight">; measuredAt: ZodISODateTime; sourceBridgeId: ZodOptional<ZodString>; version: ZodString; weightKilograms: ZodNumber; }, $strip>, ZodObject<{ externalId: ZodOptional<ZodString>; kaiordRecordId: ZodOptional<ZodString>; kind: ZodLiteral<"hrv">; measuredAt: ZodISODateTime; measurementWindow: ZodEnum<{ overnight: "overnight"; spot: "spot"; }>; rMSSD: ZodNumber; score: ZodOptional<ZodNumber>; sourceBridgeId: ZodOptional<ZodString>; version: ZodString; }, $strip>], "kind">

Defined in: packages/core/src/domain/schemas/health/index.ts:17

Tagged discriminated union of the six health-metric payloads carried under extensions.health.<metric> in KRD v2.0.

The kind discriminator selects the variant; sub-schemas validate their own per-metric invariants.