case-editor-tools 1.0.0-beta.27 → 1.0.0-beta.30

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,8 @@ 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
+ hasResponseKey: (itemKey: string, responseKey: string) => Expression;
11
+ hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
10
12
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
11
13
  checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
12
14
  participantState: {
@@ -114,6 +116,8 @@ export declare const StudyEngine: {
114
116
  responseHasOnlyKeysOtherThan: (itemKey: string, responseSlotKey: string, ...optionKeys: string[]) => Expression;
115
117
  getResponseValueAsNum: (itemKey: string, responseKey: string) => Expression;
116
118
  getResponseValueAsStr: (itemKey: string, responseKey: string) => Expression;
119
+ hasResponseKey: (itemKey: string, responseKey: string) => Expression;
120
+ hasResponseKeyWithValue: (itemKey: string, responseKey: string, value: string) => Expression;
117
121
  countResponseItems: (itemKey: string, responseKey: string) => Expression;
118
122
  checkConditionForOldResponses: (condition: Expression, checkType?: number | "all" | "any" | undefined, surveyKey?: string | undefined, querySince?: number | Expression | undefined, queryUntil?: number | Expression | undefined) => Expression;
119
123
  participantState: {
@@ -37,6 +37,25 @@ const responseHasKeysAny = (itemKey, responseSlotKey, ...optionKeys) => expressi
37
37
  * @returns true if a response key is present, but is not in the list defined by optionKeys. If item or the response group is not found, returns false.
38
38
  */
39
39
  const responseHasOnlyKeysOtherThan = (itemKey, responseSlotKey, ...optionKeys) => expressionUtils_expressionGen.generateExpression('responseHasOnlyKeysOtherThan', undefined, itemKey, responseSlotKey, ...optionKeys);
40
+ /**
41
+ *
42
+ * @param itemKey full key to the survey item, in the form, e.g., <surveyKey>.<groupKey>.<itemKey>
43
+ * @param responseKey full key to the response that should exists
44
+ * @returns if item contains responseKey return true
45
+ */
46
+ const hasResponseKey = (itemKey, responseKey) => {
47
+ return expressionUtils_expressionGen.generateExpression('hasResponseKey', undefined, itemKey, responseKey);
48
+ };
49
+ /**
50
+ *
51
+ * @param itemKey full key to the survey item, in the form, e.g., <surveyKey>.<groupKey>.<itemKey>
52
+ * @param responseKey full key to the response that should exists
53
+ * @param value the response object with the above key should have this value
54
+ * @returns if the response object exists and has the value return true
55
+ */
56
+ const hasResponseKeyWithValue = (itemKey, responseKey, value) => {
57
+ return expressionUtils_expressionGen.generateExpression('hasResponseKeyWithValue', undefined, itemKey, responseKey, value);
58
+ };
40
59
  const getResponseValueAsNum = (itemKey, responseKey) => {
41
60
  return expressionUtils_expressionGen.generateExpression('getResponseValueAsNum', 'float', itemKey, responseKey);
42
61
  };
@@ -268,6 +287,8 @@ const NativeStudyEngineExpressions = {
268
287
  responseHasOnlyKeysOtherThan,
269
288
  getResponseValueAsNum,
270
289
  getResponseValueAsStr,
290
+ hasResponseKey,
291
+ hasResponseKeyWithValue,
271
292
  countResponseItems,
272
293
  // Old responses
273
294
  checkConditionForOldResponses,
@@ -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.0.0-beta.27",
4
+ "version": "1.0.0-beta.30",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
7
7
  "repository": "github:case-framework/case-editor-tools",
@@ -20,6 +20,6 @@
20
20
  "build": "rollup -c"
21
21
  },
22
22
  "dependencies": {
23
- "survey-engine": "^1.0.3"
23
+ "survey-engine": "^1.0.4"
24
24
  }
25
25
  }
@@ -74,10 +74,11 @@ export declare const SurveyEngine: {
74
74
  get: (itemKey: string) => Expression;
75
75
  };
76
76
  participantFlags: {
77
- hasKey: (key: string, value: string) => Expression;
77
+ hasKey: (key: string) => Expression;
78
78
  hasKeyAndValue: (key: string, value: string) => Expression;
79
79
  getAsNum: (key: string) => Expression;
80
80
  };
81
+ isLoggedIn: () => Expression;
81
82
  getters: {
82
83
  getContext: () => Expression;
83
84
  getResponses: () => Expression;
@@ -307,7 +307,7 @@ const parseParticipantFlagAsNum = (key) => {
307
307
  * @param key retrieve participant flag's value for this key
308
308
  * @returns
309
309
  */
310
- const hasParticipantFlagKey = (key, value) => {
310
+ const hasParticipantFlagKey = (key) => {
311
311
  return isDefined(getAttribute(getAttribute(getContext(), 'participantFlags'), key));
312
312
  };
313
313
  /**
@@ -319,6 +319,9 @@ const hasParticipantFlagKey = (key, value) => {
319
319
  const hasParticipantFlagKeyAndValue = (key, value) => {
320
320
  return eq(getAttribute(getAttribute(getContext(), 'participantFlags'), key), value);
321
321
  };
322
+ const isLoggedIn = () => {
323
+ return getAttribute(getContext(), 'isLoggedIn');
324
+ };
322
325
  /**
323
326
  * Counts the number of selected options in a multiple choice question
324
327
  * @param itemKey full key of the survey item (e.g. SURVEY.GROUP.QUESTIONKEY)
@@ -429,7 +432,7 @@ const SurveyEngine = Object.assign(Object.assign({}, NativeSurveyEngineExpressio
429
432
  hasKey: hasParticipantFlagKey,
430
433
  hasKeyAndValue: hasParticipantFlagKeyAndValue,
431
434
  getAsNum: parseParticipantFlagAsNum,
432
- } });
435
+ }, isLoggedIn });
433
436
 
434
437
  exports.NativeSurveyEngineExpressions = NativeSurveyEngineExpressions;
435
438
  exports.SurveyEngine = SurveyEngine;
@@ -1 +1 @@
1
- {"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"survey-engine-expressions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}