@nativesquare/soma 0.16.2 → 0.16.3

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.
Files changed (34) hide show
  1. package/dist/client/healthkit.d.ts +4 -84
  2. package/dist/client/healthkit.d.ts.map +1 -1
  3. package/dist/client/healthkit.js +13 -505
  4. package/dist/client/healthkit.js.map +1 -1
  5. package/dist/component/_generated/api.d.ts +4 -0
  6. package/dist/component/_generated/api.d.ts.map +1 -1
  7. package/dist/component/_generated/api.js.map +1 -1
  8. package/dist/component/_generated/component.d.ts +472 -0
  9. package/dist/component/_generated/component.d.ts.map +1 -1
  10. package/dist/component/healthkit/index.d.ts +1 -0
  11. package/dist/component/healthkit/index.d.ts.map +1 -1
  12. package/dist/component/healthkit/index.js +5 -0
  13. package/dist/component/healthkit/index.js.map +1 -1
  14. package/dist/component/healthkit/public.d.ts +451 -0
  15. package/dist/component/healthkit/public.d.ts.map +1 -0
  16. package/dist/component/healthkit/public.js +386 -0
  17. package/dist/component/healthkit/public.js.map +1 -0
  18. package/dist/component/healthkit/types.d.ts +13 -76
  19. package/dist/component/healthkit/types.d.ts.map +1 -1
  20. package/dist/component/healthkit/types.js +9 -6
  21. package/dist/component/healthkit/types.js.map +1 -1
  22. package/dist/component/healthkit/validators.d.ts +1933 -0
  23. package/dist/component/healthkit/validators.d.ts.map +1 -0
  24. package/dist/component/healthkit/validators.js +199 -0
  25. package/dist/component/healthkit/validators.js.map +1 -0
  26. package/dist/component/strava/types/stravaApi/zod.gen.d.ts +3 -3
  27. package/package.json +1 -1
  28. package/src/client/healthkit.ts +43 -624
  29. package/src/component/_generated/api.ts +4 -0
  30. package/src/component/_generated/component.ts +412 -0
  31. package/src/component/healthkit/index.ts +74 -46
  32. package/src/component/healthkit/public.ts +597 -0
  33. package/src/component/healthkit/types.ts +45 -114
  34. package/src/component/healthkit/validators.ts +253 -0
