case-editor-tools 1.6.8 → 1.6.9
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.
|
@@ -12,6 +12,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
12
12
|
hasResponseKey: (itemKey: string, responseKey: string) => Expression;
|
|
13
13
|
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
14
14
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
15
|
+
isStudyCodePresent: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
15
16
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
|
|
16
17
|
eventPayload: {
|
|
17
18
|
hasEventPayload: () => Expression;
|
|
@@ -28,6 +29,10 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
28
29
|
hasStudyStatus: (status: string) => Expression;
|
|
29
30
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
30
31
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
32
|
+
linkingCode: {
|
|
33
|
+
has: (forKey: string | Expression) => Expression;
|
|
34
|
+
get: (forKey: string | Expression) => Expression;
|
|
35
|
+
};
|
|
31
36
|
getParticipantFlagValue: (key: string) => Expression;
|
|
32
37
|
getParticipantFlagValueAsNum: (key: string) => Expression;
|
|
33
38
|
getLastSubmissionDate: (surveyKey?: string) => Expression;
|
|
@@ -57,6 +62,8 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
57
62
|
or: (...args: Expression[]) => Expression;
|
|
58
63
|
and: (...args: Expression[]) => Expression;
|
|
59
64
|
not: (arg: Expression) => Expression;
|
|
65
|
+
sum: (...values: (Expression | number)[]) => Expression;
|
|
66
|
+
neg: (value: Expression | number) => Expression;
|
|
60
67
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
61
68
|
getISOWeekForTs: (ts: number | Expression) => Expression;
|
|
62
69
|
getTsForNextISOWeek: (ISOWeek: number | Expression, reference?: number | Expression) => Expression;
|
|
@@ -87,6 +94,10 @@ export declare const StudyEngineActions: {
|
|
|
87
94
|
setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
|
|
88
95
|
setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
|
|
89
96
|
};
|
|
97
|
+
linkingCodes: {
|
|
98
|
+
set: (forKey: string | Expression, value: string | Expression) => Expression;
|
|
99
|
+
delete: (forKey?: string | Expression) => Expression;
|
|
100
|
+
};
|
|
90
101
|
messages: {
|
|
91
102
|
add: (messageType: string, scheduledFor: number | Expression) => Expression;
|
|
92
103
|
removeAll: () => Expression;
|
|
@@ -100,6 +111,7 @@ export declare const StudyEngineActions: {
|
|
|
100
111
|
stopParticipation: () => Expression;
|
|
101
112
|
finishParticipation: () => Expression;
|
|
102
113
|
};
|
|
114
|
+
removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
103
115
|
notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
|
|
104
116
|
};
|
|
105
117
|
export declare const StudyEngine: {
|
|
@@ -153,6 +165,10 @@ export declare const StudyEngine: {
|
|
|
153
165
|
setReportMessage: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
|
|
154
166
|
setReportSummary: (reportKey: string, content: string, asTranslationKey?: boolean) => Expression;
|
|
155
167
|
};
|
|
168
|
+
linkingCodes: {
|
|
169
|
+
set: (forKey: string | Expression, value: string | Expression) => Expression;
|
|
170
|
+
delete: (forKey?: string | Expression) => Expression;
|
|
171
|
+
};
|
|
156
172
|
messages: {
|
|
157
173
|
add: (messageType: string, scheduledFor: number | Expression) => Expression;
|
|
158
174
|
removeAll: () => Expression;
|
|
@@ -166,6 +182,7 @@ export declare const StudyEngine: {
|
|
|
166
182
|
stopParticipation: () => Expression;
|
|
167
183
|
finishParticipation: () => Expression;
|
|
168
184
|
};
|
|
185
|
+
removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
169
186
|
notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
|
|
170
187
|
checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'CUSTOM' | 'LEAVE') => Expression;
|
|
171
188
|
checkEventKey: (equalsKey: string) => Expression;
|
|
@@ -178,6 +195,7 @@ export declare const StudyEngine: {
|
|
|
178
195
|
hasResponseKey: (itemKey: string, responseKey: string) => Expression;
|
|
179
196
|
hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
|
|
180
197
|
countResponseItems: (itemKey: string, responseKey: string) => Expression;
|
|
198
|
+
isStudyCodePresent: (listKey: string | Expression, code: string | Expression) => Expression;
|
|
181
199
|
checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
|
|
182
200
|
eventPayload: {
|
|
183
201
|
hasEventPayload: () => Expression;
|
|
@@ -194,6 +212,10 @@ export declare const StudyEngine: {
|
|
|
194
212
|
hasStudyStatus: (status: string) => Expression;
|
|
195
213
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
196
214
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
215
|
+
linkingCode: {
|
|
216
|
+
has: (forKey: string | Expression) => Expression;
|
|
217
|
+
get: (forKey: string | Expression) => Expression;
|
|
218
|
+
};
|
|
197
219
|
getParticipantFlagValue: (key: string) => Expression;
|
|
198
220
|
getParticipantFlagValueAsNum: (key: string) => Expression;
|
|
199
221
|
getLastSubmissionDate: (surveyKey?: string) => Expression;
|
|
@@ -223,6 +245,8 @@ export declare const StudyEngine: {
|
|
|
223
245
|
or: (...args: Expression[]) => Expression;
|
|
224
246
|
and: (...args: Expression[]) => Expression;
|
|
225
247
|
not: (arg: Expression) => Expression;
|
|
248
|
+
sum: (...values: (Expression | number)[]) => Expression;
|
|
249
|
+
neg: (value: Expression | number) => Expression;
|
|
226
250
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
227
251
|
getISOWeekForTs: (ts: number | Expression) => Expression;
|
|
228
252
|
getTsForNextISOWeek: (ISOWeek: number | Expression, reference?: number | Expression) => Expression;
|
|
@@ -82,6 +82,15 @@ const getSelectedKeys = (itemKey, responseKey) => {
|
|
|
82
82
|
const countResponseItems = (itemKey, responseKey) => {
|
|
83
83
|
return expressionUtils_expressionGen.generateExpression('countResponseItems', undefined, itemKey, responseKey);
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* Check if a study code is present in the study wide list with the given list key
|
|
87
|
+
* @param listKey
|
|
88
|
+
* @param code
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
const isStudyCodePresent = (listKey, code) => {
|
|
92
|
+
return expressionUtils_expressionGen.generateExpression('isStudyCodePresent', undefined, listKey, code);
|
|
93
|
+
};
|
|
85
94
|
/**
|
|
86
95
|
* Method to run a check on previous responses of the participant.
|
|
87
96
|
* @param condition expression that will be evaluated on each retrieved response
|
|
@@ -189,6 +198,8 @@ const lt = (val1, val2) => expressionUtils_expressionGen.generateExpression('lt'
|
|
|
189
198
|
const lte = (val1, val2) => expressionUtils_expressionGen.generateExpression('lte', undefined, val1, val2);
|
|
190
199
|
const gt = (val1, val2) => expressionUtils_expressionGen.generateExpression('gt', undefined, val1, val2);
|
|
191
200
|
const gte = (val1, val2) => expressionUtils_expressionGen.generateExpression('gte', undefined, val1, val2);
|
|
201
|
+
const sum = (...values) => expressionUtils_expressionGen.generateExpression('sum', "float", ...values);
|
|
202
|
+
const neg = (value) => expressionUtils_expressionGen.generateExpression("neg", "float", value);
|
|
192
203
|
/**
|
|
193
204
|
* Generate a timestamp value (POSIX timestamp). T = T_ref + delta. If 'reference' is not defined, the current time will be used as a reference.
|
|
194
205
|
* @param delta offset for the timestamp generation
|
|
@@ -286,6 +297,13 @@ const REMOVE_ALL_MESSAGES = () => expressionUtils_expressionGen.generateExpressi
|
|
|
286
297
|
* @returns
|
|
287
298
|
*/
|
|
288
299
|
const REMOVE_MESSAGES_BY_TYPE = (messageType) => expressionUtils_expressionGen.generateExpression('REMOVE_MESSAGES_BY_TYPE', undefined, messageType);
|
|
300
|
+
/**
|
|
301
|
+
* Remove a study code from a list
|
|
302
|
+
* @param listKey
|
|
303
|
+
* @param code
|
|
304
|
+
* @returns
|
|
305
|
+
*/
|
|
306
|
+
const REMOVE_STUDY_CODE = (listKey, code) => expressionUtils_expressionGen.generateExpression('REMOVE_STUDY_CODE', undefined, listKey, code);
|
|
289
307
|
/**
|
|
290
308
|
* Add a new notification message for the subscribed researchers
|
|
291
309
|
* @param messageType message type
|
|
@@ -359,6 +377,39 @@ const setReportMessage = (reportKey, content, asTranslationKey) => {
|
|
|
359
377
|
const setReportSummary = (reportKey, content, asTranslationKey) => {
|
|
360
378
|
return UPDATE_REPORT_DATA(reportKey, 'summary', content, asTranslationKey ? undefined : 'rawMessage');
|
|
361
379
|
};
|
|
380
|
+
/**
|
|
381
|
+
* Method to check if a participant has any linking code for a specific key
|
|
382
|
+
* @param forKey
|
|
383
|
+
* @returns
|
|
384
|
+
*/
|
|
385
|
+
const hasLinkingCode = (forKey) => {
|
|
386
|
+
return expressionUtils_expressionGen.generateExpression('hasLinkingCode', undefined, forKey);
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Retrieve the value of a linking code for a specific key. Will return empty string if not present
|
|
390
|
+
* @param forKey
|
|
391
|
+
* @returns
|
|
392
|
+
*/
|
|
393
|
+
const getLinkingCode = (forKey) => {
|
|
394
|
+
return expressionUtils_expressionGen.generateExpression("getLinkingCode", undefined, forKey);
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Set a linking code for a specific key. This will override any existing value for that key, if already present.
|
|
398
|
+
* @param forKey: will result in an error if empty
|
|
399
|
+
* @param value
|
|
400
|
+
* @returns
|
|
401
|
+
*/
|
|
402
|
+
const SET_LINKING_CODE = (forKey, value) => {
|
|
403
|
+
return expressionUtils_expressionGen.generateExpression('SET_LINKING_CODE', undefined, forKey, value);
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Delete a linking code for a specific key or all linling codes if no key is specified
|
|
407
|
+
* @param forKey
|
|
408
|
+
* @returns
|
|
409
|
+
*/
|
|
410
|
+
const DELETE_LINKING_CODE = (forKey) => {
|
|
411
|
+
return expressionUtils_expressionGen.generateExpression('DELETE_LINKING_CODE', undefined, forKey);
|
|
412
|
+
};
|
|
362
413
|
/**
|
|
363
414
|
* Method to call external event handler
|
|
364
415
|
* @param serviceName name of the external service endpoint that should be used (URL and API key are config of the service)
|
|
@@ -440,6 +491,7 @@ const NativeStudyEngineExpressions = {
|
|
|
440
491
|
hasResponseKey,
|
|
441
492
|
hasResponseKeyWithValue,
|
|
442
493
|
countResponseItems,
|
|
494
|
+
isStudyCodePresent,
|
|
443
495
|
// Old responses
|
|
444
496
|
checkConditionForOldResponses,
|
|
445
497
|
// Event payload methods:
|
|
@@ -459,6 +511,10 @@ const NativeStudyEngineExpressions = {
|
|
|
459
511
|
hasStudyStatus,
|
|
460
512
|
hasParticipantFlagKeyAndValue,
|
|
461
513
|
hasParticipantFlagKey,
|
|
514
|
+
linkingCode: {
|
|
515
|
+
has: hasLinkingCode,
|
|
516
|
+
get: getLinkingCode,
|
|
517
|
+
},
|
|
462
518
|
getParticipantFlagValue,
|
|
463
519
|
getParticipantFlagValueAsNum,
|
|
464
520
|
getLastSubmissionDate,
|
|
@@ -490,6 +546,8 @@ const NativeStudyEngineExpressions = {
|
|
|
490
546
|
or,
|
|
491
547
|
and,
|
|
492
548
|
not,
|
|
549
|
+
sum,
|
|
550
|
+
neg,
|
|
493
551
|
// Other
|
|
494
552
|
timestampWithOffset,
|
|
495
553
|
getISOWeekForTs,
|
|
@@ -522,6 +580,10 @@ const StudyEngineActions = {
|
|
|
522
580
|
setReportMessage,
|
|
523
581
|
setReportSummary,
|
|
524
582
|
},
|
|
583
|
+
linkingCodes: {
|
|
584
|
+
set: SET_LINKING_CODE,
|
|
585
|
+
delete: DELETE_LINKING_CODE,
|
|
586
|
+
},
|
|
525
587
|
messages: {
|
|
526
588
|
add: ADD_MESSAGE,
|
|
527
589
|
removeAll: REMOVE_ALL_MESSAGES,
|
|
@@ -536,6 +598,7 @@ const StudyEngineActions = {
|
|
|
536
598
|
stopParticipation,
|
|
537
599
|
finishParticipation,
|
|
538
600
|
},
|
|
601
|
+
removeStudyCode: REMOVE_STUDY_CODE,
|
|
539
602
|
notifyResearcher: NOTIFY_RESEARCHER,
|
|
540
603
|
};
|
|
541
604
|
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.6.
|
|
4
|
+
"version": "1.6.9",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|