@nativesquare/soma 0.12.0 → 0.13.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.
Files changed (60) hide show
  1. package/dist/client/garmin.d.ts +5 -1
  2. package/dist/client/garmin.d.ts.map +1 -1
  3. package/dist/client/garmin.js +148 -0
  4. package/dist/client/garmin.js.map +1 -1
  5. package/dist/client/index.d.ts +5 -6
  6. package/dist/client/index.d.ts.map +1 -1
  7. package/dist/client/index.js +5 -211
  8. package/dist/client/index.js.map +1 -1
  9. package/dist/client/strava.d.ts +11 -6
  10. package/dist/client/strava.d.ts.map +1 -1
  11. package/dist/client/strava.js +64 -0
  12. package/dist/client/strava.js.map +1 -1
  13. package/dist/client/types.d.ts +93 -20
  14. package/dist/client/types.d.ts.map +1 -1
  15. package/dist/component/_generated/component.d.ts +24 -5
  16. package/dist/component/_generated/component.d.ts.map +1 -1
  17. package/dist/component/garmin/private.d.ts +53 -68
  18. package/dist/component/garmin/private.d.ts.map +1 -1
  19. package/dist/component/garmin/private.js +87 -85
  20. package/dist/component/garmin/private.js.map +1 -1
  21. package/dist/component/garmin/public.d.ts +97 -43
  22. package/dist/component/garmin/public.d.ts.map +1 -1
  23. package/dist/component/garmin/public.js +75 -51
  24. package/dist/component/garmin/public.js.map +1 -1
  25. package/dist/component/garmin/webhooks.d.ts +22 -20
  26. package/dist/component/garmin/webhooks.d.ts.map +1 -1
  27. package/dist/component/garmin/webhooks.js +115 -76
  28. package/dist/component/garmin/webhooks.js.map +1 -1
  29. package/dist/component/public.d.ts +15 -15
  30. package/dist/component/schema.d.ts +25 -25
  31. package/dist/component/strava/public.d.ts +12 -8
  32. package/dist/component/strava/public.d.ts.map +1 -1
  33. package/dist/component/strava/public.js +7 -7
  34. package/dist/component/strava/public.js.map +1 -1
  35. package/dist/component/validators/activity.d.ts +4 -4
  36. package/dist/component/validators/body.d.ts +4 -4
  37. package/dist/component/validators/daily.d.ts +4 -4
  38. package/dist/component/validators/nutrition.d.ts +3 -3
  39. package/dist/component/validators/samples.d.ts +4 -4
  40. package/dist/component/validators/shared.d.ts +13 -4
  41. package/dist/component/validators/shared.d.ts.map +1 -1
  42. package/dist/component/validators/shared.js +7 -0
  43. package/dist/component/validators/shared.js.map +1 -1
  44. package/dist/component/validators/sleep.d.ts +5 -5
  45. package/dist/validators.d.ts +41 -40
  46. package/dist/validators.d.ts.map +1 -1
  47. package/dist/validators.js +1 -0
  48. package/dist/validators.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/client/garmin.ts +692 -487
  51. package/src/client/index.ts +10 -279
  52. package/src/client/strava.ts +199 -108
  53. package/src/client/types.ts +303 -215
  54. package/src/component/_generated/component.ts +19 -19
  55. package/src/component/garmin/private.ts +1872 -1870
  56. package/src/component/garmin/public.ts +104 -80
  57. package/src/component/garmin/webhooks.ts +122 -81
  58. package/src/component/strava/public.ts +393 -393
  59. package/src/component/validators/shared.ts +9 -0
  60. package/src/validators.ts +1 -0
