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

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 (141) 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/CoreMREncoder.d.ts.map +1 -1
  6. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
  7. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
  8. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts +106 -0
  9. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts.map +1 -0
  10. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts +105 -0
  11. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts.map +1 -0
  12. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +26 -13
  13. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  14. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +1 -2
  15. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  16. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts +5 -3
  17. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  18. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
  19. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  20. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  21. package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
  22. package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
  24. package/FormSpec.TS/FormSpec.FS/FormSpec.js +13 -8
  25. package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
  27. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +5 -5
  28. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  29. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  30. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -21
  31. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
  32. package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
  33. package/FormSpec.TS/FormSpec.FS/Helpers.js +12 -12
  34. package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
  35. package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
  36. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +1 -1
  37. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
  38. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
  39. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -1
  40. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
  41. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -1
  42. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
  43. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  44. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  45. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +12 -8
  46. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  47. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  48. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +1 -1
  49. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  50. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  51. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +2 -2
  52. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +1 -1
  53. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  54. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js +184 -0
  55. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js.map +1 -0
  56. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts.map +1 -0
  57. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js +752 -0
  58. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -0
  59. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -0
  60. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +317 -81
  61. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  62. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  63. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +5 -10
  64. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  65. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  66. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +20 -10
  67. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  68. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  69. package/FormSpec.TS/FormSpec.FS/Migrator.js +1 -1
  70. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  71. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  72. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +3 -3
  73. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  74. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  75. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js +1 -1
  76. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js.map +1 -1
  77. package/FormSpec.TS/FormSpec.FS/PathwayValidator.ts.map +1 -1
  78. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
  79. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
  80. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
  81. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
  82. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
  83. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
  84. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
  85. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
  86. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  87. package/FormSpec.TS/plugins/signature/src/SignatureField.js +1 -1
  88. package/FormSpec.TS/plugins/signature/src/SignatureField.js.map +1 -1
  89. package/FormSpec.TS/plugins/signature/src/SignatureField.ts.map +1 -1
  90. package/README.md +7 -7
  91. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
  92. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
  93. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
  94. package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
  95. package/package.json +9 -1
  96. package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
  97. package/src/FormSpec.FS/Designer.ts +1 -1
  98. package/src/FormSpec.FS/FormSpec.ts +10 -8
  99. package/src/FormSpec.FS/FormSpecHelpers.ts +5 -5
  100. package/src/FormSpec.FS/FormSpecValues.ts +2 -25
  101. package/src/FormSpec.FS/Helpers.ts +12 -12
  102. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +1 -1
  103. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -1
  104. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
  105. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +14 -9
  106. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +1 -1
  107. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
  108. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +3 -3
  109. package/src/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts +244 -0
  110. package/src/FormSpec.FS/Interop/Facade/FormAnswersGate.ts +508 -0
  111. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +376 -128
  112. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -8
  113. package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +17 -13
  114. package/src/FormSpec.FS/Migrator.ts +1 -1
  115. package/src/FormSpec.FS/PathwayExecutor.ts +3 -3
  116. package/src/FormSpec.FS/PathwayValidator.ts +1 -1
  117. package/src/plugins/signature/src/SignatureField.ts +1 -1
  118. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.js.map +0 -1
  119. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.ts.map +0 -1
  120. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.js.map +0 -1
  121. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.ts.map +0 -1
  122. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.js.map +0 -1
  123. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.ts.map +0 -1
  124. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.js.map +0 -1
  125. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.ts.map +0 -1
  126. package/libs/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +0 -1
  127. package/libs/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +0 -1
  128. package/libs/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +0 -1
  129. package/libs/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +0 -1
  130. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.js +0 -0
  131. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.js +0 -0
  132. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.js +0 -0
  133. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.js +0 -0
  134. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.d.ts +0 -0
  135. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.d.ts +0 -0
  136. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.d.ts +0 -0
  137. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.d.ts +0 -0
  138. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.ts +0 -0
  139. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.ts +0 -0
  140. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.ts +0 -0
  141. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.ts +0 -0
@@ -1,23 +1,25 @@
1
- import { map, unwrap, value as value_19, orElseWith, orElse, defaultArgWith as defaultArgWith_1, Option, defaultArg as defaultArg_1 } from "@fable-org/fable-library-js/Option.js";
2
- import { exists, sortBy, toArray as toArray_1, length as length_1, tryPick, filter, mapIndexed as mapIndexed_1, isEmpty, map as map_3, empty, ofArray as ofArray_1, ofSeq, fold, singleton, collect, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
3
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
4
- import { Spec_SingleChoiceInfo, Spec_ClinicalInstrumentInfo, Spec_FormClassification_$union, ClinicalPathway_StateType_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_AlertSeverity_$union, ClinicalPathway_ReferralUrgency_$union, ClinicalPathway_ActionInfo_$union, ClinicalPathway_NavigateToFormAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_TestAction, ClinicalPathway_DocumentationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_MedicationAction, ClinicalPathway_ReferralAction, Shared_FieldValue, Shared_FieldValue_$union, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_SinglePathway, ClinicalPathway_SinglePathwayConfig, ClinicalPathway_SelectionStrategy_HighestPriority, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, ClinicalPathway_FieldEvaluator_Equals, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Action, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, Shared_StateKey, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Matrix, Spec_MatrixInfo, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Shared_FieldOptionKey, Spec_FieldType_Checkbox, Spec_BooleanInfo, Shared_FieldKey, Shared_FieldOption, Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_Multiple, Shared_FieldAnswer, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Spec_FormSpec$1, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection } from "../FormSpec.js";
5
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
6
- import { comparePrimitives, int32ToString, int64ToString, defaultOf, equals, createObj, stringHash, compare, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2 } from "@fable-org/fable-library-js/Util.js";
1
+ import { map as map_2, bind, unwrap, orElse, value as value_19, orElseWith, defaultArgWith as defaultArgWith_1, Option, defaultArg as defaultArg_1 } from "@fable-org/fable-library-js/Option.js";
2
+ import { exists, sortBy, toArray, length as length_1, tryPick, filter as filter_1, mapIndexed as mapIndexed_2, isEmpty, map as map_3, empty, fold, ofSeq as ofSeq_1, ofArray as ofArray_2, singleton as singleton_1, collect as collect_1, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
3
+ import { int32ToString, int64ToString, stringHash, compare, comparePrimitives, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2, createObj, equals, defaultOf } from "@fable-org/fable-library-js/Util.js";
4
+ import { toText, join, isNullOrWhiteSpace, printf, toConsole, isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
5
+ import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
6
+ import { append, mapIndexed, tryFind as tryFind_1, map, item as item_2 } from "@fable-org/fable-library-js/Array.js";
7
+ import { length, mapIndexed as mapIndexed_1, filter, choose, map as map_1, singleton, collect, delay, toList } from "@fable-org/fable-library-js/Seq.js";
8
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../Thoth.Json/packages/Thoth.Json/Encode.js";
9
+ import { Spec_SingleChoiceInfo, Spec_ClinicalInstrumentInfo, Spec_FormClassification_$union, ClinicalPathway_StateType_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_AlertSeverity_$union, ClinicalPathway_ReferralUrgency_$union, ClinicalPathway_ActionInfo_$union, ClinicalPathway_NavigateToFormAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_TestAction, ClinicalPathway_DocumentationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_MedicationAction, ClinicalPathway_ReferralAction, Shared_FieldValue, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_SinglePathway, ClinicalPathway_SinglePathwayConfig, ClinicalPathway_SelectionStrategy_HighestPriority, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, ClinicalPathway_FieldEvaluator_Equals, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Action, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, Shared_StateKey, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Matrix, Spec_MatrixInfo, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Shared_FieldOptionKey, Spec_FieldType_Checkbox, Spec_BooleanInfo, Shared_FieldKey, Shared_FieldOption, Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_Multiple, Shared_FieldAnswer, Shared_FieldValue_$union, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Spec_FormSpec$1, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection } from "../FormSpec.js";
10
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
7
11
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
8
12
  import { newGuid, parse, tryParse } from "@fable-org/fable-library-js/Guid.js";
9
- import { Union, FSharpRef } from "@fable-org/fable-library-js/Types.js";
13
+ import { toString as toString_1, Union, FSharpRef } from "@fable-org/fable-library-js/Types.js";
10
14
  import { array_type, string_type, obj_type, union_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
11
- import { isNullOrEmpty, toText, join, isNullOrWhiteSpace, printf, toConsole } from "@fable-org/fable-library-js/String.js";
12
- import { array as array_7, at, IOptionalGetter, IGetters, dict as dict_1, string, IRequiredGetter, object, fromString as fromString_1 } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
13
- import { ErrorReason_$union } from "../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
14
- import { tryFind as tryFind_1, empty as empty_2, ofSeq as ofSeq_1, toList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
15
+ import { at, dict as dict_1, IRequiredGetter, array as array_7, IGetters, IOptionalGetter, string, object, fromString as fromString_1 } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
16
+ import { ErrorReason_$union } from "../../Thoth.Json/packages/Thoth.Json/Types.js";
17
+ import { empty as empty_1, fold as fold_1, ofSeq, tryFind as tryFind_2, ofArray, toList as toList_1, FSharpMap } from "@fable-org/fable-library-js/Map.js";
15
18
  import { addToDict } from "@fable-org/fable-library-js/MapUtil.js";
16
- import { int32 } from "@fable-org/fable-library-js/Int32.js";
19
+ import { tryDecodeFieldValueFromObject } from "./Facade/FormAnswersGate.js";
20
+ import { Convert_fieldValueToTs } from "./Facade/BlueprintFilledForm.js";
21
+ import { ofArray as ofArray_1 } from "@fable-org/fable-library-js/Set.js";
17
22
  import { getFieldDetails as getFieldDetails_1, FieldDetails$1, findStepIndexForField, updateField } from "../FormSpecValues.js";
18
- import { length, singleton as singleton_1, empty as empty_1, collect as collect_1, delay, toList as toList_1, mapIndexed, map as map_2, choose } from "@fable-org/fable-library-js/Seq.js";
19
- import { toArray, ofArray } from "@fable-org/fable-library-js/Set.js";
20
- import { tryFind as tryFind_2, append, map as map_1 } from "@fable-org/fable-library-js/Array.js";
21
23
  import { now } from "@fable-org/fable-library-js/DateOffset.js";
22
24
  import { initializeExecution } from "../PathwayExecutor.js";
23
25
  import { List_distinct, distinct } from "@fable-org/fable-library-js/Seq2.js";
@@ -67,13 +69,69 @@ export function listToArray<T>(list: FSharpList<T>): T[] {
67
69
  return Array.from(list);
68
70
  }
69
71
 
70
- /**
71
- * Normalize form values for platform API (f1-api fill_form, etc.).
72
- * Ensures field keys and value shapes are in the format expected by the API.
73
- * TypeScript: normalizeFormValuesForPlatformApi(formValues: Record<string, unknown>) => Record<string, unknown>
74
- */
72
+ function normalizeValue(v: any): any {
73
+ if (v == null) {
74
+ return defaultOf();
75
+ }
76
+ else if (equals(v, "")) {
77
+ return defaultOf();
78
+ }
79
+ else if (typeof v === "string") {
80
+ const s: string = (v as string).trim();
81
+ if (isNullOrEmpty(s)) {
82
+ return defaultOf();
83
+ }
84
+ else {
85
+ return s;
86
+ }
87
+ }
88
+ else if (typeof v === "number") {
89
+ const n = v as float64;
90
+ if (Number.isNaN(n)) {
91
+ return defaultOf();
92
+ }
93
+ else {
94
+ return n;
95
+ }
96
+ }
97
+ else if (typeof v === "boolean") {
98
+ return v;
99
+ }
100
+ else if (Array.isArray(v)) {
101
+ return (function(arr){var c=Array.from(arr).filter(function(x){return x!==''&&x!=null});return c.length>0?c:[]})(v);
102
+ }
103
+ else if (typeof v === 'object' && v !== null && !Array.isArray(v)) {
104
+ const entries: [string, any][] = Object.entries(v);
105
+ let hasValues = false;
106
+ const pairs: [string, any][] = [];
107
+ for (let idx = 0; idx <= (entries.length - 1); idx++) {
108
+ const forLoopVar: [string, any] = item_2(idx, entries);
109
+ const nv: any = forLoopVar[1];
110
+ if (!(nv == null) && !equals(nv, "")) {
111
+ void (pairs.push([forLoopVar[0], nv] as [string, any]));
112
+ hasValues = true;
113
+ }
114
+ }
115
+ if (hasValues) {
116
+ return createObj(toList<[string, any]>(delay<[string, any]>((): Iterable<[string, any]> => collect<[string, any], Iterable<[string, any]>, [string, any]>((matchValue: [string, any]): Iterable<[string, any]> => singleton<[string, any]>([matchValue[0], matchValue[1]] as [string, any]), pairs))));
117
+ }
118
+ else {
119
+ return {};
120
+ }
121
+ }
122
+ else {
123
+ return v;
124
+ }
125
+ }
126
+
75
127
  export function normalizeFormValuesForPlatformApi(formValues: any): any {
76
- return formValues;
128
+ if (formValues == null) {
129
+ return {};
130
+ }
131
+ else {
132
+ const entries: [string, any][] = Object.entries(formValues);
133
+ return createObj(toList<[string, any]>(delay<[string, any]>((): Iterable<[string, any]> => collect<[string, any], Iterable<[string, any]>, [string, any]>((matchValue: [string, any]): Iterable<[string, any]> => singleton<[string, any]>([matchValue[0], normalizeValue(matchValue[1])] as [string, any]), entries))));
134
+ }
77
135
  }
78
136
 
79
137
  export function serializeFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): string {
@@ -100,7 +158,7 @@ export function findFieldByKey(spec: Spec_FormSpec$1<Spec_FieldType_$union>, fie
100
158
  outArg = v;
101
159
  })), outArg] as [boolean, string]);
102
160
  if (matchValue[0]) {
103
- return tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => (field.FieldKey.fields[0] === matchValue[1]), 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, spec.Steps));
161
+ return tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => (field.FieldKey.fields[0] === matchValue[1]), collect_1<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, spec.Steps));
104
162
  }
