@f1studio/form-spec 5.0.0-alpha.101 → 5.0.0-alpha.103
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.
- package/Components/HelloComponent.d.ts +20 -0
- package/Components/HelloComponent.d.ts.map +1 -0
- package/Designer.d.ts.map +1 -0
- package/FormSpec.TS/Designer.js +2 -2
- package/FormSpec.TS/Designer.js.map +1 -1
- package/FormSpec.TS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.js +210 -143
- package/FormSpec.TS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.js +62 -40
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpecValues.js +207 -0
- package/FormSpec.TS/FormSpecValues.js.map +1 -0
- package/FormSpec.TS/FormSpecValues.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +26 -25
- package/FormSpec.TS/Helpers.js.map +1 -1
- package/FormSpec.TS/Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/PathwayExecutor.js +371 -125
- package/FormSpec.TS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PathwayValidator.js +14 -26
- package/FormSpec.TS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.d.ts +56 -43
- package/FormSpec.d.ts.map +1 -0
- package/FormSpecHelpers.d.ts +18 -12
- package/FormSpecHelpers.d.ts.map +1 -0
- package/FormSpecValues.d.ts +62 -0
- package/FormSpecValues.d.ts.map +1 -0
- package/Helpers.d.ts +11 -10
- package/Helpers.d.ts.map +1 -0
- package/Interfaces.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Option.d.ts +10 -6
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/Logging/LogTypes.d.ts +112 -0
- package/Logging/LogTypes.d.ts.map +1 -0
- package/Migrator.d.ts.map +1 -0
- package/PathwayDataExtractor.d.ts.map +1 -0
- package/PathwayExecutor.d.ts +63 -33
- package/PathwayExecutor.d.ts.map +1 -0
- package/PathwayValidator.d.ts.map +1 -0
- package/PluginInterface.d.ts.map +1 -0
- package/Prelude.d.ts.map +1 -0
- package/README.TS.md +621 -621
- package/README.md +98 -85
- package/Renderers/FormSpecMarkdownRenderer.d.ts +11 -0
- package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -0
- package/Renderers/MermaidRenderer.d.ts +48 -0
- package/Renderers/MermaidRenderer.d.ts.map +1 -0
- package/Renderers/PathwayRenderers.d.ts +59 -0
- package/Renderers/PathwayRenderers.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts +126 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts +163 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts +66 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +1 -0
- package/package.json +53 -39
- package/src/Components/HelloComponent.ts +48 -48
- package/src/Designer.ts +389 -389
- package/src/FormSpec.ts +3154 -3114
- package/src/FormSpecHelpers.ts +397 -374
- package/src/FormSpecValues.ts +158 -0
- package/src/Helpers.ts +766 -765
- package/src/Interfaces.ts +166 -166
- package/src/Interop/FormSpec.Api.Helpers.ts +835 -872
- package/src/Interop/FormSpec.Api.Option.ts +1637 -1618
- package/src/Interop/FormSpec.Values.Api.Option.ts +1241 -1214
- package/src/Logging/LogTypes.ts +212 -212
- package/src/Migrator.ts +156 -156
- package/src/PathwayDataExtractor.ts +290 -290
- package/src/PathwayExecutor.ts +1379 -1102
- package/src/PathwayValidator.ts +238 -244
- package/src/PluginInterface.ts +79 -79
- package/src/Prelude.ts +21 -21
- package/src/Renderers/FormSpecMarkdownRenderer.ts +875 -874
- package/src/Renderers/MermaidRenderer.ts +218 -218
- package/src/Renderers/PathwayRenderers.ts +208 -200
- package/src/Components/HelloComponent.ts.map +0 -1
- package/src/Designer.ts.map +0 -1
- package/src/FormSpec.ts.map +0 -1
- package/src/FormSpecHelpers.ts.map +0 -1
- package/src/Helpers.ts.map +0 -1
- package/src/Interfaces.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Helpers.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Option.ts.map +0 -1
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +0 -1
- package/src/Logging/LogTypes.ts.map +0 -1
- package/src/Migrator.ts.map +0 -1
- package/src/PathwayDataExtractor.ts.map +0 -1
- package/src/PathwayExecutor.ts.map +0 -1
- package/src/PathwayValidator.ts.map +0 -1
- package/src/PluginInterface.ts.map +0 -1
- package/src/Prelude.ts.map +0 -1
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +0 -1
- package/src/Renderers/MermaidRenderer.ts.map +0 -1
- package/src/Renderers/PathwayRenderers.ts.map +0 -1
package/src/FormSpecHelpers.ts
CHANGED
|
@@ -1,374 +1,397 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return FSharpResult$
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
case /*
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
1
|
+
import { singleton, head, isEmpty, ofSeq, iterate, forAll, exists, FSharpList, empty, sortBy, mapIndexed, map } from "@fable-org/fable-library-js/List.js";
|
|
2
|
+
import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
+
import { getFieldDetails, FormSpecMetadata, FieldDetails$1 } from "./FormSpecValues.js";
|
|
4
|
+
import { Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_FieldValue_Multiple, Shared_ConditionValue_Single, Shared_ConditionValue_PluginData, Shared_ConditionValue_Matrix, Shared_ConditionValue_Multiple, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ConstraintType_$union, ClinicalPathway_TransitionDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_PluginPropertyKey, Shared_FieldOptionKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty_$reflection, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormLifecycle_Draft, Values_StepOrder, Spec_FormStep$1, Shared_FieldKey, Spec_FormField$1, Spec_FieldType_$union } from "./FormSpec.js";
|
|
5
|
+
import { FSharpMap, toList } from "@fable-org/fable-library-js/Map.js";
|
|
6
|
+
import { compare, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
7
|
+
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
8
|
+
import { value as value_2, Option, bind } from "@fable-org/fable-library-js/Option.js";
|
|
9
|
+
import { join } from "@fable-org/fable-library-js/String.js";
|
|
10
|
+
import { map as map_1, toList as toList_1 } from "@fable-org/fable-library-js/Set.js";
|
|
11
|
+
import { Auto_generateBoxedEncoder_437914C6, toString } from "./fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
12
|
+
import { list_type } from "@fable-org/fable-library-js/Reflection.js";
|
|
13
|
+
import { tryParse } from "@fable-org/fable-library-js/Double.js";
|
|
14
|
+
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
15
|
+
import { FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
16
|
+
import { addRangeInPlace } from "@fable-org/fable-library-js/Array.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Build minimal FormSpec structure from ResultSteps Map (for TS interop when formSpec not available)
|
|
20
|
+
*/
|
|
21
|
+
export function buildFormSpecFromResultStepsMap(details: FormSpecMetadata, stepsMap: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
22
|
+
return new Spec_FormSpec$1(details.FormSpecId, details.FormSpecCode, "", "", details.DynamicVersion, details.FormSpecVersion, map<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], Spec_FormStep$1<Spec_FieldType_$union>>((tupledArg_1: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): Spec_FormStep$1<Spec_FieldType_$union> => {
|
|
23
|
+
const stepOrder: int32 = tupledArg_1[0].fields[0] | 0;
|
|
24
|
+
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> => {
|
|
25
|
+
const fd_1: FieldDetails$1<Spec_FieldType_$union> = tupledArg_3[1];
|
|
26
|
+
return new Spec_FormField$1(i + 1, tupledArg_3[0], fd_1.Label, undefined, undefined, false, false, fd_1.FieldType, fd_1.FieldValue);
|
|
27
|
+
}, 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]), {
|
|
28
|
+
Compare: comparePrimitives,
|
|
29
|
+
})));
|
|
30
|
+
}, sortBy<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], int32>((tupledArg: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): int32 => tupledArg[0].fields[0], toList<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(stepsMap), {
|
|
31
|
+
Compare: comparePrimitives,
|
|
32
|
+
})), empty<string>(), details.MaxScore, empty<string>(), false, false, undefined, Spec_FormLifecycle_Draft(newGuid()), undefined);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract a field value as a string from FormSpec
|
|
37
|
+
*/
|
|
38
|
+
export function getFieldValue(fieldKey: Shared_FieldKey, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> {
|
|
39
|
+
return bind<FieldDetails$1<Spec_FieldType_$union>, string>((fieldDetails: FieldDetails$1<Spec_FieldType_$union>): Option<string> => {
|
|
40
|
+
const matchValue: Shared_FieldValue_$union = fieldDetails.FieldValue;
|
|
41
|
+
switch (matchValue.tag) {
|
|
42
|
+
case /* Multiple */ 1:
|
|
43
|
+
return join(",", map<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList_1<Shared_FieldAnswer>(matchValue.fields[0])));
|
|
44
|
+
case /* Matrix */ 2:
|
|
45
|
+
return join(",", map<[Shared_MatrixItemKey, string], string>((tuple: [Shared_MatrixItemKey, string]): string => tuple[1], toList<Shared_MatrixItemKey, string>(matchValue.fields[0].Values)));
|
|
46
|
+
case /* PluginData */ 3: {
|
|
47
|
+
const pluginData: FSharpList<Shared_PluginDataProperty> = matchValue.fields[0];
|
|
48
|
+
return toString(0, Auto_generateBoxedEncoder_437914C6(list_type(Shared_PluginDataProperty_$reflection()), undefined, undefined, undefined)(pluginData));
|
|
49
|
+
}
|
|
50
|
+
default:
|
|
51
|
+
return matchValue.fields[0].Value;
|
|
52
|
+
}
|
|
53
|
+
}, getFieldDetails(formSpec, fieldKey));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Check if a field has a specific value
|
|
58
|
+
*/
|
|
59
|
+
export function fieldHasValue(fieldKey: Shared_FieldKey, expectedValue: string, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
60
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
61
|
+
if (matchValue == null) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return value_2(matchValue) === expectedValue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Check if a field value is greater than a threshold
|
|
71
|
+
*/
|
|
72
|
+
export function fieldGreaterThan(fieldKey: Shared_FieldKey, threshold: float64, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
73
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
74
|
+
if (matchValue == null) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
let matchValue_1: [boolean, float64];
|
|
79
|
+
let outArg = 0;
|
|
80
|
+
matchValue_1 = ([tryParse(value_2(matchValue), new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
|
|
81
|
+
outArg = v;
|
|
82
|
+
})), outArg] as [boolean, float64]);
|
|
83
|
+
if (matchValue_1[0]) {
|
|
84
|
+
return matchValue_1[1] > threshold;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Check if a field value is less than a threshold
|
|
94
|
+
*/
|
|
95
|
+
export function fieldLessThan(fieldKey: Shared_FieldKey, threshold: float64, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
96
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
97
|
+
if (matchValue == null) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
let matchValue_1: [boolean, float64];
|
|
102
|
+
let outArg = 0;
|
|
103
|
+
matchValue_1 = ([tryParse(value_2(matchValue), new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
|
|
104
|
+
outArg = v;
|
|
105
|
+
})), outArg] as [boolean, float64]);
|
|
106
|
+
if (matchValue_1[0]) {
|
|
107
|
+
return matchValue_1[1] < threshold;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Evaluate a single field condition (string-based, for backward compatibility)
|
|
117
|
+
*/
|
|
118
|
+
export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: ClinicalPathway_FieldEvaluator_$union, expectedValue: string, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
119
|
+
switch (evaluator.tag) {
|
|
120
|
+
case /* Equals */ 0:
|
|
121
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
122
|
+
case /* NotEquals */ 1:
|
|
123
|
+
return !fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
124
|
+
case /* GreaterThan */ 5: {
|
|
125
|
+
let matchValue: [boolean, float64];
|
|
126
|
+
let outArg = 0;
|
|
127
|
+
matchValue = ([tryParse(expectedValue, new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
|
|
128
|
+
outArg = v;
|
|
129
|
+
})), outArg] as [boolean, float64]);
|
|
130
|
+
if (matchValue[0]) {
|
|
131
|
+
return fieldGreaterThan(fieldKey, matchValue[1], formSpec);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
case /* LessThan */ 7: {
|
|
138
|
+
let matchValue_1: [boolean, float64];
|
|
139
|
+
let outArg_1 = 0;
|
|
140
|
+
matchValue_1 = ([tryParse(expectedValue, new FSharpRef<float64>((): float64 => outArg_1, (v_1: float64): void => {
|
|
141
|
+
outArg_1 = v_1;
|
|
142
|
+
})), outArg_1] as [boolean, float64]);
|
|
143
|
+
if (matchValue_1[0]) {
|
|
144
|
+
return fieldLessThan(fieldKey, matchValue_1[1], formSpec);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
case /* GreaterOrEqual */ 6: {
|
|
151
|
+
let matchValue_2: [boolean, float64];
|
|
152
|
+
let outArg_2 = 0;
|
|
153
|
+
matchValue_2 = ([tryParse(expectedValue, new FSharpRef<float64>((): float64 => outArg_2, (v_2: float64): void => {
|
|
154
|
+
outArg_2 = v_2;
|
|
155
|
+
})), outArg_2] as [boolean, float64]);
|
|
156
|
+
if (matchValue_2[0]) {
|
|
157
|
+
if (fieldGreaterThan(fieldKey, matchValue_2[1], formSpec)) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
case /* LessOrEqual */ 8: {
|
|
169
|
+
let matchValue_3: [boolean, float64];
|
|
170
|
+
let outArg_3 = 0;
|
|
171
|
+
matchValue_3 = ([tryParse(expectedValue, new FSharpRef<float64>((): float64 => outArg_3, (v_3: float64): void => {
|
|
172
|
+
outArg_3 = v_3;
|
|
173
|
+
})), outArg_3] as [boolean, float64]);
|
|
174
|
+
if (matchValue_3[0]) {
|
|
175
|
+
if (fieldLessThan(fieldKey, matchValue_3[1], formSpec)) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
default:
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Recursively evaluate a transition condition
|
|
193
|
+
*/
|
|
194
|
+
export function evaluateCondition(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, condition: ClinicalPathway_TransitionCondition_$union): boolean {
|
|
195
|
+
switch (condition.tag) {
|
|
196
|
+
case /* ScoreInRange */ 3:
|
|
197
|
+
return false;
|
|
198
|
+
case /* FieldScoreInRange */ 4:
|
|
199
|
+
return false;
|
|
200
|
+
case /* FieldCondition */ 0: {
|
|
201
|
+
const conditionValue: Shared_ConditionValue_$union = condition.fields[2];
|
|
202
|
+
return evaluateFieldCondition(condition.fields[0], condition.fields[1], (conditionValue.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue.fields[0])) : ((conditionValue.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg: [Shared_MatrixItemKey, string]): string => tupledArg[1], toList<Shared_MatrixItemKey, string>(conditionValue.fields[0]))) : ((conditionValue.tag === /* PluginData */ 3) ? conditionValue.fields[0].Value : conditionValue.fields[0])), formSpec);
|
|
203
|
+
}
|
|
204
|
+
case /* FieldOptionCondition */ 1: {
|
|
205
|
+
const optionKey: Shared_FieldOptionKey = condition.fields[2];
|
|
206
|
+
const fieldKey_1: Shared_FieldKey = condition.fields[0];
|
|
207
|
+
const fieldItemKey: Option<Shared_MatrixItemKey> = condition.fields[1];
|
|
208
|
+
const evaluator_1: ClinicalPathway_FieldEvaluator_$union = condition.fields[3];
|
|
209
|
+
const conditionValue_1: Shared_ConditionValue_$union = condition.fields[4];
|
|
210
|
+
return evaluateFieldCondition((fieldItemKey == null) ? fieldKey_1 : (new Shared_FieldKey(value_2(fieldItemKey).fields[0])), evaluator_1, (conditionValue_1.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue_1.fields[0])) : ((conditionValue_1.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg_1: [Shared_MatrixItemKey, string]): string => tupledArg_1[1], toList<Shared_MatrixItemKey, string>(conditionValue_1.fields[0]))) : ((conditionValue_1.tag === /* PluginData */ 3) ? conditionValue_1.fields[0].Value : conditionValue_1.fields[0])), formSpec);
|
|
211
|
+
}
|
|
212
|
+
case /* PluginPropertyCondition */ 2: {
|
|
213
|
+
const propertyKey: Shared_PluginPropertyKey = condition.fields[1];
|
|
214
|
+
const fieldKey_2: Shared_FieldKey = condition.fields[0];
|
|
215
|
+
const evaluator_2: ClinicalPathway_FieldEvaluator_$union = condition.fields[2];
|
|
216
|
+
const conditionValue_2: Shared_ConditionValue_$union = condition.fields[3];
|
|
217
|
+
const expectedValueStr_2: string = (conditionValue_2.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue_2.fields[0])) : ((conditionValue_2.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg_2: [Shared_MatrixItemKey, string]): string => tupledArg_2[1], toList<Shared_MatrixItemKey, string>(conditionValue_2.fields[0]))) : ((conditionValue_2.tag === /* PluginData */ 3) ? conditionValue_2.fields[0].Value : conditionValue_2.fields[0]));
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
case /* CompositeCondition */ 6: {
|
|
221
|
+
const operator: ClinicalPathway_LogicalOp_$union = condition.fields[0];
|
|
222
|
+
const conditions: FSharpList<ClinicalPathway_TransitionCondition_$union> = condition.fields[1];
|
|
223
|
+
switch (operator.tag) {
|
|
224
|
+
case /* Or */ 1:
|
|
225
|
+
return exists<ClinicalPathway_TransitionCondition_$union>((condition_2: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(formSpec, condition_2), conditions);
|
|
226
|
+
case /* Not */ 2:
|
|
227
|
+
throw new Error("Not operator should not be used directly with CompositeCondition");
|
|
228
|
+
default:
|
|
229
|
+
return forAll<ClinicalPathway_TransitionCondition_$union>((condition_1: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(formSpec, condition_1), conditions);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
case /* StateCondition */ 5:
|
|
233
|
+
return true;
|
|
234
|
+
case /* TestResultCondition */ 7:
|
|
235
|
+
return true;
|
|
236
|
+
default:
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Validate that a FormSpec only uses GUID field keys
|
|
243
|
+
*/
|
|
244
|
+
export function validateFormSpecFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): FSharpResult$2_$union<void, FSharpList<string>> {
|
|
245
|
+
const errors: string[] = [];
|
|
246
|
+
iterate<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): void => {
|
|
247
|
+
iterate<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): void => {
|
|
248
|
+
if (field.FieldKey.fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
249
|
+
void (errors.push(`Field '${field.Label}' has empty GUID field key`));
|
|
250
|
+
}
|
|
251
|
+
}, step.Fields);
|
|
252
|
+
}, formSpec.Steps);
|
|
253
|
+
const matchValue: Option<ClinicalPathway_ClinicalPathwaySpec> = formSpec.ClinicalPathway;
|
|
254
|
+
if (matchValue == null) {
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
const pathway: ClinicalPathway_ClinicalPathwaySpec = value_2(matchValue);
|
|
258
|
+
pathway.States;
|
|
259
|
+
iterate<ClinicalPathway_TransitionDefinition>((transition: ClinicalPathway_TransitionDefinition): void => {
|
|
260
|
+
const validateCondition = (condition: ClinicalPathway_TransitionCondition_$union): void => {
|
|
261
|
+
switch (condition.tag) {
|
|
262
|
+
case /* FieldCondition */ 0: {
|
|
263
|
+
if (condition.fields[0].fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
264
|
+
void (errors.push(`Transition '${transition.TransitionKey}' has empty GUID field key in condition`));
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
case /* PluginPropertyCondition */ 2: {
|
|
269
|
+
const propGuid: string = condition.fields[1].fields[0];
|
|
270
|
+
if (condition.fields[0].fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
271
|
+
void (errors.push(`Transition '${transition.TransitionKey}' has empty GUID field key in plugin property condition`));
|
|
272
|
+
}
|
|
273
|
+
if (propGuid === "00000000-0000-0000-0000-000000000000") {
|
|
274
|
+
void (errors.push(`Transition '${transition.TransitionKey}' has empty GUID property key in plugin property condition`));
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
case /* CompositeCondition */ 6: {
|
|
279
|
+
iterate<ClinicalPathway_TransitionCondition_$union>(validateCondition, condition.fields[1]);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
default:
|
|
283
|
+
undefined;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
validateCondition(transition.Condition);
|
|
287
|
+
}, pathway.Transitions);
|
|
288
|
+
iterate<ClinicalPathway_ConstraintDefinition>((constraintDef: ClinicalPathway_ConstraintDefinition): void => {
|
|
289
|
+
const matchValue_1: ClinicalPathway_ConstraintType_$union = constraintDef.ConstraintType;
|
|
290
|
+
if (matchValue_1.tag === /* RequiredField */ 3) {
|
|
291
|
+
if (matchValue_1.fields[0].fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
292
|
+
void (errors.push(`Constraint '${constraintDef.ConstraintKey}' has empty GUID field key`));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, pathway.Constraints);
|
|
296
|
+
}
|
|
297
|
+
if (errors.length === 0) {
|
|
298
|
+
return FSharpResult$2_Ok<void, FSharpList<string>>(undefined);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
return FSharpResult$2_Error<void, FSharpList<string>>(ofSeq<string>(errors));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Validate that FormSpec only contains GUID field keys (for form data validation)
|
|
307
|
+
*/
|
|
308
|
+
export function validateFormDataFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): FSharpResult$2_$union<void, FSharpList<string>> {
|
|
309
|
+
const errors: string[] = [];
|
|
310
|
+
iterate<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): void => {
|
|
311
|
+
iterate<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): void => {
|
|
312
|
+
if (field.FieldKey.fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
313
|
+
void (errors.push(`Step ${step.StepOrder} contains field with empty GUID`));
|
|
314
|
+
}
|
|
315
|
+
}, step.Fields);
|
|
316
|
+
}, formSpec.Steps);
|
|
317
|
+
if (errors.length === 0) {
|
|
318
|
+
return FSharpResult$2_Ok<void, FSharpList<string>>(undefined);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
return FSharpResult$2_Error<void, FSharpList<string>>(ofSeq<string>(errors));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Comprehensive validation that ensures FormSpec only works with GUID keys
|
|
327
|
+
*/
|
|
328
|
+
export function validateGuidOnlyFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formSpecWithValues: Option<Spec_FormSpec$1<Spec_FieldType_$union>>): FSharpResult$2_$union<void, FSharpList<string>> {
|
|
329
|
+
const errors: string[] = [];
|
|
330
|
+
const matchValue: FSharpResult$2_$union<void, FSharpList<string>> = validateFormSpecFieldKeys(formSpec);
|
|
331
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
addRangeInPlace(matchValue.fields[0], errors);
|
|
335
|
+
}
|
|
336
|
+
if (formSpecWithValues == null) {
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
const matchValue_1: FSharpResult$2_$union<void, FSharpList<string>> = validateFormDataFieldKeys(value_2(formSpecWithValues));
|
|
340
|
+
if (matchValue_1.tag === /* Ok */ 0) {
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
addRangeInPlace(matchValue_1.fields[0], errors);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (errors.length === 0) {
|
|
347
|
+
return FSharpResult$2_Ok<void, FSharpList<string>>(undefined);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
return FSharpResult$2_Error<void, FSharpList<string>>(ofSeq<string>(errors));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Convert FieldValue to ConditionValue (extracts just the values, no FieldAnswer wrapper)
|
|
356
|
+
*/
|
|
357
|
+
export function fieldValueToConditionValue(fieldValue: Shared_FieldValue_$union): Shared_ConditionValue_$union {
|
|
358
|
+
switch (fieldValue.tag) {
|
|
359
|
+
case /* Multiple */ 1:
|
|
360
|
+
return Shared_ConditionValue_Multiple(map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, fieldValue.fields[0], {
|
|
361
|
+
Compare: comparePrimitives,
|
|
362
|
+
}));
|
|
363
|
+
case /* Matrix */ 2:
|
|
364
|
+
return Shared_ConditionValue_Matrix(fieldValue.fields[0].Values);
|
|
365
|
+
case /* PluginData */ 3: {
|
|
366
|
+
const pluginDataList: FSharpList<Shared_PluginDataProperty> = fieldValue.fields[0];
|
|
367
|
+
if (!isEmpty(pluginDataList)) {
|
|
368
|
+
return Shared_ConditionValue_PluginData(head(pluginDataList));
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
throw new Error("Empty plugin data list cannot be converted to ConditionValue");
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
default:
|
|
375
|
+
return Shared_ConditionValue_Single(fieldValue.fields[0].Value);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Convert ConditionValue to FieldValue (for evaluation - needs fieldKey for FieldAnswer)
|
|
381
|
+
*/
|
|
382
|
+
export function conditionValueToFieldValue(conditionValue: Shared_ConditionValue_$union, fieldKey: Shared_FieldKey, fieldLabel: string): Shared_FieldValue_$union {
|
|
383
|
+
switch (conditionValue.tag) {
|
|
384
|
+
case /* Multiple */ 1:
|
|
385
|
+
return Shared_FieldValue_Multiple(map_1<string, Shared_FieldAnswer>((value_1: string): Shared_FieldAnswer => (new Shared_FieldAnswer(fieldKey, fieldLabel, value_1)), conditionValue.fields[0], {
|
|
386
|
+
Compare: compare,
|
|
387
|
+
}));
|
|
388
|
+
case /* Matrix */ 2:
|
|
389
|
+
return Shared_FieldValue_Matrix(new Shared_MatrixAnswer(fieldKey, fieldLabel, conditionValue.fields[0]));
|
|
390
|
+
case /* PluginData */ 3:
|
|
391
|
+
return Shared_FieldValue_PluginData(singleton(conditionValue.fields[0]));
|
|
392
|
+
default:
|
|
393
|
+
return Shared_FieldValue_Single(new Shared_FieldAnswer(fieldKey, fieldLabel, conditionValue.fields[0]));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
//# sourceMappingURL=FormSpecHelpers.ts.map
|