case-editor-tools 1.0.0-beta.28 → 1.0.0-beta.31
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/expression-utils/studyEngineExpressions.d.ts +4 -0
- package/expression-utils/studyEngineExpressions.js +21 -0
- package/expression-utils/studyEngineExpressions.js.map +1 -1
- package/package.json +2 -2
- package/surveys/survey-engine-expressions.d.ts +1 -0
- package/surveys/survey-engine-expressions.js +8 -1
- package/surveys/survey-engine-expressions.js.map +1 -1
|
@@ -7,6 +7,8 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
7
7
|
responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
|
|
8
8
|
getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
|
|
9
9
|
getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
|
|
10
|
+
hasResponseKey: (itemKey: string, responseKey: string) => Expression;
|
|
11
|
+
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
10
12
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
11
13
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
|
|
12
14
|
participantState: {
|
|
@@ -114,6 +116,8 @@ export declare const StudyEngine: {
|
|
|
114
116
|
responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
|
|
115
117
|
getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
|
|
116
118
|
getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
|
|
119
|
+
hasResponseKey: (itemKey: string, responseKey: string) => Expression;
|
|
120
|
+
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
117
121
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
118
122
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
|
|
119
123
|
participantState: {
|
|
@@ -37,6 +37,25 @@ const responseHasKeysAny = (itemKey, responseSlotKey, ...optionKeys) => expressi
|
|
|
37
37
|
* @returns true if a response key is present, but is not in the list defined by optionKeys. If item or the response group is not found, returns false.
|
|
38
38
|
*/
|
|
39
39
|
const responseHasOnlyKeysOtherThan = (itemKey, responseSlotKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, responseSlotKey, ...optionKeys);
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param itemKey full key to the survey item, in the form, e.g., <surveyKey>.<groupKey>.<itemKey>
|
|
43
|
+
* @param responseKey full key to the response that should exists
|
|
44
|
+
* @returns if item contains responseKey return true
|
|
45
|
+
*/
|
|
46
|
+
const hasResponseKey = (itemKey, responseKey) => {
|
|
47
|
+
return expressionUtils_expressionGen.generateExpression('hasResponseKey', undefined, itemKey, responseKey);
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param itemKey full key to the survey item, in the form, e.g., <surveyKey>.<groupKey>.<itemKey>
|
|
52
|
+
* @param responseKey full key to the response that should exists
|
|
53
|
+
* @param value the response object with the above key should have this value
|
|
54
|
+
* @returns if the response object exists and has the value return true
|
|
55
|
+
*/
|
|
56
|
+
const hasResponseKeyWithValue = (itemKey, responseKey, value) => {
|
|
57
|
+
return expressionUtils_expressionGen.generateExpression('hasResponseKeyWithValue', undefined, itemKey, responseKey, value);
|
|
58
|
+
};
|
|
40
59
|
const getResponseValueAsNum = (itemKey, responseKey) => {
|
|
41
60
|
return expressionUtils_expressionGen.generateExpression('getResponseValueAsNum', 'float', itemKey, responseKey);
|
|
42
61
|
};
|
|
@@ -268,6 +287,8 @@ const NativeStudyEngineExpressions = {
|
|
|
268
287
|
responseHasOnlyKeysOtherThan,
|
|
269
288
|
getResponseValueAsNum,
|
|
270
289
|
getResponseValueAsStr,
|
|
290
|
+
hasResponseKey,
|
|
291
|
+
hasResponseKeyWithValue,
|
|
271
292
|
countResponseItems,
|
|
272
293
|
// Old responses
|
|
273
294
|
checkConditionForOldResponses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "case-editor-tools",
|
|
3
3
|
"description": "Javascript tools to simplify survey and study coding for CASE.",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.31",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"build": "rollup -c"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"survey-engine": "^1.0.
|
|
23
|
+
"survey-engine": "^1.0.4"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -78,6 +78,7 @@ export declare const SurveyEngine: {
|
|
|
78
78
|
hasKeyAndValue: (key: string, value: string) => Expression;
|
|
79
79
|
getAsNum: (key: string) => Expression;
|
|
80
80
|
};
|
|
81
|
+
isLoggedIn: () => Expression;
|
|
81
82
|
getters: {
|
|
82
83
|
getContext: () => Expression;
|
|
83
84
|
getResponses: () => Expression;
|
|
@@ -319,6 +319,13 @@ const hasParticipantFlagKey = (key) => {
|
|
|
319
319
|
const hasParticipantFlagKeyAndValue = (key, value) => {
|
|
320
320
|
return eq(getAttribute(getAttribute(getContext(), 'participantFlags'), key), value);
|
|
321
321
|
};
|
|
322
|
+
/**
|
|
323
|
+
* Check if the participant is logged in currently.
|
|
324
|
+
* @returns true if context variable isLoggedIn is set and true
|
|
325
|
+
*/
|
|
326
|
+
const isLoggedIn = () => {
|
|
327
|
+
return and(isDefined(getAttribute(getContext(), 'isLoggedIn')), getAttribute(getContext(), 'isLoggedIn'));
|
|
328
|
+
};
|
|
322
329
|
/**
|
|
323
330
|
* Counts the number of selected options in a multiple choice question
|
|
324
331
|
* @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
|
|
@@ -429,7 +436,7 @@ const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressio
|
|
|
429
436
|
hasKey: hasParticipantFlagKey,
|
|
430
437
|
hasKeyAndValue: hasParticipantFlagKeyAndValue,
|
|
431
438
|
getAsNum: parseParticipantFlagAsNum,
|
|
432
|
-
} });
|
|
439
|
+
}, isLoggedIn });
|
|
433
440
|
|
|
434
441
|
exports.NativeSurveyEngineExpressions = NativeSurveyEngineExpressions;
|
|
435
442
|
exports.SurveyEngine = SurveyEngine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|