105
163
  else {
106
164
  return undefined;
@@ -202,21 +260,76 @@ export function getExpectedFieldValueType(fieldType: Spec_FieldType_$union): Exp
202
260
  }
203
261
  }
204
262
 
205
- export function decodeAsString(fieldKey: string, obj: any): string {
206
- let matchValue: FSharpResult$2_$union<string, string>;
207
- const json: string = toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(obj));
208
- matchValue = fromString<string>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(string_type, undefined, undefined)), json);
209
- if (matchValue.tag === /* Error */ 1) {
210
- if (typeof obj === "string") {
211
- const str = obj as string;
212
- return str;
263
+ function decodeAsOptionalDocumentation(obj: any): Option<string> {
264
+ if (obj == null) {
265
+ return undefined;
266
+ }
267
+ else {
268
+ try {
269
+ const matchValue_2: FSharpResult$2_$union<Option<string>, string> = fromString_1<Option<string>>((path_2: string, v_6: any): FSharpResult$2_$union<Option<string>, [string, ErrorReason_$union]> => object<Option<string>>((get$: IGetters): Option<string> => {
270
+ let objectArg: IOptionalGetter;
271
+ return orElseWith<string>((objectArg = get$.Optional, objectArg.Field<string>("documentation", string)), (): Option<string> => {
272
+ const objectArg_1: IOptionalGetter = get$.Optional;
273
+ return objectArg_1.Field<string>("Documentation", string);
274
+ });
275
+ }, path_2, v_6), toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(obj)));
276
+ return (matchValue_2.tag === /* Error */ 1) ? undefined : matchValue_2.fields[0];
213
277
  }
214
- else {
215
- throw new Error(`Field ${fieldKey}: Expected string value, got ${"Object"}`);
278
+ catch (matchValue_3: any) {
279
+ return undefined;
216
280
  }
217
281
  }
282
+ }
283
+
284
+ export function decodeAsString(fieldKey: string, obj: any): string {
285
+ if (typeof obj === "string") {
286
+ return obj;
287
+ }
218
288
  else {
219
- return matchValue.fields[0];
289
+ try {
290
+ const json: string = toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(obj));
291
+ const matchValue_2: FSharpResult$2_$union<Option<string>, string> = fromString_1<Option<string>>((path_2: string, v_4: any): FSharpResult$2_$union<Option<string>, [string, ErrorReason_$union]> => object<Option<string>>((get$: IGetters): Option<string> => {
292
+ let objectArg: IOptionalGetter;
293
+ return orElseWith<string>((objectArg = get$.Optional, objectArg.Field<string>("value", string)), (): Option<string> => {
294
+ const objectArg_1: IOptionalGetter = get$.Optional;
295
+ return objectArg_1.Field<string>("Value", string);
296
+ });
297
+ }, path_2, v_4), json);
298
+ let matchResult: int32;
299
+ if (matchValue_2.tag === /* Ok */ 0) {
300
+ if (matchValue_2.fields[0] != null) {
301
+ matchResult = 0;
302
+ }
303
+ else {
304
+ matchResult = 1;
305
+ }
306
+ }
307
+ else {
308
+ matchResult = 1;
309
+ }
310
+ switch (matchResult) {
311
+ case 0:
312
+ return value_19(matchValue_2.fields[0]);
313
+ default: {
314
+ const matchValue_3: FSharpResult$2_$union<string, string> = fromString<string>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(string_type, undefined, undefined)), json);
315
+ if (matchValue_3.tag === /* Error */ 1) {
316
+ throw new Error(`Field ${fieldKey}: Expected string value, got ${"Object"}`);
317
+ }
318
+ else {
319
+ return matchValue_3.fields[0];
320
+ }
321
+ }
322
+ }
323
+ }
324
+ catch (matchValue_4: any) {
325
+ if (typeof obj === "string") {
326
+ const str_1 = obj as string;
327
+ return str_1;
328
+ }
329
+ else {
330
+ throw new Error(`Field ${fieldKey}: Expected string value, got ${"Object"}`);
331
+ }
332
+ }
220
333
  }
221
334
  }
222
335
 
@@ -233,14 +346,38 @@ export function decodeAsStringArray(fieldKey: string, obj: any): string[] {
233
346
  }
