@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
@@ -135,32 +135,36 @@ export class Shared_FieldAnswer extends Record implements IEquatable<Shared_Fiel
135
135
  readonly FieldKey: Shared_FieldKey;
136
136
  readonly Description: string;
137
137
  readonly Value: string;
138
- constructor(FieldKey: Shared_FieldKey, Description: string, Value: string) {
138
+ readonly Documentation: Option<string>;
139
+ constructor(FieldKey: Shared_FieldKey, Description: string, Value: string, Documentation: Option<string>) {
139
140
  super();
140
141
  this.FieldKey = FieldKey;
141
142
  this.Description = Description;
142
143
  this.Value = Value;
144
+ this.Documentation = Documentation;
143
145
  }
144
146
  }
145
147
 
146
148
  export function Shared_FieldAnswer_$reflection(): TypeInfo {
147
- return record_type("F1.Studio.Shared.FieldAnswer", [], Shared_FieldAnswer, () => [["FieldKey", Shared_FieldKey_$reflection()], ["Description", string_type], ["Value", string_type]]);
149
+ return record_type("F1.Studio.Shared.FieldAnswer", [], Shared_FieldAnswer, () => [["FieldKey", Shared_FieldKey_$reflection()], ["Description", string_type], ["Value", string_type], ["Documentation", option_type(string_type)]]);
148
150
  }
149
151
 
150
152
  export class Shared_MatrixAnswer extends Record implements IEquatable<Shared_MatrixAnswer>, IComparable<Shared_MatrixAnswer> {
151
153
  readonly FieldKey: Shared_FieldKey;
152
154
  readonly Description: string;
153
155
  readonly Values: FSharpMap<Shared_MatrixItemKey, string>;
154
- constructor(FieldKey: Shared_FieldKey, Description: string, Values: FSharpMap<Shared_MatrixItemKey, string>) {
156
+ readonly Documentation: Option<string>;
157
+ constructor(FieldKey: Shared_FieldKey, Description: string, Values: FSharpMap<Shared_MatrixItemKey, string>, Documentation: Option<string>) {
155
158
  super();
156
159
  this.FieldKey = FieldKey;
157
160
  this.Description = Description;
158
161
  this.Values = Values;
162
+ this.Documentation = Documentation;
159
163
  }
160
164
  }
161
165
 
162
166
  export function Shared_MatrixAnswer_$reflection(): TypeInfo {
163
- return record_type("F1.Studio.Shared.MatrixAnswer", [], Shared_MatrixAnswer, () => [["FieldKey", Shared_FieldKey_$reflection()], ["Description", string_type], ["Values", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Shared_MatrixItemKey_$reflection(), string_type])]]);
167
+ return record_type("F1.Studio.Shared.MatrixAnswer", [], Shared_MatrixAnswer, () => [["FieldKey", Shared_FieldKey_$reflection()], ["Description", string_type], ["Values", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Shared_MatrixItemKey_$reflection(), string_type])], ["Documentation", option_type(string_type)]]);
164
168
  }
165
169
 
