@nativesquare/soma 0.16.2 → 0.16.4

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 (37) hide show
  1. package/dist/client/healthkit.d.ts +5 -85
  2. package/dist/client/healthkit.d.ts.map +1 -1
  3. package/dist/client/healthkit.js +14 -506
  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/dist/component/validators/connection.js +1 -1
  28. package/dist/component/validators/connection.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/client/healthkit.ts +44 -625
  31. package/src/component/_generated/api.ts +4 -0
  32. package/src/component/_generated/component.ts +412 -0
  33. package/src/component/healthkit/index.ts +74 -46
  34. package/src/component/healthkit/public.ts +597 -0
  35. package/src/component/healthkit/types.ts +45 -114
  36. package/src/component/healthkit/validators.ts +253 -0
  37. package/src/component/validators/connection.ts +1 -1
@@ -1,19 +1,11 @@
1
- import { transformWorkout } from "../component/healthkit/transform/activity.js";
2
- import { transformSleep } from "../component/healthkit/transform/sleep.js";
3
- import { transformBody } from "../component/healthkit/transform/body.js";
4
- import { transformDaily, transformDailyFromSummary, } from "../component/healthkit/transform/daily.js";
5
- import { transformNutrition } from "../component/healthkit/transform/nutrition.js";
6
- import { transformMenstruation } from "../component/healthkit/transform/menstruation.js";
7
- import { transformAthlete } from "../component/healthkit/transform/athlete.js";
8
- const PROVIDER = "APPLE";
9
1
  /**
10
2
  * Client class for Apple HealthKit integration with Soma.
11
3
  *
12
4
  * Unlike {@link import("./strava.js").SomaStrava | SomaStrava} and
13
5
  * {@link import("./garmin.js").SomaGarmin | SomaGarmin}, HealthKit is an
14
6
  * on-device provider — data is queried locally on iOS, not fetched from a
15
- * cloud API. This class wraps the transform + ingest pipeline so the host
16
- * app gets the same ergonomic interface as cloud providers.
7
+ * cloud API. This class is a thin wrapper over the component's public
8
+ * mutations, which own the transform + ingest pipeline.
17
9
  *
18
10
  * Because HealthKit permissions are managed in iOS Settings, the server
19
11
  * cannot independently verify whether the user has granted or revoked
@@ -62,22 +54,15 @@ export class SomaHealthKit {
62
54
  * Assert that HealthKit is connected for this user.
63
55
  *
64
56
  * Call this once after the React Native HealthKit library confirms
65
- * permissions were granted. Creates the APPLE connection if missing,
57
+ * permissions were granted. Creates the HEALTHKIT connection if missing,
66
58
  * or re-activates it if previously disconnected. Idempotent.
67
59
  *
68
- * Because iOS permission grants happen on-device, the server cannot
69
- * verify them independently — this method records the host app's
70
- * assertion that the user has authorized HealthKit access.
71
- *
72
60
  * @param ctx - Mutation context from the host app
73
61
  * @param args.userId - The host app's user identifier
74
62
  * @returns The connection document ID
75
63
  */
76
64
  async connect(ctx, args) {
77
- return (await ctx.runMutation(this.component.public.connect, {
78
- userId: args.userId,
79
- provider: PROVIDER,
80
- }));
65
+ return await ctx.runMutation(this.component.healthkit.public.connect, args);
81
66
  }
82
67
  /**
83
68
  * Mark the HealthKit connection inactive for this user.
@@ -94,10 +79,7 @@ export class SomaHealthKit {
94
79
  * @param args.userId - The host app's user identifier
95
80
  */
96
81
  async disconnect(ctx, args) {
97
- return await ctx.runMutation(this.component.public.disconnect, {
98
- userId: args.userId,
99
- provider: PROVIDER,
100
- });
82
+ return await ctx.runMutation(this.component.healthkit.public.disconnect, args);
101
83
  }
102
84
  // ─── Per-Type Sync Methods ─────────────────────────────────────────────
