@f1studio/form-spec 5.0.0-alpha.111 → 5.0.0-alpha.113

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.
Files changed (191) hide show
  1. package/FormSpec.FS/BitmaskHelpers.d.ts +23 -0
  2. package/FormSpec.FS/BitmaskHelpers.d.ts.map +1 -0
  3. package/FormSpec.FS/BlueprintValidation.d.ts +16 -0
  4. package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -0
  5. package/FormSpec.FS/FormSpec.d.ts +19 -5
  6. package/FormSpec.FS/FormSpec.d.ts.map +1 -1
  7. package/FormSpec.FS/FormSpecHelpers.d.ts +4 -0
  8. package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
  9. package/FormSpec.FS/FormSpecValues.d.ts +5 -0
  10. package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
  11. package/FormSpec.FS/Helpers.d.ts.map +1 -1
  12. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts +13 -0
  13. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -0
  14. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +22 -0
  15. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -0
  16. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts +22 -0
  17. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -0
  18. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +130 -0
  19. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -0
  20. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts +37 -0
  21. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts.map +1 -0
  22. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts +231 -0
  23. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -0
  24. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts +10 -0
  25. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts.map +1 -0
  26. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +55 -0
  27. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -0
  28. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts +69 -0
  29. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +1 -0
  30. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts +21 -0
  31. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -0
  32. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +133 -0
  33. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -0
  34. package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts +52 -0
  35. package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts.map +1 -0
  36. package/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.d.ts +46 -0
  37. package/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.d.ts.map +1 -0
  38. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.d.ts +4 -0
  39. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.d.ts.map +1 -0
  40. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.d.ts +36 -0
  41. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.d.ts.map +1 -0
  42. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts +95 -0
  43. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts.map +1 -0
  44. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +449 -0
  45. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -0
  46. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  47. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +3 -1
  48. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  49. package/FormSpec.FS/Provenance.d.ts +10 -0
  50. package/FormSpec.FS/Provenance.d.ts.map +1 -0
  51. package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
  52. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js +56 -0
  53. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js.map +1 -0
  54. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.ts.map +1 -0
  55. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +116 -0
  56. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -0
  57. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -0
  58. package/FormSpec.TS/FormSpec.FS/Designer.js +2 -2
  59. package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
  60. package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
  61. package/FormSpec.TS/FormSpec.FS/FormSpec.js +72 -3
  62. package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
  63. package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
  64. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +201 -3
  65. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  66. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  67. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +38 -3
  68. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
  69. package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
  70. package/FormSpec.TS/FormSpec.FS/Helpers.js +44 -27
  71. package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
  72. package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
  73. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +45 -0
  74. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -0
  75. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -0
  76. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +145 -0
  77. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -0
  78. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -0
  79. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +139 -0
  80. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -0
  81. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -0
  82. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +801 -0
  83. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -0
  84. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts.map +1 -0
  85. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js +121 -0
  86. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js.map +1 -0
  87. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts.map +1 -0
  88. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +1380 -0
  89. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -0
  90. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts.map +1 -0
  91. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +29 -0
  92. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -0
  93. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -0
  94. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +172 -0
  95. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -0
  96. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -0
  97. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +406 -0
  98. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +1 -0
  99. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts.map +1 -0
  100. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +317 -0
  101. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -0
  102. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -0
  103. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +622 -0
  104. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -0
  105. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -0
  106. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +448 -0
  107. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -0
  108. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts.map +1 -0
  109. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.js +198 -0
  110. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.js.map +1 -0
  111. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.ts.map +1 -0
  112. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.js +57 -0
  113. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.js.map +1 -0
  114. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.ts.map +1 -0
  115. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.js +144 -0
  116. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.js.map +1 -0
  117. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.ts.map +1 -0
  118. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js +258 -0
  119. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js.map +1 -0
  120. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts.map +1 -0
  121. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +1768 -0
  122. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js.map +1 -0
  123. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts.map +1 -0
  124. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +22 -18
  125. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  126. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  127. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +18 -6
  128. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  129. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  130. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +1 -1
  131. package/FormSpec.TS/FormSpec.FS/Provenance.js +41 -0
  132. package/FormSpec.TS/FormSpec.FS/Provenance.js.map +1 -0
  133. package/FormSpec.TS/FormSpec.FS/Provenance.ts.map +1 -0
  134. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js +36 -13
  135. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js.map +1 -1
  136. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
  137. package/FormSpec.TS/FormSpec.FS/Renderers/PathwayRenderers.js +1 -1
  138. package/FormSpec.TS/PathwayExecutor.withPlugins.js +0 -5
  139. package/FormSpec.TS/PathwayExecutor.withPlugins.js.map +1 -1
  140. package/FormSpec.TS/PluginRegistration.js +2 -0
  141. package/FormSpec.TS/PluginRegistration.js.map +1 -1
  142. package/FormSpec.TS/PluginRegistration.ts.map +1 -1
  143. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
  144. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
  145. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  146. package/FormSpec.TS/plugins/demographics/src/DemographicsField.js +918 -0
  147. package/FormSpec.TS/plugins/demographics/src/DemographicsField.js.map +1 -0
  148. package/FormSpec.TS/plugins/demographics/src/DemographicsField.ts.map +1 -0
  149. package/FormSpec.TS/plugins/likert/src/LikertField.js +1 -1
  150. package/PathwayExecutor.withPlugins.d.ts +0 -5
  151. package/PathwayExecutor.withPlugins.d.ts.map +1 -1
  152. package/README.md +7 -7
  153. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts +3 -0
  154. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts.map +1 -0
  155. package/package.json +4 -4
  156. package/plugins/demographics/src/DemographicsField.d.ts +104 -0
  157. package/plugins/demographics/src/DemographicsField.d.ts.map +1 -0
  158. package/src/FormSpec.FS/BitmaskHelpers.ts +52 -0
  159. package/src/FormSpec.FS/BlueprintValidation.ts +108 -0
  160. package/src/FormSpec.FS/Designer.ts +2 -2
  161. package/src/FormSpec.FS/FormSpec.ts +39 -8
  162. package/src/FormSpec.FS/FormSpecHelpers.ts +190 -12
  163. package/src/FormSpec.FS/FormSpecValues.ts +42 -3
  164. package/src/FormSpec.FS/Helpers.ts +44 -27
  165. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +37 -0
  166. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +103 -0
  167. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +129 -0
  168. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +490 -0
  169. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts +87 -0
  170. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +1046 -0
  171. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +26 -0
  172. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +161 -0
  173. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +386 -0
  174. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +320 -0
  175. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +371 -0
  176. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +372 -0
  177. package/src/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.ts +92 -0
  178. package/src/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.ts +51 -0
  179. package/src/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.ts +71 -0
  180. package/src/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts +15 -0
  181. package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +825 -0
  182. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +19 -15
  183. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +13 -7
  184. package/src/FormSpec.FS/PathwayExecutor.ts +1 -1
  185. package/src/FormSpec.FS/Provenance.ts +19 -0
  186. package/src/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts +32 -12
  187. package/src/FormSpec.FS/Renderers/PathwayRenderers.ts +1 -1
  188. package/src/PathwayExecutor.withPlugins.ts +0 -5
  189. package/src/PluginRegistration.ts +2 -0
  190. package/src/plugins/demographics/src/DemographicsField.ts +502 -0
  191. package/src/plugins/likert/src/LikertField.ts +1 -1
