@tryterra/react-native 2.2.1 → 2.3.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 +68 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/BridgeBootstrap.kt +14 -1
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Conversions.kt +35 -2
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/Rejections.kt +3 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/TerraBridgeOpsImpl.kt +33 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeErrors.kt +12 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeOps.kt +47 -0
- package/android/src/bridgeCore/kotlin/co/tryterra/sdk/bridge/generated/BridgeTypes.kt +348 -0
- package/docs/availability.md +111 -1
- 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 +21646 -9224
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.package.swiftinterface +351 -14
- package/frameworks/TerraSDK.xcframework/ios-arm64/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +351 -14
- 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 +339 -13
- 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 +7449 -6589
- 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 +21646 -9224
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +351 -14
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +351 -14
- 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 +339 -13
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +21646 -9224
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +351 -14
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/TerraSDK.framework/Modules/TerraSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +351 -14
- 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 +339 -13
- 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 +7450 -6590
- package/frameworks/TerraSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/TerraSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/TerraSDK.yml +7359 -6508
- package/ios/TerraBridgeCore/BridgeBootstrap.swift +13 -3
- package/ios/TerraBridgeCore/Conversions.swift +36 -1
- package/ios/TerraBridgeCore/Generated/BridgeErrors.swift +15 -0
- package/ios/TerraBridgeCore/Generated/BridgeOps.swift +82 -0
- package/ios/TerraBridgeCore/Generated/BridgeTypes.swift +252 -3
- package/ios/TerraBridgeCore/Rejections.swift +5 -1
- package/ios/TerraBridgeCore/TerraBridgeOpsImpl.swift +32 -1
- package/lib/Terra.d.ts +47 -1
- package/lib/Terra.js +16 -0
- package/lib/generated/client.d.ts +33 -1
- package/lib/generated/client.js +42 -0
- package/lib/generated/codecs.d.ts +15 -1
- package/lib/generated/codecs.js +119 -5
- package/lib/generated/errors.d.ts +1 -1
- package/lib/generated/errors.js +6 -1
- package/lib/generated/ops.d.ts +1 -1
- package/lib/generated/ops.js +12 -0
- package/lib/generated/types.d.ts +70 -2
- package/lib/generated/types.js +101 -1
- package/lib/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/Terra.ts +64 -0
- package/src/generated/client.ts +49 -2
- package/src/generated/codecs.ts +112 -6
- package/src/generated/errors.ts +11 -1
- package/src/generated/ops.ts +17 -0
- package/src/generated/types.ts +274 -1
- package/src/index.ts +1 -0
|
@@ -143,6 +143,157 @@ public enum DataCategory: String, Codable, Sendable, CaseIterable {
|
|
|
143
143
|
///
|
|
144
144
|
/// Available on ios only.
|
|
145
145
|
case athlete = "athlete"
|
|
146
|
+
/// Apple Health Records. Opt-in: asked for only by permissions.requestClinicalRecords, on
|
|
147
|
+
/// HealthKit's own sheet, and never part of a default request. Health Connect has no
|
|
148
|
+
/// counterpart.
|
|
149
|
+
///
|
|
150
|
+
/// Available on ios only.
|
|
151
|
+
case clinicalRecord = "clinicalRecord"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/// One kind of health data, at the granularity a permission sheet can ask for it: the
|
|
155
|
+
/// type-level twin of DataCategory. permissions.request with readTypes asks for exactly these,
|
|
156
|
+
/// and from then on the SDK reads and uploads nothing else. Each dietary type is HealthKit's
|
|
157
|
+
/// HKQuantityTypeIdentifierDietary identifier less its prefix; on Health Connect they all read
|
|
158
|
+
/// NutritionRecord, and the store keeps only the requested nutrients of each meal.
|
|
159
|
+
/// healthObservation and clinicalRecord have no types. docs/sdk-reference.md lists the
|
|
160
|
+
/// HealthKit and Health Connect types behind each and the route it feeds.
|
|
161
|
+
public enum HealthDataType: String, Codable, Sendable, CaseIterable {
|
|
162
|
+
case steps = "steps"
|
|
163
|
+
case activeEnergy = "activeEnergy"
|
|
164
|
+
/// HealthKit's basalEnergyBurned; Health Connect's BasalMetabolicRateRecord, which the daily
|
|
165
|
+
/// route totals into basal energy.
|
|
166
|
+
case basalEnergy = "basalEnergy"
|
|
167
|
+
/// Every distance the store records. HealthKit splits it by activity; Health Connect holds one
|
|
168
|
+
/// undifferentiated DistanceRecord.
|
|
169
|
+
case distance = "distance"
|
|
170
|
+
case floorsClimbed = "floorsClimbed"
|
|
171
|
+
/// Available on ios only.
|
|
172
|
+
case swimmingStrokes = "swimmingStrokes"
|
|
173
|
+
/// Available on ios only.
|
|
174
|
+
case exerciseTime = "exerciseTime"
|
|
175
|
+
/// Available on ios only.
|
|
176
|
+
case moveTime = "moveTime"
|
|
177
|
+
/// Apple's stand minutes, and the stand hours HealthKit's activity summary counts.
|
|
178
|
+
///
|
|
179
|
+
/// Available on ios only.
|
|
180
|
+
case standTime = "standTime"
|
|
181
|
+
case heartRate = "heartRate"
|
|
182
|
+
case restingHeartRate = "restingHeartRate"
|
|
183
|
+
case sleepAnalysis = "sleepAnalysis"
|
|
184
|
+
/// The sessions themselves. A session's energy, distance and steps travel only where
|
|
185
|
+
/// activeEnergy, distance and steps are requested too.
|
|
186
|
+
case workouts = "workouts"
|
|
187
|
+
/// A workout's GPS track. iOS needs a location usage string; Health Connect asks about each
|
|
188
|
+
/// session's track itself.
|
|
189
|
+
case workoutRoute = "workoutRoute"
|
|
190
|
+
case speed = "speed"
|
|
191
|
+
case power = "power"
|
|
192
|
+
/// On Health Connect granted under READ_EXERCISE, the sessions' own permission.
|
|
193
|
+
case cyclingCadence = "cyclingCadence"
|
|
194
|
+
case weight = "weight"
|
|
195
|
+
case height = "height"
|
|
196
|
+
/// Available on ios only.
|
|
197
|
+
case bmi = "bmi"
|
|
198
|
+
case bodyFat = "bodyFat"
|
|
199
|
+
case leanBodyMass = "leanBodyMass"
|
|
200
|
+
/// Available on ios only.
|
|
201
|
+
case waistCircumference = "waistCircumference"
|
|
202
|
+
case bloodPressure = "bloodPressure"
|
|
203
|
+
case bloodGlucose = "bloodGlucose"
|
|
204
|
+
case oxygenSaturation = "oxygenSaturation"
|
|
205
|
+
/// Body and basal temperature, plus the sleeping wrist temperature (iOS) or skin temperature
|
|
206
|
+
/// (Android) where the OS has it.
|
|
207
|
+
case bodyTemperature = "bodyTemperature"
|
|
208
|
+
/// SDNN on iOS, RMSSD on Android: different statistics, never one series.
|
|
209
|
+
case heartRateVariability = "heartRateVariability"
|
|
210
|
+
case respiratoryRate = "respiratoryRate"
|
|
211
|
+
case vo2Max = "vo2Max"
|
|
212
|
+
/// Available on ios only.
|
|
213
|
+
case insulinDelivery = "insulinDelivery"
|
|
214
|
+
/// Available on ios only.
|
|
215
|
+
case heartbeatSeries = "heartbeatSeries"
|
|
216
|
+
/// Available on ios only.
|
|
217
|
+
case electrocardiogram = "electrocardiogram"
|
|
218
|
+
case dietaryEnergyConsumed = "dietaryEnergyConsumed"
|
|
219
|
+
case dietaryProtein = "dietaryProtein"
|
|
220
|
+
case dietaryCarbohydrates = "dietaryCarbohydrates"
|
|
221
|
+
case dietaryFatTotal = "dietaryFatTotal"
|
|
222
|
+
case dietaryFatSaturated = "dietaryFatSaturated"
|
|
223
|
+
case dietaryFatMonounsaturated = "dietaryFatMonounsaturated"
|
|
224
|
+
case dietaryFatPolyunsaturated = "dietaryFatPolyunsaturated"
|
|
225
|
+
case dietarySugar = "dietarySugar"
|
|
226
|
+
case dietaryFiber = "dietaryFiber"
|
|
227
|
+
case dietaryCholesterol = "dietaryCholesterol"
|
|
228
|
+
case dietarySodium = "dietarySodium"
|
|
229
|
+
case dietaryPotassium = "dietaryPotassium"
|
|
230
|
+
case dietaryCalcium = "dietaryCalcium"
|
|
231
|
+
case dietaryIron = "dietaryIron"
|
|
232
|
+
case dietaryMagnesium = "dietaryMagnesium"
|
|
233
|
+
case dietaryZinc = "dietaryZinc"
|
|
234
|
+
case dietaryPhosphorus = "dietaryPhosphorus"
|
|
235
|
+
case dietaryIodine = "dietaryIodine"
|
|
236
|
+
case dietaryManganese = "dietaryManganese"
|
|
237
|
+
case dietaryMolybdenum = "dietaryMolybdenum"
|
|
238
|
+
case dietarySelenium = "dietarySelenium"
|
|
239
|
+
case dietaryCopper = "dietaryCopper"
|
|
240
|
+
case dietaryChromium = "dietaryChromium"
|
|
241
|
+
case dietaryChloride = "dietaryChloride"
|
|
242
|
+
case dietaryCaffeine = "dietaryCaffeine"
|
|
243
|
+
case dietaryVitaminA = "dietaryVitaminA"
|
|
244
|
+
case dietaryVitaminC = "dietaryVitaminC"
|
|
245
|
+
case dietaryVitaminD = "dietaryVitaminD"
|
|
246
|
+
case dietaryVitaminE = "dietaryVitaminE"
|
|
247
|
+
case dietaryVitaminK = "dietaryVitaminK"
|
|
248
|
+
case dietaryVitaminB6 = "dietaryVitaminB6"
|
|
249
|
+
case dietaryVitaminB12 = "dietaryVitaminB12"
|
|
250
|
+
case dietaryThiamin = "dietaryThiamin"
|
|
251
|
+
case dietaryRiboflavin = "dietaryRiboflavin"
|
|
252
|
+
case dietaryNiacin = "dietaryNiacin"
|
|
253
|
+
case dietaryFolate = "dietaryFolate"
|
|
254
|
+
case dietaryBiotin = "dietaryBiotin"
|
|
255
|
+
case dietaryPantothenicAcid = "dietaryPantothenicAcid"
|
|
256
|
+
/// Water, which travels as hydration rather than as a nutrient.
|
|
257
|
+
case dietaryWater = "dietaryWater"
|
|
258
|
+
case menstrualFlow = "menstrualFlow"
|
|
259
|
+
case intermenstrualBleeding = "intermenstrualBleeding"
|
|
260
|
+
case ovulationTest = "ovulationTest"
|
|
261
|
+
case cervicalMucus = "cervicalMucus"
|
|
262
|
+
case sexualActivity = "sexualActivity"
|
|
263
|
+
/// Available on ios only.
|
|
264
|
+
case pregnancyTest = "pregnancyTest"
|
|
265
|
+
/// Available on ios only.
|
|
266
|
+
case progesteroneTest = "progesteroneTest"
|
|
267
|
+
/// Available on ios only.
|
|
268
|
+
case pregnancy = "pregnancy"
|
|
269
|
+
/// Available on ios only.
|
|
270
|
+
case lactation = "lactation"
|
|
271
|
+
/// Available on ios only.
|
|
272
|
+
case contraceptive = "contraceptive"
|
|
273
|
+
/// Available on ios only.
|
|
274
|
+
case persistentIntermenstrualBleeding = "persistentIntermenstrualBleeding"
|
|
275
|
+
/// Available on ios only.
|
|
276
|
+
case infrequentCycles = "infrequentCycles"
|
|
277
|
+
/// Available on ios only.
|
|
278
|
+
case irregularCycles = "irregularCycles"
|
|
279
|
+
/// Available on ios only.
|
|
280
|
+
case prolongedPeriods = "prolongedPeriods"
|
|
281
|
+
/// Available on ios only.
|
|
282
|
+
case bleedingDuringPregnancy = "bleedingDuringPregnancy"
|
|
283
|
+
/// Available on ios only.
|
|
284
|
+
case bleedingAfterPregnancy = "bleedingAfterPregnancy"
|
|
285
|
+
/// Available on ios only.
|
|
286
|
+
case biologicalSex = "biologicalSex"
|
|
287
|
+
/// Available on ios only.
|
|
288
|
+
case dateOfBirth = "dateOfBirth"
|
|
289
|
+
/// Available on ios only.
|
|
290
|
+
case wheelchairUse = "wheelchairUse"
|
|
291
|
+
/// Available on ios only.
|
|
292
|
+
case activityMoveMode = "activityMoveMode"
|
|
293
|
+
/// Available on android only.
|
|
294
|
+
case boneMass = "boneMass"
|
|
295
|
+
/// Available on android only.
|
|
296
|
+
case bodyWaterMass = "bodyWaterMass"
|
|
146
297
|
}
|
|
147
298
|
|
|
148
299
|
public enum PermissionStatus: String, Codable, Sendable, CaseIterable {
|
|
@@ -309,9 +460,18 @@ public enum FailureCode: String, Codable, Sendable, CaseIterable {
|
|
|
309
460
|
case sampleNotFound = "sampleNotFound"
|
|
310
461
|
case rollbackIncomplete = "rollbackIncomplete"
|
|
311
462
|
case distanceNotAttributable = "distanceNotAttributable"
|
|
463
|
+
case workoutsRequired = "workoutsRequired"
|
|
312
464
|
case bloodPressureIncomplete = "bloodPressureIncomplete"
|
|
313
465
|
case authorizationUnavailableInExtension = "authorizationUnavailableInExtension"
|
|
314
466
|
case routeAwaitingConverter = "routeAwaitingConverter"
|
|
467
|
+
/// Terra answered 409 data_type_not_enabled: the client has not enabled the data type. Only
|
|
468
|
+
/// clinicalRecord needs enabling, and Android has no clinicalRecord route.
|
|
469
|
+
///
|
|
470
|
+
/// Available on ios only.
|
|
471
|
+
case dataTypeNotEnabled = "dataTypeNotEnabled"
|
|
472
|
+
/// Terra refused, permanently, to share this device's key with a customer. Only multi-dev-id
|
|
473
|
+
/// mode shares a key.
|
|
474
|
+
case linkRefused = "linkRefused"
|
|
315
475
|
/// Available on android only.
|
|
316
476
|
case readQuotaExceeded = "readQuotaExceeded"
|
|
317
477
|
/// Apple's FailureCode carries it; Android's does not, because there is no Android
|
|
@@ -1170,11 +1330,16 @@ public struct HealthAccess: Codable, Equatable, Sendable {
|
|
|
1170
1330
|
@CaseSet public var read: [DataCategory]
|
|
1171
1331
|
@CaseSet public var write: [DataCategory]
|
|
1172
1332
|
public var workouts: [WorkoutScope]
|
|
1333
|
+
/// The types asked for individually, sorted by wire name; absent for an install that asked only
|
|
1334
|
+
/// by category. Optional rather than a set so every earlier payload still decodes. Once present
|
|
1335
|
+
/// the install reads and uploads only these types and the types of the categories in read.
|
|
1336
|
+
public var readTypes: [HealthDataType]?
|
|
1173
1337
|
|
|
1174
|
-
public init(read: [DataCategory], write: [DataCategory], workouts: [WorkoutScope]) {
|
|
1338
|
+
public init(read: [DataCategory], write: [DataCategory], workouts: [WorkoutScope], readTypes: [HealthDataType]? = nil) {
|
|
1175
1339
|
self.read = read
|
|
1176
1340
|
self.write = write
|
|
1177
1341
|
self.workouts = workouts
|
|
1342
|
+
self.readTypes = readTypes
|
|
1178
1343
|
}
|
|
1179
1344
|
}
|
|
1180
1345
|
|
|
@@ -1444,13 +1609,18 @@ public struct BootstrapState: Codable, Equatable, Sendable {
|
|
|
1444
1609
|
public var platform: String
|
|
1445
1610
|
public var sdkVersion: String
|
|
1446
1611
|
public var backgroundRegistered: Bool
|
|
1612
|
+
/// single or multiple, as the native bootstrap configured the client (Info.plist TerraDevIDMode
|
|
1613
|
+
/// on iOS, manifest meta-data co.tryterra.sdk.DEV_ID_MODE on Android). Lets the app detect a
|
|
1614
|
+
/// missing key before linkDevId refuses with dev_id_mismatch.
|
|
1615
|
+
public var devIdMode: String?
|
|
1447
1616
|
|
|
1448
|
-
public init(bootstrapped: Bool, devId: String? = nil, platform: String, sdkVersion: String, backgroundRegistered: Bool) {
|
|
1617
|
+
public init(bootstrapped: Bool, devId: String? = nil, platform: String, sdkVersion: String, backgroundRegistered: Bool, devIdMode: String? = nil) {
|
|
1449
1618
|
self.bootstrapped = bootstrapped
|
|
1450
1619
|
self.devId = devId
|
|
1451
1620
|
self.platform = platform
|
|
1452
1621
|
self.sdkVersion = sdkVersion
|
|
1453
1622
|
self.backgroundRegistered = backgroundRegistered
|
|
1623
|
+
self.devIdMode = devIdMode
|
|
1454
1624
|
}
|
|
1455
1625
|
}
|
|
1456
1626
|
|
|
@@ -1495,6 +1665,16 @@ public struct CategoryRequest: Codable, Equatable, Sendable {
|
|
|
1495
1665
|
}
|
|
1496
1666
|
}
|
|
1497
1667
|
|
|
1668
|
+
public struct DataTypeRequest: Codable, Equatable, Sendable {
|
|
1669
|
+
public var type: HealthDataType
|
|
1670
|
+
public var source: Source?
|
|
1671
|
+
|
|
1672
|
+
public init(type: HealthDataType, source: Source? = nil) {
|
|
1673
|
+
self.type = type
|
|
1674
|
+
self.source = source
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1498
1678
|
public struct RecordIdRequest: Codable, Equatable, Sendable {
|
|
1499
1679
|
public var id: String
|
|
1500
1680
|
|
|
@@ -1522,12 +1702,17 @@ public struct PermissionRequest: Codable, Equatable, Sendable {
|
|
|
1522
1702
|
@CaseSet public var write: [DataCategory]
|
|
1523
1703
|
public var workouts: [WorkoutScope]
|
|
1524
1704
|
public var source: Source?
|
|
1705
|
+
/// Individual types to read, for a host that discloses specific data rather than whole
|
|
1706
|
+
/// categories. Optional, so a payload from a wrapper that predates types still decodes. A type
|
|
1707
|
+
/// this platform has no store type for rejects with bridge.unsupported_on_platform.
|
|
1708
|
+
public var readTypes: [HealthDataType]?
|
|
1525
1709
|
|
|
1526
|
-
public init(read: [DataCategory], write: [DataCategory], workouts: [WorkoutScope], source: Source? = nil) {
|
|
1710
|
+
public init(read: [DataCategory], write: [DataCategory], workouts: [WorkoutScope], source: Source? = nil, readTypes: [HealthDataType]? = nil) {
|
|
1527
1711
|
self.read = read
|
|
1528
1712
|
self.write = write
|
|
1529
1713
|
self.workouts = workouts
|
|
1530
1714
|
self.source = source
|
|
1715
|
+
self.readTypes = readTypes
|
|
1531
1716
|
}
|
|
1532
1717
|
}
|
|
1533
1718
|
|
|
@@ -1583,6 +1768,70 @@ public struct MarkCompleteRequest: Codable, Equatable, Sendable {
|
|
|
1583
1768
|
}
|
|
1584
1769
|
}
|
|
1585
1770
|
|
|
1771
|
+
/// One customer linking a multi-dev-id installation, with a link token that customer minted.
|
|
1772
|
+
public struct LinkDevIdRequest: Codable, Equatable, Sendable {
|
|
1773
|
+
public var devId: String
|
|
1774
|
+
public var token: String
|
|
1775
|
+
public var source: Source?
|
|
1776
|
+
|
|
1777
|
+
public init(devId: String, token: String, source: Source? = nil) {
|
|
1778
|
+
self.devId = devId
|
|
1779
|
+
self.token = token
|
|
1780
|
+
self.source = source
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
public struct DevIdRequest: Codable, Equatable, Sendable {
|
|
1785
|
+
public var devId: String
|
|
1786
|
+
public var source: Source?
|
|
1787
|
+
|
|
1788
|
+
public init(devId: String, source: Source? = nil) {
|
|
1789
|
+
self.devId = devId
|
|
1790
|
+
self.source = source
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
/// One customer's connection to a multi-dev-id installation's shared device link.
|
|
1795
|
+
public struct DevIdBinding: Codable, Equatable, Sendable {
|
|
1796
|
+
public var devId: String
|
|
1797
|
+
/// Terra's id for this customer's connection.
|
|
1798
|
+
public var userId: String
|
|
1799
|
+
/// The upload routes the customer selected, as Terra answered at link. Absent when Terra did
|
|
1800
|
+
/// not say, which syncs the app's requested access for this customer.
|
|
1801
|
+
public var dataTypes: [String]?
|
|
1802
|
+
public var linkedAt: String
|
|
1803
|
+
/// False once Terra's init no longer lists this connection: the customer removed it or stopped
|
|
1804
|
+
/// accepting the key. Nothing is read or backfilled for it until the customer links again.
|
|
1805
|
+
public var active: Bool
|
|
1806
|
+
|
|
1807
|
+
public init(devId: String, userId: String, dataTypes: [String]? = nil, linkedAt: String, active: Bool) {
|
|
1808
|
+
self.devId = devId
|
|
1809
|
+
self.userId = userId
|
|
1810
|
+
self.dataTypes = dataTypes
|
|
1811
|
+
self.linkedAt = linkedAt
|
|
1812
|
+
self.active = active
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
public struct LinkedDevIdsRequest: Codable, Equatable, Sendable {
|
|
1817
|
+
public var source: Source?
|
|
1818
|
+
/// Ask Terra's init first, so active is as of now.
|
|
1819
|
+
public var refresh: Bool?
|
|
1820
|
+
|
|
1821
|
+
public init(source: Source? = nil, refresh: Bool? = nil) {
|
|
1822
|
+
self.source = source
|
|
1823
|
+
self.refresh = refresh
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
public struct DevIdBindingList: Codable, Equatable, Sendable {
|
|
1828
|
+
public var bindings: [DevIdBinding]
|
|
1829
|
+
|
|
1830
|
+
public init(bindings: [DevIdBinding]) {
|
|
1831
|
+
self.bindings = bindings
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1586
1835
|
public struct BoolResult: Codable, Equatable, Sendable {
|
|
1587
1836
|
public var value: Bool
|
|
1588
1837
|
|
|
@@ -76,6 +76,8 @@ enum Rejections {
|
|
|
76
76
|
private static func details(_ error: TerraError) -> BridgeJSON? {
|
|
77
77
|
switch error {
|
|
78
78
|
case .routeAwaitingConverter(let type): return bag(["dataType": type.rawValue])
|
|
79
|
+
case .dataTypeNotEnabled(let type): return bag(["dataType": type.rawValue])
|
|
80
|
+
case .linkRefused(let refusal): return bag(["reason": refusal.rawValue])
|
|
79
81
|
case .syncAlreadyRunning(let type): return bag(["dataType": type.rawValue])
|
|
80
82
|
case .permissionDenied(let category): return bag(["category": category.rawValue])
|
|
81
83
|
case .sampleNotFound(let id): return bag(["id": id.uuidString])
|
|
@@ -84,6 +86,7 @@ enum Rejections {
|
|
|
84
86
|
return BridgeJSON(["remaining": .number(Double(remaining.count)), "cause": .string(cause.code)])
|
|
85
87
|
case .distanceNotAttributable(let activity):
|
|
86
88
|
return bag(["activity": Conversions.sortKey(Conversions.activity(activity))])
|
|
89
|
+
case .workoutsRequired(let type): return bag(["type": type.rawValue])
|
|
87
90
|
case .network(let failure): return details(failure)
|
|
88
91
|
case .tokenProviderFailed, .platform:
|
|
89
92
|
return nil
|
|
@@ -91,7 +94,8 @@ enum Rejections {
|
|
|
91
94
|
.userLimitReached, .upgradeRequired, .deviceKeyUnavailable, .signatureRejected,
|
|
92
95
|
.clockSkewed, .linkRevoked, .devIDMismatch, .linkConflict, .linkAlreadyRunning,
|
|
93
96
|
.storeLocked, .storeUnreadable, .deadlineExceeded, .authorizationNotDetermined,
|
|
94
|
-
.bloodPressureIncomplete, .plannedWorkoutUnnamed, .authorizationUnavailableInExtension
|
|
97
|
+
.bloodPressureIncomplete, .plannedWorkoutUnnamed, .authorizationUnavailableInExtension,
|
|
98
|
+
.healthRecordsUnavailable, .healthRecordsUsageDescriptionMissing:
|
|
95
99
|
return nil
|
|
96
100
|
@unknown default:
|
|
97
101
|
return nil
|
|
@@ -21,7 +21,8 @@ struct TerraBridgeOpsImpl: TerraBridgeOps {
|
|
|
21
21
|
devId: host.devID,
|
|
22
22
|
platform: "ios",
|
|
23
23
|
sdkVersion: TerraSDK.sdkVersion,
|
|
24
|
-
backgroundRegistered: await host.backgroundRegistered()
|
|
24
|
+
backgroundRegistered: await host.backgroundRegistered(),
|
|
25
|
+
devIdMode: terra.devIDMode == .multiple ? "multiple" : "single")
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
func clientConnect(_ request: ConnectRequest) async throws -> Connection {
|
|
@@ -53,6 +54,23 @@ struct TerraBridgeOpsImpl: TerraBridgeOps {
|
|
|
53
54
|
return Empty()
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
func clientLinkDevId(_ request: LinkDevIdRequest) async throws -> DevIdBinding {
|
|
58
|
+
Conversions.devIDBinding(try await terra.linkedDevIDs.link(
|
|
59
|
+
request.devId, using: request.token, source: try Conversions.source(request.source)))
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
func clientUnlinkDevId(_ request: DevIdRequest) async throws -> Empty {
|
|
63
|
+
try await terra.linkedDevIDs.unlink(
|
|
64
|
+
request.devId, source: try Conversions.source(request.source))
|
|
65
|
+
return Empty()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
func clientLinkedDevIds(_ request: LinkedDevIdsRequest) async throws -> DevIdBindingList {
|
|
69
|
+
DevIdBindingList(bindings: try await terra.linkedDevIDs
|
|
70
|
+
.all(source: try Conversions.source(request.source), refresh: request.refresh ?? false)
|
|
71
|
+
.map(Conversions.devIDBinding))
|
|
72
|
+
}
|
|
73
|
+
|
|
56
74
|
// MARK: token
|
|
57
75
|
|
|
58
76
|
func tokenSetProviderPresent(_ request: TokenProviderRequest) async throws -> Empty {
|
|
@@ -75,13 +93,21 @@ struct TerraBridgeOpsImpl: TerraBridgeOps {
|
|
|
75
93
|
/// HealthKit will not say what was granted for reads, so Apple answers nothing.
|
|
76
94
|
func permissionsRequest(_ request: PermissionRequest) async throws -> PermissionGrant {
|
|
77
95
|
_ = try Conversions.source(request.source)
|
|
96
|
+
let readTypes = try (request.readTypes ?? []).map(Conversions.requestedType)
|
|
78
97
|
try await terra.permissions.request(
|
|
79
98
|
read: request.read.map(Conversions.category),
|
|
99
|
+
readTypes: readTypes,
|
|
80
100
|
write: request.write.map(Conversions.category),
|
|
81
101
|
workouts: request.workouts.map(Conversions.scope))
|
|
82
102
|
return PermissionGrant()
|
|
83
103
|
}
|
|
84
104
|
|
|
105
|
+
func permissionsTypeStatus(_ request: DataTypeRequest) async throws -> StatusResult {
|
|
106
|
+
_ = try Conversions.source(request.source)
|
|
107
|
+
let type = try Conversions.requestedType(request.type)
|
|
108
|
+
return StatusResult(status: Conversions.permissionStatus(await terra.permissions.status(for: type)))
|
|
109
|
+
}
|
|
110
|
+
|
|
85
111
|
func permissionsStatus(_ request: CategoryRequest) async throws -> StatusResult {
|
|
86
112
|
_ = try Conversions.source(request.source)
|
|
87
113
|
return StatusResult(status: Conversions.permissionStatus(
|
|
@@ -99,6 +125,11 @@ struct TerraBridgeOpsImpl: TerraBridgeOps {
|
|
|
99
125
|
return Conversions.access(await terra.permissions.requested)
|
|
100
126
|
}
|
|
101
127
|
|
|
128
|
+
func permissionsRequestClinicalRecords(_ request: Empty) async throws -> Empty {
|
|
129
|
+
try await terra.permissions.requestClinicalRecords()
|
|
130
|
+
return Empty()
|
|
131
|
+
}
|
|
132
|
+
|
|
102
133
|
// MARK: diagnostics
|
|
103
134
|
|
|
104
135
|
func diagnosticsState(_ request: SourceRequest) async throws -> DiagnosticsState {
|
package/lib/Terra.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* here, so this file cannot quietly fall behind the surface the way the 1.x wrapper did.
|
|
9
9
|
*/
|
|
10
10
|
import { TerraError } from "./TerraError";
|
|
11
|
-
import type { AthleteProfile, BodyEntry, BodyReading, BootstrapState, Connection, DataCategory, DayTotal, DiagnosticsState, DietaryQuantity, EndUser, HealthAccess, HealthChange, HeartRateEntry, HeartRateSample, HydrationSample, IntradaySample, MenstrualEvent, MenstruationFlowDay, NutritionEntry, PermissionStatus, PlannedWorkout, RestingHeartRateSample, StoreAvailability, WorkoutSchedulingStatus, SleepEntry, SleepSegment, Source, StepCount, StepEntry, SupportReport, TerraEvent, TimeRange, Workout, WorkoutEntry, WorkoutIntensitySample, WorkoutRoute } from "./generated/types";
|
|
11
|
+
import type { AthleteProfile, BodyEntry, BodyReading, BootstrapState, Connection, DataCategory, DayTotal, DevIdBinding, DiagnosticsState, DietaryQuantity, EndUser, HealthAccess, HealthDataType, HealthChange, HeartRateEntry, HeartRateSample, HydrationSample, IntradaySample, MenstrualEvent, MenstruationFlowDay, NutritionEntry, PermissionStatus, PlannedWorkout, RestingHeartRateSample, StoreAvailability, WorkoutSchedulingStatus, SleepEntry, SleepSegment, Source, StepCount, StepEntry, SupportReport, TerraEvent, TimeRange, Workout, WorkoutEntry, WorkoutIntensitySample, WorkoutRoute } from "./generated/types";
|
|
12
12
|
/** What the facade needs from the native module. `NativeTerraBridge` satisfies it; so does a double. */
|
|
13
13
|
export interface NativeBridge {
|
|
14
14
|
invoke(op: string, payload: string): Promise<string>;
|
|
@@ -48,6 +48,13 @@ export interface Permissions {
|
|
|
48
48
|
*/
|
|
49
49
|
request(access: Partial<HealthAccess>, source?: Source): Promise<HealthAccess | undefined>;
|
|
50
50
|
status(category: DataCategory, source?: Source): Promise<PermissionStatus>;
|
|
51
|
+
/**
|
|
52
|
+
* One type's read status. iOS answers `notDisclosed` wherever it has the type, because HealthKit
|
|
53
|
+
* never reports a read decision; Android answers `granted` once any permission behind the type
|
|
54
|
+
* is granted. A type this platform has no store type for rejects with
|
|
55
|
+
* `bridge.unsupported_on_platform`.
|
|
56
|
+
*/
|
|
57
|
+
typeStatus(type: HealthDataType, source?: Source): Promise<PermissionStatus>;
|
|
51
58
|
writeStatus(category: DataCategory, source?: Source): Promise<PermissionStatus>;
|
|
52
59
|
requested(source?: Source): Promise<HealthAccess>;
|
|
53
60
|
/** Android only. */
|
|
@@ -56,6 +63,15 @@ export interface Permissions {
|
|
|
56
63
|
readonly backgroundReadStatus?: (source?: Source) => Promise<PermissionStatus>;
|
|
57
64
|
/** Android only. */
|
|
58
65
|
readonly historyReadStatus?: (source?: Source) => Promise<PermissionStatus>;
|
|
66
|
+
/**
|
|
67
|
+
* iOS only. Apple Health Records (`clinicalRecord`), on HealthKit's own sheet. Opt-in: the host
|
|
68
|
+
* needs the Clinical Health Records entitlement, both `NSHealthShareUsageDescription` and
|
|
69
|
+
* `NSHealthClinicalHealthRecordsShareUsageDescription`, and `CLINICAL_RECORD` enabled for the
|
|
70
|
+
* Terra client in Terra's dashboard. Rejects with `health_records_unavailable` where the device has
|
|
71
|
+
* no Health Records, and with `health_records_usage_description_missing` when either Info.plist
|
|
72
|
+
* string is absent. The only way to ask: `request` ignores `clinicalRecord`.
|
|
73
|
+
*/
|
|
74
|
+
readonly requestClinicalRecords?: () => Promise<void>;
|
|
59
75
|
}
|
|
60
76
|
export interface Diagnostics {
|
|
61
77
|
state(source?: Source): Promise<DiagnosticsState>;
|
|
@@ -166,6 +182,34 @@ export interface PlannedWorkouts {
|
|
|
166
182
|
*/
|
|
167
183
|
requestScheduling(): Promise<WorkoutSchedulingStatus>;
|
|
168
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* The customers one installation serves, in multi-dev-id mode: a connector app that several
|
|
187
|
+
* customers link the same person through, with one read and one upload for all of them. Every call
|
|
188
|
+
* is refused with `dev_id_mismatch` unless the native bootstrap chose the mode - `TerraDevIDMode`
|
|
189
|
+
* set to `multiple` in the iOS Info.plist, `co.tryterra.sdk.DEV_ID_MODE` set to `multiple` in the
|
|
190
|
+
* Android manifest's application meta-data.
|
|
191
|
+
*/
|
|
192
|
+
export interface LinkedDevIds {
|
|
193
|
+
/**
|
|
194
|
+
* Links `devId`'s connection with a link token that customer minted. The first customer links
|
|
195
|
+
* the installation; every later one joins it and is sent the history the others already have.
|
|
196
|
+
*/
|
|
197
|
+
link(devId: string, token: string, source?: Source): Promise<DevIdBinding>;
|
|
198
|
+
/**
|
|
199
|
+
* Stops delivering to `devId`'s connection and leaves the others linked. The last customer's
|
|
200
|
+
* unlink disconnects the installation.
|
|
201
|
+
*/
|
|
202
|
+
unlink(devId: string, source?: Source): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* The customers currently linked, in the order they linked, gone ones included (`active` false).
|
|
205
|
+
* `refresh` asks Terra first, so `active` is as of now; the `devIDBindingChanged` event reports
|
|
206
|
+
* each change.
|
|
207
|
+
*/
|
|
208
|
+
all(options?: {
|
|
209
|
+
readonly source?: Source;
|
|
210
|
+
readonly refresh?: boolean;
|
|
211
|
+
}): Promise<readonly DevIdBinding[]>;
|
|
212
|
+
}
|
|
169
213
|
export declare class Terra {
|
|
170
214
|
readonly platform: Platform;
|
|
171
215
|
readonly permissions: Permissions;
|
|
@@ -181,6 +225,8 @@ export declare class Terra {
|
|
|
181
225
|
readonly athlete: AthleteMetrics | undefined;
|
|
182
226
|
/** `undefined` on Android, which has no planned workouts. */
|
|
183
227
|
readonly plannedWorkouts: PlannedWorkouts | undefined;
|
|
228
|
+
/** Multi-dev-id mode's customers, on both platforms. */
|
|
229
|
+
readonly linkedDevIds: LinkedDevIds;
|
|
184
230
|
private readonly ops;
|
|
185
231
|
private readonly streams;
|
|
186
232
|
private readonly tokenProvider;
|
package/lib/Terra.js
CHANGED
|
@@ -35,10 +35,14 @@ class Terra {
|
|
|
35
35
|
write: access.write ?? [],
|
|
36
36
|
workouts: access.workouts ?? [],
|
|
37
37
|
source,
|
|
38
|
+
// Left out rather than sent empty when the host asks only by category, so the request
|
|
39
|
+
// has the shape it had before types existed.
|
|
40
|
+
...(access.readTypes !== undefined && { readTypes: access.readTypes }),
|
|
38
41
|
});
|
|
39
42
|
return grant.granted;
|
|
40
43
|
},
|
|
41
44
|
status: async (category, source) => (await ops.permissionsStatus({ category, source })).status,
|
|
45
|
+
typeStatus: async (type, source) => (await ops.permissionsTypeStatus({ type, source })).status,
|
|
42
46
|
writeStatus: async (category, source) => (await ops.permissionsWriteStatus({ category, source })).status,
|
|
43
47
|
requested: (source) => ops.permissionsRequested({ source }),
|
|
44
48
|
...(on("permissions.statuses") && {
|
|
@@ -50,6 +54,11 @@ class Terra {
|
|
|
50
54
|
...(on("permissions.historyReadStatus") && {
|
|
51
55
|
historyReadStatus: async (source) => (await ops.permissionsHistoryReadStatus({ source })).status,
|
|
52
56
|
}),
|
|
57
|
+
...(on("permissions.requestClinicalRecords") && {
|
|
58
|
+
requestClinicalRecords: async () => {
|
|
59
|
+
await ops.permissionsRequestClinicalRecords({});
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
53
62
|
};
|
|
54
63
|
this.diagnostics = {
|
|
55
64
|
state: (source) => ops.diagnosticsState({ source }),
|
|
@@ -131,6 +140,13 @@ class Terra {
|
|
|
131
140
|
requestScheduling: async () => (await ops.plannedWorkoutsRequestScheduling({})).status,
|
|
132
141
|
}
|
|
133
142
|
: undefined;
|
|
143
|
+
this.linkedDevIds = {
|
|
144
|
+
link: (devId, token, source) => ops.clientLinkDevId({ devId, token, source }),
|
|
145
|
+
unlink: async (devId, source) => {
|
|
146
|
+
await ops.clientUnlinkDevId({ devId, source });
|
|
147
|
+
},
|
|
148
|
+
all: async (options = {}) => (await ops.clientLinkedDevIds({ source: options.source, refresh: options.refresh })).bindings,
|
|
149
|
+
};
|
|
134
150
|
}
|
|
135
151
|
/**
|
|
136
152
|
* The native client this runtime is attached to. Rejects with `bridge.not_bootstrapped`, carrying
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AthleteProfileResult, AvailabilityResult, BodyEntryList, BodyReadingList, BoolResult, BootstrapState, CategoryRequest, ConnectRequest, Connection, ConnectionList, DayTotalList, DiagnosticsState, DietaryQuantityList, Empty, HealthAccess, HeartRateEntryList, HeartRateList, HydrationList, IntradaySampleList, LastDeliveryResult, MarkCompleteRequest, MenstrualEventList, MenstruationFlowDayList, NutritionEntryList, PermissionGrant, PermissionRequest, PlannedWorkoutList, RangeRequest, RecordIdList, RecordIdRequest, RestingHeartRateList, SleepEntryList, SleepSegmentList, SourceRequest, StatusResult, StatusesResult, StepCountList, StepEntryList, SupportReport, TokenProviderRequest, TokenRejectRequest, TokenResolveRequest, WorkoutEntryList, WorkoutIntensityList, WorkoutList, WorkoutRouteList, WorkoutScheduling } from "./types";
|
|
1
|
+
import type { AthleteProfileResult, AvailabilityResult, BodyEntryList, BodyReadingList, BoolResult, BootstrapState, CategoryRequest, ConnectRequest, Connection, ConnectionList, DataTypeRequest, DayTotalList, DevIdBinding, DevIdBindingList, DevIdRequest, DiagnosticsState, DietaryQuantityList, Empty, HealthAccess, HeartRateEntryList, HeartRateList, HydrationList, IntradaySampleList, LastDeliveryResult, LinkDevIdRequest, LinkedDevIdsRequest, MarkCompleteRequest, MenstrualEventList, MenstruationFlowDayList, NutritionEntryList, PermissionGrant, PermissionRequest, PlannedWorkoutList, RangeRequest, RecordIdList, RecordIdRequest, RestingHeartRateList, SleepEntryList, SleepSegmentList, SourceRequest, StatusResult, StatusesResult, StepCountList, StepEntryList, SupportReport, TokenProviderRequest, TokenRejectRequest, TokenResolveRequest, WorkoutEntryList, WorkoutIntensityList, WorkoutList, WorkoutRouteList, WorkoutScheduling } from "./types";
|
|
2
2
|
import type { OpId } from "./ops";
|
|
3
3
|
/** What the facade needs from the native module. The TurboModule spec satisfies it; so does a test double. */
|
|
4
4
|
export interface Invoker {
|
|
@@ -24,6 +24,22 @@ export declare class GeneratedClient {
|
|
|
24
24
|
/** Whether the device can serve the source at all. Needs no connection and prompts for nothing. */
|
|
25
25
|
clientAvailability(request: SourceRequest): Promise<AvailabilityResult>;
|
|
26
26
|
clientDisconnect(request: SourceRequest): Promise<Empty>;
|
|
27
|
+
/**
|
|
28
|
+
* Multi-dev-id mode only: links one customer's connection to the installation's shared device
|
|
29
|
+
* link. The first customer links the installation; every later one joins it, keeping one read
|
|
30
|
+
* and one upload.
|
|
31
|
+
*/
|
|
32
|
+
clientLinkDevId(request: LinkDevIdRequest): Promise<DevIdBinding>;
|
|
33
|
+
/**
|
|
34
|
+
* Multi-dev-id mode only: stops delivering to one customer's connection and leaves the others
|
|
35
|
+
* linked. The last customer's unlink disconnects the installation.
|
|
36
|
+
*/
|
|
37
|
+
clientUnlinkDevId(request: DevIdRequest): Promise<Empty>;
|
|
38
|
+
/**
|
|
39
|
+
* Multi-dev-id mode only: the customers currently linked, in the order they linked, gone ones
|
|
40
|
+
* included (active false). refresh asks Terra first.
|
|
41
|
+
*/
|
|
42
|
+
clientLinkedDevIds(request: LinkedDevIdsRequest): Promise<DevIdBindingList>;
|
|
27
43
|
/**
|
|
28
44
|
* Tells the broker whether JS can answer at all. Without it a link asks a provider that is not
|
|
29
45
|
* there and waits out the timeout.
|
|
@@ -37,8 +53,24 @@ export declare class GeneratedClient {
|
|
|
37
53
|
tokenReject(request: TokenRejectRequest): Promise<Empty>;
|
|
38
54
|
permissionsRequest(request: PermissionRequest): Promise<PermissionGrant>;
|
|
39
55
|
permissionsStatus(request: CategoryRequest): Promise<StatusResult>;
|
|
56
|
+
/**
|
|
57
|
+
* One type's read status. iOS answers notDisclosed wherever the OS has the type, because
|
|
58
|
+
* HealthKit never reports a read decision; Android answers granted once any permission behind
|
|
59
|
+
* the type is granted, denied when it was asked for and none is, and notDetermined when it
|
|
60
|
+
* never was.
|
|
61
|
+
*/
|
|
62
|
+
permissionsTypeStatus(request: DataTypeRequest): Promise<StatusResult>;
|
|
40
63
|
permissionsWriteStatus(request: CategoryRequest): Promise<StatusResult>;
|
|
41
64
|
permissionsRequested(request: SourceRequest): Promise<HealthAccess>;
|
|
65
|
+
/**
|
|
66
|
+
* Shows HealthKit's Health Records sheet, on its own. The host needs the Clinical Health
|
|
67
|
+
* Records entitlement, both NSHealthShareUsageDescription and
|
|
68
|
+
* NSHealthClinicalHealthRecordsShareUsageDescription, and CLINICAL_RECORD enabled for the
|
|
69
|
+
* Terra client in Terra's dashboard.
|
|
70
|
+
*
|
|
71
|
+
* Available on ios only.
|
|
72
|
+
*/
|
|
73
|
+
permissionsRequestClinicalRecords(request: Empty): Promise<Empty>;
|
|
42
74
|
/** Available on android only. */
|
|
43
75
|
permissionsStatuses(request: SourceRequest): Promise<StatusesResult>;
|
|
44
76
|
/** Available on android only. */
|
package/lib/generated/client.js
CHANGED
|
@@ -57,6 +57,28 @@ class GeneratedClient {
|
|
|
57
57
|
async clientDisconnect(request) {
|
|
58
58
|
return this.call("client.disconnect", () => (0, codecs_1.encodeSourceRequest)(request), (raw) => (0, codecs_1.decodeEmpty)(raw, "Empty"));
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Multi-dev-id mode only: links one customer's connection to the installation's shared device
|
|
62
|
+
* link. The first customer links the installation; every later one joins it, keeping one read
|
|
63
|
+
* and one upload.
|
|
64
|
+
*/
|
|
65
|
+
async clientLinkDevId(request) {
|
|
66
|
+
return this.call("client.linkDevId", () => (0, codecs_1.encodeLinkDevIdRequest)(request), (raw) => (0, codecs_1.decodeDevIdBinding)(raw, "DevIdBinding"));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Multi-dev-id mode only: stops delivering to one customer's connection and leaves the others
|
|
70
|
+
* linked. The last customer's unlink disconnects the installation.
|
|
71
|
+
*/
|
|
72
|
+
async clientUnlinkDevId(request) {
|
|
73
|
+
return this.call("client.unlinkDevId", () => (0, codecs_1.encodeDevIdRequest)(request), (raw) => (0, codecs_1.decodeEmpty)(raw, "Empty"));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Multi-dev-id mode only: the customers currently linked, in the order they linked, gone ones
|
|
77
|
+
* included (active false). refresh asks Terra first.
|
|
78
|
+
*/
|
|
79
|
+
async clientLinkedDevIds(request) {
|
|
80
|
+
return this.call("client.linkedDevIds", () => (0, codecs_1.encodeLinkedDevIdsRequest)(request), (raw) => (0, codecs_1.decodeDevIdBindingList)(raw, "DevIdBindingList"));
|
|
81
|
+
}
|
|
60
82
|
/**
|
|
61
83
|
* Tells the broker whether JS can answer at all. Without it a link asks a provider that is not
|
|
62
84
|
* there and waits out the timeout.
|
|
@@ -80,12 +102,32 @@ class GeneratedClient {
|
|
|
80
102
|
async permissionsStatus(request) {
|
|
81
103
|
return this.call("permissions.status", () => (0, codecs_1.encodeCategoryRequest)(request), (raw) => (0, codecs_1.decodeStatusResult)(raw, "StatusResult"));
|
|
82
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* One type's read status. iOS answers notDisclosed wherever the OS has the type, because
|
|
107
|
+
* HealthKit never reports a read decision; Android answers granted once any permission behind
|
|
108
|
+
* the type is granted, denied when it was asked for and none is, and notDetermined when it
|
|
109
|
+
* never was.
|
|
110
|
+
*/
|
|
111
|
+
async permissionsTypeStatus(request) {
|
|
112
|
+
return this.call("permissions.typeStatus", () => (0, codecs_1.encodeDataTypeRequest)(request), (raw) => (0, codecs_1.decodeStatusResult)(raw, "StatusResult"));
|
|
113
|
+
}
|
|
83
114
|
async permissionsWriteStatus(request) {
|
|
84
115
|
return this.call("permissions.writeStatus", () => (0, codecs_1.encodeCategoryRequest)(request), (raw) => (0, codecs_1.decodeStatusResult)(raw, "StatusResult"));
|
|
85
116
|
}
|
|
86
117
|
async permissionsRequested(request) {
|
|
87
118
|
return this.call("permissions.requested", () => (0, codecs_1.encodeSourceRequest)(request), (raw) => (0, codecs_1.decodeHealthAccess)(raw, "HealthAccess"));
|
|
88
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Shows HealthKit's Health Records sheet, on its own. The host needs the Clinical Health
|
|
122
|
+
* Records entitlement, both NSHealthShareUsageDescription and
|
|
123
|
+
* NSHealthClinicalHealthRecordsShareUsageDescription, and CLINICAL_RECORD enabled for the
|
|
124
|
+
* Terra client in Terra's dashboard.
|
|
125
|
+
*
|
|
126
|
+
* Available on ios only.
|
|
127
|
+
*/
|
|
128
|
+
async permissionsRequestClinicalRecords(request) {
|
|
129
|
+
return this.call("permissions.requestClinicalRecords", () => (0, codecs_1.encodeEmpty)(request), (raw) => (0, codecs_1.decodeEmpty)(raw, "Empty"));
|
|
130
|
+
}
|
|
89
131
|
/** Available on android only. */
|
|
90
132
|
async permissionsStatuses(request) {
|
|
91
133
|
return this.call("permissions.statuses", () => (0, codecs_1.encodeSourceRequest)(request), (raw) => (0, codecs_1.decodeStatusesResult)(raw, "StatusesResult"));
|