@f1studio/form-spec 5.0.0-alpha.101
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/Designer.d.ts +89 -0
- package/FormSpec.TS/Components/HelloComponent.js +68 -0
- package/FormSpec.TS/Components/HelloComponent.js.map +1 -0
- package/FormSpec.TS/Components/HelloComponent.ts.map +1 -0
- package/FormSpec.TS/Designer.js +526 -0
- package/FormSpec.TS/Designer.js.map +1 -0
- package/FormSpec.TS/Designer.ts.map +1 -0
- package/FormSpec.TS/FormSpec.js +5400 -0
- package/FormSpec.TS/FormSpec.js.map +1 -0
- package/FormSpec.TS/FormSpec.ts.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.js +382 -0
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +732 -0
- package/FormSpec.TS/Helpers.js.map +1 -0
- package/FormSpec.TS/Helpers.ts.map +1 -0
- package/FormSpec.TS/Interfaces.js +257 -0
- package/FormSpec.TS/Interfaces.js.map +1 -0
- package/FormSpec.TS/Interfaces.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +854 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +1961 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +1367 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.js +347 -0
- package/FormSpec.TS/Logging/LogTypes.js.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.ts.map +1 -0
- package/FormSpec.TS/Migrator.js +230 -0
- package/FormSpec.TS/Migrator.js.map +1 -0
- package/FormSpec.TS/Migrator.ts.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.js +361 -0
- package/FormSpec.TS/PathwayDataExtractor.js.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -0
- package/FormSpec.TS/PathwayExecutor.js +1321 -0
- package/FormSpec.TS/PathwayExecutor.js.map +1 -0
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -0
- package/FormSpec.TS/PathwayValidator.js +346 -0
- package/FormSpec.TS/PathwayValidator.js.map +1 -0
- package/FormSpec.TS/PathwayValidator.ts.map +1 -0
- package/FormSpec.TS/PluginInterface.js +171 -0
- package/FormSpec.TS/PluginInterface.js.map +1 -0
- package/FormSpec.TS/PluginInterface.ts.map +1 -0
- package/FormSpec.TS/Prelude.js +59 -0
- package/FormSpec.TS/Prelude.js.map +1 -0
- package/FormSpec.TS/Prelude.ts.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js +958 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js +228 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js +190 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +511 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js +437 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +16 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js +73 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +50 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js +72 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +24 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js +56 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +31 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +178 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js +464 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +17 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +152 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js +25 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +218 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js +37 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +27 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +82 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +59 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +154 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js +32 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +42 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +240 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +24 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +826 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +83 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js +292 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +65 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js +229 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +91 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +876 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +4080 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js +133 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +656 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js +561 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +25 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js +46 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +63 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +41 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +53 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +5740 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +1455 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js +39 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +33 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +181 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +17 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +162 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +1768 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js +2337 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +811 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js +465 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +47 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js +18 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +34 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +68 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js +355 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -0
- package/FormSpec.d.ts +1257 -0
- package/FormSpecHelpers.d.ts +50 -0
- package/Helpers.d.ts +147 -0
- package/Interfaces.d.ts +70 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +247 -0
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Option.d.ts +384 -0
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts +324 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -0
- package/Migrator.d.ts +59 -0
- package/PathwayDataExtractor.d.ts +19 -0
- package/PathwayExecutor.d.ts +210 -0
- package/PathwayValidator.d.ts +52 -0
- package/PluginInterface.d.ts +36 -0
- package/Prelude.d.ts +11 -0
- package/README.TS.md +622 -0
- package/README.md +85 -0
- package/package.json +39 -0
- package/src/Components/HelloComponent.ts +48 -0
- package/src/Components/HelloComponent.ts.map +1 -0
- package/src/Designer.ts +389 -0
- package/src/Designer.ts.map +1 -0
- package/src/FormSpec.ts +3114 -0
- package/src/FormSpec.ts.map +1 -0
- package/src/FormSpecHelpers.ts +374 -0
- package/src/FormSpecHelpers.ts.map +1 -0
- package/src/Helpers.ts +765 -0
- package/src/Helpers.ts.map +1 -0
- package/src/Interfaces.ts +166 -0
- package/src/Interfaces.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Helpers.ts +872 -0
- package/src/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Option.ts +1618 -0
- package/src/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts +1214 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/src/Logging/LogTypes.ts +212 -0
- package/src/Logging/LogTypes.ts.map +1 -0
- package/src/Migrator.ts +156 -0
- package/src/Migrator.ts.map +1 -0
- package/src/PathwayDataExtractor.ts +290 -0
- package/src/PathwayDataExtractor.ts.map +1 -0
- package/src/PathwayExecutor.ts +1102 -0
- package/src/PathwayExecutor.ts.map +1 -0
- package/src/PathwayValidator.ts +244 -0
- package/src/PathwayValidator.ts.map +1 -0
- package/src/PluginInterface.ts +79 -0
- package/src/PluginInterface.ts.map +1 -0
- package/src/Prelude.ts +21 -0
- package/src/Prelude.ts.map +1 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts +874 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/src/Renderers/MermaidRenderer.ts +218 -0
- package/src/Renderers/MermaidRenderer.ts.map +1 -0
- package/src/Renderers/PathwayRenderers.ts +200 -0
- package/src/Renderers/PathwayRenderers.ts.map +1 -0
|
@@ -0,0 +1,2337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get Auto () {
|
|
13
|
+
return Auto;
|
|
14
|
+
},
|
|
15
|
+
get Auto_$reflection () {
|
|
16
|
+
return Auto_$reflection;
|
|
17
|
+
},
|
|
18
|
+
get Auto_generateBoxedDecoderCached_Z6670B51 () {
|
|
19
|
+
return Auto_generateBoxedDecoderCached_Z6670B51;
|
|
20
|
+
},
|
|
21
|
+
get Auto_generateBoxedDecoder_Z6670B51 () {
|
|
22
|
+
return Auto_generateBoxedDecoder_Z6670B51;
|
|
23
|
+
},
|
|
24
|
+
get Getters$1 () {
|
|
25
|
+
return Getters$1;
|
|
26
|
+
},
|
|
27
|
+
get Getters$1_$ctor_4A51B60E () {
|
|
28
|
+
return Getters$1_$ctor_4A51B60E;
|
|
29
|
+
},
|
|
30
|
+
get Getters$1_$reflection () {
|
|
31
|
+
return Getters$1_$reflection;
|
|
32
|
+
},
|
|
33
|
+
get Getters$1__get_Errors () {
|
|
34
|
+
return Getters$1__get_Errors;
|
|
35
|
+
},
|
|
36
|
+
get Helpers_isUndefined () {
|
|
37
|
+
return Helpers_isUndefined;
|
|
38
|
+
},
|
|
39
|
+
get all () {
|
|
40
|
+
return all;
|
|
41
|
+
},
|
|
42
|
+
get andMap () {
|
|
43
|
+
return andMap;
|
|
44
|
+
},
|
|
45
|
+
get andThen () {
|
|
46
|
+
return andThen;
|
|
47
|
+
},
|
|
48
|
+
get array () {
|
|
49
|
+
return array;
|
|
50
|
+
},
|
|
51
|
+
get at () {
|
|
52
|
+
return at;
|
|
53
|
+
},
|
|
54
|
+
get bigint () {
|
|
55
|
+
return bigint;
|
|
56
|
+
},
|
|
57
|
+
get bool () {
|
|
58
|
+
return bool;
|
|
59
|
+
},
|
|
60
|
+
get byte () {
|
|
61
|
+
return byte;
|
|
62
|
+
},
|
|
63
|
+
get char () {
|
|
64
|
+
return char;
|
|
65
|
+
},
|
|
66
|
+
get datetime () {
|
|
67
|
+
return datetime;
|
|
68
|
+
},
|
|
69
|
+
get datetimeLocal () {
|
|
70
|
+
return datetimeLocal;
|
|
71
|
+
},
|
|
72
|
+
get datetimeOffset () {
|
|
73
|
+
return datetimeOffset;
|
|
74
|
+
},
|
|
75
|
+
get datetimeUtc () {
|
|
76
|
+
return datetimeUtc;
|
|
77
|
+
},
|
|
78
|
+
get decimal () {
|
|
79
|
+
return decimal;
|
|
80
|
+
},
|
|
81
|
+
get decodeString () {
|
|
82
|
+
return decodeString;
|
|
83
|
+
},
|
|
84
|
+
get decodeValue () {
|
|
85
|
+
return decodeValue;
|
|
86
|
+
},
|
|
87
|
+
get dict () {
|
|
88
|
+
return dict;
|
|
89
|
+
},
|
|
90
|
+
get fail () {
|
|
91
|
+
return fail;
|
|
92
|
+
},
|
|
93
|
+
get field () {
|
|
94
|
+
return field;
|
|
95
|
+
},
|
|
96
|
+
get float () {
|
|
97
|
+
return float;
|
|
98
|
+
},
|
|
99
|
+
get float32 () {
|
|
100
|
+
return float32;
|
|
101
|
+
},
|
|
102
|
+
get fromString () {
|
|
103
|
+
return fromString;
|
|
104
|
+
},
|
|
105
|
+
get fromValue () {
|
|
106
|
+
return fromValue;
|
|
107
|
+
},
|
|
108
|
+
get guid () {
|
|
109
|
+
return guid;
|
|
110
|
+
},
|
|
111
|
+
get index () {
|
|
112
|
+
return index;
|
|
113
|
+
},
|
|
114
|
+
get int () {
|
|
115
|
+
return int;
|
|
116
|
+
},
|
|
117
|
+
get int16 () {
|
|
118
|
+
return int16;
|
|
119
|
+
},
|
|
120
|
+
get int64 () {
|
|
121
|
+
return int64;
|
|
122
|
+
},
|
|
123
|
+
get keyValuePairs () {
|
|
124
|
+
return keyValuePairs;
|
|
125
|
+
},
|
|
126
|
+
get keys () {
|
|
127
|
+
return keys;
|
|
128
|
+
},
|
|
129
|
+
get list () {
|
|
130
|
+
return list;
|
|
131
|
+
},
|
|
132
|
+
get map () {
|
|
133
|
+
return map;
|
|
134
|
+
},
|
|
135
|
+
get map$0027 () {
|
|
136
|
+
return map$0027;
|
|
137
|
+
},
|
|
138
|
+
get map2 () {
|
|
139
|
+
return map2;
|
|
140
|
+
},
|
|
141
|
+
get map3 () {
|
|
142
|
+
return map3;
|
|
143
|
+
},
|
|
144
|
+
get map4 () {
|
|
145
|
+
return map4;
|
|
146
|
+
},
|
|
147
|
+
get map5 () {
|
|
148
|
+
return map5;
|
|
149
|
+
},
|
|
150
|
+
get map6 () {
|
|
151
|
+
return map6;
|
|
152
|
+
},
|
|
153
|
+
get map7 () {
|
|
154
|
+
return map7;
|
|
155
|
+
},
|
|
156
|
+
get map8 () {
|
|
157
|
+
return map8;
|
|
158
|
+
},
|
|
159
|
+
get nil () {
|
|
160
|
+
return nil;
|
|
161
|
+
},
|
|
162
|
+
get object () {
|
|
163
|
+
return object;
|
|
164
|
+
},
|
|
165
|
+
get oneOf () {
|
|
166
|
+
return oneOf;
|
|
167
|
+
},
|
|
168
|
+
get option () {
|
|
169
|
+
return option;
|
|
170
|
+
},
|
|
171
|
+
get optional () {
|
|
172
|
+
return optional;
|
|
173
|
+
},
|
|
174
|
+
get optionalAt () {
|
|
175
|
+
return optionalAt;
|
|
176
|
+
},
|
|
177
|
+
get sbyte () {
|
|
178
|
+
return sbyte;
|
|
179
|
+
},
|
|
180
|
+
get seq () {
|
|
181
|
+
return seq;
|
|
182
|
+
},
|
|
183
|
+
get string () {
|
|
184
|
+
return string;
|
|
185
|
+
},
|
|
186
|
+
get succeed () {
|
|
187
|
+
return succeed;
|
|
188
|
+
},
|
|
189
|
+
get timespan () {
|
|
190
|
+
return timespan;
|
|
191
|
+
},
|
|
192
|
+
get tuple2 () {
|
|
193
|
+
return tuple2;
|
|
194
|
+
},
|
|
195
|
+
get tuple3 () {
|
|
196
|
+
return tuple3;
|
|
197
|
+
},
|
|
198
|
+
get tuple4 () {
|
|
199
|
+
return tuple4;
|
|
200
|
+
},
|
|
201
|
+
get tuple5 () {
|
|
202
|
+
return tuple5;
|
|
203
|
+
},
|
|
204
|
+
get tuple6 () {
|
|
205
|
+
return tuple6;
|
|
206
|
+
},
|
|
207
|
+
get tuple7 () {
|
|
208
|
+
return tuple7;
|
|
209
|
+
},
|
|
210
|
+
get tuple8 () {
|
|
211
|
+
return tuple8;
|
|
212
|
+
},
|
|
213
|
+
get uint16 () {
|
|
214
|
+
return uint16;
|
|
215
|
+
},
|
|
216
|
+
get uint32 () {
|
|
217
|
+
return uint32;
|
|
218
|
+
},
|
|
219
|
+
get uint64 () {
|
|
220
|
+
return uint64;
|
|
221
|
+
},
|
|
222
|
+
get unit () {
|
|
223
|
+
return unit;
|
|
224
|
+
},
|
|
225
|
+
get unsafeFromString () {
|
|
226
|
+
return unsafeFromString;
|
|
227
|
+
},
|
|
228
|
+
get value () {
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
const _String = require("@fable-org/fable-library-js/String.js");
|
|
233
|
+
const _Typesfs = require("./Types.fs.js");
|
|
234
|
+
const _Result = require("@fable-org/fable-library-js/Result.js");
|
|
235
|
+
const _Guid = require("@fable-org/fable-library-js/Guid.js");
|
|
236
|
+
const _Types = require("@fable-org/fable-library-js/Types.js");
|
|
237
|
+
const _Int32 = require("@fable-org/fable-library-js/Int32.js");
|
|
238
|
+
const _BigInt = require("@fable-org/fable-library-js/BigInt.js");
|
|
239
|
+
const _Long = require("@fable-org/fable-library-js/Long.js");
|
|
240
|
+
const _Decimal = /*#__PURE__*/ _interop_require_wildcard(require("@fable-org/fable-library-js/Decimal.js"));
|
|
241
|
+
const _Date = require("@fable-org/fable-library-js/Date.js");
|
|
242
|
+
const _DateOffset = require("@fable-org/fable-library-js/DateOffset.js");
|
|
243
|
+
const _TimeSpan = require("@fable-org/fable-library-js/TimeSpan.js");
|
|
244
|
+
const _Option = require("@fable-org/fable-library-js/Option.js");
|
|
245
|
+
const _List = require("@fable-org/fable-library-js/List.js");
|
|
246
|
+
const _Util = require("@fable-org/fable-library-js/Util.js");
|
|
247
|
+
const _Array = require("@fable-org/fable-library-js/Array.js");
|
|
248
|
+
const _Seq = require("@fable-org/fable-library-js/Seq.js");
|
|
249
|
+
const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
|
|
250
|
+
const _Map = require("@fable-org/fable-library-js/Map.js");
|
|
251
|
+
const _Set = require("@fable-org/fable-library-js/Set.js");
|
|
252
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
253
|
+
if (typeof WeakMap !== "function") return null;
|
|
254
|
+
var cacheBabelInterop = new WeakMap();
|
|
255
|
+
var cacheNodeInterop = new WeakMap();
|
|
256
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
257
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
258
|
+
})(nodeInterop);
|
|
259
|
+
}
|
|
260
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
261
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
262
|
+
return obj;
|
|
263
|
+
}
|
|
264
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
265
|
+
return {
|
|
266
|
+
default: obj
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
270
|
+
if (cache && cache.has(obj)) {
|
|
271
|
+
return cache.get(obj);
|
|
272
|
+
}
|
|
273
|
+
var newObj = {
|
|
274
|
+
__proto__: null
|
|
275
|
+
};
|
|
276
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
277
|
+
for(var key in obj){
|
|
278
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
279
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
280
|
+
if (desc && (desc.get || desc.set)) {
|
|
281
|
+
Object.defineProperty(newObj, key, desc);
|
|
282
|
+
} else {
|
|
283
|
+
newObj[key] = obj[key];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
newObj.default = obj;
|
|
288
|
+
if (cache) {
|
|
289
|
+
cache.set(obj, newObj);
|
|
290
|
+
}
|
|
291
|
+
return newObj;
|
|
292
|
+
}
|
|
293
|
+
function Helpers_isUndefined(o) {
|
|
294
|
+
return typeof o === "undefined";
|
|
295
|
+
}
|
|
296
|
+
function genericMsg(msg, value_1, newLine) {
|
|
297
|
+
try {
|
|
298
|
+
return "Expecting " + msg + " but instead got:" + (newLine ? "\n" : " ") + (JSON.stringify(value_1, null, 4) + '');
|
|
299
|
+
} catch (matchValue) {
|
|
300
|
+
return "Expecting " + msg + " but decoder failed. Couldn\'t report given value due to circular structure." + (newLine ? "\n" : " ");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function errorToString(path, error) {
|
|
304
|
+
let reason_1;
|
|
305
|
+
switch(error.tag){
|
|
306
|
+
case /* BadType */ 2:
|
|
307
|
+
{
|
|
308
|
+
reason_1 = genericMsg(error.fields[0], error.fields[1], true);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case /* BadPrimitiveExtra */ 1:
|
|
312
|
+
{
|
|
313
|
+
const reason = error.fields[2];
|
|
314
|
+
reason_1 = genericMsg(error.fields[0], error.fields[1], false) + "\nReason: " + reason;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case /* BadField */ 3:
|
|
318
|
+
{
|
|
319
|
+
reason_1 = genericMsg(error.fields[0], error.fields[1], true);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
case /* BadPath */ 4:
|
|
323
|
+
{
|
|
324
|
+
const fieldName = error.fields[2];
|
|
325
|
+
reason_1 = genericMsg(error.fields[0], error.fields[1], true) + ("\nNode `" + fieldName + "` is unkown.");
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case /* TooSmallArray */ 5:
|
|
329
|
+
{
|
|
330
|
+
const value_6 = error.fields[1];
|
|
331
|
+
reason_1 = "Expecting " + error.fields[0] + ".\n" + (JSON.stringify(value_6, null, 4) + '');
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case /* BadOneOf */ 7:
|
|
335
|
+
{
|
|
336
|
+
reason_1 = "The following errors were found:\n\n" + (0, _String.join)("\n\n", error.fields[0]);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
case /* FailMessage */ 6:
|
|
340
|
+
{
|
|
341
|
+
reason_1 = "The following `failure` occurred with the decoder: " + error.fields[0];
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
default:
|
|
345
|
+
reason_1 = genericMsg(error.fields[0], error.fields[1], false);
|
|
346
|
+
}
|
|
347
|
+
if (error.tag === /* BadOneOf */ 7) {
|
|
348
|
+
return reason_1;
|
|
349
|
+
} else {
|
|
350
|
+
return "Error at: `" + path + "`\n" + reason_1;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function fromValue(path, decoder, value_1) {
|
|
354
|
+
const matchValue = decoder(path, value_1);
|
|
355
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
356
|
+
const error = matchValue.fields[0];
|
|
357
|
+
return (0, _Result.FSharpResult$2_Error)(errorToString(error[0], error[1]));
|
|
358
|
+
} else {
|
|
359
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue.fields[0]);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function fromString(decoder, value_1) {
|
|
363
|
+
try {
|
|
364
|
+
return fromValue("$", decoder, JSON.parse(value_1));
|
|
365
|
+
} catch (matchValue) {
|
|
366
|
+
if (matchValue instanceof SyntaxError) {
|
|
367
|
+
return (0, _Result.FSharpResult$2_Error)("Given an invalid JSON: " + matchValue.message);
|
|
368
|
+
} else {
|
|
369
|
+
throw matchValue;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function unsafeFromString(decoder, value_1) {
|
|
374
|
+
const matchValue = fromString(decoder, value_1);
|
|
375
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
376
|
+
throw new Error(matchValue.fields[0]);
|
|
377
|
+
} else {
|
|
378
|
+
return matchValue.fields[0];
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function decodeValue(path, decoder) {
|
|
382
|
+
const decoder_1 = decoder;
|
|
383
|
+
return (value_1)=>fromValue(path, decoder_1, value_1);
|
|
384
|
+
}
|
|
385
|
+
function decodeString(decoder) {
|
|
386
|
+
const decoder_1 = decoder;
|
|
387
|
+
return (value_1)=>fromString(decoder_1, value_1);
|
|
388
|
+
}
|
|
389
|
+
function string(path, value_1) {
|
|
390
|
+
if (typeof value_1 === "string") {
|
|
391
|
+
return (0, _Result.FSharpResult$2_Ok)(value_1);
|
|
392
|
+
} else {
|
|
393
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
394
|
+
path,
|
|
395
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a string", value_1)
|
|
396
|
+
]);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function char(path, value_1) {
|
|
400
|
+
if (typeof value_1 === "string") {
|
|
401
|
+
const str = value_1;
|
|
402
|
+
if (str.length === 1) {
|
|
403
|
+
return (0, _Result.FSharpResult$2_Ok)(str[0]);
|
|
404
|
+
} else {
|
|
405
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
406
|
+
path,
|
|
407
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a single character string", value_1)
|
|
408
|
+
]);
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
412
|
+
path,
|
|
413
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a char", value_1)
|
|
414
|
+
]);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function guid(path, value_1) {
|
|
418
|
+
if (typeof value_1 === "string") {
|
|
419
|
+
let matchValue;
|
|
420
|
+
let outArg = "00000000-0000-0000-0000-000000000000";
|
|
421
|
+
matchValue = [
|
|
422
|
+
(0, _Guid.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
423
|
+
outArg = v;
|
|
424
|
+
})),
|
|
425
|
+
outArg
|
|
426
|
+
];
|
|
427
|
+
if (matchValue[0]) {
|
|
428
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue[1]);
|
|
429
|
+
} else {
|
|
430
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
431
|
+
path,
|
|
432
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a guid", value_1)
|
|
433
|
+
]);
|
|
434
|
+
}
|
|
435
|
+
} else {
|
|
436
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
437
|
+
path,
|
|
438
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a guid", value_1)
|
|
439
|
+
]);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function unit(path, value_1) {
|
|
443
|
+
if (value_1 == null) {
|
|
444
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
445
|
+
} else {
|
|
446
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
447
|
+
path,
|
|
448
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("null", value_1)
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
const sbyte = (path)=>(value_2)=>{
|
|
453
|
+
const path_1 = path;
|
|
454
|
+
const value_3 = value_2;
|
|
455
|
+
if (typeof value_3 === "number") {
|
|
456
|
+
const value_1_1 = value_3;
|
|
457
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? -128 <= value_1_1 && value_1_1 <= 127 ? (0, _Result.FSharpResult$2_Ok)((value_1_1 + 0x80 & 0xFF) - 0x80) : (0, _Result.FSharpResult$2_Error)([
|
|
458
|
+
path_1,
|
|
459
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("a sbyte", value_1_1, "Value was either too large or too small for a sbyte")
|
|
460
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
461
|
+
path_1,
|
|
462
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("a sbyte", value_1_1, "Value is not an integral value")
|
|
463
|
+
]);
|
|
464
|
+
} else if (typeof value_3 === "string") {
|
|
465
|
+
let matchValue;
|
|
466
|
+
let outArg = 0;
|
|
467
|
+
matchValue = [
|
|
468
|
+
(0, _Int32.tryParse)(value_3, 511, false, 8, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
469
|
+
outArg = v | 0;
|
|
470
|
+
})),
|
|
471
|
+
outArg
|
|
472
|
+
];
|
|
473
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
474
|
+
path_1,
|
|
475
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a sbyte", value_3)
|
|
476
|
+
]);
|
|
477
|
+
} else {
|
|
478
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
479
|
+
path_1,
|
|
480
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a sbyte", value_3)
|
|
481
|
+
]);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const byte = (path)=>(value_2)=>{
|
|
485
|
+
const path_1 = path;
|
|
486
|
+
const value_3 = value_2;
|
|
487
|
+
if (typeof value_3 === "number") {
|
|
488
|
+
const value_1_1 = value_3;
|
|
489
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? 0 <= value_1_1 && value_1_1 <= 255 ? (0, _Result.FSharpResult$2_Ok)(value_1_1 & 0xFF) : (0, _Result.FSharpResult$2_Error)([
|
|
490
|
+
path_1,
|
|
491
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("a byte", value_1_1, "Value was either too large or too small for a byte")
|
|
492
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
493
|
+
path_1,
|
|
494
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("a byte", value_1_1, "Value is not an integral value")
|
|
495
|
+
]);
|
|
496
|
+
} else if (typeof value_3 === "string") {
|
|
497
|
+
let matchValue;
|
|
498
|
+
let outArg = 0;
|
|
499
|
+
matchValue = [
|
|
500
|
+
(0, _Int32.tryParse)(value_3, 511, true, 8, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
501
|
+
outArg = v;
|
|
502
|
+
})),
|
|
503
|
+
outArg
|
|
504
|
+
];
|
|
505
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
506
|
+
path_1,
|
|
507
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a byte", value_3)
|
|
508
|
+
]);
|
|
509
|
+
} else {
|
|
510
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
511
|
+
path_1,
|
|
512
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a byte", value_3)
|
|
513
|
+
]);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
const int16 = (path)=>(value_2)=>{
|
|
517
|
+
const path_1 = path;
|
|
518
|
+
const value_3 = value_2;
|
|
519
|
+
if (typeof value_3 === "number") {
|
|
520
|
+
const value_1_1 = value_3;
|
|
521
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? -32768 <= value_1_1 && value_1_1 <= 32767 ? (0, _Result.FSharpResult$2_Ok)((value_1_1 + 0x8000 & 0xFFFF) - 0x8000) : (0, _Result.FSharpResult$2_Error)([
|
|
522
|
+
path_1,
|
|
523
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int16", value_1_1, "Value was either too large or too small for an int16")
|
|
524
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
525
|
+
path_1,
|
|
526
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int16", value_1_1, "Value is not an integral value")
|
|
527
|
+
]);
|
|
528
|
+
} else if (typeof value_3 === "string") {
|
|
529
|
+
let matchValue;
|
|
530
|
+
let outArg = 0;
|
|
531
|
+
matchValue = [
|
|
532
|
+
(0, _Int32.tryParse)(value_3, 511, false, 16, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
533
|
+
outArg = v | 0;
|
|
534
|
+
})),
|
|
535
|
+
outArg
|
|
536
|
+
];
|
|
537
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
538
|
+
path_1,
|
|
539
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int16", value_3)
|
|
540
|
+
]);
|
|
541
|
+
} else {
|
|
542
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
543
|
+
path_1,
|
|
544
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int16", value_3)
|
|
545
|
+
]);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
const uint16 = (path)=>(value_2)=>{
|
|
549
|
+
const path_1 = path;
|
|
550
|
+
const value_3 = value_2;
|
|
551
|
+
if (typeof value_3 === "number") {
|
|
552
|
+
const value_1_1 = value_3;
|
|
553
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? 0 <= value_1_1 && value_1_1 <= 65535 ? (0, _Result.FSharpResult$2_Ok)(value_1_1 & 0xFFFF) : (0, _Result.FSharpResult$2_Error)([
|
|
554
|
+
path_1,
|
|
555
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint16", value_1_1, "Value was either too large or too small for an uint16")
|
|
556
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
557
|
+
path_1,
|
|
558
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint16", value_1_1, "Value is not an integral value")
|
|
559
|
+
]);
|
|
560
|
+
} else if (typeof value_3 === "string") {
|
|
561
|
+
let matchValue;
|
|
562
|
+
let outArg = 0;
|
|
563
|
+
matchValue = [
|
|
564
|
+
(0, _Int32.tryParse)(value_3, 511, true, 16, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
565
|
+
outArg = v;
|
|
566
|
+
})),
|
|
567
|
+
outArg
|
|
568
|
+
];
|
|
569
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
570
|
+
path_1,
|
|
571
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint16", value_3)
|
|
572
|
+
]);
|
|
573
|
+
} else {
|
|
574
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
575
|
+
path_1,
|
|
576
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint16", value_3)
|
|
577
|
+
]);
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
const int = (path)=>(value_2)=>{
|
|
581
|
+
const path_1 = path;
|
|
582
|
+
const value_3 = value_2;
|
|
583
|
+
if (typeof value_3 === "number") {
|
|
584
|
+
const value_1_1 = value_3;
|
|
585
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? -2147483648 <= value_1_1 && value_1_1 <= 2147483647 ? (0, _Result.FSharpResult$2_Ok)(~~value_1_1) : (0, _Result.FSharpResult$2_Error)([
|
|
586
|
+
path_1,
|
|
587
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int", value_1_1, "Value was either too large or too small for an int")
|
|
588
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
589
|
+
path_1,
|
|
590
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int", value_1_1, "Value is not an integral value")
|
|
591
|
+
]);
|
|
592
|
+
} else if (typeof value_3 === "string") {
|
|
593
|
+
let matchValue;
|
|
594
|
+
let outArg = 0;
|
|
595
|
+
matchValue = [
|
|
596
|
+
(0, _Int32.tryParse)(value_3, 511, false, 32, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
597
|
+
outArg = v | 0;
|
|
598
|
+
})),
|
|
599
|
+
outArg
|
|
600
|
+
];
|
|
601
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
602
|
+
path_1,
|
|
603
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int", value_3)
|
|
604
|
+
]);
|
|
605
|
+
} else {
|
|
606
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
607
|
+
path_1,
|
|
608
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int", value_3)
|
|
609
|
+
]);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
const uint32 = (path)=>(value_2)=>{
|
|
613
|
+
const path_1 = path;
|
|
614
|
+
const value_3 = value_2;
|
|
615
|
+
if (typeof value_3 === "number") {
|
|
616
|
+
const value_1_1 = value_3;
|
|
617
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? 0 <= value_1_1 && value_1_1 <= 4294967295 ? (0, _Result.FSharpResult$2_Ok)(value_1_1 >>> 0) : (0, _Result.FSharpResult$2_Error)([
|
|
618
|
+
path_1,
|
|
619
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint32", value_1_1, "Value was either too large or too small for an uint32")
|
|
620
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
621
|
+
path_1,
|
|
622
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint32", value_1_1, "Value is not an integral value")
|
|
623
|
+
]);
|
|
624
|
+
} else if (typeof value_3 === "string") {
|
|
625
|
+
let matchValue;
|
|
626
|
+
let outArg = 0;
|
|
627
|
+
matchValue = [
|
|
628
|
+
(0, _Int32.tryParse)(value_3, 511, true, 32, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
629
|
+
outArg = v;
|
|
630
|
+
})),
|
|
631
|
+
outArg
|
|
632
|
+
];
|
|
633
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
634
|
+
path_1,
|
|
635
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint32", value_3)
|
|
636
|
+
]);
|
|
637
|
+
} else {
|
|
638
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
639
|
+
path_1,
|
|
640
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint32", value_3)
|
|
641
|
+
]);
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const int64 = (path)=>(value_2)=>{
|
|
645
|
+
const path_1 = path;
|
|
646
|
+
const value_3 = value_2;
|
|
647
|
+
if (typeof value_3 === "number") {
|
|
648
|
+
const value_1_1 = value_3;
|
|
649
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? (0, _BigInt.toFloat64)(-9223372036854775808n) <= value_1_1 && value_1_1 <= (0, _BigInt.toFloat64)(9223372036854775807n) ? (0, _Result.FSharpResult$2_Ok)((0, _BigInt.toInt64)((0, _BigInt.fromFloat64)(value_1_1))) : (0, _Result.FSharpResult$2_Error)([
|
|
650
|
+
path_1,
|
|
651
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int64", value_1_1, "Value was either too large or too small for an int64")
|
|
652
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
653
|
+
path_1,
|
|
654
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an int64", value_1_1, "Value is not an integral value")
|
|
655
|
+
]);
|
|
656
|
+
} else if (typeof value_3 === "string") {
|
|
657
|
+
let matchValue;
|
|
658
|
+
let outArg = 0n;
|
|
659
|
+
matchValue = [
|
|
660
|
+
(0, _Long.tryParse)(value_3, 511, false, 64, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
661
|
+
outArg = v;
|
|
662
|
+
})),
|
|
663
|
+
outArg
|
|
664
|
+
];
|
|
665
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
666
|
+
path_1,
|
|
667
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int64", value_3)
|
|
668
|
+
]);
|
|
669
|
+
} else {
|
|
670
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
671
|
+
path_1,
|
|
672
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an int64", value_3)
|
|
673
|
+
]);
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
const uint64 = (path)=>(value_2)=>{
|
|
677
|
+
const path_1 = path;
|
|
678
|
+
const value_3 = value_2;
|
|
679
|
+
if (typeof value_3 === "number") {
|
|
680
|
+
const value_1_1 = value_3;
|
|
681
|
+
return isFinite(value_1_1) && Math.floor(value_1_1) === value_1_1 ? (0, _BigInt.toFloat64)(0n) <= value_1_1 && value_1_1 <= (0, _BigInt.toFloat64)(18446744073709551615n) ? (0, _Result.FSharpResult$2_Ok)((0, _BigInt.toUInt64)((0, _BigInt.fromFloat64)(value_1_1))) : (0, _Result.FSharpResult$2_Error)([
|
|
682
|
+
path_1,
|
|
683
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint64", value_1_1, "Value was either too large or too small for an uint64")
|
|
684
|
+
]) : (0, _Result.FSharpResult$2_Error)([
|
|
685
|
+
path_1,
|
|
686
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)("an uint64", value_1_1, "Value is not an integral value")
|
|
687
|
+
]);
|
|
688
|
+
} else if (typeof value_3 === "string") {
|
|
689
|
+
let matchValue;
|
|
690
|
+
let outArg = 0n;
|
|
691
|
+
matchValue = [
|
|
692
|
+
(0, _Long.tryParse)(value_3, 511, true, 64, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
693
|
+
outArg = v;
|
|
694
|
+
})),
|
|
695
|
+
outArg
|
|
696
|
+
];
|
|
697
|
+
return matchValue[0] ? (0, _Result.FSharpResult$2_Ok)(matchValue[1]) : (0, _Result.FSharpResult$2_Error)([
|
|
698
|
+
path_1,
|
|
699
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint64", value_3)
|
|
700
|
+
]);
|
|
701
|
+
} else {
|
|
702
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
703
|
+
path_1,
|
|
704
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an uint64", value_3)
|
|
705
|
+
]);
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
function bigint(path, value_1) {
|
|
709
|
+
if (typeof value_1 === "number") {
|
|
710
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _BigInt.fromInt32)(value_1));
|
|
711
|
+
} else if (typeof value_1 === "string") {
|
|
712
|
+
try {
|
|
713
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _BigInt.parse)(value_1));
|
|
714
|
+
} catch (matchValue) {
|
|
715
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
716
|
+
path,
|
|
717
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a bigint", value_1)
|
|
718
|
+
]);
|
|
719
|
+
}
|
|
720
|
+
} else {
|
|
721
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
722
|
+
path,
|
|
723
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a bigint", value_1)
|
|
724
|
+
]);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
function bool(path, value_1) {
|
|
728
|
+
if (typeof value_1 === "boolean") {
|
|
729
|
+
return (0, _Result.FSharpResult$2_Ok)(value_1);
|
|
730
|
+
} else {
|
|
731
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
732
|
+
path,
|
|
733
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a boolean", value_1)
|
|
734
|
+
]);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function float(path, value_1) {
|
|
738
|
+
if (typeof value_1 === "number") {
|
|
739
|
+
return (0, _Result.FSharpResult$2_Ok)(value_1);
|
|
740
|
+
} else {
|
|
741
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
742
|
+
path,
|
|
743
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a float", value_1)
|
|
744
|
+
]);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
function float32(path, value_1) {
|
|
748
|
+
if (typeof value_1 === "number") {
|
|
749
|
+
return (0, _Result.FSharpResult$2_Ok)(value_1);
|
|
750
|
+
} else {
|
|
751
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
752
|
+
path,
|
|
753
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a float32", value_1)
|
|
754
|
+
]);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function decimal(path, value_1) {
|
|
758
|
+
if (typeof value_1 === "number") {
|
|
759
|
+
return (0, _Result.FSharpResult$2_Ok)(new _Decimal.default(value_1));
|
|
760
|
+
} else if (typeof value_1 === "string") {
|
|
761
|
+
let matchValue;
|
|
762
|
+
let outArg = new _Decimal.default("0");
|
|
763
|
+
matchValue = [
|
|
764
|
+
(0, _Decimal.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
765
|
+
outArg = v;
|
|
766
|
+
})),
|
|
767
|
+
outArg
|
|
768
|
+
];
|
|
769
|
+
if (matchValue[0]) {
|
|
770
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue[1]);
|
|
771
|
+
} else {
|
|
772
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
773
|
+
path,
|
|
774
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a decimal", value_1)
|
|
775
|
+
]);
|
|
776
|
+
}
|
|
777
|
+
} else {
|
|
778
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
779
|
+
path,
|
|
780
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a decimal", value_1)
|
|
781
|
+
]);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
function datetime(path, value_1) {
|
|
785
|
+
if (typeof value_1 === "string") {
|
|
786
|
+
let matchValue;
|
|
787
|
+
let outArg = (0, _Date.minValue)();
|
|
788
|
+
matchValue = [
|
|
789
|
+
(0, _Date.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
790
|
+
outArg = v;
|
|
791
|
+
})),
|
|
792
|
+
outArg
|
|
793
|
+
];
|
|
794
|
+
if (matchValue[0]) {
|
|
795
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _Date.toUniversalTime)(matchValue[1]));
|
|
796
|
+
} else {
|
|
797
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
798
|
+
path,
|
|
799
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
800
|
+
]);
|
|
801
|
+
}
|
|
802
|
+
} else {
|
|
803
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
804
|
+
path,
|
|
805
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
806
|
+
]);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
function datetimeUtc(path, value_1) {
|
|
810
|
+
if (typeof value_1 === "string") {
|
|
811
|
+
let matchValue;
|
|
812
|
+
let outArg = (0, _Date.minValue)();
|
|
813
|
+
matchValue = [
|
|
814
|
+
(0, _Date.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
815
|
+
outArg = v;
|
|
816
|
+
})),
|
|
817
|
+
outArg
|
|
818
|
+
];
|
|
819
|
+
if (matchValue[0]) {
|
|
820
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _Date.toUniversalTime)(matchValue[1]));
|
|
821
|
+
} else {
|
|
822
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
823
|
+
path,
|
|
824
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
825
|
+
]);
|
|
826
|
+
}
|
|
827
|
+
} else {
|
|
828
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
829
|
+
path,
|
|
830
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
831
|
+
]);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
function datetimeLocal(path, value_1) {
|
|
835
|
+
if (typeof value_1 === "string") {
|
|
836
|
+
let matchValue;
|
|
837
|
+
let outArg = (0, _Date.minValue)();
|
|
838
|
+
matchValue = [
|
|
839
|
+
(0, _Date.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
840
|
+
outArg = v;
|
|
841
|
+
})),
|
|
842
|
+
outArg
|
|
843
|
+
];
|
|
844
|
+
if (matchValue[0]) {
|
|
845
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue[1]);
|
|
846
|
+
} else {
|
|
847
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
848
|
+
path,
|
|
849
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
850
|
+
]);
|
|
851
|
+
}
|
|
852
|
+
} else {
|
|
853
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
854
|
+
path,
|
|
855
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
856
|
+
]);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function datetimeOffset(path, value_1) {
|
|
860
|
+
if (typeof value_1 === "string") {
|
|
861
|
+
let matchValue;
|
|
862
|
+
let outArg = (0, _DateOffset.minValue)();
|
|
863
|
+
matchValue = [
|
|
864
|
+
(0, _DateOffset.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
865
|
+
outArg = v;
|
|
866
|
+
})),
|
|
867
|
+
outArg
|
|
868
|
+
];
|
|
869
|
+
if (matchValue[0]) {
|
|
870
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue[1]);
|
|
871
|
+
} else {
|
|
872
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
873
|
+
path,
|
|
874
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetimeoffset", value_1)
|
|
875
|
+
]);
|
|
876
|
+
}
|
|
877
|
+
} else {
|
|
878
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
879
|
+
path,
|
|
880
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a datetime", value_1)
|
|
881
|
+
]);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function timespan(path, value_1) {
|
|
885
|
+
if (typeof value_1 === "string") {
|
|
886
|
+
let matchValue;
|
|
887
|
+
let outArg = 0;
|
|
888
|
+
matchValue = [
|
|
889
|
+
(0, _TimeSpan.tryParse)(value_1, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
890
|
+
outArg = v;
|
|
891
|
+
})),
|
|
892
|
+
outArg
|
|
893
|
+
];
|
|
894
|
+
if (matchValue[0]) {
|
|
895
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue[1]);
|
|
896
|
+
} else {
|
|
897
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
898
|
+
path,
|
|
899
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a timespan", value_1)
|
|
900
|
+
]);
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
904
|
+
path,
|
|
905
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a timespan", value_1)
|
|
906
|
+
]);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
function decodeMaybeNull(path, decoder, value_1) {
|
|
910
|
+
if (value_1 == null) {
|
|
911
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
912
|
+
} else {
|
|
913
|
+
const matchValue = decoder(path, value_1);
|
|
914
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
915
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
916
|
+
} else {
|
|
917
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _Option.some)(matchValue.fields[0]));
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
function optional(fieldName, decoder, path, value_1) {
|
|
922
|
+
if (value_1 === null ? false : Object.getPrototypeOf(value_1 || false) === Object.prototype) {
|
|
923
|
+
const fieldValue = value_1[fieldName];
|
|
924
|
+
if (Helpers_isUndefined(fieldValue)) {
|
|
925
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
926
|
+
} else {
|
|
927
|
+
return decodeMaybeNull(path + "." + fieldName, decoder, fieldValue);
|
|
928
|
+
}
|
|
929
|
+
} else {
|
|
930
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
931
|
+
path,
|
|
932
|
+
(0, _Typesfs.ErrorReason_BadType)("an object", value_1)
|
|
933
|
+
]);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function badPathError(fieldNames, currentPath, value_1) {
|
|
937
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
938
|
+
(0, _Option.defaultArg)(currentPath, (0, _String.join)(".", (0, _List.cons)("$", fieldNames))),
|
|
939
|
+
(0, _Typesfs.ErrorReason_BadPath)("an object with path `" + (0, _String.join)(".", fieldNames) + "`", value_1, (0, _Option.defaultArg)((0, _List.tryLast)(fieldNames), ""))
|
|
940
|
+
]);
|
|
941
|
+
}
|
|
942
|
+
function optionalAt(fieldNames, decoder, firstPath, firstValue) {
|
|
943
|
+
const _arg = (0, _List.fold)((tupledArg, field_1)=>{
|
|
944
|
+
const curPath = tupledArg[0];
|
|
945
|
+
const curValue = tupledArg[1];
|
|
946
|
+
const res = tupledArg[2];
|
|
947
|
+
if (res == null) {
|
|
948
|
+
if (curValue == null) {
|
|
949
|
+
return [
|
|
950
|
+
curPath,
|
|
951
|
+
curValue,
|
|
952
|
+
(0, _Result.FSharpResult$2_Ok)(undefined)
|
|
953
|
+
];
|
|
954
|
+
} else if (curValue === null ? false : Object.getPrototypeOf(curValue || false) === Object.prototype) {
|
|
955
|
+
return [
|
|
956
|
+
curPath + "." + field_1,
|
|
957
|
+
curValue[field_1],
|
|
958
|
+
undefined
|
|
959
|
+
];
|
|
960
|
+
} else {
|
|
961
|
+
return [
|
|
962
|
+
curPath,
|
|
963
|
+
curValue,
|
|
964
|
+
(0, _Result.FSharpResult$2_Error)([
|
|
965
|
+
curPath,
|
|
966
|
+
(0, _Typesfs.ErrorReason_BadType)("an object", curValue)
|
|
967
|
+
])
|
|
968
|
+
];
|
|
969
|
+
}
|
|
970
|
+
} else {
|
|
971
|
+
return [
|
|
972
|
+
curPath,
|
|
973
|
+
curValue,
|
|
974
|
+
res
|
|
975
|
+
];
|
|
976
|
+
}
|
|
977
|
+
}, [
|
|
978
|
+
firstPath,
|
|
979
|
+
firstValue,
|
|
980
|
+
undefined
|
|
981
|
+
], fieldNames);
|
|
982
|
+
if (_arg[2] == null) {
|
|
983
|
+
const lastValue = _arg[1];
|
|
984
|
+
if (Helpers_isUndefined(lastValue)) {
|
|
985
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
986
|
+
} else {
|
|
987
|
+
return decodeMaybeNull(_arg[0], decoder, lastValue);
|
|
988
|
+
}
|
|
989
|
+
} else {
|
|
990
|
+
return (0, _Option.value)(_arg[2]);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
function field(fieldName, decoder, path, value_1) {
|
|
994
|
+
if (value_1 === null ? false : Object.getPrototypeOf(value_1 || false) === Object.prototype) {
|
|
995
|
+
const fieldValue = value_1[fieldName];
|
|
996
|
+
if (Helpers_isUndefined(fieldValue)) {
|
|
997
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
998
|
+
path,
|
|
999
|
+
(0, _Typesfs.ErrorReason_BadField)("an object with a field named `" + fieldName + "`", value_1)
|
|
1000
|
+
]);
|
|
1001
|
+
} else {
|
|
1002
|
+
return decoder(path + "." + fieldName, fieldValue);
|
|
1003
|
+
}
|
|
1004
|
+
} else {
|
|
1005
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1006
|
+
path,
|
|
1007
|
+
(0, _Typesfs.ErrorReason_BadType)("an object", value_1)
|
|
1008
|
+
]);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function at(fieldNames, decoder, firstPath, firstValue) {
|
|
1012
|
+
const _arg = (0, _List.fold)((tupledArg, field_1)=>{
|
|
1013
|
+
const curPath = tupledArg[0];
|
|
1014
|
+
const curValue = tupledArg[1];
|
|
1015
|
+
const res = tupledArg[2];
|
|
1016
|
+
if (res == null) {
|
|
1017
|
+
if (curValue == null) {
|
|
1018
|
+
return [
|
|
1019
|
+
curPath,
|
|
1020
|
+
curValue,
|
|
1021
|
+
badPathError(fieldNames, curPath, firstValue)
|
|
1022
|
+
];
|
|
1023
|
+
} else if (curValue === null ? false : Object.getPrototypeOf(curValue || false) === Object.prototype) {
|
|
1024
|
+
const curValue_1 = curValue[field_1];
|
|
1025
|
+
if (Helpers_isUndefined(curValue_1)) {
|
|
1026
|
+
return [
|
|
1027
|
+
curPath,
|
|
1028
|
+
curValue_1,
|
|
1029
|
+
badPathError(fieldNames, undefined, firstValue)
|
|
1030
|
+
];
|
|
1031
|
+
} else {
|
|
1032
|
+
return [
|
|
1033
|
+
curPath + "." + field_1,
|
|
1034
|
+
curValue_1,
|
|
1035
|
+
undefined
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
} else {
|
|
1039
|
+
return [
|
|
1040
|
+
curPath,
|
|
1041
|
+
curValue,
|
|
1042
|
+
(0, _Result.FSharpResult$2_Error)([
|
|
1043
|
+
curPath,
|
|
1044
|
+
(0, _Typesfs.ErrorReason_BadType)("an object", curValue)
|
|
1045
|
+
])
|
|
1046
|
+
];
|
|
1047
|
+
}
|
|
1048
|
+
} else {
|
|
1049
|
+
return [
|
|
1050
|
+
curPath,
|
|
1051
|
+
curValue,
|
|
1052
|
+
res
|
|
1053
|
+
];
|
|
1054
|
+
}
|
|
1055
|
+
}, [
|
|
1056
|
+
firstPath,
|
|
1057
|
+
firstValue,
|
|
1058
|
+
undefined
|
|
1059
|
+
], fieldNames);
|
|
1060
|
+
if (_arg[2] == null) {
|
|
1061
|
+
return decoder(_arg[0], _arg[1]);
|
|
1062
|
+
} else {
|
|
1063
|
+
return (0, _Option.value)(_arg[2]);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function index(requestedIndex, decoder, path, value_1) {
|
|
1067
|
+
let copyOfStruct;
|
|
1068
|
+
const currentPath = path + ".[" + (0, _Util.int32ToString)(requestedIndex) + "]";
|
|
1069
|
+
if (Array.isArray(value_1)) {
|
|
1070
|
+
const vArray = value_1;
|
|
1071
|
+
if (requestedIndex < vArray.length) {
|
|
1072
|
+
return decoder(currentPath, (0, _Array.item)(requestedIndex, vArray));
|
|
1073
|
+
} else {
|
|
1074
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1075
|
+
currentPath,
|
|
1076
|
+
(0, _Typesfs.ErrorReason_TooSmallArray)("a longer array. Need index `" + (0, _Util.int32ToString)(requestedIndex) + "` but there are only `" + (copyOfStruct = vArray.length, (0, _Util.int32ToString)(copyOfStruct)) + "` entries", value_1)
|
|
1077
|
+
]);
|
|
1078
|
+
}
|
|
1079
|
+
} else {
|
|
1080
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1081
|
+
currentPath,
|
|
1082
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an array", value_1)
|
|
1083
|
+
]);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
function option(decoder, path, value_1) {
|
|
1087
|
+
if (value_1 == null) {
|
|
1088
|
+
return (0, _Result.FSharpResult$2_Ok)(undefined);
|
|
1089
|
+
} else {
|
|
1090
|
+
return (0, _Result.Result_Map)(_Option.some, decoder(path, value_1));
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
function list(decoder, path, value_1) {
|
|
1094
|
+
if (Array.isArray(value_1)) {
|
|
1095
|
+
let i = -1;
|
|
1096
|
+
return (0, _Result.Result_Map)(_List.reverse, (0, _Array.fold)((acc, value_2)=>{
|
|
1097
|
+
i = i + 1 | 0;
|
|
1098
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1099
|
+
const acc_1 = acc.fields[0];
|
|
1100
|
+
const matchValue = decoder(path + ".[" + (0, _Util.int32ToString)(i) + "]", value_2);
|
|
1101
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
1102
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _List.cons)(matchValue.fields[0], acc_1));
|
|
1103
|
+
} else {
|
|
1104
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1105
|
+
}
|
|
1106
|
+
} else {
|
|
1107
|
+
return acc;
|
|
1108
|
+
}
|
|
1109
|
+
}, (0, _Result.FSharpResult$2_Ok)((0, _List.empty)()), value_1));
|
|
1110
|
+
} else {
|
|
1111
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1112
|
+
path,
|
|
1113
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a list", value_1)
|
|
1114
|
+
]);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
function seq(decoder, path, value_1) {
|
|
1118
|
+
if (Array.isArray(value_1)) {
|
|
1119
|
+
let i = -1;
|
|
1120
|
+
return (0, _Result.Result_Map)(_Seq.reverse, (0, _Array.fold)((acc, value_2)=>{
|
|
1121
|
+
i = i + 1 | 0;
|
|
1122
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1123
|
+
const acc_1 = acc.fields[0];
|
|
1124
|
+
const matchValue = decoder(path + ".[" + (0, _Util.int32ToString)(i) + "]", value_2);
|
|
1125
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
1126
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _Seq.append)([
|
|
1127
|
+
matchValue.fields[0]
|
|
1128
|
+
], acc_1));
|
|
1129
|
+
} else {
|
|
1130
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1131
|
+
}
|
|
1132
|
+
} else {
|
|
1133
|
+
return acc;
|
|
1134
|
+
}
|
|
1135
|
+
}, (0, _Result.FSharpResult$2_Ok)([]), value_1));
|
|
1136
|
+
} else {
|
|
1137
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1138
|
+
path,
|
|
1139
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a seq", value_1)
|
|
1140
|
+
]);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function array(decoder, path, value_1) {
|
|
1144
|
+
if (Array.isArray(value_1)) {
|
|
1145
|
+
let i = -1;
|
|
1146
|
+
const tokens = value_1;
|
|
1147
|
+
return (0, _Array.fold)((acc, value_2)=>{
|
|
1148
|
+
i = i + 1 | 0;
|
|
1149
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1150
|
+
const acc_1 = acc.fields[0];
|
|
1151
|
+
const matchValue = decoder(path + ".[" + (0, _Util.int32ToString)(i) + "]", value_2);
|
|
1152
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
1153
|
+
const value_3 = matchValue.fields[0];
|
|
1154
|
+
(0, _Array.setItem)(acc_1, i, value_3);
|
|
1155
|
+
return (0, _Result.FSharpResult$2_Ok)(acc_1);
|
|
1156
|
+
} else {
|
|
1157
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1158
|
+
}
|
|
1159
|
+
} else {
|
|
1160
|
+
return acc;
|
|
1161
|
+
}
|
|
1162
|
+
}, (0, _Result.FSharpResult$2_Ok)((0, _Array.fill)(new Array(tokens.length), 0, tokens.length, null)), tokens);
|
|
1163
|
+
} else {
|
|
1164
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1165
|
+
path,
|
|
1166
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an array", value_1)
|
|
1167
|
+
]);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
function keys(path, value_1) {
|
|
1171
|
+
if (value_1 === null ? false : Object.getPrototypeOf(value_1 || false) === Object.prototype) {
|
|
1172
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _List.ofSeq)(Object.keys(value_1)));
|
|
1173
|
+
} else {
|
|
1174
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1175
|
+
path,
|
|
1176
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an object", value_1)
|
|
1177
|
+
]);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function keyValuePairs(decoder, path, value_1) {
|
|
1181
|
+
const matchValue = keys(path, value_1);
|
|
1182
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1183
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1184
|
+
} else {
|
|
1185
|
+
return (0, _Result.Result_Map)(_List.reverse, (0, _List.fold)((acc, prop)=>{
|
|
1186
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1187
|
+
const acc_1 = acc.fields[0];
|
|
1188
|
+
const matchValue_1 = decoder(path, value_1[prop]);
|
|
1189
|
+
if (matchValue_1.tag === /* Ok */ 0) {
|
|
1190
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _List.cons)([
|
|
1191
|
+
prop,
|
|
1192
|
+
matchValue_1.fields[0]
|
|
1193
|
+
], acc_1));
|
|
1194
|
+
} else {
|
|
1195
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_1.fields[0]);
|
|
1196
|
+
}
|
|
1197
|
+
} else {
|
|
1198
|
+
return acc;
|
|
1199
|
+
}
|
|
1200
|
+
}, (0, _Result.FSharpResult$2_Ok)((0, _List.empty)()), matchValue.fields[0]));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
function oneOf(decoders, path, value_1) {
|
|
1204
|
+
const runner = (decoders_1_mut, errors_mut)=>{
|
|
1205
|
+
runner: while(true){
|
|
1206
|
+
const decoders_1 = decoders_1_mut, errors = errors_mut;
|
|
1207
|
+
if ((0, _List.isEmpty)(decoders_1)) {
|
|
1208
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1209
|
+
path,
|
|
1210
|
+
(0, _Typesfs.ErrorReason_BadOneOf)(errors)
|
|
1211
|
+
]);
|
|
1212
|
+
} else {
|
|
1213
|
+
const matchValue = fromValue(path, (0, _Util.uncurry2)((0, _List.head)(decoders_1)), value_1);
|
|
1214
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1215
|
+
decoders_1_mut = (0, _List.tail)(decoders_1);
|
|
1216
|
+
errors_mut = (0, _List.append)(errors, (0, _List.singleton)(matchValue.fields[0]));
|
|
1217
|
+
continue runner;
|
|
1218
|
+
} else {
|
|
1219
|
+
return (0, _Result.FSharpResult$2_Ok)(matchValue.fields[0]);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
return runner(decoders, (0, _List.empty)());
|
|
1226
|
+
}
|
|
1227
|
+
function nil(output, path, value_1) {
|
|
1228
|
+
if (value_1 == null) {
|
|
1229
|
+
return (0, _Result.FSharpResult$2_Ok)(output);
|
|
1230
|
+
} else {
|
|
1231
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1232
|
+
path,
|
|
1233
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("null", value_1)
|
|
1234
|
+
]);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function value(_arg, v) {
|
|
1238
|
+
return (0, _Result.FSharpResult$2_Ok)(v);
|
|
1239
|
+
}
|
|
1240
|
+
function succeed(output, _arg, _arg_1) {
|
|
1241
|
+
return (0, _Result.FSharpResult$2_Ok)(output);
|
|
1242
|
+
}
|
|
1243
|
+
function fail(msg, path, _arg) {
|
|
1244
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1245
|
+
path,
|
|
1246
|
+
(0, _Typesfs.ErrorReason_FailMessage)(msg)
|
|
1247
|
+
]);
|
|
1248
|
+
}
|
|
1249
|
+
function andThen(cb, decoder, path, value_1) {
|
|
1250
|
+
const matchValue = decoder(path, value_1);
|
|
1251
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
1252
|
+
return cb(matchValue.fields[0], path, value_1);
|
|
1253
|
+
} else {
|
|
1254
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
function all(decoders, path, value_1) {
|
|
1258
|
+
const runner = (decoders_1_mut, values_mut)=>{
|
|
1259
|
+
runner: while(true){
|
|
1260
|
+
const decoders_1 = decoders_1_mut, values = values_mut;
|
|
1261
|
+
if ((0, _List.isEmpty)(decoders_1)) {
|
|
1262
|
+
return (0, _Result.FSharpResult$2_Ok)(values);
|
|
1263
|
+
} else {
|
|
1264
|
+
const matchValue = (0, _List.head)(decoders_1)(path)(value_1);
|
|
1265
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1266
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1267
|
+
} else {
|
|
1268
|
+
decoders_1_mut = (0, _List.tail)(decoders_1);
|
|
1269
|
+
values_mut = (0, _List.append)(values, (0, _List.singleton)(matchValue.fields[0]));
|
|
1270
|
+
continue runner;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
break;
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
return runner(decoders, (0, _List.empty)());
|
|
1277
|
+
}
|
|
1278
|
+
function map(ctor, d1, path, value_1) {
|
|
1279
|
+
const matchValue = d1(path, value_1);
|
|
1280
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1281
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
1282
|
+
} else {
|
|
1283
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(matchValue.fields[0]));
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
function map2(ctor, d1, d2, path, value_1) {
|
|
1287
|
+
const matchValue = d1(path, value_1);
|
|
1288
|
+
const matchValue_1 = d2(path, value_1);
|
|
1289
|
+
const copyOfStruct = matchValue;
|
|
1290
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1291
|
+
const er = copyOfStruct.fields[0];
|
|
1292
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1293
|
+
} else {
|
|
1294
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1295
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1296
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1297
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1298
|
+
} else {
|
|
1299
|
+
const v1 = copyOfStruct.fields[0];
|
|
1300
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1301
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2));
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function map3(ctor, d1, d2, d3, path, value_1) {
|
|
1306
|
+
const matchValue = d1(path, value_1);
|
|
1307
|
+
const matchValue_1 = d2(path, value_1);
|
|
1308
|
+
const matchValue_2 = d3(path, value_1);
|
|
1309
|
+
const copyOfStruct = matchValue;
|
|
1310
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1311
|
+
const er = copyOfStruct.fields[0];
|
|
1312
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1313
|
+
} else {
|
|
1314
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1315
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1316
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1317
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1318
|
+
} else {
|
|
1319
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1320
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1321
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1322
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1323
|
+
} else {
|
|
1324
|
+
const v1 = copyOfStruct.fields[0];
|
|
1325
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1326
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1327
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3));
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
function map4(ctor, d1, d2, d3, d4, path, value_1) {
|
|
1333
|
+
const matchValue = d1(path, value_1);
|
|
1334
|
+
const matchValue_1 = d2(path, value_1);
|
|
1335
|
+
const matchValue_2 = d3(path, value_1);
|
|
1336
|
+
const matchValue_3 = d4(path, value_1);
|
|
1337
|
+
const copyOfStruct = matchValue;
|
|
1338
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1339
|
+
const er = copyOfStruct.fields[0];
|
|
1340
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1341
|
+
} else {
|
|
1342
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1343
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1344
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1345
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1346
|
+
} else {
|
|
1347
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1348
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1349
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1350
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1351
|
+
} else {
|
|
1352
|
+
const copyOfStruct_3 = matchValue_3;
|
|
1353
|
+
if (copyOfStruct_3.tag === /* Error */ 1) {
|
|
1354
|
+
const er_3 = copyOfStruct_3.fields[0];
|
|
1355
|
+
return (0, _Result.FSharpResult$2_Error)(er_3);
|
|
1356
|
+
} else {
|
|
1357
|
+
const v1 = copyOfStruct.fields[0];
|
|
1358
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1359
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1360
|
+
const v4 = copyOfStruct_3.fields[0];
|
|
1361
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3, v4));
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
function map5(ctor, d1, d2, d3, d4, d5, path, value_1) {
|
|
1368
|
+
const matchValue = d1(path, value_1);
|
|
1369
|
+
const matchValue_1 = d2(path, value_1);
|
|
1370
|
+
const matchValue_2 = d3(path, value_1);
|
|
1371
|
+
const matchValue_3 = d4(path, value_1);
|
|
1372
|
+
const matchValue_4 = d5(path, value_1);
|
|
1373
|
+
const copyOfStruct = matchValue;
|
|
1374
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1375
|
+
const er = copyOfStruct.fields[0];
|
|
1376
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1377
|
+
} else {
|
|
1378
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1379
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1380
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1381
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1382
|
+
} else {
|
|
1383
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1384
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1385
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1386
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1387
|
+
} else {
|
|
1388
|
+
const copyOfStruct_3 = matchValue_3;
|
|
1389
|
+
if (copyOfStruct_3.tag === /* Error */ 1) {
|
|
1390
|
+
const er_3 = copyOfStruct_3.fields[0];
|
|
1391
|
+
return (0, _Result.FSharpResult$2_Error)(er_3);
|
|
1392
|
+
} else {
|
|
1393
|
+
const copyOfStruct_4 = matchValue_4;
|
|
1394
|
+
if (copyOfStruct_4.tag === /* Error */ 1) {
|
|
1395
|
+
const er_4 = copyOfStruct_4.fields[0];
|
|
1396
|
+
return (0, _Result.FSharpResult$2_Error)(er_4);
|
|
1397
|
+
} else {
|
|
1398
|
+
const v1 = copyOfStruct.fields[0];
|
|
1399
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1400
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1401
|
+
const v4 = copyOfStruct_3.fields[0];
|
|
1402
|
+
const v5 = copyOfStruct_4.fields[0];
|
|
1403
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3, v4, v5));
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
function map6(ctor, d1, d2, d3, d4, d5, d6, path, value_1) {
|
|
1411
|
+
const matchValue = d1(path, value_1);
|
|
1412
|
+
const matchValue_1 = d2(path, value_1);
|
|
1413
|
+
const matchValue_2 = d3(path, value_1);
|
|
1414
|
+
const matchValue_3 = d4(path, value_1);
|
|
1415
|
+
const matchValue_4 = d5(path, value_1);
|
|
1416
|
+
const matchValue_5 = d6(path, value_1);
|
|
1417
|
+
const copyOfStruct = matchValue;
|
|
1418
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1419
|
+
const er = copyOfStruct.fields[0];
|
|
1420
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1421
|
+
} else {
|
|
1422
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1423
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1424
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1425
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1426
|
+
} else {
|
|
1427
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1428
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1429
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1430
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1431
|
+
} else {
|
|
1432
|
+
const copyOfStruct_3 = matchValue_3;
|
|
1433
|
+
if (copyOfStruct_3.tag === /* Error */ 1) {
|
|
1434
|
+
const er_3 = copyOfStruct_3.fields[0];
|
|
1435
|
+
return (0, _Result.FSharpResult$2_Error)(er_3);
|
|
1436
|
+
} else {
|
|
1437
|
+
const copyOfStruct_4 = matchValue_4;
|
|
1438
|
+
if (copyOfStruct_4.tag === /* Error */ 1) {
|
|
1439
|
+
const er_4 = copyOfStruct_4.fields[0];
|
|
1440
|
+
return (0, _Result.FSharpResult$2_Error)(er_4);
|
|
1441
|
+
} else {
|
|
1442
|
+
const copyOfStruct_5 = matchValue_5;
|
|
1443
|
+
if (copyOfStruct_5.tag === /* Error */ 1) {
|
|
1444
|
+
const er_5 = copyOfStruct_5.fields[0];
|
|
1445
|
+
return (0, _Result.FSharpResult$2_Error)(er_5);
|
|
1446
|
+
} else {
|
|
1447
|
+
const v1 = copyOfStruct.fields[0];
|
|
1448
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1449
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1450
|
+
const v4 = copyOfStruct_3.fields[0];
|
|
1451
|
+
const v5 = copyOfStruct_4.fields[0];
|
|
1452
|
+
const v6 = copyOfStruct_5.fields[0];
|
|
1453
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3, v4, v5, v6));
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
function map7(ctor, d1, d2, d3, d4, d5, d6, d7, path, value_1) {
|
|
1462
|
+
const matchValue = d1(path, value_1);
|
|
1463
|
+
const matchValue_1 = d2(path, value_1);
|
|
1464
|
+
const matchValue_2 = d3(path, value_1);
|
|
1465
|
+
const matchValue_3 = d4(path, value_1);
|
|
1466
|
+
const matchValue_4 = d5(path, value_1);
|
|
1467
|
+
const matchValue_5 = d6(path, value_1);
|
|
1468
|
+
const matchValue_6 = d7(path, value_1);
|
|
1469
|
+
const copyOfStruct = matchValue;
|
|
1470
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1471
|
+
const er = copyOfStruct.fields[0];
|
|
1472
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1473
|
+
} else {
|
|
1474
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1475
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1476
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1477
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1478
|
+
} else {
|
|
1479
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1480
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1481
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1482
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1483
|
+
} else {
|
|
1484
|
+
const copyOfStruct_3 = matchValue_3;
|
|
1485
|
+
if (copyOfStruct_3.tag === /* Error */ 1) {
|
|
1486
|
+
const er_3 = copyOfStruct_3.fields[0];
|
|
1487
|
+
return (0, _Result.FSharpResult$2_Error)(er_3);
|
|
1488
|
+
} else {
|
|
1489
|
+
const copyOfStruct_4 = matchValue_4;
|
|
1490
|
+
if (copyOfStruct_4.tag === /* Error */ 1) {
|
|
1491
|
+
const er_4 = copyOfStruct_4.fields[0];
|
|
1492
|
+
return (0, _Result.FSharpResult$2_Error)(er_4);
|
|
1493
|
+
} else {
|
|
1494
|
+
const copyOfStruct_5 = matchValue_5;
|
|
1495
|
+
if (copyOfStruct_5.tag === /* Error */ 1) {
|
|
1496
|
+
const er_5 = copyOfStruct_5.fields[0];
|
|
1497
|
+
return (0, _Result.FSharpResult$2_Error)(er_5);
|
|
1498
|
+
} else {
|
|
1499
|
+
const copyOfStruct_6 = matchValue_6;
|
|
1500
|
+
if (copyOfStruct_6.tag === /* Error */ 1) {
|
|
1501
|
+
const er_6 = copyOfStruct_6.fields[0];
|
|
1502
|
+
return (0, _Result.FSharpResult$2_Error)(er_6);
|
|
1503
|
+
} else {
|
|
1504
|
+
const v1 = copyOfStruct.fields[0];
|
|
1505
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1506
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1507
|
+
const v4 = copyOfStruct_3.fields[0];
|
|
1508
|
+
const v5 = copyOfStruct_4.fields[0];
|
|
1509
|
+
const v6 = copyOfStruct_5.fields[0];
|
|
1510
|
+
const v7 = copyOfStruct_6.fields[0];
|
|
1511
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3, v4, v5, v6, v7));
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
function map8(ctor, d1, d2, d3, d4, d5, d6, d7, d8, path, value_1) {
|
|
1521
|
+
const matchValue = d1(path, value_1);
|
|
1522
|
+
const matchValue_1 = d2(path, value_1);
|
|
1523
|
+
const matchValue_2 = d3(path, value_1);
|
|
1524
|
+
const matchValue_3 = d4(path, value_1);
|
|
1525
|
+
const matchValue_4 = d5(path, value_1);
|
|
1526
|
+
const matchValue_5 = d6(path, value_1);
|
|
1527
|
+
const matchValue_6 = d7(path, value_1);
|
|
1528
|
+
const matchValue_7 = d8(path, value_1);
|
|
1529
|
+
const copyOfStruct = matchValue;
|
|
1530
|
+
if (copyOfStruct.tag === /* Error */ 1) {
|
|
1531
|
+
const er = copyOfStruct.fields[0];
|
|
1532
|
+
return (0, _Result.FSharpResult$2_Error)(er);
|
|
1533
|
+
} else {
|
|
1534
|
+
const copyOfStruct_1 = matchValue_1;
|
|
1535
|
+
if (copyOfStruct_1.tag === /* Error */ 1) {
|
|
1536
|
+
const er_1 = copyOfStruct_1.fields[0];
|
|
1537
|
+
return (0, _Result.FSharpResult$2_Error)(er_1);
|
|
1538
|
+
} else {
|
|
1539
|
+
const copyOfStruct_2 = matchValue_2;
|
|
1540
|
+
if (copyOfStruct_2.tag === /* Error */ 1) {
|
|
1541
|
+
const er_2 = copyOfStruct_2.fields[0];
|
|
1542
|
+
return (0, _Result.FSharpResult$2_Error)(er_2);
|
|
1543
|
+
} else {
|
|
1544
|
+
const copyOfStruct_3 = matchValue_3;
|
|
1545
|
+
if (copyOfStruct_3.tag === /* Error */ 1) {
|
|
1546
|
+
const er_3 = copyOfStruct_3.fields[0];
|
|
1547
|
+
return (0, _Result.FSharpResult$2_Error)(er_3);
|
|
1548
|
+
} else {
|
|
1549
|
+
const copyOfStruct_4 = matchValue_4;
|
|
1550
|
+
if (copyOfStruct_4.tag === /* Error */ 1) {
|
|
1551
|
+
const er_4 = copyOfStruct_4.fields[0];
|
|
1552
|
+
return (0, _Result.FSharpResult$2_Error)(er_4);
|
|
1553
|
+
} else {
|
|
1554
|
+
const copyOfStruct_5 = matchValue_5;
|
|
1555
|
+
if (copyOfStruct_5.tag === /* Error */ 1) {
|
|
1556
|
+
const er_5 = copyOfStruct_5.fields[0];
|
|
1557
|
+
return (0, _Result.FSharpResult$2_Error)(er_5);
|
|
1558
|
+
} else {
|
|
1559
|
+
const copyOfStruct_6 = matchValue_6;
|
|
1560
|
+
if (copyOfStruct_6.tag === /* Error */ 1) {
|
|
1561
|
+
const er_6 = copyOfStruct_6.fields[0];
|
|
1562
|
+
return (0, _Result.FSharpResult$2_Error)(er_6);
|
|
1563
|
+
} else {
|
|
1564
|
+
const copyOfStruct_7 = matchValue_7;
|
|
1565
|
+
if (copyOfStruct_7.tag === /* Error */ 1) {
|
|
1566
|
+
const er_7 = copyOfStruct_7.fields[0];
|
|
1567
|
+
return (0, _Result.FSharpResult$2_Error)(er_7);
|
|
1568
|
+
} else {
|
|
1569
|
+
const v1 = copyOfStruct.fields[0];
|
|
1570
|
+
const v2 = copyOfStruct_1.fields[0];
|
|
1571
|
+
const v3 = copyOfStruct_2.fields[0];
|
|
1572
|
+
const v4 = copyOfStruct_3.fields[0];
|
|
1573
|
+
const v5 = copyOfStruct_4.fields[0];
|
|
1574
|
+
const v6 = copyOfStruct_5.fields[0];
|
|
1575
|
+
const v7 = copyOfStruct_6.fields[0];
|
|
1576
|
+
const v8 = copyOfStruct_7.fields[0];
|
|
1577
|
+
return (0, _Result.FSharpResult$2_Ok)(ctor(v1, v2, v3, v4, v5, v6, v7, v8));
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function andMap() {
|
|
1588
|
+
return (d)=>(d_1)=>(path)=>(value_1)=>map2((arg, func)=>func(arg), (0, _Util.uncurry2)(d), (0, _Util.uncurry2)(d_1), path, value_1);
|
|
1589
|
+
}
|
|
1590
|
+
function unwrapWith(errors, path, decoder, value_1) {
|
|
1591
|
+
const matchValue = decoder(path, value_1);
|
|
1592
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1593
|
+
const er = matchValue.fields[0];
|
|
1594
|
+
void errors.push(er);
|
|
1595
|
+
return (0, _Util.defaultOf)();
|
|
1596
|
+
} else {
|
|
1597
|
+
return matchValue.fields[0];
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
class Getters$1 {
|
|
1601
|
+
get Required() {
|
|
1602
|
+
const __ = this;
|
|
1603
|
+
return __.required;
|
|
1604
|
+
}
|
|
1605
|
+
get Optional() {
|
|
1606
|
+
const __ = this;
|
|
1607
|
+
return __.optional;
|
|
1608
|
+
}
|
|
1609
|
+
constructor(path, v){
|
|
1610
|
+
let _this, _this_1;
|
|
1611
|
+
this.errors = [];
|
|
1612
|
+
this.required = (_this = this, {
|
|
1613
|
+
Field (fieldName, decoder) {
|
|
1614
|
+
return unwrapWith(_this.errors, path, (path_1, value_1)=>field(fieldName, decoder, path_1, value_1), v);
|
|
1615
|
+
},
|
|
1616
|
+
At (fieldNames, decoder_2) {
|
|
1617
|
+
return unwrapWith(_this.errors, path, (firstPath, firstValue)=>at(fieldNames, decoder_2, firstPath, firstValue), v);
|
|
1618
|
+
},
|
|
1619
|
+
Raw (decoder_4) {
|
|
1620
|
+
return unwrapWith(_this.errors, path, decoder_4, v);
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1623
|
+
this.optional = (_this_1 = this, {
|
|
1624
|
+
Field (fieldName_1, decoder_5) {
|
|
1625
|
+
return unwrapWith(_this_1.errors, path, (path_2, value_2)=>optional(fieldName_1, decoder_5, path_2, value_2), v);
|
|
1626
|
+
},
|
|
1627
|
+
At (fieldNames_1, decoder_7) {
|
|
1628
|
+
return unwrapWith(_this_1.errors, path, (firstPath_1, firstValue_1)=>optionalAt(fieldNames_1, decoder_7, firstPath_1, firstValue_1), v);
|
|
1629
|
+
},
|
|
1630
|
+
Raw (decoder_9) {
|
|
1631
|
+
const matchValue = decoder_9(path, v);
|
|
1632
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
1633
|
+
const reason = matchValue.fields[0][1];
|
|
1634
|
+
const error = matchValue.fields[0];
|
|
1635
|
+
let matchResult, v_2;
|
|
1636
|
+
switch(reason.tag){
|
|
1637
|
+
case /* BadField */ 3:
|
|
1638
|
+
case /* BadPath */ 4:
|
|
1639
|
+
{
|
|
1640
|
+
matchResult = 1;
|
|
1641
|
+
break;
|
|
1642
|
+
}
|
|
1643
|
+
case /* TooSmallArray */ 5:
|
|
1644
|
+
case /* FailMessage */ 6:
|
|
1645
|
+
case /* BadOneOf */ 7:
|
|
1646
|
+
{
|
|
1647
|
+
matchResult = 2;
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
case /* BadPrimitiveExtra */ 1:
|
|
1651
|
+
{
|
|
1652
|
+
matchResult = 0;
|
|
1653
|
+
v_2 = reason.fields[1];
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
case /* BadType */ 2:
|
|
1657
|
+
{
|
|
1658
|
+
matchResult = 0;
|
|
1659
|
+
v_2 = reason.fields[1];
|
|
1660
|
+
break;
|
|
1661
|
+
}
|
|
1662
|
+
default:
|
|
1663
|
+
{
|
|
1664
|
+
matchResult = 0;
|
|
1665
|
+
v_2 = reason.fields[1];
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
switch(matchResult){
|
|
1669
|
+
case 0:
|
|
1670
|
+
if (v_2 == null) {
|
|
1671
|
+
return undefined;
|
|
1672
|
+
} else {
|
|
1673
|
+
void _this_1.errors.push(error);
|
|
1674
|
+
return (0, _Util.defaultOf)();
|
|
1675
|
+
}
|
|
1676
|
+
case 1:
|
|
1677
|
+
return undefined;
|
|
1678
|
+
default:
|
|
1679
|
+
{
|
|
1680
|
+
void _this_1.errors.push(error);
|
|
1681
|
+
return (0, _Util.defaultOf)();
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
} else {
|
|
1685
|
+
return (0, _Option.some)(matchValue.fields[0]);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
function Getters$1_$reflection(gen0) {
|
|
1692
|
+
return (0, _Reflection.class_type)("Thoth.Json.Decode.Getters`1", [
|
|
1693
|
+
gen0
|
|
1694
|
+
], Getters$1);
|
|
1695
|
+
}
|
|
1696
|
+
function Getters$1_$ctor_4A51B60E(path, v) {
|
|
1697
|
+
return new Getters$1(path, v);
|
|
1698
|
+
}
|
|
1699
|
+
function Getters$1__get_Errors(__) {
|
|
1700
|
+
return (0, _Seq.toList)(__.errors);
|
|
1701
|
+
}
|
|
1702
|
+
function object(builder, path, v) {
|
|
1703
|
+
const getters = Getters$1_$ctor_4A51B60E(path, v);
|
|
1704
|
+
const result = builder(getters);
|
|
1705
|
+
const matchValue = Getters$1__get_Errors(getters);
|
|
1706
|
+
if (!(0, _List.isEmpty)(matchValue)) {
|
|
1707
|
+
const errors = matchValue;
|
|
1708
|
+
if ((0, _List.length)(errors) > 1) {
|
|
1709
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1710
|
+
path,
|
|
1711
|
+
(0, _Typesfs.ErrorReason_BadOneOf)((0, _List.map)((tupledArg)=>errorToString(tupledArg[0], tupledArg[1]), errors))
|
|
1712
|
+
]);
|
|
1713
|
+
} else {
|
|
1714
|
+
return (0, _Result.FSharpResult$2_Error)((0, _List.head)(matchValue));
|
|
1715
|
+
}
|
|
1716
|
+
} else {
|
|
1717
|
+
return (0, _Result.FSharpResult$2_Ok)(result);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
function tuple2(decoder1, decoder2) {
|
|
1721
|
+
let decoder_3;
|
|
1722
|
+
const decoder = decoder1;
|
|
1723
|
+
decoder_3 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1724
|
+
return (path_3)=>(value_4)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1725
|
+
let decoder_2;
|
|
1726
|
+
const decoder_1 = decoder2;
|
|
1727
|
+
decoder_2 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1728
|
+
return (path_2)=>(value_3)=>andThen((v2, arg10$0040, arg20$0040)=>succeed([
|
|
1729
|
+
v1,
|
|
1730
|
+
v2
|
|
1731
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_2), path_2, value_3);
|
|
1732
|
+
}), (0, _Util.uncurry2)(decoder_3), path_3, value_4);
|
|
1733
|
+
}
|
|
1734
|
+
function tuple3(decoder1, decoder2, decoder3) {
|
|
1735
|
+
let decoder_5;
|
|
1736
|
+
const decoder = decoder1;
|
|
1737
|
+
decoder_5 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1738
|
+
return (path_5)=>(value_6)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1739
|
+
let decoder_4;
|
|
1740
|
+
const decoder_1 = decoder2;
|
|
1741
|
+
decoder_4 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1742
|
+
return (path_4)=>(value_5)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1743
|
+
let decoder_3;
|
|
1744
|
+
const decoder_2 = decoder3;
|
|
1745
|
+
decoder_3 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1746
|
+
return (path_3)=>(value_4)=>andThen((v3, arg10$0040, arg20$0040)=>succeed([
|
|
1747
|
+
v1,
|
|
1748
|
+
v2,
|
|
1749
|
+
v3
|
|
1750
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_3), path_3, value_4);
|
|
1751
|
+
}), (0, _Util.uncurry2)(decoder_4), path_4, value_5);
|
|
1752
|
+
}), (0, _Util.uncurry2)(decoder_5), path_5, value_6);
|
|
1753
|
+
}
|
|
1754
|
+
function tuple4(decoder1, decoder2, decoder3, decoder4) {
|
|
1755
|
+
let decoder_7;
|
|
1756
|
+
const decoder = decoder1;
|
|
1757
|
+
decoder_7 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1758
|
+
return (path_7)=>(value_8)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1759
|
+
let decoder_6;
|
|
1760
|
+
const decoder_1 = decoder2;
|
|
1761
|
+
decoder_6 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1762
|
+
return (path_6)=>(value_7)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1763
|
+
let decoder_5;
|
|
1764
|
+
const decoder_2 = decoder3;
|
|
1765
|
+
decoder_5 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1766
|
+
return (path_5)=>(value_6)=>andThen((0, _Util.uncurry3)((v3)=>{
|
|
1767
|
+
let decoder_4;
|
|
1768
|
+
const decoder_3 = decoder4;
|
|
1769
|
+
decoder_4 = (path_3)=>(value_4)=>index(3, decoder_3, path_3, value_4);
|
|
1770
|
+
return (path_4)=>(value_5)=>andThen((v4, arg10$0040, arg20$0040)=>succeed([
|
|
1771
|
+
v1,
|
|
1772
|
+
v2,
|
|
1773
|
+
v3,
|
|
1774
|
+
v4
|
|
1775
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_4), path_4, value_5);
|
|
1776
|
+
}), (0, _Util.uncurry2)(decoder_5), path_5, value_6);
|
|
1777
|
+
}), (0, _Util.uncurry2)(decoder_6), path_6, value_7);
|
|
1778
|
+
}), (0, _Util.uncurry2)(decoder_7), path_7, value_8);
|
|
1779
|
+
}
|
|
1780
|
+
function tuple5(decoder1, decoder2, decoder3, decoder4, decoder5) {
|
|
1781
|
+
let decoder_9;
|
|
1782
|
+
const decoder = decoder1;
|
|
1783
|
+
decoder_9 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1784
|
+
return (path_9)=>(value_10)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1785
|
+
let decoder_8;
|
|
1786
|
+
const decoder_1 = decoder2;
|
|
1787
|
+
decoder_8 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1788
|
+
return (path_8)=>(value_9)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1789
|
+
let decoder_7;
|
|
1790
|
+
const decoder_2 = decoder3;
|
|
1791
|
+
decoder_7 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1792
|
+
return (path_7)=>(value_8)=>andThen((0, _Util.uncurry3)((v3)=>{
|
|
1793
|
+
let decoder_6;
|
|
1794
|
+
const decoder_3 = decoder4;
|
|
1795
|
+
decoder_6 = (path_3)=>(value_4)=>index(3, decoder_3, path_3, value_4);
|
|
1796
|
+
return (path_6)=>(value_7)=>andThen((0, _Util.uncurry3)((v4)=>{
|
|
1797
|
+
let decoder_5;
|
|
1798
|
+
const decoder_4 = decoder5;
|
|
1799
|
+
decoder_5 = (path_4)=>(value_5)=>index(4, decoder_4, path_4, value_5);
|
|
1800
|
+
return (path_5)=>(value_6)=>andThen((v5, arg10$0040, arg20$0040)=>succeed([
|
|
1801
|
+
v1,
|
|
1802
|
+
v2,
|
|
1803
|
+
v3,
|
|
1804
|
+
v4,
|
|
1805
|
+
v5
|
|
1806
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_5), path_5, value_6);
|
|
1807
|
+
}), (0, _Util.uncurry2)(decoder_6), path_6, value_7);
|
|
1808
|
+
}), (0, _Util.uncurry2)(decoder_7), path_7, value_8);
|
|
1809
|
+
}), (0, _Util.uncurry2)(decoder_8), path_8, value_9);
|
|
1810
|
+
}), (0, _Util.uncurry2)(decoder_9), path_9, value_10);
|
|
1811
|
+
}
|
|
1812
|
+
function tuple6(decoder1, decoder2, decoder3, decoder4, decoder5, decoder6) {
|
|
1813
|
+
let decoder_11;
|
|
1814
|
+
const decoder = decoder1;
|
|
1815
|
+
decoder_11 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1816
|
+
return (path_11)=>(value_12)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1817
|
+
let decoder_10;
|
|
1818
|
+
const decoder_1 = decoder2;
|
|
1819
|
+
decoder_10 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1820
|
+
return (path_10)=>(value_11)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1821
|
+
let decoder_9;
|
|
1822
|
+
const decoder_2 = decoder3;
|
|
1823
|
+
decoder_9 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1824
|
+
return (path_9)=>(value_10)=>andThen((0, _Util.uncurry3)((v3)=>{
|
|
1825
|
+
let decoder_8;
|
|
1826
|
+
const decoder_3 = decoder4;
|
|
1827
|
+
decoder_8 = (path_3)=>(value_4)=>index(3, decoder_3, path_3, value_4);
|
|
1828
|
+
return (path_8)=>(value_9)=>andThen((0, _Util.uncurry3)((v4)=>{
|
|
1829
|
+
let decoder_7;
|
|
1830
|
+
const decoder_4 = decoder5;
|
|
1831
|
+
decoder_7 = (path_4)=>(value_5)=>index(4, decoder_4, path_4, value_5);
|
|
1832
|
+
return (path_7)=>(value_8)=>andThen((0, _Util.uncurry3)((v5)=>{
|
|
1833
|
+
let decoder_6;
|
|
1834
|
+
const decoder_5 = decoder6;
|
|
1835
|
+
decoder_6 = (path_5)=>(value_6)=>index(5, decoder_5, path_5, value_6);
|
|
1836
|
+
return (path_6)=>(value_7)=>andThen((v6, arg10$0040, arg20$0040)=>succeed([
|
|
1837
|
+
v1,
|
|
1838
|
+
v2,
|
|
1839
|
+
v3,
|
|
1840
|
+
v4,
|
|
1841
|
+
v5,
|
|
1842
|
+
v6
|
|
1843
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_6), path_6, value_7);
|
|
1844
|
+
}), (0, _Util.uncurry2)(decoder_7), path_7, value_8);
|
|
1845
|
+
}), (0, _Util.uncurry2)(decoder_8), path_8, value_9);
|
|
1846
|
+
}), (0, _Util.uncurry2)(decoder_9), path_9, value_10);
|
|
1847
|
+
}), (0, _Util.uncurry2)(decoder_10), path_10, value_11);
|
|
1848
|
+
}), (0, _Util.uncurry2)(decoder_11), path_11, value_12);
|
|
1849
|
+
}
|
|
1850
|
+
function tuple7(decoder1, decoder2, decoder3, decoder4, decoder5, decoder6, decoder7) {
|
|
1851
|
+
let decoder_13;
|
|
1852
|
+
const decoder = decoder1;
|
|
1853
|
+
decoder_13 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1854
|
+
return (path_13)=>(value_14)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1855
|
+
let decoder_12;
|
|
1856
|
+
const decoder_1 = decoder2;
|
|
1857
|
+
decoder_12 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1858
|
+
return (path_12)=>(value_13)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1859
|
+
let decoder_11;
|
|
1860
|
+
const decoder_2 = decoder3;
|
|
1861
|
+
decoder_11 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1862
|
+
return (path_11)=>(value_12)=>andThen((0, _Util.uncurry3)((v3)=>{
|
|
1863
|
+
let decoder_10;
|
|
1864
|
+
const decoder_3 = decoder4;
|
|
1865
|
+
decoder_10 = (path_3)=>(value_4)=>index(3, decoder_3, path_3, value_4);
|
|
1866
|
+
return (path_10)=>(value_11)=>andThen((0, _Util.uncurry3)((v4)=>{
|
|
1867
|
+
let decoder_9;
|
|
1868
|
+
const decoder_4 = decoder5;
|
|
1869
|
+
decoder_9 = (path_4)=>(value_5)=>index(4, decoder_4, path_4, value_5);
|
|
1870
|
+
return (path_9)=>(value_10)=>andThen((0, _Util.uncurry3)((v5)=>{
|
|
1871
|
+
let decoder_8;
|
|
1872
|
+
const decoder_5 = decoder6;
|
|
1873
|
+
decoder_8 = (path_5)=>(value_6)=>index(5, decoder_5, path_5, value_6);
|
|
1874
|
+
return (path_8)=>(value_9)=>andThen((0, _Util.uncurry3)((v6)=>{
|
|
1875
|
+
let decoder_7;
|
|
1876
|
+
const decoder_6 = decoder7;
|
|
1877
|
+
decoder_7 = (path_6)=>(value_7)=>index(6, decoder_6, path_6, value_7);
|
|
1878
|
+
return (path_7)=>(value_8)=>andThen((v7, arg10$0040, arg20$0040)=>succeed([
|
|
1879
|
+
v1,
|
|
1880
|
+
v2,
|
|
1881
|
+
v3,
|
|
1882
|
+
v4,
|
|
1883
|
+
v5,
|
|
1884
|
+
v6,
|
|
1885
|
+
v7
|
|
1886
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_7), path_7, value_8);
|
|
1887
|
+
}), (0, _Util.uncurry2)(decoder_8), path_8, value_9);
|
|
1888
|
+
}), (0, _Util.uncurry2)(decoder_9), path_9, value_10);
|
|
1889
|
+
}), (0, _Util.uncurry2)(decoder_10), path_10, value_11);
|
|
1890
|
+
}), (0, _Util.uncurry2)(decoder_11), path_11, value_12);
|
|
1891
|
+
}), (0, _Util.uncurry2)(decoder_12), path_12, value_13);
|
|
1892
|
+
}), (0, _Util.uncurry2)(decoder_13), path_13, value_14);
|
|
1893
|
+
}
|
|
1894
|
+
function tuple8(decoder1, decoder2, decoder3, decoder4, decoder5, decoder6, decoder7, decoder8) {
|
|
1895
|
+
let decoder_15;
|
|
1896
|
+
const decoder = decoder1;
|
|
1897
|
+
decoder_15 = (path)=>(value_1)=>index(0, decoder, path, value_1);
|
|
1898
|
+
return (path_15)=>(value_16)=>andThen((0, _Util.uncurry3)((v1)=>{
|
|
1899
|
+
let decoder_14;
|
|
1900
|
+
const decoder_1 = decoder2;
|
|
1901
|
+
decoder_14 = (path_1)=>(value_2)=>index(1, decoder_1, path_1, value_2);
|
|
1902
|
+
return (path_14)=>(value_15)=>andThen((0, _Util.uncurry3)((v2)=>{
|
|
1903
|
+
let decoder_13;
|
|
1904
|
+
const decoder_2 = decoder3;
|
|
1905
|
+
decoder_13 = (path_2)=>(value_3)=>index(2, decoder_2, path_2, value_3);
|
|
1906
|
+
return (path_13)=>(value_14)=>andThen((0, _Util.uncurry3)((v3)=>{
|
|
1907
|
+
let decoder_12;
|
|
1908
|
+
const decoder_3 = decoder4;
|
|
1909
|
+
decoder_12 = (path_3)=>(value_4)=>index(3, decoder_3, path_3, value_4);
|
|
1910
|
+
return (path_12)=>(value_13)=>andThen((0, _Util.uncurry3)((v4)=>{
|
|
1911
|
+
let decoder_11;
|
|
1912
|
+
const decoder_4 = decoder5;
|
|
1913
|
+
decoder_11 = (path_4)=>(value_5)=>index(4, decoder_4, path_4, value_5);
|
|
1914
|
+
return (path_11)=>(value_12)=>andThen((0, _Util.uncurry3)((v5)=>{
|
|
1915
|
+
let decoder_10;
|
|
1916
|
+
const decoder_5 = decoder6;
|
|
1917
|
+
decoder_10 = (path_5)=>(value_6)=>index(5, decoder_5, path_5, value_6);
|
|
1918
|
+
return (path_10)=>(value_11)=>andThen((0, _Util.uncurry3)((v6)=>{
|
|
1919
|
+
let decoder_9;
|
|
1920
|
+
const decoder_6 = decoder7;
|
|
1921
|
+
decoder_9 = (path_6)=>(value_7)=>index(6, decoder_6, path_6, value_7);
|
|
1922
|
+
return (path_9)=>(value_10)=>andThen((0, _Util.uncurry3)((v7)=>{
|
|
1923
|
+
let decoder_8;
|
|
1924
|
+
const decoder_7 = decoder8;
|
|
1925
|
+
decoder_8 = (path_7)=>(value_8)=>index(7, decoder_7, path_7, value_8);
|
|
1926
|
+
return (path_8)=>(value_9)=>andThen((v8, arg10$0040, arg20$0040)=>succeed([
|
|
1927
|
+
v1,
|
|
1928
|
+
v2,
|
|
1929
|
+
v3,
|
|
1930
|
+
v4,
|
|
1931
|
+
v5,
|
|
1932
|
+
v6,
|
|
1933
|
+
v7,
|
|
1934
|
+
v8
|
|
1935
|
+
], arg10$0040, arg20$0040), (0, _Util.uncurry2)(decoder_8), path_8, value_9);
|
|
1936
|
+
}), (0, _Util.uncurry2)(decoder_9), path_9, value_10);
|
|
1937
|
+
}), (0, _Util.uncurry2)(decoder_10), path_10, value_11);
|
|
1938
|
+
}), (0, _Util.uncurry2)(decoder_11), path_11, value_12);
|
|
1939
|
+
}), (0, _Util.uncurry2)(decoder_12), path_12, value_13);
|
|
1940
|
+
}), (0, _Util.uncurry2)(decoder_13), path_13, value_14);
|
|
1941
|
+
}), (0, _Util.uncurry2)(decoder_14), path_14, value_15);
|
|
1942
|
+
}), (0, _Util.uncurry2)(decoder_15), path_15, value_16);
|
|
1943
|
+
}
|
|
1944
|
+
function dict(decoder) {
|
|
1945
|
+
let d;
|
|
1946
|
+
const decoder_1 = decoder;
|
|
1947
|
+
d = (path)=>(value_1)=>keyValuePairs(decoder_1, path, value_1);
|
|
1948
|
+
return (path_1)=>(value_2)=>map((elements)=>(0, _Map.ofList)(elements, {
|
|
1949
|
+
Compare: _Util.comparePrimitives
|
|
1950
|
+
}), (0, _Util.uncurry2)(d), path_1, value_2);
|
|
1951
|
+
}
|
|
1952
|
+
function map$0027(keyDecoder, valueDecoder) {
|
|
1953
|
+
let d;
|
|
1954
|
+
const decoder = tuple2(keyDecoder, valueDecoder);
|
|
1955
|
+
d = (path)=>(value_1)=>array((0, _Util.uncurry2)(decoder), path, value_1);
|
|
1956
|
+
return (path_1)=>(value_2)=>map((elements)=>(0, _Map.ofSeq)(elements, {
|
|
1957
|
+
Compare: _Util.compare
|
|
1958
|
+
}), (0, _Util.uncurry2)(d), path_1, value_2);
|
|
1959
|
+
}
|
|
1960
|
+
function toMap(xs) {
|
|
1961
|
+
return (0, _Map.ofSeq)(xs, {
|
|
1962
|
+
Compare: _Util.compare
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
function toSet(xs) {
|
|
1966
|
+
return (0, _Set.ofSeq)(xs, {
|
|
1967
|
+
Compare: _Util.compare
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
function autoObject(decoderInfos, path, value_1) {
|
|
1971
|
+
if (!(value_1 === null ? false : Object.getPrototypeOf(value_1 || false) === Object.prototype)) {
|
|
1972
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1973
|
+
path,
|
|
1974
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an object", value_1)
|
|
1975
|
+
]);
|
|
1976
|
+
} else {
|
|
1977
|
+
return (0, _Array.foldBack)((tupledArg, acc)=>{
|
|
1978
|
+
const name = tupledArg[0];
|
|
1979
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1980
|
+
const result = acc.fields[0];
|
|
1981
|
+
return (0, _Result.Result_Map)((v)=>(0, _List.cons)(v, result), tupledArg[1](path + "." + name)(value_1[name]));
|
|
1982
|
+
} else {
|
|
1983
|
+
return acc;
|
|
1984
|
+
}
|
|
1985
|
+
}, decoderInfos, (0, _Result.FSharpResult$2_Ok)((0, _List.empty)()));
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
function autoObject2(keyDecoder, valueDecoder, path, value_1) {
|
|
1989
|
+
if (!(value_1 === null ? false : Object.getPrototypeOf(value_1 || false) === Object.prototype)) {
|
|
1990
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
1991
|
+
path,
|
|
1992
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an object", value_1)
|
|
1993
|
+
]);
|
|
1994
|
+
} else {
|
|
1995
|
+
return (0, _Seq.fold)((acc, name)=>{
|
|
1996
|
+
if (acc.tag === /* Ok */ 0) {
|
|
1997
|
+
const acc_1 = acc.fields[0];
|
|
1998
|
+
const matchValue = keyDecoder(path, name);
|
|
1999
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
2000
|
+
const k = matchValue.fields[0];
|
|
2001
|
+
const _arg = valueDecoder(path + "." + name, value_1[name]);
|
|
2002
|
+
if (_arg.tag === /* Ok */ 0) {
|
|
2003
|
+
return (0, _Result.FSharpResult$2_Ok)((0, _List.cons)([
|
|
2004
|
+
k,
|
|
2005
|
+
_arg.fields[0]
|
|
2006
|
+
], acc_1));
|
|
2007
|
+
} else {
|
|
2008
|
+
return (0, _Result.FSharpResult$2_Error)(_arg.fields[0]);
|
|
2009
|
+
}
|
|
2010
|
+
} else {
|
|
2011
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue.fields[0]);
|
|
2012
|
+
}
|
|
2013
|
+
} else {
|
|
2014
|
+
return acc;
|
|
2015
|
+
}
|
|
2016
|
+
}, (0, _Result.FSharpResult$2_Ok)((0, _List.empty)()), Object.keys(value_1));
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
function mixedArray(offset, decoders, path, values) {
|
|
2020
|
+
let arg_1;
|
|
2021
|
+
const expectedLength = decoders.length + offset | 0;
|
|
2022
|
+
if (expectedLength !== values.length) {
|
|
2023
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
2024
|
+
path,
|
|
2025
|
+
(0, _Typesfs.ErrorReason_FailMessage)((arg_1 = values.length | 0, (0, _String.toText)((0, _String.printf)("Expected array of length %i but got %i"))(expectedLength)(arg_1)))
|
|
2026
|
+
]);
|
|
2027
|
+
} else {
|
|
2028
|
+
let result = (0, _Result.FSharpResult$2_Ok)((0, _List.empty)());
|
|
2029
|
+
for(let i = offset; i <= values.length - 1; i++){
|
|
2030
|
+
if (result.tag === /* Ok */ 0) {
|
|
2031
|
+
const acc = result.fields[0];
|
|
2032
|
+
const path_1 = (0, _String.toText)((0, _String.printf)("%s[%i]"))(path)(i);
|
|
2033
|
+
const decoder = (0, _Array.item)(i - offset, decoders);
|
|
2034
|
+
const value_1 = (0, _Array.item)(i, values);
|
|
2035
|
+
result = (0, _Result.Result_Map)((v)=>(0, _List.cons)(v, acc), decoder(path_1)(value_1));
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
return (0, _Result.Result_Map)(_List.reverse, result);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
function makeUnion(extra, caseStrategy, t, name, path, values) {
|
|
2042
|
+
const uci = (0, _Array.tryFind)((x)=>(0, _Reflection.name)(x) === name, (0, _Reflection.getUnionCases)(t, true));
|
|
2043
|
+
if (uci != null) {
|
|
2044
|
+
const uci_1 = (0, _Option.value)(uci);
|
|
2045
|
+
const decoders = (0, _Array.map)((fi)=>autoDecoder(extra, caseStrategy, false, fi[1]), (0, _Reflection.getUnionCaseFields)(uci_1));
|
|
2046
|
+
return (0, _Result.Result_Map)((values_2)=>(0, _Reflection.makeUnion)(uci_1, (0, _List.toArray)(values_2), true), decoders.length === 0 && values.length <= 1 ? (0, _Result.FSharpResult$2_Ok)((0, _List.empty)()) : mixedArray(1, decoders, path, values));
|
|
2047
|
+
} else {
|
|
2048
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
2049
|
+
path,
|
|
2050
|
+
(0, _Typesfs.ErrorReason_FailMessage)("Cannot find case " + name + " in " + (0, _Reflection.fullName)(t))
|
|
2051
|
+
]);
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
function autoDecodeRecordsAndUnions(extra, caseStrategy, isOptional, t) {
|
|
2055
|
+
let arg;
|
|
2056
|
+
const decoderRef = new _Types.FSharpRef((0, _Util.defaultOf)());
|
|
2057
|
+
let extra_1;
|
|
2058
|
+
const matchValue = (0, _Reflection.fullName)(t);
|
|
2059
|
+
extra_1 = matchValue === "" ? extra : (0, _Map.add)(matchValue, decoderRef, extra);
|
|
2060
|
+
let decoder;
|
|
2061
|
+
if ((0, _Reflection.isRecord)(t, true)) {
|
|
2062
|
+
const decoders = (0, _Array.map)((fi)=>[
|
|
2063
|
+
(0, _Typesfs.Util_Casing_convert)(caseStrategy, (0, _Reflection.name)(fi)),
|
|
2064
|
+
autoDecoder(extra_1, caseStrategy, false, fi[1])
|
|
2065
|
+
], (0, _Reflection.getRecordElements)(t, true));
|
|
2066
|
+
decoder = (path)=>(value_1)=>(0, _Result.Result_Map)((xs)=>(0, _Reflection.makeRecord)(t, (0, _List.toArray)(xs), true), autoObject(decoders, path, value_1));
|
|
2067
|
+
} else if ((0, _Reflection.isUnion)(t, true)) {
|
|
2068
|
+
decoder = (path_1)=>(value_2)=>{
|
|
2069
|
+
if (typeof value_2 === "string") {
|
|
2070
|
+
return makeUnion(extra_1, caseStrategy, t, value_2, path_1, []);
|
|
2071
|
+
} else if (Array.isArray(value_2)) {
|
|
2072
|
+
const values = value_2;
|
|
2073
|
+
return (0, _Result.Result_Bind)((name_2)=>makeUnion(extra_1, caseStrategy, t, name_2, path_1, values), string(path_1 + "[0]", (0, _Array.item)(0, values)));
|
|
2074
|
+
} else {
|
|
2075
|
+
return (0, _Result.FSharpResult$2_Error)([
|
|
2076
|
+
path_1,
|
|
2077
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("a string or array", value_2)
|
|
2078
|
+
]);
|
|
2079
|
+
}
|
|
2080
|
+
};
|
|
2081
|
+
} else if (isOptional) {
|
|
2082
|
+
decoder = (path_2)=>(value_3)=>(0, _Result.FSharpResult$2_Error)([
|
|
2083
|
+
path_2,
|
|
2084
|
+
(0, _Typesfs.ErrorReason_BadType)("an extra coder for " + (0, _Reflection.fullName)(t), value_3)
|
|
2085
|
+
]);
|
|
2086
|
+
} else {
|
|
2087
|
+
throw new Error((arg = (0, _Reflection.fullName)(t), (0, _String.toText)((0, _String.printf)("Cannot generate auto decoder for %s. Please pass an extra decoder.\n\nDocumentation available at: https://thoth-org.github.io/Thoth.Json/documentation/auto/extra-coders.html#ready-to-use-extra-coders"))(arg)));
|
|
2088
|
+
}
|
|
2089
|
+
decoderRef.contents = decoder;
|
|
2090
|
+
return decoder;
|
|
2091
|
+
}
|
|
2092
|
+
function autoDecoder(extra, caseStrategy, isOptional, t) {
|
|
2093
|
+
let decoder_13, decoder_14, decoder_15, decoder_16;
|
|
2094
|
+
const fullname = (0, _Reflection.fullName)(t);
|
|
2095
|
+
const matchValue = (0, _Map.tryFind)(fullname, extra);
|
|
2096
|
+
if (matchValue == null) {
|
|
2097
|
+
if ((0, _Reflection.isArray)(t)) {
|
|
2098
|
+
const decoder = autoDecoder(extra, caseStrategy, false, (0, _Reflection.getElementType)(t));
|
|
2099
|
+
return (path_1)=>(value_2)=>array((0, _Util.uncurry2)(decoder), path_1, value_2);
|
|
2100
|
+
} else if ((0, _Reflection.isEnum)(t)) {
|
|
2101
|
+
const enumType = (0, _Reflection.fullName)((0, _Reflection.getEnumUnderlyingType)(t));
|
|
2102
|
+
switch(enumType){
|
|
2103
|
+
case "System.SByte":
|
|
2104
|
+
return (path_2)=>(value_4)=>{
|
|
2105
|
+
const t_2 = t;
|
|
2106
|
+
const path_3 = path_2;
|
|
2107
|
+
const value_5 = value_4;
|
|
2108
|
+
const matchValue_1 = sbyte(path_3)(value_5);
|
|
2109
|
+
if (matchValue_1.tag === /* Error */ 1) {
|
|
2110
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_1.fields[0]);
|
|
2111
|
+
} else {
|
|
2112
|
+
const enumValue = matchValue_1.fields[0] | 0;
|
|
2113
|
+
return (0, _Seq.contains)(enumValue, (0, _Reflection.getEnumValues)(t_2), {
|
|
2114
|
+
Equals: (x, y)=>x === y,
|
|
2115
|
+
GetHashCode: _Util.numberHash
|
|
2116
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_2, enumValue.toString())) : (0, _Result.FSharpResult$2_Error)([
|
|
2117
|
+
path_3,
|
|
2118
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_2), value_5, "Unkown value provided for the enum")
|
|
2119
|
+
]);
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
case "System.Byte":
|
|
2123
|
+
return (path_4)=>(value_7)=>{
|
|
2124
|
+
const t_3 = t;
|
|
2125
|
+
const path_5 = path_4;
|
|
2126
|
+
const value_8 = value_7;
|
|
2127
|
+
const matchValue_2 = byte(path_5)(value_8);
|
|
2128
|
+
if (matchValue_2.tag === /* Error */ 1) {
|
|
2129
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_2.fields[0]);
|
|
2130
|
+
} else {
|
|
2131
|
+
const enumValue_1 = matchValue_2.fields[0];
|
|
2132
|
+
return (0, _Seq.contains)(enumValue_1, (0, _Reflection.getEnumValues)(t_3), {
|
|
2133
|
+
Equals: (x_1, y_1)=>x_1 === y_1,
|
|
2134
|
+
GetHashCode: _Util.numberHash
|
|
2135
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_3, enumValue_1.toString())) : (0, _Result.FSharpResult$2_Error)([
|
|
2136
|
+
path_5,
|
|
2137
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_3), value_8, "Unkown value provided for the enum")
|
|
2138
|
+
]);
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
case "System.Int16":
|
|
2142
|
+
return (path_6)=>(value_10)=>{
|
|
2143
|
+
const t_4 = t;
|
|
2144
|
+
const path_7 = path_6;
|
|
2145
|
+
const value_11 = value_10;
|
|
2146
|
+
const matchValue_3 = int16(path_7)(value_11);
|
|
2147
|
+
if (matchValue_3.tag === /* Error */ 1) {
|
|
2148
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_3.fields[0]);
|
|
2149
|
+
} else {
|
|
2150
|
+
const enumValue_2 = matchValue_3.fields[0] | 0;
|
|
2151
|
+
return (0, _Seq.contains)(enumValue_2, (0, _Reflection.getEnumValues)(t_4), {
|
|
2152
|
+
Equals: (x_2, y_2)=>x_2 === y_2,
|
|
2153
|
+
GetHashCode: _Util.numberHash
|
|
2154
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_4, (0, _Util.int16ToString)(enumValue_2))) : (0, _Result.FSharpResult$2_Error)([
|
|
2155
|
+
path_7,
|
|
2156
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_4), value_11, "Unkown value provided for the enum")
|
|
2157
|
+
]);
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
case "System.UInt16":
|
|
2161
|
+
return (path_8)=>(value_13)=>{
|
|
2162
|
+
const t_5 = t;
|
|
2163
|
+
const path_9 = path_8;
|
|
2164
|
+
const value_14 = value_13;
|
|
2165
|
+
const matchValue_4 = uint16(path_9)(value_14);
|
|
2166
|
+
if (matchValue_4.tag === /* Error */ 1) {
|
|
2167
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_4.fields[0]);
|
|
2168
|
+
} else {
|
|
2169
|
+
const enumValue_3 = matchValue_4.fields[0];
|
|
2170
|
+
return (0, _Seq.contains)(enumValue_3, (0, _Reflection.getEnumValues)(t_5), {
|
|
2171
|
+
Equals: (x_3, y_3)=>x_3 === y_3,
|
|
2172
|
+
GetHashCode: _Util.numberHash
|
|
2173
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_5, enumValue_3.toString())) : (0, _Result.FSharpResult$2_Error)([
|
|
2174
|
+
path_9,
|
|
2175
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_5), value_14, "Unkown value provided for the enum")
|
|
2176
|
+
]);
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
case "System.Int32":
|
|
2180
|
+
return (path_10)=>(value_16)=>{
|
|
2181
|
+
const t_6 = t;
|
|
2182
|
+
const path_11 = path_10;
|
|
2183
|
+
const value_17 = value_16;
|
|
2184
|
+
const matchValue_5 = int(path_11)(value_17);
|
|
2185
|
+
if (matchValue_5.tag === /* Error */ 1) {
|
|
2186
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_5.fields[0]);
|
|
2187
|
+
} else {
|
|
2188
|
+
const enumValue_4 = matchValue_5.fields[0] | 0;
|
|
2189
|
+
return (0, _Seq.contains)(enumValue_4, (0, _Reflection.getEnumValues)(t_6), {
|
|
2190
|
+
Equals: (x_4, y_4)=>x_4 === y_4,
|
|
2191
|
+
GetHashCode: _Util.numberHash
|
|
2192
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_6, (0, _Util.int32ToString)(enumValue_4))) : (0, _Result.FSharpResult$2_Error)([
|
|
2193
|
+
path_11,
|
|
2194
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_6), value_17, "Unkown value provided for the enum")
|
|
2195
|
+
]);
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
case "System.UInt32":
|
|
2199
|
+
return (path_12)=>(value_19)=>{
|
|
2200
|
+
const t_7 = t;
|
|
2201
|
+
const path_13 = path_12;
|
|
2202
|
+
const value_20 = value_19;
|
|
2203
|
+
const matchValue_6 = uint32(path_13)(value_20);
|
|
2204
|
+
if (matchValue_6.tag === /* Error */ 1) {
|
|
2205
|
+
return (0, _Result.FSharpResult$2_Error)(matchValue_6.fields[0]);
|
|
2206
|
+
} else {
|
|
2207
|
+
const enumValue_5 = matchValue_6.fields[0];
|
|
2208
|
+
return (0, _Seq.contains)(enumValue_5, (0, _Reflection.getEnumValues)(t_7), {
|
|
2209
|
+
Equals: (x_5, y_5)=>x_5 === y_5,
|
|
2210
|
+
GetHashCode: _Util.numberHash
|
|
2211
|
+
}) ? (0, _Result.FSharpResult$2_Ok)((0, _Reflection.parseEnum)(t_7, enumValue_5.toString())) : (0, _Result.FSharpResult$2_Error)([
|
|
2212
|
+
path_13,
|
|
2213
|
+
(0, _Typesfs.ErrorReason_BadPrimitiveExtra)((0, _Reflection.fullName)(t_7), value_20, "Unkown value provided for the enum")
|
|
2214
|
+
]);
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2217
|
+
default:
|
|
2218
|
+
{
|
|
2219
|
+
const arg = (0, _Reflection.fullName)(t);
|
|
2220
|
+
const clo_1 = (0, _String.toFail)((0, _String.printf)("Cannot generate auto decoder for %s.\nThoth.Json.Net only support the following enum types:\n- sbyte\n- byte\n- int16\n- uint16\n- int\n- uint32\nIf you can\'t use one of these types, please pass an extra decoder.\n "))(arg);
|
|
2221
|
+
return (arg_1)=>{
|
|
2222
|
+
const clo_2 = clo_1(arg_1);
|
|
2223
|
+
return clo_2;
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
} else if ((0, _Reflection.isGenericType)(t)) {
|
|
2228
|
+
if ((0, _Reflection.isTuple)(t)) {
|
|
2229
|
+
const decoders = (0, _Array.map)((t_8)=>autoDecoder(extra, caseStrategy, false, t_8), (0, _Reflection.getTupleElements)(t));
|
|
2230
|
+
return (path_14)=>(value_21)=>Array.isArray(value_21) ? (0, _Result.Result_Map)((xs)=>(0, _Reflection.makeTuple)((0, _List.toArray)(xs), t), mixedArray(0, decoders, path_14, value_21)) : (0, _Result.FSharpResult$2_Error)([
|
|
2231
|
+
path_14,
|
|
2232
|
+
(0, _Typesfs.ErrorReason_BadPrimitive)("an array", value_21)
|
|
2233
|
+
]);
|
|
2234
|
+
} else {
|
|
2235
|
+
const fullname_1 = (0, _Reflection.fullName)((0, _Reflection.getGenericTypeDefinition)(t));
|
|
2236
|
+
switch(fullname_1){
|
|
2237
|
+
case "Microsoft.FSharp.Core.FSharpOption`1[System.Object]":
|
|
2238
|
+
return decoder_13 = autoDecoder(extra, caseStrategy, true, (0, _Array.item)(0, (0, _Reflection.getGenerics)(t))), (path_15)=>(value_22)=>option((0, _Util.uncurry2)(decoder_13), path_15, value_22);
|
|
2239
|
+
case "Microsoft.FSharp.Collections.FSharpList`1[System.Object]":
|
|
2240
|
+
return decoder_14 = autoDecoder(extra, caseStrategy, false, (0, _Array.item)(0, (0, _Reflection.getGenerics)(t))), (path_16)=>(value_23)=>list((0, _Util.uncurry2)(decoder_14), path_16, value_23);
|
|
2241
|
+
case "System.Collections.Generic.IEnumerable`1[System.Object]":
|
|
2242
|
+
return decoder_15 = autoDecoder(extra, caseStrategy, false, (0, _Array.item)(0, (0, _Reflection.getGenerics)(t))), (path_17)=>(value_24)=>seq((0, _Util.uncurry2)(decoder_15), path_17, value_24);
|
|
2243
|
+
case "Microsoft.FSharp.Collections.FSharpMap`2[System.Object,System.Object]":
|
|
2244
|
+
{
|
|
2245
|
+
const keyDecoder = autoDecoder(extra, caseStrategy, false, (0, _Array.item)(0, (0, _Reflection.getGenerics)(t)));
|
|
2246
|
+
const valueDecoder = autoDecoder(extra, caseStrategy, false, (0, _Array.item)(1, (0, _Reflection.getGenerics)(t)));
|
|
2247
|
+
let d_20;
|
|
2248
|
+
const decoders_1 = (0, _List.ofArray)([
|
|
2249
|
+
(path_18)=>(value_25)=>autoObject2((0, _Util.uncurry2)(keyDecoder), (0, _Util.uncurry2)(valueDecoder), path_18, value_25),
|
|
2250
|
+
(decoder_16 = tuple2((0, _Util.uncurry2)(keyDecoder), (0, _Util.uncurry2)(valueDecoder)), (path_19)=>(value_26)=>list((0, _Util.uncurry2)(decoder_16), path_19, value_26))
|
|
2251
|
+
]);
|
|
2252
|
+
d_20 = (path_20)=>(value_27)=>oneOf(decoders_1, path_20, value_27);
|
|
2253
|
+
return (path_21)=>(value_29)=>map(toMap, (0, _Util.uncurry2)(d_20), path_21, value_29);
|
|
2254
|
+
}
|
|
2255
|
+
case "Microsoft.FSharp.Collections.FSharpSet`1[System.Object]":
|
|
2256
|
+
{
|
|
2257
|
+
const decoder_17 = autoDecoder(extra, caseStrategy, false, (0, _Array.item)(0, (0, _Reflection.getGenerics)(t)));
|
|
2258
|
+
return (path_22)=>(value_30)=>{
|
|
2259
|
+
const matchValue_7 = array((0, _Util.uncurry2)(decoder_17), path_22, value_30);
|
|
2260
|
+
return matchValue_7.tag === /* Ok */ 0 ? (0, _Result.FSharpResult$2_Ok)(toSet(matchValue_7.fields[0])) : (0, _Result.FSharpResult$2_Error)(matchValue_7.fields[0]);
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
default:
|
|
2264
|
+
return autoDecodeRecordsAndUnions(extra, caseStrategy, isOptional, t);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
} else {
|
|
2268
|
+
switch(fullname){
|
|
2269
|
+
case "System.Boolean":
|
|
2270
|
+
return (path_23)=>(value_32)=>bool(path_23, value_32);
|
|
2271
|
+
case "Microsoft.FSharp.Core.Unit":
|
|
2272
|
+
return (path_24)=>(value_33)=>unit(path_24, value_33);
|
|
2273
|
+
case "System.String":
|
|
2274
|
+
return (path_25)=>(value_34)=>string(path_25, value_34);
|
|
2275
|
+
case "System.Char":
|
|
2276
|
+
return (path_26)=>(value_35)=>char(path_26, value_35);
|
|
2277
|
+
case "System.SByte":
|
|
2278
|
+
return sbyte;
|
|
2279
|
+
case "System.Byte":
|
|
2280
|
+
return byte;
|
|
2281
|
+
case "System.Int16":
|
|
2282
|
+
return int16;
|
|
2283
|
+
case "System.UInt16":
|
|
2284
|
+
return uint16;
|
|
2285
|
+
case "System.Int32":
|
|
2286
|
+
return int;
|
|
2287
|
+
case "System.UInt32":
|
|
2288
|
+
return uint32;
|
|
2289
|
+
case "System.Double":
|
|
2290
|
+
return (path_27)=>(value_36)=>float(path_27, value_36);
|
|
2291
|
+
case "System.Single":
|
|
2292
|
+
return (path_28)=>(value_37)=>float32(path_28, value_37);
|
|
2293
|
+
case "System.DateTime":
|
|
2294
|
+
return (path_29)=>(value_38)=>datetimeUtc(path_29, value_38);
|
|
2295
|
+
case "System.DateTimeOffset":
|
|
2296
|
+
return (path_30)=>(value_39)=>datetimeOffset(path_30, value_39);
|
|
2297
|
+
case "System.TimeSpan":
|
|
2298
|
+
return (path_31)=>(value_40)=>timespan(path_31, value_40);
|
|
2299
|
+
case "System.Guid":
|
|
2300
|
+
return (path_32)=>(value_41)=>guid(path_32, value_41);
|
|
2301
|
+
case "System.Object":
|
|
2302
|
+
return (_arg_6)=>_Result.FSharpResult$2_Ok;
|
|
2303
|
+
default:
|
|
2304
|
+
return autoDecodeRecordsAndUnions(extra, caseStrategy, isOptional, t);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
} else {
|
|
2308
|
+
const decoderRef = (0, _Option.value)(matchValue);
|
|
2309
|
+
return (path)=>(value_1)=>decoderRef.contents(path)(value_1);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
function makeExtra(extra) {
|
|
2313
|
+
if (extra != null) {
|
|
2314
|
+
return (0, _Map.map)((_arg, tupledArg)=>new _Types.FSharpRef(tupledArg[1]), (0, _Option.value)(extra).Coders);
|
|
2315
|
+
} else {
|
|
2316
|
+
return (0, _Map.empty)({
|
|
2317
|
+
Compare: _Util.comparePrimitives
|
|
2318
|
+
});
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
class Auto {
|
|
2322
|
+
constructor(){}
|
|
2323
|
+
}
|
|
2324
|
+
function Auto_$reflection() {
|
|
2325
|
+
return (0, _Reflection.class_type)("Thoth.Json.Decode.Auto", undefined, Auto);
|
|
2326
|
+
}
|
|
2327
|
+
function Auto_generateBoxedDecoderCached_Z6670B51(t, caseStrategy, extra) {
|
|
2328
|
+
let y_1, y;
|
|
2329
|
+
const caseStrategy_1 = (0, _Option.defaultArg)(caseStrategy, (0, _Typesfs.CaseStrategy_PascalCase)());
|
|
2330
|
+
return (0, _Typesfs.Util_Cache$1__GetOrAdd_43981464)(_Typesfs.Util_CachedDecoders, (y_1 = (y = (0, _Reflection.fullName)(t), (0, _Types.toString)(caseStrategy_1) + y), (0, _Option.defaultArg)((0, _Option.map)((e)=>e.Hash, extra), "") + y_1), ()=>autoDecoder(makeExtra(extra), caseStrategy_1, false, t));
|
|
2331
|
+
}
|
|
2332
|
+
function Auto_generateBoxedDecoder_Z6670B51(t, caseStrategy, extra) {
|
|
2333
|
+
const caseStrategy_1 = (0, _Option.defaultArg)(caseStrategy, (0, _Typesfs.CaseStrategy_PascalCase)());
|
|
2334
|
+
return autoDecoder(makeExtra(extra), caseStrategy_1, false, t);
|
|
2335
|
+
} //# sourceMappingURL=Decode.fs.ts.map
|
|
2336
|
+
|
|
2337
|
+
//# sourceMappingURL=Decode.fs.js.map
|