@@ -0,0 +1,801 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get FormSpecValidator_calculateExpectedMaxScore () {
13
+ return FormSpecValidator_calculateExpectedMaxScore;
14
+ },
15
+ get FormSpecValidator_countHeadings () {
16
+ return FormSpecValidator_countHeadings;
17
+ },
18
+ get FormSpecValidator_countNonHeadingItems () {
19
+ return FormSpecValidator_countNonHeadingItems;
20
+ },
21
+ get FormSpecValidator_countTotalFields () {
22
+ return FormSpecValidator_countTotalFields;
23
+ },
24
+ get FormSpecValidator_createSummary () {
25
+ return FormSpecValidator_createSummary;
26
+ },
27
+ get FormSpecValidator_getChoicesPerItem () {
28
+ return FormSpecValidator_getChoicesPerItem;
29
+ },
30
+ get FormSpecValidator_validateChoices () {
31
+ return FormSpecValidator_validateChoices;
32
+ },
33
+ get FormSpecValidator_validateConversion () {
34
+ return FormSpecValidator_validateConversion;
35
+ },
36
+ get FormSpecValidator_validateCounts () {
37
+ return FormSpecValidator_validateCounts;
38
+ },
39
+ get FormSpecValidator_validateMetadata () {
40
+ return FormSpecValidator_validateMetadata;
41
+ },
42
+ get FormSpecValidator_validatePathways () {
43
+ return FormSpecValidator_validatePathways;
44
+ },
45
+ get FormSpecValidator_validateRequiredFields () {
46
+ return FormSpecValidator_validateRequiredFields;
47
+ },
48
+ get FormSpecValidator_validateScoring () {
49
+ return FormSpecValidator_validateScoring;
50
+ },
51
+ get FormSpecValidator_validateTags () {
52
+ return FormSpecValidator_validateTags;
53
+ },
54
+ get ValidationError () {
55
+ return ValidationError;
56
+ },
57
+ get ValidationError_$reflection () {
58
+ return ValidationError_$reflection;
59
+ },
60
+ get ValidationError_ChoiceCountMismatch () {
61
+ return ValidationError_ChoiceCountMismatch;
62
+ },
63
+ get ValidationError_FieldCountMismatch () {
64
+ return ValidationError_FieldCountMismatch;
65
+ },
66
+ get ValidationError_HeadingNotConverted () {
67
+ return ValidationError_HeadingNotConverted;
68
+ },
69
+ get ValidationError_InvalidFieldType () {
70
+ return ValidationError_InvalidFieldType;
71
+ },
72
+ get ValidationError_ItemCountMismatch () {
73
+ return ValidationError_ItemCountMismatch;
74
+ },
75
+ get ValidationError_MetadataMismatch () {
76
+ return ValidationError_MetadataMismatch;
77
+ },
78
+ get ValidationError_MissingChoices () {
79
+ return ValidationError_MissingChoices;
80
+ },
81
+ get ValidationError_MissingStep () {
82
+ return ValidationError_MissingStep;
83
+ },
84
+ get ValidationError_PathwayMissing () {
85
+ return ValidationError_PathwayMissing;
86
+ },
87
+ get ValidationError_PathwayStateCountInvalid () {
88
+ return ValidationError_PathwayStateCountInvalid;
89
+ },
90
+ get ValidationError_PathwayTransitionCountInvalid () {
91
+ return ValidationError_PathwayTransitionCountInvalid;
92
+ },
93
+ get ValidationError_RequiredFieldMismatch () {
94
+ return ValidationError_RequiredFieldMismatch;
95
+ },
96
+ get ValidationError_ScoreMismatch () {
97
+ return ValidationError_ScoreMismatch;
98
+ },
99
+ get ValidationError_StepCountMismatch () {
100
+ return ValidationError_StepCountMismatch;
101
+ },
102
+ get ValidationError_TagCountMismatch () {
103
+ return ValidationError_TagCountMismatch;
104
+ },
105
+ get ValidationError_TriggerConditionCountMismatch () {
106
+ return ValidationError_TriggerConditionCountMismatch;
107
+ },
108
+ get ValidationError_TriggerEventCountMismatch () {
109
+ return ValidationError_TriggerEventCountMismatch;
110
+ },
111
+ get ValidationResult () {
112
+ return ValidationResult;
113
+ },
114
+ get ValidationResult_$reflection () {
115
+ return ValidationResult_$reflection;
116
+ },
117
+ get ValidationSummary () {
118
+ return ValidationSummary;
119
+ },
120
+ get ValidationSummary_$reflection () {
121
+ return ValidationSummary_$reflection;
122
+ }
123
+ });
124
+ const _Types = require("@fable-org/fable-library-js/Types.js");
125
+ const _Option = require("@fable-org/fable-library-js/Option.js");
126
+ const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
127
+ const _List = require("@fable-org/fable-library-js/List.js");
128
+ const _Util = require("@fable-org/fable-library-js/Util.js");
129
+ const _CorEMRSectioning = require("./CorEMRSectioning.js");
130
+ const _Map = require("@fable-org/fable-library-js/Map.js");
131
+ const _Seq2 = require("@fable-org/fable-library-js/Seq2.js");
132
+ const _Seq = require("@fable-org/fable-library-js/Seq.js");
133
+ const _CorEMRElementTypeMap = require("./CorEMRElementTypeMap.js");
134
+ const _Result = require("@fable-org/fable-library-js/Result.js");
135
+ function ValidationError_ItemCountMismatch(expected, actual) {
136
+ return new ValidationError(0, [
137
+ expected,
138
+ actual
139
+ ]);
140
+ }
141
+ function ValidationError_StepCountMismatch(expected, actual) {
142
+ return new ValidationError(1, [
143
+ expected,
144
+ actual
145
+ ]);
146
+ }
147
+ function ValidationError_FieldCountMismatch(step, expected, actual) {
148
+ return new ValidationError(2, [
149
+ step,
150
+ expected,
151
+ actual
152
+ ]);
153
+ }
154
+ function ValidationError_MetadataMismatch(field, expected, actual) {
155
+ return new ValidationError(3, [
156
+ field,
157
+ expected,
158
+ actual
159
+ ]);
160
+ }
161
+ function ValidationError_MissingChoices(itemId, itemLabel) {
162
+ return new ValidationError(4, [
163
+ itemId,
164
+ itemLabel
165
+ ]);
166
+ }
167
+ function ValidationError_InvalidFieldType(itemId, itemType, reason) {
168
+ return new ValidationError(5, [
169
+ itemId,
170
+ itemType,
171
+ reason
172
+ ]);
173
+ }
174
+ function ValidationError_HeadingNotConverted(itemId, heading) {
175
+ return new ValidationError(6, [
176
+ itemId,
177
+ heading
178
+ ]);
179
+ }
180
+ function ValidationError_MissingStep(heading) {
181
+ return new ValidationError(7, [
182
+ heading
183
+ ]);
184
+ }
185
+ function ValidationError_ChoiceCountMismatch(itemId, itemLabel, expected, actual) {
186
+ return new ValidationError(8, [
187
+ itemId,
188
+ itemLabel,
189
+ expected,
190
+ actual
191
+ ]);
192
+ }
193
+ function ValidationError_RequiredFieldMismatch(itemId, itemLabel, expected, actual) {
194
+ return new ValidationError(9, [
195
+ itemId,
196
+ itemLabel,
197
+ expected,
198
+ actual
199
+ ]);
200
+ }
201
+ function ValidationError_ScoreMismatch(expected, actual) {
202
+ return new ValidationError(10, [
203
+ expected,
204
+ actual
205
+ ]);
206
+ }
207
+ function ValidationError_TagCountMismatch(expected, actual) {
208
+ return new ValidationError(11, [
209
+ expected,
210
+ actual
211
+ ]);
212
+ }
213
+ function ValidationError_PathwayMissing(triggerCount) {
214
+ return new ValidationError(12, [
215
+ triggerCount
216
+ ]);
217
+ }
218
+ function ValidationError_PathwayStateCountInvalid(pathwayId, expected, actual) {
219
+ return new ValidationError(13, [
220
+ pathwayId,
221
+ expected,
222
+ actual
223
+ ]);
224
+ }
225
+ function ValidationError_PathwayTransitionCountInvalid(pathwayId, expected, actual) {
226
+ return new ValidationError(14, [
227
+ pathwayId,
228
+ expected,
229
+ actual
230
+ ]);
231
+ }
232
+ function ValidationError_TriggerConditionCountMismatch(triggerId, expected, actual) {
233
+ return new ValidationError(15, [
234
+ triggerId,
235
+ expected,
236
+ actual
237
+ ]);
238
+ }
239
+ function ValidationError_TriggerEventCountMismatch(triggerId, expected, actual) {
240
+ return new ValidationError(16, [
241
+ triggerId,
242
+ expected,
243
+ actual
244
+ ]);
245
+ }
246
+ class ValidationError extends _Types.Union {
247
+ cases() {
248
+ return [
249
+ "ItemCountMismatch",
250
+ "StepCountMismatch",
251
+ "FieldCountMismatch",
252
+ "MetadataMismatch",
253
+ "MissingChoices",
254
+ "InvalidFieldType",
255
+ "HeadingNotConverted",
256
+ "MissingStep",
257
+ "ChoiceCountMismatch",
258
+ "RequiredFieldMismatch",
259
+ "ScoreMismatch",
260
+ "TagCountMismatch",
261
+ "PathwayMissing",
262
+ "PathwayStateCountInvalid",
263
+ "PathwayTransitionCountInvalid",
264
+ "TriggerConditionCountMismatch",
265
+ "TriggerEventCountMismatch"
266
+ ];
267
+ }
268
+ constructor(tag, fields){
269
+ super(), this.tag = tag, this.fields = fields;
270
+ }
271
+ }
272
+ function ValidationError_$reflection() {
273
+ return (0, _Reflection.union_type)("FormSpec.Integrations.CorEMR.CorEMRFormSpecValidator.ValidationError", [], ValidationError, ()=>[
274
+ [
275
+ [
276
+ "expected",
277
+ _Reflection.int32_type
278
+ ],
279
+ [
280
+ "actual",
281
+ _Reflection.int32_type
282
+ ]
283
+ ],
284
+ [
285
+ [
286
+ "expected",
287
+ _Reflection.int32_type
288
+ ],
289
+ [
290
+ "actual",
291
+ _Reflection.int32_type
292
+ ]
293
+ ],
294
+ [
295
+ [
296
+ "step",
297
+ _Reflection.string_type
298
+ ],
299
+ [
300
+ "expected",
301
+ _Reflection.int32_type
302
+ ],
303
+ [
304
+ "actual",
305
+ _Reflection.int32_type
306
+ ]
307
+ ],
308
+ [
309
+ [
310
+ "field",
311
+ _Reflection.string_type
312
+ ],
313
+ [
314
+ "expected",
315
+ _Reflection.string_type
316
+ ],
317
+ [
318
+ "actual",
319
+ _Reflection.string_type
320
+ ]
321
+ ],
322
+ [
323
+ [
324
+ "itemId",
325
+ _Reflection.int32_type
326
+ ],
327
+ [
328
+ "itemLabel",
329
+ _Reflection.string_type
330
+ ]
331
+ ],
332
+ [
333
+ [
334
+ "itemId",
335
+ _Reflection.int32_type
336
+ ],
337
+ [
338
+ "itemType",
339
+ _Reflection.string_type
340
+ ],
341
+ [
342
+ "reason",
343
+ _Reflection.string_type
344
+ ]
345
+ ],
346
+ [
347
+ [
348
+ "itemId",
349
+ _Reflection.int32_type
350
+ ],
351
+ [
352
+ "heading",
353
+ _Reflection.string_type
354
+ ]
355
+ ],
356
+ [
357
+ [
358
+ "heading",
359
+ _Reflection.string_type
360
+ ]
361
+ ],
362
+ [
363
+ [
364
+ "itemId",
365
+ _Reflection.int32_type
366
+ ],
367
+ [
368
+ "itemLabel",
369
+ _Reflection.string_type
370
+ ],
371
+ [
372
+ "expected",
373
+ _Reflection.int32_type
374
+ ],
375
+ [
376
+ "actual",
377
+ _Reflection.int32_type
378
+ ]
379
+ ],
380
+ [
381
+ [
382
+ "itemId",
383
+ _Reflection.int32_type
384
+ ],
385
+ [
386
+ "itemLabel",
387
+ _Reflection.string_type
388
+ ],
389
+ [
390
+ "expected",
391
+ _Reflection.bool_type
392
+ ],
393
+ [
394
+ "actual",
395
+ _Reflection.bool_type
396
+ ]
397
+ ],
398
+ [
399
+ [
400
+ "expected",
401
+ _Reflection.int32_type
402
+ ],
403
+ [
404
+ "actual",
405
+ (0, _Reflection.option_type)(_Reflection.int32_type)
406
+ ]
407
+ ],
408
+ [
409
+ [
410
+ "expected",
411
+ _Reflection.int32_type
412
+ ],
413
+ [
414
+ "actual",
415
+ _Reflection.int32_type
416
+ ]
417
+ ],
418
+ [
419
+ [
420
+ "triggerCount",
421
+ _Reflection.int32_type
422
+ ]
423
+ ],
424
+ [
425
+ [
426
+ "pathwayId",
427
+ _Reflection.string_type
428
+ ],
429
+ [
430
+ "expected",
431
+ _Reflection.int32_type
432
+ ],
433
+ [
434
+ "actual",
435
+ _Reflection.int32_type
436
+ ]
437
+ ],
438
+ [
439
+ [
440
+ "pathwayId",
441
+ _Reflection.string_type
442
+ ],
443
+ [
444
+ "expected",
445
+ _Reflection.int32_type
446
+ ],
447
+ [
448
+ "actual",
449
+ _Reflection.int32_type
450
+ ]
451
+ ],
452
+ [
453
+ [
454
+ "triggerId",
455
+ _Reflection.int32_type
456
+ ],
457
+ [
458
+ "expected",
459
+ _Reflection.int32_type
460
+ ],
461
+ [
462
+ "actual",
463
+ _Reflection.int32_type
464
+ ]
465
+ ],
466
+ [
467
+ [
468
+ "triggerId",
469
+ _Reflection.int32_type
470
+ ],
471
+ [
472
+ "expected",
473
+ _Reflection.int32_type
474
+ ],
475
+ [
476
+ "actual",
477
+ _Reflection.int32_type
478
+ ]
479
+ ]
480
+ ]);
481
+ }
482
+ class ValidationResult extends _Types.Record {
483
+ constructor(IsValid, Errors, Warnings, Summary){
484
+ super();
485
+ this.IsValid = IsValid;
486
+ this.Errors = Errors;
487
+ this.Warnings = Warnings;
488
+ this.Summary = Summary;
489
+ }
490
+ }
491
+ function ValidationResult_$reflection() {
492
+ return (0, _Reflection.record_type)("FormSpec.Integrations.CorEMR.CorEMRFormSpecValidator.ValidationResult", [], ValidationResult, ()=>[
493
+ [
494
+ "IsValid",
495
+ _Reflection.bool_type
496
+ ],
497
+ [
498
+ "Errors",
499
+ (0, _Reflection.list_type)(ValidationError_$reflection())
500
+ ],
501
+ [
502
+ "Warnings",
503
+ (0, _Reflection.list_type)(ValidationError_$reflection())
504
+ ],
505
+ [
506
+ "Summary",
507
+ ValidationSummary_$reflection()
508
+ ]
509
+ ]);
510
+ }
511
+ class ValidationSummary extends _Types.Record {
512
+ constructor(TotalItems, ConvertedFields, HeadingsDetected, StepsCreated, ChoicesProcessed, TriggersFound, TagsMapped){
513
+ super();
514
+ this.TotalItems = TotalItems | 0;
515
+ this.ConvertedFields = ConvertedFields | 0;
516
+ this.HeadingsDetected = HeadingsDetected | 0;
517
+ this.StepsCreated = StepsCreated | 0;
518
+ this.ChoicesProcessed = ChoicesProcessed | 0;
519
+ this.TriggersFound = TriggersFound | 0;
520
+ this.TagsMapped = TagsMapped | 0;
521
+ }
522
+ }
523
+ function ValidationSummary_$reflection() {
524
+ return (0, _Reflection.record_type)("FormSpec.Integrations.CorEMR.CorEMRFormSpecValidator.ValidationSummary", [], ValidationSummary, ()=>[
525
+ [
526
+ "TotalItems",
527
+ _Reflection.int32_type
528
+ ],
529
+ [
530
+ "ConvertedFields",
531
+ _Reflection.int32_type
532
+ ],
533
+ [
534
+ "HeadingsDetected",
535
+ _Reflection.int32_type
536
+ ],
537
+ [
538
+ "StepsCreated",
539
+ _Reflection.int32_type
540
+ ],
541
+ [
542
+ "ChoicesProcessed",
543
+ _Reflection.int32_type
544
+ ],
545
+ [
546
+ "TriggersFound",
547
+ _Reflection.int32_type
548
+ ],
549
+ [
550
+ "TagsMapped",
551
+ _Reflection.int32_type
552
+ ]
553
+ ]);
554
+ }
555
+ function FormSpecValidator_countNonHeadingItems(items) {
556
+ const headings = (0, _CorEMRSectioning.detectHeadings)(items);
557
+ return (0, _List.length)(items) - (0, _List.length)(headings) | 0;
558
+ }
559
+ function FormSpecValidator_countHeadings(items) {
560
+ return (0, _List.length)((0, _CorEMRSectioning.detectHeadings)(items));
561
+ }
562
+ function FormSpecValidator_countTotalFields(steps) {
563
+ return (0, _List.sumBy)((s)=>(0, _List.length)(s.Fields), steps, {
564
+ GetZero: ()=>0,
565
+ Add: (x, y)=>x + y
566
+ });
567
+ }
568
+ function FormSpecValidator_getChoicesPerItem(choices) {
569
+ return (0, _Map.ofList)((0, _List.map)((tupledArg)=>[
570
+ tupledArg[0],
571
+ (0, _List.length)(tupledArg[1])
572
+ ], (0, _Seq2.List_groupBy)((c)=>c.ItemId, choices, {
573
+ Equals: (x, y)=>x === y,
574
+ GetHashCode: _Util.numberHash
575
+ })), {
576
+ Compare: _Util.comparePrimitives
577
+ });
578
+ }
579
+ function FormSpecValidator_calculateExpectedMaxScore(choices) {
580
+ return (0, _List.sumBy)((c)=>c.Score, choices, {
581
+ GetZero: ()=>0,
582
+ Add: (x, y)=>x + y
583
+ });
584
+ }
585
+ function FormSpecValidator_validateMetadata(coreMR, formSpec) {
586
+ return (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)(formSpec.Title !== coreMR.FormName ? (0, _Seq.singleton)(ValidationError_MetadataMismatch("title", coreMR.FormName, formSpec.Title)) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>(0, _Seq.append)(formSpec.Version !== (0, _Util.int32ToString)(coreMR.VersionNumber) ? (0, _Seq.singleton)(ValidationError_MetadataMismatch("version", (0, _Util.int32ToString)(coreMR.VersionNumber), formSpec.Version)) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>formSpec.RequiresReview !== coreMR.RequiresSignature ? (0, _Seq.singleton)(ValidationError_MetadataMismatch("requiresReview", (0, _Types.toString)(coreMR.RequiresSignature), (0, _Types.toString)(formSpec.RequiresReview))) : (0, _Seq.empty)()))))));
587
+ }
588
+ function FormSpecValidator_validateCounts(coreMR, formSpec) {
589
+ const expectedFields = FormSpecValidator_countNonHeadingItems(coreMR.Items) | 0;
590
+ const actualFields = FormSpecValidator_countTotalFields(formSpec.Steps) | 0;
591
+ const expectedSteps = FormSpecValidator_countHeadings(coreMR.Items) | 0;
592
+ const actualSteps = (0, _List.length)(formSpec.Steps) | 0;
593
+ return (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)(expectedFields !== actualFields ? (0, _Seq.singleton)(ValidationError_ItemCountMismatch(expectedFields, actualFields)) : (0, _Seq.empty)(), (0, _Seq.delay)(()=>expectedSteps > 0 && expectedSteps !== actualSteps ? (0, _Seq.singleton)(ValidationError_StepCountMismatch(expectedSteps, actualSteps)) : (0, _Seq.empty)()))));
594
+ }
595
+ function FormSpecValidator_validateChoices(coreMR, formSpec) {
596
+ const choicesPerItem = FormSpecValidator_getChoicesPerItem(coreMR.Choices);
597
+ const errors = [];
598
+ const sequenceToFieldKey = (0, _Map.ofList)((0, _List.map)((f)=>[
599
+ f.FieldOrder,
600
+ f.FieldKey
601
+ ], (0, _List.collect)((s)=>s.Fields, formSpec.Steps)), {
602
+ Compare: _Util.comparePrimitives
603
+ });
604
+ const fieldKeyToItemId = (0, _Map.ofList)((0, _List.choose)((item)=>(0, _Option.map)((fieldKey)=>[
605
+ fieldKey,
606
+ item.ItemId
607
+ ], (0, _Map.tryFind)(item.Sequence, sequenceToFieldKey)), coreMR.Items), {
608
+ Compare: _Util.compare
609
+ });
610
+ const itemsById = (0, _Map.ofList)((0, _List.map)((i)=>[
611
+ i.ItemId,
612
+ i
613
+ ], coreMR.Items), {
614
+ Compare: _Util.comparePrimitives
615
+ });
616
+ const enumerator = (0, _Util.getEnumerator)(formSpec.Steps);
617
+ try {
618
+ while(enumerator["System.Collections.IEnumerator.MoveNext"]()){
619
+ const enumerator_1 = (0, _Util.getEnumerator)(enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]().Fields);
620
+ try {
621
+ while(enumerator_1["System.Collections.IEnumerator.MoveNext"]()){
622
+ const field = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
623
+ const matchValue = field.FieldType;
624
+ switch(matchValue.tag){
625
+ case /* MultiChoice */ 15:
626
+ {
627
+ const info = matchValue.fields[0];
628
+ const matchValue_1 = (0, _Map.tryFind)(field.FieldKey, fieldKeyToItemId);
629
+ if (matchValue_1 == null) {} else {
630
+ const itemId = (0, _Option.value)(matchValue_1) | 0;
631
+ const matchValue_2 = (0, _Map.tryFind)(itemId, itemsById);
632
+ if (matchValue_2 == null) {} else {
633
+ const item_1 = (0, _Option.value)(matchValue_2);
634
+ const expectedCount = (0, _Option.defaultArg)((0, _Map.tryFind)(itemId, choicesPerItem), 0) | 0;
635
+ const actualCount = (0, _List.length)(info.Options) | 0;
636
+ if (!(0, _CorEMRElementTypeMap.getElementTypeInfo)(item_1.ItemTypeId).IsScaffold) {
637
+ if (expectedCount > 0 && expectedCount !== actualCount) {
638
+ void errors.push(ValidationError_ChoiceCountMismatch(itemId, item_1.Label, expectedCount, actualCount));
639
+ } else if (expectedCount === 0) {
640
+ void errors.push(ValidationError_MissingChoices(itemId, item_1.Label));
641
+ }
642
+ }
643
+ }
644
+ }
645
+ break;
646
+ }
647
+ case /* Dropdown */ 14:
648
+ {
649
+ const info_1 = matchValue.fields[0];
650
+ const matchValue_3 = (0, _Map.tryFind)(field.FieldKey, fieldKeyToItemId);
651
+ if (matchValue_3 == null) {} else {
652
+ const itemId_1 = (0, _Option.value)(matchValue_3) | 0;
653
+ const matchValue_4 = (0, _Map.tryFind)(itemId_1, itemsById);
654
+ if (matchValue_4 == null) {} else {
655
+ const item_2 = (0, _Option.value)(matchValue_4);
656
+ const expectedCount_1 = (0, _Option.defaultArg)((0, _Map.tryFind)(itemId_1, choicesPerItem), 0) | 0;
657
+ const actualCount_1 = (0, _List.length)(info_1.Options) | 0;
658
+ if (!(0, _CorEMRElementTypeMap.getElementTypeInfo)(item_2.ItemTypeId).IsScaffold) {
659
+ if (expectedCount_1 > 0 && expectedCount_1 !== actualCount_1) {
660
+ void errors.push(ValidationError_ChoiceCountMismatch(itemId_1, item_2.Label, expectedCount_1, actualCount_1));
661
+ } else if (expectedCount_1 === 0) {
662
+ void errors.push(ValidationError_MissingChoices(itemId_1, item_2.Label));
663
+ }
664
+ }
665
+ }
666
+ }
667
+ break;
668
+ }
669
+ case /* CheckboxList */ 16:
670
+ {
671
+ const info_2 = matchValue.fields[0];
672
+ const matchValue_5 = (0, _Map.tryFind)(field.FieldKey, fieldKeyToItemId);
673
+ if (matchValue_5 == null) {} else {
674
+ const itemId_2 = (0, _Option.value)(matchValue_5) | 0;
675
+ const matchValue_6 = (0, _Map.tryFind)(itemId_2, itemsById);
676
+ if (matchValue_6 == null) {} else {
677
+ const item_3 = (0, _Option.value)(matchValue_6);
678
+ const expectedCount_2 = (0, _Option.defaultArg)((0, _Map.tryFind)(itemId_2, choicesPerItem), 0) | 0;
679
+ const actualCount_2 = (0, _List.length)(info_2.Options) | 0;
680
+ if (!(0, _CorEMRElementTypeMap.getElementTypeInfo)(item_3.ItemTypeId).IsScaffold) {
681
+ if (expectedCount_2 > 0 && expectedCount_2 !== actualCount_2) {
682
+ void errors.push(ValidationError_ChoiceCountMismatch(itemId_2, item_3.Label, expectedCount_2, actualCount_2));
683
+ } else if (expectedCount_2 === 0) {
684
+ void errors.push(ValidationError_MissingChoices(itemId_2, item_3.Label));
685
+ }
686
+ }
687
+ }
688
+ }
689
+ break;
690
+ }
691
+ default:
692
+ undefined;
693
+ }
694
+ }
695
+ } finally{
696
+ (0, _Util.disposeSafe)(enumerator_1);
697
+ }
698
+ }
699
+ } finally{
700
+ (0, _Util.disposeSafe)(enumerator);
701
+ }
702
+ return (0, _List.ofSeq)(errors);
703
+ }
704
+ function FormSpecValidator_validateRequiredFields(coreMR, formSpec) {
705
+ const errors = [];
706
+ const itemsByLabel = (0, _Map.ofList)((0, _List.map)((i)=>[
707
+ i.Label,
708
+ i
709
+ ], coreMR.Items), {
710
+ Compare: _Util.comparePrimitives
711
+ });
712
+ const enumerator = (0, _Util.getEnumerator)(formSpec.Steps);
713
+ try {
714
+ while(enumerator["System.Collections.IEnumerator.MoveNext"]()){
715
+ const enumerator_1 = (0, _Util.getEnumerator)(enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]().Fields);
716
+ try {
717
+ while(enumerator_1["System.Collections.IEnumerator.MoveNext"]()){
718
+ const field = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
719
+ const matchValue = (0, _Map.tryFind)(field.Label, itemsByLabel);
720
+ if (matchValue == null) {} else {
721
+ const item = (0, _Option.value)(matchValue);
722
+ const expectedOptional = !item.IsRequired;
723
+ if (field.IsOptional !== expectedOptional) {
724
+ void errors.push(ValidationError_RequiredFieldMismatch(item.ItemId, item.Label, expectedOptional, field.IsOptional));
725
+ }
726
+ }
727
+ }
728
+ } finally{
729
+ (0, _Util.disposeSafe)(enumerator_1);
730
+ }
731
+ }
732
+ } finally{
733
+ (0, _Util.disposeSafe)(enumerator);
734
+ }
735
+ return (0, _List.ofSeq)(errors);
736
+ }
737
+ function FormSpecValidator_validateScoring(coreMR, formSpec) {
738
+ const expectedScore = FormSpecValidator_calculateExpectedMaxScore(coreMR.Choices) | 0;
739
+ if (expectedScore > 0) {
740
+ const matchValue = formSpec.Score;
741
+ if (matchValue == null) {
742
+ return (0, _List.singleton)(ValidationError_ScoreMismatch(expectedScore, undefined));
743
+ } else {
744
+ const score = (0, _Option.value)(matchValue);
745
+ if (score.MaxScore !== expectedScore) {
746
+ return (0, _List.singleton)(ValidationError_ScoreMismatch(expectedScore, score.MaxScore));
747
+ } else {
748
+ return (0, _List.empty)();
749
+ }
750
+ }
751
+ } else {
752
+ return (0, _List.empty)();
753
+ }
754
+ }
755
+ function FormSpecValidator_validateTags(coreMR, formSpec) {
756
+ const expectedCount = (0, _List.length)(coreMR.Tags) | 0;
757
+ const actualCount = (0, _List.length)(formSpec.CategoryTags) | 0;
758
+ if (expectedCount !== actualCount) {
759
+ return (0, _List.singleton)(ValidationError_TagCountMismatch(expectedCount, actualCount));
760
+ } else {
761
+ return (0, _List.empty)();
762
+ }
763
+ }
764
+ function FormSpecValidator_createSummary(coreMR, formSpec) {
765
+ return new ValidationSummary((0, _List.length)(coreMR.Items), FormSpecValidator_countTotalFields(formSpec.Steps), FormSpecValidator_countHeadings(coreMR.Items), (0, _List.length)(formSpec.Steps), (0, _List.length)(coreMR.Choices), (0, _List.length)(coreMR.Triggers), (0, _List.length)(formSpec.CategoryTags));
766
+ }
767
+ function FormSpecValidator_validatePathways(triggers, pathway) {
768
+ const activeTriggers = (0, _List.filter)((t)=>{
769
+ if (t.Active) {
770
+ return !(0, _List.isEmpty)(t.Events);
771
+ } else {
772
+ return false;
773
+ }
774
+ }, triggers);
775
+ let matchResult;
776
+ if (pathway == null) {
777
+ if ((0, _List.length)(activeTriggers) > 0) {
778
+ matchResult = 0;
779
+ } else {
780
+ matchResult = 1;
781
+ }
782
+ } else {
783
+ matchResult = 1;
784
+ }
785
+ switch(matchResult){
786
+ case 0:
787
+ return (0, _List.singleton)(ValidationError_PathwayMissing((0, _List.length)(activeTriggers)));
788
+ default:
789
+ return (0, _List.empty)();
790
+ }
791
+ }
792
+ function FormSpecValidator_validateConversion(coreMR, formSpec) {
793
+ try {
794
+ const allErrors = (0, _Seq.toList)((0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateMetadata(coreMR.Metadata, formSpec), (0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateCounts(coreMR, formSpec), (0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateChoices(coreMR, formSpec), (0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateRequiredFields(coreMR, formSpec), (0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateScoring(coreMR, formSpec), (0, _Seq.delay)(()=>(0, _Seq.append)(FormSpecValidator_validateTags(coreMR, formSpec), (0, _Seq.delay)(()=>FormSpecValidator_validatePathways(coreMR.Triggers, formSpec.ClinicalPathway)))))))))))))));
795
+ return (0, _Result.FSharpResult$2_Ok)(new ValidationResult((0, _List.isEmpty)(allErrors), allErrors, (0, _List.empty)(), FormSpecValidator_createSummary(coreMR, formSpec)));
796
+ } catch (ex) {
797
+ return (0, _Result.FSharpResult$2_Error)(`Validation failed: ${ex.message}`);
798
+ }
799
+ } //# sourceMappingURL=CorEMRFormSpecValidator.ts.map
800
+
801
+ //# sourceMappingURL=CorEMRFormSpecValidator.js.map