166
170
  export class Shared_PluginDataProperty extends Record implements IEquatable<Shared_PluginDataProperty>, IComparable<Shared_PluginDataProperty> {
@@ -1174,10 +1178,9 @@ export class Spec_FormField$1<FieldType> extends Record implements IEquatable<Sp
1174
1178
  readonly IsOptional: boolean;
1175
1179
  readonly IsDeprecated: boolean;
1176
1180
  readonly NeedsDocumentation: boolean;
1177
- readonly Documentation: Option<string>;
1178
1181
  readonly FieldType: FieldType;
1179
1182
  readonly Value: Option<Shared_FieldValue_$union>;
1180
- constructor(FieldOrder: int32, FieldKey: Shared_FieldKey, Label: string, Notes: Option<string>, DependsOn: Option<Spec_DependsOn>, IsOptional: boolean, IsDeprecated: boolean, NeedsDocumentation: boolean, Documentation: Option<string>, FieldType: FieldType, Value: Option<Shared_FieldValue_$union>) {
1183
+ constructor(FieldOrder: int32, FieldKey: Shared_FieldKey, Label: string, Notes: Option<string>, DependsOn: Option<Spec_DependsOn>, IsOptional: boolean, IsDeprecated: boolean, NeedsDocumentation: boolean, FieldType: FieldType, Value: Option<Shared_FieldValue_$union>) {
1181
1184
  super();
1182
1185
  this.FieldOrder = (FieldOrder | 0);
1183
1186
  this.FieldKey = FieldKey;
@@ -1187,14 +1190,13 @@ export class Spec_FormField$1<FieldType> extends Record implements IEquatable<Sp
1187
1190
  this.IsOptional = IsOptional;
1188
1191
  this.IsDeprecated = IsDeprecated;
1189
1192
  this.NeedsDocumentation = NeedsDocumentation;
1190
- this.Documentation = Documentation;
1191
1193
  this.FieldType = FieldType;
1192
1194
  this.Value = Value;
1193
1195
  }
1194
1196
  }
1195
1197
 
1196
1198
  export function Spec_FormField$1_$reflection(gen0: TypeInfo): TypeInfo {
1197
- return record_type("F1.Studio.Spec.FormField`1", [gen0], Spec_FormField$1, () => [["FieldOrder", int32_type], ["FieldKey", Shared_FieldKey_$reflection()], ["Label", string_type], ["Notes", option_type(string_type)], ["DependsOn", option_type(Spec_DependsOn_$reflection())], ["IsOptional", bool_type], ["IsDeprecated", bool_type], ["NeedsDocumentation", bool_type], ["Documentation", option_type(string_type)], ["FieldType", gen0], ["Value", option_type(Shared_FieldValue_$reflection())]]);
1199
+ return record_type("F1.Studio.Spec.FormField`1", [gen0], Spec_FormField$1, () => [["FieldOrder", int32_type], ["FieldKey", Shared_FieldKey_$reflection()], ["Label", string_type], ["Notes", option_type(string_type)], ["DependsOn", option_type(Spec_DependsOn_$reflection())], ["IsOptional", bool_type], ["IsDeprecated", bool_type], ["NeedsDocumentation", bool_type], ["FieldType", gen0], ["Value", option_type(Shared_FieldValue_$reflection())]]);
1198
1200
  }
1199
1201
 
1200
1202
  export class Spec_FormStep$1<FieldType> extends Record implements IEquatable<Spec_FormStep$1<FieldType>>, IComparable<Spec_FormStep$1<FieldType>> {
@@ -8,7 +8,7 @@ import { newGuid } from "@fable-org/fable-library-js/Guid.js";
8
8
  import { orElse, map as map_1, filter, defaultArg, value as value_2, Option, bind } from "@fable-org/fable-library-js/Option.js";
9
9
  import { isNullOrEmpty, join } from "@fable-org/fable-library-js/String.js";
10
10
  import { map as map_2, toList as toList_1 } from "@fable-org/fable-library-js/Set.js";
11
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
11
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../Thoth.Json/packages/Thoth.Json/Encode.js";
12
12
  import { list_type } from "@fable-org/fable-library-js/Reflection.js";
13
13
  import { tryParse } from "@fable-org/fable-library-js/Double.js";
14
14
  import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
@@ -24,7 +24,7 @@ export function buildFormSpecFromResultStepsMap(details: FormSpecMetadata, steps
24
24
  const stepOrder: int32 = tupledArg_1[0].fields[0] | 0;
25
25
  return new Spec_FormStep$1(stepOrder, `Step ${stepOrder}`, mapIndexed<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Spec_FormField$1<Spec_FieldType_$union>>((i: int32, tupledArg_3: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Spec_FormField$1<Spec_FieldType_$union> => {
26
26
  const fd_1: FieldDetails$1<Spec_FieldType_$union> = tupledArg_3[1];
27
- return new Spec_FormField$1(i + 1, tupledArg_3[0], fd_1.Label, undefined, undefined, false, false, false, undefined, fd_1.FieldType, fd_1.FieldValue);
27
+ return new Spec_FormField$1(i + 1, tupledArg_3[0], fd_1.Label, undefined, undefined, false, false, false, fd_1.FieldType, fd_1.FieldValue);
28
28
  }, sortBy<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], int32>((tupledArg_2: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): int32 => tupledArg_2[1].FieldOrder, toList<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(tupledArg_1[1]), {
29
29
  Compare: comparePrimitives,
30
30
  })));
@@ -560,15 +560,15 @@ export function fieldValueToConditionValue(fieldValue: Shared_FieldValue_$union)
560
560
  export function conditionValueToFieldValue(conditionValue: Shared_ConditionValue_$union, fieldKey: Shared_FieldKey, fieldLabel: string): Shared_FieldValue_$union {
561
561
  switch (conditionValue.tag) {
562
562
  case /* Multiple */ 1:
563
- return Shared_FieldValue_Multiple(map_2<string, Shared_FieldAnswer>((value_1: string): Shared_FieldAnswer => (new Shared_FieldAnswer(fieldKey, fieldLabel, value_1)), conditionValue.fields[0], {
563
+ return Shared_FieldValue_Multiple(map_2<string, Shared_FieldAnswer>((value_1: string): Shared_FieldAnswer => (new Shared_FieldAnswer(fieldKey, fieldLabel, value_1, undefined)), conditionValue.fields[0], {
564
564
  Compare: compare,
565
565
  }));
566
566
  case /* Matrix */ 2:
567
- return Shared_FieldValue_Matrix(new Shared_MatrixAnswer(fieldKey, fieldLabel, conditionValue.fields[0]));
567
+ return Shared_FieldValue_Matrix(new Shared_MatrixAnswer(fieldKey, fieldLabel, conditionValue.fields[0], undefined));
568
568
  case /* PluginData */ 3:
569
569
  return Shared_FieldValue_PluginData(singleton(conditionValue.fields[0]));
570
570
  default:
571
- return Shared_FieldValue_Single(new Shared_FieldAnswer(fieldKey, fieldLabel, conditionValue.fields[0]));
571
+ return Shared_FieldValue_Single(new Shared_FieldAnswer(fieldKey, fieldLabel, conditionValue.fields[0], undefined));
572
572
  }
573
573
  }
574
574
 
@@ -113,30 +113,7 @@ export function updateField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKe
113
113
  if (i_1 === stepIndex) {
114
114
  return new Spec_FormStep$1(step.StepOrder, step.StepLabel, map<Spec_FormField$1<FieldType>, Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): Spec_FormField$1<FieldType> => {
115
115
  if (equals(f.FieldKey, fieldKey)) {
116
- return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, newValue);
117
- }
118
- else {
119
- return f;
120
- }
121
- }, step.Fields));
122
- }
123
- else {
124
- return step;
125
- }
126
- }, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance, spec.Classification);
127
- }
128
-
129
- /**
130
- * Update a single field's Documentation. Returns new FormSpec.
131
- * If stepIndex is None, searches for the field across all steps.
132
- */
133
- export function updateFieldDocumentation<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKey: Shared_FieldKey, newDoc: Option<string>, stepIndexOpt: Option<int32>): Spec_FormSpec$1<FieldType> {
134
- const stepIndex: int32 = ((stepIndexOpt == null) ? defaultArg(findStepIndexForField<FieldType>(spec, fieldKey), 0) : value_1(stepIndexOpt)) | 0;
135
- return new Spec_FormSpec$1(spec.Id, spec.Code, spec.Title, spec.Abstract, spec.Version, spec.FormSpecVersion, mapIndexed<Spec_FormStep$1<FieldType>, Spec_FormStep$1<FieldType>>((i_1: int32, step: Spec_FormStep$1<FieldType>): Spec_FormStep$1<FieldType> => {
136
- if (i_1 === stepIndex) {
137
- return new Spec_FormStep$1(step.StepOrder, step.StepLabel, map<Spec_FormField$1<FieldType>, Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): Spec_FormField$1<FieldType> => {
138
- if (equals(f.FieldKey, fieldKey)) {
139
- return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, newDoc, f.FieldType, f.Value);
116
+ return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, newValue);
140
117
  }
141
118
  else {
142
119
  return f;
@@ -155,7 +132,7 @@ export function updateFieldDocumentation<FieldType>(spec: Spec_FormSpec$1<FieldT
155
132
  */
156
133
  export function fieldToDetails(field: Spec_FormField$1<Spec_FieldType_$union>): FieldDetails$1<Spec_FieldType_$union> {
157
134
  let matchValue: Option<Shared_FieldValue_$union>;
158
- return new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue = field.Value, (matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, "")) : value_1(matchValue)), field.FieldType, optionsFromField(field));
135
+ return new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue = field.Value, (matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, "", undefined)) : value_1(matchValue)), field.FieldType, optionsFromField(field));
159
136
  }
