@f1studio/form-spec 5.0.0-alpha.102 → 5.0.0-alpha.104

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 (82) hide show
  1. package/FormSpec.TS/Designer.js +2 -2
  2. package/FormSpec.TS/Designer.js.map +1 -1
  3. package/FormSpec.TS/Designer.ts.map +1 -1
  4. package/FormSpec.TS/FormSpec.js +235 -178
  5. package/FormSpec.TS/FormSpec.js.map +1 -1
  6. package/FormSpec.TS/FormSpec.ts.map +1 -1
  7. package/FormSpec.TS/FormSpecHelpers.js +62 -40
  8. package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
  9. package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
  10. package/FormSpec.TS/FormSpecValues.js +207 -0
  11. package/FormSpec.TS/FormSpecValues.js.map +1 -0
  12. package/FormSpec.TS/FormSpecValues.ts.map +1 -0
  13. package/FormSpec.TS/Helpers.js +26 -25
  14. package/FormSpec.TS/Helpers.js.map +1 -1
  15. package/FormSpec.TS/Helpers.ts.map +1 -1
  16. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
  17. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  18. package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  19. package/FormSpec.TS/Interop/FormSpec.Api.Option.js +40 -19
  20. package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
  21. package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
  22. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
  23. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  24. package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  25. package/FormSpec.TS/PathwayDataExtractor.js +4 -19
  26. package/FormSpec.TS/PathwayDataExtractor.js.map +1 -1
  27. package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -1
  28. package/FormSpec.TS/PathwayExecutor.js +371 -125
  29. package/FormSpec.TS/PathwayExecutor.js.map +1 -1
  30. package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
  31. package/FormSpec.TS/PathwayValidator.js +14 -26
  32. package/FormSpec.TS/PathwayValidator.js.map +1 -1
  33. package/FormSpec.TS/PathwayValidator.ts.map +1 -1
  34. package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
  35. package/FormSpec.TS/Renderers/MermaidRenderer.js +8 -5
  36. package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -1
  37. package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -1
  38. package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
  39. package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
  40. package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
  41. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
  42. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
  43. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  44. package/FormSpec.d.ts +67 -56
  45. package/FormSpec.d.ts.map +1 -1
  46. package/FormSpecHelpers.d.ts +18 -12
  47. package/FormSpecHelpers.d.ts.map +1 -1
  48. package/FormSpecValues.d.ts +62 -0
  49. package/FormSpecValues.d.ts.map +1 -0
  50. package/Helpers.d.ts +11 -10
  51. package/Helpers.d.ts.map +1 -1
  52. package/Interop/FormSpec.Api.Helpers.d.ts +26 -30
  53. package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  54. package/Interop/FormSpec.Api.Option.d.ts +11 -8
  55. package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  56. package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
  57. package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  58. package/PathwayDataExtractor.d.ts +1 -2
  59. package/PathwayDataExtractor.d.ts.map +1 -1
  60. package/PathwayExecutor.d.ts +63 -33
  61. package/PathwayExecutor.d.ts.map +1 -1
  62. package/PathwayValidator.d.ts.map +1 -1
  63. package/README.md +18 -7
  64. package/Renderers/FormSpecMarkdownRenderer.d.ts +3 -2
  65. package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
  66. package/Renderers/MermaidRenderer.d.ts.map +1 -1
  67. package/Renderers/PathwayRenderers.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/src/Designer.ts +2 -2
  70. package/src/FormSpec.ts +145 -109
  71. package/src/FormSpecHelpers.ts +71 -48
  72. package/src/FormSpecValues.ts +158 -0
  73. package/src/Helpers.ts +52 -51
  74. package/src/Interop/FormSpec.Api.Helpers.ts +113 -150
  75. package/src/Interop/FormSpec.Api.Option.ts +37 -23
  76. package/src/Interop/FormSpec.Values.Api.Option.ts +156 -129
  77. package/src/PathwayDataExtractor.ts +6 -17
  78. package/src/PathwayExecutor.ts +431 -154
  79. package/src/PathwayValidator.ts +17 -23
  80. package/src/Renderers/FormSpecMarkdownRenderer.ts +6 -5
  81. package/src/Renderers/MermaidRenderer.ts +19 -16
  82. package/src/Renderers/PathwayRenderers.ts +37 -29
@@ -2,15 +2,17 @@ import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
2
2
  import { Converters_scoreFromTS, Converters_scoreToTS, Converters_fieldOptionFromTS, Converters_fieldTypeFromTS, Converters_fieldOptionToTS, Converters_fieldTypeToTS, Converters_fieldKeyFromTS, Converters_fieldKeyToTS, Types_ScoreTS_$reflection, Types_ScoreTS, Types_FieldOptionTS_$reflection, Types_FieldTypeTS_$reflection, Types_FieldOptionTS, Types_FieldTypeTS, Types_MatrixItemKeyTS_$reflection, Types_MatrixItemKeyTS, Types_FieldKeyTS_$reflection, Types_FieldKeyTS } from "./FormSpec.Api.Option.js";
