@d4l/collect-lib 1.50.0 → 1.51.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/dist/index.mjs CHANGED
@@ -749,7 +749,7 @@ var BLE_PSMS_ANNOTATION_ITEM_PPG_IR = {
749
749
  };
750
750
  var BLE_PSMS_ANNOTATION_ITEM_ACCELERATION = {
751
751
  type: "samsungSdkAcceleration",
752
- size: 12,
752
+ size: 6,
753
753
  format: "signedInt",
754
754
  littleEndian: true,
755
755
  channels: 3,
@@ -951,13 +951,13 @@ var GARMIN_ACTIVITY_ANNOTATION = [
951
951
  ];
952
952
  var GARMIN_SIGNAL_TYPE_ANNOTATIONS = {
953
953
  heartRate: FITBIT_HEART_RATE_ANNOTATION,
954
- hrv: FITBIT_HEART_RATE_VARIABILITY_ANNOTATION,
954
+ hrv: DEVICE_ANNOTATION_HRV_RMSSD,
955
955
  spo2: FITBIT_SPO2_ANNOTATION,
956
956
  sleep: FITBIT_SLEEP_ANNOTATION,
957
957
  steps: FITBIT_STEPS_ANNOTATION,
958
958
  calories: FITBIT_CALORIES_ANNOTATION,
959
959
  respiratoryRate: FITBIT_BREATHING_RATE_ANNOTATION,
960
- skinTemperature: FITBIT_SKIN_TEMPERATURE_ANNOTATION,
960
+ skinTemperature: DEVICE_ANNOTATION_SKIN_TEMPERATURE_DEVIATION,
961
961
  stress: OURA_STRESS_ANNOTATION,
962
962
  menstrualCycle: MENSTRUAL_CYCLE_ANNOTATION,
963
963
  // Daily floors climbed: cumulative day total from /dailies (same float32 encoding
@@ -6308,6 +6308,38 @@ var DonationSDK = class {
6308
6308
  }
6309
6309
  return true;
6310
6310
  }
6311
+ /**
6312
+ * Upload one batch of tracking events (BI events) to the dedicated tracking
6313
+ * endpoint. Tracking donations are stored under the `tracking` type on the
6314
+ * backend and are excluded from restoration.
6315
+ * @param donorIdentity The donor identity
6316
+ * @param program The program the events belong to
6317
+ * @param document The tracking events batch document
6318
+ * @param batchId The UUID identifying this batch (idempotent across retries)
6319
+ * @returns True if the upload succeeded
6320
+ */
6321
+ async donateTrackingEvents(donorIdentity, program, document, batchId) {
6322
+ validateProgramName(program.name, donorIdentity);
6323
+ if (!document.events.length) {
6324
+ return true;
6325
+ }
6326
+ const donations = await this.encryptDonations(
6327
+ [{ id: batchId, document, status: "Active" }],
6328
+ donorIdentity,
6329
+ program.donation.target
6330
+ );
6331
+ const authenticatedDonationAPI = await this.getAuthenticatedDonationAPI(donorIdentity);
6332
+ try {
6333
+ await authenticatedDonationAPI.put({
6334
+ uri: `/tracking/${program.name}`,
6335
+ body: JSON.stringify(donations)
6336
+ });
6337
+ } catch (e) {
6338
+ console.error(e);
6339
+ throw new Error("internal_server_error" /* INTERNAL_SERVER_ERROR */);
6340
+ }
6341
+ return true;
6342
+ }
6311
6343
  /**
6312
6344
  * Encrypt donations to be donated to a specific target
6313
6345
  * @param donatableRecords The donations to encrypt
@@ -6482,6 +6514,9 @@ var DonationSDK = class {
6482
6514
  }
6483
6515
  };
6484
6516
 
6517
+ // src/tracking/types.ts
6518
+ var TRACKING_RESOURCE_TYPE = "TrackingEvents";
6519
+
6485
6520
  // src/helper/datetime.ts
6486
6521
  var stringToDate = (dateString) => {
6487
6522
  const date = new Date(dateString);
@@ -7440,6 +7475,7 @@ export {
7440
7475
  TAG_LENGTH,
7441
7476
  TOPIC_ID_PATTERN,
7442
7477
  TOPIC_SCOPE_CODES,
7478
+ TRACKING_RESOURCE_TYPE,
7443
7479
  TimeFuncs,
7444
7480
  TokenNamingSystem,
7445
7481
  TopicInputScopeUrl,