103
85
  /**
@@ -105,35 +87,9 @@ export class SomaHealthKit {
105
87
  *
106
88
  * Transforms each `HKWorkout` into the Soma Activity schema and ingests it
107
89
  * with automatic deduplication by `workout.uuid`.
108
- *
109
- * @param ctx - Mutation (or action) context from the host app
110
- * @param args.userId - The host app's user identifier
111
- * @param args.workouts - Array of HKWorkout objects from HealthKit
112
90
  */
113
91
  async syncActivities(ctx, args) {
114
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
115
- const errors = [];
116
- let count = 0;
117
- for (const workout of args.workouts) {
118
- try {
119
- const data = transformWorkout(workout);
120
- await ctx.runMutation(this.component.public.ingestActivity, {
121
- connectionId,
122
- userId: args.userId,
123
- ...data,
124
- });
125
- count++;
126
- }
127
- catch (err) {
128
- errors.push({
129
- type: "activity",
130
- id: workout.uuid,
131
- message: err instanceof Error ? err.message : String(err),
132
- });
133
- }
134
- }
135
- await this.updateLastDataUpdate(ctx, connectionId);
136
- return { data: { activities: count }, errors };
92
+ return (await ctx.runMutation(this.component.healthkit.public.syncActivities, args));
137
93
  }
138
94
  /**
139
95
  * Sync sleep sessions from HealthKit.
@@ -141,36 +97,9 @@ export class SomaHealthKit {
141
97
  * Each inner array represents one sleep session (all `HKCategorySample`
142
98
  * stage records for a single night). Each session is aggregated into a
143
99
  * single Soma Sleep document.
144
- *
145
- * @param ctx - Mutation (or action) context from the host app
146
- * @param args.userId - The host app's user identifier
147
- * @param args.sessions - Array of sessions, each an array of sleep-stage samples
148
100
  */
149
101
  async syncSleep(ctx, args) {
150
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
151
- const errors = [];
152
- let count = 0;
153
- for (const session of args.sessions) {
154
- const sessionId = session[0]?.uuid ?? "unknown";
155
- try {
156
- const data = transformSleep(session);
157
- await ctx.runMutation(this.component.public.ingestSleep, {
158
- connectionId,
159
- userId: args.userId,
160
- ...data,
161
- });
162
- count++;
163
- }
164
- catch (err) {
165
- errors.push({
166
- type: "sleep",
167
- id: sessionId,
168
- message: err instanceof Error ? err.message : String(err),
169
- });
170
- }
171
- }
172
- await this.updateLastDataUpdate(ctx, connectionId);
173
- return { data: { sleep: count }, errors };
102
+ return (await ctx.runMutation(this.component.healthkit.public.syncSleep, args));
174
103
  }
175
104
  /**
176
105
  * Sync body metrics from HealthKit.
@@ -178,206 +107,42 @@ export class SomaHealthKit {
178
107
  * Accepts a mixed array of body-related quantity samples (heart rate, HRV,
179
108
  * blood pressure, SpO2, weight, etc.) for a single time window and produces
180
109
  * one Soma Body document.
181
- *
182
- * @param ctx - Mutation (or action) context from the host app
183
- * @param args.userId - The host app's user identifier
184
- * @param args.samples - Array of HKQuantitySample for the desired time range
185
- * @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
186
110
  */
187
111
  async syncBody(ctx, args) {
188
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
189
- const errors = [];
190
- let count = 0;
191
- try {
192
- const data = transformBody(args.samples, args.timeRange);
193
- await ctx.runMutation(this.component.public.ingestBody, {
194
- connectionId,
195
- userId: args.userId,
196
- ...data,
197
- });
198
- count++;
199
- }
200
- catch (err) {
201
- errors.push({
202
- type: "body",
203
- id: "transform",
204
- message: err instanceof Error ? err.message : String(err),
205
- });
206
- }
207
- await this.updateLastDataUpdate(ctx, connectionId);
208
- return { data: { body: count }, errors };
112
+ return (await ctx.runMutation(this.component.healthkit.public.syncBody, args));
209
113
  }
210
114
  /**
211
115
  * Sync daily activity data from HealthKit quantity samples.
212
- *
213
- * Accepts samples for a single day (steps, distance, energy, exercise time,
214
- * heart rate, etc.) and produces one Soma Daily document.
215
- *
216
- * @param ctx - Mutation (or action) context from the host app
217
- * @param args.userId - The host app's user identifier
218
- * @param args.samples - Array of HKQuantitySample for the desired day
219
- * @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
220
116
  */
