case-editor-tools 1.6.5 → 1.6.7

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.
@@ -1,7 +1,8 @@
1
1
  import { Expression } from "survey-engine/data_types";
2
2
  import { Duration } from "../types/duration";
3
3
  export declare const NativeStudyEngineExpressions: {
4
- checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'LEAVE') => Expression;
4
+ checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'CUSTOM' | 'LEAVE') => Expression;
5
+ checkEventKey: (equalsKey: string) => Expression;
5
6
  checkSurveyResponseKey: (surveyKey: string) => Expression;
6
7
  responseHasKeysAny: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
7
8
  responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
@@ -12,6 +13,13 @@ export declare const NativeStudyEngineExpressions: {
12
13
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
13
14
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
14
15
  checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
16
+ eventPayload: {
17
+ hasEventPayload: () => Expression;
18
+ hasEventPayloadKey: (key: string) => Expression;
19
+ hasEventPayloadKeyWithValue: (key: string, value: string) => Expression;
20
+ getEventPayloadValueAsStr: (key: string) => Expression;
21
+ getEventPayloadValueAsNum: (key: string) => Expression;
22
+ };
15
23
  participantState: {
16
24
  getStudyEntryTime: () => Expression;
17
25
  hasSurveyKeyAssigned: (surveyKey: string) => Expression;
@@ -157,7 +165,8 @@ export declare const StudyEngine: {
157
165
  finishParticipation: () => Expression;
158
166
  };
159
167
  notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
160
- checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'LEAVE') => Expression;
168
+ checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'CUSTOM' | 'LEAVE') => Expression;
169
+ checkEventKey: (equalsKey: string) => Expression;
161
170
  checkSurveyResponseKey: (surveyKey: string) => Expression;
162
171
  responseHasKeysAny: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
163
172
  responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
@@ -168,6 +177,13 @@ export declare const StudyEngine: {
168
177
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
169
178
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
170
179
  checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
180
+ eventPayload: {
181
+ hasEventPayload: () => Expression;
182
+ hasEventPayloadKey: (key: string) => Expression;
183
+ hasEventPayloadKeyWithValue: (key: string, value: string) => Expression;
184
+ getEventPayloadValueAsStr: (key: string) => Expression;
185
+ getEventPayloadValueAsNum: (key: string) => Expression;
186
+ };
171
187
  participantState: {
172
188
  getStudyEntryTime: () => Expression;
173
189
  hasSurveyKeyAssigned: (surveyKey: string) => Expression;
@@ -17,6 +17,12 @@ const not = (arg) => expressionUtils_expressionGen.generateExpression('not', und
17
17
  * @returns if event type matches the argument, return true otherwise false
18
18
  */
19
19
  const checkEventType = (equalsType) => expressionUtils_expressionGen.generateExpression('checkEventType', undefined, equalsType);
20
+ /**
21
+ * Check if the current event has the given key
22
+ * @param equalsKey string
23
+ * @returns if event key matches the argument, return true otherwise false
24
+ */
25
+ const checkEventKey = (equalsKey) => expressionUtils_expressionGen.generateExpression('checkEventKey', undefined, equalsKey);
20
26
  /**
21
27
  * Check if the submitted survey has a specific key
22
28
  * @param surveyKey string to check for
@@ -86,6 +92,11 @@ const countResponseItems = (itemKey, responseKey) => {
86
92
  * @returns true/false
87
93
  */
88
94
  const checkConditionForOldResponses = (condition, checkType, surveyKey, querySince, queryUntil) => expressionUtils_expressionGen.generateExpression('checkConditionForOldResponses', undefined, condition, checkType, surveyKey, querySince, queryUntil);
95
+ const hasEventPayload = () => expressionUtils_expressionGen.generateExpression('hasEventPayload', undefined);
96
+ const hasEventPayloadKey = (key) => expressionUtils_expressionGen.generateExpression('hasEventPayloadKey', undefined, key);
97
+ const hasEventPayloadKeyWithValue = (key, value) => expressionUtils_expressionGen.generateExpression('hasEventPayloadKeyWithValue', undefined, key, value);
98
+ const getEventPayloadValueAsStr = (key) => expressionUtils_expressionGen.generateExpression('getEventPayloadValueAsStr', 'string', key);
99
+ const getEventPayloadValueAsNum = (key) => expressionUtils_expressionGen.generateExpression('getEventPayloadValueAsNum', 'float', key);
89
100
  /**
90
101
  * Method to access the timestamp for when the participant entered the study
91
102
  * @returns timestamp
@@ -411,6 +422,7 @@ const hasSurveyKeyValidUntilSoonerThan = (surveyKey, delta, reference) => {
411
422
  };
412
423
  const NativeStudyEngineExpressions = {
413
424
  checkEventType,
425
+ checkEventKey,
414
426
  // Response checkers
415
427
  checkSurveyResponseKey,
416
428
  responseHasKeysAny,
@@ -423,6 +435,14 @@ const NativeStudyEngineExpressions = {
423
435
  countResponseItems,
424
436
  // Old responses
425
437
  checkConditionForOldResponses,
438
+ // Event payload methods:
439
+ eventPayload: {
440
+ hasEventPayload,
441
+ hasEventPayloadKey,
442
+ hasEventPayloadKeyWithValue,
443
+ getEventPayloadValueAsStr,
444
+ getEventPayloadValueAsNum,
445
+ },
426
446
  // Participant state:
427
447
  participantState: {
428
448
  getStudyEntryTime,
@@ -1 +1 @@
1
- {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;"}
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.5",
4
+ "version": "1.6.7",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "github:case-framework/case-editor-tools",