@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
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { Source, DataCategory, PermissionStatus, MotionContext, Nutrient, MealType, MenstruationFlow, BiologicalSex, ActivityMoveMode, BackgroundRestrictionReason, DiagnosticsReason, DeviceKeyRevokeOutcome, FailureCode, WorkoutSchedulingStatus, DayTotalMetric, IntradayMetric, WorkoutIntensityMetric, BodyMetric, BloodGlucoseUnit, GlucoseMealTime, GlucoseSpecimen, BodyTemperatureMetric, HeartRateVariabilityMetric, VO2MaxTestType, MenstrualEventKind, EndUser, TimeRange, SleepStage, WorkoutActivity, DiagnosticsState, StreamMessage, BodyReadingKind, StoreAvailability, SampleSource, Connection, HeartRateSample, StepCount, SleepSegment, Workout, DietaryQuantity, MenstruationFlowDay, AthleteProfile, HealthChange, WorkoutScope, HealthAccess, HeartRateEntry, StepEntry, SleepEntry, WorkoutEntry, BodyEntry, Nutrients, NutritionEntry, TerraErrorPayload, PlannedWorkout, TerraEvent, SupportReport, BootstrapState, TokenRequest, Empty, SourceRequest, RangeRequest, CategoryRequest, RecordIdRequest, ConnectRequest, PermissionRequest, PermissionGrant, TokenResolveRequest, TokenRejectRequest, TokenProviderRequest, MarkCompleteRequest, BoolResult, StatusResult, StatusesResult, RecordIdList, ConnectionList, HeartRateList, StepCountList, SleepSegmentList, WorkoutList, DietaryQuantityList, MenstruationFlowDayList, MenstrualEvent, MenstrualEventList, AthleteProfileResult, PlannedWorkoutList, WorkoutScheduling, LastDeliveryResult, HeartRateEntryList, BodyEntryList, StepEntryList, SleepEntryList, WorkoutEntryList, NutritionEntryList, DayTotal, IntradaySample, RestingHeartRateSample, BodyReading, RoutePoint, WorkoutRoute, WorkoutIntensitySample, HydrationSample, DayTotalList, IntradaySampleList, RestingHeartRateList, BodyReadingList, WorkoutRouteList, WorkoutIntensityList, HydrationList, AvailabilityResult } from "./types";
|
|
1
|
+
import type { Source, DataCategory, HealthDataType, PermissionStatus, MotionContext, Nutrient, MealType, MenstruationFlow, BiologicalSex, ActivityMoveMode, BackgroundRestrictionReason, DiagnosticsReason, DeviceKeyRevokeOutcome, FailureCode, WorkoutSchedulingStatus, DayTotalMetric, IntradayMetric, WorkoutIntensityMetric, BodyMetric, BloodGlucoseUnit, GlucoseMealTime, GlucoseSpecimen, BodyTemperatureMetric, HeartRateVariabilityMetric, VO2MaxTestType, MenstrualEventKind, EndUser, TimeRange, SleepStage, WorkoutActivity, DiagnosticsState, StreamMessage, BodyReadingKind, StoreAvailability, SampleSource, Connection, HeartRateSample, StepCount, SleepSegment, Workout, DietaryQuantity, MenstruationFlowDay, AthleteProfile, HealthChange, WorkoutScope, HealthAccess, HeartRateEntry, StepEntry, SleepEntry, WorkoutEntry, BodyEntry, Nutrients, NutritionEntry, TerraErrorPayload, PlannedWorkout, TerraEvent, SupportReport, BootstrapState, TokenRequest, Empty, SourceRequest, RangeRequest, CategoryRequest, DataTypeRequest, RecordIdRequest, ConnectRequest, PermissionRequest, PermissionGrant, TokenResolveRequest, TokenRejectRequest, TokenProviderRequest, MarkCompleteRequest, LinkDevIdRequest, DevIdRequest, DevIdBinding, LinkedDevIdsRequest, DevIdBindingList, BoolResult, StatusResult, StatusesResult, RecordIdList, ConnectionList, HeartRateList, StepCountList, SleepSegmentList, WorkoutList, DietaryQuantityList, MenstruationFlowDayList, MenstrualEvent, MenstrualEventList, AthleteProfileResult, PlannedWorkoutList, WorkoutScheduling, LastDeliveryResult, HeartRateEntryList, BodyEntryList, StepEntryList, SleepEntryList, WorkoutEntryList, NutritionEntryList, DayTotal, IntradaySample, RestingHeartRateSample, BodyReading, RoutePoint, WorkoutRoute, WorkoutIntensitySample, HydrationSample, DayTotalList, IntradaySampleList, RestingHeartRateList, BodyReadingList, WorkoutRouteList, WorkoutIntensityList, HydrationList, AvailabilityResult } from "./types";
|
|
2
2
|
/** Narrows an untyped value to Source, or throws naming the field. */
|
|
3
3
|
export declare function asSource(value: unknown, at?: string): Source;
|
|
4
4
|
/** Narrows an untyped value to DataCategory, or throws naming the field. */
|
|
5
5
|
export declare function asDataCategory(value: unknown, at?: string): DataCategory;
|
|
6
|
+
/** Narrows an untyped value to HealthDataType, or throws naming the field. */
|
|
7
|
+
export declare function asHealthDataType(value: unknown, at?: string): HealthDataType;
|
|
6
8
|
/** Narrows an untyped value to PermissionStatus, or throws naming the field. */
|
|
7
9
|
export declare function asPermissionStatus(value: unknown, at?: string): PermissionStatus;
|
|
8
10
|
/** Narrows an untyped value to MotionContext. A string it does not name is `unknown`; anything else throws. */
|
|
@@ -107,6 +109,8 @@ export declare function encodeRangeRequest(value: RangeRequest): Record<string,
|
|
|
107
109
|
export declare function decodeRangeRequest(raw: unknown, at$?: string): RangeRequest;
|
|
108
110
|
export declare function encodeCategoryRequest(value: CategoryRequest): Record<string, unknown>;
|
|
109
111
|
export declare function decodeCategoryRequest(raw: unknown, at$?: string): CategoryRequest;
|
|
112
|
+
export declare function encodeDataTypeRequest(value: DataTypeRequest): Record<string, unknown>;
|
|
113
|
+
export declare function decodeDataTypeRequest(raw: unknown, at$?: string): DataTypeRequest;
|
|
110
114
|
export declare function encodeRecordIdRequest(value: RecordIdRequest): Record<string, unknown>;
|
|
111
115
|
export declare function decodeRecordIdRequest(raw: unknown, at$?: string): RecordIdRequest;
|
|
112
116
|
export declare function encodeConnectRequest(value: ConnectRequest): Record<string, unknown>;
|
|
@@ -123,6 +127,16 @@ export declare function encodeTokenProviderRequest(value: TokenProviderRequest):
|
|
|
123
127
|
export declare function decodeTokenProviderRequest(raw: unknown, at$?: string): TokenProviderRequest;
|
|
124
128
|
export declare function encodeMarkCompleteRequest(value: MarkCompleteRequest): Record<string, unknown>;
|
|
125
129
|
export declare function decodeMarkCompleteRequest(raw: unknown, at$?: string): MarkCompleteRequest;
|
|
130
|
+
export declare function encodeLinkDevIdRequest(value: LinkDevIdRequest): Record<string, unknown>;
|
|
131
|
+
export declare function decodeLinkDevIdRequest(raw: unknown, at$?: string): LinkDevIdRequest;
|
|
132
|
+
export declare function encodeDevIdRequest(value: DevIdRequest): Record<string, unknown>;
|
|
133
|
+
export declare function decodeDevIdRequest(raw: unknown, at$?: string): DevIdRequest;
|
|
134
|
+
export declare function encodeDevIdBinding(value: DevIdBinding): Record<string, unknown>;
|
|
135
|
+
export declare function decodeDevIdBinding(raw: unknown, at$?: string): DevIdBinding;
|
|
136
|
+
export declare function encodeLinkedDevIdsRequest(value: LinkedDevIdsRequest): Record<string, unknown>;
|
|
137
|
+
export declare function decodeLinkedDevIdsRequest(raw: unknown, at$?: string): LinkedDevIdsRequest;
|
|
138
|
+
export declare function encodeDevIdBindingList(value: DevIdBindingList): Record<string, unknown>;
|
|
139
|
+
export declare function decodeDevIdBindingList(raw: unknown, at$?: string): DevIdBindingList;
|
|
126
140
|
export declare function encodeBoolResult(value: BoolResult): Record<string, unknown>;
|
|
127
141
|
export declare function decodeBoolResult(raw: unknown, at$?: string): BoolResult;
|
|
128
142
|
export declare function encodeStatusResult(value: StatusResult): Record<string, unknown>;
|
package/lib/generated/codecs.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.asSource = asSource;
|
|
6
6
|
exports.asDataCategory = asDataCategory;
|
|
7
|
+
exports.asHealthDataType = asHealthDataType;
|
|
7
8
|
exports.asPermissionStatus = asPermissionStatus;
|
|
8
9
|
exports.asMotionContext = asMotionContext;
|
|
9
10
|
exports.asNutrient = asNutrient;
|
|
@@ -85,6 +86,8 @@ exports.encodeRangeRequest = encodeRangeRequest;
|
|
|
85
86
|
exports.decodeRangeRequest = decodeRangeRequest;
|
|
86
87
|
exports.encodeCategoryRequest = encodeCategoryRequest;
|
|
87
88
|
exports.decodeCategoryRequest = decodeCategoryRequest;
|
|
89
|
+
exports.encodeDataTypeRequest = encodeDataTypeRequest;
|
|
90
|
+
exports.decodeDataTypeRequest = decodeDataTypeRequest;
|
|
88
91
|
exports.encodeRecordIdRequest = encodeRecordIdRequest;
|
|
89
92
|
exports.decodeRecordIdRequest = decodeRecordIdRequest;
|
|
90
93
|
exports.encodeConnectRequest = encodeConnectRequest;
|
|
@@ -101,6 +104,16 @@ exports.encodeTokenProviderRequest = encodeTokenProviderRequest;
|
|
|
101
104
|
exports.decodeTokenProviderRequest = decodeTokenProviderRequest;
|
|
102
105
|
exports.encodeMarkCompleteRequest = encodeMarkCompleteRequest;
|
|
103
106
|
exports.decodeMarkCompleteRequest = decodeMarkCompleteRequest;
|
|
107
|
+
exports.encodeLinkDevIdRequest = encodeLinkDevIdRequest;
|
|
108
|
+
exports.decodeLinkDevIdRequest = decodeLinkDevIdRequest;
|
|
109
|
+
exports.encodeDevIdRequest = encodeDevIdRequest;
|
|
110
|
+
exports.decodeDevIdRequest = decodeDevIdRequest;
|
|
111
|
+
exports.encodeDevIdBinding = encodeDevIdBinding;
|
|
112
|
+
exports.decodeDevIdBinding = decodeDevIdBinding;
|
|
113
|
+
exports.encodeLinkedDevIdsRequest = encodeLinkedDevIdsRequest;
|
|
114
|
+
exports.decodeLinkedDevIdsRequest = decodeLinkedDevIdsRequest;
|
|
115
|
+
exports.encodeDevIdBindingList = encodeDevIdBindingList;
|
|
116
|
+
exports.decodeDevIdBindingList = decodeDevIdBindingList;
|
|
104
117
|
exports.encodeBoolResult = encodeBoolResult;
|
|
105
118
|
exports.decodeBoolResult = decodeBoolResult;
|
|
106
119
|
exports.encodeStatusResult = encodeStatusResult;
|
|
@@ -265,7 +278,7 @@ function asSource(value, at = "Source") {
|
|
|
265
278
|
}
|
|
266
279
|
return value;
|
|
267
280
|
}
|
|
268
|
-
const DataCategoryCases = new Set(["activity", "body", "daily", "sleep", "nutrition", "menstruation", "athlete"]);
|
|
281
|
+
const DataCategoryCases = new Set(["activity", "body", "daily", "sleep", "nutrition", "menstruation", "athlete", "clinicalRecord"]);
|
|
269
282
|
/** Narrows an untyped value to DataCategory, or throws naming the field. */
|
|
270
283
|
function asDataCategory(value, at = "DataCategory") {
|
|
271
284
|
if (typeof value !== "string" || !DataCategoryCases.has(value)) {
|
|
@@ -273,6 +286,14 @@ function asDataCategory(value, at = "DataCategory") {
|
|
|
273
286
|
}
|
|
274
287
|
return value;
|
|
275
288
|
}
|
|
289
|
+
const HealthDataTypeCases = new Set(["steps", "activeEnergy", "basalEnergy", "distance", "floorsClimbed", "swimmingStrokes", "exerciseTime", "moveTime", "standTime", "heartRate", "restingHeartRate", "sleepAnalysis", "workouts", "workoutRoute", "speed", "power", "cyclingCadence", "weight", "height", "bmi", "bodyFat", "leanBodyMass", "waistCircumference", "bloodPressure", "bloodGlucose", "oxygenSaturation", "bodyTemperature", "heartRateVariability", "respiratoryRate", "vo2Max", "insulinDelivery", "heartbeatSeries", "electrocardiogram", "dietaryEnergyConsumed", "dietaryProtein", "dietaryCarbohydrates", "dietaryFatTotal", "dietaryFatSaturated", "dietaryFatMonounsaturated", "dietaryFatPolyunsaturated", "dietarySugar", "dietaryFiber", "dietaryCholesterol", "dietarySodium", "dietaryPotassium", "dietaryCalcium", "dietaryIron", "dietaryMagnesium", "dietaryZinc", "dietaryPhosphorus", "dietaryIodine", "dietaryManganese", "dietaryMolybdenum", "dietarySelenium", "dietaryCopper", "dietaryChromium", "dietaryChloride", "dietaryCaffeine", "dietaryVitaminA", "dietaryVitaminC", "dietaryVitaminD", "dietaryVitaminE", "dietaryVitaminK", "dietaryVitaminB6", "dietaryVitaminB12", "dietaryThiamin", "dietaryRiboflavin", "dietaryNiacin", "dietaryFolate", "dietaryBiotin", "dietaryPantothenicAcid", "dietaryWater", "menstrualFlow", "intermenstrualBleeding", "ovulationTest", "cervicalMucus", "sexualActivity", "pregnancyTest", "progesteroneTest", "pregnancy", "lactation", "contraceptive", "persistentIntermenstrualBleeding", "infrequentCycles", "irregularCycles", "prolongedPeriods", "bleedingDuringPregnancy", "bleedingAfterPregnancy", "biologicalSex", "dateOfBirth", "wheelchairUse", "activityMoveMode", "boneMass", "bodyWaterMass"]);
|
|
290
|
+
/** Narrows an untyped value to HealthDataType, or throws naming the field. */
|
|
291
|
+
function asHealthDataType(value, at = "HealthDataType") {
|
|
292
|
+
if (typeof value !== "string" || !HealthDataTypeCases.has(value)) {
|
|
293
|
+
throw new TypeError(`${at}: ${String(value)} is not a HealthDataType`);
|
|
294
|
+
}
|
|
295
|
+
return value;
|
|
296
|
+
}
|
|
276
297
|
const PermissionStatusCases = new Set(["granted", "denied", "notDetermined", "notDisclosed", "unsupported", "unavailable"]);
|
|
277
298
|
/** Narrows an untyped value to PermissionStatus, or throws naming the field. */
|
|
278
299
|
function asPermissionStatus(value, at = "PermissionStatus") {
|
|
@@ -357,7 +378,7 @@ function asDeviceKeyRevokeOutcome(value, at = "DeviceKeyRevokeOutcome") {
|
|
|
357
378
|
}
|
|
358
379
|
return value;
|
|
359
380
|
}
|
|
360
|
-
const FailureCodeCases = new Set(["healthDataUnavailable", "notConnected", "tokenUnavailable", "tokenRejected", "tokenProviderFailed", "offline", "timedOut", "serverError", "transport", "malformedResponse", "userLimitReached", "upgradeRequired", "platform", "deviceKeyUnavailable", "signatureRejected", "linkRevoked", "linkConflict", "clockSkewed", "devIDMismatch", "syncAlreadyRunning", "linkAlreadyRunning", "storeLocked", "storeUnreadable", "deadlineExceeded", "permissionDenied", "authorizationNotDetermined", "sampleNotFound", "rollbackIncomplete", "distanceNotAttributable", "bloodPressureIncomplete", "authorizationUnavailableInExtension", "routeAwaitingConverter", "readQuotaExceeded", "plannedWorkoutUnnamed"]);
|
|
381
|
+
const FailureCodeCases = new Set(["healthDataUnavailable", "notConnected", "tokenUnavailable", "tokenRejected", "tokenProviderFailed", "offline", "timedOut", "serverError", "transport", "malformedResponse", "userLimitReached", "upgradeRequired", "platform", "deviceKeyUnavailable", "signatureRejected", "linkRevoked", "linkConflict", "clockSkewed", "devIDMismatch", "syncAlreadyRunning", "linkAlreadyRunning", "storeLocked", "storeUnreadable", "deadlineExceeded", "permissionDenied", "authorizationNotDetermined", "sampleNotFound", "rollbackIncomplete", "distanceNotAttributable", "workoutsRequired", "bloodPressureIncomplete", "authorizationUnavailableInExtension", "routeAwaitingConverter", "dataTypeNotEnabled", "linkRefused", "readQuotaExceeded", "plannedWorkoutUnnamed"]);
|
|
361
382
|
/** Narrows an untyped value to FailureCode, or throws naming the field. */
|
|
362
383
|
function asFailureCode(value, at = "FailureCode") {
|
|
363
384
|
if (typeof value !== "string" || !FailureCodeCases.has(value)) {
|
|
@@ -714,6 +735,8 @@ function encodeHealthAccess(value) {
|
|
|
714
735
|
out.read = caseSet(value.read);
|
|
715
736
|
out.write = caseSet(value.write);
|
|
716
737
|
out.workouts = value.workouts.map((item) => encodeWorkoutScope(item));
|
|
738
|
+
if (value.readTypes !== undefined)
|
|
739
|
+
out.readTypes = value.readTypes;
|
|
717
740
|
return out;
|
|
718
741
|
}
|
|
719
742
|
function decodeHealthAccess(raw, at$ = "HealthAccess") {
|
|
@@ -721,7 +744,8 @@ function decodeHealthAccess(raw, at$ = "HealthAccess") {
|
|
|
721
744
|
const read = caseSet(asArray(object.read, `${at$}.read`).map((item, index) => asDataCategory(item, `${`${at$}.read`}[${index}]`)));
|
|
722
745
|
const write = caseSet(asArray(object.write, `${at$}.write`).map((item, index) => asDataCategory(item, `${`${at$}.write`}[${index}]`)));
|
|
723
746
|
const workouts = asArray(object.workouts, `${at$}.workouts`).map((item, index) => decodeWorkoutScope(item, `${`${at$}.workouts`}[${index}]`));
|
|
724
|
-
|
|
747
|
+
const readTypes = optional(object.readTypes, (value) => asArray(value, `${at$}.readTypes`).map((item, index) => asHealthDataType(item, `${`${at$}.readTypes`}[${index}]`)));
|
|
748
|
+
return { read, write, workouts, readTypes };
|
|
725
749
|
}
|
|
726
750
|
function encodeHeartRateEntry(value) {
|
|
727
751
|
const out = {};
|
|
@@ -1071,6 +1095,8 @@ function encodeBootstrapState(value) {
|
|
|
1071
1095
|
out.platform = value.platform;
|
|
1072
1096
|
out.sdkVersion = value.sdkVersion;
|
|
1073
1097
|
out.backgroundRegistered = value.backgroundRegistered;
|
|
1098
|
+
if (value.devIdMode !== undefined)
|
|
1099
|
+
out.devIdMode = value.devIdMode;
|
|
1074
1100
|
return out;
|
|
1075
1101
|
}
|
|
1076
1102
|
function decodeBootstrapState(raw, at$ = "BootstrapState") {
|
|
@@ -1080,7 +1106,8 @@ function decodeBootstrapState(raw, at$ = "BootstrapState") {
|
|
|
1080
1106
|
const platform = asString(object.platform, `${at$}.platform`);
|
|
1081
1107
|
const sdkVersion = asString(object.sdkVersion, `${at$}.sdkVersion`);
|
|
1082
1108
|
const backgroundRegistered = asBoolean(object.backgroundRegistered, `${at$}.backgroundRegistered`);
|
|
1083
|
-
|
|
1109
|
+
const devIdMode = optional(object.devIdMode, (value) => asString(value, `${at$}.devIdMode`));
|
|
1110
|
+
return { bootstrapped, devId, platform, sdkVersion, backgroundRegistered, devIdMode };
|
|
1084
1111
|
}
|
|
1085
1112
|
function encodeTokenRequest(value) {
|
|
1086
1113
|
const out = {};
|
|
@@ -1133,6 +1160,19 @@ function decodeCategoryRequest(raw, at$ = "CategoryRequest") {
|
|
|
1133
1160
|
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1134
1161
|
return { category, source };
|
|
1135
1162
|
}
|
|
1163
|
+
function encodeDataTypeRequest(value) {
|
|
1164
|
+
const out = {};
|
|
1165
|
+
out.type = value.type;
|
|
1166
|
+
if (value.source !== undefined)
|
|
1167
|
+
out.source = value.source;
|
|
1168
|
+
return out;
|
|
1169
|
+
}
|
|
1170
|
+
function decodeDataTypeRequest(raw, at$ = "DataTypeRequest") {
|
|
1171
|
+
const object = asObject(raw, at$);
|
|
1172
|
+
const type = asHealthDataType(object.type, `${at$}.type`);
|
|
1173
|
+
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1174
|
+
return { type, source };
|
|
1175
|
+
}
|
|
1136
1176
|
function encodeRecordIdRequest(value) {
|
|
1137
1177
|
const out = {};
|
|
1138
1178
|
out.id = value.id;
|
|
@@ -1166,6 +1206,8 @@ function encodePermissionRequest(value) {
|
|
|
1166
1206
|
out.workouts = value.workouts.map((item) => encodeWorkoutScope(item));
|
|
1167
1207
|
if (value.source !== undefined)
|
|
1168
1208
|
out.source = value.source;
|
|
1209
|
+
if (value.readTypes !== undefined)
|
|
1210
|
+
out.readTypes = value.readTypes;
|
|
1169
1211
|
return out;
|
|
1170
1212
|
}
|
|
1171
1213
|
function decodePermissionRequest(raw, at$ = "PermissionRequest") {
|
|
@@ -1174,7 +1216,8 @@ function decodePermissionRequest(raw, at$ = "PermissionRequest") {
|
|
|
1174
1216
|
const write = caseSet(asArray(object.write, `${at$}.write`).map((item, index) => asDataCategory(item, `${`${at$}.write`}[${index}]`)));
|
|
1175
1217
|
const workouts = asArray(object.workouts, `${at$}.workouts`).map((item, index) => decodeWorkoutScope(item, `${`${at$}.workouts`}[${index}]`));
|
|
1176
1218
|
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1177
|
-
|
|
1219
|
+
const readTypes = optional(object.readTypes, (value) => asArray(value, `${at$}.readTypes`).map((item, index) => asHealthDataType(item, `${`${at$}.readTypes`}[${index}]`)));
|
|
1220
|
+
return { read, write, workouts, source, readTypes };
|
|
1178
1221
|
}
|
|
1179
1222
|
function encodePermissionGrant(value) {
|
|
1180
1223
|
const out = {};
|
|
@@ -1236,6 +1279,77 @@ function decodeMarkCompleteRequest(raw, at$ = "MarkCompleteRequest") {
|
|
|
1236
1279
|
const at = optional(object.at, (value) => decodeInstant(value, `${at$}.at`));
|
|
1237
1280
|
return { id, at };
|
|
1238
1281
|
}
|
|
1282
|
+
function encodeLinkDevIdRequest(value) {
|
|
1283
|
+
const out = {};
|
|
1284
|
+
out.devId = value.devId;
|
|
1285
|
+
out.token = value.token;
|
|
1286
|
+
if (value.source !== undefined)
|
|
1287
|
+
out.source = value.source;
|
|
1288
|
+
return out;
|
|
1289
|
+
}
|
|
1290
|
+
function decodeLinkDevIdRequest(raw, at$ = "LinkDevIdRequest") {
|
|
1291
|
+
const object = asObject(raw, at$);
|
|
1292
|
+
const devId = asString(object.devId, `${at$}.devId`);
|
|
1293
|
+
const token = asString(object.token, `${at$}.token`);
|
|
1294
|
+
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1295
|
+
return { devId, token, source };
|
|
1296
|
+
}
|
|
1297
|
+
function encodeDevIdRequest(value) {
|
|
1298
|
+
const out = {};
|
|
1299
|
+
out.devId = value.devId;
|
|
1300
|
+
if (value.source !== undefined)
|
|
1301
|
+
out.source = value.source;
|
|
1302
|
+
return out;
|
|
1303
|
+
}
|
|
1304
|
+
function decodeDevIdRequest(raw, at$ = "DevIdRequest") {
|
|
1305
|
+
const object = asObject(raw, at$);
|
|
1306
|
+
const devId = asString(object.devId, `${at$}.devId`);
|
|
1307
|
+
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1308
|
+
return { devId, source };
|
|
1309
|
+
}
|
|
1310
|
+
function encodeDevIdBinding(value) {
|
|
1311
|
+
const out = {};
|
|
1312
|
+
out.devId = value.devId;
|
|
1313
|
+
out.userId = value.userId;
|
|
1314
|
+
if (value.dataTypes !== undefined)
|
|
1315
|
+
out.dataTypes = value.dataTypes;
|
|
1316
|
+
out.linkedAt = encodeInstant(value.linkedAt);
|
|
1317
|
+
out.active = value.active;
|
|
1318
|
+
return out;
|
|
1319
|
+
}
|
|
1320
|
+
function decodeDevIdBinding(raw, at$ = "DevIdBinding") {
|
|
1321
|
+
const object = asObject(raw, at$);
|
|
1322
|
+
const devId = asString(object.devId, `${at$}.devId`);
|
|
1323
|
+
const userId = asString(object.userId, `${at$}.userId`);
|
|
1324
|
+
const dataTypes = optional(object.dataTypes, (value) => asArray(value, `${at$}.dataTypes`).map((item, index) => asString(item, `${`${at$}.dataTypes`}[${index}]`)));
|
|
1325
|
+
const linkedAt = decodeInstant(object.linkedAt, `${at$}.linkedAt`);
|
|
1326
|
+
const active = asBoolean(object.active, `${at$}.active`);
|
|
1327
|
+
return { devId, userId, dataTypes, linkedAt, active };
|
|
1328
|
+
}
|
|
1329
|
+
function encodeLinkedDevIdsRequest(value) {
|
|
1330
|
+
const out = {};
|
|
1331
|
+
if (value.source !== undefined)
|
|
1332
|
+
out.source = value.source;
|
|
1333
|
+
if (value.refresh !== undefined)
|
|
1334
|
+
out.refresh = value.refresh;
|
|
1335
|
+
return out;
|
|
1336
|
+
}
|
|
1337
|
+
function decodeLinkedDevIdsRequest(raw, at$ = "LinkedDevIdsRequest") {
|
|
1338
|
+
const object = asObject(raw, at$);
|
|
1339
|
+
const source = optional(object.source, (value) => asSource(value, `${at$}.source`));
|
|
1340
|
+
const refresh = optional(object.refresh, (value) => asBoolean(value, `${at$}.refresh`));
|
|
1341
|
+
return { source, refresh };
|
|
1342
|
+
}
|
|
1343
|
+
function encodeDevIdBindingList(value) {
|
|
1344
|
+
const out = {};
|
|
1345
|
+
out.bindings = value.bindings.map((item) => encodeDevIdBinding(item));
|
|
1346
|
+
return out;
|
|
1347
|
+
}
|
|
1348
|
+
function decodeDevIdBindingList(raw, at$ = "DevIdBindingList") {
|
|
1349
|
+
const object = asObject(raw, at$);
|
|
1350
|
+
const bindings = asArray(object.bindings, `${at$}.bindings`).map((item, index) => decodeDevIdBinding(item, `${`${at$}.bindings`}[${index}]`));
|
|
1351
|
+
return { bindings };
|
|
1352
|
+
}
|
|
1239
1353
|
function encodeBoolResult(value) {
|
|
1240
1354
|
const out = {};
|
|
1241
1355
|
out.value = value.value;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Every code a rejected op can carry. */
|
|
2
|
-
export type TerraErrorCode = "health_data_unavailable" | "not_connected" | "route_awaiting_converter" | "token_unavailable" | "token_rejected" | "token_provider_failed" | "user_limit_reached" | "upgrade_required" | "platform" | "device_key_unavailable" | "signature_rejected" | "clock_skewed" | "link_revoked" | "dev_id_mismatch" | "link_conflict" | "sync_already_running" | "link_already_running" | "store_locked" | "store_unreadable" | "deadline_exceeded" | "read_quota_exceeded" | "permission_denied" | "authorization_not_determined" | "sample_not_found" | "rollback_incomplete" | "distance_not_attributable" | "blood_pressure_incomplete" | "authorization_unavailable_in_extension" | "planned_workout_unnamed" | "network.transport" | "network.throttled" | "network.server_error" | "network.malformed_response" | "network.offline" | "network.timed_out" | "bridge.not_bootstrapped" | "bridge.unsupported_on_platform" | "bridge.no_activity" | "bridge.permission_sheet_unavailable" | "bridge.token_timeout" | "bridge.invalid_payload";
|
|
2
|
+
export type TerraErrorCode = "health_data_unavailable" | "not_connected" | "route_awaiting_converter" | "data_type_not_enabled" | "token_unavailable" | "token_rejected" | "token_provider_failed" | "user_limit_reached" | "upgrade_required" | "platform" | "device_key_unavailable" | "signature_rejected" | "clock_skewed" | "link_revoked" | "dev_id_mismatch" | "link_conflict" | "link_refused" | "sync_already_running" | "link_already_running" | "store_locked" | "store_unreadable" | "deadline_exceeded" | "read_quota_exceeded" | "permission_denied" | "authorization_not_determined" | "sample_not_found" | "rollback_incomplete" | "distance_not_attributable" | "workouts_required" | "blood_pressure_incomplete" | "authorization_unavailable_in_extension" | "health_records_unavailable" | "health_records_usage_description_missing" | "planned_workout_unnamed" | "network.transport" | "network.throttled" | "network.server_error" | "network.malformed_response" | "network.offline" | "network.timed_out" | "bridge.not_bootstrapped" | "bridge.unsupported_on_platform" | "bridge.no_activity" | "bridge.permission_sheet_unavailable" | "bridge.token_timeout" | "bridge.invalid_payload";
|
|
3
3
|
/**
|
|
4
4
|
* Whether retrying the same call could succeed.
|
|
5
5
|
*
|
package/lib/generated/errors.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.retryableByCode = {
|
|
|
13
13
|
"health_data_unavailable": false,
|
|
14
14
|
"not_connected": false,
|
|
15
15
|
"route_awaiting_converter": false,
|
|
16
|
+
"data_type_not_enabled": false,
|
|
16
17
|
"token_unavailable": false,
|
|
17
18
|
"token_rejected": false,
|
|
18
19
|
"token_provider_failed": false,
|
|
@@ -25,6 +26,7 @@ exports.retryableByCode = {
|
|
|
25
26
|
"link_revoked": false,
|
|
26
27
|
"dev_id_mismatch": false,
|
|
27
28
|
"link_conflict": true,
|
|
29
|
+
"link_refused": false,
|
|
28
30
|
"sync_already_running": false,
|
|
29
31
|
"link_already_running": false,
|
|
30
32
|
"store_locked": true,
|
|
@@ -36,8 +38,11 @@ exports.retryableByCode = {
|
|
|
36
38
|
"sample_not_found": false,
|
|
37
39
|
"rollback_incomplete": false,
|
|
38
40
|
"distance_not_attributable": false,
|
|
41
|
+
"workouts_required": false,
|
|
39
42
|
"blood_pressure_incomplete": false,
|
|
40
43
|
"authorization_unavailable_in_extension": false,
|
|
44
|
+
"health_records_unavailable": false,
|
|
45
|
+
"health_records_usage_description_missing": false,
|
|
41
46
|
"planned_workout_unnamed": false,
|
|
42
47
|
"network.transport": true,
|
|
43
48
|
"network.throttled": true,
|
|
@@ -63,6 +68,6 @@ exports.bridgeOwnedCodes = [
|
|
|
63
68
|
];
|
|
64
69
|
/** Codes only one platform can raise, so that a caller can narrow rather than discover. */
|
|
65
70
|
exports.platformOnlyCodes = {
|
|
66
|
-
ios: ["planned_workout_unnamed", "network.offline", "network.timed_out"],
|
|
71
|
+
ios: ["data_type_not_enabled", "health_records_unavailable", "health_records_usage_description_missing", "planned_workout_unnamed", "network.offline", "network.timed_out"],
|
|
67
72
|
android: ["read_quota_exceeded", "bridge.no_activity", "bridge.permission_sheet_unavailable"],
|
|
68
73
|
};
|
package/lib/generated/ops.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `availableOn` is read by the availability test and by the facade, which is what makes an op
|
|
5
5
|
* missing from a platform a typed absence rather than a runtime surprise.
|
|
6
6
|
*/
|
|
7
|
-
export type OpId = "client.attach" | "client.connect" | "client.connections" | "client.availability" | "client.disconnect" | "token.setProviderPresent" | "token.resolve" | "token.reject" | "permissions.request" | "permissions.status" | "permissions.writeStatus" | "permissions.requested" | "permissions.statuses" | "permissions.backgroundReadStatus" | "permissions.historyReadStatus" | "diagnostics.state" | "diagnostics.lastDelivery" | "diagnostics.report" | "diagnostics.send" | "background.isRegistered" | "background.cancel" | "body.heartRate" | "body.restingHeartRate" | "body.readings" | "body.logHeartRate" | "body.log" | "body.delete" | "daily.steps" | "daily.totals" | "daily.intraday" | "daily.log" | "daily.delete" | "sleep.segments" | "sleep.log" | "sleep.delete" | "activity.workouts" | "activity.routes" | "activity.intensity" | "activity.log" | "activity.delete" | "nutrition.quantities" | "nutrition.log" | "nutrition.delete" | "nutrition.hydration" | "menstruation.flow" | "menstruation.events" | "athlete.profile" | "plannedWorkouts.planned" | "plannedWorkouts.markComplete" | "plannedWorkouts.delete" | "plannedWorkouts.schedulingStatus" | "plannedWorkouts.requestScheduling";
|
|
7
|
+
export type OpId = "client.attach" | "client.connect" | "client.connections" | "client.availability" | "client.disconnect" | "client.linkDevId" | "client.unlinkDevId" | "client.linkedDevIds" | "token.setProviderPresent" | "token.resolve" | "token.reject" | "permissions.request" | "permissions.status" | "permissions.typeStatus" | "permissions.writeStatus" | "permissions.requested" | "permissions.requestClinicalRecords" | "permissions.statuses" | "permissions.backgroundReadStatus" | "permissions.historyReadStatus" | "diagnostics.state" | "diagnostics.lastDelivery" | "diagnostics.report" | "diagnostics.send" | "background.isRegistered" | "background.cancel" | "body.heartRate" | "body.restingHeartRate" | "body.readings" | "body.logHeartRate" | "body.log" | "body.delete" | "daily.steps" | "daily.totals" | "daily.intraday" | "daily.log" | "daily.delete" | "sleep.segments" | "sleep.log" | "sleep.delete" | "activity.workouts" | "activity.routes" | "activity.intensity" | "activity.log" | "activity.delete" | "nutrition.quantities" | "nutrition.log" | "nutrition.delete" | "nutrition.hydration" | "menstruation.flow" | "menstruation.events" | "athlete.profile" | "plannedWorkouts.planned" | "plannedWorkouts.markComplete" | "plannedWorkouts.delete" | "plannedWorkouts.schedulingStatus" | "plannedWorkouts.requestScheduling";
|
|
8
8
|
export declare const opIds: readonly OpId[];
|
|
9
9
|
export declare const availableOn: Readonly<Record<OpId, readonly string[]>>;
|
|
10
10
|
export type StreamId = "diagnostics.events" | "body.changes" | "daily.changes" | "sleep.changes" | "activity.changes" | "bridge.tokenRequest";
|
package/lib/generated/ops.js
CHANGED
|
@@ -9,13 +9,18 @@ exports.opIds = [
|
|
|
9
9
|
"client.connections",
|
|
10
10
|
"client.availability",
|
|
11
11
|
"client.disconnect",
|
|
12
|
+
"client.linkDevId",
|
|
13
|
+
"client.unlinkDevId",
|
|
14
|
+
"client.linkedDevIds",
|
|
12
15
|
"token.setProviderPresent",
|
|
13
16
|
"token.resolve",
|
|
14
17
|
"token.reject",
|
|
15
18
|
"permissions.request",
|
|
16
19
|
"permissions.status",
|
|
20
|
+
"permissions.typeStatus",
|
|
17
21
|
"permissions.writeStatus",
|
|
18
22
|
"permissions.requested",
|
|
23
|
+
"permissions.requestClinicalRecords",
|
|
19
24
|
"permissions.statuses",
|
|
20
25
|
"permissions.backgroundReadStatus",
|
|
21
26
|
"permissions.historyReadStatus",
|
|
@@ -63,13 +68,18 @@ exports.availableOn = {
|
|
|
63
68
|
"client.connections": ["ios", "android"],
|
|
64
69
|
"client.availability": ["ios", "android"],
|
|
65
70
|
"client.disconnect": ["ios", "android"],
|
|
71
|
+
"client.linkDevId": ["ios", "android"],
|
|
72
|
+
"client.unlinkDevId": ["ios", "android"],
|
|
73
|
+
"client.linkedDevIds": ["ios", "android"],
|
|
66
74
|
"token.setProviderPresent": ["ios", "android"],
|
|
67
75
|
"token.resolve": ["ios", "android"],
|
|
68
76
|
"token.reject": ["ios", "android"],
|
|
69
77
|
"permissions.request": ["ios", "android"],
|
|
70
78
|
"permissions.status": ["ios", "android"],
|
|
79
|
+
"permissions.typeStatus": ["ios", "android"],
|
|
71
80
|
"permissions.writeStatus": ["ios", "android"],
|
|
72
81
|
"permissions.requested": ["ios", "android"],
|
|
82
|
+
"permissions.requestClinicalRecords": ["ios"],
|
|
73
83
|
"permissions.statuses": ["android"],
|
|
74
84
|
"permissions.backgroundReadStatus": ["android"],
|
|
75
85
|
"permissions.historyReadStatus": ["android"],
|
|
@@ -151,6 +161,8 @@ exports.eventKinds = {
|
|
|
151
161
|
"plannedWorkoutsScheduled": ["ios"],
|
|
152
162
|
"plannedWorkoutScheduleFailed": ["ios"],
|
|
153
163
|
"sleepWakeDateTooLarge": ["ios"],
|
|
164
|
+
"clinicalRecordTooLarge": ["ios"],
|
|
165
|
+
"devIDBindingChanged": ["ios", "android"],
|
|
154
166
|
"backgroundWorkGap": ["android"],
|
|
155
167
|
"backgroundWorkReset": ["android"],
|
|
156
168
|
"changeTokenExpired": ["android"],
|
package/lib/generated/types.d.ts
CHANGED
|
@@ -2,8 +2,19 @@
|
|
|
2
2
|
export type Source = "health" | "samsungHealth";
|
|
3
3
|
export declare const SourceValues: readonly Source[];
|
|
4
4
|
/** The unit permissions are asked for and changes are reported against. */
|
|
5
|
-
export type DataCategory = "activity" | "body" | "daily" | "sleep" | "nutrition" | "menstruation" | "athlete";
|
|
5
|
+
export type DataCategory = "activity" | "body" | "daily" | "sleep" | "nutrition" | "menstruation" | "athlete" | "clinicalRecord";
|
|
6
6
|
export declare const DataCategoryValues: readonly DataCategory[];
|
|
7
|
+
/**
|
|
8
|
+
* One kind of health data, at the granularity a permission sheet can ask for it: the
|
|
9
|
+
* type-level twin of DataCategory. permissions.request with readTypes asks for exactly these,
|
|
10
|
+
* and from then on the SDK reads and uploads nothing else. Each dietary type is HealthKit's
|
|
11
|
+
* HKQuantityTypeIdentifierDietary identifier less its prefix; on Health Connect they all read
|
|
12
|
+
* NutritionRecord, and the store keeps only the requested nutrients of each meal.
|
|
13
|
+
* healthObservation and clinicalRecord have no types. docs/sdk-reference.md lists the
|
|
14
|
+
* HealthKit and Health Connect types behind each and the route it feeds.
|
|
15
|
+
*/
|
|
16
|
+
export type HealthDataType = "steps" | "activeEnergy" | "basalEnergy" | "distance" | "floorsClimbed" | "swimmingStrokes" | "exerciseTime" | "moveTime" | "standTime" | "heartRate" | "restingHeartRate" | "sleepAnalysis" | "workouts" | "workoutRoute" | "speed" | "power" | "cyclingCadence" | "weight" | "height" | "bmi" | "bodyFat" | "leanBodyMass" | "waistCircumference" | "bloodPressure" | "bloodGlucose" | "oxygenSaturation" | "bodyTemperature" | "heartRateVariability" | "respiratoryRate" | "vo2Max" | "insulinDelivery" | "heartbeatSeries" | "electrocardiogram" | "dietaryEnergyConsumed" | "dietaryProtein" | "dietaryCarbohydrates" | "dietaryFatTotal" | "dietaryFatSaturated" | "dietaryFatMonounsaturated" | "dietaryFatPolyunsaturated" | "dietarySugar" | "dietaryFiber" | "dietaryCholesterol" | "dietarySodium" | "dietaryPotassium" | "dietaryCalcium" | "dietaryIron" | "dietaryMagnesium" | "dietaryZinc" | "dietaryPhosphorus" | "dietaryIodine" | "dietaryManganese" | "dietaryMolybdenum" | "dietarySelenium" | "dietaryCopper" | "dietaryChromium" | "dietaryChloride" | "dietaryCaffeine" | "dietaryVitaminA" | "dietaryVitaminC" | "dietaryVitaminD" | "dietaryVitaminE" | "dietaryVitaminK" | "dietaryVitaminB6" | "dietaryVitaminB12" | "dietaryThiamin" | "dietaryRiboflavin" | "dietaryNiacin" | "dietaryFolate" | "dietaryBiotin" | "dietaryPantothenicAcid" | "dietaryWater" | "menstrualFlow" | "intermenstrualBleeding" | "ovulationTest" | "cervicalMucus" | "sexualActivity" | "pregnancyTest" | "progesteroneTest" | "pregnancy" | "lactation" | "contraceptive" | "persistentIntermenstrualBleeding" | "infrequentCycles" | "irregularCycles" | "prolongedPeriods" | "bleedingDuringPregnancy" | "bleedingAfterPregnancy" | "biologicalSex" | "dateOfBirth" | "wheelchairUse" | "activityMoveMode" | "boneMass" | "bodyWaterMass";
|
|
17
|
+
export declare const HealthDataTypeValues: readonly HealthDataType[];
|
|
7
18
|
export type PermissionStatus = "granted" | "denied" | "notDetermined" | "notDisclosed" | "unsupported" | "unavailable";
|
|
8
19
|
export declare const PermissionStatusValues: readonly PermissionStatus[];
|
|
9
20
|
export type MotionContext = "unknown" | "sedentary" | "active";
|
|
@@ -51,7 +62,7 @@ export declare const DeviceKeyRevokeOutcomeValues: readonly DeviceKeyRevokeOutco
|
|
|
51
62
|
* The redacted error name an event carries. Deliberately not TerraErrorCode: an event names
|
|
52
63
|
* the failure without the detail bag, because a support report leaves the device.
|
|
53
64
|
*/
|
|
54
|
-
export type FailureCode = "healthDataUnavailable" | "notConnected" | "tokenUnavailable" | "tokenRejected" | "tokenProviderFailed" | "offline" | "timedOut" | "serverError" | "transport" | "malformedResponse" | "userLimitReached" | "upgradeRequired" | "platform" | "deviceKeyUnavailable" | "signatureRejected" | "linkRevoked" | "linkConflict" | "clockSkewed" | "devIDMismatch" | "syncAlreadyRunning" | "linkAlreadyRunning" | "storeLocked" | "storeUnreadable" | "deadlineExceeded" | "permissionDenied" | "authorizationNotDetermined" | "sampleNotFound" | "rollbackIncomplete" | "distanceNotAttributable" | "bloodPressureIncomplete" | "authorizationUnavailableInExtension" | "routeAwaitingConverter" | "readQuotaExceeded" | "plannedWorkoutUnnamed";
|
|
65
|
+
export type FailureCode = "healthDataUnavailable" | "notConnected" | "tokenUnavailable" | "tokenRejected" | "tokenProviderFailed" | "offline" | "timedOut" | "serverError" | "transport" | "malformedResponse" | "userLimitReached" | "upgradeRequired" | "platform" | "deviceKeyUnavailable" | "signatureRejected" | "linkRevoked" | "linkConflict" | "clockSkewed" | "devIDMismatch" | "syncAlreadyRunning" | "linkAlreadyRunning" | "storeLocked" | "storeUnreadable" | "deadlineExceeded" | "permissionDenied" | "authorizationNotDetermined" | "sampleNotFound" | "rollbackIncomplete" | "distanceNotAttributable" | "workoutsRequired" | "bloodPressureIncomplete" | "authorizationUnavailableInExtension" | "routeAwaitingConverter" | "dataTypeNotEnabled" | "linkRefused" | "readQuotaExceeded" | "plannedWorkoutUnnamed";
|
|
55
66
|
export declare const FailureCodeValues: readonly FailureCode[];
|
|
56
67
|
/**
|
|
57
68
|
* Whether Terra's plans can be put on the person's Apple Watch. unsupported before iOS 17 or
|
|
@@ -377,6 +388,12 @@ export interface HealthAccess {
|
|
|
377
388
|
readonly read: readonly DataCategory[];
|
|
378
389
|
readonly write: readonly DataCategory[];
|
|
379
390
|
readonly workouts: readonly WorkoutScope[];
|
|
391
|
+
/**
|
|
392
|
+
* The types asked for individually, sorted by wire name; absent for an install that asked only
|
|
393
|
+
* by category. Optional rather than a set so every earlier payload still decodes. Once present
|
|
394
|
+
* the install reads and uploads only these types and the types of the categories in read.
|
|
395
|
+
*/
|
|
396
|
+
readonly readTypes?: readonly HealthDataType[] | undefined;
|
|
380
397
|
}
|
|
381
398
|
export interface HeartRateEntry {
|
|
382
399
|
readonly time: Date;
|
|
@@ -521,6 +538,12 @@ export interface BootstrapState {
|
|
|
521
538
|
readonly platform: string;
|
|
522
539
|
readonly sdkVersion: string;
|
|
523
540
|
readonly backgroundRegistered: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* single or multiple, as the native bootstrap configured the client (Info.plist TerraDevIDMode
|
|
543
|
+
* on iOS, manifest meta-data co.tryterra.sdk.DEV_ID_MODE on Android). Lets the app detect a
|
|
544
|
+
* missing key before linkDevId refuses with dev_id_mismatch.
|
|
545
|
+
*/
|
|
546
|
+
readonly devIdMode?: string | undefined;
|
|
524
547
|
}
|
|
525
548
|
/**
|
|
526
549
|
* The broker asking JS for a link token. Answered by token.resolve or token.reject with the
|
|
@@ -541,6 +564,10 @@ export interface CategoryRequest {
|
|
|
541
564
|
readonly category: DataCategory;
|
|
542
565
|
readonly source?: Source | undefined;
|
|
543
566
|
}
|
|
567
|
+
export interface DataTypeRequest {
|
|
568
|
+
readonly type: HealthDataType;
|
|
569
|
+
readonly source?: Source | undefined;
|
|
570
|
+
}
|
|
544
571
|
export interface RecordIdRequest {
|
|
545
572
|
readonly id: string;
|
|
546
573
|
}
|
|
@@ -558,6 +585,12 @@ export interface PermissionRequest {
|
|
|
558
585
|
readonly write: readonly DataCategory[];
|
|
559
586
|
readonly workouts: readonly WorkoutScope[];
|
|
560
587
|
readonly source?: Source | undefined;
|
|
588
|
+
/**
|
|
589
|
+
* Individual types to read, for a host that discloses specific data rather than whole
|
|
590
|
+
* categories. Optional, so a payload from a wrapper that predates types still decodes. A type
|
|
591
|
+
* this platform has no store type for rejects with bridge.unsupported_on_platform.
|
|
592
|
+
*/
|
|
593
|
+
readonly readTypes?: readonly HealthDataType[] | undefined;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* What the sheet granted. Android answers with the access this call obtained; HealthKit will
|
|
@@ -584,6 +617,41 @@ export interface MarkCompleteRequest {
|
|
|
584
617
|
readonly id: string;
|
|
585
618
|
readonly at?: Date | undefined;
|
|
586
619
|
}
|
|
620
|
+
/** One customer linking a multi-dev-id installation, with a link token that customer minted. */
|
|
621
|
+
export interface LinkDevIdRequest {
|
|
622
|
+
readonly devId: string;
|
|
623
|
+
readonly token: string;
|
|
624
|
+
readonly source?: Source | undefined;
|
|
625
|
+
}
|
|
626
|
+
export interface DevIdRequest {
|
|
627
|
+
readonly devId: string;
|
|
628
|
+
readonly source?: Source | undefined;
|
|
629
|
+
}
|
|
630
|
+
/** One customer's connection to a multi-dev-id installation's shared device link. */
|
|
631
|
+
export interface DevIdBinding {
|
|
632
|
+
readonly devId: string;
|
|
633
|
+
/** Terra's id for this customer's connection. */
|
|
634
|
+
readonly userId: string;
|
|
635
|
+
/**
|
|
636
|
+
* The upload routes the customer selected, as Terra answered at link. Absent when Terra did
|
|
637
|
+
* not say, which syncs the app's requested access for this customer.
|
|
638
|
+
*/
|
|
639
|
+
readonly dataTypes?: readonly string[] | undefined;
|
|
640
|
+
readonly linkedAt: Date;
|
|
641
|
+
/**
|
|
642
|
+
* False once Terra's init no longer lists this connection: the customer removed it or stopped
|
|
643
|
+
* accepting the key. Nothing is read or backfilled for it until the customer links again.
|
|
644
|
+
*/
|
|
645
|
+
readonly active: boolean;
|
|
646
|
+
}
|
|
647
|
+
export interface LinkedDevIdsRequest {
|
|
648
|
+
readonly source?: Source | undefined;
|
|
649
|
+
/** Ask Terra's init first, so active is as of now. */
|
|
650
|
+
readonly refresh?: boolean | undefined;
|
|
651
|
+
}
|
|
652
|
+
export interface DevIdBindingList {
|
|
653
|
+
readonly bindings: readonly DevIdBinding[];
|
|
654
|
+
}
|
|
587
655
|
export interface BoolResult {
|
|
588
656
|
readonly value: boolean;
|
|
589
657
|
}
|
package/lib/generated/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Generated from surface/terra-surface.json by surface/gen. Do not edit by hand.
|
|
3
3
|
// Regenerate with: node surface/gen/src/cli.ts generate
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.MenstrualEventKindValues = exports.VO2MaxTestTypeValues = exports.HeartRateVariabilityMetricValues = exports.BodyTemperatureMetricValues = exports.GlucoseSpecimenValues = exports.GlucoseMealTimeValues = exports.BloodGlucoseUnitValues = exports.BodyMetricValues = exports.WorkoutIntensityMetricValues = exports.IntradayMetricValues = exports.DayTotalMetricValues = exports.WorkoutSchedulingStatusValues = exports.FailureCodeValues = exports.DeviceKeyRevokeOutcomeValues = exports.DiagnosticsReasonValues = exports.BackgroundRestrictionReasonValues = exports.ActivityMoveModeValues = exports.BiologicalSexValues = exports.MenstruationFlowValues = exports.MealTypeValues = exports.NutrientValues = exports.MotionContextValues = exports.PermissionStatusValues = exports.DataCategoryValues = exports.SourceValues = void 0;
|
|
5
|
+
exports.MenstrualEventKindValues = exports.VO2MaxTestTypeValues = exports.HeartRateVariabilityMetricValues = exports.BodyTemperatureMetricValues = exports.GlucoseSpecimenValues = exports.GlucoseMealTimeValues = exports.BloodGlucoseUnitValues = exports.BodyMetricValues = exports.WorkoutIntensityMetricValues = exports.IntradayMetricValues = exports.DayTotalMetricValues = exports.WorkoutSchedulingStatusValues = exports.FailureCodeValues = exports.DeviceKeyRevokeOutcomeValues = exports.DiagnosticsReasonValues = exports.BackgroundRestrictionReasonValues = exports.ActivityMoveModeValues = exports.BiologicalSexValues = exports.MenstruationFlowValues = exports.MealTypeValues = exports.NutrientValues = exports.MotionContextValues = exports.PermissionStatusValues = exports.HealthDataTypeValues = exports.DataCategoryValues = exports.SourceValues = void 0;
|
|
6
6
|
exports.SourceValues = [
|
|
7
7
|
"health",
|
|
8
8
|
"samsungHealth",
|
|
@@ -15,6 +15,103 @@ exports.DataCategoryValues = [
|
|
|
15
15
|
"nutrition",
|
|
16
16
|
"menstruation",
|
|
17
17
|
"athlete",
|
|
18
|
+
"clinicalRecord",
|
|
19
|
+
];
|
|
20
|
+
exports.HealthDataTypeValues = [
|
|
21
|
+
"steps",
|
|
22
|
+
"activeEnergy",
|
|
23
|
+
"basalEnergy",
|
|
24
|
+
"distance",
|
|
25
|
+
"floorsClimbed",
|
|
26
|
+
"swimmingStrokes",
|
|
27
|
+
"exerciseTime",
|
|
28
|
+
"moveTime",
|
|
29
|
+
"standTime",
|
|
30
|
+
"heartRate",
|
|
31
|
+
"restingHeartRate",
|
|
32
|
+
"sleepAnalysis",
|
|
33
|
+
"workouts",
|
|
34
|
+
"workoutRoute",
|
|
35
|
+
"speed",
|
|
36
|
+
"power",
|
|
37
|
+
"cyclingCadence",
|
|
38
|
+
"weight",
|
|
39
|
+
"height",
|
|
40
|
+
"bmi",
|
|
41
|
+
"bodyFat",
|
|
42
|
+
"leanBodyMass",
|
|
43
|
+
"waistCircumference",
|
|
44
|
+
"bloodPressure",
|
|
45
|
+
"bloodGlucose",
|
|
46
|
+
"oxygenSaturation",
|
|
47
|
+
"bodyTemperature",
|
|
48
|
+
"heartRateVariability",
|
|
49
|
+
"respiratoryRate",
|
|
50
|
+
"vo2Max",
|
|
51
|
+
"insulinDelivery",
|
|
52
|
+
"heartbeatSeries",
|
|
53
|
+
"electrocardiogram",
|
|
54
|
+
"dietaryEnergyConsumed",
|
|
55
|
+
"dietaryProtein",
|
|
56
|
+
"dietaryCarbohydrates",
|
|
57
|
+
"dietaryFatTotal",
|
|
58
|
+
"dietaryFatSaturated",
|
|
59
|
+
"dietaryFatMonounsaturated",
|
|
60
|
+
"dietaryFatPolyunsaturated",
|
|
61
|
+
"dietarySugar",
|
|
62
|
+
"dietaryFiber",
|
|
63
|
+
"dietaryCholesterol",
|
|
64
|
+
"dietarySodium",
|
|
65
|
+
"dietaryPotassium",
|
|
66
|
+
"dietaryCalcium",
|
|
67
|
+
"dietaryIron",
|
|
68
|
+
"dietaryMagnesium",
|
|
69
|
+
"dietaryZinc",
|
|
70
|
+
"dietaryPhosphorus",
|
|
71
|
+
"dietaryIodine",
|
|
72
|
+
"dietaryManganese",
|
|
73
|
+
"dietaryMolybdenum",
|
|
74
|
+
"dietarySelenium",
|
|
75
|
+
"dietaryCopper",
|
|
76
|
+
"dietaryChromium",
|
|
77
|
+
"dietaryChloride",
|
|
78
|
+
"dietaryCaffeine",
|
|
79
|
+
"dietaryVitaminA",
|
|
80
|
+
"dietaryVitaminC",
|
|
81
|
+
"dietaryVitaminD",
|
|
82
|
+
"dietaryVitaminE",
|
|
83
|
+
"dietaryVitaminK",
|
|
84
|
+
"dietaryVitaminB6",
|
|
85
|
+
"dietaryVitaminB12",
|
|
86
|
+
"dietaryThiamin",
|
|
87
|
+
"dietaryRiboflavin",
|
|
88
|
+
"dietaryNiacin",
|
|
89
|
+
"dietaryFolate",
|
|
90
|
+
"dietaryBiotin",
|
|
91
|
+
"dietaryPantothenicAcid",
|
|
92
|
+
"dietaryWater",
|
|
93
|
+
"menstrualFlow",
|
|
94
|
+
"intermenstrualBleeding",
|
|
95
|
+
"ovulationTest",
|
|
96
|
+
"cervicalMucus",
|
|
97
|
+
"sexualActivity",
|
|
98
|
+
"pregnancyTest",
|
|
99
|
+
"progesteroneTest",
|
|
100
|
+
"pregnancy",
|
|
101
|
+
"lactation",
|
|
102
|
+
"contraceptive",
|
|
103
|
+
"persistentIntermenstrualBleeding",
|
|
104
|
+
"infrequentCycles",
|
|
105
|
+
"irregularCycles",
|
|
106
|
+
"prolongedPeriods",
|
|
107
|
+
"bleedingDuringPregnancy",
|
|
108
|
+
"bleedingAfterPregnancy",
|
|
109
|
+
"biologicalSex",
|
|
110
|
+
"dateOfBirth",
|
|
111
|
+
"wheelchairUse",
|
|
112
|
+
"activityMoveMode",
|
|
113
|
+
"boneMass",
|
|
114
|
+
"bodyWaterMass",
|
|
18
115
|
];
|
|
19
116
|
exports.PermissionStatusValues = [
|
|
20
117
|
"granted",
|
|
@@ -144,9 +241,12 @@ exports.FailureCodeValues = [
|
|
|
144
241
|
"sampleNotFound",
|
|
145
242
|
"rollbackIncomplete",
|
|
146
243
|
"distanceNotAttributable",
|
|
244
|
+
"workoutsRequired",
|
|
147
245
|
"bloodPressureIncomplete",
|
|
148
246
|
"authorizationUnavailableInExtension",
|
|
149
247
|
"routeAwaitingConverter",
|
|
248
|
+
"dataTypeNotEnabled",
|
|
249
|
+
"linkRefused",
|
|
150
250
|
"readQuotaExceeded",
|
|
151
251
|
"plannedWorkoutUnnamed",
|
|
152
252
|
];
|
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export { createTerra } from "./createTerra";
|
|
16
16
|
export { Terra } from "./Terra";
|
|
17
|
-
export type { ActivityMetrics, AthleteMetrics, Background, BodyMetrics, DailyMetrics, Diagnostics, MenstruationMetrics, NativeBridge, NutritionMetrics, Permissions, PlannedWorkouts, SleepMetrics, StreamListener, TerraOptions, TokenProvider, Unsubscribe, } from "./Terra";
|
|
17
|
+
export type { ActivityMetrics, AthleteMetrics, Background, BodyMetrics, DailyMetrics, Diagnostics, LinkedDevIds, MenstruationMetrics, NativeBridge, NutritionMetrics, Permissions, PlannedWorkouts, SleepMetrics, StreamListener, TerraOptions, TokenProvider, Unsubscribe, } from "./Terra";
|
|
18
18
|
export { TerraError } from "./TerraError";
|
|
19
19
|
export type { TerraErrorJSON } from "./TerraError";
|
|
20
20
|
export { EndUser } from "./EndUser";
|