221
117
  async syncDaily(ctx, args) {
222
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
223
- const errors = [];
224
- let count = 0;
225
- try {
226
- const data = transformDaily(args.samples, args.timeRange);
227
- await ctx.runMutation(this.component.public.ingestDaily, {
228
- connectionId,
229
- userId: args.userId,
230
- ...data,
231
- });
232
- count++;
233
- }
234
- catch (err) {
235
- errors.push({
236
- type: "daily",
237
- id: "transform",
238
- message: err instanceof Error ? err.message : String(err),
239
- });
240
- }
241
- await this.updateLastDataUpdate(ctx, connectionId);
242
- return { data: { daily: count }, errors };
118
+ return (await ctx.runMutation(this.component.healthkit.public.syncDaily, args));
243
119
  }
244
120
  /**
245
121
  * Sync daily activity data from HealthKit activity ring summaries.
246
- *
247
- * Each `HKActivitySummary` represents one day's activity rings (Move,
248
- * Exercise, Stand). Each summary produces one Soma Daily document.
249
- *
250
- * @param ctx - Mutation (or action) context from the host app
251
- * @param args.userId - The host app's user identifier
252
- * @param args.summaries - Array of HKActivitySummary from HealthKit
253
122
  */
254
123
  async syncDailyFromSummary(ctx, args) {
255
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
256
- const errors = [];
257
- let count = 0;
258
- for (const summary of args.summaries) {
259
- const { year, month, day } = summary.dateComponents;
260
- const summaryId = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
261
- try {
262
- const data = transformDailyFromSummary(summary);
263
- await ctx.runMutation(this.component.public.ingestDaily, {
264
- connectionId,
265
- userId: args.userId,
266
- ...data,
267
- });
268
- count++;
269
- }
270
- catch (err) {
271
- errors.push({
272
- type: "daily",
273
- id: summaryId,
274
- message: err instanceof Error ? err.message : String(err),
275
- });
276
- }
277
- }
278
- await this.updateLastDataUpdate(ctx, connectionId);
279
- return { data: { daily: count }, errors };
124
+ return (await ctx.runMutation(this.component.healthkit.public.syncDailyFromSummary, args));
280
125
  }
281
126
  /**
282
127
  * Sync nutrition data from HealthKit.
283
- *
284
- * Accepts dietary quantity samples for a single time window and produces
285
- * one Soma Nutrition document with macros and micros.
286
- *
287
- * @param ctx - Mutation (or action) context from the host app
288
- * @param args.userId - The host app's user identifier
289
- * @param args.samples - Array of HKQuantitySample with dietary type identifiers
290
- * @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
291
128
  */
292
129
  async syncNutrition(ctx, args) {
293
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
294
- const errors = [];
295
- let count = 0;
296
- try {
297
- const data = transformNutrition(args.samples, args.timeRange);
298
- await ctx.runMutation(this.component.public.ingestNutrition, {
299
- connectionId,
300
- userId: args.userId,
301
- ...data,
302
- });
303
- count++;
304
- }
305
- catch (err) {
306
- errors.push({
307
- type: "nutrition",
308
- id: "transform",
309
- message: err instanceof Error ? err.message : String(err),
310
- });
311
- }
312
- await this.updateLastDataUpdate(ctx, connectionId);
313
- return { data: { nutrition: count }, errors };
130
+ return (await ctx.runMutation(this.component.healthkit.public.syncNutrition, args));
314
131
  }
315
132
  /**
316
133
  * Sync menstruation data from HealthKit.
317
- *
318
- * Accepts menstrual flow category samples for a single time window and
319
- * produces one Soma Menstruation document.
320
- *
321
- * @param ctx - Mutation (or action) context from the host app
322
- * @param args.userId - The host app's user identifier
323
- * @param args.samples - Array of HKCategorySample with menstrual flow values
324
- * @param args.timeRange - Optional explicit time range; auto-detected from samples if omitted
325
134
  */
