@f1studio/form-spec 5.0.0-alpha.101

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 (225) hide show
  1. package/Designer.d.ts +89 -0
  2. package/FormSpec.TS/Components/HelloComponent.js +68 -0
  3. package/FormSpec.TS/Components/HelloComponent.js.map +1 -0
  4. package/FormSpec.TS/Components/HelloComponent.ts.map +1 -0
  5. package/FormSpec.TS/Designer.js +526 -0
  6. package/FormSpec.TS/Designer.js.map +1 -0
  7. package/FormSpec.TS/Designer.ts.map +1 -0
  8. package/FormSpec.TS/FormSpec.js +5400 -0
  9. package/FormSpec.TS/FormSpec.js.map +1 -0
  10. package/FormSpec.TS/FormSpec.ts.map +1 -0
  11. package/FormSpec.TS/FormSpecHelpers.js +382 -0
  12. package/FormSpec.TS/FormSpecHelpers.js.map +1 -0
  13. package/FormSpec.TS/FormSpecHelpers.ts.map +1 -0
  14. package/FormSpec.TS/Helpers.js +732 -0
  15. package/FormSpec.TS/Helpers.js.map +1 -0
  16. package/FormSpec.TS/Helpers.ts.map +1 -0
  17. package/FormSpec.TS/Interfaces.js +257 -0
  18. package/FormSpec.TS/Interfaces.js.map +1 -0
  19. package/FormSpec.TS/Interfaces.ts.map +1 -0
  20. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +854 -0
  21. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -0
  22. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -0
  23. package/FormSpec.TS/Interop/FormSpec.Api.Option.js +1961 -0
  24. package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -0
  25. package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -0
  26. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +1367 -0
  27. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -0
  28. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
  29. package/FormSpec.TS/Logging/LogTypes.js +347 -0
  30. package/FormSpec.TS/Logging/LogTypes.js.map +1 -0
  31. package/FormSpec.TS/Logging/LogTypes.ts.map +1 -0
  32. package/FormSpec.TS/Migrator.js +230 -0
  33. package/FormSpec.TS/Migrator.js.map +1 -0
  34. package/FormSpec.TS/Migrator.ts.map +1 -0
  35. package/FormSpec.TS/PathwayDataExtractor.js +361 -0
  36. package/FormSpec.TS/PathwayDataExtractor.js.map +1 -0
  37. package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -0
  38. package/FormSpec.TS/PathwayExecutor.js +1321 -0
  39. package/FormSpec.TS/PathwayExecutor.js.map +1 -0
  40. package/FormSpec.TS/PathwayExecutor.ts.map +1 -0
  41. package/FormSpec.TS/PathwayValidator.js +346 -0
  42. package/FormSpec.TS/PathwayValidator.js.map +1 -0
  43. package/FormSpec.TS/PathwayValidator.ts.map +1 -0
  44. package/FormSpec.TS/PluginInterface.js +171 -0
  45. package/FormSpec.TS/PluginInterface.js.map +1 -0
  46. package/FormSpec.TS/PluginInterface.ts.map +1 -0
  47. package/FormSpec.TS/Prelude.js +59 -0
  48. package/FormSpec.TS/Prelude.js.map +1 -0
  49. package/FormSpec.TS/Prelude.ts.map +1 -0
  50. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js +958 -0
  51. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js.map +1 -0
  52. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
  53. package/FormSpec.TS/Renderers/MermaidRenderer.js +228 -0
  54. package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -0
  55. package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -0
  56. package/FormSpec.TS/Renderers/PathwayRenderers.js +190 -0
  57. package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -0
  58. package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -0
  59. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +511 -0
  60. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js +437 -0
  61. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js.map +1 -0
  62. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.ts.map +1 -0
  63. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +16 -0
  64. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js +73 -0
  65. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js.map +1 -0
  66. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.ts.map +1 -0
  67. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +50 -0
  68. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js +72 -0
  69. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js.map +1 -0
  70. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.ts.map +1 -0
  71. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +28 -0
  72. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +24 -0
  73. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js +56 -0
  74. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js.map +1 -0
  75. package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts.map +1 -0
  76. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +31 -0
  77. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +178 -0
  78. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js +464 -0
  79. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js.map +1 -0
  80. package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.ts.map +1 -0
  81. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +17 -0
  82. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +152 -0
  83. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js +25 -0
  84. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js.map +1 -0
  85. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.ts.map +1 -0
  86. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +28 -0
  87. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +218 -0
  88. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js +37 -0
  89. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js.map +1 -0
  90. package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.ts.map +1 -0
  91. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +27 -0
  92. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +82 -0
  93. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js +7 -0
  94. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js.map +1 -0
  95. package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.ts.map +1 -0
  96. package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +59 -0
  97. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +154 -0
  98. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js +32 -0
  99. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js.map +1 -0
  100. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.ts.map +1 -0
  101. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +42 -0
  102. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +240 -0
  103. package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +24 -0
  104. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +826 -0
  105. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +83 -0
  106. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js +292 -0
  107. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js.map +1 -0
  108. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.ts.map +1 -0
  109. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +65 -0
  110. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js +229 -0
  111. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js.map +1 -0
  112. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.ts.map +1 -0
  113. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +91 -0
  114. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +876 -0
  115. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +4080 -0
  116. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js +133 -0
  117. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js.map +1 -0
  118. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.ts.map +1 -0
  119. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +656 -0
  120. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js +561 -0
  121. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js.map +1 -0
  122. package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.ts.map +1 -0
  123. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +25 -0
  124. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js +46 -0
  125. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js.map +1 -0
  126. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.ts.map +1 -0
  127. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +63 -0
  128. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +1 -0
  129. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +41 -0
  130. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js +7 -0
  131. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js.map +1 -0
  132. package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.ts.map +1 -0
  133. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +53 -0
  134. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js +7 -0
  135. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js.map +1 -0
  136. package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.ts.map +1 -0
  137. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +5740 -0
  138. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +1455 -0
  139. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js +39 -0
  140. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js.map +1 -0
  141. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.ts.map +1 -0
  142. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +13 -0
  143. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +33 -0
  144. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +181 -0
  145. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +17 -0
  146. package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +162 -0
  147. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +13 -0
  148. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js +7 -0
  149. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js.map +1 -0
  150. package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.ts.map +1 -0
  151. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +1768 -0
  152. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js +2337 -0
  153. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +1 -0
  154. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +1 -0
  155. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +811 -0
  156. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js +465 -0
  157. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -0
  158. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -0
  159. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +47 -0
  160. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js +18 -0
  161. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +1 -0
  162. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +1 -0
  163. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +34 -0
  164. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +68 -0
  165. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js +355 -0
  166. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +1 -0
  167. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +1 -0
  168. package/FormSpec.TS/fable_modules/project_cracked.json +1 -0
  169. package/FormSpec.d.ts +1257 -0
  170. package/FormSpecHelpers.d.ts +50 -0
  171. package/Helpers.d.ts +147 -0
  172. package/Interfaces.d.ts +70 -0
  173. package/Interop/FormSpec.Api.Helpers.d.ts +247 -0
  174. package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -0
  175. package/Interop/FormSpec.Api.Option.d.ts +384 -0
  176. package/Interop/FormSpec.Api.Option.d.ts.map +1 -0
  177. package/Interop/FormSpec.Values.Api.Option.d.ts +324 -0
  178. package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -0
  179. package/Migrator.d.ts +59 -0
  180. package/PathwayDataExtractor.d.ts +19 -0
  181. package/PathwayExecutor.d.ts +210 -0
  182. package/PathwayValidator.d.ts +52 -0
  183. package/PluginInterface.d.ts +36 -0
  184. package/Prelude.d.ts +11 -0
  185. package/README.TS.md +622 -0
  186. package/README.md +85 -0
  187. package/package.json +39 -0
  188. package/src/Components/HelloComponent.ts +48 -0
  189. package/src/Components/HelloComponent.ts.map +1 -0
  190. package/src/Designer.ts +389 -0
  191. package/src/Designer.ts.map +1 -0
  192. package/src/FormSpec.ts +3114 -0
  193. package/src/FormSpec.ts.map +1 -0
  194. package/src/FormSpecHelpers.ts +374 -0
  195. package/src/FormSpecHelpers.ts.map +1 -0
  196. package/src/Helpers.ts +765 -0
  197. package/src/Helpers.ts.map +1 -0
  198. package/src/Interfaces.ts +166 -0
  199. package/src/Interfaces.ts.map +1 -0
  200. package/src/Interop/FormSpec.Api.Helpers.ts +872 -0
  201. package/src/Interop/FormSpec.Api.Helpers.ts.map +1 -0
  202. package/src/Interop/FormSpec.Api.Option.ts +1618 -0
  203. package/src/Interop/FormSpec.Api.Option.ts.map +1 -0
  204. package/src/Interop/FormSpec.Values.Api.Option.ts +1214 -0
  205. package/src/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
  206. package/src/Logging/LogTypes.ts +212 -0
  207. package/src/Logging/LogTypes.ts.map +1 -0
  208. package/src/Migrator.ts +156 -0
  209. package/src/Migrator.ts.map +1 -0
  210. package/src/PathwayDataExtractor.ts +290 -0
  211. package/src/PathwayDataExtractor.ts.map +1 -0
  212. package/src/PathwayExecutor.ts +1102 -0
  213. package/src/PathwayExecutor.ts.map +1 -0
  214. package/src/PathwayValidator.ts +244 -0
  215. package/src/PathwayValidator.ts.map +1 -0
  216. package/src/PluginInterface.ts +79 -0
  217. package/src/PluginInterface.ts.map +1 -0
  218. package/src/Prelude.ts +21 -0
  219. package/src/Prelude.ts.map +1 -0
  220. package/src/Renderers/FormSpecMarkdownRenderer.ts +874 -0
  221. package/src/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
  222. package/src/Renderers/MermaidRenderer.ts +218 -0
  223. package/src/Renderers/MermaidRenderer.ts.map +1 -0
  224. package/src/Renderers/PathwayRenderers.ts +200 -0
  225. package/src/Renderers/PathwayRenderers.ts.map +1 -0
