case-editor-tools 1.4.1 → 1.5.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.
|
@@ -21,6 +21,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
21
21
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
22
22
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
23
23
|
getParticipantFlagValue: (key: string) => Expression;
|
|
24
|
+
getParticipantFlagAsNum: (key: string) => Expression;
|
|
24
25
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
|
|
25
26
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
26
27
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -47,6 +48,7 @@ export declare const NativeStudyEngineExpressions: {
|
|
|
47
48
|
and: (...args: Expression[]) => Expression;
|
|
48
49
|
not: (arg: Expression) => Expression;
|
|
49
50
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
51
|
+
parseValueAsNum: (valueRef: Expression | string | number) => Expression;
|
|
50
52
|
externalEventEval: (serviceName: string, expectFloat?: boolean) => Expression;
|
|
51
53
|
};
|
|
52
54
|
export declare const StudyEngineActions: {
|
|
@@ -172,6 +174,7 @@ export declare const StudyEngine: {
|
|
|
172
174
|
hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
|
|
173
175
|
hasParticipantFlagKey: (key: string) => Expression;
|
|
174
176
|
getParticipantFlagValue: (key: string) => Expression;
|
|
177
|
+
getParticipantFlagAsNum: (key: string) => Expression;
|
|
175
178
|
lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string) => Expression;
|
|
176
179
|
hasMessageTypeAssigned: (messageType: string) => Expression;
|
|
177
180
|
getMessageNextTime: (messageType: string) => Expression;
|
|
@@ -198,5 +201,6 @@ export declare const StudyEngine: {
|
|
|
198
201
|
and: (...args: Expression[]) => Expression;
|
|
199
202
|
not: (arg: Expression) => Expression;
|
|
200
203
|
timestampWithOffset: (delta: Duration, reference?: number | Expression) => Expression;
|
|
204
|
+
parseValueAsNum: (valueRef: Expression | string | number) => Expression;
|
|
201
205
|
externalEventEval: (serviceName: string, expectFloat?: boolean) => Expression;
|
|
202
206
|
};
|
|
@@ -142,6 +142,8 @@ const hasParticipantFlagKeyForIncoming = (key) => expressionUtils_expressionGen.
|
|
|
142
142
|
*/
|
|
143
143
|
const getParticipantFlagValue = (key) => expressionUtils_expressionGen.generateExpression('getParticipantFlagValue', undefined, key);
|
|
144
144
|
const getParticipantFlagValueForIncoming = (key) => expressionUtils_expressionGen.generateExpression('incomingState:getParticipantFlagValue', undefined, key);
|
|
145
|
+
// Convinience method to parse participant flag's value as a number
|
|
146
|
+
const getParticipantFlagAsNum = (key) => parseValueAsNum(getParticipantFlagValue(key));
|
|
145
147
|
/**
|
|
146
148
|
* Checks if the participant has a message type assigned (at least one)
|
|
147
149
|
* @param messageType
|
|
@@ -176,6 +178,14 @@ const gte = (val1, val2) => expressionUtils_expressionGen.generateExpression('gt
|
|
|
176
178
|
* @returns
|
|
177
179
|
*/
|
|
178
180
|
const timestampWithOffset = (delta, reference) => expressionUtils_expressionGen.generateExpression('timestampWithOffset', undefined, types_duration.durationObjectToSeconds(delta), reference ? reference : undefined);
|
|
181
|
+
/**
|
|
182
|
+
* Attempt to parse the resolved argument's value as a number
|
|
183
|
+
* @param valueRef resolve this argument, and try to parse this as number. Boolean value will result in error.
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
const parseValueAsNum = (valueRef) => {
|
|
187
|
+
return expressionUtils_expressionGen.generateExpression('parseValueAsNum', 'float', valueRef);
|
|
188
|
+
};
|
|
179
189
|
/**
|
|
180
190
|
*
|
|
181
191
|
* @param serviceName name of the external service endpoint that should be used (URL and API key are config of the service)
|
|
@@ -408,6 +418,7 @@ const NativeStudyEngineExpressions = {
|
|
|
408
418
|
hasParticipantFlagKeyAndValue,
|
|
409
419
|
hasParticipantFlagKey,
|
|
410
420
|
getParticipantFlagValue,
|
|
421
|
+
getParticipantFlagAsNum,
|
|
411
422
|
lastSubmissionDateOlderThan,
|
|
412
423
|
hasMessageTypeAssigned,
|
|
413
424
|
getMessageNextTime,
|
|
@@ -437,6 +448,7 @@ const NativeStudyEngineExpressions = {
|
|
|
437
448
|
not,
|
|
438
449
|
// Other
|
|
439
450
|
timestampWithOffset,
|
|
451
|
+
parseValueAsNum,
|
|
440
452
|
externalEventEval,
|
|
441
453
|
};
|
|
442
454
|
const StudyEngineActions = {
|
|
@@ -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.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": "github:case-framework/case-editor-tools",
|