234
347
  else {
235
348
  try {
236
- let matchValue: FSharpResult$2_$union<string[], string>;
237
349
  const json: string = toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(obj));
238
- matchValue = fromString<string[]>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(array_type(string_type), undefined, undefined)), json);
239
- if (matchValue.tag === /* Error */ 1) {
240
- throw new Error(`Field ${fieldKey}: Expected string array, got ${"Object"}`);
350
+ const matchValue: FSharpResult$2_$union<Option<string[]>, string> = fromString_1<Option<string[]>>((path_4: string, v: any): FSharpResult$2_$union<Option<string[]>, [string, ErrorReason_$union]> => object<Option<string[]>>((get$: IGetters): Option<string[]> => {
351
+ let objectArg: IOptionalGetter;
352
+ return orElseWith<string[]>((objectArg = get$.Optional, objectArg.Field<string[]>("values", (path_1: string, value_3: any): FSharpResult$2_$union<string[], [string, ErrorReason_$union]> => array_7<string>(string, path_1, value_3))), (): Option<string[]> => {
353
+ const objectArg_1: IOptionalGetter = get$.Optional;
354
+ return objectArg_1.Field<string[]>("Values", (path_3: string, value_5: any): FSharpResult$2_$union<string[], [string, ErrorReason_$union]> => array_7<string>(string, path_3, value_5));
355
+ });
356
+ }, path_4, v), json);
357
+ let matchResult: int32;
358
+ if (matchValue.tag === /* Ok */ 0) {
359
+ if (matchValue.fields[0] != null) {
360
+ matchResult = 0;
361
+ }
362
+ else {
363
+ matchResult = 1;
364
+ }
241
365
  }
242
366
  else {
243
- return matchValue.fields[0];
367
+ matchResult = 1;
368
+ }
369
+ switch (matchResult) {
370
+ case 0:
371
+ return value_19(matchValue.fields[0]);
372
+ default: {
373
+ const matchValue_1: FSharpResult$2_$union<string[], string> = fromString<string[]>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(array_type(string_type), undefined, undefined)), json);
374
+ if (matchValue_1.tag === /* Error */ 1) {
375
+ throw new Error(`Field ${fieldKey}: Expected string array, got ${"Object"}`);
376
+ }
377
+ else {
378
+ return matchValue_1.fields[0];
379
+ }
380
+ }
244
381
  }
245
382
  }
246
383
  catch (ex: any) {
@@ -265,7 +402,7 @@ export function decodeAsMatrixValue(fieldKey: string, obj: any): { description:
265
402
  const objectArg_1: IRequiredGetter = get$.Required;
266
403
  valuesMap = objectArg_1.Field<FSharpMap<string, string>>("values", uncurry2(arg_7));
267
404
  const valuesDict_1: IMap<string, string> = new Map<string, string>([]);
268
- const enumerator_1: IEnumerator<[string, string]> = getEnumerator(toList<string, string>(valuesMap));
405
+ const enumerator_1: IEnumerator<[string, string]> = getEnumerator(toList_1<string, string>(valuesMap));
269
406
  try {
270
407
  while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
271
408
  const forLoopVar: [string, string] = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -289,7 +426,7 @@ export function decodeAsMatrixValue(fieldKey: string, obj: any): { description:
289
426
  else {
290
427
  const valuesMap_1: FSharpMap<string, string> = matchValue.fields[0];
291
428
  const valuesDict_2: IMap<string, string> = new Map<string, string>([]);
292
- const enumerator_2: IEnumerator<[string, string]> = getEnumerator(toList<string, string>(valuesMap_1));
429
+ const enumerator_2: IEnumerator<[string, string]> = getEnumerator(toList_1<string, string>(valuesMap_1));
293
430
  try {
294
431
  while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
295
432
  const forLoopVar_1: [string, string] = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
@@ -333,9 +470,9 @@ function decodePropertyKey(get$: IGetters): string {
333
470
  const matchValue: Option<string> = orElse(orElseWith<string>((objectArg = get$.Optional, objectArg.Field<string>("PropertyKey", string)), (): Option<string> => {
334
471
  const objectArg_1: IOptionalGetter = get$.Optional;
335
472
  return objectArg_1.Field<string>("propertyKey", string);
336
- }), orElseWith<string>((objectArg_2 = get$.Optional, objectArg_2.Field<string>("PropertyKey", (firstPath: string, firstValue: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => at<string>(singleton("Value"), string, firstPath, firstValue))), (): Option<string> => {
473
+ }), orElseWith<string>((objectArg_2 = get$.Optional, objectArg_2.Field<string>("PropertyKey", (firstPath: string, firstValue: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => at<string>(singleton_1("Value"), string, firstPath, firstValue))), (): Option<string> => {
337
474
  const objectArg_3: IOptionalGetter = get$.Optional;
338
- return objectArg_3.Field<string>("propertyKey", (firstPath_1: string, firstValue_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => at<string>(singleton("Value"), string, firstPath_1, firstValue_1));
475
+ return objectArg_3.Field<string>("propertyKey", (firstPath_1: string, firstValue_1: any): FSharpResult$2_$union<string, [string, ErrorReason_$union]> => at<string>(singleton_1("Value"), string, firstPath_1, firstValue_1));
339
476
  }));
340
477
  let matchResult: int32, s_1: string;
341
478
  if (matchValue != null) {
@@ -391,6 +528,76 @@ export function decodeAsPluginDataArray(fieldKey: string, obj: any): { dataType:
391
528
  }
392
529
  }
393
530
 
531
+ /**
532
+ * Convert flat LLM/wire values to canonical BlueprintFilledFormFieldValueAnswersMap.
533
+ * This is the ONE place flat→canonical conversion exists. LLM produces flat primitives
534
+ * (string, string[], Record, Plugin[]); this function uses the blueprint to determine
535
+ * expected types, decodes the flat values, builds FieldValue DUs, and converts them
536
+ * to canonical ISingleValue/IMultipleValue/IMatrixValue/IPluginDataValue via Convert.fieldValueToTs.
537
+ * Also merges a top-level "documentation" block into per-field values.
538
+ * TypeScript: convertFlatValuesToCanonical(formSpec: FormSpec, flatValues: Record<string, unknown>) => BlueprintFilledFormFieldValueAnswersMap
539
+ */
540
+ export function convertFlatValuesToCanonical(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, flatValues: any): any {
541
+ let matchValue_2: ExpectedFieldValueType_$union, matrixData: { description: string, values: IMap<string, string> };
542
+ if (flatValues == null) {
543
+ return {};
544
+ }
545
+ else {
546
+ const entries: [string, any][] = Object.entries(flatValues);
547
+ const docMap: FSharpMap<string, string> = ofArray<string, string>(map<[string, any], [string, string]>((tupledArg_2: [string, any]): [string, string] => ([tupledArg_2[0], toString_1(tupledArg_2[1])] as [string, string]), defaultArg_1(bind<[string, any], [string, any][]>((tupledArg_1: [string, any]): Option<[string, any][]> => {
548
+ const docObj: any = tupledArg_1[1];
549
+ if (docObj == null) {
550
+ return undefined;
551
+ }
552
+ else {
553
+ return Object.entries(docObj);
554
+ }
555
+ }, tryFind_1<[string, any]>((tupledArg: [string, any]): boolean => (tupledArg[0] === "documentation"), entries)), [])), {
556
+ Compare: comparePrimitives,
557
+ });
558
+ const resultPairs: [string, any][] = [];
559
+ for (let idx = 0; idx <= (entries.length - 1); idx++) {
560
+ const forLoopVar: [string, any] = item_2(idx, entries);
561
+ const rawValue: any = forLoopVar[1];
562
+ const fieldKey: string = forLoopVar[0];
563
+ if (fieldKey === "documentation") {
564
+ }
565
+ else {
566
+ const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec, fieldKey);
567
+ if (matchValue == null) {
568
+ }
569
+ else {
570
+ const field: Spec_FormField$1<Spec_FieldType_$union> = value_19(matchValue);
571
+ try {
572
+ const matchValue_1: Option<Shared_FieldValue_$union> = tryDecodeFieldValueFromObject(rawValue);
573
+ if (matchValue_1 == null) {
574
+ const docOpt: Option<string> = orElseWith<string>(decodeAsOptionalDocumentation(rawValue), (): Option<string> => tryFind_2<string, string>(fieldKey, docMap));
575
+ const canonical_1: any = Convert_fieldValueToTs((matchValue_2 = getExpectedFieldValueType(field.FieldType), (matchValue_2.tag === /* MultipleValues */ 1) ? Shared_FieldValue_Multiple(ofArray_1<Shared_FieldAnswer>(mapIndexed<string, Shared_FieldAnswer>((i: int32, value_1: string): Shared_FieldAnswer => (new Shared_FieldAnswer(field.FieldKey, field.Label, value_1, (i === 0) ? docOpt : undefined)), decodeAsStringArray(fieldKey, rawValue)), {
576
+ Compare: compare,
577
+ })) : ((matchValue_2.tag === /* MatrixValue */ 2) ? ((matrixData = decodeAsMatrixValue(fieldKey, rawValue), Shared_FieldValue_Matrix(new Shared_MatrixAnswer(field.FieldKey, matrixData.description, ofSeq<Shared_MatrixItemKey, string>(map_1<[string, string], [Shared_MatrixItemKey, string]>((kvp: [string, string]): [Shared_MatrixItemKey, string] => ([new Shared_MatrixItemKey(parse(kvp[0])), kvp[1]] as [Shared_MatrixItemKey, string]), matrixData.values), {
578
+ Compare: compare,
579
+ }), docOpt)))) : ((matchValue_2.tag === /* PluginDataValue */ 3) ? Shared_FieldValue_PluginData(ofArray_2<Shared_PluginDataProperty>(map<{ dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }, Shared_PluginDataProperty>((prop: { dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }): Shared_PluginDataProperty => (new Shared_PluginDataProperty(new Shared_PluginPropertyKey(parse(prop.propertyKey)), prop.name, prop.dataType, prop.value, prop.displayName, prop.unit, prop.description)), decodeAsPluginDataArray(fieldKey, rawValue)))) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, decodeAsString(fieldKey, rawValue), docOpt))))));
580
+ void (resultPairs.push([fieldKey, canonical_1] as [string, any]));
581
+ }
582
+ else {
583
+ const canonical: any = Convert_fieldValueToTs(value_19(matchValue_1));
584
+ void (resultPairs.push([fieldKey, canonical] as [string, any]));
585
+ }
586
+ }
587
+ catch (matchValue_3: any) {
588
+ }
589
+ }
590
+ }
591
+ }
592
+ if (resultPairs.length === 0) {
593
+ return {};
594
+ }
595
+ else {
596
+ return createObj(ofSeq_1<[string, any]>(map_1<[string, any], [string, any]>((tupledArg_3: [string, any]): [string, any] => ([tupledArg_3[0], tupledArg_3[1]] as [string, any]), resultPairs)));
597
+ }
598
+ }
599
+ }
600
+
394
601
  export function createFormFieldData(fieldKey: string, objectValue: any): { fieldKey: string, objectValue: any } {
395
602
  return {
396
603
  fieldKey: fieldKey,
@@ -398,36 +605,61 @@ export function createFormFieldData(fieldKey: string, objectValue: any): { field
398
605
  };
399
606
  }
400
607
 
401
- /**
402
- * Build FormSpec with field values applied. Primary API - pathway uses FormSpec directly.
403
- * TypeScript: buildFormSpecWithValues(formSpec: FormSpec, fieldData: FieldInput[]) => FormSpec
404
- */
405
608
  export function buildFormSpecWithValues(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldData: { fieldKey: string, objectValue: any }[]): Spec_FormSpec$1<Spec_FieldType_$union> {
609
+ let collection: Iterable<{ fieldKey: string, objectValue: any }>;
406
610
  return fold<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>], Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, tupledArg: [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]): Spec_FormSpec$1<Spec_FieldType_$union> => {
407
611
  const field_1: Spec_FormField$1<Spec_FieldType_$union> = tupledArg[0];
408
- return defaultArg_1(map<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, field_1.FieldKey, tupledArg[1].FieldValue, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, field_1.FieldKey)), spec);
409
- }, formSpec, ofSeq<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>(choose<{ fieldKey: string, objectValue: any }, [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>((input: { fieldKey: string, objectValue: any }): Option<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]> => {
410
- let matchValue_1: ExpectedFieldValueType_$union, matrixData: { description: string, values: IMap<string, string> }, matchValue_2: Spec_FieldType_$union;
411
- const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec, input.fieldKey);
612
+ return defaultArg_1(map_2<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, field_1.FieldKey, tupledArg[1].FieldValue, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, field_1.FieldKey)), spec);
613
+ }, formSpec, ofSeq_1<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>(choose<{ fieldKey: string, objectValue: any }, [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>((input_1: { fieldKey: string, objectValue: any }): Option<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]> => {
614
+ let matchValue_1: Option<Shared_FieldValue_$union>, matchValue_2: Spec_FieldType_$union;
615
+ const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec, input_1.fieldKey);
412
616
  if (matchValue == null) {
413
- toConsole(`Warning: Field ${input.fieldKey} not found in FormSpec`);
617
+ toConsole(`Warning: Field ${input_1.fieldKey} not found in FormSpec`);
414
618
  return undefined;
415
619
  }
416
620
  else {
417
621
  const field: Spec_FormField$1<Spec_FieldType_$union> = value_19(matchValue);
418
622
  try {
419
- return [field, new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue_1 = getExpectedFieldValueType(field.FieldType), (matchValue_1.tag === /* MultipleValues */ 1) ? Shared_FieldValue_Multiple(ofArray<Shared_FieldAnswer>(map_1<string, Shared_FieldAnswer>((value: string): Shared_FieldAnswer => (new Shared_FieldAnswer(field.FieldKey, field.Label, value)), decodeAsStringArray(input.fieldKey, input.objectValue)), {
420
- Compare: compare,
421
- })) : ((matchValue_1.tag === /* MatrixValue */ 2) ? ((matrixData = decodeAsMatrixValue(input.fieldKey, input.objectValue), Shared_FieldValue_Matrix(new Shared_MatrixAnswer(field.FieldKey, matrixData.description, ofSeq_1<Shared_MatrixItemKey, string>(map_2<[string, string], [Shared_MatrixItemKey, string]>((kvp: [string, string]): [Shared_MatrixItemKey, string] => ([new Shared_MatrixItemKey(parse(kvp[0])), kvp[1]] as [Shared_MatrixItemKey, string]), matrixData.values), {
422
- Compare: compare,
423
- }))))) : ((matchValue_1.tag === /* PluginDataValue */ 3) ? Shared_FieldValue_PluginData(ofArray_1<Shared_PluginDataProperty>(map_1<{ dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }, Shared_PluginDataProperty>((prop: { dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }): Shared_PluginDataProperty => (new Shared_PluginDataProperty(new Shared_PluginPropertyKey(parse(prop.propertyKey)), prop.name, prop.dataType, prop.value, prop.displayName, prop.unit, prop.description)), decodeAsPluginDataArray(input.fieldKey, input.objectValue)))) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, decodeAsString(input.fieldKey, input.objectValue)))))), field.FieldType, (matchValue_2 = field.FieldType, (matchValue_2.tag === /* Radio */ 12) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* SingleChoice */ 13) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Dropdown */ 14) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* MultiChoice */ 15) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* CheckboxList */ 16) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TagList */ 17) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TextAutoComplete */ 18) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Matrix */ 19) ? matchValue_2.fields[0].Options : empty<Shared_FieldOption>())))))))))] as [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>];
623
+ return [field, new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue_1 = tryDecodeFieldValueFromObject(input_1.objectValue), (matchValue_1 == null) ? (() => {
624
+ throw new Error(`Field ${input_1.fieldKey}: Expected canonical discriminated format (with 'kind' tag). Got flat value. Use convertFlatValuesToCanonical() at the boundary to convert flat values before calling buildFormSpecWithValues.`);
625
+ })() : value_19(matchValue_1)), field.FieldType, (matchValue_2 = field.FieldType, (matchValue_2.tag === /* Radio */ 12) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* SingleChoice */ 13) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Dropdown */ 14) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* MultiChoice */ 15) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* CheckboxList */ 16) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TagList */ 17) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TextAutoComplete */ 18) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Matrix */ 19) ? matchValue_2.fields[0].Options : empty<Shared_FieldOption>())))))))))] as [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>];
424
626
  }
