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