326
135
  async syncMenstruation(ctx, args) {
327
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
328
- const errors = [];
329
- let count = 0;
330
- try {
331
- const data = transformMenstruation(args.samples, args.timeRange);
332
- await ctx.runMutation(this.component.public.ingestMenstruation, {
333
- connectionId,
334
- userId: args.userId,
335
- ...data,
336
- });
337
- count++;
338
- }
339
- catch (err) {
340
- errors.push({
341
- type: "menstruation",
342
- id: "transform",
343
- message: err instanceof Error ? err.message : String(err),
344
- });
345
- }
346
- await this.updateLastDataUpdate(ctx, connectionId);
347
- return { data: { menstruation: count }, errors };
136
+ return (await ctx.runMutation(this.component.healthkit.public.syncMenstruation, args));
348
137
  }
349
138
  /**
350
139
  * Sync athlete profile from HealthKit.
351
140
  *
352
141
  * HealthKit exposes limited profile data (biological sex, date of birth).
353
142
  * Produces one Soma Athlete document per connection.
354
- *
355
- * @param ctx - Mutation (or action) context from the host app
356
- * @param args.userId - The host app's user identifier
357
- * @param args.characteristics - The HKCharacteristics from HealthKit
358
143
  */
359
144
  async syncAthlete(ctx, args) {
360
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
361
- const errors = [];
362
- let count = 0;
363
- try {
364
- const data = transformAthlete(args.characteristics);
365
- await ctx.runMutation(this.component.public.ingestAthlete, {
366
- connectionId,
367
- userId: args.userId,
368
- ...data,
369
- });
370
- count++;
371
- }
372
- catch (err) {
373
- errors.push({
374
- type: "athlete",
375
- id: "transform",
376
- message: err instanceof Error ? err.message : String(err),
377
- });
378
- }
379
- await this.updateLastDataUpdate(ctx, connectionId);
380
- return { data: { athletes: count }, errors };
145
+ return (await ctx.runMutation(this.component.healthkit.public.syncAthlete, args));
381
146
  }
382
147
  // ─── Orchestrator ────────────────────────────────────────────────────────
383
148
  /**
@@ -386,17 +151,6 @@ export class SomaHealthKit {
386
151
  * Only data types with values provided are synced. Errors from individual
387
152
  * data types are collected — one failing type does not block others.
388
153
  *
389
- * @param ctx - Mutation (or action) context from the host app
390
- * @param args.userId - The host app's user identifier
391
- * @param args.workouts - Optional array of HKWorkout objects
392
- * @param args.sleepSessions - Optional array of sleep sessions (each an array of stage samples)
393
- * @param args.bodySamples - Optional body-related quantity samples
394
- * @param args.dailySamples - Optional daily activity quantity samples
395
- * @param args.dailySummaries - Optional daily activity ring summaries
396
- * @param args.nutritionSamples - Optional dietary quantity samples
397
- * @param args.menstruationSamples - Optional menstrual flow category samples
398
- * @param args.characteristics - Optional user characteristics
399
- *
400
154
  * @example
401
155
  * ```ts
402
156
  * const result = await soma.healthkit.syncAll(ctx, {
@@ -410,253 +164,7 @@ export class SomaHealthKit {
410
164
  * ```
411
165
  */
