oro-sdk 3.12.0 → 3.15.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 ORO Health Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -11,7 +11,53 @@ export declare function filterTriggeredAnsweredWithKind(workflowData: WorkflowDa
11
11
  */
12
12
  export declare function getWorkflowDataByCategory(workflowData: WorkflowData, category: MetadataCategory): Promise<PopulatedWorkflowData>;
13
13
  export declare function getImagesFromIndexDb(answer: SelectedAnswerData): Promise<WorkflowUploadedImage[]>;
14
- export declare function isTriggered(triggers: string[], answers: string[]): boolean;
14
+ /**
15
+ * Determine if a question is triggered by some answers
16
+ *
17
+ * We use the following logical combinations of rules:
18
+ *
19
+ * #### Single string
20
+ *
21
+ * ```
22
+ * // Required: rule1
23
+ * rules: rule1
24
+ * ```
25
+ *
26
+ * #### Array of strings (AND is applied between statements):
27
+ *
28
+ * ```
29
+ * // Required: rule1 AND rule2
30
+ * rules: [ rule1, rule2 ]
31
+ * ```
32
+ *
33
+ * #### Array of arrays of strings (OR is applied between inner arrays. AND is applied between inner arrays statements)
34
+ *
35
+ * ```
36
+ * // Required: rule1 OR rule2
37
+ * rules: [
38
+ * [ rule1 ],
39
+ * [ rule2 ]
40
+ * ]
41
+ *
42
+ * // Required: rule1 OR (rule2 AND rule3)
43
+ * rules: [
44
+ * [ rule1 ],
45
+ * [ rule2, rule3 ]
46
+ * ]
47
+ *
48
+ * // THIS IS FORBIDDEN
49
+ * rules: [
50
+ * rule1, // <-- THIS IS FORBIDDEN. Instead use [ rule1 ]
51
+ * [ rule2, rule3 ]
52
+ * ]
53
+ * ```
54
+ *
55
+ * @param triggers the triggering rules
56
+ * @param answers the answers to check againts triggering rules
57
+ * @returns `true` if triggers are verified against ansers. Otherwise, returns `false`.
58
+ * @throws an Error if triggers typing is wrong
59
+ */
60
+ export declare function isTriggered(triggers: string[][] | string[] | string, answers: string[]): boolean;
15
61
  export declare function flattenSelectedAnswers(answers: SelectedAnswersData): string[];
16
62
  /**
17
63
  * This function helps you to get a valid workflow selectedAnswers structure