@@ -0,0 +1,854 @@
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 ExpectedFieldValueType () {
13
+ return ExpectedFieldValueType;
14
+ },
15
+ get ExpectedFieldValueType_$reflection () {
16
+ return ExpectedFieldValueType_$reflection;
17
+ },
18
+ get ExpectedFieldValueType_MatrixValue () {
19
+ return ExpectedFieldValueType_MatrixValue;
20
+ },
21
+ get ExpectedFieldValueType_MultipleValues () {
22
+ return ExpectedFieldValueType_MultipleValues;
23
+ },
24
+ get ExpectedFieldValueType_PluginDataValue () {
25
+ return ExpectedFieldValueType_PluginDataValue;
26
+ },
27
+ get ExpectedFieldValueType_SingleValue () {
28
+ return ExpectedFieldValueType_SingleValue;
29
+ },
30
+ get addPathwayToFormSpec () {
31
+ return addPathwayToFormSpec;
32
+ },
33
+ get buildDynamicFormResultData () {
34
+ return buildDynamicFormResultData;
35
+ },
36
+ get convertActionInfo () {
37
+ return convertActionInfo;
38
+ },
39
+ get createActionState () {
40
+ return createActionState;
41
+ },
42
+ get createCheckboxField () {
43
+ return createCheckboxField;
44
+ },
45
+ get createCheckboxListField () {
46
+ return createCheckboxListField;
47
+ },
48
+ get createClinicalPathway () {
49
+ return createClinicalPathway;
50
+ },
51
+ get createFieldOption () {
52
+ return createFieldOption;
53
+ },
54
+ get createFormFieldData () {
55
+ return createFormFieldData;
56
+ },
57
+ get createFormSpec () {
58
+ return createFormSpec;
59
+ },
60
+ get createFormStep () {
61
+ return createFormStep;
62
+ },
63
+ get createMatrixField () {
64
+ return createMatrixField;
65
+ },
66
+ get createPluginField () {
67
+ return createPluginField;
68
+ },
69
+ get createTerminalState () {
70
+ return createTerminalState;
71
+ },
72
+ get createTestFormSpec () {
73
+ return createTestFormSpec;
74
+ },
75
+ get createTextField () {
76
+ return createTextField;
77
+ },
78
+ get createTransition () {
79
+ return createTransition;
80
+ },
81
+ get decodeAsMatrixValue () {
82
+ return decodeAsMatrixValue;
83
+ },
84
+ get decodeAsPluginDataArray () {
85
+ return decodeAsPluginDataArray;
86
+ },
87
+ get decodeAsString () {
88
+ return decodeAsString;
89
+ },
90
+ get decodeAsStringArray () {
91
+ return decodeAsStringArray;
92
+ },
93
+ get defaultArg () {
94
+ return defaultArg;
95
+ },
96
+ get defaultArgWith () {
97
+ return defaultArgWith;
98
+ },
99
+ get deserializeDynamicFormResultData () {
100
+ return deserializeDynamicFormResultData;
101
+ },
102
+ get deserializeFormSpec () {
103
+ return deserializeFormSpec;
104
+ },
105
+ get findFieldByKey () {
106
+ return findFieldByKey;
107
+ },
108
+ get getExpectedFieldValueType () {
109
+ return getExpectedFieldValueType;
110
+ },
111
+ get getFieldChoiceOptions () {
112
+ return getFieldChoiceOptions;
113
+ },
114
+ get getFieldDataFromFormResult () {
115
+ return getFieldDataFromFormResult;
116
+ },
117
+ get getFieldDetails () {
118
+ return getFieldDetails;
119
+ },
120
+ get getFieldKeyString () {
121
+ return getFieldKeyString;
122
+ },
123
+ get getFieldMatrixInfo () {
124
+ return getFieldMatrixInfo;
125
+ },
126
+ get getFieldTypeInfo () {
127
+ return getFieldTypeInfo;
128
+ },
129
+ get getFieldValue () {
130
+ return getFieldValue;
131
+ },
132
+ get getFormResultFieldKeys () {
133
+ return getFormResultFieldKeys;
134
+ },
135
+ get getFormResultStepOrders () {
136
+ return getFormResultStepOrders;
137
+ },
138
+ get getResultSteps () {
139
+ return getResultSteps;
140
+ },
141
+ get initializePathwayExecution () {
142
+ return initializePathwayExecution;
143
+ },
144
+ get isNone () {
145
+ return isNone;
146
+ },
147
+ get isSome () {
148
+ return isSome;
149
+ },
150
+ get listToArray () {
151
+ return listToArray;
152
+ },
153
+ get serializeDynamicFormResultData () {
154
+ return serializeDynamicFormResultData;
155
+ },
156
+ get serializeFormSpec () {
157
+ return serializeFormSpec;
158
+ },
159
+ get stateKeyForAction () {
160
+ return stateKeyForAction;
161
+ }
162
+ });
163
+ const _Option = require("@fable-org/fable-library-js/Option.js");
164
+ const _List = require("@fable-org/fable-library-js/List.js");
165
+ const _String = require("@fable-org/fable-library-js/String.js");
166
+ const _Encodefs = require("../fable_modules/Thoth.Json.10.4.1/Encode.fs.js");
167
+ const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
168
+ const _Decodefs = require("../fable_modules/Thoth.Json.10.4.1/Decode.fs.js");
169
+ const _Util = require("@fable-org/fable-library-js/Util.js");
170
+ const _FormSpec = require("../FormSpec.js");
171
+ const _Types = require("@fable-org/fable-library-js/Types.js");
172
+ const _Map = require("@fable-org/fable-library-js/Map.js");
173
+ const _MapUtil = require("@fable-org/fable-library-js/MapUtil.js");
174
+ const _Seq = require("@fable-org/fable-library-js/Seq.js");
175
+ const _Set = require("@fable-org/fable-library-js/Set.js");
176
+ const _Array = require("@fable-org/fable-library-js/Array.js");
177
+ const _Guid = require("@fable-org/fable-library-js/Guid.js");
178
+ const _DateOffset = require("@fable-org/fable-library-js/DateOffset.js");
179
+ const _PathwayExecutor = require("../PathwayExecutor.js");
180
+ function defaultArg(opt, defaultValue) {
181
+ return (0, _Option.defaultArg)(opt, defaultValue);
182
+ }
183
+ function defaultArgWith(opt, defThunk) {
184
+ return (0, _Option.defaultArgWith)(opt, defThunk);
185
+ }
186
+ function isSome(opt) {
187
+ return opt != null;
188
+ }
189
+ function isNone(opt) {
190
+ return opt == null;
191
+ }
192
+ function listToArray(list) {
193
+ return Array.from(list);
194
+ }
195
+ function serializeFormSpec(formSpec) {
196
+ (0, _String.toConsole)((0, _String.printf)("[API.Helpers] Serializing FormSpec!!"));
197
+ (0, _String.toConsole)(`[API.Helpers] FormSpec: ${formSpec}`);
198
+ return (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(formSpec));
199
+ }
200
+ function deserializeFormSpec(json) {
201
+ (0, _String.toConsole)((0, _String.printf)("[API.Helpers] Deserializing FormSpec"));
202
+ const matchValue = (0, _Decodefs.fromString)((0, _Util.uncurry2)((0, _Decodefs.Auto_generateBoxedDecoder_Z6670B51)((0, _FormSpec.Spec_FormSpec$1_$reflection)((0, _FormSpec.Spec_FieldType_$reflection)()), undefined, undefined)), json);
203
+ if (matchValue.tag === /* Error */ 1) {
204
+ throw new Error(`[API.Helpers] Deserialization failed: ${matchValue.fields[0]}`);
205
+ } else {
206
+ return matchValue.fields[0];
207
+ }
208
+ }
209
+ function serializeDynamicFormResultData(data) {
210
+ (0, _String.toConsole)((0, _String.printf)("[API.Helpers] Serializing DynamicFormResultData"));
211
+ return (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _FormSpec.Values_DynamicFormResultData$1_$reflection)((0, _FormSpec.Spec_FieldType_$reflection)()), undefined, undefined, undefined)(data));
212
+ }
213
+ function deserializeDynamicFormResultData(json) {
214
+ const matchValue = (0, _Decodefs.fromString)((0, _Util.uncurry2)((0, _Decodefs.Auto_generateBoxedDecoder_Z6670B51)((0, _FormSpec.Values_DynamicFormResultData$1_$reflection)((0, _FormSpec.Spec_FieldType_$reflection)()), undefined, undefined)), json);
215
+ if (matchValue.tag === /* Error */ 1) {
216
+ return undefined;
217
+ } else {
218
+ return matchValue.fields[0];
219
+ }
220
+ }
221
+ function findFieldByKey(spec, fieldKeyString) {
222
+ return (0, _List.tryFind)((field)=>field.FieldKey.fields[0] === fieldKeyString, (0, _List.collect)((step)=>step.Fields, spec.Steps));
223
+ }
224
+ function ExpectedFieldValueType_SingleValue() {
225
+ return new ExpectedFieldValueType(0, []);
226
+ }
227
+ function ExpectedFieldValueType_MultipleValues() {
228
+ return new ExpectedFieldValueType(1, []);
229
+ }
230
+ function ExpectedFieldValueType_MatrixValue() {
231
+ return new ExpectedFieldValueType(2, []);
232
+ }
233
+ function ExpectedFieldValueType_PluginDataValue() {
234
+ return new ExpectedFieldValueType(3, []);
235
+ }
236
+ class ExpectedFieldValueType extends _Types.Union {
237
+ cases() {
238
+ return [
239
+ "SingleValue",
240
+ "MultipleValues",
241
+ "MatrixValue",
242
+ "PluginDataValue"
243
+ ];
244
+ }
245
+ constructor(tag, fields){
246
+ super(), this.tag = tag, this.fields = fields;
247
+ }
248
+ }
249
+ function ExpectedFieldValueType_$reflection() {
250
+ return (0, _Reflection.union_type)("FormSpec.Interop.Helpers.ExpectedFieldValueType", [], ExpectedFieldValueType, ()=>[
251
+ [],
252
+ [],
253
+ [],
254
+ []
255
+ ]);
256
+ }
257
+ function getExpectedFieldValueType(fieldType) {
258
+ switch(fieldType.tag){
259
+ case /* TextArea */ 1:
260
+ return ExpectedFieldValueType_SingleValue();
261
+ case /* Email */ 2:
262
+ return ExpectedFieldValueType_SingleValue();
263
+ case /* Password */ 3:
264
+ return ExpectedFieldValueType_SingleValue();
265
+ case /* Search */ 4:
266
+ return ExpectedFieldValueType_SingleValue();
267
+ case /* Color */ 5:
268
+ return ExpectedFieldValueType_SingleValue();
269
+ case /* Number */ 6:
270
+ return ExpectedFieldValueType_SingleValue();
271
+ case /* Tel */ 7:
272
+ return ExpectedFieldValueType_SingleValue();
273
+ case /* Date */ 8:
274
+ return ExpectedFieldValueType_SingleValue();
275
+ case /* DateTimeLocal */ 9:
276
+ return ExpectedFieldValueType_SingleValue();
277
+ case /* Time */ 10:
278
+ return ExpectedFieldValueType_SingleValue();
279
+ case /* Checkbox */ 11:
280
+ return ExpectedFieldValueType_SingleValue();
281
+ case /* Radio */ 12:
282
+ return ExpectedFieldValueType_SingleValue();
283
+ case /* SingleChoice */ 13:
284
+ return ExpectedFieldValueType_SingleValue();
285
+ case /* Dropdown */ 14:
286
+ return ExpectedFieldValueType_SingleValue();
287
+ case /* TextAutoComplete */ 18:
288
+ return ExpectedFieldValueType_SingleValue();
289
+ case /* Signature */ 20:
290
+ return ExpectedFieldValueType_SingleValue();
291
+ case /* Message */ 21:
292
+ return ExpectedFieldValueType_SingleValue();
293
+ case /* CheckboxList */ 16:
294
+ return ExpectedFieldValueType_MultipleValues();
295
+ case /* MultiChoice */ 15:
296
+ return ExpectedFieldValueType_MultipleValues();
297
+ case /* TagList */ 17:
298
+ return ExpectedFieldValueType_MultipleValues();
299
+ case /* Matrix */ 19:
300
+ return ExpectedFieldValueType_MatrixValue();
301
+ case /* PluginField */ 22:
302
+ return ExpectedFieldValueType_PluginDataValue();
303
+ default:
304
+ return ExpectedFieldValueType_SingleValue();
305
+ }
306
+ }
307
+ function decodeAsString(fieldKey, obj) {
308
+ let matchValue;
309
+ const json = (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(obj));
310
+ matchValue = (0, _Decodefs.fromString)((0, _Util.uncurry2)((0, _Decodefs.Auto_generateBoxedDecoder_Z6670B51)(_Reflection.string_type, undefined, undefined)), json);
311
+ if (matchValue.tag === /* Error */ 1) {
312
+ if (typeof obj === "string") {
313
+ const str = obj;
314
+ return str;
315
+ } else {
316
+ throw new Error(`Field ${fieldKey}: Expected string value, got ${"Object"}`);
317
+ }
318
+ } else {
319
+ return matchValue.fields[0];
320
+ }
321
+ }
322
+ function decodeAsStringArray(fieldKey, obj) {
323
+ if ((0, _Util.isArrayLike)(obj)) {
324
+ return obj;
325
+ } else if ((0, _Util.isArrayLike)(obj)) {
326
+ const resizeArray = obj;
327
+ return resizeArray.slice();
328
+ } else if (typeof obj === "string") {
329
+ return [
330
+ obj
331
+ ];
332
+ } else {
333
+ try {
334
+ let matchValue;
335
+ const json = (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(obj));
336
+ matchValue = (0, _Decodefs.fromString)((0, _Util.uncurry2)((0, _Decodefs.Auto_generateBoxedDecoder_Z6670B51)((0, _Reflection.array_type)(_Reflection.string_type), undefined, undefined)), json);
337
+ if (matchValue.tag === /* Error */ 1) {
338
+ throw new Error(`Field ${fieldKey}: Expected string array, got ${"Object"}`);
339
+ } else {
340
+ return matchValue.fields[0];
341
+ }
342
+ } catch (ex) {
343
+ throw new Error(`Field ${fieldKey}: Expected string array, got ${"Object"}`);
344
+ }
345
+ }
346
+ }
347
+ function decodeAsMatrixValue(fieldKey, obj) {
348
+ let str;
349
+ const objAsString = typeof obj === "string" ? (str = obj, str) : (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(obj));
350
+ try {
351
+ const matchValue = (0, _Decodefs.fromString)((path_2, v)=>(0, _Decodefs.object)((get$)=>{
352
+ let description;
353
+ const objectArg = get$.Required;
354
+ description = objectArg.Field("description", _Decodefs.string);
355
+ let valuesMap;
356
+ const arg_3 = (0, _Decodefs.dict)(_Decodefs.string);
357
+ const objectArg_1 = get$.Required;
358
+ valuesMap = objectArg_1.Field("values", (0, _Util.uncurry2)(arg_3));
359
+ const valuesDict = new Map([]);
360
+ const enumerator = (0, _Util.getEnumerator)(valuesMap);
361
+ try {
362
+ while(enumerator["System.Collections.IEnumerator.MoveNext"]()){
363
+ const kvp = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
364
+ (0, _MapUtil.addToDict)(valuesDict, kvp[0], kvp[1]);
365
+ }
366
+ } finally{
367
+ (0, _Util.disposeSafe)(enumerator);
368
+ }
369
+ return {
370
+ description: description,
371
+ values: valuesDict
372
+ };
373
+ }, path_2, v), objAsString);
374
+ if (matchValue.tag === /* Error */ 1) {
375
+ throw new Error(`Field ${fieldKey}: Invalid matrix data format - ${matchValue.fields[0]}`);
376
+ } else {
377
+ return matchValue.fields[0];
378
+ }
379
+ } catch (ex) {
380
+ throw new Error(`Field ${fieldKey}: Failed to decode matrix value - ${ex.message}`);
381
+ }
382
+ }
383
+ function decodeAsPluginDataArray(fieldKey, obj) {
384
+ let str;
385
+ const objAsString = typeof obj === "string" ? (str = obj, str) : (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(obj));
386
+ try {
387
+ const matchValue = (0, _Decodefs.fromString)((path_8, value_10)=>(0, _Decodefs.array)((path_7, v)=>(0, _Decodefs.object)((get$)=>{
388
+ let objectArg_6;
389
+ let propertyKey;
390
+ const objectArg = get$.Required;
391
+ propertyKey = objectArg.Field("propertyKey", _Decodefs.string);
392
+ let name;
393
+ const objectArg_1 = get$.Required;
394
+ name = objectArg_1.Field("name", _Decodefs.string);
395
+ let dataType;
396
+ const objectArg_2 = get$.Required;
397
+ dataType = objectArg_2.Field("dataType", _Decodefs.string);
398
+ let value_6;
399
+ const objectArg_3 = get$.Required;
400
+ value_6 = objectArg_3.Field("value", _Decodefs.string);
401
+ let displayName;
402
+ const objectArg_4 = get$.Optional;
403
+ displayName = objectArg_4.Field("displayName", _Decodefs.string);
404
+ let unit;
405
+ const objectArg_5 = get$.Optional;
406
+ unit = objectArg_5.Field("unit", _Decodefs.string);
407
+ return {
408
+ dataType: dataType,
409
+ description: (0, _Option.unwrap)((objectArg_6 = get$.Optional, objectArg_6.Field("description", _Decodefs.string))),
410
+ displayName: (0, _Option.unwrap)(displayName),
411
+ name: name,
412
+ propertyKey: propertyKey,
413
+ unit: (0, _Option.unwrap)(unit),
414
+ value: value_6
415
+ };
416
+ }, path_7, v), path_8, value_10), objAsString);
417
+ if (matchValue.tag === /* Error */ 1) {
418
+ throw new Error(`Field ${fieldKey}: Invalid plugin data format - ${matchValue.fields[0]}`);
419
+ } else {
420
+ return matchValue.fields[0];
421
+ }
422
+ } catch (ex) {
423
+ throw new Error(`Field ${fieldKey}: Failed to decode plugin data - ${ex.message}`);
424
+ }
425
+ }
426
+ function createFormFieldData(fieldKey, objectValue) {
427
+ return {
428
+ fieldKey: fieldKey,
429
+ objectValue: objectValue
430
+ };
431
+ }
432
+ function buildDynamicFormResultData(formSpec, fieldData) {
433
+ const resultFormSpecDetails = new _FormSpec.Values_DynamicFormSpecDetails(formSpec.Id, formSpec.Code, formSpec.FormSpecVersion, formSpec.FormSpecVersion, formSpec.Score, (0, _FormSpec.Values_FormStatus_Pending)(), (0, _List.empty)());
434
+ const allFieldDetails = (0, _List.ofSeq)((0, _Seq.choose)((input)=>{
435
+ let matchValue_1, matrixData, matchValue_2;
436
+ const matchValue = findFieldByKey(formSpec, input.fieldKey);
437
+ if (matchValue == null) {
438
+ (0, _String.toConsole)(`Warning: Field ${input.fieldKey} not found in FormSpec`);
439
+ return undefined;
440
+ } else {
441
+ const field = (0, _Option.value)(matchValue);
442
+ try {
443
+ return [
444
+ field,
445
+ new _FormSpec.Values_FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue_1 = getExpectedFieldValueType(field.FieldType), matchValue_1.tag === /* MultipleValues */ 1 ? (0, _FormSpec.Shared_FieldValue_Multiple)((0, _Set.ofArray)((0, _Array.map)((value)=>new _FormSpec.Shared_FieldAnswer(field.FieldKey, field.Label, value), decodeAsStringArray(input.fieldKey, input.objectValue)), {
446
+ Compare: _Util.compare
447
+ })) : matchValue_1.tag === /* MatrixValue */ 2 ? (matrixData = decodeAsMatrixValue(input.fieldKey, input.objectValue), (0, _FormSpec.Shared_FieldValue_Matrix)(new _FormSpec.Shared_MatrixAnswer(field.FieldKey, matrixData.description, (0, _Map.ofSeq)((0, _Seq.map)((kvp)=>[
448
+ new _FormSpec.Shared_MatrixItemKey((0, _Guid.parse)(kvp[0])),
449
+ kvp[1]
450
+ ], matrixData.values), {
451
+ Compare: _Util.compare
452
+ })))) : matchValue_1.tag === /* PluginDataValue */ 3 ? (0, _FormSpec.Shared_FieldValue_PluginData)((0, _List.ofArray)((0, _Array.map)((prop)=>new _FormSpec.Shared_PluginDataProperty(new _FormSpec.Shared_PluginPropertyKey((0, _Guid.parse)(prop.propertyKey)), prop.name, prop.dataType, prop.value, prop.displayName, prop.unit, prop.description), decodeAsPluginDataArray(input.fieldKey, input.objectValue)))) : (0, _FormSpec.Shared_FieldValue_Single)(new _FormSpec.Shared_FieldAnswer(field.FieldKey, field.Label, decodeAsString(input.fieldKey, input.objectValue)))), field.FieldType, (matchValue_2 = field.FieldType, matchValue_2.tag === /* Radio */ 12 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* SingleChoice */ 13 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* Dropdown */ 14 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* MultiChoice */ 15 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* CheckboxList */ 16 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* TagList */ 17 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* TextAutoComplete */ 18 ? matchValue_2.fields[0].Options : matchValue_2.tag === /* Matrix */ 19 ? matchValue_2.fields[0].Options : (0, _List.empty)()))
453
+ ];
454
+ } catch (ex) {
455
+ (0, _String.toConsole)(`Error processing field ${input.fieldKey}: ${ex.message}`);
456
+ return undefined;
457
+ }
458
+ }
459
+ }, fieldData));
460
+ return new _FormSpec.Values_DynamicFormResultData$1(resultFormSpecDetails, (0, _Map.ofList)((0, _List.map)((step)=>[
461
+ new _FormSpec.Values_StepOrder(step.StepOrder),
462
+ (0, _Map.ofList)((0, _List.map)((tupledArg_1)=>{
463
+ const fieldDetails_1 = tupledArg_1[1];
464
+ return [
465
+ fieldDetails_1.Key,
466
+ fieldDetails_1
467
+ ];
468
+ }, (0, _List.filter)((tupledArg)=>(0, _List.exists)((stepField)=>(0, _Util.equals)(stepField.FieldKey, tupledArg[0].FieldKey), step.Fields), allFieldDetails)), {
469
+ Compare: _Util.compare
470
+ })
471
+ ], formSpec.Steps), {
472
+ Compare: _Util.compare
473
+ }));
474
+ }
475
+ function createCheckboxField(fieldKeyString, label, isOptional) {
476
+ return new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), label, undefined, undefined, isOptional, false, (0, _FormSpec.Spec_FieldType_Checkbox)(new _FormSpec.Spec_BooleanInfo(undefined, undefined)));
477
+ }
478
+ function createCheckboxListField(fieldKeyString, label, options) {
479
+ const fieldOptions = (0, _List.ofSeq)((0, _Seq.mapIndexed)((_arg, opt)=>new _FormSpec.Shared_FieldOption(opt.description, opt.value, new _FormSpec.Shared_FieldOptionKey((0, _Guid.parse)(opt.optionKey))), options));
480
+ return new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), label, undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_CheckboxList)(new _FormSpec.Spec_MultiChoiceInfo(fieldOptions)));
481
+ }
482
+ function createTextField(fieldKeyString, label, isOptional) {
483
+ return new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), label, undefined, undefined, isOptional, false, (0, _FormSpec.Spec_FieldType_Text)(new _FormSpec.Spec_TextInfo(undefined)));
484
+ }
485
+ function createFormStep(stepOrder, stepLabel, fields) {
486
+ return new _FormSpec.Spec_FormStep$1(stepOrder, stepLabel, (0, _List.ofSeq)((0, _Seq.mapIndexed)((index, field)=>new _FormSpec.Spec_FormField$1(index + 1, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.FieldType), fields)));
487
+ }
488
+ function createFormSpec(idString, title, steps) {
489
+ return new _FormSpec.Spec_FormSpec$1((0, _Guid.parse)(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", (0, _List.ofSeq)(steps), (0, _List.empty)(), undefined, (0, _List.empty)(), false, false, undefined);
490
+ }
491
+ function createFieldOption(description, value, optionKeyString) {
492
+ return new _FormSpec.Shared_FieldOption(description, value, new _FormSpec.Shared_FieldOptionKey((0, _Guid.parse)(optionKeyString)));
493
+ }
494
+ function createMatrixField(fieldKeyString, label, items, options) {
495
+ return new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), label, undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_Matrix)(new _FormSpec.Spec_MatrixInfo((0, _List.ofSeq)(items), (0, _List.ofSeq)(options))));
496
+ }
497
+ function createPluginField(fieldKeyString, label, config) {
498
+ return new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), label, undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_PluginField)(new _FormSpec.Spec_PluginFieldConfig(config.pluginId, config.fieldName)));
499
+ }
500
+ function createActionState(stateKeyString, label, taskDescription, priority) {
501
+ return new _FormSpec.ClinicalPathway_StateDefinition(new _FormSpec.Shared_StateKey((0, _Guid.parse)(stateKeyString)), label, 1, (0, _FormSpec.ClinicalPathway_StateType_Action)((0, _FormSpec.ClinicalPathway_ActionInfo_Task)(new _FormSpec.ClinicalPathway_TaskAction("Clinical", taskDescription, priority != null ? (0, _Option.value)(priority) === "High" ? (0, _FormSpec.ClinicalPathway_TaskPriority_High)() : (0, _Option.value)(priority) === "Low" ? (0, _FormSpec.ClinicalPathway_TaskPriority_Low)() : (0, _FormSpec.ClinicalPathway_TaskPriority_Medium)() : (0, _FormSpec.ClinicalPathway_TaskPriority_Medium)(), (0, _FormSpec.ClinicalPathway_DueDate_Today)(), "Clinical Staff", undefined))), undefined);
502
+ }
503
+ function createTerminalState(stateKeyString, outcome) {
504
+ return new _FormSpec.ClinicalPathway_StateDefinition(new _FormSpec.Shared_StateKey((0, _Guid.parse)(stateKeyString)), outcome, 1, (0, _FormSpec.ClinicalPathway_StateType_Terminal)(new _FormSpec.ClinicalPathway_TerminalInfo("Complete", outcome, undefined)), undefined);
505
+ }
506
+ function createTransition(transitionKeyString, fromStateString, toStateString, fieldKeyString, expectedValue) {
507
+ return new _FormSpec.ClinicalPathway_TransitionDefinition(new _FormSpec.Shared_TransitionKey((0, _Guid.parse)(transitionKeyString)), new _FormSpec.Shared_StateKey((0, _Guid.parse)(fromStateString)), new _FormSpec.Shared_StateKey((0, _Guid.parse)(toStateString)), (0, _FormSpec.ClinicalPathway_TransitionCondition_FieldCondition)(new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString)), (0, _FormSpec.ClinicalPathway_FieldEvaluator_Equals)(), (0, _FormSpec.Shared_ConditionValue_Single)(expectedValue)), undefined);
508
+ }
509
+ function createClinicalPathway(name, states, transitions) {
510
+ let copyOfStruct;
511
+ const statesWithOrder = (0, _List.ofSeq)((0, _Seq.mapIndexed)((index, state)=>new _FormSpec.ClinicalPathway_StateDefinition(state.StateKey, state.StateLabel, index + 1, state.StateType, state.DependsOn), states));
512
+ return new _FormSpec.ClinicalPathway_ClinicalPathwaySpec((copyOfStruct = (0, _Guid.newGuid)(), copyOfStruct), name, "1.0.0", "Dynamic Builder", (0, _FormSpec.ClinicalPathway_PathwayExecutionMode_SinglePathway)(new _FormSpec.ClinicalPathway_SinglePathwayConfig((0, _FormSpec.ClinicalPathway_SelectionStrategy_HighestPriority)(), true)), new _FormSpec.Shared_StateKey("00000000-0000-0000-0000-000000000001"), statesWithOrder, (0, _List.ofSeq)(transitions), (0, _List.empty)(), (0, _List.empty)(), (0, _DateOffset.now)(), undefined, undefined, undefined);
513
+ }
514
+ function addPathwayToFormSpec(formSpec, pathway) {
515
+ return new _FormSpec.Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, formSpec.Steps, formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, pathway);
516
+ }
517
+ function getFieldDataFromFormResult(formData, stepOrder, fieldKeyString) {
518
+ const fieldKey = new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString));
519
+ const matchValue = (0, _Map.tryFind)(new _FormSpec.Values_StepOrder(stepOrder), formData.ResultSteps);
520
+ if (matchValue == null) {
521
+ return undefined;
522
+ } else {
523
+ const matchValue_1 = (0, _Map.tryFind)(fieldKey, (0, _Option.value)(matchValue));
524
+ if (matchValue_1 == null) {
525
+ return undefined;
526
+ } else {
527
+ const fieldDetails = (0, _Option.value)(matchValue_1);
528
+ return (0, _Option.some)({
529
+ FieldOrder: fieldDetails.FieldOrder,
530
+ FieldType: fieldDetails.FieldType,
531
+ FieldValue: fieldDetails.FieldValue,
532
+ Key: fieldKeyString,
533
+ Label: fieldDetails.Label
534
+ });
535
+ }
536
+ }
537
+ }
538
+ function getFormResultStepOrders(formData) {
539
+ const collection = (0, _Seq.map)((tupledArg)=>tupledArg[0].fields[0], (0, _Map.toSeq)(formData.ResultSteps));
540
+ return Array.from(collection);
541
+ }
542
+ function getFormResultFieldKeys(formData, stepOrder) {
543
+ const matchValue = (0, _Map.tryFind)(new _FormSpec.Values_StepOrder(stepOrder), formData.ResultSteps);
544
+ if (matchValue == null) {
545
+ return [];
546
+ } else {
547
+ const collection = (0, _Seq.map)((_arg)=>_arg.fields[0], (0, _Seq.map)((tuple)=>tuple[0], (0, _Map.toSeq)((0, _Option.value)(matchValue))));
548
+ return Array.from(collection);
549
+ }
550
+ }
551
+ function getResultSteps(formData) {
552
+ return formData.ResultSteps;
553
+ }
554
+ function getFieldValue(formData, stepOrder, fieldKeyString) {
555
+ const fieldKey = new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString));
556
+ const matchValue = (0, _Map.tryFind)(new _FormSpec.Values_StepOrder(stepOrder), formData.ResultSteps);
557
+ if (matchValue == null) {
558
+ return undefined;
559
+ } else {
560
+ const matchValue_1 = (0, _Map.tryFind)(fieldKey, (0, _Option.value)(matchValue));
561
+ if (matchValue_1 == null) {
562
+ return undefined;
563
+ } else {
564
+ return (0, _Option.some)((0, _Option.value)(matchValue_1).FieldValue);
565
+ }
566
+ }
567
+ }
568
+ function getFieldDetails(formData, stepOrder, fieldKeyString) {
569
+ const fieldKey = new _FormSpec.Shared_FieldKey((0, _Guid.parse)(fieldKeyString));
570
+ const matchValue = (0, _Map.tryFind)(new _FormSpec.Values_StepOrder(stepOrder), formData.ResultSteps);
571
+ if (matchValue == null) {
572
+ return undefined;
573
+ } else {
574
+ const matchValue_1 = (0, _Map.tryFind)(fieldKey, (0, _Option.value)(matchValue));
575
+ if (matchValue_1 == null) {
576
+ return undefined;
577
+ } else {
578
+ return (0, _Option.some)((0, _Option.value)(matchValue_1));
579
+ }
580
+ }
581
+ }
582
+ function createTestFormSpec() {
583
+ const option1 = new _FormSpec.Shared_FieldOption("Option 1", "opt1", new _FormSpec.Shared_FieldOptionKey((0, _Guid.newGuid)()));
584
+ const option2 = new _FormSpec.Shared_FieldOption("Option 2", "opt2", new _FormSpec.Shared_FieldOptionKey((0, _Guid.newGuid)()));
585
+ const testStep = new _FormSpec.Spec_FormStep$1(1, "Test Step", (0, _List.ofArray)([
586
+ new _FormSpec.Spec_FormField$1(1, new _FormSpec.Shared_FieldKey("11111111-1111-1111-1111-111111111111"), "Test Text Field", undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_Text)(new _FormSpec.Spec_TextInfo(undefined))),
587
+ new _FormSpec.Spec_FormField$1(2, new _FormSpec.Shared_FieldKey("22222222-2222-2222-2222-222222222222"), "Test Checkbox List", undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_CheckboxList)(new _FormSpec.Spec_MultiChoiceInfo((0, _List.ofArray)([
588
+ option1,
589
+ option2
590
+ ])))),
591
+ new _FormSpec.Spec_FormField$1(3, new _FormSpec.Shared_FieldKey("33333333-3333-3333-3333-333333333333"), "Test Matrix", undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_Matrix)(new _FormSpec.Spec_MatrixInfo((0, _List.ofArray)([
592
+ option1,
593
+ option2
594
+ ]), (0, _List.ofArray)([
595
+ new _FormSpec.Shared_FieldOption("Scale 1", "1", new _FormSpec.Shared_FieldOptionKey((0, _Guid.newGuid)())),
596
+ new _FormSpec.Shared_FieldOption("Scale 2", "2", new _FormSpec.Shared_FieldOptionKey((0, _Guid.newGuid)()))
597
+ ])))),
598
+ new _FormSpec.Spec_FormField$1(4, new _FormSpec.Shared_FieldKey("44444444-4444-4444-4444-444444444444"), "Test Plugin Field", undefined, undefined, false, false, (0, _FormSpec.Spec_FieldType_PluginField)(new _FormSpec.Spec_PluginFieldConfig("test.plugin", "Test Plugin")))
599
+ ]));
600
+ return new _FormSpec.Spec_FormSpec$1((0, _Guid.newGuid)(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", (0, _List.singleton)(testStep), (0, _List.empty)(), undefined, (0, _List.empty)(), false, false, undefined);
601
+ }
602
+ function initializePathwayExecution(formSpec, pathway, formData) {
603
+ try {
604
+ return (0, _PathwayExecutor.initializeExecution)(formSpec, formData);
605
+ } catch (ex) {
606
+ return {
607
+ ErrorMessage: ex.message,
608
+ ErrorType: "Exception",
609
+ IsError: true
610
+ };
611
+ }
612
+ }
613
+ function getFieldTypeInfo(field) {
614
+ let matchValue;
615
+ return {
616
+ isRequired: !field.IsOptional,
617
+ typeName: (matchValue = field.FieldType, matchValue.tag === /* TextArea */ 1 ? "TextArea" : matchValue.tag === /* Email */ 2 ? "Email" : matchValue.tag === /* Password */ 3 ? "Password" : matchValue.tag === /* Search */ 4 ? "Search" : matchValue.tag === /* Color */ 5 ? "Color" : matchValue.tag === /* Number */ 6 ? "Number" : matchValue.tag === /* Tel */ 7 ? "Tel" : matchValue.tag === /* Date */ 8 ? "Date" : matchValue.tag === /* DateTimeLocal */ 9 ? "DateTimeLocal" : matchValue.tag === /* Time */ 10 ? "Time" : matchValue.tag === /* Checkbox */ 11 ? "Checkbox" : matchValue.tag === /* Radio */ 12 ? "Radio" : matchValue.tag === /* SingleChoice */ 13 ? "SingleChoice" : matchValue.tag === /* Dropdown */ 14 ? "Dropdown" : matchValue.tag === /* TextAutoComplete */ 18 ? "TextAutoComplete" : matchValue.tag === /* MultiChoice */ 15 ? "MultiChoice" : matchValue.tag === /* CheckboxList */ 16 ? "CheckboxList" : matchValue.tag === /* TagList */ 17 ? "TagList" : matchValue.tag === /* Matrix */ 19 ? "Matrix" : matchValue.tag === /* Signature */ 20 ? "Signature" : matchValue.tag === /* Message */ 21 ? "Message" : matchValue.tag === /* PluginField */ 22 ? "PluginField" : "Text")
618
+ };
619
+ }
620
+ function getFieldChoiceOptions(field) {
621
+ let collection, collection_1, collection_2, collection_3, collection_4, collection_5, collection_6;
622
+ const matchValue = field.FieldType;
623
+ switch(matchValue.tag){
624
+ case /* Radio */ 12:
625
+ return collection = (0, _List.map)((opt)=>({
626
+ key: opt.OptionKey.fields[0],
627
+ label: opt.Description,
628
+ value: opt.Value
629
+ }), matchValue.fields[0].Options), Array.from(collection);
630
+ case /* SingleChoice */ 13:
631
+ return collection_1 = (0, _List.map)((opt_1)=>({
632
+ key: opt_1.OptionKey.fields[0],
633
+ label: opt_1.Description,
634
+ value: opt_1.Value
635
+ }), matchValue.fields[0].Options), Array.from(collection_1);
636
+ case /* Dropdown */ 14:
637
+ return collection_2 = (0, _List.map)((opt_2)=>({
638
+ key: opt_2.OptionKey.fields[0],
639
+ label: opt_2.Description,
640
+ value: opt_2.Value
641
+ }), matchValue.fields[0].Options), Array.from(collection_2);
642
+ case /* MultiChoice */ 15:
643
+ return collection_3 = (0, _List.map)((opt_3)=>({
644
+ key: opt_3.OptionKey.fields[0],
645
+ label: opt_3.Description,
646
+ value: opt_3.Value
647
+ }), matchValue.fields[0].Options), Array.from(collection_3);
648
+ case /* CheckboxList */ 16:
649
+ return collection_4 = (0, _List.map)((opt_4)=>({
650
+ key: opt_4.OptionKey.fields[0],
651
+ label: opt_4.Description,
652
+ value: opt_4.Value
653
+ }), matchValue.fields[0].Options), Array.from(collection_4);
654
+ case /* TagList */ 17:
655
+ return collection_5 = (0, _List.map)((opt_5)=>({
656
+ key: opt_5.OptionKey.fields[0],
657
+ label: opt_5.Description,
658
+ value: opt_5.Value
659
+ }), matchValue.fields[0].Options), Array.from(collection_5);
660
+ case /* TextAutoComplete */ 18:
661
+ return collection_6 = (0, _List.map)((opt_6)=>({
662
+ key: opt_6.OptionKey.fields[0],
663
+ label: opt_6.Description,
664
+ value: opt_6.Value
665
+ }), matchValue.fields[0].Options), Array.from(collection_6);
666
+ default:
667
+ return undefined;
668
+ }
669
+ }
670
+ function getFieldMatrixInfo(field) {
671
+ let collection, collection_1;
672
+ const matchValue = field.FieldType;
673
+ if (matchValue.tag === /* Matrix */ 19) {
674
+ const matrixInfo = matchValue.fields[0];
675
+ return {
676
+ items: (collection = (0, _List.map)((item)=>({
677
+ key: item.OptionKey.fields[0],
678
+ label: item.Description
679
+ }), matrixInfo.Items), Array.from(collection)),
680
+ options: (collection_1 = (0, _List.map)((opt)=>({
681
+ description: opt.Description,
682
+ key: opt.OptionKey.fields[0],
683
+ value: opt.Value
684
+ }), matrixInfo.Options), Array.from(collection_1))
685
+ };
686
+ } else {
687
+ return undefined;
688
+ }
689
+ }
690
+ function getFieldKeyString(fieldKey) {
691
+ return fieldKey.fields[0];
692
+ }
693
+ function convertActionInfo(action) {
694
+ let matchValue_1, matchValue_3, matchValue;
695
+ switch(action.tag){
696
+ case /* Referral */ 2:
697
+ {
698
+ const referral = action.fields[0];
699
+ return {
700
+ description: `Refer to ${referral.Target}`,
701
+ reason: referral.Reason,
702
+ type: "referral",
703
+ urgency: (matchValue_1 = referral.Urgency, matchValue_1.tag === /* Routine */ 1 ? `routine-${matchValue_1.fields[0]}` : matchValue_1.tag === /* AsNeeded */ 2 ? "asNeeded" : "immediate")
704
+ };
705
+ }
706
+ case /* Medication */ 0:
707
+ {
708
+ const med = action.fields[0];
709
+ return {
710
+ description: `${med.Name} - ${med.Dose} ${med.Route}`,
711
+ dose: med.Dose,
712
+ duration: med.Duration,
713
+ frequency: med.Frequency,
714
+ medicationName: med.Name,
715
+ route: med.Route,
716
+ type: "medication"
717
+ };
718
+ }
719
+ case /* Prescription */ 9:
720
+ {
721
+ const presc = action.fields[0];
722
+ return {
723
+ description: `${presc.Medication} - ${presc.Dose} ${presc.Route}`,
724
+ dose: presc.Dose,
725
+ duration: presc.Duration,
726
+ frequency: presc.Frequency,
727
+ medication: presc.Medication,
728
+ quantity: presc.Quantity,
729
+ route: presc.Route,
730
+ type: "prescription"
731
+ };
732
+ }
733
+ case /* SetFieldValue */ 10:
734
+ {
735
+ const setField = action.fields[0];
736
+ let valueStr;
737
+ const matchValue_2 = setField.Value;
738
+ valueStr = matchValue_2.tag === /* FieldReference */ 1 ? `Reference to ${matchValue_2.fields[0].fields[0]}` : matchValue_2.tag === /* OptionKey */ 2 ? `Option ${matchValue_2.fields[0].fields[0]}` : matchValue_2.fields[0];
739
+ const fieldGuid = setField.TargetField.fields[0];
740
+ return {
741
+ description: `Set field ${fieldGuid} to ${valueStr}`,
742
+ fieldKey: fieldGuid,
743
+ type: "setFieldValue",
744
+ value: valueStr
745
+ };
746
+ }
747
+ case /* Documentation */ 5:
748
+ {
749
+ const doc = action.fields[0];
750
+ return {
751
+ description: `Document: ${doc.FormName}`,
752
+ formName: doc.FormName,
753
+ purpose: doc.Purpose,
754
+ required: doc.Required,
755
+ type: "documentation"
756
+ };
757
+ }
758
+ case /* Test */ 1:
759
+ {
760
+ const test = action.fields[0];
761
+ return {
762
+ description: `${test.TestName} (${test.TestType})`,
763
+ testName: test.TestName,
764
+ testType: test.TestType,
765
+ type: "test"
766
+ };
767
+ }
768
+ case /* Procedure */ 4:
769
+ {
770
+ const proc = action.fields[0];
771
+ return {
772
+ description: `${proc.Name}: ${proc.Description}`,
773
+ procedureDescription: proc.Description,
774
+ procedureName: proc.Name,
775
+ type: "procedure"
776
+ };
777
+ }
778
+ case /* Education */ 3:
779
+ {
780
+ const edu = action.fields[0];
781
+ return {
782
+ description: `Education: ${(0, _String.join)(", ", edu.Topics)}`,
783
+ topics: edu.Topics,
784
+ type: "education"
785
+ };
786
+ }
787
+ case /* Alert */ 7:
788
+ {
789
+ const alert = action.fields[0];
790
+ return {
791
+ category: alert.Category,
792
+ description: alert.Message,
793
+ severity: (matchValue_3 = alert.Severity, matchValue_3.tag === /* High */ 2 ? "high" : matchValue_3.tag === /* Medium */ 1 ? "medium" : matchValue_3.tag === /* Low */ 0 ? "low" : "critical"),
794
+ type: "alert"
795
+ };
796
+ }
797
+ case /* Problem */ 8:
798
+ {
799
+ const prob = action.fields[0];
800
+ return {
801
+ description: `${prob.ProblemName}${(0, _Option.defaultArg)((0, _Option.map)((code)=>` (ICD: ${code})`, prob.IcdCode), "")}`,
802
+ icdCode: (0, _Option.unwrap)(prob.IcdCode),
803
+ problemName: prob.ProblemName,
804
+ type: "problem"
805
+ };
806
+ }
807
+ case /* NavigateToForm */ 11:
808
+ {
809
+ const nav = action.fields[0];
810
+ const formCode = (0, _Option.defaultArg)(nav.FormCode, nav.FormId);
811
+ return {
812
+ description: `Navigate to form: ${formCode}`,
813
+ formCode: formCode,
814
+ type: "navigateToForm"
815
+ };
816
+ }
817
+ default:
818
+ {
819
+ const task = action.fields[0];
820
+ return {
821
+ category: task.Category,
822
+ description: task.Description,
823
+ priority: (matchValue = task.Priority, matchValue.tag === /* Medium */ 1 ? "medium" : matchValue.tag === /* Low */ 2 ? "low" : "high"),
824
+ type: "task"
825
+ };
826
+ }
827
+ }
828
+ }
829
+ function stateKeyForAction(pathway, action) {
830
+ (0, _String.toConsole)((0, _String.printf)("PathwayId: %A"))(pathway.PathwayId);
831
+ (0, _String.toConsole)((0, _String.printf)("Finding state key for action: %A"))(action);
832
+ return (0, _List.tryPick)((state)=>{
833
+ const matchValue = state.StateType;
834
+ let matchResult, actionInfo_1;
835
+ if (matchValue.tag === /* Action */ 2) {
836
+ if ((0, _Util.equals)(matchValue.fields[0], action)) {
837
+ matchResult = 0;
838
+ actionInfo_1 = matchValue.fields[0];
839
+ } else {
840
+ matchResult = 1;
841
+ }
842
+ } else {
843
+ matchResult = 1;
844
+ }
845
+ switch(matchResult){
846
+ case 0:
847
+ return state.StateKey.fields[0];
848
+ default:
849
+ return undefined;
850
+ }
851
+ }, pathway.States);
852
+ } //# sourceMappingURL=FormSpec.Api.Helpers.ts.map
853
+
854
+ //# sourceMappingURL=FormSpec.Api.Helpers.js.map