160
137
 
161
138
  /**
@@ -451,7 +451,7 @@ export function Helpers_FormSpecMutators_addFormFieldToStep<UserField>(formStep:
451
451
  export function Helpers_FormSpecMutators_removeFormFieldFromFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
452
452
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
453
453
  if (s.StepOrder === formStepOrder) {
454
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((i: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(i + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), filter<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => (f.FieldOrder !== formField.FieldOrder), s.Fields)));
454
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((i: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(i + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), filter<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => (f.FieldOrder !== formField.FieldOrder), s.Fields)));
455
455
  }
456
456
  else {
457
457
  return s;
@@ -463,7 +463,7 @@ export function Helpers_FormSpecMutators_removeFormFieldFromFormSpec<UserField>(
463
463
  * Inserts a form field at a specific position within a step.
464
464
  */
465
465
  export function Helpers_FormSpecMutators_insertFormFieldToStepAt<UserField>(formStep: Spec_FormStep$1<UserField>, newPositionFieldOrder: int32, fieldKey: Shared_FieldKey): FSharpList<Spec_FormField$1<UserField>> {
466
- return mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), formStep.Fields), formStep.Fields));
466
+ return mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), formStep.Fields), formStep.Fields));
467
467
  }
468
468
 
469
469
  /**
@@ -472,12 +472,12 @@ export function Helpers_FormSpecMutators_insertFormFieldToStepAt<UserField>(form
472
472
  export function Helpers_FormSpecMutators_moveFormFieldUpInFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
473
473
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
474
474
  if (s.StepOrder === formStepOrder) {
475
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.Documentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
475
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
476
476
  if (f.FieldOrder === formField.FieldOrder) {
477
- return new Spec_FormField$1(formField.FieldOrder - 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
477
+ return new Spec_FormField$1(formField.FieldOrder - 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
478
478
  }
479
479
  else if (f.FieldOrder === (formField.FieldOrder - 1)) {
480
- return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
480
+ return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
481
481
  }
482
482
  else {
483
483
  return f;
@@ -498,12 +498,12 @@ export function Helpers_FormSpecMutators_moveFormFieldUpInFormSpec<UserField>(fo
498
498
  export function Helpers_FormSpecMutators_moveFormFieldDownInFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
499
499
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
500
500
  if (s.StepOrder === formStepOrder) {
501
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.Documentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
501
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
502
502
  if (f.FieldOrder === formField.FieldOrder) {
503
- return new Spec_FormField$1(formField.FieldOrder + 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
503
+ return new Spec_FormField$1(formField.FieldOrder + 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
504
504
  }
505
505
  else if (f.FieldOrder === (formField.FieldOrder + 1)) {
506
- return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
506
+ return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
507
507
  }
508
508
  else {
509
509
  return f;
@@ -527,7 +527,7 @@ export function Helpers_FormSpecMutators_moveFieldByKeyToPositionInFormStepSpec<
527
527
  const formStep_1: Spec_FormStep$1<UserField> = value_1(formStep);
528
528
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
529
529
  if (s.StepOrder === formStep_1.StepOrder) {
530
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), List_distinct<Spec_FormField$1<UserField>>(insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), s.Fields), s.Fields), {
530
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), List_distinct<Spec_FormField$1<UserField>>(insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), s.Fields), s.Fields), {
531
531
  Equals: equals,
532
532
  GetHashCode: safeHash,
533
533
  })));
@@ -599,7 +599,7 @@ export function Helpers_FormSpecTransformers_flattenSpecSteps<UserField>(formSpe
599
599
  if (!isEmpty(steps)) {
600
600
  const step: Spec_FormStep$1<UserField> = head(steps);
601
601
  steps_mut = tail(steps);
602
- acc_mut = append(acc, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((field: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1((step.StepOrder * 1000) + field.FieldOrder, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.Documentation, field.FieldType, field.Value)), step.Fields));
602
+ acc_mut = append(acc, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((field: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1((step.StepOrder * 1000) + field.FieldOrder, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value)), step.Fields));
603
603
  continue flatten;
604
604
  }
605
605
  else {
@@ -711,7 +711,7 @@ export function Helpers_readManyValue<FieldType>(fieldKey: Shared_FieldKey, valu
711
711
  export function Helpers_updateSingleFunc(formatter: ((arg0: string) => string), specField: Spec_FormField$1<Spec_FieldType_$union>, newValue: string, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> {
712
712
  let Value: string, matchValue: Option<Shared_FieldOption>;
713
713
  const fieldOptions: FSharpList<Shared_FieldOption> = Helpers_optionsFromSpecField(specField);
714
- const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Single((Value = formatter(newValue), new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === newValue), fieldOptions), (matchValue == null) ? newValue : value_1(matchValue).Description), Value))), specField.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions));
714
+ const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Single((Value = formatter(newValue), new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === newValue), fieldOptions), (matchValue == null) ? newValue : value_1(matchValue).Description), Value, undefined))), specField.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions));
715
715
  const matchValue_1: Option<Shared_FieldKey> = tryFind_1<Shared_FieldKey>((k: Shared_FieldKey): boolean => equals(k, newFieldDetails.Key), map_2<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Shared_FieldKey>((tuple: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Shared_FieldKey => tuple[0], toSeq<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(values)));
716
716
  if (matchValue_1 != null) {
717
717
  const key: Shared_FieldKey = value_1(matchValue_1);
@@ -727,7 +727,7 @@ export function Helpers_updateManyFunc(formatter: ((arg0: string) => string), sp
727
727
  const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Multiple(map_3<string, Shared_FieldAnswer>((v: string): Shared_FieldAnswer => {
728
728
  let matchValue: Option<Shared_FieldOption>;
729
729
  const Value: string = formatter(v);
730
- return new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === v), Helpers_optionsFromSpecField(specField)), (matchValue == null) ? v : value_1(matchValue).Description), Value);
730
+ return new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === v), Helpers_optionsFromSpecField(specField)), (matchValue == null) ? v : value_1(matchValue).Description), Value, undefined);
731
731
  }, newValue, {
732
732
  Compare: compare,
733
733
  })), specField.FieldType, Helpers_specFieldOptionsToValueOptions(Helpers_optionsFromSpecField(specField)));
@@ -124,7 +124,7 @@ export function mapToFormField(formCode: string, stepOrder: int32, item: CoreMRI
124
124
  const fieldType: Spec_FieldType_$union = mapFieldType(item, choices);
125
125
  const mainLabel: string = item.Label.trim();
126
126
  const notesField: Option<string> = isPlusNotesType(item) ? "" : undefined;
127
- return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), mainLabel, notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), undefined, fieldType, undefined);
127
+ return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), mainLabel, notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), fieldType, undefined);
128
128
  }
129
129
 
130
130
  //# sourceMappingURL=CorEMRFieldTypeMapper.ts.map
@@ -15,7 +15,7 @@ export function createSteps(formCode: string, items: FSharpList<CoreMRItem>, cho
15
15
  return mapIndexed<Section, Spec_FormStep$1<Spec_FieldType_$union>>((index: int32, section: Section): Spec_FormStep$1<Spec_FieldType_$union> => (new Spec_FormStep$1(index + 1, section.HeadingLabel, map<CoreMRItem, Spec_FormField$1<Spec_FieldType_$union>>((item: CoreMRItem): Spec_FormField$1<Spec_FieldType_$union> => {
16
16
  const field: Spec_FormField$1<Spec_FieldType_$union> = mapToFormField(formCode, index + 1, item, defaultArg(tryFind<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem), empty<CoreMRChoice>()));
17
17
  if (isNullOrWhiteSpace(field.Label)) {
18
- return new Spec_FormField$1(field.FieldOrder, field.FieldKey, "_(blank)_", field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.Documentation, field.FieldType, field.Value);
18
+ return new Spec_FormField$1(field.FieldOrder, field.FieldKey, "_(blank)_", field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value);
19
19
  }
20
20
  else {
21
21
  return field;
@@ -13,7 +13,7 @@ import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
13
  import { generateNamespacedFieldKey } from "./CorEMRFieldTypeMapper.js";
14
14
  import { nonHeadingItems } from "./CorEMRSectioning.js";
15
15
  import { convertTriggersToSinglePathway } from "./CorEMRTriggerConverter.js";
16
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
16
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
17
17
  import { FSharpResult$2_Ok, FSharpResult$2_$union, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
18
18
  import { FormSpecValidator_validateConversion, ValidationResult } from "./CorEMRFormSpecValidator.js";
19
19
  import { buildReport } from "./CorEMRSemanticReportBuilder.js";
@@ -3,17 +3,17 @@ import { orElse, defaultArg, map, value as value_3, bind, unwrap, Option } from
3
3
  import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
4
4
  import { comparePrimitives, stringHash, uncurry2, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
5
  import { record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
- import { fold, contains, exists, tail, choose, map as map_1, singleton, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
6
+ import { fold, contains, exists, tail, mapIndexed, tryHead, choose, map as map_1, singleton, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
7
7
  import { Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Spec_FormSpec$1, Shared_FieldValue, Shared_FieldAnswer, Shared_PluginDataProperty, Shared_FieldValue_$union, Spec_FormStep$1, Spec_FormField$1, Spec_PluginFieldConfig, Spec_FieldType_$union } from "../../../FormSpec.js";
8
8
  import { split, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
9
9
  import { tryParse } from "@fable-org/fable-library-js/Double.js";
10
10
  import { item } from "@fable-org/fable-library-js/Array.js";
11
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
11
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
12
12
  import { CoreMRStepMap, CoreMRMatrixItemAnchor, CoreMRChoiceAnchor, CoreMRFieldAnchor, CoreMRSourceMap, CoreMRSourceMap_$reflection } from "./CoreMRSourceMap.js";
13
13
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
14
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
14
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
15
15
  import { CoreMRAnswer, CoreMRFormInsertRequest, CoreMRFormInsertRequest_$reflection } from "./FormSpecToCoreMRInsert.js";
16
- import { CaseStrategy_CamelCase } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
16
+ import { CaseStrategy_CamelCase } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
17
17
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
18
18
  import { op_LeftShift, op_BitwiseOr, int64, fromInt32, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
19
19
  import { toList, FSharpSet } from "@fable-org/fable-library-js/Set.js";
@@ -217,6 +217,10 @@ function supportsTextContent(anchor: CoreMRFieldAnchor): boolean {
217
217
  }
218
218
  }
219
219
 
220
+ function supportsOptionalNotes(anchor: CoreMRFieldAnchor): boolean {
221
+ return anchor.Encoding.TextFieldRole === "optional_notes";
222
+ }
223
+
220
224
  function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_FieldOption> {
221
225
  let matchResult: int32, info: Spec_SingleChoiceInfo, info_1: Spec_MultiChoiceInfo;
222
226
  switch (ft.tag) {
@@ -302,7 +306,7 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
302
306
  throw new Error(`🚨 ItemTypeId ${anchor.ItemTypeId} multiple choice field ${anchor.FieldKey} has no choices`);
303
307
  }
304
308
  else {
305
- return singleton(new CoreMRAnswer(anchor.Sequence, computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg_1: [string, int32]): boolean => (tupledArg_1[0] === key), choicesWithBitPos_1)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_4: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_4.OptionKey), tryFind<Shared_FieldOption>((opt_3: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_3.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), undefined));
309
+ return singleton(new CoreMRAnswer(anchor.Sequence, computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg_1: [string, int32]): boolean => (tupledArg_1[0] === key), choicesWithBitPos_1)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_4: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_4.OptionKey), tryFind<Shared_FieldOption>((opt_3: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_3.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), supportsOptionalNotes(anchor) ? bind<Shared_FieldAnswer, string>((fa: Shared_FieldAnswer): Option<string> => fa.Documentation, tryHead<Shared_FieldAnswer>(toList<Shared_FieldAnswer>(answers))) : undefined));
306
310
  }
307
311
  }
308
312
  default:
@@ -316,7 +320,8 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
316
320
  }
317
321
  else {
318
322
  const options_2: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
319
- return choose<CoreMRMatrixItemAnchor, CoreMRAnswer>((rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue_1: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue_1), 0n), undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors);
323
+ const docForFirst: Option<string> = supportsOptionalNotes(anchor) ? matrixAnswer.Documentation : undefined;
324
+ return choose<Option<CoreMRAnswer>, CoreMRAnswer>((x_1: Option<CoreMRAnswer>): Option<CoreMRAnswer> => x_1, mapIndexed<CoreMRMatrixItemAnchor, Option<CoreMRAnswer>>((i: int32, rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue_1: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue_1), 0n), (i === 0) ? docForFirst : undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors));
320
325
  }
321
326
  }
322
327
  case /* PluginData */ 3: {
@@ -371,7 +376,7 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
371
376
  throw new Error(`🚨 No matching choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
372
377
  }
373
378
  else {
374
- return singleton(new CoreMRAnswer(anchor.Sequence, value_3(scoreOpt), undefined));
379
+ return singleton(new CoreMRAnswer(anchor.Sequence, value_3(scoreOpt), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
375
380
  }
376
381
  }
377
382
  case 26:
@@ -404,13 +409,13 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
404
409
  if (isEmpty(bitPositions)) {
405
410
  throw new Error(`🚨 No matching bitmask choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
406
411
  }
407
- return singleton(new CoreMRAnswer(anchor.Sequence, fold<int32, int64>((acc: int64, bit_1: int32): int64 => toInt64(op_BitwiseOr(acc, toInt64(op_LeftShift(1n, bit_1)))), 0n, bitPositions), undefined));
412
+ return singleton(new CoreMRAnswer(anchor.Sequence, fold<int32, int64>((acc: int64, bit_1: int32): int64 => toInt64(op_BitwiseOr(acc, toInt64(op_LeftShift(1n, bit_1)))), 0n, bitPositions), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
408
413
  }
409
414
  }
410
415
  case 30:
411
416
  case 31: {
412
417
  const valStr: string = canonicalizeForYesNo(answer.Value);
413
- return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), supportsTextContent(anchor) ? answer.Value : undefined));
418
+ return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
414
419
  }