3
3
  import { uncurry2, comparePrimitives, compare, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
4
4
  import { obj_type, bool_type, enum_type, int32_type, option_type, array_type, tuple_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
5
- import { some, map as map_3, value as value_2, Option } from "@fable-org/fable-library-js/Option.js";
5
+ import { bind, defaultArgWith, some, map as map_3, value as value_2, Option } from "@fable-org/fable-library-js/Option.js";
6
6
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
7
- import { Values_DynamicFormResultData$1, Values_DynamicForm$1, Values_StepOrder, Values_DynamicFormSpecDetails, Spec_Score, Values_Signature, Values_SignatureType_Approval, Values_SignatureType_Review, Values_SignatureType_$union, Values_FormStatus_Complete, Values_FormStatus_WaitingForApproval, Values_FormStatus_WaitingForReview, Values_FormStatus_Draft, Values_FormStatus_Pending, Values_FormStatus_$union, Spec_FieldType_$union, Values_FieldDetails$1, Shared_FieldOption, Shared_FieldValue_Matrix, Shared_FieldValue_Multiple, Shared_FieldValue_Single, Shared_FieldValue_$union, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldKey, Shared_FieldAnswer } from "../FormSpec.js";
8
- import { fold as fold_1, reverse, empty as empty_2, cons, FSharpList, map as map_1, toArray } from "@fable-org/fable-library-js/List.js";
7
+ import { Values_DynamicForm$1, Spec_FormSpec$1, Values_StepOrder, Spec_Score, Values_Signature, Values_SignatureType_Approval, Values_SignatureType_Review, Values_SignatureType_$union, Values_FormStatus_Complete, Values_FormStatus_WaitingForApproval, Values_FormStatus_WaitingForReview, Values_FormStatus_Draft, Values_FormStatus_Pending, Values_FormStatus_$union, Spec_FieldType_$union, Shared_FieldOption, Shared_FieldValue_Matrix, Shared_FieldValue_Multiple, Shared_FieldValue_Single, Shared_FieldValue_$union, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldKey, Shared_FieldAnswer } from "../FormSpec.js";
8
+ import { fold as fold_1, tryHead, reverse, empty as empty_2, cons, FSharpList, map as map_1, toArray } from "@fable-org/fable-library-js/List.js";
9
9
  import { empty, add, FSharpMap, toList } from "@fable-org/fable-library-js/Map.js";
10
10
  import { fold, map as map_2 } from "@fable-org/fable-library-js/Array.js";
11
11
  import { tryParse } from "@fable-org/fable-library-js/Guid.js";
12
12
  import { ofArray, empty as empty_1, add as add_1, FSharpSet, toList as toList_1 } from "@fable-org/fable-library-js/Set.js";
13
+ import { resultStepsMapToFormSpec, formSpecToResultStepsMap, formSpecToMetadata, FormSpecMetadata, FieldDetails$1 } from "../FormSpecValues.js";
13
14
  import { tryParse as tryParse_1, minValue, toString } from "@fable-org/fable-library-js/Date.js";
15
+ import { buildFormSpecFromResultStepsMap } from "../FormSpecHelpers.js";
14
16
  import { Auto_generateBoxedEncoder_437914C6, toString as toString_1 } from "../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
15
17
  import { FSharpResult$2_$union, Result_ToOption } from "@fable-org/fable-library-js/Result.js";
16
18
  import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
@@ -408,14 +410,14 @@ export function ValuesConverters_fieldValueFromTS(value: ValuesTypes_FieldValueT
408
410
  /**
409
411
  * Convert F# FieldDetails to TypeScript representation
410
412
  */
411
- export function ValuesConverters_fieldDetailsToTS(details: Values_FieldDetails$1<Spec_FieldType_$union>): ValuesTypes_FieldDetailsTS {
413
+ export function ValuesConverters_fieldDetailsToTS(details: FieldDetails$1<Spec_FieldType_$union>): ValuesTypes_FieldDetailsTS {
412
414
  return new ValuesTypes_FieldDetailsTS(details.FieldOrder, Converters_fieldKeyToTS(details.Key), details.Label, ValuesConverters_fieldValueToTS(details.FieldValue), Converters_fieldTypeToTS(details.FieldType), toArray<Types_FieldOptionTS>(map_1<Shared_FieldOption, Types_FieldOptionTS>(Converters_fieldOptionToTS, details.Options)));
413
415
  }
414
416
 
415
417
  /**
416
418
  * Convert TypeScript FieldDetails to F# representation
417
419
  */
418
- export function ValuesConverters_fieldDetailsFromTS(details: ValuesTypes_FieldDetailsTS): Option<Values_FieldDetails$1<Spec_FieldType_$union>> {
420
+ export function ValuesConverters_fieldDetailsFromTS(details: ValuesTypes_FieldDetailsTS): Option<FieldDetails$1<Spec_FieldType_$union>> {
419
421
  const matchValue: Option<Shared_FieldKey> = Converters_fieldKeyFromTS(details.Key);
420
422
  const matchValue_1: Option<Shared_FieldValue_$union> = ValuesConverters_fieldValueFromTS(details.FieldValue);
421
423
  const matchValue_2: Option<Spec_FieldType_$union> = Converters_fieldTypeFromTS(details.FieldType);
@@ -467,7 +469,7 @@ export function ValuesConverters_fieldDetailsFromTS(details: ValuesTypes_FieldDe
467
469
  return undefined;
468
470
  }
469
471
  else {
470
- return new Values_FieldDetails$1(details.FieldOrder, key!, details.Label, fieldValue!, fieldType!, reverse<Shared_FieldOption>(value_2(options)));
472
+ return new FieldDetails$1(details.FieldOrder, key!, details.Label, fieldValue!, fieldType!, reverse<Shared_FieldOption>(value_2(options)));
471
473
  }
472
474
  }
473
475
  default:
@@ -605,20 +607,20 @@ export function ValuesConverters_signatureFromTS(signature: ValuesTypes_Signatur
605
607
  }
606
608
 
607
609
  /**
608
- * Convert F# DynamicStepValues to TypeScript representation
610
+ * Convert F# ResultStepValues to TypeScript representation
609
611
  */
610
- export function ValuesConverters_dynamicStepValuesToTS(stepValues: FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>): [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][] {
611
- return toArray<[Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]>(map_1<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>], [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]>((tupledArg: [Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]): [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS] => ([Converters_fieldKeyToTS(tupledArg[0]), ValuesConverters_fieldDetailsToTS(tupledArg[1])] as [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]), toList<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>(stepValues)));
612
+ export function ValuesConverters_dynamicStepValuesToTS(stepValues: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][] {
613
+ return toArray<[Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]>(map_1<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]>((tupledArg: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS] => ([Converters_fieldKeyToTS(tupledArg[0]), ValuesConverters_fieldDetailsToTS(tupledArg[1])] as [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]), toList<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(stepValues)));
612
614
  }
613
615
 
614
616
  /**
615
617
  * Convert TypeScript DynamicStepValues to F# representation
616
618
  */
617
- export function ValuesConverters_dynamicStepValuesFromTS(stepValues: [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]): Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>> {
618
- const array_1: Option<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]>[] = map_2<[Types_FieldKeyTS, ValuesTypes_FieldDetailsTS], Option<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]>>((tupledArg: [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]): Option<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]> => {
619
+ export function ValuesConverters_dynamicStepValuesFromTS(stepValues: [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]): Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> {
620
+ const array_1: Option<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]>[] = map_2<[Types_FieldKeyTS, ValuesTypes_FieldDetailsTS], Option<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]>>((tupledArg: [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS]): Option<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]> => {
619
621
  const matchValue: Option<Shared_FieldKey> = Converters_fieldKeyFromTS(tupledArg[0]);
620
- const matchValue_1: Option<Values_FieldDetails$1<Spec_FieldType_$union>> = ValuesConverters_fieldDetailsFromTS(tupledArg[1]);
621
- let matchResult: int32, details: Values_FieldDetails$1<Spec_FieldType_$union>, key: Shared_FieldKey;
622
+ const matchValue_1: Option<FieldDetails$1<Spec_FieldType_$union>> = ValuesConverters_fieldDetailsFromTS(tupledArg[1]);
623
+ let matchResult: int32, details: FieldDetails$1<Spec_FieldType_$union>, key: Shared_FieldKey;
622
624
  if (matchValue != null) {
623
625
  if (matchValue_1 != null) {
624
626
  matchResult = 0;
@@ -634,13 +636,13 @@ export function ValuesConverters_dynamicStepValuesFromTS(stepValues: [Types_Fiel
634
636
  }
635
637
  switch (matchResult) {
636
638
  case 0:
637
- return [key!, details!] as [Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>];
639
+ return [key!, details!] as [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>];
638
640
  default:
639
641
  return undefined;
640
642
  }
641
643
  }, stepValues);
642
- return fold<Option<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]>, Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>>((acc: Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>, item: Option<[Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>]>): Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>> => {
643
- let matchResult_1: int32, details_1: Values_FieldDetails$1<Spec_FieldType_$union>, key_1: Shared_FieldKey, map: FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>;
644
+ return fold<Option<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]>, Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>((acc: Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>, item: Option<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]>): Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> => {
645
+ let matchResult_1: int32, details_1: FieldDetails$1<Spec_FieldType_$union>, key_1: Shared_FieldKey, map: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>;
644
646
  if (acc != null) {
645
647
  if (item != null) {
646
648
  matchResult_1 = 0;
@@ -657,78 +659,34 @@ export function ValuesConverters_dynamicStepValuesFromTS(stepValues: [Types_Fiel
657
659
  }
658
660
  switch (matchResult_1) {
659
661
  case 0:
660
- return add<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>(key_1!, details_1!, map!);
662
+ return add<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(key_1!, details_1!, map!);
661
663
  default:
662
664
  return undefined;
663
665
  }
664
- }, empty<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>({
666
+ }, empty<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>({
665
667
  Compare: compare,
666
668
  }), array_1);
667
669
  }
668
670
 
669
671
  /**
670
- * Convert F# DynamicFormSpecDetails to TypeScript representation
672
+ * Convert F# FormSpecMetadata to TypeScript representation (legacy DynamicFormSpecDetails shape)
671
673
  */
672
- export function ValuesConverters_dynamicFormSpecDetailsToTS(details: Values_DynamicFormSpecDetails): ValuesTypes_DynamicFormSpecDetailsTS {
673
- return new ValuesTypes_DynamicFormSpecDetailsTS(details.FormSpecId, details.FormSpecCode, details.FormSpecVersion, details.DynamicVersion, map_3<Spec_Score, Types_ScoreTS>(Converters_scoreToTS, details.MaxScore), ValuesConverters_formStatusToTS(details.Status), toArray<ValuesTypes_SignatureTS>(map_1<Values_Signature, ValuesTypes_SignatureTS>(ValuesConverters_signatureToTS, details.Signatures)));
674
+ export function ValuesConverters_dynamicFormSpecDetailsToTS(details: FormSpecMetadata): ValuesTypes_DynamicFormSpecDetailsTS {
675
+ return new ValuesTypes_DynamicFormSpecDetailsTS(details.FormSpecId, details.FormSpecCode, details.FormSpecVersion, details.DynamicVersion, map_3<Spec_Score, Types_ScoreTS>(Converters_scoreToTS, details.MaxScore), new ValuesTypes_FormStatusTS("Pending", undefined), []);
674
676
  }
675
677
 
676
678
  /**
677
- * Convert TypeScript DynamicFormSpecDetails to F# representation
679
+ * Convert TypeScript DynamicFormSpecDetails to F# FormSpecMetadata (for buildFormSpecFromResultStepsMap)
678
680
  */
679
- export function ValuesConverters_dynamicFormSpecDetailsFromTS(details: ValuesTypes_DynamicFormSpecDetailsTS): Option<Values_DynamicFormSpecDetails> {
681
+ export function ValuesConverters_dynamicFormSpecDetailsFromTS(details: ValuesTypes_DynamicFormSpecDetailsTS): Option<FormSpecMetadata> {
682
+ let matchValue_1: Option<Types_ScoreTS>;
680
683
  let matchValue: [boolean, string];
681
684
  let outArg = "00000000-0000-0000-0000-000000000000";
682
685
  matchValue = ([tryParse(details.FormSpecId, new FSharpRef<string>((): string => outArg, (v: string): void => {
683
686
  outArg = v;
684
687
  })), outArg] as [boolean, string]);
685
688
  if (matchValue[0]) {
686
- const statusResult: Option<Values_FormStatus_$union> = ValuesConverters_formStatusFromTS(details.Status);
687
- const signaturesResult: Option<FSharpList<Values_Signature>> = fold<Option<Values_Signature>, Option<FSharpList<Values_Signature>>>((acc: Option<FSharpList<Values_Signature>>, sigOpt: Option<Values_Signature>): Option<FSharpList<Values_Signature>> => {
688
- let matchResult: int32, item: Values_Signature, list: FSharpList<Values_Signature>;
689
- if (acc != null) {
690
- if (sigOpt != null) {
691
- matchResult = 0;
692
- item = value_2(sigOpt);
693
- list = value_2(acc);
694
- }
695
- else {
696
- matchResult = 1;
697
- }
698
- }
699
- else {
700
- matchResult = 1;
701
- }
702
- switch (matchResult) {
703
- case 0:
704
- return cons(item!, list!);
705
- default:
706
- return undefined;
707
- }
708
- }, empty_2<Values_Signature>(), map_2<ValuesTypes_SignatureTS, Option<Values_Signature>>(ValuesConverters_signatureFromTS, details.Signatures));
709
- let maxScoreResult: Option<Spec_Score>;
710
- const matchValue_2: Option<Types_ScoreTS> = details.MaxScore;
711
- maxScoreResult = ((matchValue_2 == null) ? undefined : Converters_scoreFromTS(value_2(matchValue_2)));
712
- let matchResult_1: int32, signatures: FSharpList<Values_Signature>, status: Values_FormStatus_$union;
713
- if (statusResult != null) {
714
- if (signaturesResult != null) {
715
- matchResult_1 = 0;
716
- signatures = value_2(signaturesResult);
717
- status = value_2(statusResult);
718
- }
719
- else {
720
- matchResult_1 = 1;
721
- }
722
- }
723
- else {
724
- matchResult_1 = 1;
725
- }
726
- switch (matchResult_1) {
727
- case 0:
728
- return new Values_DynamicFormSpecDetails(matchValue[1], details.FormSpecCode, details.FormSpecVersion, details.DynamicVersion, maxScoreResult, status!, reverse<Values_Signature>(signatures!));
729
- default:
730
- return undefined;
731
- }
689
+ return new FormSpecMetadata(matchValue[1], details.FormSpecCode, details.FormSpecVersion, details.DynamicVersion, (matchValue_1 = details.MaxScore, (matchValue_1 == null) ? undefined : Converters_scoreFromTS(value_2(matchValue_1))));
732
690
  }
733
691
  else {
734
692
  return undefined;
@@ -819,10 +777,10 @@ export function ValuesConverters_fableFormModelToTS(model: any): Option<ValuesTy
819
777
  * Note: This returns obj as we can't directly construct Fable.Form types
820
778
  */
821
779
  export function ValuesConverters_fableFormModelFromTS(model: ValuesTypes_FableFormModelTS): Option<any> {
822
- const matchValue: Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>> = ValuesConverters_dynamicStepValuesFromTS(model.Values);
780
+ const matchValue: Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> = ValuesConverters_dynamicStepValuesFromTS(model.Values);
823
781
  const matchValue_1: Option<any> = ValuesConverters_fableFormStateFromTS(model.State);
824
782
  const matchValue_2: Option<any> = ValuesConverters_errorTrackingFromTS(model.ErrorTracking);
825
- let matchResult: int32, errorTracking: any, state: any, values: FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>;
783
+ let matchResult: int32, errorTracking: any, state: any, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>;
826
784
  if (matchValue != null) {
827
785
  if (matchValue_1 != null) {
828
786
  if (matchValue_2 != null) {
@@ -855,17 +813,27 @@ export function ValuesConverters_fableFormModelFromTS(model: ValuesTypes_FableFo
855
813
  }
856
814
 
857
815
  /**
858
- * Convert F# DynamicForm to TypeScript representation
816
+ * Convert F# DynamicForm to TypeScript representation.
817
+ * Details derived from FormSpec (first step's Values) when DynamicForm has Steps only.
859
818
  */
860
819
  export function ValuesConverters_dynamicFormToTS<FableFormModel>(form: Values_DynamicForm$1<FableFormModel>): Option<ValuesTypes_DynamicFormTS> {
861
820
  try {
862
- const detailsTS: ValuesTypes_DynamicFormSpecDetailsTS = ValuesConverters_dynamicFormSpecDetailsToTS(form.DynamicFormSpecDetails);
821
+ const detailsTS: ValuesTypes_DynamicFormSpecDetailsTS = ValuesConverters_dynamicFormSpecDetailsToTS(formSpecToMetadata<Spec_FieldType_$union>(defaultArgWith<Spec_FormSpec$1<Spec_FieldType_$union>>(bind<[Values_StepOrder, FableFormModel], Spec_FormSpec$1<Spec_FieldType_$union>>((tupledArg: [Values_StepOrder, FableFormModel]): Option<Spec_FormSpec$1<Spec_FieldType_$union>> => {
822
+ try {
823
+ return tupledArg[1].Values;
824
+ }
825
+ catch (matchValue: any) {
826
+ return undefined;
827
+ }
828
+ }, tryHead<[Values_StepOrder, FableFormModel]>(toList<Values_StepOrder, FableFormModel>(form.Steps))), (): Spec_FormSpec$1<Spec_FieldType_$union> => {
829
+ throw new Error("dynamicFormToTS: no steps or Values");
830
+ })));
863
831
  const stepsTS: Option<FSharpList<[int32, ValuesTypes_FableFormModelTS]>> = fold_1<Option<[int32, ValuesTypes_FableFormModelTS]>, Option<FSharpList<[int32, ValuesTypes_FableFormModelTS]>>>((acc: Option<FSharpList<[int32, ValuesTypes_FableFormModelTS]>>, item: Option<[int32, ValuesTypes_FableFormModelTS]>): Option<FSharpList<[int32, ValuesTypes_FableFormModelTS]>> => {
864
- let matchResult: int32, list_1: FSharpList<[int32, ValuesTypes_FableFormModelTS]>, model_1: ValuesTypes_FableFormModelTS, order: int32;
832
+ let matchResult: int32, list_2: FSharpList<[int32, ValuesTypes_FableFormModelTS]>, model_1: ValuesTypes_FableFormModelTS, order: int32;
865
833
  if (acc != null) {
866
834
  if (item != null) {
867
835
  matchResult = 0;
868
- list_1 = value_2(acc);
836
+ list_2 = value_2(acc);
869
837
  model_1 = value_2(item)[1];
870
838
  order = value_2(item)[0];
871
839
  }
@@ -878,23 +846,23 @@ export function ValuesConverters_dynamicFormToTS<FableFormModel>(form: Values_Dy
878
846
  }
879
847
  switch (matchResult) {
880
848
  case 0:
881
- return cons([order!, model_1!] as [int32, ValuesTypes_FableFormModelTS], list_1!);
849
+ return cons([order!, model_1!] as [int32, ValuesTypes_FableFormModelTS], list_2!);
882
850
  default:
883
851
  return undefined;
884
852
  }
885
- }, empty_2<[int32, ValuesTypes_FableFormModelTS]>(), map_1<[Values_StepOrder, FableFormModel], Option<[int32, ValuesTypes_FableFormModelTS]>>((tupledArg: [Values_StepOrder, FableFormModel]): Option<[int32, ValuesTypes_FableFormModelTS]> => {
886
- const stepOrder: int32 = tupledArg[0].fields[0] | 0;
887
- const matchValue: Option<ValuesTypes_FableFormModelTS> = ValuesConverters_fableFormModelToTS(tupledArg[1]);
888
- if (matchValue == null) {
853
+ }, empty_2<[int32, ValuesTypes_FableFormModelTS]>(), map_1<[Values_StepOrder, FableFormModel], Option<[int32, ValuesTypes_FableFormModelTS]>>((tupledArg_1: [Values_StepOrder, FableFormModel]): Option<[int32, ValuesTypes_FableFormModelTS]> => {
854
+ const stepOrder: int32 = tupledArg_1[0].fields[0] | 0;
855
+ const matchValue_1: Option<ValuesTypes_FableFormModelTS> = ValuesConverters_fableFormModelToTS(tupledArg_1[1]);
856
+ if (matchValue_1 == null) {
889
857
  return undefined;
890
858
  }
891
859
  else {
892
- return [stepOrder, value_2(matchValue)] as [int32, ValuesTypes_FableFormModelTS];
860
+ return [stepOrder, value_2(matchValue_1)] as [int32, ValuesTypes_FableFormModelTS];
893
861
  }
894
862
  }, toList<Values_StepOrder, FableFormModel>(form.Steps)));
895
863
  return (stepsTS == null) ? undefined : (new ValuesTypes_DynamicFormTS(detailsTS, toArray<[int32, ValuesTypes_FableFormModelTS]>(reverse<[int32, ValuesTypes_FableFormModelTS]>(value_2(stepsTS)))));
896
864
  }
897
- catch (matchValue_2: any) {
865
+ catch (matchValue_3: any) {
898
866
  return undefined;
899
867
  }
900
868
  }
@@ -904,30 +872,90 @@ export function ValuesConverters_dynamicFormToTS<FableFormModel>(form: Values_Dy
904
872
  * Note: Returns obj as we can't directly construct generic DynamicForm
905
873
  */
906
874
  export function ValuesConverters_dynamicFormFromTS(form: ValuesTypes_DynamicFormTS): Option<any> {
907
- const matchValue: Option<Values_DynamicFormSpecDetails> = ValuesConverters_dynamicFormSpecDetailsFromTS(form.DynamicFormSpecDetails);
875
+ let steps: Option<FSharpMap<Values_StepOrder, any>>;
876
+ const array_1: Option<[Values_StepOrder, any]>[] = map_2<[int32, ValuesTypes_FableFormModelTS], Option<[Values_StepOrder, any]>>((tupledArg: [int32, ValuesTypes_FableFormModelTS]): Option<[Values_StepOrder, any]> => {
877
+ const matchValue: Option<any> = ValuesConverters_fableFormModelFromTS(tupledArg[1]);
878
+ if (matchValue == null) {
879
+ return undefined;
880
+ }
881
+ else {
882
+ return [new Values_StepOrder(tupledArg[0]), value_2(matchValue)] as [Values_StepOrder, any];
883
+ }
884
+ }, form.Steps);
885
+ steps = fold<Option<[Values_StepOrder, any]>, Option<FSharpMap<Values_StepOrder, any>>>((acc: Option<FSharpMap<Values_StepOrder, any>>, item: Option<[Values_StepOrder, any]>): Option<FSharpMap<Values_StepOrder, any>> => {
886
+ let matchResult: int32, map: FSharpMap<Values_StepOrder, any>, model_1: any, order: Values_StepOrder;
887
+ if (acc != null) {
888
+ if (item != null) {
889
+ matchResult = 0;
890
+ map = value_2(acc);
891
+ model_1 = value_2(item)[1];
892
+ order = value_2(item)[0];
893
+ }
894
+ else {
895
+ matchResult = 1;
896
+ }
897
+ }
898
+ else {
899
+ matchResult = 1;
900
+ }
901
+ switch (matchResult) {
902
+ case 0:
903
+ return add<Values_StepOrder, any>(order!, model_1!, map!);
904
+ default:
905
+ return undefined;
906
+ }
907
+ }, empty<Values_StepOrder, any>({
908
+ Compare: compare,
909
+ }), array_1);
910
+ if (steps == null) {
911
+ return undefined;
912
+ }
913
+ else {
914
+ return some({
915
+ Steps: value_2(steps),
916
+ });
917
+ }
918
+ }
919
+
920
+ /**
921
+ * Convert F# FormSpec to TypeScript DynamicFormResultData representation (legacy shape).
922
+ * FormSpec is the single source of truth.
923
+ */
924
+ export function ValuesConverters_dynamicFormResultDataToTS(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): ValuesTypes_DynamicFormResultDataTS {
925
+ const metadata: FormSpecMetadata = formSpecToMetadata<Spec_FieldType_$union>(formSpec);
926
+ const resultStepsMap: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> = formSpecToResultStepsMap(formSpec);
927
+ return new ValuesTypes_DynamicFormResultDataTS(ValuesConverters_dynamicFormSpecDetailsToTS(metadata), toArray<[int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]>(map_1<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]>((tupledArg: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]] => ([tupledArg[0].fields[0], ValuesConverters_dynamicStepValuesToTS(tupledArg[1])] as [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]), toList<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(resultStepsMap))));
928
+ }
929
+
930
+ /**
931
+ * Convert TypeScript DynamicFormResultData to F# FormSpec.
932
+ * Requires formSpec to merge values into (structure comes from formSpec).
933
+ */
934
+ export function ValuesConverters_dynamicFormResultDataFromTS(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, data: ValuesTypes_DynamicFormResultDataTS): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
935
+ const matchValue: Option<FormSpecMetadata> = ValuesConverters_dynamicFormSpecDetailsFromTS(data.ResultFormSpecDetails);
908
936
  if (matchValue == null) {
909
937
  return undefined;
910
938
  }
911
939
  else {
912
- const details: Values_DynamicFormSpecDetails = value_2(matchValue);
913
- let steps: Option<FSharpMap<Values_StepOrder, any>>;
914
- const array_1: Option<[Values_StepOrder, any]>[] = map_2<[int32, ValuesTypes_FableFormModelTS], Option<[Values_StepOrder, any]>>((tupledArg: [int32, ValuesTypes_FableFormModelTS]): Option<[Values_StepOrder, any]> => {
915
- const matchValue_1: Option<any> = ValuesConverters_fableFormModelFromTS(tupledArg[1]);
940
+ const _details: FormSpecMetadata = value_2(matchValue);
941
+ let resultSteps: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>;
942
+ const array_1: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>[] = map_2<[int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]], Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>>((tupledArg: [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]): Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]> => {
943
+ const matchValue_1: Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> = ValuesConverters_dynamicStepValuesFromTS(tupledArg[1]);
916
944
  if (matchValue_1 == null) {
917
945
  return undefined;
918
946
  }
919
947
  else {
920
- return [new Values_StepOrder(tupledArg[0]), value_2(matchValue_1)] as [Values_StepOrder, any];
948
+ return [new Values_StepOrder(tupledArg[0]), value_2(matchValue_1)] as [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>];
921
949
  }
922
- }, form.Steps);
923
- steps = fold<Option<[Values_StepOrder, any]>, Option<FSharpMap<Values_StepOrder, any>>>((acc: Option<FSharpMap<Values_StepOrder, any>>, item: Option<[Values_StepOrder, any]>): Option<FSharpMap<Values_StepOrder, any>> => {
924
- let matchResult: int32, map: FSharpMap<Values_StepOrder, any>, model_1: any, order: Values_StepOrder;
950
+ }, data.ResultSteps);
951
+ resultSteps = fold<Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>, Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>>((acc: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>, item: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>): Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>> => {
952
+ let matchResult: int32, map: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>, order: Values_StepOrder, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>;
925
953
  if (acc != null) {
926
954
  if (item != null) {
927
955
  matchResult = 0;
928
956
  map = value_2(acc);
929
- model_1 = value_2(item)[1];
930
957
  order = value_2(item)[0];
958
+ values = value_2(item)[1];
931
959
  }
932
960
  else {
933
961
  matchResult = 1;
@@ -938,54 +966,45 @@ export function ValuesConverters_dynamicFormFromTS(form: ValuesTypes_DynamicForm
938
966
  }
939
967
  switch (matchResult) {
940
968
  case 0:
941
- return add<Values_StepOrder, any>(order!, model_1!, map!);
969
+ return add<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(order!, values!, map!);
942
970
  default:
943
971
  return undefined;
944
972
  }
945
- }, empty<Values_StepOrder, any>({
973
+ }, empty<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>({
946
974
  Compare: compare,
947
975
  }), array_1);
948
- if (steps == null) {
976
+ if (resultSteps == null) {
949
977
  return undefined;
950
978
  }
951
979
  else {
952
- return some({
953
- DynamicFormSpecDetails: details,
954
- Steps: value_2(steps),
955
- });
980
+ return resultStepsMapToFormSpec<Spec_FieldType_$union>(formSpec, value_2(resultSteps));
956
981
  }
957
982
  }
958
983
  }
959
984
 
960
985
  /**
961
- * Convert F# DynamicFormResultData to TypeScript representation
962
- */
963
- export function ValuesConverters_dynamicFormResultDataToTS(data: Values_DynamicFormResultData$1<Spec_FieldType_$union>): ValuesTypes_DynamicFormResultDataTS {
964
- return new ValuesTypes_DynamicFormResultDataTS(ValuesConverters_dynamicFormSpecDetailsToTS(data.ResultFormSpecDetails), toArray<[int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]>(map_1<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>], [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]>((tupledArg: [Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]): [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]] => ([tupledArg[0].fields[0], ValuesConverters_dynamicStepValuesToTS(tupledArg[1])] as [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]), toList<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>(data.ResultSteps))));
965
- }
966
-
967
- /**
968
- * Convert TypeScript DynamicFormResultData to F# representation
986
+ * Convert TypeScript DynamicFormResultData to F# FormSpec when formSpec is not available.
987
+ * Builds minimal FormSpec from TS ResultSteps structure (for backward compatibility).
969
988
  */
970
- export function ValuesConverters_dynamicFormResultDataFromTS(data: ValuesTypes_DynamicFormResultDataTS): Option<Values_DynamicFormResultData$1<Spec_FieldType_$union>> {
971
- const matchValue: Option<Values_DynamicFormSpecDetails> = ValuesConverters_dynamicFormSpecDetailsFromTS(data.ResultFormSpecDetails);
989
+ export function ValuesConverters_dynamicFormResultDataFromTSWithoutFormSpec(data: ValuesTypes_DynamicFormResultDataTS): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
990
+ const matchValue: Option<FormSpecMetadata> = ValuesConverters_dynamicFormSpecDetailsFromTS(data.ResultFormSpecDetails);
972
991
  if (matchValue == null) {
973
992
  return undefined;
974
993
  }
975
994
  else {
976
- const details: Values_DynamicFormSpecDetails = value_2(matchValue);
977
- let resultSteps: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>>;
978
- const array_1: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]>[] = map_2<[int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]], Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]>>((tupledArg: [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]): Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]> => {
979
- const matchValue_1: Option<FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>> = ValuesConverters_dynamicStepValuesFromTS(tupledArg[1]);
995
+ const details: FormSpecMetadata = value_2(matchValue);
996
+ let resultSteps: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>;
997
+ const array_1: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>[] = map_2<[int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]], Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>>((tupledArg: [int32, [Types_FieldKeyTS, ValuesTypes_FieldDetailsTS][]]): Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]> => {
998
+ const matchValue_1: Option<FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> = ValuesConverters_dynamicStepValuesFromTS(tupledArg[1]);
980
999
  if (matchValue_1 == null) {
981
1000
  return undefined;
982
1001
  }
983
1002
  else {
984
- return [new Values_StepOrder(tupledArg[0]), value_2(matchValue_1)] as [Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>];
1003
+ return [new Values_StepOrder(tupledArg[0]), value_2(matchValue_1)] as [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>];
985
1004
  }
986
1005
  }, data.ResultSteps);
987
- resultSteps = fold<Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]>, Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>>>((acc: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>>, item: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>]>): Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>> => {
988
- let matchResult: int32, map: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>, order: Values_StepOrder, values: FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>;
1006
+ resultSteps = fold<Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>, Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>>((acc: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>, item: Option<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]>): Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>> => {
1007
+ let matchResult: int32, map: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>, order: Values_StepOrder, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>;
989
1008
  if (acc != null) {
990
1009
  if (item != null) {
991
1010
  matchResult = 0;
@@ -1002,18 +1021,19 @@ export function ValuesConverters_dynamicFormResultDataFromTS(data: ValuesTypes_D
1002
1021
  }
1003
1022
  switch (matchResult) {
1004
1023
  case 0:
1005
- return add<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>(order!, values!, map!);
1024
+ return add<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(order!, values!, map!);
1006
1025
  default:
1007
1026
  return undefined;
1008
1027
  }
1009
- }, empty<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<Spec_FieldType_$union>>>({
1028
+ }, empty<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>({
1010
1029
  Compare: compare,
1011
1030
  }), array_1);
1012
1031
  if (resultSteps == null) {
1013
1032
  return undefined;
1014
1033
  }
1015
1034
  else {
1016
- return new Values_DynamicFormResultData$1(details, value_2(resultSteps));
1035
+ const stepsMap: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>> = value_2(resultSteps);
1036
+ return resultStepsMapToFormSpec<Spec_FieldType_$union>(buildFormSpecFromResultStepsMap(details, stepsMap), stepsMap);
1017
1037
  }
1018
1038
  }
1019
1039
  }
@@ -1027,15 +1047,15 @@ export function ValuesValidators_validateDynamicFormResultData(input: any): Opti
1027
1047
  }
1028
1048
 
1029
1049
  /**
1030
- * Validate and convert a TypeScript DynamicFormResultData to F# domain type
1050
+ * Validate and convert a TypeScript DynamicFormResultData to F# FormSpec
1031
1051
  */
1032
- export function ValuesValidators_validateAndConvertDynamicFormResultData(input: any): Option<Values_DynamicFormResultData$1<Spec_FieldType_$union>> {
1052
+ export function ValuesValidators_validateAndConvertDynamicFormResultData(input: any): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
1033
1053
  const matchValue: Option<ValuesTypes_DynamicFormResultDataTS> = ValuesValidators_validateDynamicFormResultData(input);
1034
1054
  if (matchValue == null) {
1035
1055
  return undefined;
1036
1056
  }
1037
1057
  else {
1038
- return ValuesConverters_dynamicFormResultDataFromTS(value_2(matchValue));
1058
+ return ValuesConverters_dynamicFormResultDataFromTSWithoutFormSpec(value_2(matchValue));
1039
1059
  }
1040
1060
  }
1041
1061
 
@@ -1122,7 +1142,7 @@ export function ValuesApi_validateDynamicFormResultData<$a>(): ((arg0: $a) => Op
1122
1142
  /**
1123
1143
  * Validate and convert a DynamicFormResultData to F# domain type
1124
1144
  */
1125
- export function ValuesApi_validateAndConvertDynamicFormResultData<$a>(): ((arg0: $a) => Option<Values_DynamicFormResultData$1<Spec_FieldType_$union>>) {
1145
+ export function ValuesApi_validateAndConvertDynamicFormResultData<$a>(): ((arg0: $a) => Option<Spec_FormSpec$1<Spec_FieldType_$union>>) {
1126
1146
  return ValuesValidators_validateAndConvertDynamicFormResultData;
1127
1147
  }
1128
1148
 
@@ -1148,17 +1168,24 @@ export function ValuesApi_validateFieldValue<$a>(): ((arg0: $a) => Option<Values
1148
1168
  }
1149
1169
 
1150
1170
  /**
1151
- * Convert F# DynamicFormResultData to TypeScript representation
1171
+ * Convert F# FormSpec to TypeScript DynamicFormResultData representation (legacy shape)
1172
+ */
1173
+ export function ValuesApi_dynamicFormResultDataToTypeScript(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): ValuesTypes_DynamicFormResultDataTS {
1174
+ return ValuesConverters_dynamicFormResultDataToTS(formSpec);
1175
+ }
1176
+
1177
+ /**
1178
+ * Convert TypeScript DynamicFormResultData to F# FormSpec (when formSpec not available)
1152
1179
  */
1153
- export function ValuesApi_dynamicFormResultDataToTypeScript(data: Values_DynamicFormResultData$1<Spec_FieldType_$union>): ValuesTypes_DynamicFormResultDataTS {
1154
- return ValuesConverters_dynamicFormResultDataToTS(data);
1180
+ export function ValuesApi_dynamicFormResultDataFromTypeScript(data: ValuesTypes_DynamicFormResultDataTS): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
1181
+ return ValuesConverters_dynamicFormResultDataFromTSWithoutFormSpec(data);
1155
1182
  }
1156
1183
 
1157
1184
  /**
1158
- * Convert TypeScript DynamicFormResultData to F# representation
1185
+ * Convert TypeScript DynamicFormResultData to F# FormSpec with formSpec (preferred when formSpec available)
1159
1186
  */
1160
- export function ValuesApi_dynamicFormResultDataFromTypeScript(data: ValuesTypes_DynamicFormResultDataTS): Option<Values_DynamicFormResultData$1<Spec_FieldType_$union>> {
1161
- return ValuesConverters_dynamicFormResultDataFromTS(data);
1187
+ export function ValuesApi_dynamicFormResultDataFromTypeScriptWithFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, data: ValuesTypes_DynamicFormResultDataTS): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
1188
+ return ValuesConverters_dynamicFormResultDataFromTS(formSpec, data);
1162
1189
  }
1163
1190
 
1164
1191
  /**
@@ -1,6 +1,6 @@
1
- import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_DecisionInfo, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction } from "./FormSpec.js";
1
+ import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction } from "./FormSpec.js";
2
2
  import { split, replace, join, isNullOrWhiteSpace, substring, printf, toText } from "@fable-org/fable-library-js/String.js";
3
- import { singleton, append, map, empty, FSharpList, filter } from "@fable-org/fable-library-js/List.js";
3
+ import { singleton, append, map, FSharpList, empty } from "@fable-org/fable-library-js/List.js";
4
4
  import { Option, value } from "@fable-org/fable-library-js/Option.js";
5
5
  import { item, map as map_1 } from "@fable-org/fable-library-js/Array.js";
6
6
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
@@ -173,20 +173,9 @@ export function extractActionType(action: ClinicalPathway_ActionInfo_$union): st
173
173
  }
174
174
  }
175
175
 
176
- export function extractDecisionDetails(decision: ClinicalPathway_DecisionInfo): [string, FSharpList<string>] {
177
- return [decision.Question, filter<string>((opt: string): boolean => {
178
- if ((opt !== "Yes") && (opt !== "No")) {
179
- return opt !== "None of the above";
180
- }
181
- else {
182
- return false;
183
- }
184
- }, decision.Options)] as [string, FSharpList<string>];
185
- }
186
-
187
176
  export function extractEvaluationDetails(evaluation: ClinicalPathway_EvaluationInfo): [string, FSharpList<string>] {
188
177
  let matchValue: Option<FSharpList<string>>;
189
- return [evaluation.EvaluationName, (matchValue = evaluation.CriticalFindings, (matchValue == null) ? empty<string>() : value(matchValue))] as [string, FSharpList<string>];
178
+ return [evaluation.EvaluationName, (matchValue = evaluation.EvaluationNotes, (matchValue == null) ? empty<string>() : value(matchValue))] as [string, FSharpList<string>];
190
179
  }
191
180
 
192
181
  export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo): string {
@@ -195,8 +184,8 @@ export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo
195
184
 
196
185
  export function stateTypeToString(stateType: ClinicalPathway_StateType_$union): string {
197
186
  switch (stateType.tag) {
198
- case /* Decision */ 1:
199
- return "Decision";
187
+ case /* Evaluation */ 1:
188
+ return "Evaluation";
200
189
  case /* Action */ 2:
201
190
  return "Action";
202
191
  case /* CompoundAction */ 3:
@@ -206,7 +195,7 @@ export function stateTypeToString(stateType: ClinicalPathway_StateType_$union):
206
195
  case /* Terminal */ 5:
207
196
  return "Terminal";
208
197
  default:
209
- return "Evaluation";
198
+ throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
210
199
  }
211
200
  }
212
201