@f1studio/form-spec 5.0.0-alpha.139 → 5.0.0-alpha.141

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 (202) hide show
  1. package/FormSpec.FS/FormSpec.d.ts +5 -4
  2. package/FormSpec.FS/FormSpec.d.ts.map +1 -1
  3. package/FormSpec.FS/FormSpecValues.d.ts +0 -5
  4. package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
  5. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +3 -2
  6. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
  7. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
  8. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  9. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
  10. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
  11. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts +74 -0
  12. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts.map +1 -0
  13. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts +106 -0
  14. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts.map +1 -0
  15. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts +105 -0
  16. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts.map +1 -0
  17. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +26 -13
  18. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  19. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +1 -2
  20. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  21. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts +5 -3
  22. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
  24. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  25. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
  27. package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
  28. package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
  29. package/FormSpec.TS/FormSpec.FS/FormSpec.js +13 -8
  30. package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
  31. package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
  32. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +5 -5
  33. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  34. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  35. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -21
  36. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
  37. package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
  38. package/FormSpec.TS/FormSpec.FS/Helpers.js +12 -12
  39. package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
  40. package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
  41. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +36 -30
  42. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
  43. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
  44. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +5 -20
  45. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
  46. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
  47. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -1
  48. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
  49. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -1
  50. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
  51. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  52. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  53. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +24 -10
  54. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  55. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  56. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +1 -1
  57. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  58. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  59. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +2 -2
  60. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +1 -1
  61. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
  62. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  63. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js +282 -0
  64. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js.map +1 -0
  65. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts.map +1 -0
  66. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js +184 -0
  67. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js.map +1 -0
  68. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts.map +1 -0
  69. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js +752 -0
  70. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -0
  71. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -0
  72. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +317 -81
  73. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  74. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  75. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +5 -10
  76. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  77. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  78. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +20 -10
  79. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  80. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  81. package/FormSpec.TS/FormSpec.FS/Migrator.js +1 -1
  82. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  83. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  84. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +3 -3
  85. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  86. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  87. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js +1 -1
  88. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js.map +1 -1
  89. package/FormSpec.TS/FormSpec.FS/PathwayValidator.ts.map +1 -1
  90. package/FormSpec.TS/PluginRegistration.js +2 -0
  91. package/FormSpec.TS/PluginRegistration.js.map +1 -1
  92. package/FormSpec.TS/PluginRegistration.ts.map +1 -1
  93. package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.js +63 -69
  94. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
  95. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
  96. package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.js +6 -10
  97. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
  98. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
  99. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
  100. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
  101. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
  102. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
  103. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
  104. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +119 -0
  105. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
  106. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.ts.map +1 -0
  107. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
  108. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
  109. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +165 -0
  110. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
  111. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.ts.map +1 -0
  112. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
  113. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +32 -0
  114. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
  115. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.ts.map +1 -0
  116. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.js.map +1 -1
  117. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.ts.map +1 -1
  118. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  119. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js +2431 -0
  120. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -0
  121. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.ts.map +1 -0
  122. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js +107 -0
  123. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js.map +1 -0
  124. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.ts.map +1 -0
  125. package/FormSpec.TS/plugins/signature/src/SignatureField.js +1 -1
  126. package/FormSpec.TS/plugins/signature/src/SignatureField.js.map +1 -1
  127. package/FormSpec.TS/plugins/signature/src/SignatureField.ts.map +1 -1
  128. package/FormSpec.TS/plugins/vitals/src/VitalsField.js +29 -312
  129. package/FormSpec.TS/plugins/vitals/src/VitalsField.js.map +1 -1
  130. package/FormSpec.TS/plugins/vitals/src/VitalsField.ts.map +1 -1
  131. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js +506 -0
  132. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js.map +1 -0
  133. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.ts.map +1 -0
  134. package/README.md +7 -7
  135. package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.d.ts +2 -2
  136. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
  137. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
  138. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
  139. package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
  140. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts +112 -0
  141. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts.map +1 -0
  142. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts +8 -0
  143. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts.map +1 -0
  144. package/package.json +9 -1
  145. package/plugins/allergyfinder/src/AllergyFinderField.d.ts +116 -0
  146. package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -0
  147. package/plugins/allergyfinder/src/OpenFdaClient.d.ts +5 -0
  148. package/plugins/allergyfinder/src/OpenFdaClient.d.ts.map +1 -0
  149. package/plugins/vitals/src/VitalsField.d.ts +4 -43
  150. package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
  151. package/plugins/vitals/src/VitalsLogic.d.ts +72 -0
  152. package/plugins/vitals/src/VitalsLogic.d.ts.map +1 -0
  153. package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
  154. package/src/FormSpec.FS/Designer.ts +1 -1
  155. package/src/FormSpec.FS/FormSpec.ts +10 -8
  156. package/src/FormSpec.FS/FormSpecHelpers.ts +5 -5
  157. package/src/FormSpec.FS/FormSpecValues.ts +2 -25
  158. package/src/FormSpec.FS/Helpers.ts +12 -12
  159. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +35 -32
  160. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +6 -23
  161. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -1
  162. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
  163. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +27 -11
  164. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +1 -1
  165. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
  166. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +3 -3
  167. package/src/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts +160 -0
  168. package/src/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts +244 -0
  169. package/src/FormSpec.FS/Interop/Facade/FormAnswersGate.ts +508 -0
  170. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +376 -128
  171. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -8
  172. package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +17 -13
  173. package/src/FormSpec.FS/Migrator.ts +1 -1
  174. package/src/FormSpec.FS/PathwayExecutor.ts +3 -3
  175. package/src/FormSpec.FS/PathwayValidator.ts +1 -1
  176. package/src/PluginRegistration.ts +2 -0
  177. package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.ts +38 -55
  178. package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.ts +10 -16
  179. package/src/plugins/allergyfinder/src/AllergyFinderField.ts +1341 -0
  180. package/src/plugins/allergyfinder/src/OpenFdaClient.ts +103 -0
  181. package/src/plugins/signature/src/SignatureField.ts +1 -1
  182. package/src/plugins/vitals/src/VitalsField.ts +35 -244
  183. package/src/plugins/vitals/src/VitalsLogic.ts +360 -0
  184. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.js.map +0 -1
  185. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.ts.map +0 -1
  186. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.js.map +0 -1
  187. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.ts.map +0 -1
  188. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.js.map +0 -1
  189. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.ts.map +0 -1
  190. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.js.map +0 -1
  191. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.ts.map +0 -1
  192. package/libs/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +0 -1
  193. package/libs/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +0 -1
  194. package/libs/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +0 -1
  195. package/libs/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +0 -1
  196. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.js +0 -0
  197. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.js +0 -0
  198. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.d.ts +0 -0
  199. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.d.ts +0 -0
  200. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.d.ts +0 -0
  201. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.ts +0 -0
  202. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.ts +0 -0