@@ -0,0 +1,451 @@
1
+ import type { Id } from "../_generated/dataModel.js";
2
+ import type { SomaError } from "../validators/shared.js";
3
+ /**
4
+ * Assert that HealthKit is connected for this user. Creates the APPLE
5
+ * connection if missing or re-activates it if previously disconnected.
6
+ * Idempotent.
7
+ */
8
+ export declare const connect: import("convex/server").RegisteredMutation<"public", {
9
+ userId: string;
10
+ }, Promise<Id<"connections">>>;
11
+ /**
12
+ * Mark the HealthKit connection inactive for this user. Does not delete
13
+ * the connection row or any previously synced data.
14
+ */
15
+ export declare const disconnect: import("convex/server").RegisteredMutation<"public", {
16
+ userId: string;
17
+ }, Promise<null>>;
18
+ export declare const syncActivities: import("convex/server").RegisteredMutation<"public", {
19
+ userId: string;
20
+ workouts: {
21
+ source?: {
22
+ name: string;
23
+ bundleIdentifier: string;
24
+ } | undefined;
25
+ device?: {
26
+ name?: string | undefined;
27
+ manufacturer?: string | undefined;
28
+ model?: string | undefined;
29
+ hardwareVersion?: string | undefined;
30
+ softwareVersion?: string | undefined;
31
+ } | undefined;
32
+ totalEnergyBurned?: number | undefined;
33
+ totalDistance?: number | undefined;
34
+ totalSwimmingStrokeCount?: number | undefined;
35
+ totalFlightsClimbed?: number | undefined;
36
+ heartRateSamples?: {
37
+ source?: {
38
+ name: string;
39
+ bundleIdentifier: string;
40
+ } | undefined;
41
+ device?: {
42
+ name?: string | undefined;
43
+ manufacturer?: string | undefined;
44
+ model?: string | undefined;
45
+ hardwareVersion?: string | undefined;
46
+ softwareVersion?: string | undefined;
47
+ } | undefined;
48
+ unit: string;
49
+ endDate: string;
50
+ startDate: string;
51
+ uuid: string;
52
+ sampleType: string;
53
+ value: number;
54
+ }[] | undefined;
55
+ routeData?: {
56
+ locations: {
57
+ altitude?: number | undefined;
58
+ timestamp: string;
59
+ latitude: number;
60
+ longitude: number;
61
+ }[];
62
+ }[] | undefined;
63
+ endDate: string;
64
+ startDate: string;
65
+ uuid: string;
66
+ workoutActivityType: number;
67
+ duration: number;
68
+ }[];
69
+ }, Promise<{
70
+ data: {
71
+ activities: number;
72
+ };
73
+ errors: SomaError[];
74
+ }>>;
75
+ export declare const syncSleep: import("convex/server").RegisteredMutation<"public", {
76
+ userId: string;
77
+ sessions: {
78
+ source?: {
79
+ name: string;
80
+ bundleIdentifier: string;
81
+ } | undefined;
82
+ device?: {
83
+ name?: string | undefined;
84
+ manufacturer?: string | undefined;
85
+ model?: string | undefined;
86
+ hardwareVersion?: string | undefined;
87
+ softwareVersion?: string | undefined;
88
+ } | undefined;
89
+ endDate: string;
90
+ startDate: string;
91
+ uuid: string;
92
+ sampleType: string;
93
+ value: number;
94
+ }[][];
95
+ }, Promise<{
96
+ data: {
97
+ sleep: number;
98
+ };
99
+ errors: SomaError[];
100
+ }>>;
101
+ export declare const syncBody: import("convex/server").RegisteredMutation<"public", {
102
+ timeRange?: {
103
+ start_time: string;
104
+ end_time: string;
105
+ } | undefined;
106
+ userId: string;
107
+ samples: {
108
+ source?: {
109
+ name: string;
110
+ bundleIdentifier: string;
111
+ } | undefined;
112
+ device?: {
113
+ name?: string | undefined;
114
+ manufacturer?: string | undefined;
115
+ model?: string | undefined;
116
+ hardwareVersion?: string | undefined;
117
+ softwareVersion?: string | undefined;
118
+ } | undefined;
119
+ unit: string;
120
+ endDate: string;
121
+ startDate: string;
122
+ uuid: string;
123
+ sampleType: string;
124
+ value: number;
125
+ }[];
126
+ }, Promise<{
127
+ data: {
128
+ body: number;
129
+ };
130
+ errors: SomaError[];
131
+ }>>;
132
+ export declare const syncDaily: import("convex/server").RegisteredMutation<"public", {
133
+ timeRange?: {
134
+ start_time: string;
135
+ end_time: string;
136
+ } | undefined;
137
+ userId: string;
138
+ samples: {
139
+ source?: {
140
+ name: string;
141
+ bundleIdentifier: string;
142
+ } | undefined;
143
+ device?: {
144
+ name?: string | undefined;
145
+ manufacturer?: string | undefined;
146
+ model?: string | undefined;
147
+ hardwareVersion?: string | undefined;
148
+ softwareVersion?: string | undefined;
149
+ } | undefined;
150
+ unit: string;
151
+ endDate: string;
152
+ startDate: string;
153
+ uuid: string;
154
+ sampleType: string;
155
+ value: number;
156
+ }[];
157
+ }, Promise<{
158
+ data: {
159
+ daily: number;
160
+ };
161
+ errors: SomaError[];
162
+ }>>;
163
+ export declare const syncDailyFromSummary: import("convex/server").RegisteredMutation<"public", {
164
+ userId: string;
165
+ summaries: {
166
+ activeEnergyBurned: number;
167
+ activeEnergyBurnedGoal: number;
168
+ appleExerciseTime: number;
169
+ appleExerciseTimeGoal: number;
170
+ appleStandHours: number;
171
+ appleStandHoursGoal: number;
172
+ dateComponents: {
173
+ year: number;
174
+ month: number;
175
+ day: number;
176
+ };
177
+ }[];
178
+ }, Promise<{
179
+ data: {
180
+ daily: number;
181
+ };
182
+ errors: SomaError[];
183
+ }>>;
184
+ export declare const syncNutrition: import("convex/server").RegisteredMutation<"public", {
185
+ timeRange?: {
186
+ start_time: string;
187
+ end_time: string;
188
+ } | undefined;
189
+ userId: string;
190
+ samples: {
191
+ source?: {
192
+ name: string;
193
+ bundleIdentifier: string;
194
+ } | undefined;
195
+ device?: {
196
+ name?: string | undefined;
197
+ manufacturer?: string | undefined;
198
+ model?: string | undefined;
199
+ hardwareVersion?: string | undefined;
200
+ softwareVersion?: string | undefined;
201
+ } | undefined;
202
+ unit: string;
203
+ endDate: string;
204
+ startDate: string;
205
+ uuid: string;
206
+ sampleType: string;
207
+ value: number;
208
+ }[];
209
+ }, Promise<{
210
+ data: {
211
+ nutrition: number;
212
+ };
213
+ errors: SomaError[];
214
+ }>>;
215
+ export declare const syncMenstruation: import("convex/server").RegisteredMutation<"public", {
216
+ timeRange?: {
217
+ start_time: string;
218
+ end_time: string;
219
+ } | undefined;
220
+ userId: string;
221
+ samples: {
222
+ source?: {
223
+ name: string;
224
+ bundleIdentifier: string;
225
+ } | undefined;
226
+ device?: {
227
+ name?: string | undefined;
228
+ manufacturer?: string | undefined;
229
+ model?: string | undefined;
230
+ hardwareVersion?: string | undefined;
231
+ softwareVersion?: string | undefined;
232
+ } | undefined;
233
+ endDate: string;
234
+ startDate: string;
235
+ uuid: string;
236
+ sampleType: string;
237
+ value: number;
238
+ }[];
239
+ }, Promise<{
240
+ data: {
241
+ menstruation: number;
242
+ };
243
+ errors: SomaError[];
244
+ }>>;
245
+ export declare const syncAthlete: import("convex/server").RegisteredMutation<"public", {
246
+ userId: string;
247
+ characteristics: {
248
+ biologicalSex?: "other" | "female" | "male" | "notSet" | undefined;
249
+ dateOfBirth?: string | undefined;
250
+ bloodType?: string | undefined;
251
+ fitzpatrickSkinType?: number | undefined;
252
+ wheelchairUse?: boolean | undefined;
253
+ };
254
+ }, Promise<{
255
+ data: {
256
+ athletes: number;
257
+ };
258
+ errors: SomaError[];
259
+ }>>;
260
+ /**
261
+ * Sync all provided HealthKit data types in a single transaction.
262
+ *
263
+ * Only types with values provided are synced. Errors from individual data
264
+ * types are collected — one failing type does not block others. The
265
+ * connection is resolved once and `lastDataUpdate` is written once.
266
+ */
267
+ export declare const syncAll: import("convex/server").RegisteredMutation<"public", {
268
+ workouts?: {
269
+ source?: {
270
+ name: string;
271
+ bundleIdentifier: string;
272
+ } | undefined;
273
+ device?: {
274
+ name?: string | undefined;
275
+ manufacturer?: string | undefined;
276
+ model?: string | undefined;
277
+ hardwareVersion?: string | undefined;
278
+ softwareVersion?: string | undefined;
279
+ } | undefined;
280
+ totalEnergyBurned?: number | undefined;
281
+ totalDistance?: number | undefined;
282
+ totalSwimmingStrokeCount?: number | undefined;
283
+ totalFlightsClimbed?: number | undefined;
284
+ heartRateSamples?: {
285
+ source?: {
286
+ name: string;
287
+ bundleIdentifier: string;
288
+ } | undefined;
289
+ device?: {
290
+ name?: string | undefined;
291
+ manufacturer?: string | undefined;
292
+ model?: string | undefined;
293
+ hardwareVersion?: string | undefined;
294
+ softwareVersion?: string | undefined;
295
+ } | undefined;
296
+ unit: string;
297
+ endDate: string;
298
+ startDate: string;
299
+ uuid: string;
300
+ sampleType: string;
301
+ value: number;
302
+ }[] | undefined;
303
+ routeData?: {
304
+ locations: {
305
+ altitude?: number | undefined;
306
+ timestamp: string;
307
+ latitude: number;
308
+ longitude: number;
309
+ }[];
310
+ }[] | undefined;
311
+ endDate: string;
312
+ startDate: string;
313
+ uuid: string;
314
+ workoutActivityType: number;
315
+ duration: number;
316
+ }[] | undefined;
317
+ bodySamples?: {
318
+ source?: {
319
+ name: string;
320
+ bundleIdentifier: string;
321
+ } | undefined;
322
+ device?: {
323
+ name?: string | undefined;
324
+ manufacturer?: string | undefined;
325
+ model?: string | undefined;
326
+ hardwareVersion?: string | undefined;
327
+ softwareVersion?: string | undefined;
328
+ } | undefined;
329
+ unit: string;
330
+ endDate: string;
331
+ startDate: string;
332
+ uuid: string;
333
+ sampleType: string;
334
+ value: number;
335
+ }[] | undefined;
336
+ bodyTimeRange?: {
337
+ start_time: string;
338
+ end_time: string;
339
+ } | undefined;
340
+ characteristics?: {
341
+ biologicalSex?: "other" | "female" | "male" | "notSet" | undefined;
342
+ dateOfBirth?: string | undefined;
343
+ bloodType?: string | undefined;
344
+ fitzpatrickSkinType?: number | undefined;
345
+ wheelchairUse?: boolean | undefined;
346
+ } | undefined;
347
+ dailySamples?: {
348
+ source?: {
349
+ name: string;
350
+ bundleIdentifier: string;
351
+ } | undefined;
352
+ device?: {
353
+ name?: string | undefined;
354
+ manufacturer?: string | undefined;
355
+ model?: string | undefined;
356
+ hardwareVersion?: string | undefined;
357
+ softwareVersion?: string | undefined;
358
+ } | undefined;
359
+ unit: string;
360
+ endDate: string;
361
+ startDate: string;
362
+ uuid: string;
363
+ sampleType: string;
364
+ value: number;
365
+ }[] | undefined;
366
+ dailySummaries?: {
367
+ activeEnergyBurned: number;
368
+ activeEnergyBurnedGoal: number;
369
+ appleExerciseTime: number;
370
+ appleExerciseTimeGoal: number;
371
+ appleStandHours: number;
372
+ appleStandHoursGoal: number;
373
+ dateComponents: {
374
+ year: number;
375
+ month: number;
376
+ day: number;
377
+ };
378
+ }[] | undefined;
379
+ dailyTimeRange?: {
380
+ start_time: string;
381
+ end_time: string;
382
+ } | undefined;
383
+ menstruationSamples?: {
384
+ source?: {
385
+ name: string;
386
+ bundleIdentifier: string;
387
+ } | undefined;
388
+ device?: {
389
+ name?: string | undefined;
390
+ manufacturer?: string | undefined;
391
+ model?: string | undefined;
392
+ hardwareVersion?: string | undefined;
393
+ softwareVersion?: string | undefined;
394
+ } | undefined;
395
+ endDate: string;
396
+ startDate: string;
397
+ uuid: string;
398
+ sampleType: string;
399
+ value: number;
400
+ }[] | undefined;
401
+ menstruationTimeRange?: {
402
+ start_time: string;
403
+ end_time: string;
404
+ } | undefined;
405
+ nutritionSamples?: {
406
+ source?: {
407
+ name: string;
408
+ bundleIdentifier: string;
409
+ } | undefined;
410
+ device?: {
411
+ name?: string | undefined;
412
+ manufacturer?: string | undefined;
413
+ model?: string | undefined;
414
+ hardwareVersion?: string | undefined;
415
+ softwareVersion?: string | undefined;
416
+ } | undefined;
417
+ unit: string;
418
+ endDate: string;
419
+ startDate: string;
420
+ uuid: string;
421
+ sampleType: string;
422
+ value: number;
423
+ }[] | undefined;
424
+ nutritionTimeRange?: {
425
+ start_time: string;
426
+ end_time: string;
427
+ } | undefined;
428
+ sleepSessions?: {
429
+ source?: {
430
+ name: string;
431
+ bundleIdentifier: string;
432
+ } | undefined;
433
+ device?: {
434
+ name?: string | undefined;
435
+ manufacturer?: string | undefined;
436
+ model?: string | undefined;
437
+ hardwareVersion?: string | undefined;
438
+ softwareVersion?: string | undefined;
439
+ } | undefined;
440
+ endDate: string;
441
+ startDate: string;
442
+ uuid: string;
443
+ sampleType: string;
444
+ value: number;
445
+ }[][] | undefined;
446
+ userId: string;
447
+ }, Promise<{
448
+ data: Record<string, number>;
449
+ errors: SomaError[];
450
+ }>>;
451
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/component/healthkit/public.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAmTzD;;;;GAIG;AACH,eAAO,MAAM,OAAO;;8BAWlB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;;iBAYrB,CAAC;AAIH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAczB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;GAcpB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAenB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAepB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;GAc/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAexB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAe3B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;GActB,CAAC;AAIH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGlB,CAAC"}