@d4l/collect-lib 1.50.0 → 1.51.0
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.d.mts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +38 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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:
|
|
752
|
+
size: 6,
|
|
753
753
|
format: "signedInt",
|
|
754
754
|
littleEndian: true,
|
|
755
755
|
channels: 3,
|
|
@@ -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,
|