@@ -0,0 +1,752 @@
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 Decoders_fieldAnswerDecoder () {
13
+ return Decoders_fieldAnswerDecoder;
14
+ },
15
+ get Decoders_fieldKeyDecoder () {
16
+ return Decoders_fieldKeyDecoder;
17
+ },
18
+ get Decoders_fieldValueDecoder () {
19
+ return Decoders_fieldValueDecoder;
20
+ },
21
+ get Decoders_formAnswersDecoder () {
22
+ return Decoders_formAnswersDecoder;
23
+ },
24
+ get Decoders_guidDecoder () {
25
+ return Decoders_guidDecoder;
26
+ },
27
+ get Decoders_matrixDecoder () {
28
+ return Decoders_matrixDecoder;
29
+ },
30
+ get Decoders_matrixItemKeyDecoder () {
31
+ return Decoders_matrixItemKeyDecoder;
32
+ },
33
+ get Decoders_multipleDecoder () {
34
+ return Decoders_multipleDecoder;
35
+ },
36
+ get Decoders_pluginDataDecoder () {
37
+ return Decoders_pluginDataDecoder;
38
+ },
39
+ get Decoders_pluginDataPropertyDecoder () {
40
+ return Decoders_pluginDataPropertyDecoder;
41
+ },
42
+ get Decoders_pluginDataTypeDecoder () {
43
+ return Decoders_pluginDataTypeDecoder;
44
+ },
45
+ get Decoders_pluginPropertyKeyDecoder () {
46
+ return Decoders_pluginPropertyKeyDecoder;
47
+ },
48
+ get Decoders_singleDecoder () {
49
+ return Decoders_singleDecoder;
50
+ },
51
+ get Decoders_validKinds () {
52
+ return Decoders_validKinds;
53
+ },
54
+ get Decoders_validPluginDataTypes () {
55
+ return Decoders_validPluginDataTypes;
56
+ },
57
+ get GateResult_bind () {
58
+ return GateResult_bind;
59
+ },
60
+ get GateResult_collect () {
61
+ return GateResult_collect;
62
+ },
63
+ get GateResult_map () {
64
+ return GateResult_map;
65
+ },
66
+ get Rejection () {
67
+ return Rejection;
68
+ },
69
+ get RejectionPath () {
70
+ return RejectionPath;
71
+ },
72
+ get RejectionPath_$reflection () {
73
+ return RejectionPath_$reflection;
74
+ },
75
+ get RejectionPath_AtField () {
76
+ return RejectionPath_AtField;
77
+ },
78
+ get RejectionPath_AtIndex () {
79
+ return RejectionPath_AtIndex;
80
+ },
81
+ get RejectionPath_Nested () {
82
+ return RejectionPath_Nested;
83
+ },
84
+ get RejectionPath_Root () {
85
+ return RejectionPath_Root;
86
+ },
87
+ get RejectionReason () {
88
+ return RejectionReason;
89
+ },
90
+ get RejectionReason_$reflection () {
91
+ return RejectionReason_$reflection;
92
+ },
93
+ get RejectionReason_DuplicateKeys () {
94
+ return RejectionReason_DuplicateKeys;
95
+ },
96
+ get RejectionReason_EmptyWhenRequired () {
97
+ return RejectionReason_EmptyWhenRequired;
98
+ },
99
+ get RejectionReason_InvalidGuid () {
100
+ return RejectionReason_InvalidGuid;
101
+ },
102
+ get RejectionReason_InvalidPluginDataType () {
103
+ return RejectionReason_InvalidPluginDataType;
104
+ },
105
+ get RejectionReason_MissingField () {
106
+ return RejectionReason_MissingField;
107
+ },
108
+ get RejectionReason_MultipleErrors () {
109
+ return RejectionReason_MultipleErrors;
110
+ },
111
+ get RejectionReason_NotJson () {
112
+ return RejectionReason_NotJson;
113
+ },
114
+ get RejectionReason_UnknownKind () {
115
+ return RejectionReason_UnknownKind;
116
+ },
117
+ get RejectionReason_WrongType () {
118
+ return RejectionReason_WrongType;
119
+ },
120
+ get Rejection_$reflection () {
121
+ return Rejection_$reflection;
122
+ },
123
+ get Rejection_Create_7FA655F1 () {
124
+ return Rejection_Create_7FA655F1;
125
+ },
126
+ get formatPath () {
127
+ return formatPath;
128
+ },
129
+ get formatReason () {
130
+ return formatReason;
131
+ },
132
+ get formatRejection () {
133
+ return formatRejection;
134
+ },
135
+ get gateFieldKey () {
136
+ return gateFieldKey;
137
+ },
138
+ get gateFieldValue () {
139
+ return gateFieldValue;
140
+ },
141
+ get gateFormAnswers () {
142
+ return gateFormAnswers;
143
+ },
144
+ get tryDecodeFieldValueFromObject () {
145
+ return tryDecodeFieldValueFromObject;
146
+ }
147
+ });
148
+ const _Types = require("@fable-org/fable-library-js/Types.js");
149
+ const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
150
+ const _List = require("@fable-org/fable-library-js/List.js");
151
+ const _Option = require("@fable-org/fable-library-js/Option.js");
152
+ const _Util = require("@fable-org/fable-library-js/Util.js");
153
+ const _String = require("@fable-org/fable-library-js/String.js");
154
+ const _Result = require("@fable-org/fable-library-js/Result.js");
155
+ const _Decode = require("../../../Thoth.Json/packages/Thoth.Json/Decode.js");
156
+ const _Guid = require("@fable-org/fable-library-js/Guid.js");
157
+ const _FormSpec = require("../../FormSpec.js");
158
+ const _Set = require("@fable-org/fable-library-js/Set.js");
159
+ const _Map = require("@fable-org/fable-library-js/Map.js");
160
+ const _Encode = require("../../../Thoth.Json/packages/Thoth.Json/Encode.js");
161
+ function RejectionPath_Root() {
162
+ return new RejectionPath(0, []);
163
+ }
164
+ function RejectionPath_AtField(Item) {
165
+ return new RejectionPath(1, [
166
+ Item
167
+ ]);
168
+ }
169
+ function RejectionPath_AtIndex(Item) {
170
+ return new RejectionPath(2, [
171
+ Item
172
+ ]);
173
+ }
174
+ function RejectionPath_Nested(Item1, Item2) {
175
+ return new RejectionPath(3, [
176
+ Item1,
177
+ Item2
178
+ ]);
179
+ }
180
+ class RejectionPath extends _Types.Union {
181
+ cases() {
182
+ return [
183
+ "Root",
184
+ "AtField",
185
+ "AtIndex",
186
+ "Nested"
187
+ ];
188
+ }
189
+ constructor(tag, fields){
190
+ super(), this.tag = tag, this.fields = fields;
191
+ }
192
+ }
193
+ function RejectionPath_$reflection() {
194
+ return (0, _Reflection.union_type)("FormSpec.Interop.FormAnswersGate.RejectionPath", [], RejectionPath, ()=>[
195
+ [],
196
+ [
197
+ [
198
+ "Item",
199
+ _Reflection.string_type
200
+ ]
201
+ ],
202
+ [
203
+ [
204
+ "Item",
205
+ _Reflection.int32_type
206
+ ]
207
+ ],
208
+ [
209
+ [
210
+ "Item1",
211
+ RejectionPath_$reflection()
212
+ ],
213
+ [
214
+ "Item2",
215
+ RejectionPath_$reflection()
216
+ ]
217
+ ]
218
+ ]);
219
+ }
220
+ function RejectionReason_NotJson(parseError) {
221
+ return new RejectionReason(0, [
222
+ parseError
223
+ ]);
224
+ }
225
+ function RejectionReason_MissingField(fieldName) {
226
+ return new RejectionReason(1, [
227
+ fieldName
228
+ ]);
229
+ }
230
+ function RejectionReason_WrongType(fieldName, expected, actual) {
231
+ return new RejectionReason(2, [
232
+ fieldName,
233
+ expected,
234
+ actual
235
+ ]);
236
+ }
237
+ function RejectionReason_InvalidGuid(fieldName, raw) {
238
+ return new RejectionReason(3, [
239
+ fieldName,
240
+ raw
241
+ ]);
242
+ }
243
+ function RejectionReason_UnknownKind(got, expected) {
244
+ return new RejectionReason(4, [
245
+ got,
246
+ expected
247
+ ]);
248
+ }
249
+ function RejectionReason_InvalidPluginDataType(got, expected) {
250
+ return new RejectionReason(5, [
251
+ got,
252
+ expected
253
+ ]);
254
+ }
255
+ function RejectionReason_EmptyWhenRequired(fieldName) {
256
+ return new RejectionReason(6, [
257
+ fieldName
258
+ ]);
259
+ }
260
+ function RejectionReason_DuplicateKeys(fieldName, duplicates) {
261
+ return new RejectionReason(7, [
262
+ fieldName,
263
+ duplicates
264
+ ]);
265
+ }
266
+ function RejectionReason_MultipleErrors(Item) {
267
+ return new RejectionReason(8, [
268
+ Item
269
+ ]);
270
+ }
271
+ class RejectionReason extends _Types.Union {
272
+ cases() {
273
+ return [
274
+ "NotJson",
275
+ "MissingField",
276
+ "WrongType",
277
+ "InvalidGuid",
278
+ "UnknownKind",
279
+ "InvalidPluginDataType",
280
+ "EmptyWhenRequired",
281
+ "DuplicateKeys",
282
+ "MultipleErrors"
283
+ ];
284
+ }
285
+ constructor(tag, fields){
286
+ super(), this.tag = tag, this.fields = fields;
287
+ }
288
+ }
289
+ function RejectionReason_$reflection() {
290
+ return (0, _Reflection.union_type)("FormSpec.Interop.FormAnswersGate.RejectionReason", [], RejectionReason, ()=>[
291
+ [
292
+ [
293
+ "parseError",
294
+ _Reflection.string_type
295
+ ]
296
+ ],
297
+ [
298
+ [
299
+ "fieldName",
300
+ _Reflection.string_type
301
+ ]
302
+ ],
303
+ [
304
+ [
305
+ "fieldName",
306
+ _Reflection.string_type
307
+ ],
308
+ [
309
+ "expected",
310
+ _Reflection.string_type
311
+ ],
312
+ [
313
+ "actual",
314
+ _Reflection.string_type
315
+ ]
316
+ ],
317
+ [
318
+ [
319
+ "fieldName",
320
+ _Reflection.string_type
321
+ ],
322
+ [
323
+ "raw",
324
+ _Reflection.string_type
325
+ ]
326
+ ],
327
+ [
328
+ [
329
+ "got",
330
+ _Reflection.string_type
331
+ ],
332
+ [
333
+ "expected",
334
+ (0, _Reflection.list_type)(_Reflection.string_type)
335
+ ]
336
+ ],
337
+ [
338
+ [
339
+ "got",
340
+ _Reflection.string_type
341
+ ],
342
+ [
343
+ "expected",
344
+ (0, _Reflection.list_type)(_Reflection.string_type)
345
+ ]
346
+ ],
347
+ [
348
+ [
349
+ "fieldName",
350
+ _Reflection.string_type
351
+ ]
352
+ ],
353
+ [
354
+ [
355
+ "fieldName",
356
+ _Reflection.string_type
357
+ ],
358
+ [
359
+ "duplicates",
360
+ (0, _Reflection.list_type)(_Reflection.string_type)
361
+ ]
362
+ ],
363
+ [
364
+ [
365
+ "Item",
366
+ (0, _Reflection.list_type)(RejectionReason_$reflection())
367
+ ]
368
+ ]
369
+ ]);
370
+ }
371
+ class Rejection extends _Types.Record {
372
+ constructor(Path, Reason, RawFragment){
373
+ super();
374
+ this.Path = Path;
375
+ this.Reason = Reason;
376
+ this.RawFragment = RawFragment;
377
+ }
378
+ }
379
+ function Rejection_$reflection() {
380
+ return (0, _Reflection.record_type)("FormSpec.Interop.FormAnswersGate.Rejection", [], Rejection, ()=>[
381
+ [
382
+ "Path",
383
+ RejectionPath_$reflection()
384
+ ],
385
+ [
386
+ "Reason",
387
+ RejectionReason_$reflection()
388
+ ],
389
+ [
390
+ "RawFragment",
391
+ (0, _Reflection.option_type)(_Reflection.string_type)
392
+ ]
393
+ ]);
394
+ }
395
+ function Rejection_Create_7FA655F1(path, reason, raw) {
396
+ return new Rejection(path, reason, raw);
397
+ }
398
+ function formatRejection(r) {
399
+ const pathStr = formatPath(r.Path);
400
+ const reasonStr = formatReason(r.Reason);
401
+ const rawStr = (0, _Option.defaultArg)((0, _Option.map)((s)=>{
402
+ const truncated = s.length > 80 ? s.slice(undefined, 79 + 1) + "…" : s;
403
+ return (0, _String.toText)((0, _String.printf)(" | raw: %s"))(truncated);
404
+ }, r.RawFragment), "");
405
+ return (0, _String.toText)((0, _String.printf)("[%s] %s%s"))(pathStr)(reasonStr)(rawStr);
406
+ }
407
+ function formatPath(p) {
408
+ switch(p.tag){
409
+ case /* AtField */ 1:
410
+ {
411
+ const f = p.fields[0];
412
+ return (0, _String.toText)((0, _String.printf)(".%s"))(f);
413
+ }
414
+ case /* AtIndex */ 2:
415
+ {
416
+ const i = p.fields[0] | 0;
417
+ return (0, _String.toText)((0, _String.printf)("[%d]"))(i);
418
+ }
419
+ case /* Nested */ 3:
420
+ {
421
+ const child = p.fields[1];
422
+ const arg_2 = formatPath(p.fields[0]);
423
+ const arg_3 = formatPath(child);
424
+ return (0, _String.toText)((0, _String.printf)("%s%s"))(arg_2)(arg_3);
425
+ }
426
+ default:
427
+ return "$";
428
+ }
429
+ }
430
+ function formatReason(r) {
431
+ switch(r.tag){
432
+ case /* MissingField */ 1:
433
+ {
434
+ const f = r.fields[0];
435
+ return (0, _String.toText)((0, _String.printf)("Missing required field \'%s\'"))(f);
436
+ }
437
+ case /* WrongType */ 2:
438
+ {
439
+ const f_1 = r.fields[0];
440
+ const expected = r.fields[1];
441
+ const actual = r.fields[2];
442
+ return (0, _String.toText)((0, _String.printf)("Field \'%s\' expected %s, got %s"))(f_1)(expected)(actual);
443
+ }
444
+ case /* InvalidGuid */ 3:
445
+ {
446
+ const raw = r.fields[1];
447
+ const f_2 = r.fields[0];
448
+ return (0, _String.toText)((0, _String.printf)("Field \'%s\' is not a valid GUID: \'%s\'"))(f_2)(raw);
449
+ }
450
+ case /* UnknownKind */ 4:
451
+ {
452
+ const got = r.fields[0];
453
+ const arg_8 = (0, _String.join)(", ", r.fields[1]);
454
+ return (0, _String.toText)((0, _String.printf)("Unknown kind \'%s\', expected one of: %s"))(got)(arg_8);
455
+ }
456
+ case /* InvalidPluginDataType */ 5:
457
+ {
458
+ const got_1 = r.fields[0];
459
+ const arg_10 = (0, _String.join)(", ", r.fields[1]);
460
+ return (0, _String.toText)((0, _String.printf)("Unknown dataType \'%s\', expected one of: %s"))(got_1)(arg_10);
461
+ }
462
+ case /* EmptyWhenRequired */ 6:
463
+ {
464
+ const f_3 = r.fields[0];
465
+ return (0, _String.toText)((0, _String.printf)("Field \'%s\' is empty/whitespace but required at this level"))(f_3);
466
+ }
467
+ case /* DuplicateKeys */ 7:
468
+ {
469
+ const f_4 = r.fields[0];
470
+ const arg_13 = (0, _String.join)(", ", r.fields[1]);
471
+ return (0, _String.toText)((0, _String.printf)("Duplicate keys in \'%s\': %s"))(f_4)(arg_13);
472
+ }
473
+ case /* MultipleErrors */ 8:
474
+ return (0, _String.join)("; ", (0, _List.map)(formatReason, r.fields[0]));
475
+ default:
476
+ {
477
+ const e = r.fields[0];
478
+ return (0, _String.toText)((0, _String.printf)("Not valid JSON: %s"))(e);
479
+ }
480
+ }
481
+ }
482
+ function GateResult_map(f, r) {
483
+ return (0, _Result.Result_Map)(f, r);
484
+ }
485
+ function GateResult_bind(f, r) {
486
+ if (r.tag === /* Error */ 1) {
487
+ return (0, _Result.FSharpResult$2_Error)(r.fields[0]);
488
+ } else {
489
+ return f(r.fields[0]);
490
+ }
491
+ }
492
+ function GateResult_collect(results) {
493
+ const patternInput = (0, _List.fold)((tupledArg, r)=>{
494
+ const oks = tupledArg[0];
495
+ const errs = tupledArg[1];
496
+ if (r.tag === /* Error */ 1) {
497
+ return [
498
+ oks,
499
+ (0, _List.append)(r.fields[0], errs)
500
+ ];
501
+ } else {
502
+ return [
503
+ (0, _List.cons)(r.fields[0], oks),
504
+ errs
505
+ ];
506
+ }
507
+ }, [
508
+ (0, _List.empty)(),
509
+ (0, _List.empty)()
510
+ ], results);
511
+ const errs_1 = patternInput[1];
512
+ if ((0, _List.isEmpty)(errs_1)) {
513
+ return (0, _Result.FSharpResult$2_Ok)((0, _List.reverse)(patternInput[0]));
514
+ } else {
515
+ return (0, _Result.FSharpResult$2_Error)(errs_1);
516
+ }
517
+ }
518
+ const Decoders_validKinds = (0, _List.ofArray)([
519
+ "single",
520
+ "multiple",
521
+ "matrix",
522
+ "pluginData"
523
+ ]);
524
+ const Decoders_validPluginDataTypes = (0, _List.ofArray)([
525
+ "string",
526
+ "int",
527
+ "float",
528
+ "bool",
529
+ "datetime"
530
+ ]);
531
+ function Decoders_guidDecoder(fieldName) {
532
+ return (path_2)=>(value_1)=>(0, _Decode.andThen)((0, _Util.uncurry3)((raw)=>{
533
+ let matchValue;
534
+ let outArg = "00000000-0000-0000-0000-000000000000";
535
+ matchValue = [
536
+ (0, _Guid.tryParse)(raw, new _Types.FSharpRef(()=>outArg, (v)=>{
537
+ outArg = v;
538
+ })),
539
+ outArg
540
+ ];
541
+ if (matchValue[0]) {
542
+ return (arg10$0040)=>(arg20$0040)=>(0, _Decode.succeed)(matchValue[1], arg10$0040, arg20$0040);
543
+ } else {
544
+ const msg = (0, _String.toText)((0, _String.printf)("\'%s\' is not a valid GUID: \'%s\'"))(fieldName)(raw);
545
+ return (path_1)=>(arg20$0040_1)=>(0, _Decode.fail)(msg, path_1, arg20$0040_1);
546
+ }
547
+ }), _Decode.string, path_2, value_1);
548
+ }
549
+ const Decoders_fieldKeyDecoder = (()=>{
550
+ const d = Decoders_guidDecoder("fieldKey");
551
+ return (path)=>(value)=>(0, _Decode.map)((Item)=>new _FormSpec.Shared_FieldKey(Item), (0, _Util.uncurry2)(d), path, value);
552
+ })();
553
+ const Decoders_matrixItemKeyDecoder = (()=>{
554
+ const d = Decoders_guidDecoder("matrixItemKey");
555
+ return (path)=>(value)=>(0, _Decode.map)((Item)=>new _FormSpec.Shared_MatrixItemKey(Item), (0, _Util.uncurry2)(d), path, value);
556
+ })();
557
+ const Decoders_pluginPropertyKeyDecoder = (()=>{
558
+ const d = Decoders_guidDecoder("propertyKey");
559
+ return (path)=>(value)=>(0, _Decode.map)((Item)=>new _FormSpec.Shared_PluginPropertyKey(Item), (0, _Util.uncurry2)(d), path, value);
560
+ })();
561
+ const Decoders_pluginDataTypeDecoder = (path_2)=>(value_1)=>(0, _Decode.andThen)((0, _Util.uncurry3)((raw)=>{
562
+ if ((0, _List.contains)(raw, Decoders_validPluginDataTypes, {
563
+ Equals: (x, y)=>x === y,
564
+ GetHashCode: _Util.stringHash
565
+ })) {
566
+ return (arg10$0040)=>(arg20$0040)=>(0, _Decode.succeed)(raw, arg10$0040, arg20$0040);
567
+ } else {
568
+ let msg;
569
+ const arg_1 = (0, _String.join)(", ", Decoders_validPluginDataTypes);
570
+ msg = (0, _String.toText)((0, _String.printf)("Unknown dataType \'%s\', expected one of: %s"))(raw)(arg_1);
571
+ return (path_1)=>(arg20$0040_1)=>(0, _Decode.fail)(msg, path_1, arg20$0040_1);
572
+ }
573
+ }), _Decode.string, path_2, value_1);
574
+ const Decoders_singleDecoder = (path_3)=>(v)=>(0, _Decode.object)((get$)=>{
575
+ let objectArg, objectArg_1, objectArg_2, objectArg_3;
576
+ return new _FormSpec.Shared_FieldAnswer((objectArg = get$.Required, objectArg.Field("fieldKey", (0, _Util.uncurry2)(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field("description", _Decode.string)), (objectArg_2 = get$.Required, objectArg_2.Field("value", _Decode.string)), (objectArg_3 = get$.Optional, objectArg_3.Field("documentation", _Decode.string)));
577
+ }, path_3, v);
578
+ const Decoders_fieldAnswerDecoder = (path_3)=>(v)=>(0, _Decode.object)((get$)=>{
579
+ let objectArg, objectArg_1, objectArg_2, objectArg_3;
580
+ return new _FormSpec.Shared_FieldAnswer((objectArg = get$.Required, objectArg.Field("fieldKey", (0, _Util.uncurry2)(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field("description", _Decode.string)), (objectArg_2 = get$.Required, objectArg_2.Field("value", _Decode.string)), (objectArg_3 = get$.Optional, objectArg_3.Field("documentation", _Decode.string)));
581
+ }, path_3, v);
582
+ const Decoders_multipleDecoder = (path_1)=>(v)=>(0, _Decode.object)((get$)=>{
583
+ let objectArg, objectArg_1;
584
+ return [
585
+ (objectArg = get$.Required, objectArg.Field("fieldKey", (0, _Util.uncurry2)(Decoders_fieldKeyDecoder))),
586
+ (0, _Set.ofArray)((objectArg_1 = get$.Required, objectArg_1.Field("values", (path, value)=>(0, _Decode.array)((0, _Util.uncurry2)(Decoders_fieldAnswerDecoder), path, value))), {
587
+ Compare: _Util.compare
588
+ })
589
+ ];
590
+ }, path_1, v);
591
+ const Decoders_matrixDecoder = (path_6)=>(v_2)=>(0, _Decode.object)((get$)=>{
592
+ let objectArg, objectArg_1, objectArg_2, objectArg_3;
593
+ return new _FormSpec.Shared_MatrixAnswer((objectArg = get$.Required, objectArg.Field("fieldKey", (0, _Util.uncurry2)(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field("description", _Decode.string)), (objectArg_2 = get$.Required, objectArg_2.Field("values", (path_4, value_3)=>(0, _Decode.andThen)((0, _Util.uncurry3)((pairs)=>{
594
+ const parsed = (0, _List.map)((tupledArg)=>{
595
+ const k = tupledArg[0];
596
+ let matchValue;
597
+ let outArg = "00000000-0000-0000-0000-000000000000";
598
+ matchValue = [
599
+ (0, _Guid.tryParse)(k, new _Types.FSharpRef(()=>outArg, (v_1)=>{
600
+ outArg = v_1;
601
+ })),
602
+ outArg
603
+ ];
604
+ if (matchValue[0]) {
605
+ return (0, _Result.FSharpResult$2_Ok)([
606
+ new _FormSpec.Shared_MatrixItemKey(matchValue[1]),
607
+ tupledArg[1]
608
+ ]);
609
+ } else {
610
+ return (0, _Result.FSharpResult$2_Error)((0, _String.toText)((0, _String.printf)("Matrix key \'%s\' is not a valid GUID"))(k));
611
+ }
612
+ }, pairs);
613
+ const errors = (0, _List.choose)((_arg)=>{
614
+ if (_arg.tag === /* Error */ 1) {
615
+ return _arg.fields[0];
616
+ } else {
617
+ return undefined;
618
+ }
619
+ }, parsed);
620
+ if ((0, _List.isEmpty)(errors)) {
621
+ const output = (0, _Map.ofList)((0, _List.choose)((_arg_1)=>{
622
+ if (_arg_1.tag === /* Ok */ 0) {
623
+ return _arg_1.fields[0];
624
+ } else {
625
+ return undefined;
626
+ }
627
+ }, parsed), {
628
+ Compare: _Util.compare
629
+ });
630
+ return (arg10$0040)=>(arg20$0040)=>(0, _Decode.succeed)(output, arg10$0040, arg20$0040);
631
+ } else {
632
+ const msg = (0, _String.join)("; ", errors);
633
+ return (path_3)=>(arg20$0040_1)=>(0, _Decode.fail)(msg, path_3, arg20$0040_1);
634
+ }
635
+ }), (path_2, value_2)=>(0, _Decode.keyValuePairs)(_Decode.string, path_2, value_2), path_4, value_3))), (objectArg_3 = get$.Optional, objectArg_3.Field("documentation", _Decode.string)));
636
+ }, path_6, v_2);
637
+ const Decoders_pluginDataPropertyDecoder = (path_5)=>(v)=>(0, _Decode.object)((get$)=>{
638
+ let objectArg, objectArg_1, objectArg_2, objectArg_3, objectArg_4, objectArg_5, objectArg_6;
639
+ return new _FormSpec.Shared_PluginDataProperty((objectArg = get$.Required, objectArg.Field("propertyKey", (0, _Util.uncurry2)(Decoders_pluginPropertyKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field("name", _Decode.string)), (objectArg_2 = get$.Required, objectArg_2.Field("dataType", (0, _Util.uncurry2)(Decoders_pluginDataTypeDecoder))), (objectArg_3 = get$.Required, objectArg_3.Field("value", _Decode.string)), (objectArg_4 = get$.Optional, objectArg_4.Field("displayName", _Decode.string)), (objectArg_5 = get$.Optional, objectArg_5.Field("unit", _Decode.string)), (objectArg_6 = get$.Optional, objectArg_6.Field("description", _Decode.string)));
640
+ }, path_5, v);
641
+ const Decoders_pluginDataDecoder = (path_1)=>(v)=>(0, _Decode.object)((get$)=>{
642
+ const objectArg = get$.Required;
643
+ return objectArg.Field("properties", (path, value)=>(0, _Decode.list)((0, _Util.uncurry2)(Decoders_pluginDataPropertyDecoder), path, value));
644
+ }, path_1, v);
645
+ const Decoders_fieldValueDecoder = (path_7)=>(value_6)=>(0, _Decode.andThen)((0, _Util.uncurry3)((kind)=>{
646
+ switch(kind){
647
+ case "single":
648
+ return (path_2)=>(value_2)=>(0, _Decode.map)(_FormSpec.Shared_FieldValue_Single, (0, _Util.uncurry2)(Decoders_singleDecoder), path_2, value_2);
649
+ case "multiple":
650
+ return (path_3)=>(value_3)=>(0, _Decode.map)((tupledArg)=>(0, _FormSpec.Shared_FieldValue_Multiple)(tupledArg[1]), (0, _Util.uncurry2)(Decoders_multipleDecoder), path_3, value_3);
651
+ case "matrix":
652
+ return (path_4)=>(value_4)=>(0, _Decode.map)(_FormSpec.Shared_FieldValue_Matrix, (0, _Util.uncurry2)(Decoders_matrixDecoder), path_4, value_4);
653
+ case "pluginData":
654
+ return (path_5)=>(value_5)=>(0, _Decode.map)(_FormSpec.Shared_FieldValue_PluginData, (0, _Util.uncurry2)(Decoders_pluginDataDecoder), path_5, value_5);
655
+ default:
656
+ {
657
+ let msg;
658
+ const arg_1 = (0, _String.join)(", ", Decoders_validKinds);
659
+ msg = (0, _String.toText)((0, _String.printf)("Unknown kind \'%s\', expected one of: %s"))(kind)(arg_1);
660
+ return (path_6)=>(arg20$0040)=>(0, _Decode.fail)(msg, path_6, arg20$0040);
661
+ }
662
+ }
663
+ }), (path_1, value_1)=>(0, _Decode.field)("kind", _Decode.string, path_1, value_1), path_7, value_6);
664
+ const Decoders_formAnswersDecoder = (path_2)=>(value_1)=>(0, _Decode.andThen)((0, _Util.uncurry3)((pairs)=>{
665
+ const parsed = (0, _List.map)((tupledArg)=>{
666
+ const k = tupledArg[0];
667
+ let matchValue;
668
+ let outArg = "00000000-0000-0000-0000-000000000000";
669
+ matchValue = [
670
+ (0, _Guid.tryParse)(k, new _Types.FSharpRef(()=>outArg, (v_1)=>{
671
+ outArg = v_1;
672
+ })),
673
+ outArg
674
+ ];
675
+ if (matchValue[0]) {
676
+ return (0, _Result.FSharpResult$2_Ok)([
677
+ new _FormSpec.Shared_FieldKey(matchValue[1]),
678
+ tupledArg[1]
679
+ ]);
680
+ } else {
681
+ return (0, _Result.FSharpResult$2_Error)((0, _String.toText)((0, _String.printf)("Form answer key \'%s\' is not a valid GUID"))(k));
682
+ }
683
+ }, pairs);
684
+ const errors = (0, _List.choose)((_arg)=>{
685
+ if (_arg.tag === /* Error */ 1) {
686
+ return _arg.fields[0];
687
+ } else {
688
+ return undefined;
689
+ }
690
+ }, parsed);
691
+ if ((0, _List.isEmpty)(errors)) {
692
+ const output = (0, _Map.ofList)((0, _List.choose)((_arg_1)=>{
693
+ if (_arg_1.tag === /* Ok */ 0) {
694
+ return _arg_1.fields[0];
695
+ } else {
696
+ return undefined;
697
+ }
698
+ }, parsed), {
699
+ Compare: _Util.compare
700
+ });
701
+ return (arg10$0040)=>(arg20$0040)=>(0, _Decode.succeed)(output, arg10$0040, arg20$0040);
702
+ } else {
703
+ const msg = (0, _String.join)("; ", errors);
704
+ return (path_1)=>(arg20$0040_1)=>(0, _Decode.fail)(msg, path_1, arg20$0040_1);
705
+ }
706
+ }), (path, value)=>(0, _Decode.keyValuePairs)((0, _Util.uncurry2)(Decoders_fieldValueDecoder), path, value), path_2, value_1);
707
+ function gateFieldValue(json) {
708
+ const matchValue = (0, _Decode.fromString)((0, _Util.uncurry2)(Decoders_fieldValueDecoder), json);
709
+ if (matchValue.tag === /* Error */ 1) {
710
+ return (0, _Result.FSharpResult$2_Error)((0, _List.singleton)(new Rejection(RejectionPath_Root(), RejectionReason_NotJson(matchValue.fields[0]), json.length > 200 ? json.slice(undefined, 199 + 1) + "…" : json)));
711
+ } else {
712
+ return (0, _Result.FSharpResult$2_Ok)(matchValue.fields[0]);
713
+ }
714
+ }
715
+ function gateFormAnswers(json) {
716
+ const matchValue = (0, _Decode.fromString)((0, _Util.uncurry2)(Decoders_formAnswersDecoder), json);
717
+ if (matchValue.tag === /* Error */ 1) {
718
+ return (0, _Result.FSharpResult$2_Error)((0, _List.singleton)(new Rejection(RejectionPath_Root(), RejectionReason_NotJson(matchValue.fields[0]), json.length > 500 ? json.slice(undefined, 499 + 1) + "…" : json)));
719
+ } else {
720
+ return (0, _Result.FSharpResult$2_Ok)(matchValue.fields[0]);
721
+ }
722
+ }
723
+ function gateFieldKey(raw) {
724
+ let matchValue;
725
+ let outArg = "00000000-0000-0000-0000-000000000000";
726
+ matchValue = [
727
+ (0, _Guid.tryParse)(raw, new _Types.FSharpRef(()=>outArg, (v)=>{
728
+ outArg = v;
729
+ })),
730
+ outArg
731
+ ];
732
+ if (matchValue[0]) {
733
+ return (0, _Result.FSharpResult$2_Ok)(new _FormSpec.Shared_FieldKey(matchValue[1]));
734
+ } else {
735
+ return (0, _Result.FSharpResult$2_Error)((0, _List.singleton)(new Rejection(RejectionPath_Root(), RejectionReason_InvalidGuid("fieldKey", raw), raw)));
736
+ }
737
+ }
738
+ function tryDecodeFieldValueFromObject(objValue) {
739
+ let s, s_1;
740
+ if (objValue == null) {
741
+ return undefined;
742
+ } else {
743
+ try {
744
+ const matchValue = (0, _Decode.fromString)((0, _Util.uncurry2)(Decoders_fieldValueDecoder), typeof objValue === "string" ? (s = objValue, s.trimStart().startsWith("{")) ? (s_1 = objValue, s_1) : (0, _Encode.toString)(0, (0, _Encode.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(objValue)) : (0, _Encode.toString)(0, (0, _Encode.Auto_generateBoxedEncoder_437914C6)(_Reflection.obj_type, undefined, undefined, undefined)(objValue)));
745
+ return matchValue.tag === /* Error */ 1 ? undefined : matchValue.fields[0];
746
+ } catch (matchValue_1) {
747
+ return undefined;
748
+ }
749
+ }
750
+ } //# sourceMappingURL=FormAnswersGate.ts.map
751
+
752
+ //# sourceMappingURL=FormAnswersGate.js.map