@@ -205,7 +205,7 @@ export const deleteTokens = internalMutation({
205
205
  /**
206
206
  * Process a Garmin activity push payload.
207
207
  * Parses the full activity data, groups by user, resolves connections,
208
- * transforms, and ingests each activity.
208
+ * and transforms each activity. Does not write to the database.
209
209
  */
210
210
  export const processActivityPushPayload = internalAction({
211
211
  args: { payload: v.any() },
@@ -231,7 +231,7 @@ export const processActivityPushPayload = internalAction({
231
231
  errors.push({
232
232
  type: "activity",
233
233
  id: item.summaryId ?? "unknown",
234
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
234
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
235
235
  });
236
236
  }
237
237
  continue;
@@ -241,7 +241,7 @@ export const processActivityPushPayload = internalAction({
241
241
  errors.push({
242
242
  type: "activity",
243
243
  id: item.summaryId ?? "unknown",
244
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
244
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
245
245
  });
246
246
  }
247
247
  continue;
@@ -255,7 +255,7 @@ export const processActivityPushPayload = internalAction({
255
255
  errors.push({
256
256
  type: "activity",
257
257
  id: item.summaryId ?? "unknown",
258
- error: err instanceof Error ? err.message : String(err),
258
+ message: err instanceof Error ? err.message : String(err),
259
259
  });
260
260
  }
261
261
  }
@@ -273,14 +273,15 @@ export const processActivityPingPayload = internalAction({
273
273
  handler: async (_ctx, args) => {
274
274
  const { activities } = garminActivityPingPayloadSchema.parse(args.payload);
275
275
  console.log(`[garmin:webhook:activities] Ping mode not yet implemented, acknowledging ${activities.length} items`);
276
- return { processed: 0, errors: [], affectedUsers: [] };
276
+ return { errors: [], items: [] };
277
277
  },
278
278
  });
279
279
  // ─── Activity Details Push Processing ─────────────────────────────────────
280
280
  /**
281
281
  * Process a Garmin activity details push payload.
282
282
  * Parses the full activity detail data (summary + samples + laps),
283
- * groups by user, resolves connections, transforms, and ingests each activity.
283
+ * groups by user, resolves connections, and transforms each activity.
284
+ * Does not write to the database.
284
285
  */
285
286
  export const processActivityDetailsPushPayload = internalAction({
286
287
  args: { payload: v.any() },
@@ -306,7 +307,7 @@ export const processActivityDetailsPushPayload = internalAction({
306
307
  errors.push({
307
308
  type: "activityDetails",
308
309
  id: item.summaryId ?? "unknown",
309
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
310
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
310
311
  });
311
312
  }
312
313
  continue;
@@ -316,7 +317,7 @@ export const processActivityDetailsPushPayload = internalAction({
316
317
  errors.push({
317
318
  type: "activityDetails",
318
319
  id: item.summaryId ?? "unknown",
319
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
320
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
320
321
  });
321
322
  }
322
323
  continue;
@@ -330,7 +331,7 @@ export const processActivityDetailsPushPayload = internalAction({
330
331
  errors.push({
331
332
  type: "activityDetails",
332
333
  id: item.summaryId ?? "unknown",
333
- error: err instanceof Error ? err.message : String(err),
334
+ message: err instanceof Error ? err.message : String(err),
334
335
  });
335
336
  }
336
337
  }
@@ -348,14 +349,14 @@ export const processActivityDetailsPingPayload = internalAction({
348
349
  handler: async (_ctx, args) => {
349
350
  const { activityDetails } = garminActivityDetailsPingPayloadSchema.parse(args.payload);
350
351
  console.log(`[garmin:webhook:activityDetails] Ping mode not yet implemented, acknowledging ${activityDetails.length} items`);
351
- return { processed: 0, errors: [], affectedUsers: [] };
352
+ return { errors: [], items: [] };
352
353
  },
353
354
  });
354
355
  // ─── Manually Updated Activities Push Processing ────────────────────────────
355
356
  /**
356
357
  * Process a Garmin manually updated activities push payload.
357
358
  * Parses the full activity data, groups by user, resolves connections,
358
- * transforms, and ingests each activity.
359
+ * and transforms each activity. Does not write to the database.
359
360
  */
360
361
  export const processManuallyUpdatedActivitiesPushPayload = internalAction({
361
362
  args: { payload: v.any() },
@@ -381,7 +382,7 @@ export const processManuallyUpdatedActivitiesPushPayload = internalAction({
381
382
  errors.push({
382
383
  type: "manuallyUpdatedActivities",
383
384
  id: item.summaryId ?? "unknown",
384
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
385
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
385
386
  });
386
387
  }
387
388
  continue;
@@ -391,7 +392,7 @@ export const processManuallyUpdatedActivitiesPushPayload = internalAction({
391
392
  errors.push({
392
393
  type: "manuallyUpdatedActivities",
393
394
  id: item.summaryId ?? "unknown",
394
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
395
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
395
396
  });
396
397
  }
397
398
  continue;
@@ -405,7 +406,7 @@ export const processManuallyUpdatedActivitiesPushPayload = internalAction({
405
406
  errors.push({
406
407
  type: "manuallyUpdatedActivities",
407
408
  id: item.summaryId ?? "unknown",
408
- error: err instanceof Error ? err.message : String(err),
409
+ message: err instanceof Error ? err.message : String(err),
409
410
  });
410
411
  }
411
412
  }
@@ -423,14 +424,15 @@ export const processManuallyUpdatedActivitiesPingPayload = internalAction({
423
424
  handler: async (_ctx, args) => {
424
425
  const { manuallyUpdatedActivities } = garminManuallyUpdatedActivitiesPingPayloadSchema.parse(args.payload);
425
426
  console.log(`[garmin:webhook:manuallyUpdatedActivities] Ping mode not yet implemented, acknowledging ${manuallyUpdatedActivities.length} items`);
426
- return { processed: 0, errors: [], affectedUsers: [] };
427
+ return { errors: [], items: [] };
427
428
  },
428
429
  });
429
430
  // ─── Move IQ Push Processing ──────────────────────────────────────────────
430
431
  /**
431
432
  * Process a Garmin Move IQ push payload.
432
433
  * Parses the auto-detected activity events, groups by user, resolves
433
- * connections, transforms, and ingests each event as an activity.
434
+ * connections, and transforms each event as an activity.
435
+ * Does not write to the database.
434
436
  */
435
437
  export const processMoveIQPushPayload = internalAction({
436
438
  args: { payload: v.any() },
@@ -456,7 +458,7 @@ export const processMoveIQPushPayload = internalAction({
456
458
  errors.push({
457
459
  type: "moveIQ",
458
460
  id: item.summaryId ?? "unknown",
459
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
461
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
460
462
  });
461
463
  }
462
464
  continue;
@@ -466,7 +468,7 @@ export const processMoveIQPushPayload = internalAction({
466
468
  errors.push({
467
469
  type: "moveIQ",
468
470
  id: item.summaryId ?? "unknown",
469
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
471
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
470
472
  });
471
473
  }
472
474
  continue;
@@ -480,7 +482,7 @@ export const processMoveIQPushPayload = internalAction({
480
482
  errors.push({
481
483
  type: "moveIQ",
482
484
  id: item.summaryId ?? "unknown",
483
- error: err instanceof Error ? err.message : String(err),
485
+ message: err instanceof Error ? err.message : String(err),
484
486
  });
485
487
  }
486
488
  }
@@ -498,14 +500,14 @@ export const processMoveIQPingPayload = internalAction({
498
500
  handler: async (_ctx, args) => {
499
501
  const { moveIQActivities } = garminMoveIQPingPayloadSchema.parse(args.payload);
500
502
  console.log(`[garmin:webhook:moveIQ] Ping mode not yet implemented, acknowledging ${moveIQActivities.length} items`);
501
- return { processed: 0, errors: [], affectedUsers: [] };
503
+ return { errors: [], items: [] };
502
504
  },
503
505
  });
504
506
  // ─── Blood Pressure Push Processing ─────────────────────────────────────────
505
507
  /**
506
508
  * Process a Garmin blood pressure push payload.
507
509
  * Parses the full blood pressure data, groups by user, resolves connections,
508
- * transforms, and ingests each record into the body table.
510
+ * and transforms each record. Does not write to the database.
509
511
  */
510
512
  export const processBloodPressurePushPayload = internalAction({
511
513
  args: { payload: v.any() },
@@ -531,7 +533,7 @@ export const processBloodPressurePushPayload = internalAction({
531
533
  errors.push({
532
534
  type: "bloodPressure",
533
535
  id: item.summaryId ?? "unknown",
534
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
536
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
535
537
  });
536
538
  }
537
539
  continue;
@@ -541,7 +543,7 @@ export const processBloodPressurePushPayload = internalAction({
541
543
  errors.push({
542
544
  type: "bloodPressure",
543
545
  id: item.summaryId ?? "unknown",
544
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
546
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
545
547
  });
546
548
  }
547
549
  continue;
@@ -557,7 +559,7 @@ export const processBloodPressurePushPayload = internalAction({
557
559
  errors.push({
558
560
  type: "bloodPressure",
559
561
  id: item.summaryId ?? "unknown",
560
- error: err instanceof Error ? err.message : String(err),
562
+ message: err instanceof Error ? err.message : String(err),
561
563
  });
562
564
  }
563
565
  }
@@ -575,14 +577,14 @@ export const processBloodPressurePingPayload = internalAction({
575
577
  handler: async (_ctx, args) => {
576
578
  const { bloodPressures } = garminBloodPressurePingPayloadSchema.parse(args.payload);
577
579
  console.log(`[garmin:webhook:bloodPressures] Ping mode not yet implemented, acknowledging ${bloodPressures.length} items`);
578
- return { processed: 0, errors: [], affectedUsers: [] };
580
+ return { errors: [], items: [] };
579
581
  },
580
582
  });
581
583
  // ─── Body Compositions Push Processing ─────────────────────────────────────
582
584
  /**
583
585
  * Process a Garmin body compositions push payload.
584
586
  * Parses the full body composition data, groups by user, resolves connections,
585
- * transforms, and ingests each record into the body table.
587
+ * and transforms each record. Does not write to the database.
586
588
  */
587
589
  export const processBodyCompositionsPushPayload = internalAction({
588
590
  args: { payload: v.any() },
@@ -608,7 +610,7 @@ export const processBodyCompositionsPushPayload = internalAction({
608
610
  errors.push({
609
611
  type: "bodyCompositions",
610
612
  id: item.summaryId ?? "unknown",
611
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
613
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
612
614
  });
613
615
  }
614
616
  continue;
@@ -618,7 +620,7 @@ export const processBodyCompositionsPushPayload = internalAction({
618
620
  errors.push({
619
621
  type: "bodyCompositions",
620
622
  id: item.summaryId ?? "unknown",
621
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
623
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
622
624
  });
623
625
  }
624
626
  continue;
@@ -634,7 +636,7 @@ export const processBodyCompositionsPushPayload = internalAction({
634
636
  errors.push({
635
637
  type: "bodyCompositions",
636
638
  id: item.summaryId ?? "unknown",
637
- error: err instanceof Error ? err.message : String(err),
639
+ message: err instanceof Error ? err.message : String(err),
638
640
  });
639
641
  }
640
642
  }
@@ -652,14 +654,14 @@ export const processBodyCompositionsPingPayload = internalAction({
652
654
  handler: async (_ctx, args) => {
653
655
  const { bodyComps } = garminBodyCompositionsPingPayloadSchema.parse(args.payload);
654
656
  console.log(`[garmin:webhook:bodyCompositions] Ping mode not yet implemented, acknowledging ${bodyComps.length} items`);
655
- return { processed: 0, errors: [], affectedUsers: [] };
657
+ return { errors: [], items: [] };
656
658
  },
657
659
  });
658
660
  // ─── Dailies Push Processing ──────────────────────────────────────────────
659
661
  /**
660
662
  * Process a Garmin dailies push payload.
661
663
  * Parses the full daily summary data, groups by user, resolves connections,
662
- * transforms, and ingests each record into the daily table.
664
+ * and transforms each record. Does not write to the database.
663
665
  */
664
666
  export const processDailiesPushPayload = internalAction({
665
667
  args: { payload: v.any() },
@@ -685,7 +687,7 @@ export const processDailiesPushPayload = internalAction({
685
687
  errors.push({
686
688
  type: "dailies",
687
689
  id: item.summaryId ?? "unknown",
688
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
690
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
689
691
  });
690
692
  }
691
693
  continue;
@@ -695,7 +697,7 @@ export const processDailiesPushPayload = internalAction({
695
697
  errors.push({
696
698
  type: "dailies",
697
699
  id: item.summaryId ?? "unknown",
698
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
700
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
699
701
  });
700
702
  }
701
703
  continue;
@@ -711,7 +713,7 @@ export const processDailiesPushPayload = internalAction({
711
713
  errors.push({
712
714
  type: "dailies",
713
715
  id: item.summaryId ?? "unknown",
714
- error: err instanceof Error ? err.message : String(err),
716
+ message: err instanceof Error ? err.message : String(err),
715
717
  });
716
718
  }
717
719
  }
@@ -729,14 +731,14 @@ export const processDailiesPingPayload = internalAction({
729
731
  handler: async (_ctx, args) => {
730
732
  const { dailies } = garminDailiesPingPayloadSchema.parse(args.payload);
731
733
  console.log(`[garmin:webhook:dailies] Ping mode not yet implemented, acknowledging ${dailies.length} items`);
732
- return { processed: 0, errors: [], affectedUsers: [] };
734
+ return { errors: [], items: [] };
733
735
  },
734
736
  });
735
737
  // ─── Health Snapshot Push Processing ────────────────────────────────────────
736
738
  /**
737
739
  * Process a Garmin health snapshot push payload.
738
740
  * Parses the full health snapshot data, groups by user, resolves connections,
739
- * transforms, and ingests each record into the daily table.
741
+ * and transforms each record. Does not write to the database.
740
742
  */
741
743
  export const processHealthSnapshotPushPayload = internalAction({
742
744
  args: { payload: v.any() },
@@ -762,7 +764,7 @@ export const processHealthSnapshotPushPayload = internalAction({
762
764
  errors.push({
763
765
  type: "healthSnapshot",
764
766
  id: item.summaryId ?? "unknown",
765
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
767
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
766
768
  });
767
769
  }
768
770
  continue;
@@ -772,7 +774,7 @@ export const processHealthSnapshotPushPayload = internalAction({
772
774
  errors.push({
773
775
  type: "healthSnapshot",
774
776
  id: item.summaryId ?? "unknown",
775
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
777
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
776
778
  });
777
779
  }
778
780
  continue;
@@ -788,7 +790,7 @@ export const processHealthSnapshotPushPayload = internalAction({
788
790
  errors.push({
789
791
  type: "healthSnapshot",
790
792
  id: item.summaryId ?? "unknown",
791
- error: err instanceof Error ? err.message : String(err),
793
+ message: err instanceof Error ? err.message : String(err),
792
794
  });
793
795
  }
794
796
  }
@@ -806,14 +808,14 @@ export const processHealthSnapshotPingPayload = internalAction({
806
808
  handler: async (_ctx, args) => {
807
809
  const { healthSnapshot } = garminHealthSnapshotPingPayloadSchema.parse(args.payload);
808
810
  console.log(`[garmin:webhook:healthSnapshot] Ping mode not yet implemented, acknowledging ${healthSnapshot.length} items`);
809
- return { processed: 0, errors: [], affectedUsers: [] };
811
+ return { errors: [], items: [] };
810
812
  },
811
813
  });
812
814
  // ─── HRV Summary Push Processing ────────────────────────────────────────────
813
815
  /**
814
816
  * Process a Garmin HRV summary push payload.
815
817
  * Parses the full HRV summary data, groups by user, resolves connections,
816
- * transforms, and ingests each record into the daily table.
818
+ * and transforms each record. Does not write to the database.
817
819
  */
818
820
  export const processHRVSummaryPushPayload = internalAction({
819
821
  args: { payload: v.any() },
@@ -839,7 +841,7 @@ export const processHRVSummaryPushPayload = internalAction({
839
841
  errors.push({
840
842
  type: "hrvSummary",
841
843
  id: item.summaryId ?? "unknown",
842
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
844
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
843
845
  });
844
846
  }
845
847
  continue;
@@ -849,7 +851,7 @@ export const processHRVSummaryPushPayload = internalAction({
849
851
  errors.push({
850
852
  type: "hrvSummary",
851
853
  id: item.summaryId ?? "unknown",
852
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
854
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
853
855
  });
854
856
  }
855
857
  continue;
@@ -865,7 +867,7 @@ export const processHRVSummaryPushPayload = internalAction({
865
867
  errors.push({
866
868
  type: "hrvSummary",
867
869
  id: item.summaryId ?? "unknown",
868
- error: err instanceof Error ? err.message : String(err),
870
+ message: err instanceof Error ? err.message : String(err),
869
871
  });
870
872
  }
871
873
  }
@@ -883,14 +885,14 @@ export const processHRVSummaryPingPayload = internalAction({
883
885
  handler: async (_ctx, args) => {
884
886
  const { hrv } = garminHRVSummaryPingPayloadSchema.parse(args.payload);
885
887
  console.log(`[garmin:webhook:hrvSummary] Ping mode not yet implemented, acknowledging ${hrv.length} items`);
886
- return { processed: 0, errors: [], affectedUsers: [] };
888
+ return { errors: [], items: [] };
887
889
  },
888
890
  });
889
891
  // ─── Epoch Push Processing ──────────────────────────────────────────────────
890
892
  /**
891
893
  * Process a Garmin epoch push payload.
892
894
  * Parses the full epoch summary data (15-min wellness slices), groups by user,
893
- * resolves connections, transforms, and ingests each record into the daily table.
895
+ * resolves connections, and transforms each record. Does not write to the database.
894
896
  */
895
897
  export const processEpochPushPayload = internalAction({
896
898
  args: { payload: v.any() },
@@ -916,7 +918,7 @@ export const processEpochPushPayload = internalAction({
916
918
  errors.push({
917
919
  type: "epochs",
918
920
  id: item.summaryId ?? "unknown",
919
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
921
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
920
922
  });
921
923
  }
922
924
  continue;
@@ -926,7 +928,7 @@ export const processEpochPushPayload = internalAction({
926
928
  errors.push({
927
929
  type: "epochs",
928
930
  id: item.summaryId ?? "unknown",
929
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
931
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
930
932
  });
931
933
  }
932
934
  continue;
@@ -942,7 +944,7 @@ export const processEpochPushPayload = internalAction({
942
944
  errors.push({
943
945
  type: "epochs",
944
946
  id: item.summaryId ?? "unknown",
945
- error: err instanceof Error ? err.message : String(err),
947
+ message: err instanceof Error ? err.message : String(err),
946
948
  });
947
949
  }
948
950
  }
@@ -960,14 +962,14 @@ export const processEpochPingPayload = internalAction({
960
962
  handler: async (_ctx, args) => {
961
963
  const { epochs } = garminEpochPingPayloadSchema.parse(args.payload);
962
964
  console.log(`[garmin:webhook:epochs] Ping mode not yet implemented, acknowledging ${epochs.length} items`);
963
- return { processed: 0, errors: [], affectedUsers: [] };
965
+ return { errors: [], items: [] };
964
966
  },
965
967
  });
966
968
  // ─── Pulse Ox Push Processing ──────────────────────────────────────────────
967
969
  /**
968
970
  * Process a Garmin Pulse Ox push payload.
969
971
  * Parses the full SpO2 data, groups by user, resolves connections,
970
- * transforms, and ingests each record into the daily table.
972
+ * and transforms each record. Does not write to the database.
971
973
  */
972
974
  export const processPulseOxPushPayload = internalAction({
973
975
  args: { payload: v.any() },
@@ -993,7 +995,7 @@ export const processPulseOxPushPayload = internalAction({
993
995
  errors.push({
994
996
  type: "pulseOx",
995
997
  id: item.summaryId ?? "unknown",
996
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
998
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
997
999
  });
998
1000
  }
999
1001
  continue;
@@ -1003,7 +1005,7 @@ export const processPulseOxPushPayload = internalAction({
1003
1005
  errors.push({
1004
1006
  type: "pulseOx",
1005
1007
  id: item.summaryId ?? "unknown",
1006
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1008
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1007
1009
  });
1008
1010
  }
1009
1011
  continue;
@@ -1019,7 +1021,7 @@ export const processPulseOxPushPayload = internalAction({
1019
1021
  errors.push({
1020
1022
  type: "pulseOx",
1021
1023
  id: item.summaryId ?? "unknown",
1022
- error: err instanceof Error ? err.message : String(err),
1024
+ message: err instanceof Error ? err.message : String(err),
1023
1025
  });
1024
1026
  }
1025
1027
  }
@@ -1037,14 +1039,14 @@ export const processPulseOxPingPayload = internalAction({
1037
1039
  handler: async (_ctx, args) => {
1038
1040
  const { pulseox } = garminPulseOxPingPayloadSchema.parse(args.payload);
1039
1041
  console.log(`[garmin:webhook:pulseOx] Ping mode not yet implemented, acknowledging ${pulseox.length} items`);
1040
- return { processed: 0, errors: [], affectedUsers: [] };
1042
+ return { errors: [], items: [] };
1041
1043
  },
1042
1044
  });
1043
1045
  // ─── Respiration Push Processing ──────────────────────────────────────────
1044
1046
  /**
1045
1047
  * Process a Garmin Respiration push payload.
1046
1048
  * Parses the full breathing rate data, groups by user, resolves connections,
1047
- * transforms, and ingests each record into the daily table.
1049
+ * and transforms each record. Does not write to the database.
1048
1050
  */
1049
1051
  export const processRespirationPushPayload = internalAction({
1050
1052
  args: { payload: v.any() },
@@ -1070,7 +1072,7 @@ export const processRespirationPushPayload = internalAction({
1070
1072
  errors.push({
1071
1073
  type: "respiration",
1072
1074
  id: item.summaryId ?? "unknown",
1073
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1075
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1074
1076
  });
1075
1077
  }
1076
1078
  continue;
@@ -1080,7 +1082,7 @@ export const processRespirationPushPayload = internalAction({
1080
1082
  errors.push({
1081
1083
  type: "respiration",
1082
1084
  id: item.summaryId ?? "unknown",
1083
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1085
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1084
1086
  });
1085
1087
  }
1086
1088
  continue;
@@ -1096,7 +1098,7 @@ export const processRespirationPushPayload = internalAction({
1096
1098
  errors.push({
1097
1099
  type: "respiration",
1098
1100
  id: item.summaryId ?? "unknown",
1099
- error: err instanceof Error ? err.message : String(err),
1101
+ message: err instanceof Error ? err.message : String(err),
1100
1102
  });
1101
1103
  }
1102
1104
  }
@@ -1114,14 +1116,14 @@ export const processRespirationPingPayload = internalAction({
1114
1116
  handler: async (_ctx, args) => {
1115
1117
  const { allDayRespiration } = garminRespirationPingPayloadSchema.parse(args.payload);
1116
1118
  console.log(`[garmin:webhook:respiration] Ping mode not yet implemented, acknowledging ${allDayRespiration.length} items`);
1117
- return { processed: 0, errors: [], affectedUsers: [] };
1119
+ return { errors: [], items: [] };
1118
1120
  },
1119
1121
  });
1120
1122
  // ─── Stress Details Push Processing ──────────────────────────────────────────
1121
1123
  /**
1122
1124
  * Process a Garmin stress details push payload.
1123
1125
  * Parses the full stress data, groups by user, resolves connections,
1124
- * transforms, and ingests each record into the daily table.
1126
+ * and transforms each record. Does not write to the database.
1125
1127
  */
1126
1128
  export const processStressPushPayload = internalAction({
1127
1129
  args: { payload: v.any() },
@@ -1147,7 +1149,7 @@ export const processStressPushPayload = internalAction({
1147
1149
  errors.push({
1148
1150
  type: "stressDetails",
1149
1151
  id: item.summaryId ?? "unknown",
1150
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1152
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1151
1153
  });
1152
1154
  }
1153
1155
  continue;
@@ -1157,7 +1159,7 @@ export const processStressPushPayload = internalAction({
1157
1159
  errors.push({
1158
1160
  type: "stressDetails",
1159
1161
  id: item.summaryId ?? "unknown",
1160
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1162
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1161
1163
  });
1162
1164
  }
1163
1165
  continue;
@@ -1173,7 +1175,7 @@ export const processStressPushPayload = internalAction({
1173
1175
  errors.push({
1174
1176
  type: "stressDetails",
1175
1177
  id: item.summaryId ?? "unknown",
1176
- error: err instanceof Error ? err.message : String(err),
1178
+ message: err instanceof Error ? err.message : String(err),
1177
1179
  });
1178
1180
  }
1179
1181
  }
@@ -1191,14 +1193,14 @@ export const processStressPingPayload = internalAction({
1191
1193
  handler: async (_ctx, args) => {
1192
1194
  const { stressDetails } = garminStressPingPayloadSchema.parse(args.payload);
1193
1195
  console.log(`[garmin:webhook:stressDetails] Ping mode not yet implemented, acknowledging ${stressDetails.length} items`);
1194
- return { processed: 0, errors: [], affectedUsers: [] };
1196
+ return { errors: [], items: [] };
1195
1197
  },
1196
1198
  });
1197
1199
  // ─── Skin Temperature Push Processing ───────────────────────────────────────
1198
1200
  /**
1199
1201
  * Process a Garmin skin temperature push payload.
1200
1202
  * Parses the full skin temperature data, groups by user, resolves connections,
1201
- * transforms, and ingests each record into the body table.
1203
+ * and transforms each record. Does not write to the database.
1202
1204
  */
1203
1205
  export const processSkinTemperaturePushPayload = internalAction({
1204
1206
  args: { payload: v.any() },
@@ -1224,7 +1226,7 @@ export const processSkinTemperaturePushPayload = internalAction({
1224
1226
  errors.push({
1225
1227
  type: "skinTemperature",
1226
1228
  id: item.summaryId ?? "unknown",
1227
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1229
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1228
1230
  });
1229
1231
  }
1230
1232
  continue;
@@ -1234,7 +1236,7 @@ export const processSkinTemperaturePushPayload = internalAction({
1234
1236
  errors.push({
1235
1237
  type: "skinTemperature",
1236
1238
  id: item.summaryId ?? "unknown",
1237
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1239
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1238
1240
  });
1239
1241
  }
1240
1242
  continue;
@@ -1250,7 +1252,7 @@ export const processSkinTemperaturePushPayload = internalAction({
1250
1252
  errors.push({
1251
1253
  type: "skinTemperature",
1252
1254
  id: item.summaryId ?? "unknown",
1253
- error: err instanceof Error ? err.message : String(err),
1255
+ message: err instanceof Error ? err.message : String(err),
1254
1256
  });
1255
1257
  }
1256
1258
  }
@@ -1268,14 +1270,14 @@ export const processSkinTemperaturePingPayload = internalAction({
1268
1270
  handler: async (_ctx, args) => {
1269
1271
  const { skinTemp } = garminSkinTemperaturePingPayloadSchema.parse(args.payload);
1270
1272
  console.log(`[garmin:webhook:skinTemperature] Ping mode not yet implemented, acknowledging ${skinTemp.length} items`);
1271
- return { processed: 0, errors: [], affectedUsers: [] };
1273
+ return { errors: [], items: [] };
1272
1274
  },
1273
1275
  });
1274
1276
  // ─── Sleeps Push Processing ─────────────────────────────────────────────────
1275
1277
  /**
1276
1278
  * Process a Garmin sleep summary push payload.
1277
1279
  * Parses the full sleep data, groups by user, resolves connections,
1278
- * transforms, and ingests each sleep record.
1280
+ * and transforms each sleep record. Does not write to the database.
1279
1281
  */
1280
1282
  export const processSleepsPushPayload = internalAction({
1281
1283
  args: { payload: v.any() },
@@ -1301,7 +1303,7 @@ export const processSleepsPushPayload = internalAction({
1301
1303
  errors.push({
1302
1304
  type: "sleep",
1303
1305
  id: item.summaryId ?? "unknown",
1304
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1306
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1305
1307
  });
1306
1308
  }
1307
1309
  continue;
@@ -1311,7 +1313,7 @@ export const processSleepsPushPayload = internalAction({
1311
1313
  errors.push({
1312
1314
  type: "sleep",
1313
1315
  id: item.summaryId ?? "unknown",
1314
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1316
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1315
1317
  });
1316
1318
  }
1317
1319
  continue;
@@ -1325,7 +1327,7 @@ export const processSleepsPushPayload = internalAction({
1325
1327
  errors.push({
1326
1328
  type: "sleep",
1327
1329
  id: item.summaryId ?? "unknown",
1328
- error: err instanceof Error ? err.message : String(err),
1330
+ message: err instanceof Error ? err.message : String(err),
1329
1331
  });
1330
1332
  }
1331
1333
  }
@@ -1343,14 +1345,14 @@ export const processSleepsPingPayload = internalAction({
1343
1345
  handler: async (_ctx, args) => {
1344
1346
  const { sleeps } = garminSleepsPingPayloadSchema.parse(args.payload);
1345
1347
  console.log(`[garmin:webhook:sleeps] Ping mode not yet implemented, acknowledging ${sleeps.length} items`);
1346
- return { processed: 0, errors: [], affectedUsers: [] };
1348
+ return { errors: [], items: [] };
1347
1349
  },
1348
1350
  });
1349
1351
  // ─── User Metrics Push Processing ──────────────────────────────────────────
1350
1352
  /**
1351
1353
  * Process a Garmin user metrics push payload.
1352
1354
  * Parses the full user metrics data, groups by user, resolves connections,
1353
- * transforms, and ingests each user metrics record.
1355
+ * and transforms each user metrics record. Does not write to the database.
1354
1356
  */
1355
1357
  export const processUserMetricsPushPayload = internalAction({
1356
1358
  args: { payload: v.any() },
@@ -1376,7 +1378,7 @@ export const processUserMetricsPushPayload = internalAction({
1376
1378
  errors.push({
1377
1379
  type: "userMetrics",
1378
1380
  id: item.summaryId ?? "unknown",
1379
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1381
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1380
1382
  });
1381
1383
  }
1382
1384
  continue;
@@ -1386,7 +1388,7 @@ export const processUserMetricsPushPayload = internalAction({
1386
1388
  errors.push({
1387
1389
  type: "userMetrics",
1388
1390
  id: item.summaryId ?? "unknown",
1389
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1391
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1390
1392
  });
1391
1393
  }
1392
1394
  continue;
@@ -1402,7 +1404,7 @@ export const processUserMetricsPushPayload = internalAction({
1402
1404
  errors.push({
1403
1405
  type: "userMetrics",
1404
1406
  id: item.summaryId ?? "unknown",
1405
- error: err instanceof Error ? err.message : String(err),
1407
+ message: err instanceof Error ? err.message : String(err),
1406
1408
  });
1407
1409
  }
1408
1410
  }
@@ -1420,14 +1422,14 @@ export const processUserMetricsPingPayload = internalAction({
1420
1422
  handler: async (_ctx, args) => {
1421
1423
  const { userMetrics } = garminUserMetricsPingPayloadSchema.parse(args.payload);
1422
1424
  console.log(`[garmin:webhook:userMetrics] Ping mode not yet implemented, acknowledging ${userMetrics.length} items`);
1423
- return { processed: 0, errors: [], affectedUsers: [] };
1425
+ return { errors: [], items: [] };
1424
1426
  },
1425
1427
  });
1426
1428
  // ─── Menstrual Cycle Tracking Push Processing ───────────────────────────────
1427
1429
  /**
1428
1430
  * Process a Garmin MCT (Women's Health API) push payload.
1429
1431
  * Parses full MCT summary data, groups by user, resolves connections,
1430
- * transforms, and ingests each record into the menstruation table.
1432
+ * and transforms each record. Does not write to the database.
1431
1433
  */
1432
1434
  export const processMenstrualCycleTrackingPushPayload = internalAction({
1433
1435
  args: { payload: v.any() },
@@ -1453,7 +1455,7 @@ export const processMenstrualCycleTrackingPushPayload = internalAction({
1453
1455
  errors.push({
1454
1456
  type: "menstrualCycleTracking",
1455
1457
  id: item.summaryId ?? "unknown",
1456
- error: `No Soma connection found for Garmin userId "${garminUserId}"`,
1458
+ message: `No Soma connection found for Garmin userId "${garminUserId}"`,
1457
1459
  });
1458
1460
  }
1459
1461
  continue;
@@ -1463,7 +1465,7 @@ export const processMenstrualCycleTrackingPushPayload = internalAction({
1463
1465
  errors.push({
1464
1466
  type: "menstrualCycleTracking",
1465
1467
  id: item.summaryId ?? "unknown",
1466
- error: `Garmin connection for userId "${garminUserId}" is inactive`,
1468
+ message: `Garmin connection for userId "${garminUserId}" is inactive`,
1467
1469
  });
1468
1470
  }
1469
1471
  continue;
@@ -1477,7 +1479,7 @@ export const processMenstrualCycleTrackingPushPayload = internalAction({
1477
1479
  errors.push({
1478
1480
  type: "menstrualCycleTracking",
1479
1481
  id: item.summaryId ?? "unknown",
1480
- error: err instanceof Error ? err.message : String(err),
1482
+ message: err instanceof Error ? err.message : String(err),
1481
1483
  });
1482
1484
  }
1483
1485
  }
@@ -1495,7 +1497,7 @@ export const processMenstrualCycleTrackingPingPayload = internalAction({
1495
1497
  handler: async (_ctx, args) => {
1496
1498
  const { mct } = garminMenstrualCycleTrackingPingPayloadSchema.parse(args.payload);
1497
1499
  console.log(`[garmin:webhook:menstrualCycleTracking] Ping mode not yet implemented, acknowledging ${mct.length} items`);
1498
- return { processed: 0, errors: [], affectedUsers: [] };
1500
+ return { errors: [], items: [] };
1499
1501
  },
1500
1502
  });
1501
1503
  //# sourceMappingURL=private.js.map