@nativesquare/soma 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/garmin.d.ts +31 -0
- package/dist/client/garmin.d.ts.map +1 -1
- package/dist/client/garmin.js +34 -0
- package/dist/client/garmin.js.map +1 -1
- package/dist/client/healthkit.d.ts +267 -0
- package/dist/client/healthkit.d.ts.map +1 -0
- package/dist/client/healthkit.js +600 -0
- package/dist/client/healthkit.js.map +1 -0
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +3 -2
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/_generated/api.d.ts +26 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +7 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/garmin/private.d.ts +18 -85
- package/dist/component/garmin/private.d.ts.map +1 -1
- package/dist/component/garmin/private.js +12 -12
- package/dist/component/garmin/private.js.map +1 -1
- package/dist/component/garmin/public.d.ts +38 -65
- package/dist/component/garmin/public.d.ts.map +1 -1
- package/dist/component/garmin/public.js +132 -10
- package/dist/component/garmin/public.js.map +1 -1
- package/dist/component/garmin/utils.d.ts +48 -0
- package/dist/component/garmin/utils.d.ts.map +1 -1
- package/dist/component/garmin/utils.js +65 -0
- package/dist/component/garmin/utils.js.map +1 -1
- package/dist/component/garmin/webhooks.d.ts +1 -11
- package/dist/component/garmin/webhooks.d.ts.map +1 -1
- package/dist/component/garmin/webhooks.js.map +1 -1
- package/dist/component/healthkit/index.d.ts +14 -0
- package/dist/component/healthkit/index.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit}/index.js +11 -11
- package/dist/component/healthkit/index.js.map +1 -0
- package/dist/component/healthkit/transform/activity.d.ts +19 -0
- package/dist/component/healthkit/transform/activity.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/activity.js +1 -1
- package/dist/component/healthkit/transform/activity.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/athlete.d.ts +3 -9
- package/dist/component/healthkit/transform/athlete.d.ts.map +1 -0
- package/dist/component/healthkit/transform/athlete.js.map +1 -0
- package/dist/component/healthkit/transform/body.d.ts +25 -0
- package/dist/component/healthkit/transform/body.d.ts.map +1 -0
- package/dist/component/healthkit/transform/body.js.map +1 -0
- package/dist/component/healthkit/transform/daily.d.ts +36 -0
- package/dist/component/healthkit/transform/daily.d.ts.map +1 -0
- package/dist/component/healthkit/transform/daily.js.map +1 -0
- package/dist/{healthkit/maps/activity-type.d.ts → component/healthkit/transform/maps/activityType.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/activityType.d.ts.map +1 -0
- package/dist/{healthkit/maps/activity-type.js → component/healthkit/transform/maps/activityType.js} +1 -1
- package/dist/component/healthkit/transform/maps/activityType.js.map +1 -0
- package/dist/{healthkit/maps/menstruation-flow.d.ts → component/healthkit/transform/maps/menstruationFlow.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/menstruationFlow.d.ts.map +1 -0
- package/dist/{healthkit/maps/menstruation-flow.js → component/healthkit/transform/maps/menstruationFlow.js} +2 -2
- package/dist/component/healthkit/transform/maps/menstruationFlow.js.map +1 -0
- package/dist/{healthkit/maps/sleep-level.d.ts → component/healthkit/transform/maps/sleepLevel.d.ts} +1 -1
- package/dist/component/healthkit/transform/maps/sleepLevel.d.ts.map +1 -0
- package/dist/{healthkit/maps/sleep-level.js → component/healthkit/transform/maps/sleepLevel.js} +2 -2
- package/dist/component/healthkit/transform/maps/sleepLevel.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/menstruation.d.ts +3 -17
- package/dist/component/healthkit/transform/menstruation.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/menstruation.js +1 -1
- package/dist/component/healthkit/transform/menstruation.js.map +1 -0
- package/dist/component/healthkit/transform/nutrition.d.ts +25 -0
- package/dist/component/healthkit/transform/nutrition.d.ts.map +1 -0
- package/dist/component/healthkit/transform/nutrition.js.map +1 -0
- package/dist/component/healthkit/transform/sleep.d.ts +22 -0
- package/dist/component/healthkit/transform/sleep.d.ts.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/sleep.js +2 -2
- package/dist/component/healthkit/transform/sleep.js.map +1 -0
- package/dist/{healthkit → component/healthkit/transform}/utils.d.ts +1 -1
- package/dist/component/healthkit/transform/utils.d.ts.map +1 -0
- package/dist/component/healthkit/transform/utils.js.map +1 -0
- package/dist/component/healthkit/types.d.ts.map +1 -0
- package/dist/component/healthkit/types.js.map +1 -0
- package/dist/component/public.d.ts +3 -3
- package/dist/component/schema.d.ts +4 -4
- package/dist/component/strava/public.d.ts +4 -15
- package/dist/component/strava/public.d.ts.map +1 -1
- package/dist/component/strava/public.js +4 -3
- package/dist/component/strava/public.js.map +1 -1
- package/dist/component/strava/webhooks.d.ts +3 -10
- package/dist/component/strava/webhooks.d.ts.map +1 -1
- package/dist/component/strava/webhooks.js.map +1 -1
- package/dist/component/validators/daily.d.ts +2 -2
- package/dist/component/validators/shared.d.ts +16 -3
- package/dist/component/validators/shared.d.ts.map +1 -1
- package/dist/component/validators/shared.js +1 -1
- package/dist/component/validators/shared.js.map +1 -1
- package/dist/validators.d.ts +5 -4
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js.map +1 -1
- package/package.json +3 -3
- package/src/client/garmin.ts +42 -0
- package/src/client/healthkit.ts +791 -0
- package/src/client/index.ts +5 -0
- package/src/client/types.ts +4 -2
- package/src/component/_generated/api.ts +26 -0
- package/src/component/_generated/component.ts +13 -0
- package/src/component/garmin/private.ts +12 -12
- package/src/component/garmin/public.ts +166 -11
- package/src/component/garmin/utils.ts +102 -0
- package/src/component/garmin/webhooks.ts +1 -7
- package/src/{healthkit → component/healthkit}/index.ts +46 -59
- package/src/component/healthkit/transform/activity.ts +115 -0
- package/src/{healthkit → component/healthkit/transform}/athlete.ts +4 -8
- package/src/{healthkit → component/healthkit/transform}/body.ts +3 -7
- package/src/{healthkit → component/healthkit/transform}/daily.ts +4 -10
- package/src/{healthkit/maps/menstruation-flow.ts → component/healthkit/transform/maps/menstruationFlow.ts} +1 -1
- package/src/{healthkit/maps/sleep-level.ts → component/healthkit/transform/maps/sleepLevel.ts} +1 -1
- package/src/{healthkit → component/healthkit/transform}/menstruation.ts +4 -8
- package/src/{healthkit → component/healthkit/transform}/nutrition.ts +3 -7
- package/src/{healthkit → component/healthkit/transform}/sleep.ts +5 -9
- package/src/{healthkit → component/healthkit/transform}/utils.ts +1 -1
- package/src/component/strava/public.ts +6 -5
- package/src/component/strava/webhooks.ts +9 -11
- package/src/component/validators/shared.ts +47 -4
- package/src/validators.ts +1 -0
- package/dist/healthkit/activity.d.ts +0 -75
- package/dist/healthkit/activity.d.ts.map +0 -1
- package/dist/healthkit/activity.js.map +0 -1
- package/dist/healthkit/athlete.d.ts.map +0 -1
- package/dist/healthkit/athlete.js.map +0 -1
- package/dist/healthkit/body.d.ts +0 -102
- package/dist/healthkit/body.d.ts.map +0 -1
- package/dist/healthkit/body.js.map +0 -1
- package/dist/healthkit/daily.d.ts +0 -119
- package/dist/healthkit/daily.d.ts.map +0 -1
- package/dist/healthkit/daily.js.map +0 -1
- package/dist/healthkit/index.d.ts +0 -21
- package/dist/healthkit/index.d.ts.map +0 -1
- package/dist/healthkit/index.js.map +0 -1
- package/dist/healthkit/maps/activity-type.d.ts.map +0 -1
- package/dist/healthkit/maps/activity-type.js.map +0 -1
- package/dist/healthkit/maps/menstruation-flow.d.ts.map +0 -1
- package/dist/healthkit/maps/menstruation-flow.js.map +0 -1
- package/dist/healthkit/maps/sleep-level.d.ts.map +0 -1
- package/dist/healthkit/maps/sleep-level.js.map +0 -1
- package/dist/healthkit/menstruation.d.ts.map +0 -1
- package/dist/healthkit/menstruation.js.map +0 -1
- package/dist/healthkit/nutrition.d.ts +0 -77
- package/dist/healthkit/nutrition.d.ts.map +0 -1
- package/dist/healthkit/nutrition.js.map +0 -1
- package/dist/healthkit/sleep.d.ts +0 -60
- package/dist/healthkit/sleep.d.ts.map +0 -1
- package/dist/healthkit/sleep.js.map +0 -1
- package/dist/healthkit/types.d.ts.map +0 -1
- package/dist/healthkit/types.js.map +0 -1
- package/dist/healthkit/utils.d.ts.map +0 -1
- package/dist/healthkit/utils.js.map +0 -1
- package/src/healthkit/activity.ts +0 -120
- /package/dist/{healthkit → component/healthkit/transform}/athlete.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/body.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/daily.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/nutrition.js +0 -0
- /package/dist/{healthkit → component/healthkit/transform}/utils.js +0 -0
- /package/dist/{healthkit → component/healthkit}/types.d.ts +0 -0
- /package/dist/{healthkit → component/healthkit}/types.js +0 -0
- /package/src/{healthkit/maps/activity-type.ts → component/healthkit/transform/maps/activityType.ts} +0 -0
- /package/src/{healthkit → component/healthkit}/types.ts +0 -0
package/dist/validators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,iEAAiE;AACjE,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,EAAE;AACF,gEAAgE;AAChE,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,4CAA4C;AAC5C,+BAA+B;AAC/B,sCAAsC;AACtC,8CAA8C;AAC9C,SAAS;AACT,QAAQ;AACR,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,4CAA4C;AAC5C,6DAA6D;AAC7D,sCAAsC;AACtC,yFAAyF;AACzF,kDAAkD;AAClD,iFAAiF;AACjF,UAAU;AACV,SAAS;AACT,QAAQ;AAER,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,4EAA4E;AAC5E,iEAAiE;AACjE,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,EAAE;AACF,gEAAgE;AAChE,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,gFAAgF;AAChF,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,4CAA4C;AAC5C,+BAA+B;AAC/B,sCAAsC;AACtC,8CAA8C;AAC9C,SAAS;AACT,QAAQ;AACR,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,4CAA4C;AAC5C,6DAA6D;AAC7D,sCAAsC;AACtC,yFAAyF;AACzF,kDAAkD;AAClD,iFAAiF;AACjF,UAAU;AACV,SAAS;AACT,QAAQ;AAER,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACnG,OAAO,EACL,iBAAiB,IAAI,kBAAkB,GAExC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,gBAAgB,IAAI,iBAAiB,GAEtC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,aAAa,IAAI,cAAc,GAEhC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,cAAc,IAAI,eAAe,GAElC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,cAAc,IAAI,eAA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,QAAQ;CACZ,CAAC;AAEF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,sBAAsB,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC,wBAAwB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/NativeSquare/soma/issues"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.16.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"convex",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"default": "./dist/react/index.js"
|
|
57
57
|
},
|
|
58
58
|
"./healthkit": {
|
|
59
|
-
"types": "./dist/healthkit/index.d.ts",
|
|
60
|
-
"default": "./dist/healthkit/index.js"
|
|
59
|
+
"types": "./dist/component/healthkit/index.d.ts",
|
|
60
|
+
"default": "./dist/component/healthkit/index.js"
|
|
61
61
|
},
|
|
62
62
|
"./strava/client": {
|
|
63
63
|
"types": "./dist/component/strava/client.d.ts",
|
package/src/client/garmin.ts
CHANGED
|
@@ -403,6 +403,48 @@ export class SomaGarmin {
|
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Request historical data from Garmin's backfill API for all summary types.
|
|
408
|
+
*
|
|
409
|
+
* Unlike pull methods (which query by upload time with a 24h max window),
|
|
410
|
+
* backfill requests data by the time it was *recorded* on the device.
|
|
411
|
+
* Garmin processes backfill asynchronously (HTTP 202) and delivers data
|
|
412
|
+
* via push/ping webhooks — no data is returned synchronously.
|
|
413
|
+
*
|
|
414
|
+
* Health endpoints accept up to 90 days per request.
|
|
415
|
+
* Activity endpoints accept up to 30 days per request (auto-chunked).
|
|
416
|
+
*
|
|
417
|
+
* Defaults to the last 90 days when no time range is provided.
|
|
418
|
+
*
|
|
419
|
+
* @param ctx - Action context from the host app
|
|
420
|
+
* @param args.userId - The host app's user identifier
|
|
421
|
+
* @param args.startTimeInSeconds - Optional Unix epoch lower bound (when data was recorded)
|
|
422
|
+
* @param args.endTimeInSeconds - Optional Unix epoch upper bound (when data was recorded)
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```ts
|
|
426
|
+
* // Request last 90 days of historical data
|
|
427
|
+
* const result = await soma.garmin.backfillAll(ctx, { userId: "user_123" });
|
|
428
|
+
* // Data arrives async via push webhooks
|
|
429
|
+
* console.log(result.data.requested); // ["dailies", "sleeps", ...]
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
async backfillAll(
|
|
433
|
+
ctx: ActionCtx,
|
|
434
|
+
args: {
|
|
435
|
+
userId: string;
|
|
436
|
+
startTimeInSeconds?: number;
|
|
437
|
+
endTimeInSeconds?: number;
|
|
438
|
+
},
|
|
439
|
+
) {
|
|
440
|
+
const config = this.requireConfig();
|
|
441
|
+
return await ctx.runAction(this.component.garmin.public.backfillAll, {
|
|
442
|
+
...args,
|
|
443
|
+
clientId: config.clientId,
|
|
444
|
+
clientSecret: config.clientSecret,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
406
448
|
/**
|
|
407
449
|
* Push a planned workout to Garmin Connect.
|
|
408
450
|
*
|