@molecule/api-wearable-fitbit 1.0.3 → 1.0.5
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/README.md +12 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-11-08T06:02:57.686Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-wearable-fitbit
|
|
@@ -445,6 +445,7 @@ error path must be sanitized.
|
|
|
445
445
|
interface WearableProvider {
|
|
446
446
|
/** Stable provider key used for credential-store segregation, e.g. `"fitbit"`. */
|
|
447
447
|
readonly providerName: string
|
|
448
|
+
|
|
448
449
|
/**
|
|
449
450
|
* Reads the daily activity rollup for `(userId, date)`.
|
|
450
451
|
*
|
|
@@ -453,6 +454,7 @@ interface WearableProvider {
|
|
|
453
454
|
* @returns Normalized daily activity.
|
|
454
455
|
*/
|
|
455
456
|
getDailyActivity(userId: string, date: WearableDate): Promise<DailyActivity>
|
|
457
|
+
|
|
456
458
|
/**
|
|
457
459
|
* Reads sleep sessions bucketed under `(userId, date)`. Most days return
|
|
458
460
|
* a single primary session; multi-nap days return multiple.
|
|
@@ -462,6 +464,7 @@ interface WearableProvider {
|
|
|
462
464
|
* @returns All sleep sessions bucketed under that day.
|
|
463
465
|
*/
|
|
464
466
|
getDailySleep(userId: string, date: WearableDate): Promise<SleepSession[]>
|
|
467
|
+
|
|
465
468
|
/**
|
|
466
469
|
* Reads the daily heart-rate summary for `(userId, date)`.
|
|
467
470
|
*
|
|
@@ -470,6 +473,7 @@ interface WearableProvider {
|
|
|
470
473
|
* @returns Normalized daily heart-rate summary.
|
|
471
474
|
*/
|
|
472
475
|
getDailyHeartRate(userId: string, date: WearableDate): Promise<HeartRateSummary>
|
|
476
|
+
|
|
473
477
|
/**
|
|
474
478
|
* Reads body-weight entries for the user across `range`. Providers cap
|
|
475
479
|
* how far back a single call may reach — implementations should clamp
|
|
@@ -481,6 +485,7 @@ interface WearableProvider {
|
|
|
481
485
|
* @returns Weight entries, ordered by `recordedAt` ascending.
|
|
482
486
|
*/
|
|
483
487
|
getWeight(userId: string, range: WearableDateRange): Promise<WeightEntry[]>
|
|
488
|
+
|
|
484
489
|
/**
|
|
485
490
|
* Exchanges an OAuth authorization `code` for tokens and persists the
|
|
486
491
|
* resulting {@link UserConnection} via the bond's credentials store.
|
|
@@ -490,6 +495,7 @@ interface WearableProvider {
|
|
|
490
495
|
* @returns The freshly-minted connection (already persisted).
|
|
491
496
|
*/
|
|
492
497
|
connect(userId: string, code: string): Promise<UserConnection>
|
|
498
|
+
|
|
493
499
|
/**
|
|
494
500
|
* Forces a refresh of the user's access token using the stored refresh
|
|
495
501
|
* token. The rotated connection is persisted before being returned.
|
|
@@ -498,6 +504,7 @@ interface WearableProvider {
|
|
|
498
504
|
* @returns The rotated connection (already persisted).
|
|
499
505
|
*/
|
|
500
506
|
refreshConnection(userId: string): Promise<UserConnection>
|
|
507
|
+
|
|
501
508
|
/**
|
|
502
509
|
* Revokes (best-effort) and removes the user's connection record.
|
|
503
510
|
*
|
|
@@ -544,7 +551,7 @@ type SleepStage = 'awake' | 'light' | 'deep' | 'rem' | 'restless' | 'asleep' | '
|
|
|
544
551
|
Base64url-encodes the bytes (RFC 4648 §5 with `=` padding stripped).
|
|
545
552
|
|
|
546
553
|
```typescript
|
|
547
|
-
function base64UrlEncode(bytes: Uint8Array
|
|
554
|
+
function base64UrlEncode(bytes: Uint8Array): string
|
|
548
555
|
```
|
|
549
556
|
|
|
550
557
|
- `bytes` — The bytes to encode.
|
|
@@ -571,7 +578,7 @@ normalized {@link DailyActivity} shape. Missing fields are zero-defaulted
|
|
|
571
578
|
so handlers can sum across days without null guards.
|
|
572
579
|
|
|
573
580
|
```typescript
|
|
574
|
-
function fromFitbitActivity(date:
|
|
581
|
+
function fromFitbitActivity(date: WearableDate, raw: FitbitDailyActivityResponse): DailyActivity
|
|
575
582
|
```
|
|
576
583
|
|
|
577
584
|
- `date` — The calendar day the response was requested for.
|
|
@@ -599,7 +606,7 @@ Translates a Fitbit `sleep/date` payload into a list of normalized
|
|
|
599
606
|
{@link SleepSession} records.
|
|
600
607
|
|
|
601
608
|
```typescript
|
|
602
|
-
function fromFitbitSleep(date:
|
|
609
|
+
function fromFitbitSleep(date: WearableDate, raw: FitbitSleepResponse): SleepSession[]
|
|
603
610
|
```
|
|
604
611
|
|
|
605
612
|
- `date` — Calendar day the response was requested for.
|
|
@@ -613,7 +620,7 @@ Translates a Fitbit `activities/heart/date` payload into the normalized
|
|
|
613
620
|
{@link HeartRateSummary} shape.
|
|
614
621
|
|
|
615
622
|
```typescript
|
|
616
|
-
function fromFitbitHeartRate(date:
|
|
623
|
+
function fromFitbitHeartRate(date: WearableDate, raw: FitbitHeartRateResponse): HeartRateSummary
|
|
617
624
|
```
|
|
618
625
|
|
|
619
626
|
- `date` — Calendar day the response was requested for.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-wearable-fitbit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Fitbit Web API bond for molecule.dev — daily activity, sleep, heart-rate, and weight ingestion via OAuth 2.0 PKCE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@molecule/api-wearable": "^1.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@molecule/api-bond": "1.0.
|
|
41
|
-
"@molecule/api-http": "1.0.
|
|
40
|
+
"@molecule/api-bond": "1.0.4",
|
|
41
|
+
"@molecule/api-http": "1.0.5",
|
|
42
42
|
"@molecule/api-wearable": "1.0.3",
|
|
43
43
|
"@types/node": "26.6.5",
|
|
44
44
|
"typescript": "6.0.3",
|