case-editor-tools 1.7.1 → 1.7.2
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.
|
@@ -14,6 +14,8 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
14
14
|
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
15
15
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
16
16
|
isStudyCodePresent: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
17
|
+
getCurrentStudyCounterValue: (scopeKey: string | Expression) => Expression;
|
|
18
|
+
getNextStudyCounterValue: (scopeKey: string | Expression) => Expression;
|
|
17
19
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
|
|
18
20
|
eventPayload: {
|
|
19
21
|
hasEventPayload: () => Expression;
|
|
@@ -80,8 +82,9 @@ export declare const StudyEngineActions: {
|
|
|
80
82
|
participantActions: {
|
|
81
83
|
updateStudyStatus: (status: string) => Expression;
|
|
82
84
|
startNewStudySession: () => Expression;
|
|
83
|
-
updateFlag: (key: string, newValue: string | number | Expression) => Expression;
|
|
84
|
-
removeFlag: (key: string) => Expression;
|
|
85
|
+
updateFlag: (key: string | Expression, newValue: string | number | Expression) => Expression;
|
|
86
|
+
removeFlag: (key: string | Expression) => Expression;
|
|
87
|
+
getNextStudyCounterAsFlag: (scopeKey: string | Expression, flagKey: string | Expression, prefix: string | Expression, padding: number | Expression) => Expression;
|
|
85
88
|
assignedSurveys: {
|
|
86
89
|
add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression, activeUntil?: number | Expression) => Expression;
|
|
87
90
|
removeAll: () => Expression;
|
|
@@ -100,6 +103,7 @@ export declare const StudyEngineActions: {
|
|
|
100
103
|
set: (forKey: string | Expression, value: string | Expression) => Expression;
|
|
101
104
|
delete: (forKey?: string | Expression) => Expression;
|
|
102
105
|
drawFromStudyCodeList: (listKey: string | Expression, forKey?: string | Expression) => Expression;
|
|
106
|
+
getNextStudyCounterAsLinkingCode: (scopeKey: string | Expression, linkingCodeKey: string | Expression, prefix: string | Expression, padding: number | Expression) => Expression;
|
|
103
107
|
};
|
|
104
108
|
messages: {
|
|
105
109
|
add: (messageType: string, scheduledFor: number | Expression) => Expression;
|
|
@@ -116,6 +120,7 @@ export declare const StudyEngineActions: {
|
|
|
116
120
|
finishParticipation: () => Expression;
|
|
117
121
|
};
|
|
118
122
|
removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
123
|
+
resetStudyCounter: (scopeKey: string | Expression) => Expression;
|
|
119
124
|
notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
|
|
120
125
|
};
|
|
121
126
|
export declare const StudyEngine: {
|
|
@@ -153,8 +158,9 @@ export declare const StudyEngine: {
|
|
|
153
158
|
participantActions: {
|
|
154
159
|
updateStudyStatus: (status: string) => Expression;
|
|
155
160
|
startNewStudySession: () => Expression;
|
|
156
|
-
updateFlag: (key: string, newValue: string | number | Expression) => Expression;
|
|
157
|
-
removeFlag: (key: string) => Expression;
|
|
161
|
+
updateFlag: (key: string | Expression, newValue: string | number | Expression) => Expression;
|
|
162
|
+
removeFlag: (key: string | Expression) => Expression;
|
|
163
|
+
getNextStudyCounterAsFlag: (scopeKey: string | Expression, flagKey: string | Expression, prefix: string | Expression, padding: number | Expression) => Expression;
|
|
158
164
|
assignedSurveys: {
|
|
159
165
|
add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression, activeUntil?: number | Expression) => Expression;
|
|
160
166
|
removeAll: () => Expression;
|
|
@@ -173,6 +179,7 @@ export declare const StudyEngine: {
|
|
|
173
179
|
set: (forKey: string | Expression, value: string | Expression) => Expression;
|
|
174
180
|
delete: (forKey?: string | Expression) => Expression;
|
|
175
181
|
drawFromStudyCodeList: (listKey: string | Expression, forKey?: string | Expression) => Expression;
|
|
182
|
+
getNextStudyCounterAsLinkingCode: (scopeKey: string | Expression, linkingCodeKey: string | Expression, prefix: string | Expression, padding: number | Expression) => Expression;
|
|
176
183
|
};
|
|
177
184
|
messages: {
|
|
178
185
|
add: (messageType: string, scheduledFor: number | Expression) => Expression;
|
|
@@ -189,6 +196,7 @@ export declare const StudyEngine: {
|
|
|
189
196
|
finishParticipation: () => Expression;
|
|
190
197
|
};
|
|
191
198
|
removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
199
|
+
resetStudyCounter: (scopeKey: string | Expression) => Expression;
|
|
192
200
|
notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
|
|
193
201
|
checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'CUSTOM' | 'LEAVE') => Expression;
|
|
194
202
|
checkEventKey: (equalsKey: string) => Expression;
|
|
@@ -202,6 +210,8 @@ export declare const StudyEngine: {
|
|
|
202
210
|
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
203
211
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
204
212
|
isStudyCodePresent: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
213
|
+
getCurrentStudyCounterValue: (scopeKey: string | Expression) => Expression;
|
|
214
|
+
getNextStudyCounterValue: (scopeKey: string | Expression) => Expression;
|
|
205
215
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
|
|
206
216
|
eventPayload: {
|
|
207
217
|
hasEventPayload: () => Expression;
|
|
@@ -91,6 +91,22 @@ const countResponseItems = (itemKey, responseKey) => {
|
|
|
91
91
|
const isStudyCodePresent = (listKey, code) => {
|
|
92
92
|
return expressionUtils_expressionGen.generateExpression('isStudyCodePresent', undefined, listKey, code);
|
|
93
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Get the current study counter value for the given scope key (does not change the counter)
|
|
96
|
+
* @param scopeKey
|
|
97
|
+
* @returns
|
|
98
|
+
*/
|
|
99
|
+
const getCurrentStudyCounterValue = (scopeKey) => {
|
|
100
|
+
return expressionUtils_expressionGen.generateExpression('getCurrentStudyCounterValue', undefined, scopeKey);
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Get the next study counter value for the given scope key (increases the counter by 1)
|
|
104
|
+
* @param scopeKey
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
const getNextStudyCounterValue = (scopeKey) => {
|
|
108
|
+
return expressionUtils_expressionGen.generateExpression('getNextStudyCounterValue', undefined, scopeKey);
|
|
109
|
+
};
|
|
94
110
|
/**
|
|
95
111
|
* Method to run a check on previous responses of the participant.
|
|
96
112
|
* @param condition expression that will be evaluated on each retrieved response
|
|
@@ -433,6 +449,36 @@ const DELETE_LINKING_CODE = (forKey) => {
|
|
|
433
449
|
const DRAW_STUDY_CODE_AS_LINKING_CODE = (listKey, forKey) => {
|
|
434
450
|
return expressionUtils_expressionGen.generateExpression('DRAW_STUDY_CODE_AS_LINKING_CODE', undefined, listKey, forKey);
|
|
435
451
|
};
|
|
452
|
+
/**
|
|
453
|
+
* Get the next study counter value for the given scope key (increases the counter by 1) and store it as a flag for the participant
|
|
454
|
+
* @param scopeKey
|
|
455
|
+
* @param flagKey
|
|
456
|
+
* @param prefix prefix to be added to the flag
|
|
457
|
+
* @param padding number of digits to pad the counter with
|
|
458
|
+
* @returns
|
|
459
|
+
*/
|
|
460
|
+
const GET_NEXT_STUDY_COUNTER_AS_FLAG = (scopeKey, flagKey, prefix, padding) => {
|
|
461
|
+
return expressionUtils_expressionGen.generateExpression('GET_NEXT_STUDY_COUNTER_AS_FLAG', undefined, scopeKey, flagKey, prefix, padding);
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Get the next study counter value for the given scope key (increases the counter by 1) and store it as a linking code for the participant
|
|
465
|
+
* @param scopeKey
|
|
466
|
+
* @param linkingCodeKey
|
|
467
|
+
* @param prefix prefix to be added to the linking code
|
|
468
|
+
* @param padding number of digits to pad the counter with
|
|
469
|
+
* @returns
|
|
470
|
+
*/
|
|
471
|
+
const GET_NEXT_STUDY_COUNTER_AS_LINKING_CODE = (scopeKey, linkingCodeKey, prefix, padding) => {
|
|
472
|
+
return expressionUtils_expressionGen.generateExpression('GET_NEXT_STUDY_COUNTER_AS_LINKING_CODE', undefined, scopeKey, linkingCodeKey, prefix, padding);
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Reset the study counter for the given scope key
|
|
476
|
+
* @param scopeKey
|
|
477
|
+
* @returns
|
|
478
|
+
*/
|
|
479
|
+
const RESET_STUDY_COUNTER = (scopeKey) => {
|
|
480
|
+
return expressionUtils_expressionGen.generateExpression('RESET_STUDY_COUNTER', undefined, scopeKey);
|
|
481
|
+
};
|
|
436
482
|
/**
|
|
437
483
|
* Method to call external event handler
|
|
438
484
|
* @param serviceName name of the external service endpoint that should be used (URL and API key are config of the service)
|
|
@@ -515,6 +561,8 @@ const NativeStudyEngineExpressions = {
|
|
|
515
561
|
hasResponseKeyWithValue,
|
|
516
562
|
countResponseItems,
|
|
517
563
|
isStudyCodePresent,
|
|
564
|
+
getCurrentStudyCounterValue,
|
|
565
|
+
getNextStudyCounterValue,
|
|
518
566
|
// Old responses
|
|
519
567
|
checkConditionForOldResponses,
|
|
520
568
|
// Event payload methods:
|
|
@@ -589,6 +637,7 @@ const StudyEngineActions = {
|
|
|
589
637
|
startNewStudySession: START_NEW_STUDY_SESSION,
|
|
590
638
|
updateFlag: UPDATE_FLAG,
|
|
591
639
|
removeFlag: REMOVE_FLAG,
|
|
640
|
+
getNextStudyCounterAsFlag: GET_NEXT_STUDY_COUNTER_AS_FLAG,
|
|
592
641
|
assignedSurveys: {
|
|
593
642
|
add: ADD_NEW_SURVEY,
|
|
594
643
|
removeAll: REMOVE_ALL_SURVEYS,
|
|
@@ -608,6 +657,7 @@ const StudyEngineActions = {
|
|
|
608
657
|
set: SET_LINKING_CODE,
|
|
609
658
|
delete: DELETE_LINKING_CODE,
|
|
610
659
|
drawFromStudyCodeList: DRAW_STUDY_CODE_AS_LINKING_CODE,
|
|
660
|
+
getNextStudyCounterAsLinkingCode: GET_NEXT_STUDY_COUNTER_AS_LINKING_CODE,
|
|
611
661
|
},
|
|
612
662
|
messages: {
|
|
613
663
|
add: ADD_MESSAGE,
|
|
@@ -625,6 +675,7 @@ const StudyEngineActions = {
|
|
|
625
675
|
finishParticipation,
|
|
626
676
|
},
|
|
627
677
|
removeStudyCode: REMOVE_STUDY_CODE,
|
|
678
|
+
resetStudyCounter: RESET_STUDY_COUNTER,
|
|
628
679
|
notifyResearcher: NOTIFY_RESEARCHER,
|
|
629
680
|
};
|
|
630
681
|
const StudyEngine = Object.assign(Object.assign(Object.assign({}, NativeStudyEngineExpressions), StudyEngineActions), { singleChoice: {
|
|
@@ -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.7.
|
|
4
|
+
"version": "1.7.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|