425
627
  catch (ex: any) {
426
- toConsole(`Error processing field ${input.fieldKey}: ${ex.message}`);
427
- return undefined;
628
+ toConsole(`Error processing field ${input_1.fieldKey}: ${ex.message}`);
629
+ throw ex;
630
+ }
631
+ }
632
+ }, (collection = filter<{ fieldKey: string, objectValue: any }>((input: { fieldKey: string, objectValue: any }): boolean => {
633
+ if (input.fieldKey !== "documentation") {
634
+ return !input.fieldKey.endsWith("_doc");
635
+ }
636
+ else {
637
+ return false;
638
+ }
639
+ }, fieldData), Array.from(collection)))));
640
+ }
641
+
642
+ /**
643
+ * Build FormSpec with pre-decoded FieldValues (server-side: HTTP decoder already validated).
644
+ * Skips tryDecodeFieldValueFromObject — values are already domain types.
645
+ */
646
+ export function buildFormSpecFromDecodedValues(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldValues: FSharpMap<string, Shared_FieldValue_$union>): Spec_FormSpec$1<Spec_FieldType_$union> {
647
+ return fold_1<string, Shared_FieldValue_$union, Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: string, fieldValue: Shared_FieldValue_$union): Spec_FormSpec$1<Spec_FieldType_$union> => {
648
+ if ((fieldKey === "documentation") ? true : fieldKey.endsWith("_doc")) {
649
+ return spec;
650
+ }
651
+ else {
652
+ const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(spec, fieldKey);
653
+ if (matchValue == null) {
654
+ toConsole(`Warning: Field ${fieldKey} not found in FormSpec`);
655
+ return spec;
656
+ }
657
+ else {
658
+ const field: Spec_FormField$1<Spec_FieldType_$union> = value_19(matchValue);
659
+ return defaultArg_1(map_2<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, field.FieldKey, fieldValue, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, field.FieldKey)), spec);
428
660
  }
429
661
  }
430
- }, fieldData)));
662
+ }, formSpec, fieldValues);
431
663
  }
432
664
 
433
665
  /**
@@ -435,7 +667,7 @@ export function buildFormSpecWithValues(formSpec: Spec_FormSpec$1<Spec_FieldType
435
667
  * TypeScript: createCheckboxField(fieldKey: string, label: string, isOptional: boolean)
436
668
  */
437
669
  export function createCheckboxField(fieldKeyString: string, label: string, isOptional: boolean): Spec_FormField$1<Spec_FieldType_$union> {
438
- return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, isOptional, false, false, undefined, Spec_FieldType_Checkbox(new Spec_BooleanInfo(undefined, undefined)), undefined);
670
+ return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, isOptional, false, false, Spec_FieldType_Checkbox(new Spec_BooleanInfo(undefined, undefined)), undefined);
439
671
  }
440
672
 
441
673
  /**
@@ -443,8 +675,8 @@ export function createCheckboxField(fieldKeyString: string, label: string, isOpt
443
675
  * TypeScript: createCheckboxListField(fieldKey: string, label: string, options: {value: string, description: string, optionKey: string}[])
444
676
  */