415
420
  case 50:
416
421
  case 51:
@@ -12,7 +12,7 @@ import { CoreMRFormData, CoreMRItem, CoreMRChoice, CoreMRTag_$reflection, CoreMR
12
12
  import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
13
  import { detectHeadings, groupItemsByHeadings, Section, HeadingItem } from "./CorEMRSectioning.js";
14
14
  import { convertToFormSpec } from "./CorEMRTemplateToFormSpec.js";
15
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
15
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
16
16
  import { IntegrationProvenance } from "../../../Provenance.js";
17
17
 
18
18
  export class ValueEncodingInfo extends Record implements IEquatable<ValueEncodingInfo>, IComparable<ValueEncodingInfo> {
@@ -9,10 +9,10 @@ import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable
9
9
  import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
10
10
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
11
11
  import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
12
- import { object, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
13
- 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 "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
12
+ import { object, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
13
+ 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 "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
15
- import { ErrorReason_$union } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
15
+ import { ErrorReason_$union } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
16
16
  import { tryParse } from "@fable-org/fable-library-js/Guid.js";
17
17
  import { IntegrationProvenance } from "../../../Provenance.js";
18
18
 
@@ -6,11 +6,11 @@ import { int32ToString, uncurry2, comparePrimitives, IComparable, IEquatable } f
6
6
  import { class_type, list_type, bool_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
7
7
  import { filter, length, sumBy as sumBy_1, empty, collect, map as map_2, isEmpty, FSharpList } from "@fable-org/fable-library-js/List.js";
8
8
  import { toSeq, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
9
- import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
9
+ import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
10
10
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
11
- import { ErrorReason_$union } from "../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
11
+ import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
12
12
  import { isNullOrEmpty, toConsole, printf, toText } from "@fable-org/fable-library-js/String.js";
13
- import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
13
+ import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { CoreMRFormData, CoreMRTag, CoreMRTrigger, CoreMRFormMetadata, CoreMRItem, CoreMRChoice } from "./CoreMRTypes.js";
15
15
  import { sumBy } from "@fable-org/fable-library-js/Seq.js";
16
16