@tryterra/react-native 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +142 -2
- package/TerraReactNative.podspec +48 -0
- package/android/build.gradle +87 -0
- package/android/src/bridgeCore/kotlin/README.md +1 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/BridgeBootstrap.kt +133 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/BridgeHost.kt +32 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Conversions.kt +557 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/LauncherSlots.kt +41 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/ReadConversions.kt +250 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Rejections.kt +150 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/StreamRegistry.kt +77 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridge.kt +86 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeOpsImpl.kt +300 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeStreamsImpl.kt +50 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TokenBroker.kt +198 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeErrors.kt +217 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeOps.kt +582 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeTypes.kt +1569 -0
- package/android/src/healthConnectOnly/kotlin/co/tryterra/sdk/reactnative/TerraStores.kt +11 -0
- package/android/src/main/AndroidManifest.xml +24 -0
- package/android/src/main/java/co/tryterra/sdk/reactnative/TerraBridgeModule.kt +96 -0
- package/android/src/main/java/co/tryterra/sdk/reactnative/TerraReactNativePackage.kt +26 -0
- package/android/src/main/java/co/tryterra/sdk/reactnative/TerraStartup.kt +46 -0
- package/android/src/samsung/kotlin/co/tryterra/sdk/reactnative/TerraStores.kt +13 -0
- package/docs/availability.md +396 -0
- package/frameworks/TerraSDK.xcframework/Info.plist +48 -0
- 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 +82672 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +2186 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +2186 -0
- 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 +2163 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/PrivacyInfo.xcprivacy +96 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/TerraSDK +0 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +20 -0
- 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 +6594 -0
- 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 +82672 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +2186 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2186 -0
- 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 +2163 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +82672 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +2186 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2186 -0
- 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 +2163 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/PrivacyInfo.xcprivacy +96 -0
- 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 +223 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Info.plist +20 -0
- 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 +6595 -0
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/TerraSDK.yml +6513 -0
- package/ios/TerraBridgeCore/BridgeBootstrap.swift +89 -0
- package/ios/TerraBridgeCore/BridgeHost.swift +13 -0
- package/ios/TerraBridgeCore/Conversions+Reads.swift +259 -0
- package/ios/TerraBridgeCore/Conversions.swift +594 -0
- package/ios/TerraBridgeCore/Generated/BridgeErrors.swift +179 -0
- package/ios/TerraBridgeCore/Generated/BridgeOps.swift +967 -0
- package/ios/TerraBridgeCore/Generated/BridgeTypes.swift +2050 -0
- package/ios/TerraBridgeCore/Locked.swift +15 -0
- package/ios/TerraBridgeCore/README.md +1 -0
- package/ios/TerraBridgeCore/Rejections.swift +130 -0
- package/ios/TerraBridgeCore/RuntimeAttachment.swift +60 -0
- package/ios/TerraBridgeCore/StreamRegistry.swift +59 -0
- package/ios/TerraBridgeCore/TerraBridge.swift +122 -0
- package/ios/TerraBridgeCore/TerraBridgeOpsImpl.swift +318 -0
- package/ios/TerraBridgeCore/TerraBridgeStreamsImpl.swift +60 -0
- package/ios/TerraBridgeCore/TokenBroker.swift +147 -0
- package/ios/TerraBridgeModule.mm +79 -0
- package/ios/TerraBridgeModuleImpl.swift +49 -0
- package/ios/TerraReactNative.swift +19 -0
- package/lib/EndUser.d.ts +12 -0
- package/lib/EndUser.js +13 -0
- package/lib/NativeTerraBridge.d.ts +23 -0
- package/lib/NativeTerraBridge.js +13 -0
- package/lib/Terra.d.ts +223 -0
- package/lib/Terra.js +336 -0
- package/lib/TerraError.d.ts +42 -0
- package/lib/TerraError.js +95 -0
- package/lib/createTerra.d.ts +8 -0
- package/lib/createTerra.js +19 -0
- package/lib/generated/client.d.ts +128 -0
- package/lib/generated/client.js +256 -0
- package/lib/generated/codecs.d.ts +219 -0
- package/lib/generated/codecs.js +2066 -0
- package/lib/generated/errors.d.ts +13 -0
- package/lib/generated/errors.js +68 -0
- package/lib/generated/ops.d.ts +13 -0
- package/lib/generated/ops.js +161 -0
- package/lib/generated/streams.d.ts +23 -0
- package/lib/generated/streams.js +58 -0
- package/lib/generated/types.d.ts +794 -0
- package/lib/generated/types.js +224 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.js +55 -0
- package/package.json +71 -4
- package/src/EndUser.ts +15 -0
- package/src/NativeTerraBridge.ts +27 -0
- package/src/Terra.ts +592 -0
- package/src/TerraError.ts +116 -0
- package/src/createTerra.ts +18 -0
- package/src/generated/client.ts +315 -0
- package/src/generated/codecs.ts +1989 -0
- package/src/generated/errors.ts +113 -0
- package/src/generated/ops.ts +233 -0
- package/src/generated/streams.ts +74 -0
- package/src/generated/types.ts +1222 -0
- package/src/index.ts +54 -0
|
@@ -0,0 +1,1222 @@
|
|
|
1
|
+
// Generated from surface/terra-surface.json by surface/gen. Do not edit by hand.
|
|
2
|
+
// Regenerate with: node surface/gen/src/cli.ts generate
|
|
3
|
+
|
|
4
|
+
/** A health store the SDK can link. One connection per source per device. */
|
|
5
|
+
export type Source =
|
|
6
|
+
| "health"
|
|
7
|
+
| "samsungHealth"; // android only
|
|
8
|
+
|
|
9
|
+
export const SourceValues: readonly Source[] = [
|
|
10
|
+
"health",
|
|
11
|
+
"samsungHealth",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/** The unit permissions are asked for and changes are reported against. */
|
|
15
|
+
export type DataCategory =
|
|
16
|
+
| "activity"
|
|
17
|
+
| "body"
|
|
18
|
+
| "daily"
|
|
19
|
+
| "sleep"
|
|
20
|
+
| "nutrition"
|
|
21
|
+
| "menstruation"
|
|
22
|
+
| "athlete"; // ios only
|
|
23
|
+
|
|
24
|
+
export const DataCategoryValues: readonly DataCategory[] = [
|
|
25
|
+
"activity",
|
|
26
|
+
"body",
|
|
27
|
+
"daily",
|
|
28
|
+
"sleep",
|
|
29
|
+
"nutrition",
|
|
30
|
+
"menstruation",
|
|
31
|
+
"athlete",
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export type PermissionStatus =
|
|
35
|
+
| "granted"
|
|
36
|
+
| "denied"
|
|
37
|
+
| "notDetermined"
|
|
38
|
+
| "notDisclosed"
|
|
39
|
+
| "unsupported"
|
|
40
|
+
| "unavailable"; // ios only
|
|
41
|
+
|
|
42
|
+
export const PermissionStatusValues: readonly PermissionStatus[] = [
|
|
43
|
+
"granted",
|
|
44
|
+
"denied",
|
|
45
|
+
"notDetermined",
|
|
46
|
+
"notDisclosed",
|
|
47
|
+
"unsupported",
|
|
48
|
+
"unavailable",
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export type MotionContext =
|
|
52
|
+
| "unknown"
|
|
53
|
+
| "sedentary"
|
|
54
|
+
| "active";
|
|
55
|
+
|
|
56
|
+
export const MotionContextValues: readonly MotionContext[] = [
|
|
57
|
+
"unknown",
|
|
58
|
+
"sedentary",
|
|
59
|
+
"active",
|
|
60
|
+
];
|
|
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
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Why background delivery is restricted. Android discloses which; Apple reports the state
|
|
214
|
+
* without a reason.
|
|
215
|
+
*
|
|
216
|
+
* Available on android only.
|
|
217
|
+
*/
|
|
218
|
+
export type BackgroundRestrictionReason =
|
|
219
|
+
| "oemRestricted" // android only
|
|
220
|
+
| "backgroundReadDenied" // android only
|
|
221
|
+
| "healthConnectFeatureUnavailable" // android only
|
|
222
|
+
| "storeFeatureUnavailable" // android only
|
|
223
|
+
| "ticksNotRunning"; // android only
|
|
224
|
+
|
|
225
|
+
export const BackgroundRestrictionReasonValues: readonly BackgroundRestrictionReason[] = [
|
|
226
|
+
"oemRestricted",
|
|
227
|
+
"backgroundReadDenied",
|
|
228
|
+
"healthConnectFeatureUnavailable",
|
|
229
|
+
"storeFeatureUnavailable",
|
|
230
|
+
"ticksNotRunning",
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
export type DiagnosticsReason =
|
|
234
|
+
| "uploadFailed"
|
|
235
|
+
| "backfillAbandoned"
|
|
236
|
+
| "backgroundObservationUnavailable"
|
|
237
|
+
| "backgroundRestricted"
|
|
238
|
+
| "backgroundRefreshUnscheduled"
|
|
239
|
+
| "quiet"
|
|
240
|
+
| "requested";
|
|
241
|
+
|
|
242
|
+
export const DiagnosticsReasonValues: readonly DiagnosticsReason[] = [
|
|
243
|
+
"uploadFailed",
|
|
244
|
+
"backfillAbandoned",
|
|
245
|
+
"backgroundObservationUnavailable",
|
|
246
|
+
"backgroundRestricted",
|
|
247
|
+
"backgroundRefreshUnscheduled",
|
|
248
|
+
"quiet",
|
|
249
|
+
"requested",
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
export type DeviceKeyRevokeOutcome =
|
|
253
|
+
| "revoked"
|
|
254
|
+
| "alreadyRevoked"
|
|
255
|
+
| "routeAbsent";
|
|
256
|
+
|
|
257
|
+
export const DeviceKeyRevokeOutcomeValues: readonly DeviceKeyRevokeOutcome[] = [
|
|
258
|
+
"revoked",
|
|
259
|
+
"alreadyRevoked",
|
|
260
|
+
"routeAbsent",
|
|
261
|
+
];
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The redacted error name an event carries. Deliberately not TerraErrorCode: an event names
|
|
265
|
+
* the failure without the detail bag, because a support report leaves the device.
|
|
266
|
+
*/
|
|
267
|
+
export type FailureCode =
|
|
268
|
+
| "healthDataUnavailable"
|
|
269
|
+
| "notConnected"
|
|
270
|
+
| "tokenUnavailable"
|
|
271
|
+
| "tokenRejected"
|
|
272
|
+
| "tokenProviderFailed"
|
|
273
|
+
| "offline"
|
|
274
|
+
| "timedOut"
|
|
275
|
+
| "serverError"
|
|
276
|
+
| "transport"
|
|
277
|
+
| "malformedResponse"
|
|
278
|
+
| "userLimitReached"
|
|
279
|
+
| "upgradeRequired"
|
|
280
|
+
| "platform"
|
|
281
|
+
| "deviceKeyUnavailable"
|
|
282
|
+
| "signatureRejected"
|
|
283
|
+
| "linkRevoked"
|
|
284
|
+
| "linkConflict"
|
|
285
|
+
| "clockSkewed"
|
|
286
|
+
| "devIDMismatch"
|
|
287
|
+
| "syncAlreadyRunning"
|
|
288
|
+
| "linkAlreadyRunning"
|
|
289
|
+
| "storeLocked"
|
|
290
|
+
| "storeUnreadable"
|
|
291
|
+
| "deadlineExceeded"
|
|
292
|
+
| "permissionDenied"
|
|
293
|
+
| "authorizationNotDetermined"
|
|
294
|
+
| "sampleNotFound"
|
|
295
|
+
| "rollbackIncomplete"
|
|
296
|
+
| "distanceNotAttributable"
|
|
297
|
+
| "bloodPressureIncomplete"
|
|
298
|
+
| "authorizationUnavailableInExtension"
|
|
299
|
+
| "routeAwaitingConverter"
|
|
300
|
+
| "readQuotaExceeded" // android only
|
|
301
|
+
| "plannedWorkoutUnnamed"; // ios only
|
|
302
|
+
|
|
303
|
+
export const FailureCodeValues: readonly FailureCode[] = [
|
|
304
|
+
"healthDataUnavailable",
|
|
305
|
+
"notConnected",
|
|
306
|
+
"tokenUnavailable",
|
|
307
|
+
"tokenRejected",
|
|
308
|
+
"tokenProviderFailed",
|
|
309
|
+
"offline",
|
|
310
|
+
"timedOut",
|
|
311
|
+
"serverError",
|
|
312
|
+
"transport",
|
|
313
|
+
"malformedResponse",
|
|
314
|
+
"userLimitReached",
|
|
315
|
+
"upgradeRequired",
|
|
316
|
+
"platform",
|
|
317
|
+
"deviceKeyUnavailable",
|
|
318
|
+
"signatureRejected",
|
|
319
|
+
"linkRevoked",
|
|
320
|
+
"linkConflict",
|
|
321
|
+
"clockSkewed",
|
|
322
|
+
"devIDMismatch",
|
|
323
|
+
"syncAlreadyRunning",
|
|
324
|
+
"linkAlreadyRunning",
|
|
325
|
+
"storeLocked",
|
|
326
|
+
"storeUnreadable",
|
|
327
|
+
"deadlineExceeded",
|
|
328
|
+
"permissionDenied",
|
|
329
|
+
"authorizationNotDetermined",
|
|
330
|
+
"sampleNotFound",
|
|
331
|
+
"rollbackIncomplete",
|
|
332
|
+
"distanceNotAttributable",
|
|
333
|
+
"bloodPressureIncomplete",
|
|
334
|
+
"authorizationUnavailableInExtension",
|
|
335
|
+
"routeAwaitingConverter",
|
|
336
|
+
"readQuotaExceeded",
|
|
337
|
+
"plannedWorkoutUnnamed",
|
|
338
|
+
];
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Whether Terra's plans can be put on the person's Apple Watch. unsupported before iOS 17 or
|
|
342
|
+
* where WorkoutKit cannot schedule.
|
|
343
|
+
*
|
|
344
|
+
* Available on ios only.
|
|
345
|
+
*/
|
|
346
|
+
export type WorkoutSchedulingStatus =
|
|
347
|
+
| "unsupported" // ios only
|
|
348
|
+
| "notDetermined" // ios only
|
|
349
|
+
| "denied" // ios only
|
|
350
|
+
| "authorized"; // ios only
|
|
351
|
+
|
|
352
|
+
export const WorkoutSchedulingStatusValues: readonly WorkoutSchedulingStatus[] = [
|
|
353
|
+
"unsupported",
|
|
354
|
+
"notDetermined",
|
|
355
|
+
"denied",
|
|
356
|
+
"authorized",
|
|
357
|
+
];
|
|
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
|
+
|
|
520
|
+
/**
|
|
521
|
+
* The person a connect is for. A stored link is restored only for the person it was made for;
|
|
522
|
+
* anybody else gets a fresh link. Never sent to Terra as identity.
|
|
523
|
+
*/
|
|
524
|
+
export type EndUser =
|
|
525
|
+
| { kind: "reference"; id: string }
|
|
526
|
+
| { kind: "anonymous" };
|
|
527
|
+
|
|
528
|
+
/** A half-open window [start, end). Resolved against the device's calendar natively. */
|
|
529
|
+
export type TimeRange =
|
|
530
|
+
| { kind: "lastHours"; hours: number }
|
|
531
|
+
| { kind: "lastDays"; days: number }
|
|
532
|
+
| { kind: "today" }
|
|
533
|
+
| { kind: "between"; start: Date; end: Date };
|
|
534
|
+
|
|
535
|
+
export type SleepStage =
|
|
536
|
+
| { kind: "inBed" }
|
|
537
|
+
| { kind: "awake" }
|
|
538
|
+
| { kind: "asleep" }
|
|
539
|
+
| { kind: "light" }
|
|
540
|
+
| { kind: "deep" }
|
|
541
|
+
| { kind: "rem" }
|
|
542
|
+
| { kind: "unknown"; raw: string };
|
|
543
|
+
|
|
544
|
+
export type WorkoutActivity =
|
|
545
|
+
| { kind: "running" }
|
|
546
|
+
| { kind: "walking" }
|
|
547
|
+
| { kind: "cycling" }
|
|
548
|
+
| { kind: "swimming" }
|
|
549
|
+
| { kind: "strengthTraining" }
|
|
550
|
+
| { kind: "other"; label: string };
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* What the SDK believes about delivery right now. Wire spelling matches DiagnosticsWire.state
|
|
554
|
+
* and Apple's DiagnosticsState Encodable.
|
|
555
|
+
*/
|
|
556
|
+
export type DiagnosticsState =
|
|
557
|
+
| { state: "healthy" }
|
|
558
|
+
| { state: "quiet"; since: Date }
|
|
559
|
+
| { state: "backgroundRestricted"; reason?: BackgroundRestrictionReason | undefined }
|
|
560
|
+
| { state: "backgroundRefreshUnscheduled" }
|
|
561
|
+
| { state: "pendingRetry" }
|
|
562
|
+
| { state: "linkRevoked" }
|
|
563
|
+
| { state: "devIDMismatch" };
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* What a subscription delivers. A stream can fail or finish, and without saying so the
|
|
567
|
+
* framework layer has to invent a convention for both - two of those, one per wrapper, is a
|
|
568
|
+
* contract nobody wrote down.
|
|
569
|
+
*/
|
|
570
|
+
export type StreamMessage =
|
|
571
|
+
| { kind: "data"; element: Record<string, unknown> }
|
|
572
|
+
| { kind: "error"; error: TerraErrorPayload }
|
|
573
|
+
| { kind: "complete" };
|
|
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
|
+
|
|
602
|
+
/** Who recorded a sample. The only stable handle an app has for filtering by app or device. */
|
|
603
|
+
export interface SampleSource {
|
|
604
|
+
readonly name: string;
|
|
605
|
+
readonly bundleId: string;
|
|
606
|
+
readonly productType?: string | undefined;
|
|
607
|
+
readonly deviceType?: string | undefined;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* A link record. A value, not a handle: Apple's Connection carries sync and disconnect
|
|
612
|
+
* methods, and an object with behaviour cannot cross the bridge, so those are ops on the
|
|
613
|
+
* client.
|
|
614
|
+
*/
|
|
615
|
+
export interface Connection {
|
|
616
|
+
readonly source: Source;
|
|
617
|
+
readonly userId: string;
|
|
618
|
+
/**
|
|
619
|
+
* Android's StoredConnection carries the store-side id. Apple's Connection does not.
|
|
620
|
+
*
|
|
621
|
+
* Available on android only.
|
|
622
|
+
*/
|
|
623
|
+
readonly providerUserId?: string | undefined;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface HeartRateSample {
|
|
627
|
+
readonly id: string;
|
|
628
|
+
readonly time: Date;
|
|
629
|
+
readonly beatsPerMinute: number;
|
|
630
|
+
readonly source: SampleSource;
|
|
631
|
+
readonly motionContext?: MotionContext | undefined;
|
|
632
|
+
readonly userEntered: boolean;
|
|
633
|
+
readonly timeZone?: string | undefined;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* A step total over an interval. Apple derives the id from the source and start; Android
|
|
638
|
+
* carries a RecordId when it has one, so the id is optional on the wire.
|
|
639
|
+
*/
|
|
640
|
+
export interface StepCount {
|
|
641
|
+
readonly id?: string | undefined;
|
|
642
|
+
readonly start: Date;
|
|
643
|
+
readonly end: Date;
|
|
644
|
+
readonly steps: number;
|
|
645
|
+
readonly source: SampleSource;
|
|
646
|
+
readonly userEntered: boolean;
|
|
647
|
+
readonly timeZone?: string | undefined;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export interface SleepSegment {
|
|
651
|
+
readonly id: string;
|
|
652
|
+
readonly start: Date;
|
|
653
|
+
readonly end: Date;
|
|
654
|
+
readonly stage: SleepStage;
|
|
655
|
+
readonly source: SampleSource;
|
|
656
|
+
readonly userEntered: boolean;
|
|
657
|
+
readonly timeZone?: string | undefined;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* indoor is optional because Health Connect does not always record it; Apple always has an
|
|
662
|
+
* answer.
|
|
663
|
+
*/
|
|
664
|
+
export interface Workout {
|
|
665
|
+
readonly id: string;
|
|
666
|
+
readonly start: Date;
|
|
667
|
+
readonly end: Date;
|
|
668
|
+
readonly activity: WorkoutActivity;
|
|
669
|
+
readonly activityTypeCode: number;
|
|
670
|
+
readonly indoor?: boolean | undefined;
|
|
671
|
+
readonly activeEnergyKilocalories?: number | undefined;
|
|
672
|
+
readonly distanceMeters?: number | undefined;
|
|
673
|
+
readonly source: SampleSource;
|
|
674
|
+
readonly userEntered: boolean;
|
|
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;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/** A day whose data changed. Carries no health value by construction. */
|
|
724
|
+
export interface HealthChange {
|
|
725
|
+
readonly category: DataCategory;
|
|
726
|
+
readonly day: string;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export interface WorkoutScope {
|
|
730
|
+
readonly activity: WorkoutActivity;
|
|
731
|
+
readonly energy: boolean;
|
|
732
|
+
readonly distance: boolean;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Lists rather than sets: JSON has no set, so the category lists are marked `set` and every
|
|
737
|
+
* generated codec de-duplicates and sorts them, so two orderings compare equal.
|
|
738
|
+
*/
|
|
739
|
+
export interface HealthAccess {
|
|
740
|
+
readonly read: readonly DataCategory[];
|
|
741
|
+
readonly write: readonly DataCategory[];
|
|
742
|
+
readonly workouts: readonly WorkoutScope[];
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
export interface HeartRateEntry {
|
|
746
|
+
readonly time: Date;
|
|
747
|
+
readonly beatsPerMinute: number;
|
|
748
|
+
readonly recordId?: string | undefined;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export interface StepEntry {
|
|
752
|
+
readonly start: Date;
|
|
753
|
+
readonly end: Date;
|
|
754
|
+
readonly steps: number;
|
|
755
|
+
readonly recordId?: string | undefined;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
export interface SleepEntry {
|
|
759
|
+
readonly start: Date;
|
|
760
|
+
readonly end: Date;
|
|
761
|
+
readonly stage: SleepStage;
|
|
762
|
+
readonly recordId?: string | undefined;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface WorkoutEntry {
|
|
766
|
+
readonly start: Date;
|
|
767
|
+
readonly end: Date;
|
|
768
|
+
readonly activity: WorkoutActivity;
|
|
769
|
+
readonly totalEnergyKilocalories?: number | undefined;
|
|
770
|
+
readonly totalDistanceMeters?: number | undefined;
|
|
771
|
+
readonly recordId?: string | undefined;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
export interface BodyEntry {
|
|
775
|
+
readonly time: Date;
|
|
776
|
+
readonly bodyMassKilograms?: number | undefined;
|
|
777
|
+
readonly bodyFatPercent?: number | undefined;
|
|
778
|
+
readonly bodyMassIndex?: number | undefined;
|
|
779
|
+
readonly heightMeters?: number | undefined;
|
|
780
|
+
readonly leanBodyMassKilograms?: number | undefined;
|
|
781
|
+
readonly bodyTemperatureCelsius?: number | undefined;
|
|
782
|
+
readonly oxygenSaturationPercent?: number | undefined;
|
|
783
|
+
readonly bloodGlucoseMilligramsPerDeciliter?: number | undefined;
|
|
784
|
+
readonly bloodPressureSystolicMillimetersOfMercury?: number | undefined;
|
|
785
|
+
readonly bloodPressureDiastolicMillimetersOfMercury?: number | undefined;
|
|
786
|
+
readonly recordId?: string | undefined;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Every field optional and every unit in the name, matching NutritionEntry.Nutrients on both
|
|
791
|
+
* platforms field for field.
|
|
792
|
+
*/
|
|
793
|
+
export interface Nutrients {
|
|
794
|
+
readonly energyKilocalories?: number | undefined;
|
|
795
|
+
readonly proteinGrams?: number | undefined;
|
|
796
|
+
readonly carbohydratesGrams?: number | undefined;
|
|
797
|
+
readonly fiberGrams?: number | undefined;
|
|
798
|
+
readonly sugarGrams?: number | undefined;
|
|
799
|
+
readonly fatTotalGrams?: number | undefined;
|
|
800
|
+
readonly fatSaturatedGrams?: number | undefined;
|
|
801
|
+
readonly fatMonounsaturatedGrams?: number | undefined;
|
|
802
|
+
readonly fatPolyunsaturatedGrams?: number | undefined;
|
|
803
|
+
readonly cholesterolMilligrams?: number | undefined;
|
|
804
|
+
readonly sodiumMilligrams?: number | undefined;
|
|
805
|
+
readonly potassiumMilligrams?: number | undefined;
|
|
806
|
+
readonly calciumMilligrams?: number | undefined;
|
|
807
|
+
readonly ironMilligrams?: number | undefined;
|
|
808
|
+
readonly magnesiumMilligrams?: number | undefined;
|
|
809
|
+
readonly zincMilligrams?: number | undefined;
|
|
810
|
+
readonly waterLiters?: number | undefined;
|
|
811
|
+
readonly caffeineMilligrams?: number | undefined;
|
|
812
|
+
readonly vitaminAMicrograms?: number | undefined;
|
|
813
|
+
readonly vitaminCMilligrams?: number | undefined;
|
|
814
|
+
readonly vitaminDMicrograms?: number | undefined;
|
|
815
|
+
readonly vitaminEMilligrams?: number | undefined;
|
|
816
|
+
readonly vitaminKMicrograms?: number | undefined;
|
|
817
|
+
readonly vitaminB6Milligrams?: number | undefined;
|
|
818
|
+
readonly vitaminB12Micrograms?: number | undefined;
|
|
819
|
+
readonly folateMicrograms?: number | undefined;
|
|
820
|
+
readonly thiaminMilligrams?: number | undefined;
|
|
821
|
+
readonly riboflavinMilligrams?: number | undefined;
|
|
822
|
+
readonly niacinMilligrams?: number | undefined;
|
|
823
|
+
readonly biotinMicrograms?: number | undefined;
|
|
824
|
+
readonly pantothenicAcidMilligrams?: number | undefined;
|
|
825
|
+
readonly phosphorusMilligrams?: number | undefined;
|
|
826
|
+
readonly iodineMicrograms?: number | undefined;
|
|
827
|
+
readonly chromiumMicrograms?: number | undefined;
|
|
828
|
+
readonly copperMilligrams?: number | undefined;
|
|
829
|
+
readonly manganeseMilligrams?: number | undefined;
|
|
830
|
+
readonly molybdenumMicrograms?: number | undefined;
|
|
831
|
+
readonly seleniumMicrograms?: number | undefined;
|
|
832
|
+
readonly chlorideMilligrams?: number | undefined;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
export interface NutritionEntry {
|
|
836
|
+
readonly start: Date;
|
|
837
|
+
readonly end: Date;
|
|
838
|
+
readonly name?: string | undefined;
|
|
839
|
+
readonly nutrients: Nutrients;
|
|
840
|
+
readonly recordId?: string | undefined;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* An error carried as a value rather than thrown, inside a sync result. The same shape the
|
|
845
|
+
* bridge rejects a promise with.
|
|
846
|
+
*/
|
|
847
|
+
export interface TerraErrorPayload {
|
|
848
|
+
readonly code: string;
|
|
849
|
+
readonly retryable: boolean;
|
|
850
|
+
readonly message: string;
|
|
851
|
+
readonly source?: Source | undefined;
|
|
852
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/** Available on ios only. */
|
|
856
|
+
export interface PlannedWorkout {
|
|
857
|
+
readonly id: string;
|
|
858
|
+
readonly plannedOn: string;
|
|
859
|
+
readonly activity: WorkoutActivity;
|
|
860
|
+
readonly title?: string | undefined;
|
|
861
|
+
readonly completedAt?: Date | undefined;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* The flat object both SDKs already emit: `at`, `event`, and whatever keys that kind carries.
|
|
866
|
+
* Carried through unchanged rather than reshaped, because reshaping it would be a hand-written
|
|
867
|
+
* second contract on each platform that no vector could pin - and the encoding it would be
|
|
868
|
+
* translating is one DiagnosticsWire and Apple's Encodable already agree on, and that
|
|
869
|
+
* EventPrivacyTest already guards against carrying a health value.
|
|
870
|
+
*/
|
|
871
|
+
export type TerraEvent = Record<string, unknown>;
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* The redacted report, carried as the wire object DiagnosticsWire.report and Apple's
|
|
875
|
+
* SupportReport.json already produce.
|
|
876
|
+
*/
|
|
877
|
+
export interface SupportReport {
|
|
878
|
+
readonly sdkVersion: string;
|
|
879
|
+
readonly generatedAt: Date;
|
|
880
|
+
readonly state: DiagnosticsState;
|
|
881
|
+
readonly lastDelivery?: Date | undefined;
|
|
882
|
+
readonly isConnected: boolean;
|
|
883
|
+
readonly requestedCategories: readonly string[];
|
|
884
|
+
readonly requestedWrites: readonly string[];
|
|
885
|
+
readonly requestedWorkouts: readonly string[];
|
|
886
|
+
readonly recentEvents: readonly TerraEvent[];
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* What the JS side needs to know about the native client it is attaching to. bootstrapped
|
|
891
|
+
* false is a host setup bug, and the wrapper says so with the exact line to add.
|
|
892
|
+
*/
|
|
893
|
+
export interface BootstrapState {
|
|
894
|
+
readonly bootstrapped: boolean;
|
|
895
|
+
readonly devId?: string | undefined;
|
|
896
|
+
readonly platform: string;
|
|
897
|
+
readonly sdkVersion: string;
|
|
898
|
+
readonly backgroundRegistered: boolean;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* The broker asking JS for a link token. Answered by token.resolve or token.reject with the
|
|
903
|
+
* same requestId.
|
|
904
|
+
*/
|
|
905
|
+
export interface TokenRequest {
|
|
906
|
+
readonly requestId: string;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/** No request fields, or no response value. */
|
|
910
|
+
export type Empty = Record<string, never>;
|
|
911
|
+
|
|
912
|
+
export interface SourceRequest {
|
|
913
|
+
readonly source?: Source | undefined;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
export interface RangeRequest {
|
|
917
|
+
readonly range: TimeRange;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
export interface CategoryRequest {
|
|
921
|
+
readonly category: DataCategory;
|
|
922
|
+
readonly source?: Source | undefined;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
export interface RecordIdRequest {
|
|
926
|
+
readonly id: string;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export interface ConnectRequest {
|
|
930
|
+
readonly source?: Source | undefined;
|
|
931
|
+
readonly endUser: EndUser;
|
|
932
|
+
/**
|
|
933
|
+
* A grant already in hand, from a QR code or a deep link. Absent means the token provider is
|
|
934
|
+
* asked.
|
|
935
|
+
*/
|
|
936
|
+
readonly token?: string | undefined;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export interface PermissionRequest {
|
|
940
|
+
readonly read: readonly DataCategory[];
|
|
941
|
+
readonly write: readonly DataCategory[];
|
|
942
|
+
readonly workouts: readonly WorkoutScope[];
|
|
943
|
+
readonly source?: Source | undefined;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* What the sheet granted. Android answers with the access this call obtained; HealthKit will
|
|
948
|
+
* not report read grants, so Apple answers nothing at all.
|
|
949
|
+
*/
|
|
950
|
+
export interface PermissionGrant {
|
|
951
|
+
/** Available on android only. */
|
|
952
|
+
readonly granted?: HealthAccess | undefined;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
export interface TokenResolveRequest {
|
|
956
|
+
readonly requestId: string;
|
|
957
|
+
readonly token: string;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export interface TokenRejectRequest {
|
|
961
|
+
readonly requestId: string;
|
|
962
|
+
readonly message: string;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export interface TokenProviderRequest {
|
|
966
|
+
readonly present: boolean;
|
|
967
|
+
readonly timeoutMs: number;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/** Available on ios only. */
|
|
971
|
+
export interface MarkCompleteRequest {
|
|
972
|
+
readonly id: string;
|
|
973
|
+
readonly at?: Date | undefined;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export interface BoolResult {
|
|
977
|
+
readonly value: boolean;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export interface StatusResult {
|
|
981
|
+
readonly status: PermissionStatus;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/** Available on android only. */
|
|
985
|
+
export interface StatusesResult {
|
|
986
|
+
readonly statuses: Partial<Record<DataCategory, PermissionStatus>>;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export interface RecordIdList {
|
|
990
|
+
readonly ids: readonly string[];
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export interface ConnectionList {
|
|
994
|
+
readonly connections: readonly Connection[];
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
export interface HeartRateList {
|
|
998
|
+
readonly samples: readonly HeartRateSample[];
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export interface StepCountList {
|
|
1002
|
+
readonly samples: readonly StepCount[];
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
export interface SleepSegmentList {
|
|
1006
|
+
readonly samples: readonly SleepSegment[];
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
export interface WorkoutList {
|
|
1010
|
+
readonly samples: readonly Workout[];
|
|
1011
|
+
}
|
|
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
|
+
|
|
1051
|
+
/** Available on ios only. */
|
|
1052
|
+
export interface PlannedWorkoutList {
|
|
1053
|
+
readonly workouts: readonly PlannedWorkout[];
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Once authorized, every sync run keeps the Watch schedule in step with Terra.
|
|
1058
|
+
*
|
|
1059
|
+
* Available on ios only.
|
|
1060
|
+
*/
|
|
1061
|
+
export interface WorkoutScheduling {
|
|
1062
|
+
readonly status: WorkoutSchedulingStatus;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
export interface LastDeliveryResult {
|
|
1066
|
+
readonly at?: Date | undefined;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
export interface HeartRateEntryList {
|
|
1070
|
+
readonly entries: readonly HeartRateEntry[];
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
export interface BodyEntryList {
|
|
1074
|
+
readonly entries: readonly BodyEntry[];
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
export interface StepEntryList {
|
|
1078
|
+
readonly entries: readonly StepEntry[];
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
export interface SleepEntryList {
|
|
1082
|
+
readonly entries: readonly SleepEntry[];
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
export interface WorkoutEntryList {
|
|
1086
|
+
readonly entries: readonly WorkoutEntry[];
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
export interface NutritionEntryList {
|
|
1090
|
+
readonly entries: readonly NutritionEntry[];
|
|
1091
|
+
}
|
|
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
|
+
|