@tryterra/react-native 2.1.0 → 2.2.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/README.md +31 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Conversions.kt +103 -14
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/ReadConversions.kt +250 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeOpsImpl.kt +47 -5
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeStreamsImpl.kt +1 -3
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeOps.kt +89 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeTypes.kt +672 -0
- package/docs/availability.md +154 -4
- package/frameworks/TerraSDK.xcframework/Info.plist +5 -5
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Info.plist +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.abi.json +1385 -226
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/TerraSDK +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +2 -2
- package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/DWARF/TerraSDK +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/TerraSDK.yml +6589 -6468
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Info.plist +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1385 -226
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1385 -226
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +37 -1
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/TerraSDK +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/_CodeSignature/CodeResources +21 -21
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +2 -2
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/DWARF/TerraSDK +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/TerraSDK.yml +6590 -6469
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/TerraSDK.yml +6508 -6387
- package/ios/TerraBridgeCore/Conversions+Reads.swift +259 -0
- package/ios/TerraBridgeCore/Conversions.swift +129 -2
- package/ios/TerraBridgeCore/Generated/BridgeOps.swift +172 -0
- package/ios/TerraBridgeCore/Generated/BridgeTypes.swift +734 -1
- package/ios/TerraBridgeCore/TerraBridgeOpsImpl.swift +64 -0
- package/lib/Terra.d.ts +74 -5
- package/lib/Terra.js +69 -13
- package/lib/generated/client.d.ts +37 -1
- package/lib/generated/client.js +60 -0
- package/lib/generated/codecs.d.ts +85 -1
- package/lib/generated/codecs.js +710 -2
- package/lib/generated/ops.d.ts +1 -1
- package/lib/generated/ops.js +24 -0
- package/lib/generated/types.d.ts +314 -1
- package/lib/generated/types.js +133 -1
- package/lib/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/Terra.ts +146 -16
- package/src/generated/client.ts +74 -2
- package/src/generated/codecs.ts +705 -3
- package/src/generated/ops.ts +36 -0
- package/src/generated/types.ts +556 -1
- package/src/index.ts +2 -0
package/src/generated/types.ts
CHANGED
|
@@ -17,7 +17,9 @@ export type DataCategory =
|
|
|
17
17
|
| "body"
|
|
18
18
|
| "daily"
|
|
19
19
|
| "sleep"
|
|
20
|
-
| "nutrition"
|
|
20
|
+
| "nutrition"
|
|
21
|
+
| "menstruation"
|
|
22
|
+
| "athlete"; // ios only
|
|
21
23
|
|
|
22
24
|
export const DataCategoryValues: readonly DataCategory[] = [
|
|
23
25
|
"activity",
|
|
@@ -25,6 +27,8 @@ export const DataCategoryValues: readonly DataCategory[] = [
|
|
|
25
27
|
"daily",
|
|
26
28
|
"sleep",
|
|
27
29
|
"nutrition",
|
|
30
|
+
"menstruation",
|
|
31
|
+
"athlete",
|
|
28
32
|
];
|
|
29
33
|
|
|
30
34
|
export type PermissionStatus =
|
|
@@ -55,6 +59,156 @@ export const MotionContextValues: readonly MotionContext[] = [
|
|
|
55
59
|
"active",
|
|
56
60
|
];
|
|
57
61
|
|
|
62
|
+
/**
|
|
63
|
+
* On both platforms, wire names strip HKQuantityTypeIdentifierDietary from HealthKit
|
|
64
|
+
* identifiers and lowercase the first letter. Units: kcal for energyConsumed; grams for
|
|
65
|
+
* protein, carbohydrates, the four fats, sugar and fiber; milligrams for everything else,
|
|
66
|
+
* never micrograms.
|
|
67
|
+
*/
|
|
68
|
+
export type Nutrient =
|
|
69
|
+
| "energyConsumed"
|
|
70
|
+
| "protein"
|
|
71
|
+
| "carbohydrates"
|
|
72
|
+
| "fatTotal"
|
|
73
|
+
| "fatSaturated"
|
|
74
|
+
| "fatMonounsaturated"
|
|
75
|
+
| "fatPolyunsaturated"
|
|
76
|
+
| "sugar"
|
|
77
|
+
| "fiber"
|
|
78
|
+
| "cholesterol"
|
|
79
|
+
| "sodium"
|
|
80
|
+
| "potassium"
|
|
81
|
+
| "calcium"
|
|
82
|
+
| "iron"
|
|
83
|
+
| "magnesium"
|
|
84
|
+
| "zinc"
|
|
85
|
+
| "phosphorus"
|
|
86
|
+
| "iodine"
|
|
87
|
+
| "manganese"
|
|
88
|
+
| "molybdenum"
|
|
89
|
+
| "selenium"
|
|
90
|
+
| "copper"
|
|
91
|
+
| "chromium"
|
|
92
|
+
| "chloride"
|
|
93
|
+
| "caffeine"
|
|
94
|
+
| "vitaminA"
|
|
95
|
+
| "vitaminC"
|
|
96
|
+
| "vitaminD"
|
|
97
|
+
| "vitaminE"
|
|
98
|
+
| "vitaminK"
|
|
99
|
+
| "vitaminB6"
|
|
100
|
+
| "vitaminB12"
|
|
101
|
+
| "thiamin"
|
|
102
|
+
| "riboflavin"
|
|
103
|
+
| "niacin"
|
|
104
|
+
| "folate"
|
|
105
|
+
| "biotin"
|
|
106
|
+
| "pantothenicAcid";
|
|
107
|
+
|
|
108
|
+
export const NutrientValues: readonly Nutrient[] = [
|
|
109
|
+
"energyConsumed",
|
|
110
|
+
"protein",
|
|
111
|
+
"carbohydrates",
|
|
112
|
+
"fatTotal",
|
|
113
|
+
"fatSaturated",
|
|
114
|
+
"fatMonounsaturated",
|
|
115
|
+
"fatPolyunsaturated",
|
|
116
|
+
"sugar",
|
|
117
|
+
"fiber",
|
|
118
|
+
"cholesterol",
|
|
119
|
+
"sodium",
|
|
120
|
+
"potassium",
|
|
121
|
+
"calcium",
|
|
122
|
+
"iron",
|
|
123
|
+
"magnesium",
|
|
124
|
+
"zinc",
|
|
125
|
+
"phosphorus",
|
|
126
|
+
"iodine",
|
|
127
|
+
"manganese",
|
|
128
|
+
"molybdenum",
|
|
129
|
+
"selenium",
|
|
130
|
+
"copper",
|
|
131
|
+
"chromium",
|
|
132
|
+
"chloride",
|
|
133
|
+
"caffeine",
|
|
134
|
+
"vitaminA",
|
|
135
|
+
"vitaminC",
|
|
136
|
+
"vitaminD",
|
|
137
|
+
"vitaminE",
|
|
138
|
+
"vitaminK",
|
|
139
|
+
"vitaminB6",
|
|
140
|
+
"vitaminB12",
|
|
141
|
+
"thiamin",
|
|
142
|
+
"riboflavin",
|
|
143
|
+
"niacin",
|
|
144
|
+
"folate",
|
|
145
|
+
"biotin",
|
|
146
|
+
"pantothenicAcid",
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Which meal a quantity was logged against. unknown is the store's explicit answer, not an
|
|
151
|
+
* absence: HealthKit has no meal type at all, so every iOS quantity is unknown.
|
|
152
|
+
*/
|
|
153
|
+
export type MealType =
|
|
154
|
+
| "breakfast"
|
|
155
|
+
| "lunch"
|
|
156
|
+
| "dinner"
|
|
157
|
+
| "snack"
|
|
158
|
+
| "unknown";
|
|
159
|
+
|
|
160
|
+
export const MealTypeValues: readonly MealType[] = [
|
|
161
|
+
"breakfast",
|
|
162
|
+
"lunch",
|
|
163
|
+
"dinner",
|
|
164
|
+
"snack",
|
|
165
|
+
"unknown",
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
/** How heavy a logged day's flow was. */
|
|
169
|
+
export type MenstruationFlow =
|
|
170
|
+
| "unspecified"
|
|
171
|
+
| "light"
|
|
172
|
+
| "medium"
|
|
173
|
+
| "heavy"
|
|
174
|
+
| "none";
|
|
175
|
+
|
|
176
|
+
export const MenstruationFlowValues: readonly MenstruationFlow[] = [
|
|
177
|
+
"unspecified",
|
|
178
|
+
"light",
|
|
179
|
+
"medium",
|
|
180
|
+
"heavy",
|
|
181
|
+
"none",
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
/** Available on ios only. */
|
|
185
|
+
export type BiologicalSex =
|
|
186
|
+
| "female" // ios only
|
|
187
|
+
| "male" // ios only
|
|
188
|
+
| "other" // ios only
|
|
189
|
+
| "notSet"; // ios only
|
|
190
|
+
|
|
191
|
+
export const BiologicalSexValues: readonly BiologicalSex[] = [
|
|
192
|
+
"female",
|
|
193
|
+
"male",
|
|
194
|
+
"other",
|
|
195
|
+
"notSet",
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* A move-time user's daily totals are minutes rather than active energy.
|
|
200
|
+
*
|
|
201
|
+
* Available on ios only.
|
|
202
|
+
*/
|
|
203
|
+
export type ActivityMoveMode =
|
|
204
|
+
| "activeEnergy" // ios only
|
|
205
|
+
| "appleMoveTime"; // ios only
|
|
206
|
+
|
|
207
|
+
export const ActivityMoveModeValues: readonly ActivityMoveMode[] = [
|
|
208
|
+
"activeEnergy",
|
|
209
|
+
"appleMoveTime",
|
|
210
|
+
];
|
|
211
|
+
|
|
58
212
|
/**
|
|
59
213
|
* Why background delivery is restricted. Android discloses which; Apple reports the state
|
|
60
214
|
* without a reason.
|
|
@@ -202,6 +356,167 @@ export const WorkoutSchedulingStatusValues: readonly WorkoutSchedulingStatus[] =
|
|
|
202
356
|
"authorized",
|
|
203
357
|
];
|
|
204
358
|
|
|
359
|
+
/**
|
|
360
|
+
* distance* are metres, *EnergyBurned kilocalories, flightsClimbed a count, and
|
|
361
|
+
* appleExerciseTime minutes.
|
|
362
|
+
*/
|
|
363
|
+
export type DayTotalMetric =
|
|
364
|
+
| "distanceWalkingRunning"
|
|
365
|
+
| "distanceCycling"
|
|
366
|
+
| "distanceSwimming"
|
|
367
|
+
| "distanceWheelchair"
|
|
368
|
+
| "activeEnergyBurned"
|
|
369
|
+
| "basalEnergyBurned"
|
|
370
|
+
| "flightsClimbed"
|
|
371
|
+
| "appleExerciseTime"; // ios only
|
|
372
|
+
|
|
373
|
+
export const DayTotalMetricValues: readonly DayTotalMetric[] = [
|
|
374
|
+
"distanceWalkingRunning",
|
|
375
|
+
"distanceCycling",
|
|
376
|
+
"distanceSwimming",
|
|
377
|
+
"distanceWheelchair",
|
|
378
|
+
"activeEnergyBurned",
|
|
379
|
+
"basalEnergyBurned",
|
|
380
|
+
"flightsClimbed",
|
|
381
|
+
"appleExerciseTime",
|
|
382
|
+
];
|
|
383
|
+
|
|
384
|
+
/** activeEnergy and basalEnergy are kilocalories, distance metres, floorsClimbed a count. */
|
|
385
|
+
export type IntradayMetric =
|
|
386
|
+
| "activeEnergy"
|
|
387
|
+
| "basalEnergy" // ios only
|
|
388
|
+
| "distance"
|
|
389
|
+
| "floorsClimbed";
|
|
390
|
+
|
|
391
|
+
export const IntradayMetricValues: readonly IntradayMetric[] = [
|
|
392
|
+
"activeEnergy",
|
|
393
|
+
"basalEnergy",
|
|
394
|
+
"distance",
|
|
395
|
+
"floorsClimbed",
|
|
396
|
+
];
|
|
397
|
+
|
|
398
|
+
/** speed is metres per second, power watts, cadence pedal revolutions per minute. */
|
|
399
|
+
export type WorkoutIntensityMetric =
|
|
400
|
+
| "speed"
|
|
401
|
+
| "power"
|
|
402
|
+
| "cadence";
|
|
403
|
+
|
|
404
|
+
export const WorkoutIntensityMetricValues: readonly WorkoutIntensityMetric[] = [
|
|
405
|
+
"speed",
|
|
406
|
+
"power",
|
|
407
|
+
"cadence",
|
|
408
|
+
];
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* The body composition figure a measurement carries. weight and leanBodyMass are kilograms,
|
|
412
|
+
* height centimetres, bodyFatPercentage a fraction in 0..1, bmi dimensionless.
|
|
413
|
+
*/
|
|
414
|
+
export type BodyMetric =
|
|
415
|
+
| "weight"
|
|
416
|
+
| "height"
|
|
417
|
+
| "bodyFatPercentage"
|
|
418
|
+
| "leanBodyMass"
|
|
419
|
+
| "bmi"; // ios only
|
|
420
|
+
|
|
421
|
+
export const BodyMetricValues: readonly BodyMetric[] = [
|
|
422
|
+
"weight",
|
|
423
|
+
"height",
|
|
424
|
+
"bodyFatPercentage",
|
|
425
|
+
"leanBodyMass",
|
|
426
|
+
"bmi",
|
|
427
|
+
];
|
|
428
|
+
|
|
429
|
+
/** The unit the writing app chose. Never converted on the device. */
|
|
430
|
+
export type BloodGlucoseUnit =
|
|
431
|
+
| "mg/dL"
|
|
432
|
+
| "mmol/L";
|
|
433
|
+
|
|
434
|
+
export const BloodGlucoseUnitValues: readonly BloodGlucoseUnit[] = [
|
|
435
|
+
"mg/dL",
|
|
436
|
+
"mmol/L",
|
|
437
|
+
];
|
|
438
|
+
|
|
439
|
+
/** unknown is the store saying nothing about the meal, distinct from absent. */
|
|
440
|
+
export type GlucoseMealTime =
|
|
441
|
+
| "preprandial"
|
|
442
|
+
| "postprandial"
|
|
443
|
+
| "unknown";
|
|
444
|
+
|
|
445
|
+
export const GlucoseMealTimeValues: readonly GlucoseMealTime[] = [
|
|
446
|
+
"preprandial",
|
|
447
|
+
"postprandial",
|
|
448
|
+
"unknown",
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
/** interstitial is a continuous monitor. */
|
|
452
|
+
export type GlucoseSpecimen =
|
|
453
|
+
| "capillary"
|
|
454
|
+
| "interstitial"
|
|
455
|
+
| "plasma"
|
|
456
|
+
| "serum"
|
|
457
|
+
| "tears"
|
|
458
|
+
| "wholeBlood"
|
|
459
|
+
| "unknown";
|
|
460
|
+
|
|
461
|
+
export const GlucoseSpecimenValues: readonly GlucoseSpecimen[] = [
|
|
462
|
+
"capillary",
|
|
463
|
+
"interstitial",
|
|
464
|
+
"plasma",
|
|
465
|
+
"serum",
|
|
466
|
+
"tears",
|
|
467
|
+
"wholeBlood",
|
|
468
|
+
"unknown",
|
|
469
|
+
];
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* body and basal are absolute; wrist and skin are deltas from a baseline and routinely
|
|
473
|
+
* negative.
|
|
474
|
+
*/
|
|
475
|
+
export type BodyTemperatureMetric =
|
|
476
|
+
| "body"
|
|
477
|
+
| "basal"
|
|
478
|
+
| "wrist" // ios only
|
|
479
|
+
| "skin";
|
|
480
|
+
|
|
481
|
+
export const BodyTemperatureMetricValues: readonly BodyTemperatureMetric[] = [
|
|
482
|
+
"body",
|
|
483
|
+
"basal",
|
|
484
|
+
"wrist",
|
|
485
|
+
"skin",
|
|
486
|
+
];
|
|
487
|
+
|
|
488
|
+
/** HealthKit records SDNN only and Health Connect RMSSD only; they are never one series. */
|
|
489
|
+
export type HeartRateVariabilityMetric =
|
|
490
|
+
| "sdnn"
|
|
491
|
+
| "rmssd";
|
|
492
|
+
|
|
493
|
+
export const HeartRateVariabilityMetricValues: readonly HeartRateVariabilityMetric[] = [
|
|
494
|
+
"sdnn",
|
|
495
|
+
"rmssd",
|
|
496
|
+
];
|
|
497
|
+
|
|
498
|
+
export type VO2MaxTestType =
|
|
499
|
+
| "maxExercise"
|
|
500
|
+
| "predictedSubMaxExercise"
|
|
501
|
+
| "predictedNonExercise";
|
|
502
|
+
|
|
503
|
+
export const VO2MaxTestTypeValues: readonly VO2MaxTestType[] = [
|
|
504
|
+
"maxExercise",
|
|
505
|
+
"predictedSubMaxExercise",
|
|
506
|
+
"predictedNonExercise",
|
|
507
|
+
];
|
|
508
|
+
|
|
509
|
+
export type MenstrualEventKind =
|
|
510
|
+
| "intermenstrualBleeding"
|
|
511
|
+
| "ovulationTest"
|
|
512
|
+
| "cervicalMucus";
|
|
513
|
+
|
|
514
|
+
export const MenstrualEventKindValues: readonly MenstrualEventKind[] = [
|
|
515
|
+
"intermenstrualBleeding",
|
|
516
|
+
"ovulationTest",
|
|
517
|
+
"cervicalMucus",
|
|
518
|
+
];
|
|
519
|
+
|
|
205
520
|
/**
|
|
206
521
|
* The person a connect is for. A stored link is restored only for the person it was made for;
|
|
207
522
|
* anybody else gets a fresh link. Never sent to Terra as identity.
|
|
@@ -257,6 +572,33 @@ export type StreamMessage =
|
|
|
257
572
|
| { kind: "error"; error: TerraErrorPayload }
|
|
258
573
|
| { kind: "complete" };
|
|
259
574
|
|
|
575
|
+
/**
|
|
576
|
+
* What a BodyReading measured, with the unit fixed by the variant. Blood glucose alone keeps
|
|
577
|
+
* the writer's unit.
|
|
578
|
+
*/
|
|
579
|
+
export type BodyReadingKind =
|
|
580
|
+
| { type: "measurement"; metric: BodyMetric; value: number }
|
|
581
|
+
| { type: "bloodPressure"; systolic: number; diastolic: number }
|
|
582
|
+
| { type: "bloodGlucose"; value: number; unit: BloodGlucoseUnit; mealTime?: GlucoseMealTime | undefined; specimen?: GlucoseSpecimen | undefined }
|
|
583
|
+
| { type: "oxygenSaturation"; fraction: number }
|
|
584
|
+
| { type: "temperature"; metric: BodyTemperatureMetric; celsius: number }
|
|
585
|
+
| { type: "heartRateVariability"; metric: HeartRateVariabilityMetric; milliseconds: number }
|
|
586
|
+
| { type: "respiratoryRate"; breathsPerMinute: number }
|
|
587
|
+
| { type: "vo2Max"; millilitresPerKilogramMinute: number; testType?: VO2MaxTestType | undefined };
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Apple's store is part of the OS, so it is there or the device cannot have it; Health Connect
|
|
591
|
+
* is an app a person can lack.
|
|
592
|
+
*/
|
|
593
|
+
export type StoreAvailability =
|
|
594
|
+
| { kind: "available" }
|
|
595
|
+
| { kind: "unsupportedDevice" }
|
|
596
|
+
| { kind: "providerAppMissing" }
|
|
597
|
+
| { kind: "providerAppTooOld"; installed: string }
|
|
598
|
+
| { kind: "moduleMissing" }
|
|
599
|
+
| { kind: "partnerPolicyMissing" }
|
|
600
|
+
| { kind: "featureUnavailable" };
|
|
601
|
+
|
|
260
602
|
/** Who recorded a sample. The only stable handle an app has for filtering by app or device. */
|
|
261
603
|
export interface SampleSource {
|
|
262
604
|
readonly name: string;
|
|
@@ -331,6 +673,51 @@ export interface Workout {
|
|
|
331
673
|
readonly source: SampleSource;
|
|
332
674
|
readonly userEntered: boolean;
|
|
333
675
|
readonly timeZone?: string | undefined;
|
|
676
|
+
/**
|
|
677
|
+
* ExerciseSessionRecord.title on Android; HKMetadataKeyWorkoutBrandName on Apple, which has no
|
|
678
|
+
* title field.
|
|
679
|
+
*/
|
|
680
|
+
readonly title?: string | undefined;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** Quantities of one meal share foodCorrelationId. */
|
|
684
|
+
export interface DietaryQuantity {
|
|
685
|
+
readonly id: string;
|
|
686
|
+
readonly nutrient: Nutrient;
|
|
687
|
+
readonly value: number;
|
|
688
|
+
readonly start: Date;
|
|
689
|
+
readonly end: Date;
|
|
690
|
+
readonly mealType: MealType;
|
|
691
|
+
readonly name?: string | undefined;
|
|
692
|
+
/**
|
|
693
|
+
* HealthKit's food correlation, absent for a loose quantity. Always set on Android, where it
|
|
694
|
+
* is the NutritionRecord's id - the id nutrition.delete takes for a meal this app logged.
|
|
695
|
+
*/
|
|
696
|
+
readonly foodCorrelationId?: string | undefined;
|
|
697
|
+
readonly source: SampleSource;
|
|
698
|
+
readonly userEntered: boolean;
|
|
699
|
+
readonly timeZone?: string | undefined;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/** start and end are the local midnights of that day in timeZone. */
|
|
703
|
+
export interface MenstruationFlowDay {
|
|
704
|
+
readonly id: string;
|
|
705
|
+
readonly start: Date;
|
|
706
|
+
readonly end: Date;
|
|
707
|
+
readonly flow: MenstruationFlow;
|
|
708
|
+
readonly cycleStart: boolean;
|
|
709
|
+
readonly source: SampleSource;
|
|
710
|
+
readonly userEntered: boolean;
|
|
711
|
+
readonly timeZone?: string | undefined;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** Available on ios only. */
|
|
715
|
+
export interface AthleteProfile {
|
|
716
|
+
readonly biologicalSex: BiologicalSex;
|
|
717
|
+
/** A calendar day, as HealthKit stores it, never an instant. */
|
|
718
|
+
readonly dateOfBirth?: string | undefined;
|
|
719
|
+
readonly wheelchairUse?: boolean | undefined;
|
|
720
|
+
readonly activityMoveMode?: ActivityMoveMode | undefined;
|
|
334
721
|
}
|
|
335
722
|
|
|
336
723
|
/** A day whose data changed. Carries no health value by construction. */
|
|
@@ -623,6 +1010,44 @@ export interface WorkoutList {
|
|
|
623
1010
|
readonly samples: readonly Workout[];
|
|
624
1011
|
}
|
|
625
1012
|
|
|
1013
|
+
export interface DietaryQuantityList {
|
|
1014
|
+
readonly samples: readonly DietaryQuantity[];
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
export interface MenstruationFlowDayList {
|
|
1018
|
+
readonly samples: readonly MenstruationFlowDay[];
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** A cycle event logged at an instant. */
|
|
1022
|
+
export interface MenstrualEvent {
|
|
1023
|
+
readonly id: string;
|
|
1024
|
+
readonly kind: MenstrualEventKind;
|
|
1025
|
+
readonly time: Date;
|
|
1026
|
+
/**
|
|
1027
|
+
* ovulationTest: negative, positive, high, indeterminate or luteinizingHormoneSurge.
|
|
1028
|
+
* cervicalMucus: dry, sticky, creamy, watery, eggWhite or unusual. Absent for
|
|
1029
|
+
* intermenstrualBleeding, which is a flag.
|
|
1030
|
+
*/
|
|
1031
|
+
readonly value?: string | undefined;
|
|
1032
|
+
/**
|
|
1033
|
+
* The store's own record type, passed through: OvulationTestRecord on Android,
|
|
1034
|
+
* HKCategoryTypeIdentifierOvulationTestResult on Apple.
|
|
1035
|
+
*/
|
|
1036
|
+
readonly storeIdentifier: string;
|
|
1037
|
+
readonly source: SampleSource;
|
|
1038
|
+
readonly userEntered: boolean;
|
|
1039
|
+
readonly timeZone?: string | undefined;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export interface MenstrualEventList {
|
|
1043
|
+
readonly samples: readonly MenstrualEvent[];
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/** Available on ios only. */
|
|
1047
|
+
export interface AthleteProfileResult {
|
|
1048
|
+
readonly profile?: AthleteProfile | undefined;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
626
1051
|
/** Available on ios only. */
|
|
627
1052
|
export interface PlannedWorkoutList {
|
|
628
1053
|
readonly workouts: readonly PlannedWorkout[];
|
|
@@ -665,3 +1090,133 @@ export interface NutritionEntryList {
|
|
|
665
1090
|
readonly entries: readonly NutritionEntry[];
|
|
666
1091
|
}
|
|
667
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* The store's own total for one local day, from its statistics engine. start and end are that
|
|
1095
|
+
* day's midnights.
|
|
1096
|
+
*/
|
|
1097
|
+
export interface DayTotal {
|
|
1098
|
+
readonly metric: DayTotalMetric;
|
|
1099
|
+
readonly start: Date;
|
|
1100
|
+
readonly end: Date;
|
|
1101
|
+
readonly value: number;
|
|
1102
|
+
readonly unit: string;
|
|
1103
|
+
readonly timeZone?: string | undefined;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* One record a day total is made of, as the store holds it. A record crossing midnight is
|
|
1108
|
+
* whole.
|
|
1109
|
+
*/
|
|
1110
|
+
export interface IntradaySample {
|
|
1111
|
+
readonly id: string;
|
|
1112
|
+
readonly metric: IntradayMetric;
|
|
1113
|
+
readonly start: Date;
|
|
1114
|
+
readonly end: Date;
|
|
1115
|
+
readonly value: number;
|
|
1116
|
+
readonly source: SampleSource;
|
|
1117
|
+
readonly userEntered: boolean;
|
|
1118
|
+
readonly timeZone?: string | undefined;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/** The store's own resting heart rate for a day, never derived from heart rate readings. */
|
|
1122
|
+
export interface RestingHeartRateSample {
|
|
1123
|
+
readonly id: string;
|
|
1124
|
+
readonly start: Date;
|
|
1125
|
+
readonly end: Date;
|
|
1126
|
+
readonly beatsPerMinute: number;
|
|
1127
|
+
readonly source: SampleSource;
|
|
1128
|
+
readonly userEntered: boolean;
|
|
1129
|
+
readonly timeZone?: string | undefined;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/** A point reading has start equal to end; skin and wrist temperature span a stretch. */
|
|
1133
|
+
export interface BodyReading {
|
|
1134
|
+
readonly id: string;
|
|
1135
|
+
readonly kind: BodyReadingKind;
|
|
1136
|
+
readonly start: Date;
|
|
1137
|
+
readonly end: Date;
|
|
1138
|
+
readonly source: SampleSource;
|
|
1139
|
+
readonly userEntered: boolean;
|
|
1140
|
+
readonly timeZone?: string | undefined;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
export interface RoutePoint {
|
|
1144
|
+
readonly time: Date;
|
|
1145
|
+
readonly latitude: number;
|
|
1146
|
+
readonly longitude: number;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* The GPS track a workout left, thinned to one point a second and at most 5,000 points. start
|
|
1151
|
+
* and end are the first and last point.
|
|
1152
|
+
*/
|
|
1153
|
+
export interface WorkoutRoute {
|
|
1154
|
+
readonly id: string;
|
|
1155
|
+
readonly workoutId: string;
|
|
1156
|
+
readonly start: Date;
|
|
1157
|
+
readonly end: Date;
|
|
1158
|
+
readonly points: readonly RoutePoint[];
|
|
1159
|
+
readonly source: SampleSource;
|
|
1160
|
+
readonly timeZone?: string | undefined;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/** One speed, power or cadence reading. Android's are instants, so start equals end there. */
|
|
1164
|
+
export interface WorkoutIntensitySample {
|
|
1165
|
+
readonly id: string;
|
|
1166
|
+
readonly metric: WorkoutIntensityMetric;
|
|
1167
|
+
/**
|
|
1168
|
+
* Set on Apple, where HealthKit stores a reading inside its workout. Health Connect stores
|
|
1169
|
+
* them free-standing, so Android leaves it absent rather than guessing by time.
|
|
1170
|
+
*/
|
|
1171
|
+
readonly workoutId?: string | undefined;
|
|
1172
|
+
readonly start: Date;
|
|
1173
|
+
readonly end: Date;
|
|
1174
|
+
readonly value: number;
|
|
1175
|
+
readonly source: SampleSource;
|
|
1176
|
+
readonly userEntered: boolean;
|
|
1177
|
+
readonly timeZone?: string | undefined;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/** One drink, in millilitres. */
|
|
1181
|
+
export interface HydrationSample {
|
|
1182
|
+
readonly id: string;
|
|
1183
|
+
readonly start: Date;
|
|
1184
|
+
readonly end: Date;
|
|
1185
|
+
readonly millilitres: number;
|
|
1186
|
+
readonly source: SampleSource;
|
|
1187
|
+
readonly userEntered: boolean;
|
|
1188
|
+
readonly timeZone?: string | undefined;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
export interface DayTotalList {
|
|
1192
|
+
readonly totals: readonly DayTotal[];
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
export interface IntradaySampleList {
|
|
1196
|
+
readonly samples: readonly IntradaySample[];
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
export interface RestingHeartRateList {
|
|
1200
|
+
readonly samples: readonly RestingHeartRateSample[];
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
export interface BodyReadingList {
|
|
1204
|
+
readonly samples: readonly BodyReading[];
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
export interface WorkoutRouteList {
|
|
1208
|
+
readonly routes: readonly WorkoutRoute[];
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
export interface WorkoutIntensityList {
|
|
1212
|
+
readonly samples: readonly WorkoutIntensitySample[];
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export interface HydrationList {
|
|
1216
|
+
readonly samples: readonly HydrationSample[];
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
export interface AvailabilityResult {
|
|
1220
|
+
readonly availability: StoreAvailability;
|
|
1221
|
+
}
|
|
1222
|
+
|
package/src/index.ts
CHANGED
|
@@ -17,10 +17,12 @@ export { createTerra } from "./createTerra";
|
|
|
17
17
|
export { Terra } from "./Terra";
|
|
18
18
|
export type {
|
|
19
19
|
ActivityMetrics,
|
|
20
|
+
AthleteMetrics,
|
|
20
21
|
Background,
|
|
21
22
|
BodyMetrics,
|
|
22
23
|
DailyMetrics,
|
|
23
24
|
Diagnostics,
|
|
25
|
+
MenstruationMetrics,
|
|
24
26
|
NativeBridge,
|
|
25
27
|
NutritionMetrics,
|
|
26
28
|
Permissions,
|