case-editor-tools 1.7.0 → 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,11 +103,13 @@ 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;
106
110
  removeAll: () => Expression;
107
111
  remove: (messageType: string) => Expression;
112
+ sendNow: (messageType: string, languageOverride?: string) => Expression;
108
113
  };
109
114
  confidentialResponses: {
110
115
  removeByKey: (key: string) => Expression;
@@ -115,6 +120,7 @@ export declare const StudyEngineActions: {
115
120
  finishParticipation: () => Expression;
116
121
  };
117
122
  removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
123
+ resetStudyCounter: (scopeKey: string | Expression) => Expression;
118
124
  notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
119
125
  };
120
126
  export declare const StudyEngine: {
@@ -152,8 +158,9 @@ export declare const StudyEngine: {
152
158
  participantActions: {
153
159
  updateStudyStatus: (status: string) => Expression;
154
160
  startNewStudySession: () => Expression;
155
- updateFlag: (key: string, newValue: string | number | Expression) => Expression;
156
- 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;
157
164
  assignedSurveys: {
158
165
  add: (surveyKey: string, category: 'immediate' | 'prio' | 'normal' | 'optional', activeFrom?: number | Expression, activeUntil?: number | Expression) => Expression;
159
166
  removeAll: () => Expression;
@@ -172,11 +179,13 @@ export declare const StudyEngine: {
172
179
  set: (forKey: string | Expression, value: string | Expression) => Expression;
173
180
  delete: (forKey?: string | Expression) => Expression;
174
181
  drawFromStudyCodeList: (listKey: string | Expression, forKey?: string | Expression) => Expression;
182
+ getNextStudyCounterAsLinkingCode: (scopeKey: string | Expression, linkingCodeKey: string | Expression, prefix: string | Expression, padding: number | Expression) => Expression;
175
183
  };
176
184
  messages: {
177
185
  add: (messageType: string, scheduledFor: number | Expression) => Expression;
178
186
  removeAll: () => Expression;
179
187
  remove: (messageType: string) => Expression;
188
+ sendNow: (messageType: string, languageOverride?: string) => Expression;
180
189
  };
181
190
  confidentialResponses: {
182
191
  removeByKey: (key: string) => Expression;
@@ -187,6 +196,7 @@ export declare const StudyEngine: {
187
196
  finishParticipation: () => Expression;
188
197
  };
189
198
  removeStudyCode: (listKey: string | Expression, code: string | Expression) => Expression;
199
+ resetStudyCounter: (scopeKey: string | Expression) => Expression;
190
200
  notifyResearcher: (messageType: string, ...payload: Expression[] | string[]) => Expression;
191
201
  checkEventType: (equalsType: 'ENTER' | 'SUBMIT' | 'TIMER' | 'MERGE' | 'CUSTOM' | 'LEAVE') => Expression;
192
202
  checkEventKey: (equalsKey: string) => Expression;
@@ -200,6 +210,8 @@ export declare const StudyEngine: {
200
210
  hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
201
211
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
202
212
  isStudyCodePresent: (listKey: string | Expression, code: string | Expression) => Expression;
213
+ getCurrentStudyCounterValue: (scopeKey: string | Expression) => Expression;
214
+ getNextStudyCounterValue: (scopeKey: string | Expression) => Expression;
203
215
  checkConditionForOldResponses: (condition: Expression, checkType?: number | 'all' | 'any', surveyKey?: string, querySince?: number | Expression, queryUntil?: number | Expression) => Expression;
204
216
  eventPayload: {
205
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
@@ -304,6 +320,13 @@ const REMOVE_ALL_MESSAGES = () => expressionUtils_expressionGen.generateExpressi
304
320
  * @returns
305
321
  */
306
322
  const REMOVE_MESSAGES_BY_TYPE = (messageType) => expressionUtils_expressionGen.generateExpression('REMOVE_MESSAGES_BY_TYPE', undefined, messageType);
323
+ /**
324
+ * Send a message now
325
+ * @param messageType message type
326
+ * @param languageOverride optional language override
327
+ * @returns
328
+ */
329
+ const SEND_MESSAGE_NOW = (messageType, languageOverride) => expressionUtils_expressionGen.generateExpression('SEND_MESSAGE_NOW', undefined, messageType, languageOverride);
307
330
  /**
308
331
  * Remove a study code from a list
309
332
  * @param listKey
@@ -426,6 +449,36 @@ const DELETE_LINKING_CODE = (forKey) => {
426
449
  const DRAW_STUDY_CODE_AS_LINKING_CODE = (listKey, forKey) => {
427
450
  return expressionUtils_expressionGen.generateExpression('DRAW_STUDY_CODE_AS_LINKING_CODE', undefined, listKey, forKey);
428
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
+ };
429
482
  /**
430
483
  * Method to call external event handler
431
484
  * @param serviceName name of the external service endpoint that should be used (URL and API key are config of the service)
@@ -508,6 +561,8 @@ const NativeStudyEngineExpressions = {
508
561
  hasResponseKeyWithValue,
509
562
  countResponseItems,
510
563
  isStudyCodePresent,
564
+ getCurrentStudyCounterValue,
565
+ getNextStudyCounterValue,
511
566
  // Old responses
512
567
  checkConditionForOldResponses,
513
568
  // Event payload methods:
@@ -582,6 +637,7 @@ const StudyEngineActions = {
582
637
  startNewStudySession: START_NEW_STUDY_SESSION,
583
638
  updateFlag: UPDATE_FLAG,
584
639
  removeFlag: REMOVE_FLAG,
640
+ getNextStudyCounterAsFlag: GET_NEXT_STUDY_COUNTER_AS_FLAG,
585
641
  assignedSurveys: {
586
642
  add: ADD_NEW_SURVEY,
587
643
  removeAll: REMOVE_ALL_SURVEYS,
@@ -601,11 +657,13 @@ const StudyEngineActions = {
601
657
  set: SET_LINKING_CODE,
602
658
  delete: DELETE_LINKING_CODE,
603
659
  drawFromStudyCodeList: DRAW_STUDY_CODE_AS_LINKING_CODE,
660
+ getNextStudyCounterAsLinkingCode: GET_NEXT_STUDY_COUNTER_AS_LINKING_CODE,
604
661
  },
605
662
  messages: {
606
663
  add: ADD_MESSAGE,
607
664
  removeAll: REMOVE_ALL_MESSAGES,
608
665
  remove: REMOVE_MESSAGES_BY_TYPE,
666
+ sendNow: SEND_MESSAGE_NOW,
609
667
  },
610
668
  confidentialResponses: {
611
669
  removeByKey: REMOVE_CONFIDENTIAL_RESPONSE_BY_KEY,
@@ -617,6 +675,7 @@ const StudyEngineActions = {
617
675
  finishParticipation,
618
676
  },
619
677
  removeStudyCode: REMOVE_STUDY_CODE,
678
+ resetStudyCounter: RESET_STUDY_COUNTER,
620
679
  notifyResearcher: NOTIFY_RESEARCHER,
621
680
  };
622
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.0",
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",