@nativesquare/soma 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +142 -0
- package/dist/client/_generated/_ignore.d.ts +1 -0
- package/dist/client/_generated/_ignore.d.ts.map +1 -0
- package/dist/client/_generated/_ignore.js +3 -0
- package/dist/client/_generated/_ignore.js.map +1 -0
- package/dist/client/index.d.ts +279 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +264 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +5 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +62 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +1063 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +3 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/private.d.ts +33 -0
- package/dist/component/private.d.ts.map +1 -0
- package/dist/component/private.js +45 -0
- package/dist/component/private.js.map +1 -0
- package/dist/component/public.d.ts +1107 -0
- package/dist/component/public.d.ts.map +1 -0
- package/dist/component/public.js +310 -0
- package/dist/component/public.js.map +1 -0
- package/dist/component/schema.d.ts +4419 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +106 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/validators/activity.d.ts +747 -0
- package/dist/component/validators/activity.d.ts.map +1 -0
- package/dist/component/validators/activity.js +146 -0
- package/dist/component/validators/activity.js.map +1 -0
- package/dist/component/validators/athlete.d.ts +18 -0
- package/dist/component/validators/athlete.d.ts.map +1 -0
- package/dist/component/validators/athlete.js +25 -0
- package/dist/component/validators/athlete.js.map +1 -0
- package/dist/component/validators/body.d.ts +634 -0
- package/dist/component/validators/body.d.ts.map +1 -0
- package/dist/component/validators/body.js +70 -0
- package/dist/component/validators/body.js.map +1 -0
- package/dist/component/validators/connection.d.ts +7 -0
- package/dist/component/validators/connection.d.ts.map +1 -0
- package/dist/component/validators/connection.js +16 -0
- package/dist/component/validators/connection.js.map +1 -0
- package/dist/component/validators/daily.d.ts +650 -0
- package/dist/component/validators/daily.d.ts.map +1 -0
- package/dist/component/validators/daily.js +119 -0
- package/dist/component/validators/daily.js.map +1 -0
- package/dist/component/validators/enums.d.ts +24 -0
- package/dist/component/validators/enums.d.ts.map +1 -0
- package/dist/component/validators/enums.js +69 -0
- package/dist/component/validators/enums.js.map +1 -0
- package/dist/component/validators/index.d.ts +13 -0
- package/dist/component/validators/index.d.ts.map +1 -0
- package/dist/component/validators/index.js +16 -0
- package/dist/component/validators/index.js.map +1 -0
- package/dist/component/validators/menstruation.d.ts +51 -0
- package/dist/component/validators/menstruation.d.ts.map +1 -0
- package/dist/component/validators/menstruation.js +32 -0
- package/dist/component/validators/menstruation.js.map +1 -0
- package/dist/component/validators/nutrition.d.ts +498 -0
- package/dist/component/validators/nutrition.d.ts.map +1 -0
- package/dist/component/validators/nutrition.js +31 -0
- package/dist/component/validators/nutrition.js.map +1 -0
- package/dist/component/validators/plannedWorkout.d.ts +277 -0
- package/dist/component/validators/plannedWorkout.d.ts.map +1 -0
- package/dist/component/validators/plannedWorkout.js +105 -0
- package/dist/component/validators/plannedWorkout.js.map +1 -0
- package/dist/component/validators/samples.d.ts +609 -0
- package/dist/component/validators/samples.d.ts.map +1 -0
- package/dist/component/validators/samples.js +336 -0
- package/dist/component/validators/samples.js.map +1 -0
- package/dist/component/validators/shared.d.ts +402 -0
- package/dist/component/validators/shared.d.ts.map +1 -0
- package/dist/component/validators/shared.js +146 -0
- package/dist/component/validators/shared.js.map +1 -0
- package/dist/component/validators/sleep.d.ts +438 -0
- package/dist/component/validators/sleep.d.ts.map +1 -0
- package/dist/component/validators/sleep.js +95 -0
- package/dist/component/validators/sleep.js.map +1 -0
- package/dist/healthkit/activity.d.ts +75 -0
- package/dist/healthkit/activity.d.ts.map +1 -0
- package/dist/healthkit/activity.js +93 -0
- package/dist/healthkit/activity.js.map +1 -0
- package/dist/healthkit/athlete.d.ts +26 -0
- package/dist/healthkit/athlete.d.ts.map +1 -0
- package/dist/healthkit/athlete.js +34 -0
- package/dist/healthkit/athlete.js.map +1 -0
- package/dist/healthkit/body.d.ts +102 -0
- package/dist/healthkit/body.d.ts.map +1 -0
- package/dist/healthkit/body.js +167 -0
- package/dist/healthkit/body.js.map +1 -0
- package/dist/healthkit/daily.d.ts +119 -0
- package/dist/healthkit/daily.d.ts.map +1 -0
- package/dist/healthkit/daily.js +160 -0
- package/dist/healthkit/daily.js.map +1 -0
- package/dist/healthkit/index.d.ts +21 -0
- package/dist/healthkit/index.d.ts.map +1 -0
- package/dist/healthkit/index.js +21 -0
- package/dist/healthkit/index.js.map +1 -0
- package/dist/healthkit/maps/activity-type.d.ts +6 -0
- package/dist/healthkit/maps/activity-type.d.ts.map +1 -0
- package/dist/healthkit/maps/activity-type.js +184 -0
- package/dist/healthkit/maps/activity-type.js.map +1 -0
- package/dist/healthkit/maps/menstruation-flow.d.ts +6 -0
- package/dist/healthkit/maps/menstruation-flow.d.ts.map +1 -0
- package/dist/healthkit/maps/menstruation-flow.js +21 -0
- package/dist/healthkit/maps/menstruation-flow.js.map +1 -0
- package/dist/healthkit/maps/sleep-level.d.ts +11 -0
- package/dist/healthkit/maps/sleep-level.d.ts.map +1 -0
- package/dist/healthkit/maps/sleep-level.js +32 -0
- package/dist/healthkit/maps/sleep-level.js.map +1 -0
- package/dist/healthkit/menstruation.d.ts +35 -0
- package/dist/healthkit/menstruation.d.ts.map +1 -0
- package/dist/healthkit/menstruation.js +37 -0
- package/dist/healthkit/menstruation.js.map +1 -0
- package/dist/healthkit/nutrition.d.ts +77 -0
- package/dist/healthkit/nutrition.d.ts.map +1 -0
- package/dist/healthkit/nutrition.js +135 -0
- package/dist/healthkit/nutrition.js.map +1 -0
- package/dist/healthkit/sleep.d.ts +60 -0
- package/dist/healthkit/sleep.d.ts.map +1 -0
- package/dist/healthkit/sleep.js +108 -0
- package/dist/healthkit/sleep.js.map +1 -0
- package/dist/healthkit/types.d.ts +94 -0
- package/dist/healthkit/types.d.ts.map +1 -0
- package/dist/healthkit/types.js +26 -0
- package/dist/healthkit/types.js.map +1 -0
- package/dist/healthkit/utils.d.ts +63 -0
- package/dist/healthkit/utils.d.ts.map +1 -0
- package/dist/healthkit/utils.js +93 -0
- package/dist/healthkit/utils.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +6 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +112 -0
- package/src/client/_generated/_ignore.ts +1 -0
- package/src/client/index.ts +371 -0
- package/src/client/types.ts +18 -0
- package/src/component/_generated/api.ts +78 -0
- package/src/component/_generated/component.ts +1090 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/convex.config.ts +3 -0
- package/src/component/private.ts +50 -0
- package/src/component/public.ts +358 -0
- package/src/component/schema.ts +115 -0
- package/src/component/validators/activity.ts +216 -0
- package/src/component/validators/athlete.ts +25 -0
- package/src/component/validators/body.ts +114 -0
- package/src/component/validators/connection.ts +16 -0
- package/src/component/validators/daily.ts +173 -0
- package/src/component/validators/enums.ts +119 -0
- package/src/component/validators/index.ts +16 -0
- package/src/component/validators/menstruation.ts +36 -0
- package/src/component/validators/nutrition.ts +37 -0
- package/src/component/validators/plannedWorkout.ts +110 -0
- package/src/component/validators/samples.ts +380 -0
- package/src/component/validators/shared.ts +165 -0
- package/src/component/validators/sleep.ts +133 -0
- package/src/healthkit/activity.ts +120 -0
- package/src/healthkit/athlete.ts +43 -0
- package/src/healthkit/body.ts +266 -0
- package/src/healthkit/daily.ts +245 -0
- package/src/healthkit/index.ts +59 -0
- package/src/healthkit/maps/activity-type.ts +185 -0
- package/src/healthkit/maps/menstruation-flow.ts +23 -0
- package/src/healthkit/maps/sleep-level.ts +37 -0
- package/src/healthkit/menstruation.ts +52 -0
- package/src/healthkit/nutrition.ts +162 -0
- package/src/healthkit/sleep.ts +136 -0
- package/src/healthkit/types.ts +219 -0
- package/src/healthkit/utils.ts +122 -0
- package/src/react/index.ts +7 -0
- package/src/test.ts +18 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
export declare const sleepValidator: {
|
|
2
|
+
connectionId: import("convex/values").VId<import("convex/values").GenericId<"connections">, "required">;
|
|
3
|
+
userId: import("convex/values").VString<string, "required">;
|
|
4
|
+
data_enrichment: import("convex/values").VObject<{
|
|
5
|
+
sleep_contributors?: {
|
|
6
|
+
contributor_name: string;
|
|
7
|
+
contributor_score: number;
|
|
8
|
+
}[] | undefined;
|
|
9
|
+
sleep_score?: number | undefined;
|
|
10
|
+
} | undefined, {
|
|
11
|
+
sleep_contributors: import("convex/values").VArray<{
|
|
12
|
+
contributor_name: string;
|
|
13
|
+
contributor_score: number;
|
|
14
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
15
|
+
contributor_name: string;
|
|
16
|
+
contributor_score: number;
|
|
17
|
+
}, {
|
|
18
|
+
contributor_name: import("convex/values").VString<string, "required">;
|
|
19
|
+
contributor_score: import("convex/values").VFloat64<number, "required">;
|
|
20
|
+
}, "required", "contributor_name" | "contributor_score">, "optional">;
|
|
21
|
+
sleep_score: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
22
|
+
}, "optional", "sleep_contributors" | "sleep_score">;
|
|
23
|
+
device_data: import("convex/values").VObject<{
|
|
24
|
+
name?: string | undefined;
|
|
25
|
+
manufacturer?: string | undefined;
|
|
26
|
+
serial_number?: string | undefined;
|
|
27
|
+
software_version?: string | undefined;
|
|
28
|
+
hardware_version?: string | undefined;
|
|
29
|
+
last_upload_date?: string | undefined;
|
|
30
|
+
activation_timestamp?: string | undefined;
|
|
31
|
+
data_provided?: string[] | undefined;
|
|
32
|
+
other_devices?: {
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
manufacturer?: string | undefined;
|
|
35
|
+
serial_number?: string | undefined;
|
|
36
|
+
software_version?: string | undefined;
|
|
37
|
+
hardware_version?: string | undefined;
|
|
38
|
+
last_upload_date?: string | undefined;
|
|
39
|
+
activation_timestamp?: string | undefined;
|
|
40
|
+
data_provided?: string[] | undefined;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
sensor_state?: string | undefined;
|
|
43
|
+
} | undefined, {
|
|
44
|
+
activation_timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
45
|
+
data_provided: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
46
|
+
hardware_version: import("convex/values").VString<string | undefined, "optional">;
|
|
47
|
+
last_upload_date: import("convex/values").VString<string | undefined, "optional">;
|
|
48
|
+
manufacturer: import("convex/values").VString<string | undefined, "optional">;
|
|
49
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
50
|
+
other_devices: import("convex/values").VArray<{
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
manufacturer?: string | undefined;
|
|
53
|
+
serial_number?: string | undefined;
|
|
54
|
+
software_version?: string | undefined;
|
|
55
|
+
hardware_version?: string | undefined;
|
|
56
|
+
last_upload_date?: string | undefined;
|
|
57
|
+
activation_timestamp?: string | undefined;
|
|
58
|
+
data_provided?: string[] | undefined;
|
|
59
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
manufacturer?: string | undefined;
|
|
62
|
+
serial_number?: string | undefined;
|
|
63
|
+
software_version?: string | undefined;
|
|
64
|
+
hardware_version?: string | undefined;
|
|
65
|
+
last_upload_date?: string | undefined;
|
|
66
|
+
activation_timestamp?: string | undefined;
|
|
67
|
+
data_provided?: string[] | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
70
|
+
manufacturer: import("convex/values").VString<string | undefined, "optional">;
|
|
71
|
+
serial_number: import("convex/values").VString<string | undefined, "optional">;
|
|
72
|
+
software_version: import("convex/values").VString<string | undefined, "optional">;
|
|
73
|
+
hardware_version: import("convex/values").VString<string | undefined, "optional">;
|
|
74
|
+
last_upload_date: import("convex/values").VString<string | undefined, "optional">;
|
|
75
|
+
activation_timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
76
|
+
data_provided: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
77
|
+
}, "required", "name" | "manufacturer" | "serial_number" | "software_version" | "hardware_version" | "last_upload_date" | "activation_timestamp" | "data_provided">, "optional">;
|
|
78
|
+
serial_number: import("convex/values").VString<string | undefined, "optional">;
|
|
79
|
+
sensor_state: import("convex/values").VString<string | undefined, "optional">;
|
|
80
|
+
software_version: import("convex/values").VString<string | undefined, "optional">;
|
|
81
|
+
}, "optional", "name" | "manufacturer" | "serial_number" | "software_version" | "hardware_version" | "last_upload_date" | "activation_timestamp" | "data_provided" | "other_devices" | "sensor_state">;
|
|
82
|
+
heart_rate_data: import("convex/values").VObject<{
|
|
83
|
+
summary?: {
|
|
84
|
+
avg_hr_bpm?: number | undefined;
|
|
85
|
+
avg_hrv_rmssd?: number | undefined;
|
|
86
|
+
avg_hrv_sdnn?: number | undefined;
|
|
87
|
+
hr_zone_data?: {
|
|
88
|
+
zone?: number | undefined;
|
|
89
|
+
start_percentage?: number | undefined;
|
|
90
|
+
end_percentage?: number | undefined;
|
|
91
|
+
name?: string | undefined;
|
|
92
|
+
duration_seconds?: number | undefined;
|
|
93
|
+
}[] | undefined;
|
|
94
|
+
max_hr_bpm?: number | undefined;
|
|
95
|
+
min_hr_bpm?: number | undefined;
|
|
96
|
+
resting_hr_bpm?: number | undefined;
|
|
97
|
+
user_max_hr_bpm?: number | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
detailed?: {
|
|
100
|
+
hr_samples?: {
|
|
101
|
+
timestamp?: string | undefined;
|
|
102
|
+
bpm?: number | undefined;
|
|
103
|
+
timer_duration_seconds?: number | undefined;
|
|
104
|
+
context?: number | undefined;
|
|
105
|
+
}[] | undefined;
|
|
106
|
+
hrv_samples_rmssd?: {
|
|
107
|
+
timestamp?: string | undefined;
|
|
108
|
+
hrv_rmssd?: number | undefined;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
hrv_samples_sdnn?: {
|
|
111
|
+
timestamp?: string | undefined;
|
|
112
|
+
hrv_sdnn?: number | undefined;
|
|
113
|
+
}[] | undefined;
|
|
114
|
+
} | undefined;
|
|
115
|
+
} | undefined, {
|
|
116
|
+
detailed: import("convex/values").VObject<{
|
|
117
|
+
hr_samples?: {
|
|
118
|
+
timestamp?: string | undefined;
|
|
119
|
+
bpm?: number | undefined;
|
|
120
|
+
timer_duration_seconds?: number | undefined;
|
|
121
|
+
context?: number | undefined;
|
|
122
|
+
}[] | undefined;
|
|
123
|
+
hrv_samples_rmssd?: {
|
|
124
|
+
timestamp?: string | undefined;
|
|
125
|
+
hrv_rmssd?: number | undefined;
|
|
126
|
+
}[] | undefined;
|
|
127
|
+
hrv_samples_sdnn?: {
|
|
128
|
+
timestamp?: string | undefined;
|
|
129
|
+
hrv_sdnn?: number | undefined;
|
|
130
|
+
}[] | undefined;
|
|
131
|
+
} | undefined, {
|
|
132
|
+
hr_samples: import("convex/values").VArray<{
|
|
133
|
+
timestamp?: string | undefined;
|
|
134
|
+
bpm?: number | undefined;
|
|
135
|
+
timer_duration_seconds?: number | undefined;
|
|
136
|
+
context?: number | undefined;
|
|
137
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
138
|
+
timestamp?: string | undefined;
|
|
139
|
+
bpm?: number | undefined;
|
|
140
|
+
timer_duration_seconds?: number | undefined;
|
|
141
|
+
context?: number | undefined;
|
|
142
|
+
}, {
|
|
143
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
144
|
+
bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
145
|
+
timer_duration_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
146
|
+
context: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
147
|
+
}, "required", "timestamp" | "bpm" | "timer_duration_seconds" | "context">, "optional">;
|
|
148
|
+
hrv_samples_rmssd: import("convex/values").VArray<{
|
|
149
|
+
timestamp?: string | undefined;
|
|
150
|
+
hrv_rmssd?: number | undefined;
|
|
151
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
152
|
+
timestamp?: string | undefined;
|
|
153
|
+
hrv_rmssd?: number | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
156
|
+
hrv_rmssd: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
157
|
+
}, "required", "timestamp" | "hrv_rmssd">, "optional">;
|
|
158
|
+
hrv_samples_sdnn: import("convex/values").VArray<{
|
|
159
|
+
timestamp?: string | undefined;
|
|
160
|
+
hrv_sdnn?: number | undefined;
|
|
161
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
162
|
+
timestamp?: string | undefined;
|
|
163
|
+
hrv_sdnn?: number | undefined;
|
|
164
|
+
}, {
|
|
165
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
166
|
+
hrv_sdnn: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
167
|
+
}, "required", "timestamp" | "hrv_sdnn">, "optional">;
|
|
168
|
+
}, "optional", "hr_samples" | "hrv_samples_rmssd" | "hrv_samples_sdnn">;
|
|
169
|
+
summary: import("convex/values").VObject<{
|
|
170
|
+
avg_hr_bpm?: number | undefined;
|
|
171
|
+
avg_hrv_rmssd?: number | undefined;
|
|
172
|
+
avg_hrv_sdnn?: number | undefined;
|
|
173
|
+
hr_zone_data?: {
|
|
174
|
+
zone?: number | undefined;
|
|
175
|
+
start_percentage?: number | undefined;
|
|
176
|
+
end_percentage?: number | undefined;
|
|
177
|
+
name?: string | undefined;
|
|
178
|
+
duration_seconds?: number | undefined;
|
|
179
|
+
}[] | undefined;
|
|
180
|
+
max_hr_bpm?: number | undefined;
|
|
181
|
+
min_hr_bpm?: number | undefined;
|
|
182
|
+
resting_hr_bpm?: number | undefined;
|
|
183
|
+
user_max_hr_bpm?: number | undefined;
|
|
184
|
+
} | undefined, {
|
|
185
|
+
avg_hr_bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
186
|
+
avg_hrv_rmssd: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
187
|
+
avg_hrv_sdnn: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
188
|
+
hr_zone_data: import("convex/values").VArray<{
|
|
189
|
+
zone?: number | undefined;
|
|
190
|
+
start_percentage?: number | undefined;
|
|
191
|
+
end_percentage?: number | undefined;
|
|
192
|
+
name?: string | undefined;
|
|
193
|
+
duration_seconds?: number | undefined;
|
|
194
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
195
|
+
zone?: number | undefined;
|
|
196
|
+
start_percentage?: number | undefined;
|
|
197
|
+
end_percentage?: number | undefined;
|
|
198
|
+
name?: string | undefined;
|
|
199
|
+
duration_seconds?: number | undefined;
|
|
200
|
+
}, {
|
|
201
|
+
zone: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
202
|
+
start_percentage: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
203
|
+
end_percentage: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
204
|
+
name: import("convex/values").VString<string | undefined, "optional">;
|
|
205
|
+
duration_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
206
|
+
}, "required", "zone" | "start_percentage" | "end_percentage" | "name" | "duration_seconds">, "optional">;
|
|
207
|
+
max_hr_bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
208
|
+
min_hr_bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
209
|
+
resting_hr_bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
210
|
+
user_max_hr_bpm: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
211
|
+
}, "optional", "avg_hr_bpm" | "avg_hrv_rmssd" | "avg_hrv_sdnn" | "hr_zone_data" | "max_hr_bpm" | "min_hr_bpm" | "resting_hr_bpm" | "user_max_hr_bpm">;
|
|
212
|
+
}, "optional", "summary" | "detailed" | "summary.avg_hr_bpm" | "summary.avg_hrv_rmssd" | "summary.avg_hrv_sdnn" | "summary.hr_zone_data" | "summary.max_hr_bpm" | "summary.min_hr_bpm" | "summary.resting_hr_bpm" | "summary.user_max_hr_bpm" | "detailed.hr_samples" | "detailed.hrv_samples_rmssd" | "detailed.hrv_samples_sdnn">;
|
|
213
|
+
metadata: import("convex/values").VObject<{
|
|
214
|
+
summary_id?: string | undefined;
|
|
215
|
+
timestamp_localization?: number | undefined;
|
|
216
|
+
is_nap?: boolean | undefined;
|
|
217
|
+
start_time: string;
|
|
218
|
+
end_time: string;
|
|
219
|
+
upload_type: number;
|
|
220
|
+
}, {
|
|
221
|
+
end_time: import("convex/values").VString<string, "required">;
|
|
222
|
+
start_time: import("convex/values").VString<string, "required">;
|
|
223
|
+
is_nap: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
224
|
+
summary_id: import("convex/values").VString<string | undefined, "optional">;
|
|
225
|
+
timestamp_localization: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
226
|
+
upload_type: import("convex/values").VFloat64<number, "required">;
|
|
227
|
+
}, "required", "start_time" | "end_time" | "summary_id" | "timestamp_localization" | "upload_type" | "is_nap">;
|
|
228
|
+
readiness_data: import("convex/values").VObject<{
|
|
229
|
+
readiness?: number | undefined;
|
|
230
|
+
recovery_level?: number | undefined;
|
|
231
|
+
} | undefined, {
|
|
232
|
+
readiness: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
233
|
+
recovery_level: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
234
|
+
}, "optional", "readiness" | "recovery_level">;
|
|
235
|
+
respiration_data: import("convex/values").VObject<{
|
|
236
|
+
breaths_data?: {
|
|
237
|
+
start_time?: string | undefined;
|
|
238
|
+
end_time?: string | undefined;
|
|
239
|
+
samples?: {
|
|
240
|
+
timestamp?: string | undefined;
|
|
241
|
+
breaths_per_min?: number | undefined;
|
|
242
|
+
}[] | undefined;
|
|
243
|
+
avg_breaths_per_min?: number | undefined;
|
|
244
|
+
max_breaths_per_min?: number | undefined;
|
|
245
|
+
min_breaths_per_min?: number | undefined;
|
|
246
|
+
on_demand_reading?: boolean | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
oxygen_saturation_data?: {
|
|
249
|
+
start_time?: string | undefined;
|
|
250
|
+
end_time?: string | undefined;
|
|
251
|
+
avg_saturation_percentage?: number | undefined;
|
|
252
|
+
samples?: {
|
|
253
|
+
type?: number | undefined;
|
|
254
|
+
timestamp?: string | undefined;
|
|
255
|
+
percentage?: number | undefined;
|
|
256
|
+
}[] | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
snoring_data?: {
|
|
259
|
+
start_time?: string | undefined;
|
|
260
|
+
end_time?: string | undefined;
|
|
261
|
+
samples?: {
|
|
262
|
+
timestamp?: string | undefined;
|
|
263
|
+
duration_seconds?: number | undefined;
|
|
264
|
+
}[] | undefined;
|
|
265
|
+
num_snoring_events?: number | undefined;
|
|
266
|
+
total_snoring_duration_seconds?: number | undefined;
|
|
267
|
+
} | undefined;
|
|
268
|
+
} | undefined, {
|
|
269
|
+
breaths_data: import("convex/values").VObject<{
|
|
270
|
+
start_time?: string | undefined;
|
|
271
|
+
end_time?: string | undefined;
|
|
272
|
+
samples?: {
|
|
273
|
+
timestamp?: string | undefined;
|
|
274
|
+
breaths_per_min?: number | undefined;
|
|
275
|
+
}[] | undefined;
|
|
276
|
+
avg_breaths_per_min?: number | undefined;
|
|
277
|
+
max_breaths_per_min?: number | undefined;
|
|
278
|
+
min_breaths_per_min?: number | undefined;
|
|
279
|
+
on_demand_reading?: boolean | undefined;
|
|
280
|
+
} | undefined, {
|
|
281
|
+
avg_breaths_per_min: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
282
|
+
end_time: import("convex/values").VString<string | undefined, "optional">;
|
|
283
|
+
max_breaths_per_min: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
284
|
+
min_breaths_per_min: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
285
|
+
on_demand_reading: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
286
|
+
samples: import("convex/values").VArray<{
|
|
287
|
+
timestamp?: string | undefined;
|
|
288
|
+
breaths_per_min?: number | undefined;
|
|
289
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
290
|
+
timestamp?: string | undefined;
|
|
291
|
+
breaths_per_min?: number | undefined;
|
|
292
|
+
}, {
|
|
293
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
294
|
+
breaths_per_min: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
295
|
+
}, "required", "timestamp" | "breaths_per_min">, "optional">;
|
|
296
|
+
start_time: import("convex/values").VString<string | undefined, "optional">;
|
|
297
|
+
}, "optional", "start_time" | "end_time" | "samples" | "avg_breaths_per_min" | "max_breaths_per_min" | "min_breaths_per_min" | "on_demand_reading">;
|
|
298
|
+
oxygen_saturation_data: import("convex/values").VObject<{
|
|
299
|
+
start_time?: string | undefined;
|
|
300
|
+
end_time?: string | undefined;
|
|
301
|
+
avg_saturation_percentage?: number | undefined;
|
|
302
|
+
samples?: {
|
|
303
|
+
type?: number | undefined;
|
|
304
|
+
timestamp?: string | undefined;
|
|
305
|
+
percentage?: number | undefined;
|
|
306
|
+
}[] | undefined;
|
|
307
|
+
} | undefined, {
|
|
308
|
+
avg_saturation_percentage: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
309
|
+
end_time: import("convex/values").VString<string | undefined, "optional">;
|
|
310
|
+
samples: import("convex/values").VArray<{
|
|
311
|
+
type?: number | undefined;
|
|
312
|
+
timestamp?: string | undefined;
|
|
313
|
+
percentage?: number | undefined;
|
|
314
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
315
|
+
type?: number | undefined;
|
|
316
|
+
timestamp?: string | undefined;
|
|
317
|
+
percentage?: number | undefined;
|
|
318
|
+
}, {
|
|
319
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
320
|
+
percentage: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
321
|
+
type: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
322
|
+
}, "required", "type" | "timestamp" | "percentage">, "optional">;
|
|
323
|
+
start_time: import("convex/values").VString<string | undefined, "optional">;
|
|
324
|
+
}, "optional", "start_time" | "end_time" | "avg_saturation_percentage" | "samples">;
|
|
325
|
+
snoring_data: import("convex/values").VObject<{
|
|
326
|
+
start_time?: string | undefined;
|
|
327
|
+
end_time?: string | undefined;
|
|
328
|
+
samples?: {
|
|
329
|
+
timestamp?: string | undefined;
|
|
330
|
+
duration_seconds?: number | undefined;
|
|
331
|
+
}[] | undefined;
|
|
332
|
+
num_snoring_events?: number | undefined;
|
|
333
|
+
total_snoring_duration_seconds?: number | undefined;
|
|
334
|
+
} | undefined, {
|
|
335
|
+
end_time: import("convex/values").VString<string | undefined, "optional">;
|
|
336
|
+
num_snoring_events: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
337
|
+
samples: import("convex/values").VArray<{
|
|
338
|
+
timestamp?: string | undefined;
|
|
339
|
+
duration_seconds?: number | undefined;
|
|
340
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
341
|
+
timestamp?: string | undefined;
|
|
342
|
+
duration_seconds?: number | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
345
|
+
duration_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
346
|
+
}, "required", "timestamp" | "duration_seconds">, "optional">;
|
|
347
|
+
start_time: import("convex/values").VString<string | undefined, "optional">;
|
|
348
|
+
total_snoring_duration_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
349
|
+
}, "optional", "start_time" | "end_time" | "samples" | "num_snoring_events" | "total_snoring_duration_seconds">;
|
|
350
|
+
}, "optional", "breaths_data" | "oxygen_saturation_data" | "snoring_data" | "breaths_data.start_time" | "breaths_data.end_time" | "breaths_data.samples" | "breaths_data.avg_breaths_per_min" | "breaths_data.max_breaths_per_min" | "breaths_data.min_breaths_per_min" | "breaths_data.on_demand_reading" | "oxygen_saturation_data.start_time" | "oxygen_saturation_data.end_time" | "oxygen_saturation_data.avg_saturation_percentage" | "oxygen_saturation_data.samples" | "snoring_data.start_time" | "snoring_data.end_time" | "snoring_data.samples" | "snoring_data.num_snoring_events" | "snoring_data.total_snoring_duration_seconds">;
|
|
351
|
+
scores: import("convex/values").VObject<{
|
|
352
|
+
sleep?: number | undefined;
|
|
353
|
+
} | undefined, {
|
|
354
|
+
sleep: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
355
|
+
}, "optional", "sleep">;
|
|
356
|
+
sleep_durations_data: import("convex/values").VObject<{
|
|
357
|
+
asleep?: {
|
|
358
|
+
duration_asleep_state_seconds?: number | undefined;
|
|
359
|
+
duration_deep_sleep_state_seconds?: number | undefined;
|
|
360
|
+
duration_light_sleep_state_seconds?: number | undefined;
|
|
361
|
+
duration_REM_sleep_state_seconds?: number | undefined;
|
|
362
|
+
num_REM_events?: number | undefined;
|
|
363
|
+
} | undefined;
|
|
364
|
+
awake?: {
|
|
365
|
+
duration_awake_state_seconds?: number | undefined;
|
|
366
|
+
duration_long_interruption_seconds?: number | undefined;
|
|
367
|
+
duration_short_interruption_seconds?: number | undefined;
|
|
368
|
+
num_out_of_bed_events?: number | undefined;
|
|
369
|
+
num_wakeup_events?: number | undefined;
|
|
370
|
+
sleep_latency_seconds?: number | undefined;
|
|
371
|
+
wake_up_latency_seconds?: number | undefined;
|
|
372
|
+
} | undefined;
|
|
373
|
+
hypnogram_samples?: {
|
|
374
|
+
timestamp?: string | undefined;
|
|
375
|
+
level?: number | undefined;
|
|
376
|
+
}[] | undefined;
|
|
377
|
+
other?: {
|
|
378
|
+
duration_in_bed_seconds?: number | undefined;
|
|
379
|
+
duration_unmeasurable_sleep_seconds?: number | undefined;
|
|
380
|
+
} | undefined;
|
|
381
|
+
sleep_efficiency?: number | undefined;
|
|
382
|
+
} | undefined, {
|
|
383
|
+
asleep: import("convex/values").VObject<{
|
|
384
|
+
duration_asleep_state_seconds?: number | undefined;
|
|
385
|
+
duration_deep_sleep_state_seconds?: number | undefined;
|
|
386
|
+
duration_light_sleep_state_seconds?: number | undefined;
|
|
387
|
+
duration_REM_sleep_state_seconds?: number | undefined;
|
|
388
|
+
num_REM_events?: number | undefined;
|
|
389
|
+
} | undefined, {
|
|
390
|
+
duration_asleep_state_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
391
|
+
duration_deep_sleep_state_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
392
|
+
duration_light_sleep_state_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
393
|
+
duration_REM_sleep_state_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
394
|
+
num_REM_events: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
395
|
+
}, "optional", "duration_asleep_state_seconds" | "duration_deep_sleep_state_seconds" | "duration_light_sleep_state_seconds" | "duration_REM_sleep_state_seconds" | "num_REM_events">;
|
|
396
|
+
awake: import("convex/values").VObject<{
|
|
397
|
+
duration_awake_state_seconds?: number | undefined;
|
|
398
|
+
duration_long_interruption_seconds?: number | undefined;
|
|
399
|
+
duration_short_interruption_seconds?: number | undefined;
|
|
400
|
+
num_out_of_bed_events?: number | undefined;
|
|
401
|
+
num_wakeup_events?: number | undefined;
|
|
402
|
+
sleep_latency_seconds?: number | undefined;
|
|
403
|
+
wake_up_latency_seconds?: number | undefined;
|
|
404
|
+
} | undefined, {
|
|
405
|
+
duration_awake_state_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
406
|
+
duration_long_interruption_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
407
|
+
duration_short_interruption_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
408
|
+
num_out_of_bed_events: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
409
|
+
num_wakeup_events: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
410
|
+
sleep_latency_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
411
|
+
wake_up_latency_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
412
|
+
}, "optional", "duration_awake_state_seconds" | "duration_long_interruption_seconds" | "duration_short_interruption_seconds" | "num_out_of_bed_events" | "num_wakeup_events" | "sleep_latency_seconds" | "wake_up_latency_seconds">;
|
|
413
|
+
hypnogram_samples: import("convex/values").VArray<{
|
|
414
|
+
timestamp?: string | undefined;
|
|
415
|
+
level?: number | undefined;
|
|
416
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
417
|
+
timestamp?: string | undefined;
|
|
418
|
+
level?: number | undefined;
|
|
419
|
+
}, {
|
|
420
|
+
timestamp: import("convex/values").VString<string | undefined, "optional">;
|
|
421
|
+
level: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
422
|
+
}, "required", "timestamp" | "level">, "optional">;
|
|
423
|
+
other: import("convex/values").VObject<{
|
|
424
|
+
duration_in_bed_seconds?: number | undefined;
|
|
425
|
+
duration_unmeasurable_sleep_seconds?: number | undefined;
|
|
426
|
+
} | undefined, {
|
|
427
|
+
duration_in_bed_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
428
|
+
duration_unmeasurable_sleep_seconds: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
429
|
+
}, "optional", "duration_in_bed_seconds" | "duration_unmeasurable_sleep_seconds">;
|
|
430
|
+
sleep_efficiency: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
431
|
+
}, "optional", "asleep" | "awake" | "hypnogram_samples" | "other" | "sleep_efficiency" | "asleep.duration_asleep_state_seconds" | "asleep.duration_deep_sleep_state_seconds" | "asleep.duration_light_sleep_state_seconds" | "asleep.duration_REM_sleep_state_seconds" | "asleep.num_REM_events" | "awake.duration_awake_state_seconds" | "awake.duration_long_interruption_seconds" | "awake.duration_short_interruption_seconds" | "awake.num_out_of_bed_events" | "awake.num_wakeup_events" | "awake.sleep_latency_seconds" | "awake.wake_up_latency_seconds" | "other.duration_in_bed_seconds" | "other.duration_unmeasurable_sleep_seconds">;
|
|
432
|
+
temperature_data: import("convex/values").VObject<{
|
|
433
|
+
delta?: number | undefined;
|
|
434
|
+
} | undefined, {
|
|
435
|
+
delta: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
436
|
+
}, "optional", "delta">;
|
|
437
|
+
};
|
|
438
|
+
//# sourceMappingURL=sleep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.d.ts","sourceRoot":"","sources":["../../../src/component/validators/sleep.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuH1B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { sleepHypnogramSample, breathSample, oxygenSaturationSample, snoringSample, } from "./samples.js";
|
|
3
|
+
import { deviceData, heartRateData, dataContributor } from "./shared.js";
|
|
4
|
+
// ─── Sleep ───────────────────────────────────────────────────────────────────
|
|
5
|
+
// Data from sleep sessions.
|
|
6
|
+
// Maps 1:1 to Terra's Sleep data model.
|
|
7
|
+
// Uniquely identified by metadata.summary_id.
|
|
8
|
+
export const sleepValidator = {
|
|
9
|
+
// Reference to the connections table
|
|
10
|
+
connectionId: v.id("connections"),
|
|
11
|
+
// Host app user ID (denormalized for querying)
|
|
12
|
+
userId: v.string(),
|
|
13
|
+
// ── data_enrichment ──────────────────────────────────────────────────────
|
|
14
|
+
data_enrichment: v.optional(v.object({
|
|
15
|
+
sleep_contributors: v.optional(v.array(dataContributor)),
|
|
16
|
+
sleep_score: v.optional(v.number()),
|
|
17
|
+
})),
|
|
18
|
+
// ── device_data ──────────────────────────────────────────────────────────
|
|
19
|
+
device_data: v.optional(deviceData),
|
|
20
|
+
// ── heart_rate_data ──────────────────────────────────────────────────────
|
|
21
|
+
heart_rate_data: v.optional(heartRateData),
|
|
22
|
+
// ── metadata ─────────────────────────────────────────────────────────────
|
|
23
|
+
metadata: v.object({
|
|
24
|
+
end_time: v.string(),
|
|
25
|
+
start_time: v.string(),
|
|
26
|
+
is_nap: v.optional(v.boolean()),
|
|
27
|
+
summary_id: v.optional(v.string()),
|
|
28
|
+
timestamp_localization: v.optional(v.number()),
|
|
29
|
+
upload_type: v.number(), // SleepUploadType enum
|
|
30
|
+
}),
|
|
31
|
+
// ── readiness_data ───────────────────────────────────────────────────────
|
|
32
|
+
readiness_data: v.optional(v.object({
|
|
33
|
+
readiness: v.optional(v.number()),
|
|
34
|
+
recovery_level: v.optional(v.number()), // RecoveryLevel enum
|
|
35
|
+
})),
|
|
36
|
+
// ── respiration_data ─────────────────────────────────────────────────────
|
|
37
|
+
respiration_data: v.optional(v.object({
|
|
38
|
+
breaths_data: v.optional(v.object({
|
|
39
|
+
avg_breaths_per_min: v.optional(v.number()),
|
|
40
|
+
end_time: v.optional(v.string()),
|
|
41
|
+
max_breaths_per_min: v.optional(v.number()),
|
|
42
|
+
min_breaths_per_min: v.optional(v.number()),
|
|
43
|
+
on_demand_reading: v.optional(v.boolean()),
|
|
44
|
+
samples: v.optional(v.array(breathSample)),
|
|
45
|
+
start_time: v.optional(v.string()),
|
|
46
|
+
})),
|
|
47
|
+
oxygen_saturation_data: v.optional(v.object({
|
|
48
|
+
avg_saturation_percentage: v.optional(v.number()),
|
|
49
|
+
end_time: v.optional(v.string()),
|
|
50
|
+
samples: v.optional(v.array(oxygenSaturationSample)),
|
|
51
|
+
start_time: v.optional(v.string()),
|
|
52
|
+
})),
|
|
53
|
+
snoring_data: v.optional(v.object({
|
|
54
|
+
end_time: v.optional(v.string()),
|
|
55
|
+
num_snoring_events: v.optional(v.number()),
|
|
56
|
+
samples: v.optional(v.array(snoringSample)),
|
|
57
|
+
start_time: v.optional(v.string()),
|
|
58
|
+
total_snoring_duration_seconds: v.optional(v.number()),
|
|
59
|
+
})),
|
|
60
|
+
})),
|
|
61
|
+
// ── scores ───────────────────────────────────────────────────────────────
|
|
62
|
+
scores: v.optional(v.object({
|
|
63
|
+
sleep: v.optional(v.number()),
|
|
64
|
+
})),
|
|
65
|
+
// ── sleep_durations_data ─────────────────────────────────────────────────
|
|
66
|
+
sleep_durations_data: v.optional(v.object({
|
|
67
|
+
asleep: v.optional(v.object({
|
|
68
|
+
duration_asleep_state_seconds: v.optional(v.number()),
|
|
69
|
+
duration_deep_sleep_state_seconds: v.optional(v.number()),
|
|
70
|
+
duration_light_sleep_state_seconds: v.optional(v.number()),
|
|
71
|
+
duration_REM_sleep_state_seconds: v.optional(v.number()),
|
|
72
|
+
num_REM_events: v.optional(v.number()),
|
|
73
|
+
})),
|
|
74
|
+
awake: v.optional(v.object({
|
|
75
|
+
duration_awake_state_seconds: v.optional(v.number()),
|
|
76
|
+
duration_long_interruption_seconds: v.optional(v.number()),
|
|
77
|
+
duration_short_interruption_seconds: v.optional(v.number()),
|
|
78
|
+
num_out_of_bed_events: v.optional(v.number()),
|
|
79
|
+
num_wakeup_events: v.optional(v.number()),
|
|
80
|
+
sleep_latency_seconds: v.optional(v.number()),
|
|
81
|
+
wake_up_latency_seconds: v.optional(v.number()),
|
|
82
|
+
})),
|
|
83
|
+
hypnogram_samples: v.optional(v.array(sleepHypnogramSample)),
|
|
84
|
+
other: v.optional(v.object({
|
|
85
|
+
duration_in_bed_seconds: v.optional(v.number()),
|
|
86
|
+
duration_unmeasurable_sleep_seconds: v.optional(v.number()),
|
|
87
|
+
})),
|
|
88
|
+
sleep_efficiency: v.optional(v.number()),
|
|
89
|
+
})),
|
|
90
|
+
// ── temperature_data ─────────────────────────────────────────────────────
|
|
91
|
+
temperature_data: v.optional(v.object({
|
|
92
|
+
delta: v.optional(v.number()),
|
|
93
|
+
})),
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=sleep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../src/component/validators/sleep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzE,gFAAgF;AAChF,4BAA4B;AAC5B,wCAAwC;AACxC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,G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EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC1D,mCAAmC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC3D,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC7C,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YACzC,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC7C,uBAAuB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAChD,CAAC,CACH;QACD,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC5D,KAAK,EAAE,CAAC,CAAC,QAAQ,CACf,CAAC,CAAC,MAAM,CAAC;YACP,uBAAuB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC/C,mCAAmC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAC5D,CAAC,CACH;QACD,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KACzC,CAAC,CACH;IAED,4EAA4E;IAC5E,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAC1B,CAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAC9B,CAAC,CACH;CACF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { HKWorkout } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The output shape of {@link transformWorkout}, matching the Soma Activity
|
|
4
|
+
* validator minus `connectionId` and `userId` (added at ingestion time).
|
|
5
|
+
*/
|
|
6
|
+
export type ActivityData = ReturnType<typeof transformWorkout>;
|
|
7
|
+
/**
|
|
8
|
+
* Transform an HKWorkout into a Soma Activity document shape.
|
|
9
|
+
*
|
|
10
|
+
* The returned object is ready to be spread into an `ingestActivity` call
|
|
11
|
+
* alongside `connectionId` and `userId`.
|
|
12
|
+
*
|
|
13
|
+
* @param workout - The HKWorkout from HealthKit
|
|
14
|
+
* @returns Soma Activity fields (without connectionId/userId)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const data = transformWorkout(hkWorkout);
|
|
19
|
+
* await soma.ingestActivity(ctx, { connectionId, userId, ...data });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function transformWorkout(workout: HKWorkout): {
|
|
23
|
+
metadata: {
|
|
24
|
+
summary_id: string;
|
|
25
|
+
start_time: string;
|
|
26
|
+
end_time: string;
|
|
27
|
+
type: number;
|
|
28
|
+
upload_type: 1;
|
|
29
|
+
name: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
active_durations_data: {
|
|
32
|
+
activity_seconds: number;
|
|
33
|
+
};
|
|
34
|
+
calories_data: {
|
|
35
|
+
total_burned_calories: number;
|
|
36
|
+
} | undefined;
|
|
37
|
+
device_data: {
|
|
38
|
+
name?: string;
|
|
39
|
+
manufacturer?: string;
|
|
40
|
+
hardware_version?: string;
|
|
41
|
+
software_version?: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
distance_data: {
|
|
44
|
+
summary: {
|
|
45
|
+
distance_meters: number | undefined;
|
|
46
|
+
steps: number | undefined;
|
|
47
|
+
floors_climbed: number | undefined;
|
|
48
|
+
swimming: {
|
|
49
|
+
num_strokes: number;
|
|
50
|
+
} | undefined;
|
|
51
|
+
};
|
|
52
|
+
} | undefined;
|
|
53
|
+
heart_rate_data: {
|
|
54
|
+
detailed: {
|
|
55
|
+
hr_samples: {
|
|
56
|
+
timestamp: string;
|
|
57
|
+
bpm: number;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
summary: {
|
|
61
|
+
avg_hr_bpm: number | undefined;
|
|
62
|
+
max_hr_bpm: number | undefined;
|
|
63
|
+
min_hr_bpm: number | undefined;
|
|
64
|
+
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
position_data: {
|
|
67
|
+
position_samples: {
|
|
68
|
+
timestamp: string;
|
|
69
|
+
coords_lat_lng_deg: number[];
|
|
70
|
+
}[];
|
|
71
|
+
start_pos_lat_lng_deg: number[] | undefined;
|
|
72
|
+
end_pos_lat_lng_deg: number[] | undefined;
|
|
73
|
+
} | undefined;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/healthkit/activity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS;;;;;;;cAW1B,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;mBAuBT,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDnD"}
|