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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/FormSpec.FS/BitmaskHelpers.d.ts +23 -0
  2. package/FormSpec.FS/BitmaskHelpers.d.ts.map +1 -0
  3. package/FormSpec.FS/BlueprintValidation.d.ts +16 -0
  4. package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -0
  5. package/FormSpec.FS/FormSpec.d.ts +19 -5
  6. package/FormSpec.FS/FormSpec.d.ts.map +1 -1
  7. package/FormSpec.FS/FormSpecHelpers.d.ts +4 -0
  8. package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
  9. package/FormSpec.FS/FormSpecValues.d.ts +5 -0
  10. package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
  11. package/FormSpec.FS/Helpers.d.ts.map +1 -1
  12. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts +13 -0
  13. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -0
  14. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +22 -0
  15. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -0
  16. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts +22 -0
  17. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -0
  18. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +130 -0
  19. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -0
  20. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts +37 -0
  21. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts.map +1 -0
  22. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts +231 -0
  23. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -0
  24. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts +10 -0
  25. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts.map +1 -0
  26. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +55 -0
  27. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -0
  28. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts +69 -0
  29. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +1 -0
  30. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts +21 -0
  31. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -0
  32. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +133 -0
  33. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -0
  34. package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts +52 -0
  35. package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts.map +1 -0
  36. package/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.d.ts +46 -0
  37. package/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.d.ts.map +1 -0
  38. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.d.ts +4 -0
  39. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.d.ts.map +1 -0
  40. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.d.ts +36 -0
  41. package/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.d.ts.map +1 -0
  42. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts +95 -0
  43. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts.map +1 -0
  44. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +449 -0
  45. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -0
  46. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  47. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +3 -1
  48. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  49. package/FormSpec.FS/Provenance.d.ts +10 -0
  50. package/FormSpec.FS/Provenance.d.ts.map +1 -0
  51. package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
  52. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js +56 -0
  53. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js.map +1 -0
  54. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.ts.map +1 -0
  55. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +116 -0
  56. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -0
  57. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -0
  58. package/FormSpec.TS/FormSpec.FS/Designer.js +2 -2
  59. package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
  60. package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
  61. package/FormSpec.TS/FormSpec.FS/FormSpec.js +72 -3
  62. package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
  63. package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
  64. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +201 -3
  65. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  66. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  67. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +38 -3
  68. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
  69. package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
  70. package/FormSpec.TS/FormSpec.FS/Helpers.js +44 -27
  71. package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
  72. package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
  73. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +45 -0
  74. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -0
  75. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -0
  76. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +145 -0
  77. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -0
  78. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -0
  79. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +139 -0
  80. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -0
  81. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -0
  82. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +801 -0
  83. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -0
  84. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts.map +1 -0
  85. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js +121 -0
  86. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js.map +1 -0
  87. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts.map +1 -0
  88. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +1380 -0
  89. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -0
  90. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts.map +1 -0
  91. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +29 -0
  92. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -0
  93. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -0
  94. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +172 -0
  95. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -0
  96. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -0
  97. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +406 -0
  98. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +1 -0
  99. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts.map +1 -0
  100. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +317 -0
  101. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -0
  102. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -0
  103. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +622 -0
  104. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -0
  105. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -0
  106. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +448 -0
  107. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -0
  108. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts.map +1 -0
  109. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.js +198 -0
  110. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.js.map +1 -0
  111. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.ts.map +1 -0
  112. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.js +57 -0
  113. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.js.map +1 -0
  114. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.ts.map +1 -0
  115. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.js +144 -0
  116. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.js.map +1 -0
  117. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.ts.map +1 -0
  118. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js +258 -0
  119. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js.map +1 -0
  120. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts.map +1 -0
  121. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +1768 -0
  122. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js.map +1 -0
  123. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts.map +1 -0
  124. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +22 -18
  125. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  126. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  127. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +18 -6
  128. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  129. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  130. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +1 -1
  131. package/FormSpec.TS/FormSpec.FS/Provenance.js +41 -0
  132. package/FormSpec.TS/FormSpec.FS/Provenance.js.map +1 -0
  133. package/FormSpec.TS/FormSpec.FS/Provenance.ts.map +1 -0
  134. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js +36 -13
  135. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js.map +1 -1
  136. package/FormSpec.TS/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
  137. package/FormSpec.TS/FormSpec.FS/Renderers/PathwayRenderers.js +1 -1
  138. package/FormSpec.TS/PathwayExecutor.withPlugins.js +0 -5
  139. package/FormSpec.TS/PathwayExecutor.withPlugins.js.map +1 -1
  140. package/FormSpec.TS/PluginRegistration.js +2 -0
  141. package/FormSpec.TS/PluginRegistration.js.map +1 -1
  142. package/FormSpec.TS/PluginRegistration.ts.map +1 -1
  143. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
  144. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
  145. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  146. package/FormSpec.TS/plugins/demographics/src/DemographicsField.js +918 -0
  147. package/FormSpec.TS/plugins/demographics/src/DemographicsField.js.map +1 -0
  148. package/FormSpec.TS/plugins/demographics/src/DemographicsField.ts.map +1 -0
  149. package/FormSpec.TS/plugins/likert/src/LikertField.js +1 -1
  150. package/PathwayExecutor.withPlugins.d.ts +0 -5
  151. package/PathwayExecutor.withPlugins.d.ts.map +1 -1
  152. package/README.md +7 -7
  153. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts +3 -0
  154. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts.map +1 -0
  155. package/package.json +4 -4
  156. package/plugins/demographics/src/DemographicsField.d.ts +104 -0
  157. package/plugins/demographics/src/DemographicsField.d.ts.map +1 -0
  158. package/src/FormSpec.FS/BitmaskHelpers.ts +52 -0
  159. package/src/FormSpec.FS/BlueprintValidation.ts +108 -0
  160. package/src/FormSpec.FS/Designer.ts +2 -2
  161. package/src/FormSpec.FS/FormSpec.ts +39 -8
  162. package/src/FormSpec.FS/FormSpecHelpers.ts +190 -12
  163. package/src/FormSpec.FS/FormSpecValues.ts +42 -3
  164. package/src/FormSpec.FS/Helpers.ts +44 -27
  165. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +37 -0
  166. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +103 -0
  167. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +129 -0
  168. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +490 -0
  169. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts +87 -0
  170. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +1046 -0
  171. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +26 -0
  172. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +161 -0
  173. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +386 -0
  174. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +320 -0
  175. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +371 -0
  176. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +372 -0
  177. package/src/FormSpec.FS/Integrations/Adapters/FormSystemAdapter.ts +92 -0
  178. package/src/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.ts +51 -0
  179. package/src/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormTypes.ts +71 -0
  180. package/src/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts +15 -0
  181. package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +825 -0
  182. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +19 -15
  183. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +13 -7
  184. package/src/FormSpec.FS/PathwayExecutor.ts +1 -1
  185. package/src/FormSpec.FS/Provenance.ts +19 -0
  186. package/src/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts +32 -12
  187. package/src/FormSpec.FS/Renderers/PathwayRenderers.ts +1 -1
  188. package/src/PathwayExecutor.withPlugins.ts +0 -5
  189. package/src/PluginRegistration.ts +2 -0
  190. package/src/plugins/demographics/src/DemographicsField.ts +502 -0
  191. package/src/plugins/likert/src/LikertField.ts +1 -1
