@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,508 @@
1
+ import { FSharpRef, Record, Union } from "@fable-org/fable-library-js/Types.js";
2
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { obj_type, record_type, option_type, list_type, union_type, int32_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
4
+ import { singleton, choose, contains, ofArray, reverse, isEmpty, empty, cons, append, fold, map as map_1, FSharpList } from "@fable-org/fable-library-js/List.js";
5
+ import { map, defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
6
+ import { compare, stringHash, uncurry2, uncurry3, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
7
+ import { join, printf, toText } from "@fable-org/fable-library-js/String.js";
8
+ import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union, Result_Map } from "@fable-org/fable-library-js/Result.js";
9
+ import { fromString, field, list as list_3, keyValuePairs, array as array_1, IOptionalGetter, IRequiredGetter, IGetters, object, map as map_2, string, fail, succeed, andThen } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
10
+ import { tryParse } from "@fable-org/fable-library-js/Guid.js";
11
+ import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
12
+ import { Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_FieldValue_Multiple, Shared_FieldValue_$union, Shared_FieldValue_Single, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_FieldAnswer, Shared_PluginPropertyKey, Shared_MatrixItemKey, Shared_FieldKey } from "../../FormSpec.js";
13
+ import { FSharpSet, ofArray as ofArray_1 } from "@fable-org/fable-library-js/Set.js";
14
+ import { FSharpMap, ofList } from "@fable-org/fable-library-js/Map.js";
15
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../Thoth.Json/packages/Thoth.Json/Encode.js";
16
+
17
+ export type RejectionPath_$union =
18
+ | RejectionPath<0>
19
+ | RejectionPath<1>
20
+ | RejectionPath<2>
21
+ | RejectionPath<3>
22
+
23
+ export type RejectionPath_$cases = {
24
+ 0: ["Root", []],
25
+ 1: ["AtField", [string]],
26
+ 2: ["AtIndex", [int32]],
27
+ 3: ["Nested", [RejectionPath_$union, RejectionPath_$union]]
28
+ }
29
+
30
+ export function RejectionPath_Root() {
31
+ return new RejectionPath<0>(0, []);
32
+ }
33
+
34
+ export function RejectionPath_AtField(Item: string) {
35
+ return new RejectionPath<1>(1, [Item]);
36
+ }
37
+
38
+ export function RejectionPath_AtIndex(Item: int32) {
39
+ return new RejectionPath<2>(2, [Item]);
40
+ }
41
+
42
+ export function RejectionPath_Nested(Item1: RejectionPath_$union, Item2: RejectionPath_$union) {
43
+ return new RejectionPath<3>(3, [Item1, Item2]);
44
+ }
45
+
46
+ export class RejectionPath<Tag extends keyof RejectionPath_$cases> extends Union<Tag, RejectionPath_$cases[Tag][0]> {
47
+ constructor(readonly tag: Tag, readonly fields: RejectionPath_$cases[Tag][1]) {
48
+ super();
49
+ }
50
+ cases() {
51
+ return ["Root", "AtField", "AtIndex", "Nested"];
52
+ }
53
+ }
54
+
55
+ export function RejectionPath_$reflection(): TypeInfo {
56
+ return union_type("FormSpec.Interop.FormAnswersGate.RejectionPath", [], RejectionPath, () => [[], [["Item", string_type]], [["Item", int32_type]], [["Item1", RejectionPath_$reflection()], ["Item2", RejectionPath_$reflection()]]]);
57
+ }
58
+
59
+ export type RejectionReason_$union =
60
+ | RejectionReason<0>
61
+ | RejectionReason<1>
62
+ | RejectionReason<2>
63
+ | RejectionReason<3>
64
+ | RejectionReason<4>
65
+ | RejectionReason<5>
66
+ | RejectionReason<6>
67
+ | RejectionReason<7>
68
+ | RejectionReason<8>
69
+
70
+ export type RejectionReason_$cases = {
71
+ 0: ["NotJson", [string]],
72
+ 1: ["MissingField", [string]],
73
+ 2: ["WrongType", [string, string, string]],
74
+ 3: ["InvalidGuid", [string, string]],
75
+ 4: ["UnknownKind", [string, FSharpList<string>]],
76
+ 5: ["InvalidPluginDataType", [string, FSharpList<string>]],
77
+ 6: ["EmptyWhenRequired", [string]],
78
+ 7: ["DuplicateKeys", [string, FSharpList<string>]],
79
+ 8: ["MultipleErrors", [FSharpList<RejectionReason_$union>]]
80
+ }
81
+
82
+ export function RejectionReason_NotJson(parseError: string) {
83
+ return new RejectionReason<0>(0, [parseError]);
84
+ }
85
+
86
+ export function RejectionReason_MissingField(fieldName: string) {
87
+ return new RejectionReason<1>(1, [fieldName]);
88
+ }
89
+
90
+ export function RejectionReason_WrongType(fieldName: string, expected: string, actual: string) {
91
+ return new RejectionReason<2>(2, [fieldName, expected, actual]);
92
+ }
93
+
94
+ export function RejectionReason_InvalidGuid(fieldName: string, raw: string) {
95
+ return new RejectionReason<3>(3, [fieldName, raw]);
96
+ }
97
+
98
+ export function RejectionReason_UnknownKind(got: string, expected: FSharpList<string>) {
99
+ return new RejectionReason<4>(4, [got, expected]);
100
+ }
101
+
102
+ export function RejectionReason_InvalidPluginDataType(got: string, expected: FSharpList<string>) {
103
+ return new RejectionReason<5>(5, [got, expected]);
104
+ }
105
+
106
+ export function RejectionReason_EmptyWhenRequired(fieldName: string) {
107
+ return new RejectionReason<6>(6, [fieldName]);
108
+ }
109
+
110
+ export function RejectionReason_DuplicateKeys(fieldName: string, duplicates: FSharpList<string>) {
111
+ return new RejectionReason<7>(7, [fieldName, duplicates]);
112
+ }
113
+
114
+ export function RejectionReason_MultipleErrors(Item: FSharpList<RejectionReason_$union>) {
115
+ return new RejectionReason<8>(8, [Item]);
116
+ }
117
+
118
+ export class RejectionReason<Tag extends keyof RejectionReason_$cases> extends Union<Tag, RejectionReason_$cases[Tag][0]> {
119
+ constructor(readonly tag: Tag, readonly fields: RejectionReason_$cases[Tag][1]) {
120
+ super();
121
+ }
122
+ cases() {
123
+ return ["NotJson", "MissingField", "WrongType", "InvalidGuid", "UnknownKind", "InvalidPluginDataType", "EmptyWhenRequired", "DuplicateKeys", "MultipleErrors"];
124
+ }
125
+ }
126
+
127
+ export function RejectionReason_$reflection(): TypeInfo {
128
+ return union_type("FormSpec.Interop.FormAnswersGate.RejectionReason", [], RejectionReason, () => [[["parseError", string_type]], [["fieldName", string_type]], [["fieldName", string_type], ["expected", string_type], ["actual", string_type]], [["fieldName", string_type], ["raw", string_type]], [["got", string_type], ["expected", list_type(string_type)]], [["got", string_type], ["expected", list_type(string_type)]], [["fieldName", string_type]], [["fieldName", string_type], ["duplicates", list_type(string_type)]], [["Item", list_type(RejectionReason_$reflection())]]]);
129
+ }
130
+
131
+ export class Rejection extends Record implements IEquatable<Rejection>, IComparable<Rejection> {
132
+ readonly Path: RejectionPath_$union;
133
+ readonly Reason: RejectionReason_$union;
134
+ readonly RawFragment: Option<string>;
135
+ constructor(Path: RejectionPath_$union, Reason: RejectionReason_$union, RawFragment: Option<string>) {
136
+ super();
137
+ this.Path = Path;
138
+ this.Reason = Reason;
139
+ this.RawFragment = RawFragment;
140
+ }
141
+ }
142
+
143
+ export function Rejection_$reflection(): TypeInfo {
144
+ return record_type("FormSpec.Interop.FormAnswersGate.Rejection", [], Rejection, () => [["Path", RejectionPath_$reflection()], ["Reason", RejectionReason_$reflection()], ["RawFragment", option_type(string_type)]]);
145
+ }
146
+
147
+ export function Rejection_Create_7FA655F1(path: RejectionPath_$union, reason: RejectionReason_$union, raw?: string): Rejection {
148
+ return new Rejection(path, reason, raw);
149
+ }
150
+
151
+ export function formatRejection(r: Rejection): string {
152
+ const pathStr: string = formatPath(r.Path);
153
+ const reasonStr: string = formatReason(r.Reason);
154
+ const rawStr: string = defaultArg(map<string, string>((s: string): string => {
155
+ const truncated: string = (s.length > 80) ? (s.slice(undefined, 79 + 1) + "…") : s;
156
+ return toText(printf(" | raw: %s"))(truncated);
157
+ }, r.RawFragment), "");
158
+ return toText(printf("[%s] %s%s"))(pathStr)(reasonStr)(rawStr);
159
+ }
160
+
161
+ export function formatPath(p: RejectionPath_$union): string {
162
+ switch (p.tag) {
163
+ case /* AtField */ 1: {
164
+ const f: string = p.fields[0];
165
+ return toText(printf(".%s"))(f);
166
+ }
167
+ case /* AtIndex */ 2: {
168
+ const i: int32 = p.fields[0] | 0;
169
+ return toText(printf("[%d]"))(i);
170
+ }
171
+ case /* Nested */ 3: {
172
+ const child: RejectionPath_$union = p.fields[1];
173
+ const arg_2: string = formatPath(p.fields[0]);
174
+ const arg_3: string = formatPath(child);
175
+ return toText(printf("%s%s"))(arg_2)(arg_3);
176
+ }
177
+ default:
178
+ return "$";
179
+ }
180
+ }
181
+
182
+ export function formatReason(r: RejectionReason_$union): string {
183
+ switch (r.tag) {
184
+ case /* MissingField */ 1: {
185
+ const f: string = r.fields[0];
186
+ return toText(printf("Missing required field \'%s\'"))(f);
187
+ }
188
+ case /* WrongType */ 2: {
189
+ const f_1: string = r.fields[0];
190
+ const expected: string = r.fields[1];
191
+ const actual: string = r.fields[2];
192
+ return toText(printf("Field \'%s\' expected %s, got %s"))(f_1)(expected)(actual);
193
+ }
194
+ case /* InvalidGuid */ 3: {
195
+ const raw: string = r.fields[1];
196
+ const f_2: string = r.fields[0];
197
+ return toText(printf("Field \'%s\' is not a valid GUID: \'%s\'"))(f_2)(raw);
198
+ }
199
+ case /* UnknownKind */ 4: {
200
+ const got: string = r.fields[0];
201
+ const arg_8: string = join(", ", r.fields[1]);
202
+ return toText(printf("Unknown kind \'%s\', expected one of: %s"))(got)(arg_8);
203
+ }
204
+ case /* InvalidPluginDataType */ 5: {
205
+ const got_1: string = r.fields[0];
206
+ const arg_10: string = join(", ", r.fields[1]);
207
+ return toText(printf("Unknown dataType \'%s\', expected one of: %s"))(got_1)(arg_10);
208
+ }
209
+ case /* EmptyWhenRequired */ 6: {
210
+ const f_3: string = r.fields[0];
211
+ return toText(printf("Field \'%s\' is empty/whitespace but required at this level"))(f_3);
212
+ }
213
+ case /* DuplicateKeys */ 7: {
214
+ const f_4: string = r.fields[0];
215
+ const arg_13: string = join(", ", r.fields[1]);
216
+ return toText(printf("Duplicate keys in \'%s\': %s"))(f_4)(arg_13);
217
+ }
218
+ case /* MultipleErrors */ 8:
219
+ return join("; ", map_1<RejectionReason_$union, string>(formatReason, r.fields[0]));
220
+ default: {
221
+ const e: string = r.fields[0];
222
+ return toText(printf("Not valid JSON: %s"))(e);
223
+ }
224
+ }
225
+ }
226
+
227
+ export function GateResult_map<T, U>(f: ((arg0: T) => U), r: FSharpResult$2_$union<T, FSharpList<Rejection>>): FSharpResult$2_$union<U, FSharpList<Rejection>> {
228
+ return Result_Map<T, U, FSharpList<Rejection>>(f, r);
229
+ }
230
+
231
+ export function GateResult_bind<T, U>(f: ((arg0: T) => FSharpResult$2_$union<U, FSharpList<Rejection>>), r: FSharpResult$2_$union<T, FSharpList<Rejection>>): FSharpResult$2_$union<U, FSharpList<Rejection>> {
232
+ if (r.tag === /* Error */ 1) {
233
+ return FSharpResult$2_Error<U, FSharpList<Rejection>>(r.fields[0]);
234
+ }
235
+ else {
236
+ return f(r.fields[0]);
237
+ }
238
+ }
239
+
240
+ export function GateResult_collect<T>(results: FSharpList<FSharpResult$2_$union<T, FSharpList<Rejection>>>): FSharpResult$2_$union<FSharpList<T>, FSharpList<Rejection>> {
241
+ const patternInput: [FSharpList<T>, FSharpList<Rejection>] = fold<FSharpResult$2_$union<T, FSharpList<Rejection>>, [FSharpList<T>, FSharpList<Rejection>]>((tupledArg: [FSharpList<T>, FSharpList<Rejection>], r: FSharpResult$2_$union<T, FSharpList<Rejection>>): [FSharpList<T>, FSharpList<Rejection>] => {
242
+ const oks: FSharpList<T> = tupledArg[0];
243
+ const errs: FSharpList<Rejection> = tupledArg[1];
244
+ if (r.tag === /* Error */ 1) {
245
+ return [oks, append(r.fields[0], errs)] as [FSharpList<T>, FSharpList<Rejection>];
246
+ }
247
+ else {
248
+ return [cons(r.fields[0], oks), errs] as [FSharpList<T>, FSharpList<Rejection>];
249
+ }
250
+ }, [empty<T>(), empty<Rejection>()] as [FSharpList<T>, FSharpList<Rejection>], results);
251
+ const errs_1: FSharpList<Rejection> = patternInput[1];
252
+ if (isEmpty(errs_1)) {
253
+ return FSharpResult$2_Ok<FSharpList<T>, FSharpList<Rejection>>(reverse<T>(patternInput[0]));
254
+ }
255
+ else {
256
+ return FSharpResult$2_Error<FSharpList<T>, FSharpList<Rejection>>(errs_1);
257
+ }
258
+ }
259
+
260
+ export const Decoders_validKinds: FSharpList<string> = ofArray(["single", "multiple", "matrix", "pluginData"]);
261
+
262
+ export const Decoders_validPluginDataTypes: FSharpList<string> = ofArray(["string", "int", "float", "bool", "datetime"]);
263
+
264
+ export function Decoders_guidDecoder(fieldName: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) {
265
+ return (path_2: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((value_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => andThen<string, string>(uncurry3((raw: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) => {
266
+ let matchValue: [boolean, string];
267
+ let outArg = "00000000-0000-0000-0000-000000000000";
268
+ matchValue = ([tryParse(raw, new FSharpRef<string>((): string => outArg, (v: string): void => {
269
+ outArg = v;
270
+ })), outArg] as [boolean, string]);
271
+ if (matchValue[0]) {
272
+ return (arg10$0040: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => succeed<string>(matchValue[1], arg10$0040, arg20$0040));
273
+ }
274
+ else {
275
+ const msg: string = toText(printf("\'%s\' is not a valid GUID: \'%s\'"))(fieldName)(raw);
276
+ return (path_1: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((arg20$0040_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => fail<string>(msg, path_1, arg20$0040_1));
277
+ }
278
+ }), string, path_2, value_1));
279
+ }
280
+
281
+ export const Decoders_fieldKeyDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_FieldKey, [string, ErrorReason_$union]>)) = (() => {
282
+ const d: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) = Decoders_guidDecoder("fieldKey");
283
+ return (path: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldKey, [string, ErrorReason_$union]>) => ((value: any): FSharpResult$2_$union<Shared_FieldKey, [string, ErrorReason_$union]> => map_2<string, Shared_FieldKey>((Item: string): Shared_FieldKey => (new Shared_FieldKey(Item)), uncurry2(d), path, value));
284
+ })();
285
+
286
+ export const Decoders_matrixItemKeyDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_MatrixItemKey, [string, ErrorReason_$union]>)) = (() => {
287
+ const d: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) = Decoders_guidDecoder("matrixItemKey");
288
+ return (path: string): ((arg0: any) => FSharpResult$2_$union<Shared_MatrixItemKey, [string, ErrorReason_$union]>) => ((value: any): FSharpResult$2_$union<Shared_MatrixItemKey, [string, ErrorReason_$union]> => map_2<string, Shared_MatrixItemKey>((Item: string): Shared_MatrixItemKey => (new Shared_MatrixItemKey(Item)), uncurry2(d), path, value));
289
+ })();
290
+
291
+ export const Decoders_pluginPropertyKeyDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_PluginPropertyKey, [string, ErrorReason_$union]>)) = (() => {
292
+ const d: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) = Decoders_guidDecoder("propertyKey");
293
+ return (path: string): ((arg0: any) => FSharpResult$2_$union<Shared_PluginPropertyKey, [string, ErrorReason_$union]>) => ((value: any): FSharpResult$2_$union<Shared_PluginPropertyKey, [string, ErrorReason_$union]> => map_2<string, Shared_PluginPropertyKey>((Item: string): Shared_PluginPropertyKey => (new Shared_PluginPropertyKey(Item)), uncurry2(d), path, value));
294
+ })();
295
+
296
+ export const Decoders_pluginDataTypeDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((value_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => andThen<string, string>(uncurry3((raw: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) => {
297
+ if (contains<string>(raw, Decoders_validPluginDataTypes, {
298
+ Equals: (x: string, y: string): boolean => (x === y),
299
+ GetHashCode: stringHash,
300
+ })) {
301
+ return (arg10$0040: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => succeed<string>(raw, arg10$0040, arg20$0040));
302
+ }
303
+ else {
304
+ let msg: string;
305
+ const arg_1: string = join(", ", Decoders_validPluginDataTypes);
306
+ msg = toText(printf("Unknown dataType \'%s\', expected one of: %s"))(raw)(arg_1);
307
+ return (path_1: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((arg20$0040_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => fail<string>(msg, path_1, arg20$0040_1));
308
+ }
309
+ }), string, path_2, value_1));
310
+
311
+ export const Decoders_singleDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldAnswer, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<Shared_FieldAnswer, [string, ErrorReason_$union]> => object<Shared_FieldAnswer>((get$: IGetters): Shared_FieldAnswer => {
312
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IOptionalGetter;
313
+ return new Shared_FieldAnswer((objectArg = get$.Required, objectArg.Field<Shared_FieldKey>("fieldKey", uncurry2(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("description", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("value", string)), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("documentation", string)));
314
+ }, path_3, v));
315
+
316
+ export const Decoders_fieldAnswerDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldAnswer, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<Shared_FieldAnswer, [string, ErrorReason_$union]> => object<Shared_FieldAnswer>((get$: IGetters): Shared_FieldAnswer => {
317
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IOptionalGetter;
318
+ return new Shared_FieldAnswer((objectArg = get$.Required, objectArg.Field<Shared_FieldKey>("fieldKey", uncurry2(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("description", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("value", string)), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("documentation", string)));
319
+ }, path_3, v));
320
+
321
+ export const Decoders_multipleDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<[Shared_FieldKey, FSharpSet<Shared_FieldAnswer>], [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<[Shared_FieldKey, FSharpSet<Shared_FieldAnswer>], [string, ErrorReason_$union]> => object<[Shared_FieldKey, FSharpSet<Shared_FieldAnswer>]>((get$: IGetters): [Shared_FieldKey, FSharpSet<Shared_FieldAnswer>] => {
322
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter;
323
+ return [(objectArg = get$.Required, objectArg.Field<Shared_FieldKey>("fieldKey", uncurry2(Decoders_fieldKeyDecoder))), ofArray_1<Shared_FieldAnswer>((objectArg_1 = get$.Required, objectArg_1.Field<Shared_FieldAnswer[]>("values", (path: string, value: any): FSharpResult$2_$union<Shared_FieldAnswer[], [string, ErrorReason_$union]> => array_1<Shared_FieldAnswer>(uncurry2(Decoders_fieldAnswerDecoder), path, value))), {
324
+ Compare: compare,
325
+ })] as [Shared_FieldKey, FSharpSet<Shared_FieldAnswer>];
326
+ }, path_1, v));
327
+
328
+ export const Decoders_matrixDecoder = (path_6: string): ((arg0: any) => FSharpResult$2_$union<Shared_MatrixAnswer, [string, ErrorReason_$union]>) => ((v_2: any): FSharpResult$2_$union<Shared_MatrixAnswer, [string, ErrorReason_$union]> => object<Shared_MatrixAnswer>((get$: IGetters): Shared_MatrixAnswer => {
329
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IOptionalGetter;
330
+ return new Shared_MatrixAnswer((objectArg = get$.Required, objectArg.Field<Shared_FieldKey>("fieldKey", uncurry2(Decoders_fieldKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("description", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpMap<Shared_MatrixItemKey, string>>("values", (path_4: string, value_3: any): FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]> => andThen<FSharpList<[string, string]>, FSharpMap<Shared_MatrixItemKey, string>>(uncurry3((pairs: FSharpList<[string, string]>): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]>)) => {
331
+ const parsed: FSharpList<FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>> = map_1<[string, string], FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>>((tupledArg: [string, string]): FSharpResult$2_$union<[Shared_MatrixItemKey, string], string> => {
332
+ const k: string = tupledArg[0];
333
+ let matchValue: [boolean, string];
334
+ let outArg = "00000000-0000-0000-0000-000000000000";
335
+ matchValue = ([tryParse(k, new FSharpRef<string>((): string => outArg, (v_1: string): void => {
336
+ outArg = v_1;
337
+ })), outArg] as [boolean, string]);
338
+ if (matchValue[0]) {
339
+ return FSharpResult$2_Ok<[Shared_MatrixItemKey, string], string>([new Shared_MatrixItemKey(matchValue[1]), tupledArg[1]] as [Shared_MatrixItemKey, string]);
340
+ }
341
+ else {
342
+ return FSharpResult$2_Error<[Shared_MatrixItemKey, string], string>(toText(printf("Matrix key \'%s\' is not a valid GUID"))(k));
343
+ }
344
+ }, pairs);
345
+ const errors: FSharpList<string> = choose<FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>, string>((_arg: FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>): Option<string> => {
346
+ if (_arg.tag === /* Error */ 1) {
347
+ return _arg.fields[0];
348
+ }
349
+ else {
350
+ return undefined;
351
+ }
352
+ }, parsed);
353
+ if (isEmpty(errors)) {
354
+ const output: FSharpMap<Shared_MatrixItemKey, string> = ofList<Shared_MatrixItemKey, string>(choose<FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>, [Shared_MatrixItemKey, string]>((_arg_1: FSharpResult$2_$union<[Shared_MatrixItemKey, string], string>): Option<[Shared_MatrixItemKey, string]> => {
355
+ if (_arg_1.tag === /* Ok */ 0) {
356
+ return _arg_1.fields[0];
357
+ }
358
+ else {
359
+ return undefined;
360
+ }
361
+ }, parsed), {
362
+ Compare: compare,
363
+ });
364
+ return (arg10$0040: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]> => succeed<FSharpMap<Shared_MatrixItemKey, string>>(output, arg10$0040, arg20$0040));
365
+ }
366
+ else {
367
+ const msg: string = join("; ", errors);
368
+ return (path_3: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]>) => ((arg20$0040_1: any): FSharpResult$2_$union<FSharpMap<Shared_MatrixItemKey, string>, [string, ErrorReason_$union]> => fail<FSharpMap<Shared_MatrixItemKey, string>>(msg, path_3, arg20$0040_1));
369
+ }
370
+ }), (path_2: string, value_2: any): FSharpResult$2_$union<FSharpList<[string, string]>, [string, ErrorReason_$union]> => keyValuePairs<string>(string, path_2, value_2), path_4, value_3))), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("documentation", string)));
371
+ }, path_6, v_2));
372
+
373
+ export const Decoders_pluginDataPropertyDecoder = (path_5: string): ((arg0: any) => FSharpResult$2_$union<Shared_PluginDataProperty, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<Shared_PluginDataProperty, [string, ErrorReason_$union]> => object<Shared_PluginDataProperty>((get$: IGetters): Shared_PluginDataProperty => {
374
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter, objectArg_6: IOptionalGetter;
375
+ return new Shared_PluginDataProperty((objectArg = get$.Required, objectArg.Field<Shared_PluginPropertyKey>("propertyKey", uncurry2(Decoders_pluginPropertyKeyDecoder))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("dataType", uncurry2(Decoders_pluginDataTypeDecoder))), (objectArg_3 = get$.Required, objectArg_3.Field<string>("value", string)), (objectArg_4 = get$.Optional, objectArg_4.Field<string>("displayName", string)), (objectArg_5 = get$.Optional, objectArg_5.Field<string>("unit", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("description", string)));
376
+ }, path_5, v));
377
+
378
+ export const Decoders_pluginDataDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<FSharpList<Shared_PluginDataProperty>, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<FSharpList<Shared_PluginDataProperty>, [string, ErrorReason_$union]> => object<FSharpList<Shared_PluginDataProperty>>((get$: IGetters): FSharpList<Shared_PluginDataProperty> => {
379
+ const objectArg: IRequiredGetter = get$.Required;
380
+ return objectArg.Field<FSharpList<Shared_PluginDataProperty>>("properties", (path: string, value: any): FSharpResult$2_$union<FSharpList<Shared_PluginDataProperty>, [string, ErrorReason_$union]> => list_3<Shared_PluginDataProperty>(uncurry2(Decoders_pluginDataPropertyDecoder), path, value));
381
+ }, path_1, v));
382
+
383
+ export const Decoders_fieldValueDecoder = (path_7: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((value_6: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => andThen<string, Shared_FieldValue_$union>(uncurry3((kind: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>)) => {
384
+ switch (kind) {
385
+ case "single":
386
+ return (path_2: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((value_2: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => map_2<Shared_FieldAnswer, Shared_FieldValue_$union>(Shared_FieldValue_Single, uncurry2(Decoders_singleDecoder), path_2, value_2));
387
+ case "multiple":
388
+ return (path_3: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((value_3: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => map_2<[Shared_FieldKey, FSharpSet<Shared_FieldAnswer>], Shared_FieldValue_$union>((tupledArg: [Shared_FieldKey, FSharpSet<Shared_FieldAnswer>]): Shared_FieldValue_$union => Shared_FieldValue_Multiple(tupledArg[1]), uncurry2(Decoders_multipleDecoder), path_3, value_3));
389
+ case "matrix":
390
+ return (path_4: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((value_4: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => map_2<Shared_MatrixAnswer, Shared_FieldValue_$union>(Shared_FieldValue_Matrix, uncurry2(Decoders_matrixDecoder), path_4, value_4));
391
+ case "pluginData":
392
+ return (path_5: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((value_5: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => map_2<FSharpList<Shared_PluginDataProperty>, Shared_FieldValue_$union>(Shared_FieldValue_PluginData, uncurry2(Decoders_pluginDataDecoder), path_5, value_5));
393
+ default: {
394
+ let msg: string;
395
+ const arg_1: string = join(", ", Decoders_validKinds);
396
+ msg = toText(printf("Unknown kind \'%s\', expected one of: %s"))(kind)(arg_1);
397
+ return (path_6: string): ((arg0: any) => FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<Shared_FieldValue_$union, [string, ErrorReason_$union]> => fail<Shared_FieldValue_$union>(msg, path_6, arg20$0040));
398
+ }
399
+ }
400
+ }), (path_1: string, value_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => field<string>("kind", string, path_1, value_1), path_7, value_6));
401
+
402
+ export const Decoders_formAnswersDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]>) => ((value_1: any): FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]> => andThen<FSharpList<[string, Shared_FieldValue_$union]>, FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>>(uncurry3((pairs: FSharpList<[string, Shared_FieldValue_$union]>): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]>)) => {
403
+ const parsed: FSharpList<FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>> = map_1<[string, Shared_FieldValue_$union], FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>>((tupledArg: [string, Shared_FieldValue_$union]): FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string> => {
404
+ const k: string = tupledArg[0];
405
+ let matchValue: [boolean, string];
406
+ let outArg = "00000000-0000-0000-0000-000000000000";
407
+ matchValue = ([tryParse(k, new FSharpRef<string>((): string => outArg, (v_1: string): void => {
408
+ outArg = v_1;
409
+ })), outArg] as [boolean, string]);
410
+ if (matchValue[0]) {
411
+ return FSharpResult$2_Ok<[Shared_FieldKey, Shared_FieldValue_$union], string>([new Shared_FieldKey(matchValue[1]), tupledArg[1]] as [Shared_FieldKey, Shared_FieldValue_$union]);
412
+ }
413
+ else {
414
+ return FSharpResult$2_Error<[Shared_FieldKey, Shared_FieldValue_$union], string>(toText(printf("Form answer key \'%s\' is not a valid GUID"))(k));
415
+ }
416
+ }, pairs);
417
+ const errors: FSharpList<string> = choose<FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>, string>((_arg: FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>): Option<string> => {
418
+ if (_arg.tag === /* Error */ 1) {
419
+ return _arg.fields[0];
420
+ }
421
+ else {
422
+ return undefined;
423
+ }
424
+ }, parsed);
425
+ if (isEmpty(errors)) {
426
+ const output: FSharpMap<Shared_FieldKey, Shared_FieldValue_$union> = ofList<Shared_FieldKey, Shared_FieldValue_$union>(choose<FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>, [Shared_FieldKey, Shared_FieldValue_$union]>((_arg_1: FSharpResult$2_$union<[Shared_FieldKey, Shared_FieldValue_$union], string>): Option<[Shared_FieldKey, Shared_FieldValue_$union]> => {
427
+ if (_arg_1.tag === /* Ok */ 0) {
428
+ return _arg_1.fields[0];
429
+ }
430
+ else {
431
+ return undefined;
432
+ }
433
+ }, parsed), {
434
+ Compare: compare,
435
+ });
436
+ return (arg10$0040: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]> => succeed<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>>(output, arg10$0040, arg20$0040));
437
+ }
438
+ else {
439
+ const msg: string = join("; ", errors);
440
+ return (path_1: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]>) => ((arg20$0040_1: any): FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, [string, ErrorReason_$union]> => fail<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>>(msg, path_1, arg20$0040_1));
441
+ }
442
+ }), (path: string, value: any): FSharpResult$2_$union<FSharpList<[string, Shared_FieldValue_$union]>, [string, ErrorReason_$union]> => keyValuePairs<Shared_FieldValue_$union>(uncurry2(Decoders_fieldValueDecoder), path, value), path_2, value_1));
443
+
444
+ /**
445
+ * Validate and parse a single FieldValue from JSON (discriminated format)
446
+ */
447
+ export function gateFieldValue(json: string): FSharpResult$2_$union<Shared_FieldValue_$union, FSharpList<Rejection>> {
448
+ const matchValue: FSharpResult$2_$union<Shared_FieldValue_$union, string> = fromString<Shared_FieldValue_$union>(uncurry2(Decoders_fieldValueDecoder), json);
449
+ if (matchValue.tag === /* Error */ 1) {
450
+ return FSharpResult$2_Error<Shared_FieldValue_$union, FSharpList<Rejection>>(singleton(new Rejection(RejectionPath_Root(), RejectionReason_NotJson(matchValue.fields[0]), (json.length > 200) ? (json.slice(undefined, 199 + 1) + "…") : json)));
451
+ }
452
+ else {
453
+ return FSharpResult$2_Ok<Shared_FieldValue_$union, FSharpList<Rejection>>(matchValue.fields[0]);
454
+ }
455
+ }
456
+
457
+ /**
458
+ * Validate and parse a full form's answers from JSON (Record<fieldKey, discriminated value>)
459
+ */
460
+ export function gateFormAnswers(json: string): FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, FSharpList<Rejection>> {
461
+ const matchValue: FSharpResult$2_$union<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, string> = fromString<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>>(uncurry2(Decoders_formAnswersDecoder), json);
462
+ if (matchValue.tag === /* Error */ 1) {
463
+ return FSharpResult$2_Error<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, FSharpList<Rejection>>(singleton(new Rejection(RejectionPath_Root(), RejectionReason_NotJson(matchValue.fields[0]), (json.length > 500) ? (json.slice(undefined, 499 + 1) + "…") : json)));
464
+ }
465
+ else {
466
+ return FSharpResult$2_Ok<FSharpMap<Shared_FieldKey, Shared_FieldValue_$union>, FSharpList<Rejection>>(matchValue.fields[0]);
467
+ }
468
+ }
469
+
470
+ /**
471
+ * Validate a single field key string is a valid GUID
472
+ */
473
+ export function gateFieldKey(raw: string): FSharpResult$2_$union<Shared_FieldKey, FSharpList<Rejection>> {
474
+ let matchValue: [boolean, string];
475
+ let outArg = "00000000-0000-0000-0000-000000000000";
476
+ matchValue = ([tryParse(raw, new FSharpRef<string>((): string => outArg, (v: string): void => {
477
+ outArg = v;
478
+ })), outArg] as [boolean, string]);
479
+ if (matchValue[0]) {
480
+ return FSharpResult$2_Ok<Shared_FieldKey, FSharpList<Rejection>>(new Shared_FieldKey(matchValue[1]));
481
+ }
482
+ else {
483
+ return FSharpResult$2_Error<Shared_FieldKey, FSharpList<Rejection>>(singleton(new Rejection(RejectionPath_Root(), RejectionReason_InvalidGuid("fieldKey", raw), raw)));
484
+ }
485
+ }
486
+
487
+ /**
488
+ * Try to decode an object (from TS) to FieldValue using the discriminated format.
489
+ * Returns Some when objectValue has kind and decodes successfully; None for flat format or decode failure.
490
+ * Handles both JS objects (Fable) and JSON strings (.NET server via jsonValueToObj).
491
+ */
492
+ export function tryDecodeFieldValueFromObject(objValue: any): Option<Shared_FieldValue_$union> {
493
+ let s: string, s_1: string;
494
+ if (objValue == null) {
495
+ return undefined;
496
+ }
497
+ else {
498
+ try {
499
+ const matchValue: FSharpResult$2_$union<Shared_FieldValue_$union, string> = fromString<Shared_FieldValue_$union>(uncurry2(Decoders_fieldValueDecoder), (typeof objValue === "string") ? (((s = (objValue as string), s.trimStart().startsWith("{"))) ? ((s_1 = (objValue as string), s_1)) : toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(objValue))) : toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(objValue)));
500
+ return (matchValue.tag === /* Error */ 1) ? undefined : matchValue.fields[0];
501
+ }
502
+ catch (matchValue_1: any) {
503
+ return undefined;
504
+ }
505
+ }
506
+ }
507
+
508
+ //# sourceMappingURL=FormAnswersGate.ts.map