@d4l/collect-lib 1.20.0 → 1.21.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/README.md +90 -27
- package/dist/index.d.mts +145 -53
- package/dist/index.d.ts +145 -53
- package/dist/index.js +188 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +197 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1048,6 +1048,9 @@ function calculateValueSetScore(item, valueSets, scoring) {
|
|
|
1048
1048
|
var _a2;
|
|
1049
1049
|
return Object.values((_a2 = scoringSystems[system]) != null ? _a2 : {});
|
|
1050
1050
|
});
|
|
1051
|
+
if (possibleValues.length === 0) {
|
|
1052
|
+
return { min: 0, max: 0 };
|
|
1053
|
+
}
|
|
1051
1054
|
return { min: Math.min(...possibleValues), max: Math.max(...possibleValues) };
|
|
1052
1055
|
}
|
|
1053
1056
|
function calculateNumericScore(item, scoring) {
|
|
@@ -4866,7 +4869,7 @@ var DonationSDK = class {
|
|
|
4866
4869
|
let hasMore = true;
|
|
4867
4870
|
while (hasMore) {
|
|
4868
4871
|
const [response, _] = await authenticatedDonationAPI.get({
|
|
4869
|
-
uri: `/responses/${programName}?limit=${limit}&offset=${offset}&updatedAfter=${updatedAfter}`
|
|
4872
|
+
uri: `/responses/${programName}?limit=${limit}&offset=${offset}&updatedAfter=${encodeURIComponent(updatedAfter)}`
|
|
4870
4873
|
});
|
|
4871
4874
|
limit = response.limit;
|
|
4872
4875
|
responses = [...responses, ...response.responses];
|
|
@@ -4978,7 +4981,67 @@ var evaluateOperator = (value, operator, operand) => {
|
|
|
4978
4981
|
return false;
|
|
4979
4982
|
}
|
|
4980
4983
|
};
|
|
4981
|
-
var
|
|
4984
|
+
var AnswerCodeGuard = class {
|
|
4985
|
+
constructor(questionID, operator, operand, surveyName, offset) {
|
|
4986
|
+
this.offset = Duration.fromObject({});
|
|
4987
|
+
this.surveyName = surveyName;
|
|
4988
|
+
this.questionID = questionID;
|
|
4989
|
+
this.operand = operand;
|
|
4990
|
+
this.operator = operator;
|
|
4991
|
+
if (offset) {
|
|
4992
|
+
const parsedOffset = Duration.fromISO(offset);
|
|
4993
|
+
if (parsedOffset.isValid) {
|
|
4994
|
+
this.offset = parsedOffset;
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
evaluate(answers) {
|
|
4999
|
+
const { operand, questionID, operator } = this;
|
|
5000
|
+
if (!operand) {
|
|
5001
|
+
return false;
|
|
5002
|
+
}
|
|
5003
|
+
const answer = answers[questionID];
|
|
5004
|
+
if (!answer) {
|
|
5005
|
+
return false;
|
|
5006
|
+
}
|
|
5007
|
+
if (Array.isArray(answer)) {
|
|
5008
|
+
switch (operator) {
|
|
5009
|
+
case "exists":
|
|
5010
|
+
return !!answer.length;
|
|
5011
|
+
case "=":
|
|
5012
|
+
return answer.includes(operand);
|
|
5013
|
+
case "!=":
|
|
5014
|
+
return !answer.includes(operand);
|
|
5015
|
+
default:
|
|
5016
|
+
return false;
|
|
5017
|
+
}
|
|
5018
|
+
} else {
|
|
5019
|
+
switch (operator) {
|
|
5020
|
+
case "exists":
|
|
5021
|
+
return !!answer;
|
|
5022
|
+
case "=":
|
|
5023
|
+
return answer === operand;
|
|
5024
|
+
case "!=":
|
|
5025
|
+
return answer !== operand;
|
|
5026
|
+
default:
|
|
5027
|
+
return false;
|
|
5028
|
+
}
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
getFulfillmentDate(params) {
|
|
5032
|
+
const { multiAnswers } = params;
|
|
5033
|
+
if (!this.surveyName || multiAnswers === void 0) {
|
|
5034
|
+
return null;
|
|
5035
|
+
}
|
|
5036
|
+
let fulfilled = this.evaluate(multiAnswers[this.surveyName].answers);
|
|
5037
|
+
if (!fulfilled) {
|
|
5038
|
+
return null;
|
|
5039
|
+
}
|
|
5040
|
+
const answerDate = DateTime4.fromJSDate(multiAnswers[this.surveyName].date).plus(this.offset);
|
|
5041
|
+
return answerDate.toJSDate();
|
|
5042
|
+
}
|
|
5043
|
+
};
|
|
5044
|
+
var AnswerDateGuard = class {
|
|
4982
5045
|
constructor(questionID, operand, operator, surveyName, offset) {
|
|
4983
5046
|
this.offset = Duration.fromObject({});
|
|
4984
5047
|
this.surveyName = surveyName;
|
|
@@ -5007,8 +5070,9 @@ var DateCondition = class {
|
|
|
5007
5070
|
}
|
|
5008
5071
|
return evaluateOperator(has.getTime(), operator, operand.getTime());
|
|
5009
5072
|
}
|
|
5010
|
-
getFulfillmentDate(
|
|
5011
|
-
|
|
5073
|
+
getFulfillmentDate(params) {
|
|
5074
|
+
const { multiAnswers } = params;
|
|
5075
|
+
if (this.surveyName && multiAnswers !== void 0) {
|
|
5012
5076
|
const answer = multiAnswers[this.surveyName].answers[this.questionID];
|
|
5013
5077
|
if (answer && !Array.isArray(answer)) {
|
|
5014
5078
|
const jsDate = new Date(answer);
|
|
@@ -5021,8 +5085,8 @@ var DateCondition = class {
|
|
|
5021
5085
|
return null;
|
|
5022
5086
|
}
|
|
5023
5087
|
};
|
|
5024
|
-
var
|
|
5025
|
-
var
|
|
5088
|
+
var newStepDateGuard = (questionID, surveyName, offset) => new AnswerDateGuard(questionID, "irrelevant", "exists", surveyName, offset);
|
|
5089
|
+
var YearGuard = class {
|
|
5026
5090
|
constructor(questionID, operand, operator) {
|
|
5027
5091
|
this.questionID = questionID;
|
|
5028
5092
|
this.operand = stringToYear(operand);
|
|
@@ -5043,70 +5107,11 @@ var YearCondition = class {
|
|
|
5043
5107
|
}
|
|
5044
5108
|
return evaluateOperator(has, operator, operand);
|
|
5045
5109
|
}
|
|
5046
|
-
getFulfillmentDate(
|
|
5110
|
+
getFulfillmentDate(_params) {
|
|
5047
5111
|
return null;
|
|
5048
5112
|
}
|
|
5049
5113
|
};
|
|
5050
|
-
var
|
|
5051
|
-
constructor(questionID, operand, operator, surveyName, offset) {
|
|
5052
|
-
this.offset = Duration.fromObject({});
|
|
5053
|
-
this.surveyName = surveyName;
|
|
5054
|
-
this.questionID = questionID;
|
|
5055
|
-
this.operand = operand;
|
|
5056
|
-
this.operator = operator;
|
|
5057
|
-
if (offset) {
|
|
5058
|
-
const parsedOffset = Duration.fromISO(offset);
|
|
5059
|
-
if (parsedOffset.isValid) {
|
|
5060
|
-
this.offset = parsedOffset;
|
|
5061
|
-
}
|
|
5062
|
-
}
|
|
5063
|
-
}
|
|
5064
|
-
evaluate(answers) {
|
|
5065
|
-
const { operand, questionID, operator } = this;
|
|
5066
|
-
if (!operand) {
|
|
5067
|
-
return false;
|
|
5068
|
-
}
|
|
5069
|
-
const answer = answers[questionID];
|
|
5070
|
-
if (!answer) {
|
|
5071
|
-
return false;
|
|
5072
|
-
}
|
|
5073
|
-
if (Array.isArray(answer)) {
|
|
5074
|
-
switch (operator) {
|
|
5075
|
-
case "exists":
|
|
5076
|
-
return !!answer.length;
|
|
5077
|
-
case "=":
|
|
5078
|
-
return answer.includes(operand);
|
|
5079
|
-
case "!=":
|
|
5080
|
-
return !answer.includes(operand);
|
|
5081
|
-
default:
|
|
5082
|
-
return false;
|
|
5083
|
-
}
|
|
5084
|
-
} else {
|
|
5085
|
-
switch (operator) {
|
|
5086
|
-
case "exists":
|
|
5087
|
-
return !!answer;
|
|
5088
|
-
case "=":
|
|
5089
|
-
return answer === operand;
|
|
5090
|
-
case "!=":
|
|
5091
|
-
return answer !== operand;
|
|
5092
|
-
default:
|
|
5093
|
-
return false;
|
|
5094
|
-
}
|
|
5095
|
-
}
|
|
5096
|
-
}
|
|
5097
|
-
getFulfillmentDate(multiAnswers) {
|
|
5098
|
-
if (!this.surveyName) {
|
|
5099
|
-
return null;
|
|
5100
|
-
}
|
|
5101
|
-
let fulfilled = this.evaluate(multiAnswers[this.surveyName].answers);
|
|
5102
|
-
if (!fulfilled) {
|
|
5103
|
-
return null;
|
|
5104
|
-
}
|
|
5105
|
-
const answerDate = DateTime4.fromJSDate(multiAnswers[this.surveyName].date).plus(this.offset);
|
|
5106
|
-
return answerDate.toJSDate();
|
|
5107
|
-
}
|
|
5108
|
-
};
|
|
5109
|
-
var DecimalCondition = class {
|
|
5114
|
+
var DecimalGuard = class {
|
|
5110
5115
|
constructor(questionID, operand, operator) {
|
|
5111
5116
|
this.questionID = questionID;
|
|
5112
5117
|
this.operand = operand;
|
|
@@ -5127,11 +5132,11 @@ var DecimalCondition = class {
|
|
|
5127
5132
|
}
|
|
5128
5133
|
return evaluateOperator(has, operator, operand);
|
|
5129
5134
|
}
|
|
5130
|
-
getFulfillmentDate(
|
|
5135
|
+
getFulfillmentDate(_params) {
|
|
5131
5136
|
return null;
|
|
5132
5137
|
}
|
|
5133
5138
|
};
|
|
5134
|
-
var
|
|
5139
|
+
var ExistsGuard = class {
|
|
5135
5140
|
constructor(questionID) {
|
|
5136
5141
|
this.questionID = questionID;
|
|
5137
5142
|
}
|
|
@@ -5139,18 +5144,18 @@ var ExistsCondition = class {
|
|
|
5139
5144
|
const { questionID } = this;
|
|
5140
5145
|
return !!answers[questionID];
|
|
5141
5146
|
}
|
|
5142
|
-
getFulfillmentDate(
|
|
5147
|
+
getFulfillmentDate(_params) {
|
|
5143
5148
|
return null;
|
|
5144
5149
|
}
|
|
5145
5150
|
};
|
|
5146
|
-
var
|
|
5151
|
+
var BoolGuard = class {
|
|
5147
5152
|
constructor(condition) {
|
|
5148
5153
|
this.condition = condition;
|
|
5149
5154
|
}
|
|
5150
5155
|
evaluate(_answers) {
|
|
5151
5156
|
return this.condition;
|
|
5152
5157
|
}
|
|
5153
|
-
getFulfillmentDate(
|
|
5158
|
+
getFulfillmentDate(_params) {
|
|
5154
5159
|
return this.condition ? /* @__PURE__ */ new Date() : null;
|
|
5155
5160
|
}
|
|
5156
5161
|
};
|
|
@@ -5175,10 +5180,10 @@ var Conjunction = class {
|
|
|
5175
5180
|
}
|
|
5176
5181
|
return true;
|
|
5177
5182
|
}
|
|
5178
|
-
getFulfillmentDate(
|
|
5183
|
+
getFulfillmentDate(params) {
|
|
5179
5184
|
let fulfillmentDates = [];
|
|
5180
5185
|
for (const condition of this.conditions) {
|
|
5181
|
-
const fulfillmentDate = condition.getFulfillmentDate(
|
|
5186
|
+
const fulfillmentDate = condition.getFulfillmentDate(params);
|
|
5182
5187
|
if (!fulfillmentDate) {
|
|
5183
5188
|
return null;
|
|
5184
5189
|
}
|
|
@@ -5204,10 +5209,10 @@ var Disjunction = class {
|
|
|
5204
5209
|
}
|
|
5205
5210
|
return false;
|
|
5206
5211
|
}
|
|
5207
|
-
getFulfillmentDate(
|
|
5212
|
+
getFulfillmentDate(params) {
|
|
5208
5213
|
let fulfillmentDates = [];
|
|
5209
5214
|
for (const condition of this.conditions) {
|
|
5210
|
-
const fulfillmentDate = condition.getFulfillmentDate(
|
|
5215
|
+
const fulfillmentDate = condition.getFulfillmentDate(params);
|
|
5211
5216
|
if (fulfillmentDate) {
|
|
5212
5217
|
fulfillmentDates.push(fulfillmentDate);
|
|
5213
5218
|
}
|
|
@@ -5233,8 +5238,8 @@ var Offset = class {
|
|
|
5233
5238
|
evaluate(answers) {
|
|
5234
5239
|
return this.condition.evaluate(answers);
|
|
5235
5240
|
}
|
|
5236
|
-
getFulfillmentDate(
|
|
5237
|
-
const fulfillmentDate = this.condition.getFulfillmentDate(
|
|
5241
|
+
getFulfillmentDate(params) {
|
|
5242
|
+
const fulfillmentDate = this.condition.getFulfillmentDate(params);
|
|
5238
5243
|
if (fulfillmentDate && !isNaN(fulfillmentDate == null ? void 0 : fulfillmentDate.getTime())) {
|
|
5239
5244
|
const answerDate = DateTime4.fromJSDate(fulfillmentDate).plus(this.offset);
|
|
5240
5245
|
return answerDate.toJSDate();
|
|
@@ -5242,7 +5247,7 @@ var Offset = class {
|
|
|
5242
5247
|
return null;
|
|
5243
5248
|
}
|
|
5244
5249
|
};
|
|
5245
|
-
var
|
|
5250
|
+
var ConsentGuard = class {
|
|
5246
5251
|
constructor(consentKey, offset) {
|
|
5247
5252
|
this.offset = Duration.fromObject({});
|
|
5248
5253
|
this.consentKey = consentKey;
|
|
@@ -5254,14 +5259,15 @@ var ConsentCondition = class {
|
|
|
5254
5259
|
evaluate(_answers) {
|
|
5255
5260
|
return true;
|
|
5256
5261
|
}
|
|
5257
|
-
getFulfillmentDate(
|
|
5262
|
+
getFulfillmentDate(params) {
|
|
5263
|
+
const { consentTimes } = params;
|
|
5258
5264
|
if (!(consentTimes == null ? void 0 : consentTimes[this.consentKey])) {
|
|
5259
5265
|
return null;
|
|
5260
5266
|
}
|
|
5261
5267
|
return DateTime4.fromJSDate(consentTimes[this.consentKey]).plus(this.offset).toJSDate();
|
|
5262
5268
|
}
|
|
5263
5269
|
};
|
|
5264
|
-
var
|
|
5270
|
+
var SurveyGuard = class {
|
|
5265
5271
|
constructor(surveyName, offset) {
|
|
5266
5272
|
this.offset = Duration.fromObject({});
|
|
5267
5273
|
this.surveyName = surveyName;
|
|
@@ -5275,7 +5281,11 @@ var SurveyCondition = class {
|
|
|
5275
5281
|
evaluate(_answers) {
|
|
5276
5282
|
return true;
|
|
5277
5283
|
}
|
|
5278
|
-
getFulfillmentDate(
|
|
5284
|
+
getFulfillmentDate(params) {
|
|
5285
|
+
const { multiAnswers } = params;
|
|
5286
|
+
if (!(multiAnswers == null ? void 0 : multiAnswers[this.surveyName])) {
|
|
5287
|
+
return null;
|
|
5288
|
+
}
|
|
5279
5289
|
const date = multiAnswers[this.surveyName].date;
|
|
5280
5290
|
if (!date) {
|
|
5281
5291
|
return null;
|
|
@@ -5287,7 +5297,7 @@ var SurveyCondition = class {
|
|
|
5287
5297
|
return answerDate.toJSDate();
|
|
5288
5298
|
}
|
|
5289
5299
|
};
|
|
5290
|
-
var
|
|
5300
|
+
var RoutineGuard = class {
|
|
5291
5301
|
constructor(routineName, offset) {
|
|
5292
5302
|
this.offset = Duration.fromObject({});
|
|
5293
5303
|
this.routineName = routineName;
|
|
@@ -5299,13 +5309,50 @@ var RoutineCondition = class {
|
|
|
5299
5309
|
evaluate(_answers) {
|
|
5300
5310
|
return true;
|
|
5301
5311
|
}
|
|
5302
|
-
getFulfillmentDate(
|
|
5312
|
+
getFulfillmentDate(params) {
|
|
5313
|
+
const { routineTimes } = params;
|
|
5303
5314
|
if (!(routineTimes == null ? void 0 : routineTimes[this.routineName])) {
|
|
5304
5315
|
return null;
|
|
5305
5316
|
}
|
|
5306
5317
|
return DateTime4.fromJSDate(routineTimes[this.routineName]).plus(this.offset).toJSDate();
|
|
5307
5318
|
}
|
|
5308
5319
|
};
|
|
5320
|
+
var ResponseGuard = class {
|
|
5321
|
+
constructor(responseName, offset) {
|
|
5322
|
+
this.offset = Duration.fromObject({});
|
|
5323
|
+
this.responseName = responseName;
|
|
5324
|
+
if (offset) {
|
|
5325
|
+
const parsedOffset = Duration.fromISO(offset);
|
|
5326
|
+
parsedOffset.isValid && (this.offset = parsedOffset);
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
evaluate(_answers) {
|
|
5330
|
+
return true;
|
|
5331
|
+
}
|
|
5332
|
+
getFulfillmentDate(params) {
|
|
5333
|
+
const { responseTimes } = params;
|
|
5334
|
+
if (!(responseTimes == null ? void 0 : responseTimes[this.responseName])) {
|
|
5335
|
+
return null;
|
|
5336
|
+
}
|
|
5337
|
+
return DateTime4.fromJSDate(responseTimes[this.responseName]).plus(this.offset).toJSDate();
|
|
5338
|
+
}
|
|
5339
|
+
};
|
|
5340
|
+
var DateGuard = class {
|
|
5341
|
+
constructor(date, offset) {
|
|
5342
|
+
this.offset = Duration.fromObject({});
|
|
5343
|
+
this.date = new Date(date);
|
|
5344
|
+
if (offset) {
|
|
5345
|
+
const parsedOffset = Duration.fromISO(offset);
|
|
5346
|
+
parsedOffset.isValid && (this.offset = parsedOffset);
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
evaluate(_answers) {
|
|
5350
|
+
return true;
|
|
5351
|
+
}
|
|
5352
|
+
getFulfillmentDate(_params) {
|
|
5353
|
+
return DateTime4.fromJSDate(this.date).plus(this.offset).toJSDate();
|
|
5354
|
+
}
|
|
5355
|
+
};
|
|
5309
5356
|
var generateQuestionGuard = (enableWhen, enableBehavior) => {
|
|
5310
5357
|
if (!enableWhen || !enableWhen.length || !enableBehavior) {
|
|
5311
5358
|
return void 0;
|
|
@@ -5313,139 +5360,111 @@ var generateQuestionGuard = (enableWhen, enableBehavior) => {
|
|
|
5313
5360
|
const guards = [];
|
|
5314
5361
|
for (const condition of enableWhen) {
|
|
5315
5362
|
if (condition.operator === "exists") {
|
|
5316
|
-
guards.push(new
|
|
5363
|
+
guards.push(new ExistsGuard(condition.question));
|
|
5317
5364
|
} else if (condition.answerDate && condition.answerDate.length === 4) {
|
|
5318
|
-
guards.push(new
|
|
5365
|
+
guards.push(new YearGuard(condition.question, condition.answerDate, condition.operator));
|
|
5319
5366
|
} else if (condition.answerDate) {
|
|
5320
|
-
guards.push(
|
|
5367
|
+
guards.push(
|
|
5368
|
+
new AnswerDateGuard(condition.question, condition.answerDate, condition.operator)
|
|
5369
|
+
);
|
|
5321
5370
|
} else if (condition.answerCoding) {
|
|
5322
5371
|
guards.push(
|
|
5323
|
-
new
|
|
5324
|
-
condition.question,
|
|
5325
|
-
condition.answerCoding.code,
|
|
5326
|
-
condition.operator
|
|
5327
|
-
)
|
|
5372
|
+
new AnswerCodeGuard(condition.question, condition.operator, condition.answerCoding.code)
|
|
5328
5373
|
);
|
|
5329
5374
|
} else if (condition.answerDecimal) {
|
|
5330
5375
|
guards.push(
|
|
5331
|
-
new
|
|
5376
|
+
new DecimalGuard(condition.question, condition.answerDecimal, condition.operator)
|
|
5332
5377
|
);
|
|
5333
5378
|
}
|
|
5334
5379
|
}
|
|
5335
5380
|
return enableBehavior === "all" ? new Conjunction(guards) : new Disjunction(guards);
|
|
5336
5381
|
};
|
|
5337
5382
|
var generateStepGuard = (cond) => {
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
consentKeys: nestedKeys
|
|
5349
|
-
} = generateStepGuard(condition);
|
|
5350
|
-
guards.push(guard);
|
|
5351
|
-
surveyNames.push(...nestedIds);
|
|
5352
|
-
routineNames.push(...nestedRoutineNames);
|
|
5353
|
-
consentKeys.push(...nestedKeys);
|
|
5354
|
-
}
|
|
5355
|
-
surveyNames = [...new Set(surveyNames)];
|
|
5356
|
-
routineNames = [...new Set(routineNames)];
|
|
5357
|
-
consentKeys = [...new Set(consentKeys)];
|
|
5383
|
+
if (cond.type === "and" || cond.type === "or") {
|
|
5384
|
+
const guard = cond.type === "and" ? new Conjunction([], cond.sorting) : new Disjunction([], cond.sorting);
|
|
5385
|
+
return cond.items.reduce(
|
|
5386
|
+
(result, condition) => {
|
|
5387
|
+
const item = generateStepGuard(condition);
|
|
5388
|
+
guard.conditions.push(item.guard);
|
|
5389
|
+
return mergeContexts(result, item);
|
|
5390
|
+
},
|
|
5391
|
+
{ guard }
|
|
5392
|
+
);
|
|
5358
5393
|
}
|
|
5359
5394
|
switch (cond.type) {
|
|
5360
5395
|
case "question":
|
|
5361
5396
|
switch (cond.questionType) {
|
|
5362
5397
|
case "coding":
|
|
5363
5398
|
return {
|
|
5364
|
-
guard: new
|
|
5399
|
+
guard: new AnswerCodeGuard(
|
|
5365
5400
|
cond.linkID,
|
|
5366
|
-
cond.operand,
|
|
5367
5401
|
cond.operator,
|
|
5402
|
+
cond.operand,
|
|
5368
5403
|
cond.surveyName,
|
|
5369
5404
|
cond.offset
|
|
5370
5405
|
),
|
|
5371
|
-
surveyNames: [cond.surveyName]
|
|
5372
|
-
routineNames: [],
|
|
5373
|
-
consentKeys: []
|
|
5406
|
+
surveyNames: [cond.surveyName]
|
|
5374
5407
|
};
|
|
5375
5408
|
case "date":
|
|
5376
5409
|
return {
|
|
5377
|
-
guard:
|
|
5378
|
-
surveyNames: [cond.surveyName]
|
|
5379
|
-
routineNames: [],
|
|
5380
|
-
consentKeys: []
|
|
5410
|
+
guard: newStepDateGuard(cond.linkID, cond.surveyName, cond.offset),
|
|
5411
|
+
surveyNames: [cond.surveyName]
|
|
5381
5412
|
};
|
|
5382
5413
|
default:
|
|
5383
|
-
console.warn(`[Step Guard Generation] Unknown question
|
|
5414
|
+
console.warn(`[Step Guard Generation] Unknown question condition: "${cond}"`);
|
|
5384
5415
|
return {
|
|
5385
|
-
guard: new
|
|
5386
|
-
surveyNames: [cond.surveyName],
|
|
5387
|
-
routineNames: [],
|
|
5388
|
-
consentKeys: []
|
|
5416
|
+
guard: new BoolGuard(false)
|
|
5389
5417
|
};
|
|
5390
5418
|
}
|
|
5391
|
-
case "
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
routineNames,
|
|
5396
|
-
consentKeys
|
|
5397
|
-
};
|
|
5398
|
-
case "or":
|
|
5419
|
+
case "offset":
|
|
5420
|
+
const { guard, surveyNames, routineNames, consentKeys, responseNames } = generateStepGuard(
|
|
5421
|
+
cond.item
|
|
5422
|
+
);
|
|
5399
5423
|
return {
|
|
5400
|
-
guard: new
|
|
5424
|
+
guard: new Offset(guard, cond.offset),
|
|
5401
5425
|
surveyNames,
|
|
5402
5426
|
routineNames,
|
|
5403
|
-
consentKeys
|
|
5404
|
-
|
|
5405
|
-
case "offset":
|
|
5406
|
-
const {
|
|
5407
|
-
guard: offsetGuard,
|
|
5408
|
-
surveyNames: offsetSurveyNames,
|
|
5409
|
-
routineNames: offsetRoutineNames,
|
|
5410
|
-
consentKeys: offsetConsentKeys
|
|
5411
|
-
} = generateStepGuard(cond.item);
|
|
5412
|
-
return {
|
|
5413
|
-
guard: new Offset(offsetGuard, cond.offset),
|
|
5414
|
-
surveyNames: [...offsetSurveyNames],
|
|
5415
|
-
routineNames: [...offsetRoutineNames],
|
|
5416
|
-
consentKeys: [...offsetConsentKeys]
|
|
5427
|
+
consentKeys,
|
|
5428
|
+
responseNames
|
|
5417
5429
|
};
|
|
5418
5430
|
case "consent":
|
|
5419
5431
|
return {
|
|
5420
|
-
guard: new
|
|
5421
|
-
surveyNames: [],
|
|
5422
|
-
routineNames: [],
|
|
5432
|
+
guard: new ConsentGuard(cond.consentKey, cond.offset),
|
|
5423
5433
|
consentKeys: [cond.consentKey]
|
|
5424
5434
|
};
|
|
5425
5435
|
case "survey":
|
|
5426
5436
|
return {
|
|
5427
|
-
guard: new
|
|
5428
|
-
surveyNames: [cond.surveyName]
|
|
5429
|
-
routineNames: [],
|
|
5430
|
-
consentKeys: []
|
|
5437
|
+
guard: new SurveyGuard(cond.surveyName, cond.offset),
|
|
5438
|
+
surveyNames: [cond.surveyName]
|
|
5431
5439
|
};
|
|
5432
5440
|
case "routine":
|
|
5433
5441
|
return {
|
|
5434
|
-
guard: new
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5442
|
+
guard: new RoutineGuard(cond.routineName, cond.offset),
|
|
5443
|
+
routineNames: [cond.routineName]
|
|
5444
|
+
};
|
|
5445
|
+
case "response":
|
|
5446
|
+
return {
|
|
5447
|
+
guard: new ResponseGuard(cond.responseName, cond.offset),
|
|
5448
|
+
responseNames: [cond.responseName]
|
|
5438
5449
|
};
|
|
5450
|
+
case "date":
|
|
5451
|
+
return { guard: new DateGuard(cond.date) };
|
|
5439
5452
|
default:
|
|
5440
|
-
console.warn(`[Step Guard Generation] Unknown condition
|
|
5453
|
+
console.warn(`[Step Guard Generation] Unknown condition: "${cond}"`);
|
|
5441
5454
|
return {
|
|
5442
|
-
guard: new
|
|
5443
|
-
surveyNames: [],
|
|
5444
|
-
routineNames: [],
|
|
5445
|
-
consentKeys: []
|
|
5455
|
+
guard: new BoolGuard(false)
|
|
5446
5456
|
};
|
|
5447
5457
|
}
|
|
5448
5458
|
};
|
|
5459
|
+
function mergeContexts(a, b) {
|
|
5460
|
+
return {
|
|
5461
|
+
guard: a.guard,
|
|
5462
|
+
surveyNames: [.../* @__PURE__ */ new Set([...a.surveyNames || [], ...b.surveyNames || []])],
|
|
5463
|
+
routineNames: [.../* @__PURE__ */ new Set([...a.routineNames || [], ...b.routineNames || []])],
|
|
5464
|
+
consentKeys: [.../* @__PURE__ */ new Set([...a.consentKeys || [], ...b.consentKeys || []])],
|
|
5465
|
+
responseNames: [.../* @__PURE__ */ new Set([...a.responseNames || [], ...b.responseNames || []])]
|
|
5466
|
+
};
|
|
5467
|
+
}
|
|
5449
5468
|
|
|
5450
5469
|
// src/helper/ulid/index.ts
|
|
5451
5470
|
import { Buffer as Buffer11 } from "buffer/";
|
|
@@ -5568,7 +5587,8 @@ export {
|
|
|
5568
5587
|
APPLE_HEALTH_WALKING_RUNNING_DISTANCE_ANNOTATION,
|
|
5569
5588
|
ASMSECGMeasurementAnnotation,
|
|
5570
5589
|
ASMSSpO2MeasurementAnnotation,
|
|
5571
|
-
|
|
5590
|
+
AnswerCodeGuard,
|
|
5591
|
+
AnswerDateGuard,
|
|
5572
5592
|
AppIDNamingSystem,
|
|
5573
5593
|
BLE_ASMS_ANNOTATION_ITEM_ECG,
|
|
5574
5594
|
BLE_ASMS_ANNOTATION_ITEM_SPO2,
|
|
@@ -5611,12 +5631,12 @@ export {
|
|
|
5611
5631
|
BLE_PSMS_ANNOTATION_ITEM_PPG_IR,
|
|
5612
5632
|
BLE_PSMS_ANNOTATION_ITEM_PPG_RED,
|
|
5613
5633
|
BLE_PSMS_ANNOTATION_ITEM_SKIN_TEMPERATURE,
|
|
5614
|
-
|
|
5634
|
+
BoolGuard,
|
|
5615
5635
|
CPMSHealthServicesActivityDetectionAnnotation,
|
|
5616
5636
|
CPMSHealthServicesPassiveDataAnnotation,
|
|
5617
5637
|
CommunicationTypeSystem,
|
|
5618
5638
|
Conjunction,
|
|
5619
|
-
|
|
5639
|
+
ConsentGuard,
|
|
5620
5640
|
ConsentNameSystem,
|
|
5621
5641
|
ConsentVersionSystem,
|
|
5622
5642
|
CustomExtensionDate,
|
|
@@ -5643,12 +5663,12 @@ export {
|
|
|
5643
5663
|
DEVICE_LABEL_CODING,
|
|
5644
5664
|
DEVICE_OUTPUT_RATE_CODING,
|
|
5645
5665
|
DEVICE_SENSOR_DELAY_CODING,
|
|
5646
|
-
|
|
5647
|
-
|
|
5666
|
+
DateGuard,
|
|
5667
|
+
DecimalGuard,
|
|
5648
5668
|
Disjunction,
|
|
5649
5669
|
DonationSDK,
|
|
5650
5670
|
ERROR_CODES,
|
|
5651
|
-
|
|
5671
|
+
ExistsGuard,
|
|
5652
5672
|
FITBIT_ANNOTATION_ITEM_BREATHING_RATE,
|
|
5653
5673
|
FITBIT_ANNOTATION_ITEM_CALORIES,
|
|
5654
5674
|
FITBIT_ANNOTATION_ITEM_HEART_RATE,
|
|
@@ -5691,7 +5711,8 @@ export {
|
|
|
5691
5711
|
RECORDING_SIGNAL_MODEL_CURRENT_VERSION,
|
|
5692
5712
|
RelativeMaxValueExtension,
|
|
5693
5713
|
RelativeMinValueExtension,
|
|
5694
|
-
|
|
5714
|
+
ResponseGuard,
|
|
5715
|
+
RoutineGuard,
|
|
5695
5716
|
RoutineIsPassiveExtension,
|
|
5696
5717
|
SIGNAL_DURATION_CODING,
|
|
5697
5718
|
SensorIdentifierSystem,
|
|
@@ -5702,7 +5723,7 @@ export {
|
|
|
5702
5723
|
SliderMinLabelExtension,
|
|
5703
5724
|
SliderStepSizeExtension,
|
|
5704
5725
|
StudyNameSystem,
|
|
5705
|
-
|
|
5726
|
+
SurveyGuard,
|
|
5706
5727
|
TimeFuncs,
|
|
5707
5728
|
TokenNamingSystem,
|
|
5708
5729
|
ULID_REGEX,
|
|
@@ -5712,7 +5733,7 @@ export {
|
|
|
5712
5733
|
WORDLIST_LANGUAGES,
|
|
5713
5734
|
WearOS3AnnotationMap,
|
|
5714
5735
|
WebConverter,
|
|
5715
|
-
|
|
5736
|
+
YearGuard,
|
|
5716
5737
|
binaryStringToUint8Array,
|
|
5717
5738
|
calculateQuestionnaireScoreRange,
|
|
5718
5739
|
calculateScoreRangeForItem,
|
|
@@ -5741,7 +5762,7 @@ export {
|
|
|
5741
5762
|
isNotBeforeStartDate,
|
|
5742
5763
|
isScoreEligible,
|
|
5743
5764
|
isYearString,
|
|
5744
|
-
|
|
5765
|
+
newStepDateGuard,
|
|
5745
5766
|
overwriteTime,
|
|
5746
5767
|
stringToDate,
|
|
5747
5768
|
stringToYear,
|