@@ -0,0 +1,372 @@
1
+ import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { empty as empty_1, ofList, toList, isEmpty as isEmpty_1, tryFind as tryFind_1, FSharpMap } from "@fable-org/fable-library-js/Map.js";
4
+ import { Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_FieldValue, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldAnswer, Shared_FieldOption, Shared_FieldKey_$reflection, Shared_FieldKey } from "../../../FormSpec.js";
5
+ import { compare, uncurry2, uncurry3, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
6
+ import { bool_type, list_type, option_type, record_type, class_type, string_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
7
+ import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable-org/fable-library-js/Option.js";
8
+ import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
9
+ import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
10
+ import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
11
+ import { object, toString } from "../../../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
12
+ import { keyValuePairs, map as map_2, fromString, IOptionalGetter, list as list_4, IRequiredGetter, IGetters, int, object as object_1, string, fail, succeed, andThen, guid, index, field as field_1, oneOf } from "../../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
13
+ import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
14
+ import { ErrorReason_$union } from "../../../../fable_modules/Thoth.Json.10.4.1/Types.fs.js";
15
+ import { tryParse } from "@fable-org/fable-library-js/Guid.js";
16
+ import { IntegrationProvenance } from "../../../Provenance.js";
17
+
18
+ export class CoreMRPublishMetadata extends Record implements IEquatable<CoreMRPublishMetadata>, IComparable<CoreMRPublishMetadata> {
19
+ readonly FormId: int32;
20
+ readonly FormName: string;
21
+ readonly FieldKeyToSequence: FSharpMap<Shared_FieldKey, int32>;
22
+ constructor(FormId: int32, FormName: string, FieldKeyToSequence: FSharpMap<Shared_FieldKey, int32>) {
23
+ super();
24
+ this.FormId = (FormId | 0);
25
+ this.FormName = FormName;
26
+ this.FieldKeyToSequence = FieldKeyToSequence;
27
+ }
28
+ }
29
+
30
+ export function CoreMRPublishMetadata_$reflection(): TypeInfo {
31
+ return record_type("FormSpec.Integrations.CorEMR.CoreMRPublishMetadata", [], CoreMRPublishMetadata, () => [["FormId", int32_type], ["FormName", string_type], ["FieldKeyToSequence", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Shared_FieldKey_$reflection(), int32_type])]]);
32
+ }
33
+
34
+ export class CoreMRAnswer extends Record implements IEquatable<CoreMRAnswer>, IComparable<CoreMRAnswer> {
35
+ readonly Sequence: int32;
36
+ readonly Value: int32;
37
+ readonly Text: Option<string>;
38
+ constructor(Sequence: int32, Value: int32, Text$: Option<string>) {
39
+ super();
40
+ this.Sequence = (Sequence | 0);
41
+ this.Value = (Value | 0);
42
+ this.Text = Text$;
43
+ }
44
+ }
45
+
46
+ export function CoreMRAnswer_$reflection(): TypeInfo {
47
+ return record_type("FormSpec.Integrations.CorEMR.CoreMRAnswer", [], CoreMRAnswer, () => [["Sequence", int32_type], ["Value", int32_type], ["Text", option_type(string_type)]]);
48
+ }
49
+
50
+ export class CoreMRFormInsertRequest extends Record implements IEquatable<CoreMRFormInsertRequest>, IComparable<CoreMRFormInsertRequest> {
51
+ readonly FormId: int32;
52
+ readonly FormName: string;
53
+ readonly Answers: Option<FSharpList<CoreMRAnswer>>;
54
+ readonly DryRun: Option<boolean>;
55
+ constructor(FormId: int32, FormName: string, Answers: Option<FSharpList<CoreMRAnswer>>, DryRun: Option<boolean>) {
56
+ super();
57
+ this.FormId = (FormId | 0);
58
+ this.FormName = FormName;
59
+ this.Answers = Answers;
60
+ this.DryRun = DryRun;
61
+ }
62
+ }
63
+
64
+ export function CoreMRFormInsertRequest_$reflection(): TypeInfo {
65
+ return record_type("FormSpec.Integrations.CorEMR.CoreMRFormInsertRequest", [], CoreMRFormInsertRequest, () => [["FormId", int32_type], ["FormName", string_type], ["Answers", option_type(list_type(CoreMRAnswer_$reflection()))], ["DryRun", option_type(bool_type)]]);
66
+ }
67
+
68
+ function FormSpecToCoreMRInsert_getScoreFromOption(options: FSharpList<Shared_FieldOption>, selectedValue: string): Option<int32> {
69
+ const canonicalSelected: string = Helpers_canonicalizeFieldKey(selectedValue);
70
+ return bind<Shared_FieldOption, int32>((opt_1: Shared_FieldOption): Option<int32> => opt_1.Score, tryFind<Shared_FieldOption>((opt: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt.Value) === canonicalSelected), options));
71
+ }
72
+
73
+ function FormSpecToCoreMRInsert_singleToAnswer(fieldKey: Shared_FieldKey, options: FSharpList<Shared_FieldOption>, answer: Shared_FieldAnswer, seqMap: FSharpMap<Shared_FieldKey, int32>): Option<CoreMRAnswer> {
74
+ return map<int32, CoreMRAnswer>((seq: int32): CoreMRAnswer => {
75
+ const matchValue: Option<int32> = FormSpecToCoreMRInsert_getScoreFromOption(options, answer.Value);
76
+ if (matchValue == null) {
77
+ return new CoreMRAnswer(seq, 0, answer.Value);
78
+ }
79
+ else {
80
+ return new CoreMRAnswer(seq, value_6(matchValue), undefined);
81
+ }
82
+ }, tryFind_1<Shared_FieldKey, int32>(fieldKey, seqMap));
83
+ }
84
+
85
+ function FormSpecToCoreMRInsert_getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_FieldOption> {
86
+ let matchResult: int32, info: Spec_SingleChoiceInfo, info_1: Spec_MultiChoiceInfo;
87
+ switch (ft.tag) {
88
+ case /* Radio */ 12: {
89
+ matchResult = 0;
90
+ info = ft.fields[0];
91
+ break;
92
+ }
93
+ case /* SingleChoice */ 13: {
94
+ matchResult = 0;
95
+ info = ft.fields[0];
96
+ break;
97
+ }
98
+ case /* Dropdown */ 14: {
99
+ matchResult = 0;
100
+ info = ft.fields[0];
101
+ break;
102
+ }
103
+ case /* TextAutoComplete */ 18: {
104
+ matchResult = 0;
105
+ info = ft.fields[0];
106
+ break;
107
+ }
108
+ case /* MultiChoice */ 15: {
109
+ matchResult = 1;
110
+ info_1 = ft.fields[0];
111
+ break;
112
+ }
113
+ case /* CheckboxList */ 16: {
114
+ matchResult = 1;
115
+ info_1 = ft.fields[0];
116
+ break;
117
+ }
118
+ case /* TagList */ 17: {
119
+ matchResult = 1;
120
+ info_1 = ft.fields[0];
121
+ break;
122
+ }
123
+ case /* Matrix */ 19: {
124
+ matchResult = 2;
125
+ break;
126
+ }
127
+ default:
128
+ matchResult = 3;
129
+ }
130
+ switch (matchResult) {
131
+ case 0:
132
+ return info!.Options;
133
+ case 1:
134
+ return info_1!.Options;
135
+ case 2:
136
+ return ft.fields[0].Options;
137
+ default:
138
+ return empty<Shared_FieldOption>();
139
+ }
140
+ }
141
+
142
+ function FormSpecToCoreMRInsert_fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, seqMap: FSharpMap<Shared_FieldKey, int32>): FSharpList<CoreMRAnswer> {
143
+ const matchValue: Option<Shared_FieldValue_$union> = field.Value;
144
+ if (matchValue != null) {
145
+ switch (value_6(matchValue).tag) {
146
+ case /* Multiple */ 1:
147
+ return empty<CoreMRAnswer>();
148
+ case /* Matrix */ 2: {
149
+ const matrix: Shared_MatrixAnswer = (value_6(matchValue) as Shared_FieldValue<2>).fields[0];
150
+ return empty<CoreMRAnswer>();
151
+ }
152
+ case /* PluginData */ 3: {
153
+ const props: FSharpList<Shared_PluginDataProperty> = (value_6(matchValue) as Shared_FieldValue<3>).fields[0];
154
+ let matchResult: int32, p_1: Shared_PluginDataProperty;
155
+ if (!isEmpty(props)) {
156
+ if (isEmpty(tail(props))) {
157
+ if (!isNullOrWhiteSpace(head(props).Value)) {
158
+ matchResult = 0;
159
+ p_1 = head(props);
160
+ }
161
+ else {
162
+ matchResult = 1;
163
+ }
164
+ }
165
+ else {
166
+ matchResult = 1;
167
+ }
168
+ }
169
+ else {
170
+ matchResult = 1;
171
+ }
172
+ switch (matchResult) {
173
+ case 0:
174
+ return ofArray(toArray<CoreMRAnswer>(map<int32, CoreMRAnswer>((seq: int32): CoreMRAnswer => (new CoreMRAnswer(seq, 0, p_1!.Value)), tryFind_1<Shared_FieldKey, int32>(field.FieldKey, seqMap))));
175
+ default:
176
+ return empty<CoreMRAnswer>();
177
+ }
178
+ }
179
+ default: {
180
+ const answer: Shared_FieldAnswer = (value_6(matchValue) as Shared_FieldValue<0>).fields[0];
181
+ return ofArray(toArray<CoreMRAnswer>(FormSpecToCoreMRInsert_singleToAnswer(field.FieldKey, FormSpecToCoreMRInsert_getOptionsFromFieldType(field.FieldType), answer, seqMap)));
182
+ }
183
+ }
184
+ }
185
+ else {
186
+ return empty<CoreMRAnswer>();
187
+ }
188
+ }
189
+
190
+ function FormSpecToCoreMRInsert_fieldToValueAndText(field: Spec_FormField$1<Spec_FieldType_$union>): Option<[int32, Option<string>]> {
191
+ const matchValue: Option<Shared_FieldValue_$union> = field.Value;
192
+ let matchResult: int32, answer: Shared_FieldAnswer, p_1: Shared_PluginDataProperty;
193
+ if (matchValue != null) {
194
+ switch (value_6(matchValue).tag) {
195
+ case /* Single */ 0: {
196
+ matchResult = 1;
197
+ answer = (value_6(matchValue) as Shared_FieldValue<0>).fields[0];
198
+ break;
199
+ }
200
+ case /* PluginData */ 3: {
201
+ if (!isEmpty((value_6(matchValue) as Shared_FieldValue<3>).fields[0])) {
202
+ if (isEmpty(tail((value_6(matchValue) as Shared_FieldValue<3>).fields[0]))) {
203
+ if (!isNullOrWhiteSpace(head((value_6(matchValue) as Shared_FieldValue<3>).fields[0]).Value)) {
204
+ matchResult = 2;
205
+ p_1 = head((value_6(matchValue) as Shared_FieldValue<3>).fields[0]);
206
+ }
207
+ else {
208
+ matchResult = 3;
209
+ }
210
+ }
211
+ else {
212
+ matchResult = 3;
213
+ }
214
+ }
215
+ else {
216
+ matchResult = 3;
217
+ }
218
+ break;
219
+ }
220
+ default:
221
+ matchResult = 3;
222
+ }
223
+ }
224
+ else {
225
+ matchResult = 0;
226
+ }
227
+ switch (matchResult) {
228
+ case 0:
229
+ return undefined;
230
+ case 1: {
231
+ const matchValue_1: Option<int32> = FormSpecToCoreMRInsert_getScoreFromOption(FormSpecToCoreMRInsert_getOptionsFromFieldType(field.FieldType), answer!.Value);
232
+ if (matchValue_1 == null) {
233
+ return [0, answer!.Value] as [int32, Option<string>];
234
+ }
235
+ else {
236
+ return [value_6(matchValue_1), undefined] as [int32, Option<string>];
237
+ }
238
+ }
239
+ case 2:
240
+ return [0, p_1!.Value] as [int32, Option<string>];
241
+ default:
242
+ return undefined;
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Convert filled FormSpec to CoreMR form-insert payload.
248
+ * scaffoldMode: when true, omit answers (scaffold mode - all items get value=2).
249
+ * When false, include answers from form values (real-answers mode).
250
+ * When FieldKeyToSequence is empty (fallback metadata), uses positional mapping (sequence=1,2,3...).
251
+ */
252
+ export function FormSpecToCoreMRInsert_convertToCoreMRInsertPayload(filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, metadata: CoreMRPublishMetadata, scaffoldMode: boolean, dryRun: boolean): CoreMRFormInsertRequest {
253
+ let allFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, acc: FSharpList<CoreMRAnswer>;
254
+ return new CoreMRFormInsertRequest(metadata.FormId, metadata.FormName, scaffoldMode ? undefined : ((allFields = collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, filledFormSpec.Steps), (acc = (isEmpty_1<Shared_FieldKey, int32>(metadata.FieldKeyToSequence) ? mapIndexed<[int32, Option<string>], CoreMRAnswer>((i: int32, tupledArg: [int32, Option<string>]): CoreMRAnswer => (new CoreMRAnswer((2 * i) + 1, tupledArg[0], tupledArg[1])), choose<Spec_FormField$1<Spec_FieldType_$union>, [int32, Option<string>]>(FormSpecToCoreMRInsert_fieldToValueAndText, allFields)) : collect<Spec_FormField$1<Spec_FieldType_$union>, CoreMRAnswer>((f: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<CoreMRAnswer> => FormSpecToCoreMRInsert_fieldToAnswers(f, metadata.FieldKeyToSequence), allFields)), isEmpty(acc) ? undefined : acc))), dryRun);
255
+ }
256
+
257
+ const CoreMRPublishMetadataCustomData_key = "coremr_publish";
258
+
259
+ /**
260
+ * Serialize CoreMRPublishMetadata to JSON string for CustomData storage
261
+ */
262
+ export function CoreMRPublishMetadataCustomData_serialize(metadata: CoreMRPublishMetadata): string {
263
+ return toString(0, object([["formId", metadata.FormId] as [string, any], ["formName", metadata.FormName] as [string, any], ["fieldKeyToSequence", object(map_1<[Shared_FieldKey, int32], [string, any]>((tupledArg: [Shared_FieldKey, int32]): [string, any] => ([tupledArg[0].fields[0], tupledArg[1]] as [string, any]), toList<Shared_FieldKey, int32>(metadata.FieldKeyToSequence)))] as [string, any]]));
264
+ }
265
+
266
+ const CoreMRPublishMetadataCustomData_guidDecoder = (path_6: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((value_5: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => oneOf<string>(ofArray([(path_2: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((value_2: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => field_1<string>("Fields", (path_1: string, value_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => index<string>(0, guid, path_1, value_1), path_2, value_2)), (path_5: string): ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>) => ((value_4: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => andThen<string, string>(uncurry3((s: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<string, [string, ErrorReason_$union]>)) => {
267
+ let matchValue: [boolean, string];
268
+ let outArg = "00000000-0000-0000-0000-000000000000";
269
+ matchValue = ([tryParse(s, new FSharpRef<string>((): string => outArg, (v: string): void => {
270
+ outArg = v;
271
+ })), outArg] as [boolean, string]);
272
+ if (matchValue[0]) {
273
+ 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));
274
+ }
275
+ else {
276
+ const msg = `Invalid Guid: ${s}`;
277
+ return (path_4: 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_4, arg20$0040_1));
278
+ }
279
+ }), string, path_5, value_4))]), path_6, value_5));
280
+
281
+ const CoreMRPublishMetadataCustomData_sourceMapFieldAnchorDecoder = (path: string): ((arg0: any) => FSharpResult$2_$union<[Shared_FieldKey, int32], [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<[Shared_FieldKey, int32], [string, ErrorReason_$union]> => object_1<[Shared_FieldKey, int32]>((get$: IGetters): [Shared_FieldKey, int32] => {
282
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter;
283
+ return [new Shared_FieldKey((objectArg = get$.Required, objectArg.Field<string>("FieldKey", uncurry2(CoreMRPublishMetadataCustomData_guidDecoder)))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("Sequence", uncurry2(int)))] as [Shared_FieldKey, int32];
284
+ }, path, v));
285
+
286
+ const CoreMRPublishMetadataCustomData_sourceMapStepDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<FSharpList<[Shared_FieldKey, int32]>, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<FSharpList<[Shared_FieldKey, int32]>, [string, ErrorReason_$union]> => object_1<FSharpList<[Shared_FieldKey, int32]>>((get$: IGetters): FSharpList<[Shared_FieldKey, int32]> => {
287
+ let objectArg: IOptionalGetter;
288
+ return defaultArg((objectArg = get$.Optional, objectArg.Field<FSharpList<[Shared_FieldKey, int32]>>("FieldAnchors", (path: string, value: any): FSharpResult$2_$union<FSharpList<[Shared_FieldKey, int32]>, [string, ErrorReason_$union]> => list_4<[Shared_FieldKey, int32]>(uncurry2(CoreMRPublishMetadataCustomData_sourceMapFieldAnchorDecoder), path, value))), empty<[Shared_FieldKey, int32]>());
289
+ }, path_1, v));
290
+
291
+ const CoreMRPublishMetadataCustomData_sourceMapPayloadDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<[int32, FSharpMap<Shared_FieldKey, int32>], [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<[int32, FSharpMap<Shared_FieldKey, int32>], [string, ErrorReason_$union]> => object_1<[int32, FSharpMap<Shared_FieldKey, int32>]>((get$: IGetters): [int32, FSharpMap<Shared_FieldKey, int32>] => {
292
+ let objectArg: IRequiredGetter, objectArg_1: IOptionalGetter;
293
+ return [(objectArg = get$.Required, objectArg.Field<int32>("FormId", uncurry2(int))), ofList<Shared_FieldKey, int32>(collect<FSharpList<[Shared_FieldKey, int32]>, [Shared_FieldKey, int32]>((x: FSharpList<[Shared_FieldKey, int32]>): FSharpList<[Shared_FieldKey, int32]> => x, defaultArg((objectArg_1 = get$.Optional, objectArg_1.Field<FSharpList<FSharpList<[Shared_FieldKey, int32]>>>("Steps", (path: string, value: any): FSharpResult$2_$union<FSharpList<FSharpList<[Shared_FieldKey, int32]>>, [string, ErrorReason_$union]> => list_4<FSharpList<[Shared_FieldKey, int32]>>(uncurry2(CoreMRPublishMetadataCustomData_sourceMapStepDecoder), path, value))), empty<FSharpList<[Shared_FieldKey, int32]>>())), {
294
+ Compare: compare,
295
+ })] as [int32, FSharpMap<Shared_FieldKey, int32>];
296
+ }, path_1, v));
297
+
298
+ function CoreMRPublishMetadataCustomData_tryDeserializeFromProvenance(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<CoreMRPublishMetadata> {
299
+ return bind<IntegrationProvenance, CoreMRPublishMetadata>((p: IntegrationProvenance): Option<CoreMRPublishMetadata> => {
300
+ let matchValue_1: Option<string>;
301
+ if (p.IntegrationKey !== "coremr") {
302
+ return undefined;
303
+ }
304
+ else {
305
+ try {
306
+ const matchValue: FSharpResult$2_$union<[int32, FSharpMap<Shared_FieldKey, int32>], string> = fromString<[int32, FSharpMap<Shared_FieldKey, int32>]>(uncurry2(CoreMRPublishMetadataCustomData_sourceMapPayloadDecoder), p.Payload);
307
+ if (matchValue.tag === /* Error */ 1) {
308
+ return undefined;
309
+ }
310
+ else {
311
+ const formId: int32 = matchValue.fields[0][0] | 0;
312
+ const fieldKeyToSequence: FSharpMap<Shared_FieldKey, int32> = matchValue.fields[0][1];
313
+ return new CoreMRPublishMetadata(formId, !isNullOrWhiteSpace(formSpec.Title) ? formSpec.Title : ((matchValue_1 = formSpec.Code, (matchValue_1 == null) ? (`CORE-${formId}`) : value_6(matchValue_1))), fieldKeyToSequence);
314
+ }
315
+ }
316
+ catch (matchValue_2: any) {
317
+ return undefined;
318
+ }
319
+ }
320
+ }, formSpec.Provenance);
321
+ }
322
+
323
+ /**
324
+ * Deserialize CoreMRPublishMetadata from CustomData (legacy) or Provenance (current).
325
+ * Provenance is used when form was imported via convertWithMapAndProvenance.
326
+ */
327
+ export function CoreMRPublishMetadataCustomData_tryDeserialize(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<CoreMRPublishMetadata> {
328
+ const matchValue_2: Option<CoreMRPublishMetadata> = bind<string, CoreMRPublishMetadata>((jsonStr: string): Option<CoreMRPublishMetadata> => {
329
+ const matchValue_1: FSharpResult$2_$union<CoreMRPublishMetadata, string> = fromString<CoreMRPublishMetadata>((path_3: string, v_2: any): FSharpResult$2_$union<CoreMRPublishMetadata, [string, ErrorReason_$union]> => object_1<CoreMRPublishMetadata>((get$: IGetters): CoreMRPublishMetadata => {
330
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter;
331
+ return new CoreMRPublishMetadata((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("formName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpMap<Shared_FieldKey, int32>>("fieldKeyToSequence", (path_2: string, value_2: any): FSharpResult$2_$union<FSharpMap<Shared_FieldKey, int32>, [string, ErrorReason_$union]> => map_2<FSharpList<[string, int32]>, FSharpMap<Shared_FieldKey, int32>>((pairs: FSharpList<[string, int32]>): FSharpMap<Shared_FieldKey, int32> => ofList<Shared_FieldKey, int32>(choose<[string, int32], [Shared_FieldKey, int32]>((tupledArg: [string, int32]): Option<[Shared_FieldKey, int32]> => {
332
+ let matchValue: [boolean, string];
333
+ let outArg = "00000000-0000-0000-0000-000000000000";
334
+ matchValue = ([tryParse(tupledArg[0], new FSharpRef<string>((): string => outArg, (v_1: string): void => {
335
+ outArg = v_1;
336
+ })), outArg] as [boolean, string]);
337
+ if (matchValue[0]) {
338
+ return [new Shared_FieldKey(matchValue[1]), tupledArg[1]] as [Shared_FieldKey, int32];
339
+ }
340
+ else {
341
+ return undefined;
342
+ }
343
+ }, pairs), {
344
+ Compare: compare,
345
+ }), (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<[string, int32]>, [string, ErrorReason_$union]> => keyValuePairs<int32>(uncurry2(int), path_1, value_1), path_2, value_2))));
346
+ }, path_3, v_2), jsonStr);
347
+ if (matchValue_1.tag === /* Error */ 1) {
348
+ return undefined;
349
+ }
350
+ else {
351
+ return matchValue_1.fields[0];
352
+ }
353
+ }, bind<FSharpMap<string, string>, string>((customData: FSharpMap<string, string>): Option<string> => tryFind_1<string, string>(CoreMRPublishMetadataCustomData_key, customData), formSpec.CustomData));
354
+ if (matchValue_2 == null) {
355
+ return CoreMRPublishMetadataCustomData_tryDeserializeFromProvenance(formSpec);
356
+ }
357
+ else {
358
+ return value_6(matchValue_2);
359
+ }
360
+ }
361
+
362
+ /**
363
+ * TEMPORARY: Return metadata or fallback when None (gate off for testing).
364
+ * Use when provenance/customData is missing so publish can proceed.
365
+ */
366
+ export function CoreMRPublishMetadataCustomData_tryDeserializeWithFallback(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): CoreMRPublishMetadata {
367
+ return defaultArg(CoreMRPublishMetadataCustomData_tryDeserialize(formSpec), new CoreMRPublishMetadata(1002, isNullOrWhiteSpace(formSpec.Title) ? defaultArg<string>(formSpec.Code, "Unknown") : formSpec.Title, empty_1<Shared_FieldKey, int32>({
368
+ Compare: compare,
369
+ })));
370
+ }
371
+
372
+ //# sourceMappingURL=FormSpecToCoreMRInsert.ts.map
@@ -0,0 +1,92 @@
1
+ import { Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { Option } from "@fable-org/fable-library-js/Option.js";
4
+ import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
+ import { unit_type, lambda_type, union_type, list_type, record_type, option_type, bool_type, int32_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
+ import { FSharpResult$2_Ok, FSharpResult$2, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
7
+ import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FieldType_$union, Spec_FormSpec$1 } from "../../FormSpec.js";
8
+ import { FSharpList } from "@fable-org/fable-library-js/List.js";
9
+ import { printf, toText } from "@fable-org/fable-library-js/String.js";
10
+
11
+ export class FormMetadata extends Record implements IEquatable<FormMetadata>, IComparable<FormMetadata> {
12
+ readonly Title: string;
13
+ readonly Description: string;
14
+ readonly FieldCount: int32;
15
+ readonly HasScoring: boolean;
16
+ readonly HasPathways: boolean;
17
+ readonly Version: Option<string>;
18
+ constructor(Title: string, Description: string, FieldCount: int32, HasScoring: boolean, HasPathways: boolean, Version: Option<string>) {
19
+ super();
20
+ this.Title = Title;
21
+ this.Description = Description;
22
+ this.FieldCount = (FieldCount | 0);
23
+ this.HasScoring = HasScoring;
24
+ this.HasPathways = HasPathways;
25
+ this.Version = Version;
26
+ }
27
+ }
28
+
29
+ export function FormMetadata_$reflection(): TypeInfo {
30
+ return record_type("FormSpec.Integrations.FormSystemAdapter.FormMetadata", [], FormMetadata, () => [["Title", string_type], ["Description", string_type], ["FieldCount", int32_type], ["HasScoring", bool_type], ["HasPathways", bool_type], ["Version", option_type(string_type)]]);
31
+ }
32
+
33
+ export class FormSystemFeatures extends Record implements IEquatable<FormSystemFeatures>, IComparable<FormSystemFeatures> {
34
+ readonly SupportsScoring: boolean;
35
+ readonly SupportsPathways: boolean;
36
+ readonly SupportsValidation: boolean;
37
+ readonly SupportsConditionals: boolean;
38
+ readonly SupportsMultiStep: boolean;
39
+ constructor(SupportsScoring: boolean, SupportsPathways: boolean, SupportsValidation: boolean, SupportsConditionals: boolean, SupportsMultiStep: boolean) {
40
+ super();
41
+ this.SupportsScoring = SupportsScoring;
42
+ this.SupportsPathways = SupportsPathways;
43
+ this.SupportsValidation = SupportsValidation;
44
+ this.SupportsConditionals = SupportsConditionals;
45
+ this.SupportsMultiStep = SupportsMultiStep;
46
+ }
47
+ }
48
+
49
+ export function FormSystemFeatures_$reflection(): TypeInfo {
50
+ return record_type("FormSpec.Integrations.FormSystemAdapter.FormSystemFeatures", [], FormSystemFeatures, () => [["SupportsScoring", bool_type], ["SupportsPathways", bool_type], ["SupportsValidation", bool_type], ["SupportsConditionals", bool_type], ["SupportsMultiStep", bool_type]]);
51
+ }
52
+
53
+ export class FormSystemAdapter$1<TSource> extends Record {
54
+ readonly Name: string;
55
+ readonly ConvertToFormSpec: ((arg0: TSource) => FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>);
56
+ readonly GenerateSemanticReport: ((arg0: TSource) => string);
57
+ readonly ValidateSource: ((arg0: TSource) => FSharpResult$2_$union<void, FSharpList<string>>);
58
+ readonly ExtractMetadata: ((arg0: TSource) => FormMetadata);
59
+ readonly SupportedFeatures: FormSystemFeatures;
60
+ constructor(Name: string, ConvertToFormSpec: ((arg0: TSource) => FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>), GenerateSemanticReport: ((arg0: TSource) => string), ValidateSource: ((arg0: TSource) => FSharpResult$2_$union<void, FSharpList<string>>), ExtractMetadata: ((arg0: TSource) => FormMetadata), SupportedFeatures: FormSystemFeatures) {
61
+ super();
62
+ this.Name = Name;
63
+ this.ConvertToFormSpec = ConvertToFormSpec;
64
+ this.GenerateSemanticReport = GenerateSemanticReport;
65
+ this.ValidateSource = ValidateSource;
66
+ this.ExtractMetadata = ExtractMetadata;
67
+ this.SupportedFeatures = SupportedFeatures;
68
+ }
69
+ }
70
+
71
+ export function FormSystemAdapter$1_$reflection(gen0: TypeInfo): TypeInfo {
72
+ return record_type("FormSpec.Integrations.FormSystemAdapter.FormSystemAdapter`1", [gen0], FormSystemAdapter$1, () => [["Name", string_type], ["ConvertToFormSpec", lambda_type(gen0, union_type("Microsoft.FSharp.Core.FSharpResult`2", [Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection()), list_type(string_type)], FSharpResult$2, () => [[["ResultValue", Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection())]], [["ErrorValue", list_type(string_type)]]]))], ["GenerateSemanticReport", lambda_type(gen0, string_type)], ["ValidateSource", lambda_type(gen0, union_type("Microsoft.FSharp.Core.FSharpResult`2", [unit_type, list_type(string_type)], FSharpResult$2, () => [[["ResultValue", unit_type]], [["ErrorValue", list_type(string_type)]]]))], ["ExtractMetadata", lambda_type(gen0, FormMetadata_$reflection())], ["SupportedFeatures", FormSystemFeatures_$reflection()]]);
73
+ }
74
+
75
+ /**
76
+ * Compose two adapters
77
+ */
78
+ export function AdapterHelpers_compose<a, b>(adapter1: FormSystemAdapter$1<a>, adapter2: FormSystemAdapter$1<b>, transformer: ((arg0: b) => a)): FormSystemAdapter$1<b> {
79
+ return new FormSystemAdapter$1(toText(printf("%s->%s"))(adapter2.Name)(adapter1.Name), (source: b): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> => adapter1.ConvertToFormSpec(transformer(source)), (source_1: b): string => adapter1.GenerateSemanticReport(transformer(source_1)), (source_2: b): FSharpResult$2_$union<void, FSharpList<string>> => adapter1.ValidateSource(transformer(source_2)), (source_3: b): FormMetadata => adapter1.ExtractMetadata(transformer(source_3)), adapter1.SupportedFeatures);
80
+ }
81
+
82
+ /**
83
+ * Create adapter with fallback
84
+ */
85
+ export function AdapterHelpers_withFallback<a>(primary: FormSystemAdapter$1<a>, fallback: FormSystemAdapter$1<a>): FormSystemAdapter$1<a> {
86
+ return new FormSystemAdapter$1(toText(printf("%s-with-fallback"))(primary.Name), (source: a): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> => {
87
+ const matchValue: FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> = primary.ConvertToFormSpec(source);
88
+ return (matchValue.tag === /* Error */ 1) ? fallback.ConvertToFormSpec(source) : FSharpResult$2_Ok<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(matchValue.fields[0]);
89
+ }, primary.GenerateSemanticReport, primary.ValidateSource, primary.ExtractMetadata, primary.SupportedFeatures);
90
+ }
91
+
92
+ //# sourceMappingURL=FormSystemAdapter.ts.map
@@ -0,0 +1,51 @@
1
+ import { isEmpty, map, exists, length, FSharpList, singleton } from "@fable-org/fable-library-js/List.js";
2
+ import { FSharpResult$2_Ok, FSharpResult$2_$union, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
3
+ import { Spec_FieldType_$union, Spec_FormSpec$1 } from "../../../FormSpec.js";
4
+ import { ReactHookFormField, ReactHookFormSchema } from "./ReactHookFormTypes.js";
5
+ import { count } from "@fable-org/fable-library-js/Map.js";
6
+ import { defaultArg } from "@fable-org/fable-library-js/Option.js";
7
+ import { printf, toText, join } from "@fable-org/fable-library-js/String.js";
8
+ import { FormSystemAdapter$1, FormSystemFeatures, FormMetadata } from "../FormSystemAdapter.js";
9
+
10
+ export const adapter: FormSystemAdapter$1<ReactHookFormSchema> = new FormSystemAdapter$1("react-hook-form", (schema: ReactHookFormSchema): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> => FSharpResult$2_Error<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(singleton("React Hook Form conversion not yet implemented. This adapter is a placeholder for future development.")), (schema_1: ReactHookFormSchema): string => (`
11
+ # React Hook Form Schema
12
+
13
+ ## Summary
14
+ React Hook Form semantic report generation is not yet implemented.
15
+
16
+ ## Schema Overview
17
+ - Field Count: ${length<ReactHookFormField>(schema_1.Fields)}
18
+ - Has Validation: ${exists<ReactHookFormField>((f: ReactHookFormField): boolean => {
19
+ if (f.Required) {
20
+ return true;
21
+ }
22
+ else {
23
+ return f.ValidationRules != null;
24
+ }
25
+ }, schema_1.Fields) ? "Yes" : "No"}
26
+ - Default Values: ${count<string, string>(schema_1.DefaultValues)} fields
27
+ - Validation Mode: ${defaultArg(schema_1.ValidationMode, "onSubmit")}
28
+
29
+ ## Fields
30
+ ${join("\n", map<ReactHookFormField, string>((f_1: ReactHookFormField): string => {
31
+ const required: string = f_1.Required ? " *required" : "";
32
+ return toText(printf("- %s (%s)%s"))(f_1.Name)(f_1.Type)(required);
33
+ }, schema_1.Fields))}
34
+
35
+ ## Next Steps
36
+ This is a stub implementation. To complete the adapter:
37
+ 1. Implement field type mapping from React Hook Form to FormSpec
38
+ 2. Handle validation rules conversion (yup, zod, joi, etc.)
39
+ 3. Process default values and initial state
40
+ 4. Map React Hook Form's control flow to FormSpec pathways
41
+ 5. Generate comprehensive semantic reports
42
+
43
+ ## Supported Features (When Implemented)
44
+ - Dynamic field arrays
45
+ - Nested field structures
46
+ - Custom validation
47
+ - Field dependencies
48
+ - Conditional rendering
49
+ `), (schema_2: ReactHookFormSchema): FSharpResult$2_$union<void, FSharpList<string>> => (isEmpty(schema_2.Fields) ? FSharpResult$2_Error<void, FSharpList<string>>(singleton("Schema has no fields defined")) : FSharpResult$2_Ok<void, FSharpList<string>>(undefined)), (schema_3: ReactHookFormSchema): FormMetadata => (new FormMetadata("React Hook Form", "Imported from React Hook Form schema", length<ReactHookFormField>(schema_3.Fields), false, false, undefined)), new FormSystemFeatures(false, false, true, true, false));
50
+
51
+ //# sourceMappingURL=ReactHookFormAdapter.ts.map
@@ -0,0 +1,71 @@
1
+ import { Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { Option } from "@fable-org/fable-library-js/Option.js";
3
+ import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
4
+ import { class_type, list_type, float64_type, int32_type, record_type, option_type, bool_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
5
+ import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
6
+ import { FSharpList } from "@fable-org/fable-library-js/List.js";
7
+ import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
8
+
9
+ export class ReactHookFormField extends Record implements IEquatable<ReactHookFormField>, IComparable<ReactHookFormField> {
10
+ readonly Name: string;
11
+ readonly Type: string;
12
+ readonly Required: boolean;
13
+ readonly DefaultValue: Option<string>;
14
+ readonly ValidationRules: Option<ReactHookFormValidation>;
15
+ constructor(Name: string, Type: string, Required: boolean, DefaultValue: Option<string>, ValidationRules: Option<ReactHookFormValidation>) {
16
+ super();
17
+ this.Name = Name;
18
+ this.Type = Type;
19
+ this.Required = Required;
20
+ this.DefaultValue = DefaultValue;
21
+ this.ValidationRules = ValidationRules;
22
+ }
23
+ }
24
+
25
+ export function ReactHookFormField_$reflection(): TypeInfo {
26
+ return record_type("FormSpec.Integrations.ReactHookForm.ReactHookFormTypes.ReactHookFormField", [], ReactHookFormField, () => [["Name", string_type], ["Type", string_type], ["Required", bool_type], ["DefaultValue", option_type(string_type)], ["ValidationRules", option_type(ReactHookFormValidation_$reflection())]]);
27
+ }
28
+
29
+ export class ReactHookFormValidation extends Record implements IEquatable<ReactHookFormValidation>, IComparable<ReactHookFormValidation> {
30
+ readonly Required: boolean;
31
+ readonly MinLength: Option<int32>;
32
+ readonly MaxLength: Option<int32>;
33
+ readonly Pattern: Option<string>;
34
+ readonly Min: Option<float64>;
35
+ readonly Max: Option<float64>;
36
+ readonly Custom: Option<string>;
37
+ constructor(Required: boolean, MinLength: Option<int32>, MaxLength: Option<int32>, Pattern: Option<string>, Min: Option<float64>, Max: Option<float64>, Custom: Option<string>) {
38
+ super();
39
+ this.Required = Required;
40
+ this.MinLength = MinLength;
41
+ this.MaxLength = MaxLength;
42
+ this.Pattern = Pattern;
43
+ this.Min = Min;
44
+ this.Max = Max;
45
+ this.Custom = Custom;
46
+ }
47
+ }
48
+
49
+ export function ReactHookFormValidation_$reflection(): TypeInfo {
50
+ return record_type("FormSpec.Integrations.ReactHookForm.ReactHookFormTypes.ReactHookFormValidation", [], ReactHookFormValidation, () => [["Required", bool_type], ["MinLength", option_type(int32_type)], ["MaxLength", option_type(int32_type)], ["Pattern", option_type(string_type)], ["Min", option_type(float64_type)], ["Max", option_type(float64_type)], ["Custom", option_type(string_type)]]);
51
+ }
52
+
53
+ export class ReactHookFormSchema extends Record implements IEquatable<ReactHookFormSchema>, IComparable<ReactHookFormSchema> {
54
+ readonly Fields: FSharpList<ReactHookFormField>;
55
+ readonly DefaultValues: FSharpMap<string, string>;
56
+ readonly SubmitHandler: Option<string>;
57
+ readonly ValidationMode: Option<string>;
58
+ constructor(Fields: FSharpList<ReactHookFormField>, DefaultValues: FSharpMap<string, string>, SubmitHandler: Option<string>, ValidationMode: Option<string>) {
59
+ super();
60
+ this.Fields = Fields;
61
+ this.DefaultValues = DefaultValues;
62
+ this.SubmitHandler = SubmitHandler;
63
+ this.ValidationMode = ValidationMode;
64
+ }
65
+ }
66
+
67
+ export function ReactHookFormSchema_$reflection(): TypeInfo {
68
+ return record_type("FormSpec.Integrations.ReactHookForm.ReactHookFormTypes.ReactHookFormSchema", [], ReactHookFormSchema, () => [["Fields", list_type(ReactHookFormField_$reflection())], ["DefaultValues", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, string_type])], ["SubmitHandler", option_type(string_type)], ["ValidationMode", option_type(string_type)]]);
69
+ }
70
+
71
+ //# sourceMappingURL=ReactHookFormTypes.ts.map
@@ -0,0 +1,15 @@
1
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
2
+ import { uncurry2 } from "@fable-org/fable-library-js/Util.js";
3
+ import { array_type, bool_type, int32_type, class_type, option_type, anonRecord_type, string_type } from "@fable-org/fable-library-js/Reflection.js";
4
+ import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
5
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
6
+ import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
7
+
8
+ /**
9
+ * Load and decode templates.json. Path is relative to FormSpec.FS output (Interop/templates.json).
10
+ */
11
+ export function decodeTemplates(json: string): FSharpResult$2_$union<{ $schema: string, coreEmr?: { appVersion: string, schemaRevision: string, schemaVersion: string }, elementTypes: FSharpMap<string, { code: string, textField: string, valueEncoding: string }>, forms: FSharpMap<string, { clinicalHash?: string, cosmeticHash?: string, currentVersionId?: int32, description?: string, encounterTypes?: { dental: boolean, medical: boolean, mental: boolean, other: boolean }, formCode?: string, formCodeSource?: string, formId: int32, hash?: string, isIntake?: boolean, items: { choices: { bitPosition?: int32, choiceId: int32, code?: string, highlight?: int32, score: int32, sequence: int32, text: string }[], code?: string, genderRequired?: string, highlight?: int32, isRequired: boolean, itemId: int32, nestingLevel: int32, sequence: int32, sequenceText?: string, text: string, type: int32, uuid?: string }[], name: string, onceAYear?: boolean, requiresSignature?: boolean, scoring?: { choiceScores: FSharpMap<string, int32>, labels: { min: int32, name: string }[], scoreId: int32, scoreName: string }, structureHash?: string, usage?: string }>, generatedAt?: string, generatedFrom?: string, stats?: { byElementType: FSharpMap<string, int32>, byUsage: FSharpMap<string, int32>, codeExtraction: { bySource: { description: int32, generated: int32, name: int32 }, extracted: int32, generated: int32, regex: string }, totalForms: int32, withCodes: int32, withScoring: int32, withSignature: int32, withSyntheticCodes: int32 }, version: int32 }, string> {
12
+ return fromString<{ $schema: string, coreEmr?: { appVersion: string, schemaRevision: string, schemaVersion: string }, elementTypes: FSharpMap<string, { code: string, textField: string, valueEncoding: string }>, forms: FSharpMap<string, { clinicalHash?: string, cosmeticHash?: string, currentVersionId?: int32, description?: string, encounterTypes?: { dental: boolean, medical: boolean, mental: boolean, other: boolean }, formCode?: string, formCodeSource?: string, formId: int32, hash?: string, isIntake?: boolean, items: { choices: { bitPosition?: int32, choiceId: int32, code?: string, highlight?: int32, score: int32, sequence: int32, text: string }[], code?: string, genderRequired?: string, highlight?: int32, isRequired: boolean, itemId: int32, nestingLevel: int32, sequence: int32, sequenceText?: string, text: string, type: int32, uuid?: string }[], name: string, onceAYear?: boolean, requiresSignature?: boolean, scoring?: { choiceScores: FSharpMap<string, int32>, labels: { min: int32, name: string }[], scoreId: int32, scoreName: string }, structureHash?: string, usage?: string }>, generatedAt?: string, generatedFrom?: string, stats?: { byElementType: FSharpMap<string, int32>, byUsage: FSharpMap<string, int32>, codeExtraction: { bySource: { description: int32, generated: int32, name: int32 }, extracted: int32, generated: int32, regex: string }, totalForms: int32, withCodes: int32, withScoring: int32, withSignature: int32, withSyntheticCodes: int32 }, version: int32 }>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(anonRecord_type(["$schema", string_type], ["coreEmr", option_type(anonRecord_type(["appVersion", string_type], ["schemaRevision", string_type], ["schemaVersion", string_type]))], ["elementTypes", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, anonRecord_type(["code", string_type], ["textField", string_type], ["valueEncoding", string_type])])], ["forms", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, anonRecord_type(["clinicalHash", option_type(string_type)], ["cosmeticHash", option_type(string_type)], ["currentVersionId", option_type(int32_type)], ["description", option_type(string_type)], ["encounterTypes", option_type(anonRecord_type(["dental", bool_type], ["medical", bool_type], ["mental", bool_type], ["other", bool_type]))], ["formCode", option_type(string_type)], ["formCodeSource", option_type(string_type)], ["formId", int32_type], ["hash", option_type(string_type)], ["isIntake", option_type(bool_type)], ["items", array_type(anonRecord_type(["choices", array_type(anonRecord_type(["bitPosition", option_type(int32_type)], ["choiceId", int32_type], ["code", option_type(string_type)], ["highlight", option_type(int32_type)], ["score", int32_type], ["sequence", int32_type], ["text", string_type]))], ["code", option_type(string_type)], ["genderRequired", option_type(string_type)], ["highlight", option_type(int32_type)], ["isRequired", bool_type], ["itemId", int32_type], ["nestingLevel", int32_type], ["sequence", int32_type], ["sequenceText", option_type(string_type)], ["text", string_type], ["type", int32_type], ["uuid", option_type(string_type)]))], ["name", string_type], ["onceAYear", option_type(bool_type)], ["requiresSignature", option_type(bool_type)], ["scoring", option_type(anonRecord_type(["choiceScores", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["labels", array_type(anonRecord_type(["min", int32_type], ["name", string_type]))], ["scoreId", int32_type], ["scoreName", string_type]))], ["structureHash", option_type(string_type)], ["usage", option_type(string_type)])])], ["generatedAt", option_type(string_type)], ["generatedFrom", option_type(string_type)], ["stats", option_type(anonRecord_type(["byElementType", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["byUsage", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["codeExtraction", anonRecord_type(["bySource", anonRecord_type(["description", int32_type], ["generated", int32_type], ["name", int32_type])], ["extracted", int32_type], ["generated", int32_type], ["regex", string_type])], ["totalForms", int32_type], ["withCodes", int32_type], ["withScoring", int32_type], ["withSignature", int32_type], ["withSyntheticCodes", int32_type]))], ["version", int32_type]), undefined, undefined)), json);
13
+ }
14
+
15
+ //# sourceMappingURL=CorEmrTemplates.ts.map