412
166
  async syncAll(ctx, args) {
413
- const connectionId = await this.requireActiveConnection(ctx, args.userId);
414
- const allErrors = [];
415
- const counts = {};
416
- const run = async (fn, fallbackType) => {
417
- try {
418
- const result = await fn();
419
- Object.assign(counts, result.data);
420
- allErrors.push(...result.errors);
421
- }
422
- catch (err) {
423
- allErrors.push({
424
- type: fallbackType,
425
- id: "sync",
426
- message: err instanceof Error ? err.message : String(err),
427
- });
428
- }
429
- };
430
- if (args.workouts) {
431
- await run(() => this.syncActivitiesInternal(ctx, connectionId, args.userId, args.workouts), "activity");
432
- }
433
- if (args.sleepSessions) {
434
- await run(() => this.syncSleepInternal(ctx, connectionId, args.userId, args.sleepSessions), "sleep");
435
- }
436
- if (args.bodySamples) {
437
- await run(() => this.syncBodyInternal(ctx, connectionId, args.userId, args.bodySamples, args.bodyTimeRange), "body");
438
- }
439
- if (args.dailySamples) {
440
- await run(() => this.syncDailyInternal(ctx, connectionId, args.userId, args.dailySamples, args.dailyTimeRange), "daily");
441
- }
442
- if (args.dailySummaries) {
443
- await run(() => this.syncDailyFromSummaryInternal(ctx, connectionId, args.userId, args.dailySummaries), "daily");
444
- }
445
- if (args.nutritionSamples) {
446
- await run(() => this.syncNutritionInternal(ctx, connectionId, args.userId, args.nutritionSamples, args.nutritionTimeRange), "nutrition");
447
- }
448
- if (args.menstruationSamples) {
449
- await run(() => this.syncMenstruationInternal(ctx, connectionId, args.userId, args.menstruationSamples, args.menstruationTimeRange), "menstruation");
450
- }
451
- if (args.characteristics) {
452
- await run(() => this.syncAthleteInternal(ctx, connectionId, args.userId, args.characteristics), "athlete");
453
- }
454
- // Update lastDataUpdate once at the end
455
- await this.updateLastDataUpdate(ctx, connectionId);
456
- return { data: counts, errors: allErrors };
457
- }
458
- // ─── Private Helpers ───────────��─────────────────────────────────────────
459
- /**
460
- * Load the active APPLE connection for a user, or throw if missing/inactive.
461
- *
462
- * HealthKit permissions are managed on-device, so the connection state is
463
- * an assertion made by the host app via {@link SomaHealthKit.connect} and
464
- * {@link SomaHealthKit.disconnect}. Sync methods refuse to run without an
465
- * active connection — the host app must explicitly reconnect to resume.
466
- */
467
- async requireActiveConnection(ctx, userId) {
468
- const connection = await ctx.runQuery(this.component.public.getConnectionByProvider, { userId, provider: PROVIDER });
469
- if (!connection) {
470
- throw new Error(`No HealthKit connection for user "${userId}". Call soma.healthkit.connect(ctx, { userId }) after the React Native HealthKit library confirms permissions.`);
471
- }
472
- if (connection.active === false) {
473
- throw new Error(`HealthKit connection for user "${userId}" is disconnected. Call soma.healthkit.connect(ctx, { userId }) to re-activate.`);
474
- }
475
- return connection._id;
476
- }
477
- async updateLastDataUpdate(ctx, connectionId) {
478
- await ctx.runMutation(this.component.public.updateConnection, {
479
- connectionId,
480
- lastDataUpdate: new Date().toISOString(),
481
- });
482
- }
483
- // ─── Internal sync methods (skip connection resolution + lastDataUpdate) ─
484
- async syncActivitiesInternal(ctx, connectionId, userId, workouts) {
485
- const errors = [];
486
- let count = 0;
487
- for (const workout of workouts) {
488
- try {
489
- const data = transformWorkout(workout);
490
- await ctx.runMutation(this.component.public.ingestActivity, {
491
- connectionId,
492
- userId,
493
- ...data,
494
- });
495
- count++;
496
- }
497
- catch (err) {
498
- errors.push({
499
- type: "activity",
500
- id: workout.uuid,
501
- message: err instanceof Error ? err.message : String(err),
502
- });
503
- }
504
- }
505
- return { data: { activities: count }, errors };
506
- }
507
- async syncSleepInternal(ctx, connectionId, userId, sessions) {
508
- const errors = [];
509
- let count = 0;
510
- for (const session of sessions) {
511
- const sessionId = session[0]?.uuid ?? "unknown";
512
- try {
513
- const data = transformSleep(session);
514
- await ctx.runMutation(this.component.public.ingestSleep, {
515
- connectionId,
516
- userId,
517
- ...data,
518
- });
519
- count++;
520
- }
521
- catch (err) {
522
- errors.push({
523
- type: "sleep",
524
- id: sessionId,
525
- message: err instanceof Error ? err.message : String(err),
526
- });
527
- }
528
- }
529
- return { data: { sleep: count }, errors };
530
- }
531
- async syncBodyInternal(ctx, connectionId, userId, samples, timeRange) {
532
- const errors = [];
533
- let count = 0;
534
- try {
535
- const data = transformBody(samples, timeRange);
536
- await ctx.runMutation(this.component.public.ingestBody, {
537
- connectionId,
538
- userId,
539
- ...data,
540
- });
541
- count++;
542
- }
543
- catch (err) {
544
- errors.push({
545
- type: "body",
546
- id: "transform",
547
- message: err instanceof Error ? err.message : String(err),
548
- });
549
- }
550
- return { data: { body: count }, errors };
551
- }
552
- async syncDailyInternal(ctx, connectionId, userId, samples, timeRange) {
553
- const errors = [];
554
- let count = 0;
555
- try {
556
- const data = transformDaily(samples, timeRange);
557
- await ctx.runMutation(this.component.public.ingestDaily, {
558
- connectionId,
559
- userId,
560
- ...data,
561
- });
562
- count++;
563
- }
564
- catch (err) {
565
- errors.push({
566
- type: "daily",
567
- id: "transform",
568
- message: err instanceof Error ? err.message : String(err),
569
- });
570
- }
571
- return { data: { daily: count }, errors };
572
- }
573
- async syncDailyFromSummaryInternal(ctx, connectionId, userId, summaries) {
574
- const errors = [];
575
- let count = 0;
576
- for (const summary of summaries) {
577
- const { year, month, day } = summary.dateComponents;
578
- const summaryId = `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
579
- try {
580
- const data = transformDailyFromSummary(summary);
581
- await ctx.runMutation(this.component.public.ingestDaily, {
582
- connectionId,
583
- userId,
584
- ...data,
585
- });
586
- count++;
587
- }
588
- catch (err) {
589
- errors.push({
590
- type: "daily",
591
- id: summaryId,
592
- message: err instanceof Error ? err.message : String(err),
593
- });
594
- }
595
- }
596
- return { data: { daily: count }, errors };
597
- }
598
- async syncNutritionInternal(ctx, connectionId, userId, samples, timeRange) {
599
- const errors = [];
600
- let count = 0;
601
- try {
602
- const data = transformNutrition(samples, timeRange);
603
- await ctx.runMutation(this.component.public.ingestNutrition, {
604
- connectionId,
605
- userId,
606
- ...data,
607
- });
608
- count++;
609
- }
610
- catch (err) {
611
- errors.push({
612
- type: "nutrition",
613
- id: "transform",
614
- message: err instanceof Error ? err.message : String(err),
615
- });
616
- }
617
- return { data: { nutrition: count }, errors };
618
- }
619
- async syncMenstruationInternal(ctx, connectionId, userId, samples, timeRange) {
620
- const errors = [];
621
- let count = 0;
622
- try {
623
- const data = transformMenstruation(samples, timeRange);
624
- await ctx.runMutation(this.component.public.ingestMenstruation, {
625
- connectionId,
626
- userId,
627
- ...data,
628
- });
629
- count++;
630
- }
631
- catch (err) {
632
- errors.push({
633
- type: "menstruation",
634
- id: "transform",
635
- message: err instanceof Error ? err.message : String(err),
636
- });
637
- }
638
- return { data: { menstruation: count }, errors };
639
- }
640
- async syncAthleteInternal(ctx, connectionId, userId, characteristics) {
641
- const errors = [];
642
- let count = 0;
643
- try {
644
- const data = transformAthlete(characteristics);
645
- await ctx.runMutation(this.component.public.ingestAthlete, {
646
- connectionId,
647
- userId,
648
- ...data,
649
- });
650
- count++;
651
- }
652
- catch (err) {
653
- errors.push({
654
- type: "athlete",
655
- id: "transform",
656
- message: err instanceof Error ? err.message : String(err),
657
- });
658
- }
659
- return { data: { athletes: count }, errors };
167
+ return (await ctx.runMutation(this.component.healthkit.public.syncAll, args));
660
168
  }
661
169
  }
662
170
  //# sourceMappingURL=healthkit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"healthkit.js","sourceRoot":"","sources":["../../src/client/healthkit.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EACL,cAAc,EACd,yBAAyB,GAC1B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,O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