@nativesquare/soma 0.18.0 → 0.18.1
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/dist/client/garmin.d.ts.map +1 -1
- package/dist/client/garmin.js +11 -2
- package/dist/client/garmin.js.map +1 -1
- package/dist/client/types.d.ts +36 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js +12 -4
- package/dist/client/types.js.map +1 -1
- package/dist/component/_generated/component.d.ts +18 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/garmin/private.d.ts +34 -0
- package/dist/component/garmin/private.d.ts.map +1 -1
- package/dist/component/garmin/private.js +221 -51
- package/dist/component/garmin/private.js.map +1 -1
- package/dist/component/garmin/webhooks.d.ts +18 -0
- package/dist/component/garmin/webhooks.d.ts.map +1 -1
- package/dist/component/garmin/webhooks.js +107 -35
- package/dist/component/garmin/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/client/garmin.ts +15 -2
- package/src/client/types.ts +42 -7
- package/src/component/_generated/component.ts +18 -18
- package/src/component/garmin/private.ts +221 -51
- package/src/component/garmin/webhooks.ts +107 -35
|
@@ -99,7 +99,11 @@ import { transformMenstrualCycleTracking } from "./transform/menstrualCycleTrack
|
|
|
99
99
|
* and transforms each activity. Does not write to the database.
|
|
100
100
|
*/
|
|
101
101
|
export const processActivityPushPayload = internalAction({
|
|
102
|
-
args: {
|
|
102
|
+
args: {
|
|
103
|
+
payload: v.any(),
|
|
104
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
105
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
106
|
+
},
|
|
103
107
|
handler: async (ctx, args) => {
|
|
104
108
|
const { activities } = garminActivityPushPayloadSchema.parse(args.payload);
|
|
105
109
|
|
|
@@ -147,7 +151,9 @@ export const processActivityPushPayload = internalAction({
|
|
|
147
151
|
|
|
148
152
|
for (const item of userItems) {
|
|
149
153
|
try {
|
|
150
|
-
const data =
|
|
154
|
+
const data = args.rawPassthrough
|
|
155
|
+
? (item as Record<string, unknown>)
|
|
156
|
+
: transformActivity(item);
|
|
151
157
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
152
158
|
} catch (err) {
|
|
153
159
|
errors.push({
|
|
@@ -170,7 +176,11 @@ export const processActivityPushPayload = internalAction({
|
|
|
170
176
|
* Stub — acknowledges the notification without fetching data.
|
|
171
177
|
*/
|
|
172
178
|
export const processActivityPingPayload = internalAction({
|
|
173
|
-
args: {
|
|
179
|
+
args: {
|
|
180
|
+
payload: v.any(),
|
|
181
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
182
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
183
|
+
},
|
|
174
184
|
handler: async (_ctx, args) => {
|
|
175
185
|
const { activities } = garminActivityPingPayloadSchema.parse(args.payload);
|
|
176
186
|
console.log(
|
|
@@ -189,7 +199,11 @@ export const processActivityPingPayload = internalAction({
|
|
|
189
199
|
* Does not write to the database.
|
|
190
200
|
*/
|
|
191
201
|
export const processActivityDetailsPushPayload = internalAction({
|
|
192
|
-
args: {
|
|
202
|
+
args: {
|
|
203
|
+
payload: v.any(),
|
|
204
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
205
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
206
|
+
},
|
|
193
207
|
handler: async (ctx, args) => {
|
|
194
208
|
const { activityDetails } =
|
|
195
209
|
garminActivityDetailsPushPayloadSchema.parse(args.payload);
|
|
@@ -238,7 +252,9 @@ export const processActivityDetailsPushPayload = internalAction({
|
|
|
238
252
|
|
|
239
253
|
for (const item of userItems) {
|
|
240
254
|
try {
|
|
241
|
-
const data =
|
|
255
|
+
const data = args.rawPassthrough
|
|
256
|
+
? (item as Record<string, unknown>)
|
|
257
|
+
: transformActivityDetails(item);
|
|
242
258
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
243
259
|
} catch (err) {
|
|
244
260
|
errors.push({
|
|
@@ -261,7 +277,11 @@ export const processActivityDetailsPushPayload = internalAction({
|
|
|
261
277
|
* Stub — acknowledges the notification without fetching data.
|
|
262
278
|
*/
|
|
263
279
|
export const processActivityDetailsPingPayload = internalAction({
|
|
264
|
-
args: {
|
|
280
|
+
args: {
|
|
281
|
+
payload: v.any(),
|
|
282
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
283
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
284
|
+
},
|
|
265
285
|
handler: async (_ctx, args) => {
|
|
266
286
|
const { activityDetails } =
|
|
267
287
|
garminActivityDetailsPingPayloadSchema.parse(args.payload);
|
|
@@ -280,7 +300,11 @@ export const processActivityDetailsPingPayload = internalAction({
|
|
|
280
300
|
* and transforms each activity. Does not write to the database.
|
|
281
301
|
*/
|
|
282
302
|
export const processManuallyUpdatedActivitiesPushPayload = internalAction({
|
|
283
|
-
args: {
|
|
303
|
+
args: {
|
|
304
|
+
payload: v.any(),
|
|
305
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
306
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
307
|
+
},
|
|
284
308
|
handler: async (ctx, args) => {
|
|
285
309
|
const { manuallyUpdatedActivities } =
|
|
286
310
|
garminManuallyUpdatedActivitiesPushPayloadSchema.parse(args.payload);
|
|
@@ -329,7 +353,9 @@ export const processManuallyUpdatedActivitiesPushPayload = internalAction({
|
|
|
329
353
|
|
|
330
354
|
for (const item of userItems) {
|
|
331
355
|
try {
|
|
332
|
-
const data =
|
|
356
|
+
const data = args.rawPassthrough
|
|
357
|
+
? (item as Record<string, unknown>)
|
|
358
|
+
: transformManuallyUpdatedActivity(item);
|
|
333
359
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
334
360
|
} catch (err) {
|
|
335
361
|
errors.push({
|
|
@@ -352,7 +378,11 @@ export const processManuallyUpdatedActivitiesPushPayload = internalAction({
|
|
|
352
378
|
* Stub — acknowledges the notification without fetching data.
|
|
353
379
|
*/
|
|
354
380
|
export const processManuallyUpdatedActivitiesPingPayload = internalAction({
|
|
355
|
-
args: {
|
|
381
|
+
args: {
|
|
382
|
+
payload: v.any(),
|
|
383
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
384
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
385
|
+
},
|
|
356
386
|
handler: async (_ctx, args) => {
|
|
357
387
|
const { manuallyUpdatedActivities } =
|
|
358
388
|
garminManuallyUpdatedActivitiesPingPayloadSchema.parse(args.payload);
|
|
@@ -372,7 +402,11 @@ export const processManuallyUpdatedActivitiesPingPayload = internalAction({
|
|
|
372
402
|
* Does not write to the database.
|
|
373
403
|
*/
|
|
374
404
|
export const processMoveIQPushPayload = internalAction({
|
|
375
|
-
args: {
|
|
405
|
+
args: {
|
|
406
|
+
payload: v.any(),
|
|
407
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
408
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
409
|
+
},
|
|
376
410
|
handler: async (ctx, args) => {
|
|
377
411
|
const { moveIQActivities } = garminMoveIQPushPayloadSchema.parse(
|
|
378
412
|
args.payload,
|
|
@@ -422,7 +456,9 @@ export const processMoveIQPushPayload = internalAction({
|
|
|
422
456
|
|
|
423
457
|
for (const item of userItems) {
|
|
424
458
|
try {
|
|
425
|
-
const data =
|
|
459
|
+
const data = args.rawPassthrough
|
|
460
|
+
? (item as Record<string, unknown>)
|
|
461
|
+
: transformMoveIQ(item);
|
|
426
462
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
427
463
|
} catch (err) {
|
|
428
464
|
errors.push({
|
|
@@ -445,7 +481,11 @@ export const processMoveIQPushPayload = internalAction({
|
|
|
445
481
|
* Stub — acknowledges the notification without fetching data.
|
|
446
482
|
*/
|
|
447
483
|
export const processMoveIQPingPayload = internalAction({
|
|
448
|
-
args: {
|
|
484
|
+
args: {
|
|
485
|
+
payload: v.any(),
|
|
486
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
487
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
488
|
+
},
|
|
449
489
|
handler: async (_ctx, args) => {
|
|
450
490
|
const { moveIQActivities } = garminMoveIQPingPayloadSchema.parse(
|
|
451
491
|
args.payload,
|
|
@@ -465,7 +505,11 @@ export const processMoveIQPingPayload = internalAction({
|
|
|
465
505
|
* and transforms each record. Does not write to the database.
|
|
466
506
|
*/
|
|
467
507
|
export const processBloodPressurePushPayload = internalAction({
|
|
468
|
-
args: {
|
|
508
|
+
args: {
|
|
509
|
+
payload: v.any(),
|
|
510
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
511
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
512
|
+
},
|
|
469
513
|
handler: async (ctx, args) => {
|
|
470
514
|
const { bloodPressures } =
|
|
471
515
|
garminBloodPressurePushPayloadSchema.parse(args.payload);
|
|
@@ -514,7 +558,9 @@ export const processBloodPressurePushPayload = internalAction({
|
|
|
514
558
|
|
|
515
559
|
for (const item of userItems) {
|
|
516
560
|
try {
|
|
517
|
-
const data =
|
|
561
|
+
const data = args.rawPassthrough
|
|
562
|
+
? (item as Record<string, unknown>)
|
|
563
|
+
: transformBloodPressure(item);
|
|
518
564
|
if (data == null) continue;
|
|
519
565
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
520
566
|
} catch (err) {
|
|
@@ -538,7 +584,11 @@ export const processBloodPressurePushPayload = internalAction({
|
|
|
538
584
|
* Stub — acknowledges the notification without fetching data.
|
|
539
585
|
*/
|
|
540
586
|
export const processBloodPressurePingPayload = internalAction({
|
|
541
|
-
args: {
|
|
587
|
+
args: {
|
|
588
|
+
payload: v.any(),
|
|
589
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
590
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
591
|
+
},
|
|
542
592
|
handler: async (_ctx, args) => {
|
|
543
593
|
const { bloodPressures } =
|
|
544
594
|
garminBloodPressurePingPayloadSchema.parse(args.payload);
|
|
@@ -557,7 +607,11 @@ export const processBloodPressurePingPayload = internalAction({
|
|
|
557
607
|
* and transforms each record. Does not write to the database.
|
|
558
608
|
*/
|
|
559
609
|
export const processBodyCompositionsPushPayload = internalAction({
|
|
560
|
-
args: {
|
|
610
|
+
args: {
|
|
611
|
+
payload: v.any(),
|
|
612
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
613
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
614
|
+
},
|
|
561
615
|
handler: async (ctx, args) => {
|
|
562
616
|
const { bodyComps } =
|
|
563
617
|
garminBodyCompositionsPushPayloadSchema.parse(args.payload);
|
|
@@ -606,7 +660,9 @@ export const processBodyCompositionsPushPayload = internalAction({
|
|
|
606
660
|
|
|
607
661
|
for (const item of userItems) {
|
|
608
662
|
try {
|
|
609
|
-
const data =
|
|
663
|
+
const data = args.rawPassthrough
|
|
664
|
+
? (item as Record<string, unknown>)
|
|
665
|
+
: transformBodyComposition(item);
|
|
610
666
|
if (data == null) continue;
|
|
611
667
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
612
668
|
} catch (err) {
|
|
@@ -630,7 +686,11 @@ export const processBodyCompositionsPushPayload = internalAction({
|
|
|
630
686
|
* Stub — acknowledges the notification without fetching data.
|
|
631
687
|
*/
|
|
632
688
|
export const processBodyCompositionsPingPayload = internalAction({
|
|
633
|
-
args: {
|
|
689
|
+
args: {
|
|
690
|
+
payload: v.any(),
|
|
691
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
692
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
693
|
+
},
|
|
634
694
|
handler: async (_ctx, args) => {
|
|
635
695
|
const { bodyComps } =
|
|
636
696
|
garminBodyCompositionsPingPayloadSchema.parse(args.payload);
|
|
@@ -649,7 +709,11 @@ export const processBodyCompositionsPingPayload = internalAction({
|
|
|
649
709
|
* and transforms each record. Does not write to the database.
|
|
650
710
|
*/
|
|
651
711
|
export const processDailiesPushPayload = internalAction({
|
|
652
|
-
args: {
|
|
712
|
+
args: {
|
|
713
|
+
payload: v.any(),
|
|
714
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
715
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
716
|
+
},
|
|
653
717
|
handler: async (ctx, args) => {
|
|
654
718
|
const { dailies } =
|
|
655
719
|
garminDailiesPushPayloadSchema.parse(args.payload);
|
|
@@ -698,7 +762,9 @@ export const processDailiesPushPayload = internalAction({
|
|
|
698
762
|
|
|
699
763
|
for (const item of userItems) {
|
|
700
764
|
try {
|
|
701
|
-
const data =
|
|
765
|
+
const data = args.rawPassthrough
|
|
766
|
+
? (item as Record<string, unknown>)
|
|
767
|
+
: transformDailies(item);
|
|
702
768
|
if (data == null) continue;
|
|
703
769
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
704
770
|
} catch (err) {
|
|
@@ -722,7 +788,11 @@ export const processDailiesPushPayload = internalAction({
|
|
|
722
788
|
* Stub — acknowledges the notification without fetching data.
|
|
723
789
|
*/
|
|
724
790
|
export const processDailiesPingPayload = internalAction({
|
|
725
|
-
args: {
|
|
791
|
+
args: {
|
|
792
|
+
payload: v.any(),
|
|
793
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
794
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
795
|
+
},
|
|
726
796
|
handler: async (_ctx, args) => {
|
|
727
797
|
const { dailies } =
|
|
728
798
|
garminDailiesPingPayloadSchema.parse(args.payload);
|
|
@@ -741,7 +811,11 @@ export const processDailiesPingPayload = internalAction({
|
|
|
741
811
|
* and transforms each record. Does not write to the database.
|
|
742
812
|
*/
|
|
743
813
|
export const processHealthSnapshotPushPayload = internalAction({
|
|
744
|
-
args: {
|
|
814
|
+
args: {
|
|
815
|
+
payload: v.any(),
|
|
816
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
817
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
818
|
+
},
|
|
745
819
|
handler: async (ctx, args) => {
|
|
746
820
|
const { healthSnapshot } =
|
|
747
821
|
garminHealthSnapshotPushPayloadSchema.parse(args.payload);
|
|
@@ -790,7 +864,9 @@ export const processHealthSnapshotPushPayload = internalAction({
|
|
|
790
864
|
|
|
791
865
|
for (const item of userItems) {
|
|
792
866
|
try {
|
|
793
|
-
const data =
|
|
867
|
+
const data = args.rawPassthrough
|
|
868
|
+
? (item as Record<string, unknown>)
|
|
869
|
+
: transformHealthSnapshot(item);
|
|
794
870
|
if (data == null) continue;
|
|
795
871
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
796
872
|
} catch (err) {
|
|
@@ -814,7 +890,11 @@ export const processHealthSnapshotPushPayload = internalAction({
|
|
|
814
890
|
* Stub — acknowledges the notification without fetching data.
|
|
815
891
|
*/
|
|
816
892
|
export const processHealthSnapshotPingPayload = internalAction({
|
|
817
|
-
args: {
|
|
893
|
+
args: {
|
|
894
|
+
payload: v.any(),
|
|
895
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
896
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
897
|
+
},
|
|
818
898
|
handler: async (_ctx, args) => {
|
|
819
899
|
const { healthSnapshot } =
|
|
820
900
|
garminHealthSnapshotPingPayloadSchema.parse(args.payload);
|
|
@@ -833,7 +913,11 @@ export const processHealthSnapshotPingPayload = internalAction({
|
|
|
833
913
|
* and transforms each record. Does not write to the database.
|
|
834
914
|
*/
|
|
835
915
|
export const processHRVSummaryPushPayload = internalAction({
|
|
836
|
-
args: {
|
|
916
|
+
args: {
|
|
917
|
+
payload: v.any(),
|
|
918
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
919
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
920
|
+
},
|
|
837
921
|
handler: async (ctx, args) => {
|
|
838
922
|
const { hrv } =
|
|
839
923
|
garminHRVSummaryPushPayloadSchema.parse(args.payload);
|
|
@@ -882,7 +966,9 @@ export const processHRVSummaryPushPayload = internalAction({
|
|
|
882
966
|
|
|
883
967
|
for (const item of userItems) {
|
|
884
968
|
try {
|
|
885
|
-
const data =
|
|
969
|
+
const data = args.rawPassthrough
|
|
970
|
+
? (item as Record<string, unknown>)
|
|
971
|
+
: transformHRVSummary(item);
|
|
886
972
|
if (data == null) continue;
|
|
887
973
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
888
974
|
} catch (err) {
|
|
@@ -906,7 +992,11 @@ export const processHRVSummaryPushPayload = internalAction({
|
|
|
906
992
|
* Stub — acknowledges the notification without fetching data.
|
|
907
993
|
*/
|
|
908
994
|
export const processHRVSummaryPingPayload = internalAction({
|
|
909
|
-
args: {
|
|
995
|
+
args: {
|
|
996
|
+
payload: v.any(),
|
|
997
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
998
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
999
|
+
},
|
|
910
1000
|
handler: async (_ctx, args) => {
|
|
911
1001
|
const { hrv } =
|
|
912
1002
|
garminHRVSummaryPingPayloadSchema.parse(args.payload);
|
|
@@ -925,7 +1015,11 @@ export const processHRVSummaryPingPayload = internalAction({
|
|
|
925
1015
|
* resolves connections, and transforms each record. Does not write to the database.
|
|
926
1016
|
*/
|
|
927
1017
|
export const processEpochPushPayload = internalAction({
|
|
928
|
-
args: {
|
|
1018
|
+
args: {
|
|
1019
|
+
payload: v.any(),
|
|
1020
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1021
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1022
|
+
},
|
|
929
1023
|
handler: async (ctx, args) => {
|
|
930
1024
|
const { epochs } =
|
|
931
1025
|
garminEpochPushPayloadSchema.parse(args.payload);
|
|
@@ -974,7 +1068,9 @@ export const processEpochPushPayload = internalAction({
|
|
|
974
1068
|
|
|
975
1069
|
for (const item of userItems) {
|
|
976
1070
|
try {
|
|
977
|
-
const data =
|
|
1071
|
+
const data = args.rawPassthrough
|
|
1072
|
+
? (item as Record<string, unknown>)
|
|
1073
|
+
: transformEpoch(item);
|
|
978
1074
|
if (data == null) continue;
|
|
979
1075
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
980
1076
|
} catch (err) {
|
|
@@ -998,7 +1094,11 @@ export const processEpochPushPayload = internalAction({
|
|
|
998
1094
|
* Stub — acknowledges the notification without fetching data.
|
|
999
1095
|
*/
|
|
1000
1096
|
export const processEpochPingPayload = internalAction({
|
|
1001
|
-
args: {
|
|
1097
|
+
args: {
|
|
1098
|
+
payload: v.any(),
|
|
1099
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1100
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1101
|
+
},
|
|
1002
1102
|
handler: async (_ctx, args) => {
|
|
1003
1103
|
const { epochs } =
|
|
1004
1104
|
garminEpochPingPayloadSchema.parse(args.payload);
|
|
@@ -1017,7 +1117,11 @@ export const processEpochPingPayload = internalAction({
|
|
|
1017
1117
|
* and transforms each record. Does not write to the database.
|
|
1018
1118
|
*/
|
|
1019
1119
|
export const processPulseOxPushPayload = internalAction({
|
|
1020
|
-
args: {
|
|
1120
|
+
args: {
|
|
1121
|
+
payload: v.any(),
|
|
1122
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1123
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1124
|
+
},
|
|
1021
1125
|
handler: async (ctx, args) => {
|
|
1022
1126
|
const { pulseox } =
|
|
1023
1127
|
garminPulseOxPushPayloadSchema.parse(args.payload);
|
|
@@ -1066,7 +1170,9 @@ export const processPulseOxPushPayload = internalAction({
|
|
|
1066
1170
|
|
|
1067
1171
|
for (const item of userItems) {
|
|
1068
1172
|
try {
|
|
1069
|
-
const data =
|
|
1173
|
+
const data = args.rawPassthrough
|
|
1174
|
+
? (item as Record<string, unknown>)
|
|
1175
|
+
: transformPulseOx(item);
|
|
1070
1176
|
if (data == null) continue;
|
|
1071
1177
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1072
1178
|
} catch (err) {
|
|
@@ -1090,7 +1196,11 @@ export const processPulseOxPushPayload = internalAction({
|
|
|
1090
1196
|
* Stub — acknowledges the notification without fetching data.
|
|
1091
1197
|
*/
|
|
1092
1198
|
export const processPulseOxPingPayload = internalAction({
|
|
1093
|
-
args: {
|
|
1199
|
+
args: {
|
|
1200
|
+
payload: v.any(),
|
|
1201
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1202
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1203
|
+
},
|
|
1094
1204
|
handler: async (_ctx, args) => {
|
|
1095
1205
|
const { pulseox } =
|
|
1096
1206
|
garminPulseOxPingPayloadSchema.parse(args.payload);
|
|
@@ -1109,7 +1219,11 @@ export const processPulseOxPingPayload = internalAction({
|
|
|
1109
1219
|
* and transforms each record. Does not write to the database.
|
|
1110
1220
|
*/
|
|
1111
1221
|
export const processRespirationPushPayload = internalAction({
|
|
1112
|
-
args: {
|
|
1222
|
+
args: {
|
|
1223
|
+
payload: v.any(),
|
|
1224
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1225
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1226
|
+
},
|
|
1113
1227
|
handler: async (ctx, args) => {
|
|
1114
1228
|
const { allDayRespiration } =
|
|
1115
1229
|
garminRespirationPushPayloadSchema.parse(args.payload);
|
|
@@ -1158,7 +1272,9 @@ export const processRespirationPushPayload = internalAction({
|
|
|
1158
1272
|
|
|
1159
1273
|
for (const item of userItems) {
|
|
1160
1274
|
try {
|
|
1161
|
-
const data =
|
|
1275
|
+
const data = args.rawPassthrough
|
|
1276
|
+
? (item as Record<string, unknown>)
|
|
1277
|
+
: transformRespiration(item);
|
|
1162
1278
|
if (data == null) continue;
|
|
1163
1279
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1164
1280
|
} catch (err) {
|
|
@@ -1182,7 +1298,11 @@ export const processRespirationPushPayload = internalAction({
|
|
|
1182
1298
|
* Stub — acknowledges the notification without fetching data.
|
|
1183
1299
|
*/
|
|
1184
1300
|
export const processRespirationPingPayload = internalAction({
|
|
1185
|
-
args: {
|
|
1301
|
+
args: {
|
|
1302
|
+
payload: v.any(),
|
|
1303
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1304
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1305
|
+
},
|
|
1186
1306
|
handler: async (_ctx, args) => {
|
|
1187
1307
|
const { allDayRespiration } =
|
|
1188
1308
|
garminRespirationPingPayloadSchema.parse(args.payload);
|
|
@@ -1201,7 +1321,11 @@ export const processRespirationPingPayload = internalAction({
|
|
|
1201
1321
|
* and transforms each record. Does not write to the database.
|
|
1202
1322
|
*/
|
|
1203
1323
|
export const processStressPushPayload = internalAction({
|
|
1204
|
-
args: {
|
|
1324
|
+
args: {
|
|
1325
|
+
payload: v.any(),
|
|
1326
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1327
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1328
|
+
},
|
|
1205
1329
|
handler: async (ctx, args) => {
|
|
1206
1330
|
const { stressDetails } =
|
|
1207
1331
|
garminStressPushPayloadSchema.parse(args.payload);
|
|
@@ -1250,7 +1374,9 @@ export const processStressPushPayload = internalAction({
|
|
|
1250
1374
|
|
|
1251
1375
|
for (const item of userItems) {
|
|
1252
1376
|
try {
|
|
1253
|
-
const data =
|
|
1377
|
+
const data = args.rawPassthrough
|
|
1378
|
+
? (item as Record<string, unknown>)
|
|
1379
|
+
: transformStress(item);
|
|
1254
1380
|
if (data == null) continue;
|
|
1255
1381
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1256
1382
|
} catch (err) {
|
|
@@ -1274,7 +1400,11 @@ export const processStressPushPayload = internalAction({
|
|
|
1274
1400
|
* Stub — acknowledges the notification without fetching data.
|
|
1275
1401
|
*/
|
|
1276
1402
|
export const processStressPingPayload = internalAction({
|
|
1277
|
-
args: {
|
|
1403
|
+
args: {
|
|
1404
|
+
payload: v.any(),
|
|
1405
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1406
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1407
|
+
},
|
|
1278
1408
|
handler: async (_ctx, args) => {
|
|
1279
1409
|
const { stressDetails } =
|
|
1280
1410
|
garminStressPingPayloadSchema.parse(args.payload);
|
|
@@ -1293,7 +1423,11 @@ export const processStressPingPayload = internalAction({
|
|
|
1293
1423
|
* and transforms each record. Does not write to the database.
|
|
1294
1424
|
*/
|
|
1295
1425
|
export const processSkinTemperaturePushPayload = internalAction({
|
|
1296
|
-
args: {
|
|
1426
|
+
args: {
|
|
1427
|
+
payload: v.any(),
|
|
1428
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1429
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1430
|
+
},
|
|
1297
1431
|
handler: async (ctx, args) => {
|
|
1298
1432
|
const { skinTemp } =
|
|
1299
1433
|
garminSkinTemperaturePushPayloadSchema.parse(args.payload);
|
|
@@ -1342,7 +1476,9 @@ export const processSkinTemperaturePushPayload = internalAction({
|
|
|
1342
1476
|
|
|
1343
1477
|
for (const item of userItems) {
|
|
1344
1478
|
try {
|
|
1345
|
-
const data =
|
|
1479
|
+
const data = args.rawPassthrough
|
|
1480
|
+
? (item as Record<string, unknown>)
|
|
1481
|
+
: transformSkinTemperature(item);
|
|
1346
1482
|
if (data == null) continue;
|
|
1347
1483
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1348
1484
|
} catch (err) {
|
|
@@ -1366,7 +1502,11 @@ export const processSkinTemperaturePushPayload = internalAction({
|
|
|
1366
1502
|
* Stub — acknowledges the notification without fetching data.
|
|
1367
1503
|
*/
|
|
1368
1504
|
export const processSkinTemperaturePingPayload = internalAction({
|
|
1369
|
-
args: {
|
|
1505
|
+
args: {
|
|
1506
|
+
payload: v.any(),
|
|
1507
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1508
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1509
|
+
},
|
|
1370
1510
|
handler: async (_ctx, args) => {
|
|
1371
1511
|
const { skinTemp } =
|
|
1372
1512
|
garminSkinTemperaturePingPayloadSchema.parse(args.payload);
|
|
@@ -1385,7 +1525,11 @@ export const processSkinTemperaturePingPayload = internalAction({
|
|
|
1385
1525
|
* and transforms each sleep record. Does not write to the database.
|
|
1386
1526
|
*/
|
|
1387
1527
|
export const processSleepsPushPayload = internalAction({
|
|
1388
|
-
args: {
|
|
1528
|
+
args: {
|
|
1529
|
+
payload: v.any(),
|
|
1530
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1531
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1532
|
+
},
|
|
1389
1533
|
handler: async (ctx, args) => {
|
|
1390
1534
|
const { sleeps } = garminSleepsPushPayloadSchema.parse(args.payload);
|
|
1391
1535
|
|
|
@@ -1433,7 +1577,9 @@ export const processSleepsPushPayload = internalAction({
|
|
|
1433
1577
|
|
|
1434
1578
|
for (const item of userItems) {
|
|
1435
1579
|
try {
|
|
1436
|
-
const data =
|
|
1580
|
+
const data = args.rawPassthrough
|
|
1581
|
+
? (item as Record<string, unknown>)
|
|
1582
|
+
: transformSleeps(item);
|
|
1437
1583
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1438
1584
|
} catch (err) {
|
|
1439
1585
|
errors.push({
|
|
@@ -1456,7 +1602,11 @@ export const processSleepsPushPayload = internalAction({
|
|
|
1456
1602
|
* Stub — acknowledges the notification without fetching data.
|
|
1457
1603
|
*/
|
|
1458
1604
|
export const processSleepsPingPayload = internalAction({
|
|
1459
|
-
args: {
|
|
1605
|
+
args: {
|
|
1606
|
+
payload: v.any(),
|
|
1607
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1608
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1609
|
+
},
|
|
1460
1610
|
handler: async (_ctx, args) => {
|
|
1461
1611
|
const { sleeps } = garminSleepsPingPayloadSchema.parse(args.payload);
|
|
1462
1612
|
console.log(
|
|
@@ -1474,7 +1624,11 @@ export const processSleepsPingPayload = internalAction({
|
|
|
1474
1624
|
* and transforms each user metrics record. Does not write to the database.
|
|
1475
1625
|
*/
|
|
1476
1626
|
export const processUserMetricsPushPayload = internalAction({
|
|
1477
|
-
args: {
|
|
1627
|
+
args: {
|
|
1628
|
+
payload: v.any(),
|
|
1629
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1630
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1631
|
+
},
|
|
1478
1632
|
handler: async (ctx, args) => {
|
|
1479
1633
|
const { userMetrics } =
|
|
1480
1634
|
garminUserMetricsPushPayloadSchema.parse(args.payload);
|
|
@@ -1523,7 +1677,9 @@ export const processUserMetricsPushPayload = internalAction({
|
|
|
1523
1677
|
|
|
1524
1678
|
for (const item of userItems) {
|
|
1525
1679
|
try {
|
|
1526
|
-
const data =
|
|
1680
|
+
const data = args.rawPassthrough
|
|
1681
|
+
? (item as Record<string, unknown>)
|
|
1682
|
+
: transformUserMetrics(item);
|
|
1527
1683
|
if (data == null) continue;
|
|
1528
1684
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1529
1685
|
} catch (err) {
|
|
@@ -1547,7 +1703,11 @@ export const processUserMetricsPushPayload = internalAction({
|
|
|
1547
1703
|
* Stub — acknowledges the notification without fetching data.
|
|
1548
1704
|
*/
|
|
1549
1705
|
export const processUserMetricsPingPayload = internalAction({
|
|
1550
|
-
args: {
|
|
1706
|
+
args: {
|
|
1707
|
+
payload: v.any(),
|
|
1708
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1709
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1710
|
+
},
|
|
1551
1711
|
handler: async (_ctx, args) => {
|
|
1552
1712
|
const { userMetrics } =
|
|
1553
1713
|
garminUserMetricsPingPayloadSchema.parse(args.payload);
|
|
@@ -1566,7 +1726,11 @@ export const processUserMetricsPingPayload = internalAction({
|
|
|
1566
1726
|
* and transforms each record. Does not write to the database.
|
|
1567
1727
|
*/
|
|
1568
1728
|
export const processMenstrualCycleTrackingPushPayload = internalAction({
|
|
1569
|
-
args: {
|
|
1729
|
+
args: {
|
|
1730
|
+
payload: v.any(),
|
|
1731
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1732
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1733
|
+
},
|
|
1570
1734
|
handler: async (ctx, args) => {
|
|
1571
1735
|
const { mct } =
|
|
1572
1736
|
garminMenstrualCycleTrackingPushPayloadSchema.parse(args.payload);
|
|
@@ -1615,7 +1779,9 @@ export const processMenstrualCycleTrackingPushPayload = internalAction({
|
|
|
1615
1779
|
|
|
1616
1780
|
for (const item of userItems) {
|
|
1617
1781
|
try {
|
|
1618
|
-
const data =
|
|
1782
|
+
const data = args.rawPassthrough
|
|
1783
|
+
? (item as Record<string, unknown>)
|
|
1784
|
+
: transformMenstrualCycleTracking(item);
|
|
1619
1785
|
items.push({ connectionId: connection._id, userId: connection.userId, data });
|
|
1620
1786
|
} catch (err) {
|
|
1621
1787
|
errors.push({
|
|
@@ -1638,7 +1804,11 @@ export const processMenstrualCycleTrackingPushPayload = internalAction({
|
|
|
1638
1804
|
* Stub — acknowledges the notification without fetching data.
|
|
1639
1805
|
*/
|
|
1640
1806
|
export const processMenstrualCycleTrackingPingPayload = internalAction({
|
|
1641
|
-
args: {
|
|
1807
|
+
args: {
|
|
1808
|
+
payload: v.any(),
|
|
1809
|
+
// Only consumed by push processors; ping processors ignore it.
|
|
1810
|
+
rawPassthrough: v.optional(v.boolean()),
|
|
1811
|
+
},
|
|
1642
1812
|
handler: async (_ctx, args) => {
|
|
1643
1813
|
const { mct } =
|
|
1644
1814
|
garminMenstrualCycleTrackingPingPayloadSchema.parse(args.payload);
|