case-editor-tools 1.0.0-beta.41 → 1.0.0-beta.44

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.
@@ -7,6 +7,7 @@ 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
+ getSelectedKeys: (itemKey: string, responseKey: string) => Expression;
10
11
  hasResponseKey: (itemKey: string, responseKey: string) => Expression;
11
12
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
12
13
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
@@ -19,6 +20,7 @@ export declare const NativeStudyEngineExpressions: {
19
20
  hasStudyStatus: (status: string) => Expression;
20
21
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
21
22
  hasParticipantFlagKey: (key: string) => Expression;
23
+ getParticipantFlagValue: (key: string) => Expression;
22
24
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
23
25
  hasMessageTypeAssigned: (messageType: string) => Expression;
24
26
  getMessageNextTime: (messageType: string) => Expression;
@@ -30,6 +32,7 @@ export declare const NativeStudyEngineExpressions: {
30
32
  hasStudyStatus: (status: string) => Expression;
31
33
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
32
34
  hasParticipantFlagKey: (key: string) => Expression;
35
+ getParticipantFlagValue: (key: string) => Expression;
33
36
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
34
37
  hasMessageTypeAssigned: (messageType: string) => Expression;
35
38
  getMessageNextTime: (messageType: string) => Expression;
@@ -51,6 +54,7 @@ export declare const StudyEngineActions: {
51
54
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
52
55
  participantActions: {
53
56
  updateStudyStatus: (status: string) => Expression;
57
+ startNewStudySession: () => Expression;
54
58
  updateFlag: (key: string, newValue: string | number | Expression) => Expression;
55
59
  removeFlag: (key: string) => Expression;
56
60
  assignedSurveys: {
@@ -113,6 +117,7 @@ export declare const StudyEngine: {
113
117
  ifThen: (condition: Expression, ...args: Expression[]) => Expression;
114
118
  participantActions: {
115
119
  updateStudyStatus: (status: string) => Expression;
120
+ startNewStudySession: () => Expression;
116
121
  updateFlag: (key: string, newValue: string | number | Expression) => Expression;
117
122
  removeFlag: (key: string) => Expression;
118
123
  assignedSurveys: {
@@ -147,6 +152,7 @@ export declare const StudyEngine: {
147
152
  responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
148
153
  getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
149
154
  getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
155
+ getSelectedKeys: (itemKey: string, responseKey: string) => Expression;
150
156
  hasResponseKey: (itemKey: string, responseKey: string) => Expression;
151
157
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
152
158
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
@@ -159,6 +165,7 @@ export declare const StudyEngine: {
159
165
  hasStudyStatus: (status: string) => Expression;
160
166
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
161
167
  hasParticipantFlagKey: (key: string) => Expression;
168
+ getParticipantFlagValue: (key: string) => Expression;
162
169
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
163
170
  hasMessageTypeAssigned: (messageType: string) => Expression;
164
171
  getMessageNextTime: (messageType: string) => Expression;
@@ -170,6 +177,7 @@ export declare const StudyEngine: {
170
177
  hasStudyStatus: (status: string) => Expression;
171
178
  hasParticipantFlagKeyAndValue: (key: string, value: string) => Expression;
172
179
  hasParticipantFlagKey: (key: string) => Expression;
180
+ getParticipantFlagValue: (key: string) => Expression;
173
181
  lastSubmissionDateOlderThan: (reference: number | Expression, surveyKey?: string | undefined) => Expression;
174
182
  hasMessageTypeAssigned: (messageType: string) => Expression;
175
183
  getMessageNextTime: (messageType: string) => Expression;
@@ -62,6 +62,15 @@ const getResponseValueAsNum = (itemKey, responseKey) => {
62
62
  const getResponseValueAsStr = (itemKey, responseKey) => {
63
63
  return expressionUtils_expressionGen.generateExpression('getResponseValueAsStr', 'string', itemKey, responseKey);
64
64
  };
65
+ /**
66
+ * Retrieve the selected keys from a response slot
67
+ * @param itemKey full key to the survey item, in the form, e.g., <surveyKey>.<groupKey>.<itemKey>
68
+ * @param responseKey key of the response slot, where keys should be retrieved from
69
+ * @returns
70
+ */
71
+ const getSelectedKeys = (itemKey, responseKey) => {
72
+ return expressionUtils_expressionGen.generateExpression('getSelectedKeys', 'string', itemKey, responseKey);
73
+ };
65
74
  const countResponseItems = (itemKey, responseKey) => {
66
75
  return expressionUtils_expressionGen.generateExpression('countResponseItems', undefined, itemKey, responseKey);
67
76
  };
@@ -124,6 +133,13 @@ const hasParticipantFlagKeyAndValueForIncoming = (key, value) => expressionUtils
124
133
  */
125
134
  const hasParticipantFlagKey = (key) => expressionUtils_expressionGen.generateExpression('hasParticipantFlagKey', undefined, key);
126
135
  const hasParticipantFlagKeyForIncoming = (key) => expressionUtils_expressionGen.generateExpression('incomingState:hasParticipantFlagKey', undefined, key);
136
+ /**
137
+ * Retrieve the value of a participant flag
138
+ * @param key look up this flag
139
+ * @returns return the value or an empty string if not present
140
+ */
141
+ const getParticipantFlagValue = (key) => expressionUtils_expressionGen.generateExpression('getParticipantFlagValue', undefined, key);
142
+ const getParticipantFlagValueForIncoming = (key) => expressionUtils_expressionGen.generateExpression('incomingState:getParticipantFlagValue', undefined, key);
127
143
  /**
128
144
  * Checks if the participant has a message type assigned (at least one)
129
145
  * @param messageType
@@ -185,6 +201,12 @@ const IFTHEN = (condition, ...args) => expressionUtils_expressionGen.generateExp
185
201
  * @returns
186
202
  */
187
203
  const UPDATE_STUDY_STATUS = (status) => expressionUtils_expressionGen.generateExpression('UPDATE_STUDY_STATUS', undefined, status);
204
+ /**
205
+ * Generate and store a new session id to the participant's state
206
+ * @param status new status value
207
+ * @returns
208
+ */
209
+ const START_NEW_STUDY_SESSION = () => expressionUtils_expressionGen.generateExpression('START_NEW_STUDY_SESSION', undefined);
188
210
  /**
189
211
  * Add or update a participant flag
190
212
  * @param key
@@ -344,6 +366,7 @@ const NativeStudyEngineExpressions = {
344
366
  responseHasOnlyKeysOtherThan,
345
367
  getResponseValueAsNum,
346
368
  getResponseValueAsStr,
369
+ getSelectedKeys,
347
370
  hasResponseKey,
348
371
  hasResponseKeyWithValue,
349
372
  countResponseItems,
@@ -358,6 +381,7 @@ const NativeStudyEngineExpressions = {
358
381
  hasStudyStatus,
359
382
  hasParticipantFlagKeyAndValue,
360
383
  hasParticipantFlagKey,
384
+ getParticipantFlagValue,
361
385
  lastSubmissionDateOlderThan,
362
386
  hasMessageTypeAssigned,
363
387
  getMessageNextTime,
@@ -370,6 +394,7 @@ const NativeStudyEngineExpressions = {
370
394
  hasStudyStatus: hasStudyStatusForIncoming,
371
395
  hasParticipantFlagKeyAndValue: hasParticipantFlagKeyAndValueForIncoming,
372
396
  hasParticipantFlagKey: hasParticipantFlagKeyForIncoming,
397
+ getParticipantFlagValue: getParticipantFlagValueForIncoming,
373
398
  lastSubmissionDateOlderThan: lastSubmissionDateOlderThanForIncoming,
374
399
  hasMessageTypeAssigned: hasMessageTypeAssignedForIncoming,
375
400
  getMessageNextTime: getMessageNextTimeForIncoming,
@@ -393,6 +418,7 @@ const StudyEngineActions = {
393
418
  ifThen: IFTHEN,
394
419
  participantActions: {
395
420
  updateStudyStatus: UPDATE_STUDY_STATUS,
421
+ startNewStudySession: START_NEW_STUDY_SESSION,
396
422
  updateFlag: UPDATE_FLAG,
397
423
  removeFlag: REMOVE_FLAG,
398
424
  assignedSurveys: {
@@ -1 +1 @@
1
- {"version":3,"file":"studyEngineExpressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;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or-tools",
3
3
  "description": "Javascript tools to simplify survey and study coding for CASE.",
4
- "version": "1.0.0-beta.41",
4
+ "version": "1.0.0-beta.44",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "github:case-framework/case-editor-tools",