445
677
  export function createCheckboxListField(fieldKeyString: string, label: string, options: { description: string, optionKey: string, value: string }[]): Spec_FormField$1<Spec_FieldType_$union> {
446
- const fieldOptions: FSharpList<Shared_FieldOption> = ofSeq<Shared_FieldOption>(mapIndexed<{ description: string, optionKey: string, value: string }, Shared_FieldOption>((_arg: int32, opt: { description: string, optionKey: string, value: string }): Shared_FieldOption => (new Shared_FieldOption(opt.description, opt.value, new Shared_FieldOptionKey(parse(opt.optionKey)), undefined)), options));
447
- return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, undefined, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(fieldOptions)), undefined);
678
+ const fieldOptions: FSharpList<Shared_FieldOption> = ofSeq_1<Shared_FieldOption>(mapIndexed_1<{ description: string, optionKey: string, value: string }, Shared_FieldOption>((_arg: int32, opt: { description: string, optionKey: string, value: string }): Shared_FieldOption => (new Shared_FieldOption(opt.description, opt.value, new Shared_FieldOptionKey(parse(opt.optionKey)), undefined)), options));
679
+ return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(fieldOptions)), undefined);
448
680
  }
449
681
 
450
682
  /**
@@ -452,7 +684,7 @@ export function createCheckboxListField(fieldKeyString: string, label: string, o
452
684
  * TypeScript: createTextField(fieldKey: string, label: string, isOptional: boolean)
453
685
  */
454
686
  export function createTextField(fieldKeyString: string, label: string, isOptional: boolean): Spec_FormField$1<Spec_FieldType_$union> {
455
- return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, isOptional, false, false, undefined, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined);
687
+ return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, isOptional, false, false, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined);
456
688
  }
457
689
 
458
690
  /**
@@ -460,7 +692,7 @@ export function createTextField(fieldKeyString: string, label: string, isOptiona
460
692
  * TypeScript: createFormStep(stepOrder: number, stepLabel: string, fields: FormField[])
461
693
  */
462
694
  export function createFormStep(stepOrder: int32, stepLabel: string, fields: Spec_FormField$1<Spec_FieldType_$union>[]): Spec_FormStep$1<Spec_FieldType_$union> {
463
- return new Spec_FormStep$1(stepOrder, stepLabel, ofSeq<Spec_FormField$1<Spec_FieldType_$union>>(mapIndexed<Spec_FormField$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((index: int32, field: Spec_FormField$1<Spec_FieldType_$union>): Spec_FormField$1<Spec_FieldType_$union> => (new Spec_FormField$1(index + 1, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.Documentation, field.FieldType, field.Value)), fields)));
695
+ return new Spec_FormStep$1(stepOrder, stepLabel, ofSeq_1<Spec_FormField$1<Spec_FieldType_$union>>(mapIndexed_1<Spec_FormField$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((index: int32, field: Spec_FormField$1<Spec_FieldType_$union>): Spec_FormField$1<Spec_FieldType_$union> => (new Spec_FormField$1(index + 1, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value)), fields)));
464
696
  }
465
697
 
466
698
  /**
@@ -468,7 +700,7 @@ export function createFormStep(stepOrder: int32, stepLabel: string, fields: Spec
468
700
  * TypeScript: createFormSpec(id: string, title: string, steps: FormStep[])
469
701
  */
470
702
  export function createFormSpec(idString: string, title: string, steps: Spec_FormStep$1<Spec_FieldType_$union>[]): Spec_FormSpec$1<Spec_FieldType_$union> {
471
- return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
703
+ return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq_1<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
472
704
  }
473
705
 
474
706
  /**
@@ -484,7 +716,7 @@ export function createFieldOption(description: string, value: string, optionKeyS
484
716
  * TypeScript: createMatrixField(fieldKey: string, label: string, items: FieldOption[], options: FieldOption[])
485
717
  */
486
718
  export function createMatrixField(fieldKeyString: string, label: string, items: Shared_FieldOption[], options: Shared_FieldOption[]): Spec_FormField$1<Spec_FieldType_$union> {
487
- return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, undefined, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofSeq<Shared_FieldOption>(items), ofSeq<Shared_FieldOption>(options))), undefined);
719
+ return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofSeq_1<Shared_FieldOption>(items), ofSeq_1<Shared_FieldOption>(options))), undefined);
488
720
  }
489
721
 
490
722
  /**
@@ -492,7 +724,7 @@ export function createMatrixField(fieldKeyString: string, label: string, items:
492
724
  * TypeScript: createPluginField(fieldKey: string, label: string, config: {pluginId: string})
493
725
  */
494
726
  export function createPluginField(fieldKeyString: string, label: string, config: { pluginId: string }): Spec_FormField$1<Spec_FieldType_$union> {
495
- return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, undefined, Spec_FieldType_PluginField(new Spec_PluginFieldConfig(config.pluginId, undefined, undefined)), undefined);
727
+ return new Spec_FormField$1(1, new Shared_FieldKey(parse(fieldKeyString)), label, undefined, undefined, false, false, false, Spec_FieldType_PluginField(new Spec_PluginFieldConfig(config.pluginId, undefined, undefined)), undefined);
496
728
  }
497
729
 
498
730
  /**
@@ -525,8 +757,8 @@ export function createTransition(transitionKeyString: string, fromStateString: s
525
757
  */
526
758
  export function createClinicalPathway(name: string, states: ClinicalPathway_StateDefinition[], transitions: ClinicalPathway_TransitionDefinition[]): ClinicalPathway_ClinicalPathwaySpec {
527
759
  let copyOfStruct: string;
528
- const statesWithOrder: FSharpList<ClinicalPathway_StateDefinition> = ofSeq<ClinicalPathway_StateDefinition>(mapIndexed<ClinicalPathway_StateDefinition, ClinicalPathway_StateDefinition>((index: int32, state: ClinicalPathway_StateDefinition): ClinicalPathway_StateDefinition => (new ClinicalPathway_StateDefinition(state.StateKey, state.StateLabel, index + 1, state.StateType, state.DependsOn)), states));
529
- return new ClinicalPathway_ClinicalPathwaySpec((copyOfStruct = newGuid(), copyOfStruct), name, "1.0.0", "Dynamic Builder", ClinicalPathway_PathwayExecutionMode_SinglePathway(new ClinicalPathway_SinglePathwayConfig(ClinicalPathway_SelectionStrategy_HighestPriority(), true)), new Shared_StateKey("00000000-0000-0000-0000-000000000001"), statesWithOrder, ofSeq<ClinicalPathway_TransitionDefinition>(transitions), empty<ClinicalPathway_ConstraintDefinition>(), empty<ClinicalPathway_PathRequirement>(), now(), undefined, undefined, undefined);
760
+ const statesWithOrder: FSharpList<ClinicalPathway_StateDefinition> = ofSeq_1<ClinicalPathway_StateDefinition>(mapIndexed_1<ClinicalPathway_StateDefinition, ClinicalPathway_StateDefinition>((index: int32, state: ClinicalPathway_StateDefinition): ClinicalPathway_StateDefinition => (new ClinicalPathway_StateDefinition(state.StateKey, state.StateLabel, index + 1, state.StateType, state.DependsOn)), states));
761
+ return new ClinicalPathway_ClinicalPathwaySpec((copyOfStruct = newGuid(), copyOfStruct), name, "1.0.0", "Dynamic Builder", ClinicalPathway_PathwayExecutionMode_SinglePathway(new ClinicalPathway_SinglePathwayConfig(ClinicalPathway_SelectionStrategy_HighestPriority(), true)), new Shared_StateKey("00000000-0000-0000-0000-000000000001"), statesWithOrder, ofSeq_1<ClinicalPathway_TransitionDefinition>(transitions), empty<ClinicalPathway_ConstraintDefinition>(), empty<ClinicalPathway_PathRequirement>(), now(), undefined, undefined, undefined);
530
762
  }
531
763
 
532
764
  /**
@@ -542,7 +774,7 @@ export function addPathwayToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$u
542
774
  * TypeScript: getFieldDataFromFormSpec(formSpec: FormSpec, stepOrder: number, fieldKey: string)
543
775
  */
544
776
  export function getFieldDataFromFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
