@d4l/collect-lib 1.8.0 → 1.10.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 +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3753,6 +3753,28 @@ var DonationSDK = class {
|
|
|
3753
3753
|
};
|
|
3754
3754
|
});
|
|
3755
3755
|
}
|
|
3756
|
+
/**
|
|
3757
|
+
* Get the total size of donations which can be restored for a specific program
|
|
3758
|
+
* @param donorIdentity The identity of the donor to use
|
|
3759
|
+
* @param programName The name of the program to get the size for
|
|
3760
|
+
* @returns The total size of the donations and the size of each individual donation that can be restored
|
|
3761
|
+
* @throws Error if the donation service is not available or if there is an internal server error
|
|
3762
|
+
*/
|
|
3763
|
+
async getRestorationSize(donorIdentity, programName) {
|
|
3764
|
+
if (!await this.donationServiceAvailable()) {
|
|
3765
|
+
throw new Error("not_online" /* NOT_ONLINE */);
|
|
3766
|
+
}
|
|
3767
|
+
validateProgramName(programName, donorIdentity);
|
|
3768
|
+
let authenticatedDonationAPI = await this.getAuthenticatedDonationAPI(donorIdentity);
|
|
3769
|
+
try {
|
|
3770
|
+
const [response] = await authenticatedDonationAPI.get({
|
|
3771
|
+
uri: `/donations/${programName}/size`
|
|
3772
|
+
});
|
|
3773
|
+
return response;
|
|
3774
|
+
} catch (e) {
|
|
3775
|
+
throw new Error("internal_server_error" /* INTERNAL_SERVER_ERROR */);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3756
3778
|
async restore(donorIdentity, programName) {
|
|
3757
3779
|
if (!await this.donationServiceAvailable()) {
|
|
3758
3780
|
throw new Error("not_online" /* NOT_ONLINE */);
|
|
@@ -5091,6 +5113,7 @@ var getPeriod = (progress) => {
|
|
|
5091
5113
|
// src/fhir/seenDisplay.ts
|
|
5092
5114
|
import { Buffer as Buffer10 } from "buffer/";
|
|
5093
5115
|
function generateFHIRSeenDisplay(id, seenDisplay) {
|
|
5116
|
+
var _a;
|
|
5094
5117
|
const contentCodeableConcept = {
|
|
5095
5118
|
coding: [
|
|
5096
5119
|
{
|
|
@@ -5100,6 +5123,17 @@ function generateFHIRSeenDisplay(id, seenDisplay) {
|
|
|
5100
5123
|
}
|
|
5101
5124
|
]
|
|
5102
5125
|
};
|
|
5126
|
+
const hasBlocks = ((_a = seenDisplay.content) == null ? void 0 : _a.blocks) && seenDisplay.content.blocks.length > 0;
|
|
5127
|
+
let contentData;
|
|
5128
|
+
if (hasBlocks) {
|
|
5129
|
+
contentData = JSON.stringify(seenDisplay.content.blocks);
|
|
5130
|
+
} else {
|
|
5131
|
+
contentData = getText(
|
|
5132
|
+
seenDisplay.content,
|
|
5133
|
+
"default.message",
|
|
5134
|
+
seenDisplay.lng
|
|
5135
|
+
);
|
|
5136
|
+
}
|
|
5103
5137
|
const payload = seenDisplay.content ? [
|
|
5104
5138
|
{
|
|
5105
5139
|
contentAttachment: {
|
|
@@ -5110,9 +5144,7 @@ function generateFHIRSeenDisplay(id, seenDisplay) {
|
|
|
5110
5144
|
"default.title",
|
|
5111
5145
|
seenDisplay.lng
|
|
5112
5146
|
),
|
|
5113
|
-
data: Buffer10.from(
|
|
5114
|
-
getText(seenDisplay.content, "default.message", seenDisplay.lng)
|
|
5115
|
-
).toString("base64")
|
|
5147
|
+
data: Buffer10.from(contentData).toString("base64")
|
|
5116
5148
|
},
|
|
5117
5149
|
contentCodeableConcept
|
|
5118
5150
|
}
|