545
- return map<FieldDetails$1<Spec_FieldType_$union>, any>((fieldDetails: FieldDetails$1<Spec_FieldType_$union>): any => ({
777
+ return map_2<FieldDetails$1<Spec_FieldType_$union>, any>((fieldDetails: FieldDetails$1<Spec_FieldType_$union>): any => ({
546
778
  FieldOrder: fieldDetails.FieldOrder,
547
779
  FieldType: fieldDetails.FieldType,
548
780
  FieldValue: fieldDetails.FieldValue,
@@ -565,7 +797,7 @@ export function getFormResultStepOrders(formSpec: Spec_FormSpec$1<Spec_FieldType
565
797
  * TypeScript: getFormResultFieldKeys(formSpec: FormSpec, stepOrder: number)
566
798
  */
567
799
  export function getFormResultFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, stepOrder: int32): string[] {
568
- return defaultArgWith_1<string[]>(map<Spec_FormStep$1<Spec_FieldType_$union>, string[]>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): string[] => {
800
+ return defaultArgWith_1<string[]>(map_2<Spec_FormStep$1<Spec_FieldType_$union>, string[]>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): string[] => {
569
801
  const collection: FSharpList<string> = map_3<Spec_FormField$1<Spec_FieldType_$union>, string>((f: Spec_FormField$1<Spec_FieldType_$union>): string => f.FieldKey.fields[0], step_1.Fields);
570
802
  return Array.from(collection);
571
803
  }, tryFind<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (step.StepOrder === stepOrder), formSpec.Steps)), (): string[] => []);
@@ -584,7 +816,7 @@ export function getResultSteps(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>)
584
816
  * TypeScript: getFieldValue(formSpec: FormSpec, stepOrder: number, fieldKey: string)
585
817
  */
586
818
  export function getFieldValue(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
587
- return map<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details.FieldValue, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
819
+ return map_2<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details.FieldValue, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
588
820
  }
589
821
 
590
822
  /**
@@ -592,7 +824,7 @@ export function getFieldValue(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>,
592
824
  * TypeScript: getFieldDetails(formSpec: FormSpec, stepOrder: number, fieldKey: string)
593
825
  */
594
826
  export function getFieldDetails(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
595
- return map<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
827
+ return map_2<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
596
828
  }
597
829
 
598
830
  /**
@@ -602,8 +834,8 @@ export function getFieldDetails(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>
602
834
  export function createTestFormSpec(): Spec_FormSpec$1<Spec_FieldType_$union> {
603
835
  const option1: Shared_FieldOption = new Shared_FieldOption("Option 1", "opt1", new Shared_FieldOptionKey(newGuid()), undefined);
604
836
  const option2: Shared_FieldOption = new Shared_FieldOption("Option 2", "opt2", new Shared_FieldOptionKey(newGuid()), undefined);
605
- const testStep: Spec_FormStep$1<Spec_FieldType_$union> = new Spec_FormStep$1(1, "Test Step", ofArray_1([new Spec_FormField$1(1, new Shared_FieldKey("11111111-1111-1111-1111-111111111111"), "Test Text Field", undefined, undefined, false, false, false, undefined, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined), new Spec_FormField$1(2, new Shared_FieldKey("22222222-2222-2222-2222-222222222222"), "Test Checkbox List", undefined, undefined, false, false, false, undefined, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(ofArray_1([option1, option2]))), undefined), new Spec_FormField$1(3, new Shared_FieldKey("33333333-3333-3333-3333-333333333333"), "Test Matrix", undefined, undefined, false, false, false, undefined, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofArray_1([option1, option2]), ofArray_1([new Shared_FieldOption("Scale 1", "1", new Shared_FieldOptionKey(newGuid()), 1), new Shared_FieldOption("Scale 2", "2", new Shared_FieldOptionKey(newGuid()), 2)]))), undefined), new Spec_FormField$1(4, new Shared_FieldKey("44444444-4444-4444-4444-444444444444"), "Test Plugin Field", undefined, undefined, false, false, false, undefined, Spec_FieldType_PluginField(new Spec_PluginFieldConfig("test.plugin", undefined, undefined)), undefined)]));
606
- return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton(testStep), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
837
+ const testStep: Spec_FormStep$1<Spec_FieldType_$union> = new Spec_FormStep$1(1, "Test Step", ofArray_2([new Spec_FormField$1(1, new Shared_FieldKey("11111111-1111-1111-1111-111111111111"), "Test Text Field", undefined, undefined, false, false, false, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined), new Spec_FormField$1(2, new Shared_FieldKey("22222222-2222-2222-2222-222222222222"), "Test Checkbox List", undefined, undefined, false, false, false, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(ofArray_2([option1, option2]))), undefined), new Spec_FormField$1(3, new Shared_FieldKey("33333333-3333-3333-3333-333333333333"), "Test Matrix", undefined, undefined, false, false, false, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofArray_2([option1, option2]), ofArray_2([new Shared_FieldOption("Scale 1", "1", new Shared_FieldOptionKey(newGuid()), 1), new Shared_FieldOption("Scale 2", "2", new Shared_FieldOptionKey(newGuid()), 2)]))), undefined), new Spec_FormField$1(4, new Shared_FieldKey("44444444-4444-4444-4444-444444444444"), "Test Plugin Field", undefined, undefined, false, false, false, Spec_FieldType_PluginField(new Spec_PluginFieldConfig("test.plugin", undefined, undefined)), undefined)]));
838
+ return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton_1(testStep), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
607
839
  }
608
840
 
609
841
  /**
@@ -637,6 +869,24 @@ export function getFieldTypeInfo(field: Spec_FormField$1<Spec_FieldType_$union>)
637
869
  };
638
870
  }
639
871
 
872
+ /**
873
+ * Get BooleanInfo from a Checkbox field. Returns null for non-Checkbox fields.
874
+ * TypeScript: getFieldBooleanInfo(field: FormField) => { defaultValue?: boolean, selection?: boolean } | null
875
+ */
876
+ export function getFieldBooleanInfo(field: Spec_FormField$1<Spec_FieldType_$union>): any {
877
+ const matchValue: Spec_FieldType_$union = field.FieldType;
878
+ if (matchValue.tag === /* Checkbox */ 11) {
879
+ const info: Spec_BooleanInfo = matchValue.fields[0];
880
+ return {
881
+ defaultValue: unwrap(info.DefaultValue),
882
+ selection: unwrap(info.Selection),
883
+ };
884
+ }
885
+ else {
886
+ return defaultOf();
887
+ }
888
+ }
889
+
640
890
  /**
641
891
  * Extract plugin field config (PluginId, optional items/options) for PluginField types.
642
892
  * TypeScript: getPluginFieldConfig(field: FormField) => {pluginId: string, items?: ..., options?: ...} | null
@@ -647,14 +897,14 @@ export function getPluginFieldConfig(field: Spec_FormField$1<Spec_FieldType_$uni
647
897
  if (matchValue.tag === /* PluginField */ 23) {
648
898
  const config: Spec_PluginFieldConfig = matchValue.fields[0];
649
899
  return {
650
- items: unwrap(map<FSharpList<Shared_FieldOption>, { key: string, label: string }[]>((items: FSharpList<Shared_FieldOption>): { key: string, label: string }[] => {
900
+ items: unwrap(map_2<FSharpList<Shared_FieldOption>, { key: string, label: string }[]>((items: FSharpList<Shared_FieldOption>): { key: string, label: string }[] => {
651
901
  const collection: FSharpList<{ key: string, label: string }> = map_3<Shared_FieldOption, { key: string, label: string }>((item: Shared_FieldOption): { key: string, label: string } => ({
652
902
  key: item.OptionKey.fields[0],
653
903
  label: item.Description,
654
904
  }), items);
655
905
  return Array.from(collection);
656
906
  }, config.Items)),
657
- options: unwrap(map<FSharpList<Shared_FieldOption>, { description: string, key: string, value: string }[]>((opts: FSharpList<Shared_FieldOption>): { description: string, key: string, value: string }[] => {
907
+ options: unwrap(map_2<FSharpList<Shared_FieldOption>, { description: string, key: string, value: string }[]>((opts: FSharpList<Shared_FieldOption>): { description: string, key: string, value: string }[] => {
658
908
  const collection_1: FSharpList<{ description: string, key: string, value: string }> = map_3<Shared_FieldOption, { description: string, key: string, value: string }>((opt: Shared_FieldOption): { description: string, key: string, value: string } => ({
659
909
  description: opt.Description,
660
910
  key: opt.OptionKey.fields[0],
@@ -813,11 +1063,11 @@ export function getFieldMatrixInfoFromValue(field: Spec_FormField$1<Spec_FieldTy
813
1063
  }
814
1064
  switch (matchResult) {
815
1065
  case 0: {
816
- const itemKeys: FSharpList<string> = toList_1<string>(distinct<string>(map_2<[Shared_MatrixItemKey, string], string>((kvp: [Shared_MatrixItemKey, string]): string => kvp[0].fields[0], ma!.Values), {
1066
+ const itemKeys: FSharpList<string> = toList<string>(distinct<string>(map_1<[Shared_MatrixItemKey, string], string>((kvp: [Shared_MatrixItemKey, string]): string => kvp[0].fields[0], ma!.Values), {
817
1067
  Equals: (x: string, y: string): boolean => (x === y),
818
1068
  GetHashCode: stringHash,
819
1069
  }));
820
- const optionValues: FSharpList<string> = toList_1<string>(distinct<string>(map_2<[Shared_MatrixItemKey, string], string>((kvp_1: [Shared_MatrixItemKey, string]): string => kvp_1[1], ma!.Values), {
1070
+ const optionValues: FSharpList<string> = toList<string>(distinct<string>(map_1<[Shared_MatrixItemKey, string], string>((kvp_1: [Shared_MatrixItemKey, string]): string => kvp_1[1], ma!.Values), {
821
1071
  Equals: (x_1: string, y_1: string): boolean => (x_1 === y_1),
822
1072
  GetHashCode: stringHash,
823
1073
  }));
@@ -826,11 +1076,11 @@ export function getFieldMatrixInfoFromValue(field: Spec_FormField$1<Spec_FieldTy
826
1076
  }
827
1077
  else {
828
1078
  return {
829
- items: (collection = mapIndexed_1<string, { key: string, label: string }>((i: int32, k: string): { key: string, label: string } => ({
1079
+ items: (collection = mapIndexed_2<string, { key: string, label: string }>((i: int32, k: string): { key: string, label: string } => ({
830
1080
  key: k,
831
1081
  label: k,
832
1082
  }), itemKeys), Array.from(collection)),
833
- options: (collection_1 = mapIndexed_1<string, { description: string, key: string, value: string }>((i_1: int32, v: string): { description: string, key: string, value: string } => ({
1083
+ options: (collection_1 = mapIndexed_2<string, { description: string, key: string, value: string }>((i_1: int32, v: string): { description: string, key: string, value: string } => ({
834
1084
  description: v,
835
1085
  key: v,
836
1086
  value: v,
@@ -839,7 +1089,7 @@ export function getFieldMatrixInfoFromValue(field: Spec_FormField$1<Spec_FieldTy
839
1089
  }
840
1090
  }
841
1091
  case 1: {
842
- const likertProps: FSharpList<Shared_PluginDataProperty> = filter<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name !== "TotalScore"), props!);
1092
+ const likertProps: FSharpList<Shared_PluginDataProperty> = filter_1<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name !== "TotalScore"), props!);
843
1093
  const itemKeys_1: FSharpList<string> = List_distinct<string>(map_3<Shared_PluginDataProperty, string>((p_1: Shared_PluginDataProperty): string => p_1.Name, likertProps), {
844
1094
  Equals: (x_2: string, y_2: string): boolean => (x_2 === y_2),
845
1095
  GetHashCode: stringHash,
@@ -853,11 +1103,11 @@ export function getFieldMatrixInfoFromValue(field: Spec_FormField$1<Spec_FieldTy
853
1103
  }
854
1104
  else {
855
1105
  return {
856
- items: (collection_2 = mapIndexed_1<string, { key: string, label: string }>((i_2: int32, k_1: string): { key: string, label: string } => ({
1106
+ items: (collection_2 = mapIndexed_2<string, { key: string, label: string }>((i_2: int32, k_1: string): { key: string, label: string } => ({
857
1107
  key: k_1,
858
1108
  label: k_1,
859
1109
  }), itemKeys_1), Array.from(collection_2)),
860
- options: (collection_3 = mapIndexed_1<string, { description: string, key: string, value: string }>((i_3: int32, v_1: string): { description: string, key: string, value: string } => ({
1110
+ options: (collection_3 = mapIndexed_2<string, { description: string, key: string, value: string }>((i_3: int32, v_1: string): { description: string, key: string, value: string } => ({
861
1111
  description: v_1,
862
1112
  key: v_1,
863
1113
  value: v_1,
@@ -880,44 +1130,42 @@ export function getFieldKeyString(fieldKey: Shared_FieldKey): string {
880
1130
 
881
1131
  /**
882
1132
  * Extract form values from a FormSpec that has embedded field values (e.g. from f1-api filled form).
883
- * Walks the FormSpec and reads field.Value (Shared.FieldValue DU) directly - no JSON/Thoth format guessing.
884
- * TypeScript: extractFormValuesFromFormSpec(formSpec: FormSpec) => Record<string, any>
1133
+ * Walks the FormSpec and reads field.Value (Shared.FieldValue DU) directly.
1134
+ * Returns canonical BlueprintFilledFormFieldValueAnswersMap every value is ISingleValue | IMultipleValue | IMatrixValue | IPluginDataValue.
1135
+ * TypeScript: extractFormValuesFromFormSpec(formSpec: FormSpec) => BlueprintFilledFormFieldValueAnswersMap
885
1136
  */
886
1137
  export function extractFormValuesFromFormSpec(spec: Spec_FormSpec$1<Spec_FieldType_$union>): any {
887
- const pairs: FSharpList<[string, any]> = toList_1<[string, any]>(delay<[string, any]>((): Iterable<[string, any]> => collect_1<Spec_FormStep$1<Spec_FieldType_$union>, Iterable<[string, any]>, [string, any]>((step: Spec_FormStep$1<Spec_FieldType_$union>): Iterable<[string, any]> => collect_1<Spec_FormField$1<Spec_FieldType_$union>, Iterable<[string, any]>, [string, any]>((field: Spec_FormField$1<Spec_FieldType_$union>): Iterable<[string, any]> => {
888
- let arr: string[], ma: Shared_MatrixAnswer, dict: IMap<string, string>, enumerator: IEnumerator<[Shared_MatrixItemKey, string]>, arr_1: FSharpList<any>;
889
- const matchValue: Option<Shared_FieldValue_$union> = field.Value;
890
- if (matchValue == null) {
891
- return empty_1<[string, any]>();
892
- }
893
- else {
894
- const fv: Shared_FieldValue_$union = value_19(matchValue);
895
- return singleton_1<[string, any]>([getFieldKeyString(field.FieldKey), (fv.tag === /* Multiple */ 1) ? ((arr = map_1<Shared_FieldAnswer, string>((fa_1: Shared_FieldAnswer): string => fa_1.Value, toArray<Shared_FieldAnswer>(fv.fields[0])), Array.from(arr))) : ((fv.tag === /* Matrix */ 2) ? ((ma = fv.fields[0], (dict = (new Map<string, string>([])), ((enumerator = getEnumerator(ma.Values), (() => {
896
- try {
897
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
898
- const kvp: [Shared_MatrixItemKey, string] = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
899
- addToDict(dict, kvp[0].fields[0], kvp[1]);
1138
+ const valuePairs: [string, any][] = [];
1139
+ const enumerator: IEnumerator<Spec_FormStep$1<Spec_FieldType_$union>> = getEnumerator(spec.Steps);
1140
+ try {
1141
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1142
+ const enumerator_1: IEnumerator<Spec_FormField$1<Spec_FieldType_$union>> = getEnumerator(enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]().Fields);
1143
+ try {
1144
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
1145
+ const field: Spec_FormField$1<Spec_FieldType_$union> = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
1146
+ const keyStr: string = getFieldKeyString(field.FieldKey);
1147
+ const matchValue: Option<Shared_FieldValue_$union> = field.Value;
1148
+ if (matchValue == null) {
1149
+ }
1150
+ else {
1151
+ const value: any = Convert_fieldValueToTs(value_19(matchValue));
1152
+ void (valuePairs.push([keyStr, value] as [string, any]));
900
1153
  }
901
1154
  }
902
- finally {
903
- disposeSafe(enumerator as IDisposable);
904
- }
905
- })()), dict)))) : ((fv.tag === /* PluginData */ 3) ? ((arr_1 = map_3<Shared_PluginDataProperty, any>((p: Shared_PluginDataProperty): any => ({
906
- dataType: p.DataType,
907
- description: unwrap(p.Description),
908
- displayName: unwrap(p.DisplayName),
909
- name: p.Name,
910
- propertyKey: p.PropertyKey.fields[0],
911
- unit: unwrap(p.Unit),
912
- value: p.Value,
913
- }), fv.fields[0]), Array.from(arr_1))) : fv.fields[0].Value))] as [string, any]);
1155
+ }
1156
+ finally {
1157
+ disposeSafe(enumerator_1 as IDisposable);
1158
+ }
914
1159
  }
915
- }, step.Fields), spec.Steps)));
916
- if (isEmpty(pairs)) {
1160
+ }
1161
+ finally {
1162
+ disposeSafe(enumerator as IDisposable);
1163
+ }
1164
+ if (valuePairs.length === 0) {
917
1165
  return {};
918
1166
  }
919
1167
  else {
920
- return createObj(map_3<[string, any], [string, any]>((tupledArg: [string, any]): [string, any] => ([tupledArg[0], tupledArg[1]] as [string, any]), pairs));
1168
+ return createObj(ofSeq_1<[string, any]>(map_1<[string, any], [string, any]>((tupledArg: [string, any]): [string, any] => ([tupledArg[0], tupledArg[1]] as [string, any]), valuePairs)));
921
1169
  }
922
1170
  }
923
1171
 
@@ -1023,7 +1271,7 @@ export function convertActionInfo(action: ClinicalPathway_ActionInfo_$union): an
1023
1271
  case /* Problem */ 8: {
1024
1272
  const prob: ClinicalPathway_ProblemAction = action.fields[0];
1025
1273
  return {
1026
- description: `${prob.ProblemName}${defaultArg_1(map<string, string>((code: string): string => (` (ICD: ${code})`), prob.IcdCode), "")}`,
1274
+ description: `${prob.ProblemName}${defaultArg_1(map_2<string, string>((code: string): string => (` (ICD: ${code})`), prob.IcdCode), "")}`,
1027
1275
  icdCode: unwrap(prob.IcdCode),
1028
1276
  problemName: prob.ProblemName,
1029
1277
  type: "problem",
@@ -1285,7 +1533,7 @@ export function tryEncodeToFormAnswers(provenancePayload: string, filledFormSpec
1285
1533
  * This is the SOURCE OF TRUTH for field counting!
1286
1534
  */
1287
1535
  export function getAllFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): string[] {
1288
- return toArray_1<string>(map_3<Spec_FormField$1<Spec_FieldType_$union>, string>((field: Spec_FormField$1<Spec_FieldType_$union>): string => getFieldKeyString(field.FieldKey), 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, formSpec.Steps)));
1536
+ return toArray<string>(map_3<Spec_FormField$1<Spec_FieldType_$union>, string>((field: Spec_FormField$1<Spec_FieldType_$union>): string => getFieldKeyString(field.FieldKey), collect_1<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, formSpec.Steps)));
1289
1537
  }
1290
1538
 
1291
1539
  /**
@@ -1298,7 +1546,7 @@ export function getFieldChoiceScoreSignal(fieldAnchor: Option<CoreMRFieldAnchor>
1298
1546
  return 0;
1299
1547
  }
1300
1548
  else {
1301
- return length_1<CoreMRChoiceAnchor>(filter<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => (compare_1(c.Score, 0n) > 0), value_19(fieldAnchor).Choices)) | 0;
1549
+ return length_1<CoreMRChoiceAnchor>(filter_1<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => (compare_1(c.Score, 0n) > 0), value_19(fieldAnchor).Choices)) | 0;
1302
1550
  }
1303
1551
  }
1304
1552
 
@@ -1315,7 +1563,7 @@ export function getFieldBitmaskChoiceTable(fieldAnchor: Option<CoreMRFieldAnchor
1315
1563
  const collection: FSharpList<{ bitPosition?: string, code?: string, score: string, sequence: int32, text: string }> = map_3<CoreMRChoiceAnchor, { bitPosition?: string, code?: string, score: string, sequence: int32, text: string }>((choice: CoreMRChoiceAnchor): { bitPosition?: string, code?: string, score: string, sequence: int32, text: string } => {
1316
1564
  const score: string = int64ToString(choice.Score);
1317
1565
  return {
1318
- bitPosition: unwrap(map<int32, string>(int32ToString, choice.BitPosition)),
1566
+ bitPosition: unwrap(map_2<int32, string>(int32ToString, choice.BitPosition)),
1319
1567
  code: unwrap(choice.Code),
1320
1568
  score: score,
1321
1569
  sequence: choice.Sequence,
@@ -1345,7 +1593,7 @@ export function getBitmaskChoiceAnalysis(fieldAnchor: Option<CoreMRFieldAnchor>)
1345
1593
  else {
1346
1594
  const anchor: CoreMRFieldAnchor = value_19(fieldAnchor);
1347
1595
  const totalChoices: int32 = length_1(anchor.Choices) | 0;
1348
- const scoredChoices: int32 = length_1<CoreMRChoiceAnchor>(filter<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => (compare_1(c.Score, 0n) > 0), anchor.Choices)) | 0;
1596
+ const scoredChoices: int32 = length_1<CoreMRChoiceAnchor>(filter_1<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => (compare_1(c.Score, 0n) > 0), anchor.Choices)) | 0;
1349
1597
  const hasBitPositions: boolean = exists<CoreMRChoiceAnchor>((c_1: CoreMRChoiceAnchor): boolean => (c_1.BitPosition != null), anchor.Choices);
1350
1598
  return {
1351
1599
  fieldTypeInfo: toText(printf("CoreMR ItemType %d (%s)"))(anchor.ItemTypeId)(anchor.Encoding.ValueEncoding),
@@ -1381,7 +1629,7 @@ export function getFieldCoreMRAnchor(formSpec: Spec_FormSpec$1<Spec_FieldType_$u
1381
1629
  case 0:
1382
1630
  try {
1383
1631
  const matchValue_1: FSharpResult$2_$union<CoreMRSourceMap, string> = fromString<CoreMRSourceMap>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(CoreMRSourceMap_$reflection(), undefined, undefined)), provenance_1!.Payload);
1384
- return (matchValue_1.tag === /* Error */ 1) ? undefined : tryFind<CoreMRFieldAnchor>((anchor: CoreMRFieldAnchor): boolean => (getFieldKeyString(anchor.FieldKey) === fieldKeyString), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, matchValue_1.fields[0].Steps));
1632
+ return (matchValue_1.tag === /* Error */ 1) ? undefined : tryFind<CoreMRFieldAnchor>((anchor: CoreMRFieldAnchor): boolean => (getFieldKeyString(anchor.FieldKey) === fieldKeyString), collect_1<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, matchValue_1.fields[0].Steps));
1385
1633
  }
1386
1634
  catch (matchValue_2: any) {
1387
1635
  return undefined;
@@ -1398,15 +1646,15 @@ export function getFieldCoreMRAnchor(formSpec: Spec_FormSpec$1<Spec_FieldType_$u
1398
1646
  */
1399
1647
  export function getFullValidationTelemetry(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, values: any): any {
1400
1648
  let dict: any;
1401
- const valuesDict: FSharpMap<string, any> = empty_2<string, any>({
1649
+ const valuesDict: FSharpMap<string, any> = empty_1<string, any>({
1402
1650
  Compare: comparePrimitives,
1403
1651
  });
1404
- const fieldTelemetry: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }[] = toArray_1<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>(map_3<Spec_FormField$1<Spec_FieldType_$union>, { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>((field: Spec_FormField$1<Spec_FieldType_$union>): { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean } => {
1652
+ const fieldTelemetry: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }[] = toArray<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>(map_3<Spec_FormField$1<Spec_FieldType_$union>, { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>((field: Spec_FormField$1<Spec_FieldType_$union>): { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean } => {
1405
1653
  let matchValue_2: Spec_FieldType_$union;
1406
1654
  const fieldKey: string = getFieldKeyString(field.FieldKey);
1407
1655
  const fieldLabel: string = isNullOrEmpty(field.Label) ? fieldKey : field.Label;
1408
1656
  const fieldTypeInfo: { isRequired: boolean, typeName: string } = getFieldTypeInfo(field);
1409
- const fieldValue: Option<any> = tryFind_1<string, any>(fieldKey, valuesDict);
1657
+ const fieldValue: Option<any> = tryFind_2<string, any>(fieldKey, valuesDict);
1410
1658
  let patternInput: [boolean, any[], string[], string[]];
1411
1659
  const matchValue: Spec_FieldType_$union = field.FieldType;
1412
1660
  let matchResult: int32, info_2: Spec_SingleChoiceInfo;
@@ -1439,18 +1687,18 @@ export function getFullValidationTelemetry(formSpec: Spec_FormSpec$1<Spec_FieldT
1439
1687
  }
1440
1688
  switch (matchResult) {
1441
1689
  case 0: {
1442
- const expected: string[] = toArray_1<string>(map_3<Shared_FieldOption, string>((opt: Shared_FieldOption): string => opt.Value, matchValue.fields[0].Options));
1690
+ const expected: string[] = toArray<string>(map_3<Shared_FieldOption, string>((opt: Shared_FieldOption): string => opt.Value, matchValue.fields[0].Options));
1443
1691
  patternInput = ([true, [], expected, expected] as [boolean, any[], string[], string[]]);
1444
1692
  break;
1445
1693
  }
1446
1694
  case 1: {
1447
1695
  const info_1: Spec_MatrixInfo = matchValue.fields[0];
1448
- const expected_1: string[] = append<string>(toArray_1<string>(map_3<Shared_FieldOption, string>((item: Shared_FieldOption): string => item.Value, info_1.Items)), toArray_1<string>(map_3<Shared_FieldOption, string>((opt_1: Shared_FieldOption): string => opt_1.Value, info_1.Options)));
1696
+ const expected_1: string[] = append<string>(toArray<string>(map_3<Shared_FieldOption, string>((item: Shared_FieldOption): string => item.Value, info_1.Items)), toArray<string>(map_3<Shared_FieldOption, string>((opt_1: Shared_FieldOption): string => opt_1.Value, info_1.Options)));
1449
1697
  patternInput = ([true, [], expected_1, expected_1] as [boolean, any[], string[], string[]]);
1450
1698
  break;
1451
1699
  }
1452
1700
  case 2: {
1453
- const expected_2: string[] = toArray_1<string>(map_3<Shared_FieldOption, string>((opt_2: Shared_FieldOption): string => opt_2.Value, info_2!.Options));
1701
+ const expected_2: string[] = toArray<string>(map_3<Shared_FieldOption, string>((opt_2: Shared_FieldOption): string => opt_2.Value, info_2!.Options));
1454
1702
  patternInput = ([true, [], expected_2, expected_2] as [boolean, any[], string[], string[]]);
1455
1703
  break;
1456
1704
  }
@@ -1528,7 +1776,7 @@ export function getFullValidationTelemetry(formSpec: Spec_FormSpec$1<Spec_FieldT
1528
1776
  structureIssues: patternInput[1],
1529
1777
  structureValid: patternInput[0],
1530
1778
  };
1531
- }, 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, formSpec.Steps)));
1779
+ }, collect_1<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, formSpec.Steps)));
1532
1780
  const totalFields: int32 = fieldTelemetry.length | 0;
1533
1781
  let validFields: int32;
1534
1782
  const array_1: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }[] = fieldTelemetry.filter((f: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }): boolean => f.dataValid);
@@ -1546,7 +1794,7 @@ export function getFullValidationTelemetry(formSpec: Spec_FormSpec$1<Spec_FieldT
1546
1794
  estimatedTimeToComplete: (dataIssues_1 === 0) ? "Complete" : ((dataIssues_1 <= 2) ? "1-2 minutes" : "3-5 minutes"),
1547
1795
  fields: fieldTelemetry,
1548
1796
  formValid: (dataIssues_1 === 0) && (structuralIssues === 0),
1549
- nextCriticalAction: defaultArg_1(map<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }, string>((f_4: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }): string => f_4.actionHint, tryFind_2<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>((f_3: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }): boolean => !f_3.dataValid, fieldTelemetry)), ""),
1797
+ nextCriticalAction: defaultArg_1(map_2<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }, string>((f_4: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }): string => f_4.actionHint, tryFind_1<{ actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }>((f_3: { actionHint: string, actualChoices: string[], actualValue: string, dataIssues: string[], dataValid: boolean, expectedChoices: string[], expectedValue: string, fieldKey: string, fieldLabel: string, fieldType: string, severity: string, structureIssues: any[], structureValid: boolean }): boolean => !f_3.dataValid, fieldTelemetry)), ""),
1550
1798
  overallStatus: overallStatus,
1551
1799
  progressPercent: progressPercent,
1552
1800
  structuralIssues: structuralIssues,