@f1studio/form-spec 5.0.0-alpha.128 → 5.0.0-alpha.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  2. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +1 -1
  3. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
  4. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
  5. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
  6. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +3 -3
  7. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  8. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  9. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  10. package/FormSpec.FS/Migrator.d.ts.map +1 -1
  11. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +2 -2
  12. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  13. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  14. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +2 -2
  15. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  16. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  17. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +2 -2
  18. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  19. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  20. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +31 -20
  21. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  22. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +20 -20
  24. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  25. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +21 -21
  27. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -1
  28. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +109 -41
  29. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
  30. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  31. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +218 -53
  32. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  33. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  34. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +15 -8
  35. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  36. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  37. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +18 -12
  38. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  39. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  40. package/FormSpec.TS/FormSpec.FS/Migrator.js +4 -2
  41. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  42. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  43. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +4 -4
  44. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  45. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  46. package/FormSpec.TS/{fable_modules/Thoth.Json.10.4.1/Decode.fs.js → Thoth.Json/packages/Thoth.Json/Decode.js} +120 -113
  47. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
  48. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
  49. package/FormSpec.TS/{fable_modules/Thoth.Json.10.4.1/Encode.fs.js → Thoth.Json/packages/Thoth.Json/Encode.js} +7 -7
  50. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
  51. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
  52. package/FormSpec.TS/{fable_modules/Thoth.Json.10.4.1/Extra.fs.js → Thoth.Json/packages/Thoth.Json/Extra.js} +4 -4
  53. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
  54. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
  55. package/FormSpec.TS/{fable_modules/Thoth.Json.10.4.1/Types.fs.js → Thoth.Json/packages/Thoth.Json/Types.js} +2 -2
  56. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
  57. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
  58. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  59. package/README.md +7 -7
  60. package/{fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts → Thoth.Json/packages/Thoth.Json/Decode.d.ts} +2 -2
  61. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
  62. package/{fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts → Thoth.Json/packages/Thoth.Json/Encode.d.ts} +2 -2
  63. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
  64. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts +3 -0
  65. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
  66. package/{fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts → Thoth.Json/packages/Thoth.Json/Types.d.ts} +1 -1
  67. package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
  68. package/package.json +1 -1
  69. package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
  70. package/src/FormSpec.FS/FormSpecHelpers.ts +1 -1
  71. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
  72. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +29 -18
  73. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +4 -4
  74. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
  75. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +100 -17
  76. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +191 -64
  77. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +14 -7
  78. package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +17 -11
  79. package/src/FormSpec.FS/Migrator.ts +4 -2
  80. package/src/FormSpec.FS/PathwayExecutor.ts +1 -1
  81. package/src/Thoth.Json/packages/Thoth.Json/Decode.ts +1940 -0
  82. package/src/Thoth.Json/packages/Thoth.Json/Encode.ts +475 -0
  83. package/src/Thoth.Json/packages/Thoth.Json/Extra.ts +11 -0
  84. package/src/Thoth.Json/packages/Thoth.Json/Types.ts +176 -0
  85. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -1768
  86. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +0 -1
  87. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +0 -1
  88. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -811
  89. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +0 -1
  90. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +0 -1
  91. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -47
  92. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +0 -1
  93. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +0 -1
  94. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -34
  95. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -68
  96. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +0 -1
  97. package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +0 -1
  98. package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +0 -1
  99. package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +0 -1
  100. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts +0 -3
  101. package/fable_modules/Thoth.Json.10.4.1/Extra.fs.d.ts.map +0 -1
  102. package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +0 -1
@@ -0,0 +1,475 @@
1
+ import { decimal as decimal_1, toString as toString_1 } from "@fable-org/fable-library-js/Decimal.js";
2
+ import { comparePrimitives, Lazy, IDisposable, disposeSafe, IEnumerator, getEnumerator, defaultOf } from "@fable-org/fable-library-js/Util.js";
3
+ import { map as map_1, FSharpList } from "@fable-org/fable-library-js/List.js";
4
+ import { empty, map as map_5, tryFind, add, FSharpMap, toList } from "@fable-org/fable-library-js/Map.js";
5
+ import { uint64 as uint64_1, int64 as int64_1, toString as toString_2 } from "@fable-org/fable-library-js/BigInt.js";
6
+ import { toString as toString_3 } from "@fable-org/fable-library-js/Date.js";
7
+ import { toString as toString_4 } from "@fable-org/fable-library-js/TimeSpan.js";
8
+ import { defaultArg, value as value_44, Option, map as map_2, defaultArgWith, some } from "@fable-org/fable-library-js/Option.js";
9
+ import { float32, float64, uint32, uint16, int16, uint8, int8, int32 } from "@fable-org/fable-library-js/Int32.js";
10
+ import { toString as toString_5, FSharpRef } from "@fable-org/fable-library-js/Types.js";
11
+ import { class_type, TypeInfo, getGenerics, getGenericTypeDefinition, getTupleFields, getTupleElements, isTuple, isGenericType, getEnumUnderlyingType, isEnum, getElementType, isArray, getUnionCaseFields, getUnionFields, isUnion, getRecordElements, getRecordField, name, isRecord, fullName as fullName_1 } from "@fable-org/fable-library-js/Reflection.js";
12
+ import { item, setItem, fill, map as map_3 } from "@fable-org/fable-library-js/Array.js";
13
+ import { Util_CachedEncoders, Util_Cache$1__GetOrAdd_43981464, CaseStrategy_PascalCase, ExtraCoders, ErrorReason_$union, CaseStrategy_$union, Util_Casing_convert } from "./Types.js";
14
+ import { mapIndexed, map as map_4, fold } from "@fable-org/fable-library-js/Seq.js";
15
+ import { toFail, printf, toText } from "@fable-org/fable-library-js/String.js";
16
+ import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
17
+
18
+ /**
19
+ * **Description**
20
+ * Encode a GUID
21
+ *
22
+ * **Parameters**
23
+ * * `value` - parameter of type `System.Guid`
24
+ *
25
+ * **Output Type**
26
+ * * `Value`
27
+ *
28
+ * **Exceptions**
29
+ */
30
+ export function guid(value: string): any {
31
+ return value;
32
+ }
33
+
34
+ /**
35
+ * **Description**
36
+ * Encode a Decimal.
37
+ *
38
+ * **Parameters**
39
+ * * `value` - parameter of type `decimal`
40
+ *
41
+ * **Output Type**
42
+ * * `Value`
43
+ *
44
+ * **Exceptions**
45
+ */
46
+ export function decimal(value: decimal_1): any {
47
+ return toString_1(value);
48
+ }
49
+
50
+ export const nil: any = defaultOf();
51
+
52
+ /**
53
+ * **Description**
54
+ * Encode an object
55
+ *
56
+ * **Parameters**
57
+ * * `values` - parameter of type `(string * Value) list`
58
+ *
59
+ * **Output Type**
60
+ * * `Value`
61
+ *
62
+ * **Exceptions**
63
+ */
64
+ export function object(values: Iterable<[string, any]>): any {
65
+ const o: any = {};
66
+ const enumerator: IEnumerator<[string, any]> = getEnumerator(values);
67
+ try {
68
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
69
+ const forLoopVar: [string, any] = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
70
+ o[forLoopVar[0]] = forLoopVar[1];
71
+ }
72
+ }
73
+ finally {
74
+ disposeSafe(enumerator as IDisposable);
75
+ }
76
+ return o;
77
+ }
78
+
79
+ /**
80
+ * **Description**
81
+ * Encode a list
82
+ * **Parameters**
83
+ * * `values` - parameter of type `Value list`
84
+ *
85
+ * **Output Type**
86
+ * * `Value`
87
+ *
88
+ * **Exceptions**
89
+ */
90
+ export function list(values: FSharpList<any>): any {
91
+ return Array.from(values);
92
+ }
93
+
94
+ export function seq(values: Iterable<any>): any {
95
+ return Array.from(values);
96
+ }
97
+
98
+ /**
99
+ * **Description**
100
+ * Encode a dictionary
101
+ * **Parameters**
102
+ * * `values` - parameter of type `Map<string, Value>`
103
+ *
104
+ * **Output Type**
105
+ * * `Value`
106
+ *
107
+ * **Exceptions**
108
+ */
109
+ export function dict(values: FSharpMap<string, any>): any {
110
+ return object(toList<string, any>(values));
111
+ }
112
+
113
+ export function bigint(value: bigint): any {
114
+ return toString_2(value);
115
+ }
116
+
117
+ export function datetimeOffset(value: Date): any {
118
+ return toString_3(value, "O", {});
119
+ }
120
+
121
+ /**
122
+ * **Description**
123
+ * Encode a timespan
124
+ * **Parameters**
125
+ * * `value` - parameter of type `System.TimeSpan`
126
+ *
127
+ * **Output Type**
128
+ * * `Value`
129
+ *
130
+ * **Exceptions**
131
+ */
132
+ export function timespan(value: number): any {
133
+ return toString_4(value);
134
+ }
135
+
136
+ export function int64(value: int64_1): any {
137
+ return String(value);
138
+ }
139
+
140
+ export function uint64(value: uint64_1): any {
141
+ return String(value);
142
+ }
143
+
144
+ export function unit(): any {
145
+ return defaultOf();
146
+ }
147
+
148
+ export function tuple2<T1, T2>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), v1: T1, v2: T2): any {
149
+ return [enc1(v1), enc2(v2)];
150
+ }
151
+
152
+ export function tuple3<T1, T2, T3>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), v1: T1, v2: T2, v3: T3): any {
153
+ return [enc1(v1), enc2(v2), enc3(v3)];
154
+ }
155
+
156
+ export function tuple4<T1, T2, T3, T4>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), enc4: ((arg0: T4) => any), v1: T1, v2: T2, v3: T3, v4: T4): any {
157
+ return [enc1(v1), enc2(v2), enc3(v3), enc4(v4)];
158
+ }
159
+
160
+ export function tuple5<T1, T2, T3, T4, T5>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), enc4: ((arg0: T4) => any), enc5: ((arg0: T5) => any), v1: T1, v2: T2, v3: T3, v4: T4, v5: T5): any {
161
+ return [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5)];
162
+ }
163
+
164
+ export function tuple6<T1, T2, T3, T4, T5, T6>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), enc4: ((arg0: T4) => any), enc5: ((arg0: T5) => any), enc6: ((arg0: T6) => any), v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6): any {
165
+ return [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6)];
166
+ }
167
+
168
+ export function tuple7<T1, T2, T3, T4, T5, T6, T7>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), enc4: ((arg0: T4) => any), enc5: ((arg0: T5) => any), enc6: ((arg0: T6) => any), enc7: ((arg0: T7) => any), v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7): any {
169
+ return [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7)];
170
+ }
171
+
172
+ export function tuple8<T1, T2, T3, T4, T5, T6, T7, T8>(enc1: ((arg0: T1) => any), enc2: ((arg0: T2) => any), enc3: ((arg0: T3) => any), enc4: ((arg0: T4) => any), enc5: ((arg0: T5) => any), enc6: ((arg0: T6) => any), enc7: ((arg0: T7) => any), enc8: ((arg0: T8) => any), v1: T1, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6, v7: T7, v8: T8): any {
173
+ return [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7), enc8(v8)];
174
+ }
175
+
176
+ export function map<key, value>(keyEncoder: ((arg0: key) => any), valueEncoder: ((arg0: value) => any), values: FSharpMap<key, value>): any {
177
+ return list(map_1<[key, value], any>((tupledArg: [key, value]): any => tuple2<key, value>(keyEncoder, valueEncoder, tupledArg[0], tupledArg[1]), toList<key, value>(values)));
178
+ }
179
+
180
+ export function Enum_byte<TEnum>(value: TEnum): any {
181
+ return value;
182
+ }
183
+
184
+ export function Enum_sbyte<TEnum>(value: TEnum): any {
185
+ return value;
186
+ }
187
+
188
+ export function Enum_int16<TEnum>(value: TEnum): any {
189
+ return value;
190
+ }
191
+
192
+ export function Enum_uint16<TEnum>(value: TEnum): any {
193
+ return value;
194
+ }
195
+
196
+ export function Enum_int<TEnum>(value: TEnum): any {
197
+ return value;
198
+ }
199
+
200
+ export function Enum_uint32<TEnum>(value: TEnum): any {
201
+ return value;
202
+ }
203
+
204
+ /**
205
+ * **Description**
206
+ *
207
+ * The DateTime is always encoded using UTC representation
208
+ *
209
+ * **Parameters**
210
+ * * `value` - parameter of type `System.DateTime`
211
+ *
212
+ * **Output Type**
213
+ * * `Value`
214
+ *
215
+ * **Exceptions**
216
+ */
217
+ export function datetime(value: Date): any {
218
+ return toString_3(value, "O", {});
219
+ }
220
+
221
+ /**
222
+ * **Description**
223
+ * Convert a `Value` into a prettified string.
224
+ * **Parameters**
225
+ * * `space` - parameter of type `int` - Amount of indentation
226
+ * * `value` - parameter of type `obj` - Value to convert
227
+ *
228
+ * **Output Type**
229
+ * * `string`
230
+ *
231
+ * **Exceptions**
232
+ */
233
+ export function toString(space: int32, value: any): string {
234
+ return JSON.stringify(value, undefined, some(space));
235
+ }
236
+
237
+ /**
238
+ * **Description**
239
+ * Encode an option
240
+ * **Parameters**
241
+ * * `encoder` - parameter of type `'a -> Value`
242
+ *
243
+ * **Output Type**
244
+ * * `'a option -> Value`
245
+ *
246
+ * **Exceptions**
247
+ */
248
+ export function option<a>(encoder: ((arg0: a) => any)): ((arg0: Option<a>) => any) {
249
+ return (arg: Option<a>): any => defaultArgWith<any>(map_2<a, any>(encoder, arg), (): any => nil);
250
+ }
251
+
252
+ function autoEncodeRecordsAndUnions(extra: FSharpMap<string, FSharpRef<((arg0: any) => any)>>, caseStrategy: CaseStrategy_$union, skipNullField: boolean, t: any): ((arg0: any) => any) {
253
+ let arg: string;
254
+ const encoderRef: FSharpRef<((arg0: any) => any)> = new FSharpRef<((arg0: any) => any)>(defaultOf());
255
+ let extra_1: FSharpMap<string, FSharpRef<((arg0: any) => any)>>;
256
+ const matchValue: string = fullName_1(t);
257
+ extra_1 = ((matchValue === "") ? extra : add<string, FSharpRef<((arg0: any) => any)>>(matchValue, encoderRef, extra));
258
+ let encoder: ((arg0: any) => any);
259
+ if (isRecord(t, true)) {
260
+ const setters: ((arg0: any) => ((arg0: any) => any))[] = map_3<any, ((arg0: any) => ((arg0: any) => any))>((fi: any): ((arg0: any) => ((arg0: any) => any)) => {
261
+ const targetKey: string = Util_Casing_convert(caseStrategy, name(fi));
262
+ const encode_1: ((arg0: any) => any) = autoEncoder(extra_1, caseStrategy, skipNullField, fi[1]);
263
+ return (source: any): ((arg0: any) => any) => ((target: any): any => {
264
+ const value: any = getRecordField(source, fi);
265
+ if (!skipNullField ? true : (skipNullField && !(value == null))) {
266
+ target[targetKey]=encode_1(value);
267
+ }
268
+ return target;
269
+ });
270
+ }, getRecordElements(t, true));
271
+ encoder = ((source_1: any): any => fold<((arg0: any) => ((arg0: any) => any)), any>((target_1: any, set$: ((arg0: any) => ((arg0: any) => any))): any => set$(source_1)(target_1), {}, setters));
272
+ }
273
+ else if (isUnion(t, true)) {
274
+ encoder = ((value_1: any): any => {
275
+ const patternInput: [any, any[]] = getUnionFields(value_1, t, true);
276
+ const info: any = patternInput[0];
277
+ const fields: any[] = patternInput[1];
278
+ const matchValue_1: int32 = fields.length | 0;
279
+ if (matchValue_1 === 0) {
280
+ return name(info);
281
+ }
282
+ else {
283
+ const len: int32 = matchValue_1 | 0;
284
+ const fieldTypes: any[] = getUnionCaseFields(info);
285
+ const target_2: any[] = fill(new Array(len + 1), 0, len + 1, null);
286
+ setItem(target_2, 0, name(info));
287
+ for (let i = 1; i <= len; i++) {
288
+ const encode_2: ((arg0: any) => any) = autoEncoder(extra_1, caseStrategy, skipNullField, item(i - 1, fieldTypes)[1]);
289
+ setItem(target_2, i, encode_2(item(i - 1, fields)));
290
+ }
291
+ return target_2;
292
+ }
293
+ });
294
+ }
295
+ else {
296
+ throw new Error((arg = fullName_1(t), toText(printf("Cannot generate auto encoder for %s. Please pass an extra encoder.\n\nDocumentation available at: https://thoth-org.github.io/Thoth.Json/documentation/auto/extra-coders.html#ready-to-use-extra-coders"))(arg)));
297
+ }
298
+ encoderRef.contents = encoder;
299
+ return encoder;
300
+ }
301
+
302
+ function autoEncoder(extra: FSharpMap<string, FSharpRef<((arg0: any) => any)>>, caseStrategy: CaseStrategy_$union, skipNullField: boolean, t: any): ((arg0: any) => any) {
303
+ const fullname: string = fullName_1(t);
304
+ const matchValue: Option<FSharpRef<((arg0: any) => any)>> = tryFind<string, FSharpRef<((arg0: any) => any)>>(fullname, extra);
305
+ if (matchValue == null) {
306
+ if (isArray(t)) {
307
+ const encoder: ((arg0: any) => any) = autoEncoder(extra, caseStrategy, skipNullField, getElementType(t));
308
+ return (value: any): any => seq(map_4<any, any>(encoder, value as Iterable<any>));
309
+ }
310
+ else if (isEnum(t)) {
311
+ const enumType: string = fullName_1(getEnumUnderlyingType(t));
312
+ switch (enumType) {
313
+ case "System.SByte":
314
+ return (value_1: int8): any => value_1;
315
+ case "System.Byte":
316
+ return (value_3: uint8): any => value_3;
317
+ case "System.Int16":
318
+ return (value_5: int16): any => value_5;
319
+ case "System.UInt16":
320
+ return (value_7: uint16): any => value_7;
321
+ case "System.Int32":
322
+ return (value_9: int32): any => value_9;
323
+ case "System.UInt32":
324
+ return (value_11: uint32): any => value_11;
325
+ default: {
326
+ const arg: string = fullName_1(t);
327
+ const clo_1: ((arg0: any) => any) = toFail(printf("Cannot generate auto encoder for %s.\nThoth.Json.Net only support the following enum types:\n- sbyte\n- byte\n- int16\n- uint16\n- int\n- uint32\n\nIf you can\'t use one of these types, please pass an extra encoder.\n\nDocumentation available at: https://thoth-org.github.io/Thoth.Json/documentation/auto/extra-coders.html#ready-to-use-extra-coders\n "))(arg);
328
+ return clo_1;
329
+ }
330
+ }
331
+ }
332
+ else if (isGenericType(t)) {
333
+ if (isTuple(t)) {
334
+ const encoders: ((arg0: any) => any)[] = map_3<any, ((arg0: any) => any)>((t_2: any): ((arg0: any) => any) => autoEncoder(extra, caseStrategy, skipNullField, t_2), getTupleElements(t));
335
+ return (value_13: any): any => seq(mapIndexed<any, any>((i: int32, x: any): any => item(i, encoders)(x), getTupleFields(value_13)));
336
+ }
337
+ else {
338
+ const fullname_1: string = fullName_1(getGenericTypeDefinition(t));
339
+ if (fullname_1 === "Microsoft.FSharp.Core.FSharpOption`1[System.Object]") {
340
+ const encoder_2: any = new Lazy<((arg0: any) => any)>((): ((arg0: any) => any) => option<any>(autoEncoder(extra, caseStrategy, skipNullField, item(0, getGenerics(t)))));
341
+ return (value_14: any): any => {
342
+ if (value_14 == null) {
343
+ return nil;
344
+ }
345
+ else {
346
+ return encoder_2.Value(value_14);
347
+ }
348
+ };
349
+ }
350
+ else if (((fullname_1 === "Microsoft.FSharp.Collections.FSharpList`1[System.Object]") ? true : (fullname_1 === "Microsoft.FSharp.Collections.FSharpSet`1[System.Object]")) ? true : (fullname_1 === "System.Collections.Generic.IEnumerable`1[System.Object]")) {
351
+ const encoder_3: ((arg0: any) => any) = autoEncoder(extra, caseStrategy, skipNullField, item(0, getGenerics(t)));
352
+ return (value_15: any): any => seq(map_4<any, any>(encoder_3, value_15 as Iterable<any>));
353
+ }
354
+ else if (fullname_1 === "Microsoft.FSharp.Collections.FSharpMap`2[System.Object,System.Object]") {
355
+ const keyType: any = item(0, getGenerics(t));
356
+ const valueEncoder: ((arg0: any) => any) = autoEncoder(extra, caseStrategy, skipNullField, item(1, getGenerics(t)));
357
+ if ((fullName_1(keyType) === "System.String") ? true : (fullName_1(keyType) === "System.Guid")) {
358
+ return (value_16: any): any => fold<[string, any], any>((target: any, _arg: [string, any]): any => {
359
+ const activePatternResult: [string, any] = _arg;
360
+ target[activePatternResult[0]]=valueEncoder(activePatternResult[1]);
361
+ return target;
362
+ }, {}, value_16 as FSharpMap<string, any>);
363
+ }
364
+ else {
365
+ let keyEncoder: ((arg0: string) => any);
366
+ const clo_2: ((arg0: any) => any) = autoEncoder(extra, caseStrategy, skipNullField, keyType);
367
+ keyEncoder = (clo_2);
368
+ return (value_17: any): any => seq(map_4<[string, any], any>((_arg_1: [string, any]): any => {
369
+ const activePatternResult_1: [string, any] = _arg_1;
370
+ return [keyEncoder(activePatternResult_1[0]), valueEncoder(activePatternResult_1[1])];
371
+ }, value_17 as FSharpMap<string, any>));
372
+ }
373
+ }
374
+ else {
375
+ return autoEncodeRecordsAndUnions(extra, caseStrategy, skipNullField, t);
376
+ }
377
+ }
378
+ }
379
+ else {
380
+ switch (fullname) {
381
+ case "System.Boolean":
382
+ return (value_18: boolean): any => value_18;
383
+ case "Microsoft.FSharp.Core.Unit":
384
+ return unit;
385
+ case "System.String":
386
+ return (value_20: string): any => value_20;
387
+ case "System.Char":
388
+ return (value_22: string): any => value_22;
389
+ case "System.SByte":
390
+ return (value_24: int8): any => value_24;
391
+ case "System.Byte":
392
+ return (value_26: uint8): any => value_26;
393
+ case "System.Int16":
394
+ return (value_28: int16): any => value_28;
395
+ case "System.UInt16":
396
+ return (value_30: uint16): any => value_30;
397
+ case "System.Int32":
398
+ return (value_32: int32): any => value_32;
399
+ case "System.UInt32":
400
+ return (value_34: uint32): any => value_34;
401
+ case "System.Double":
402
+ return (value_36: float64): any => value_36;
403
+ case "System.Single":
404
+ return (value_38: float32): any => value_38;
405
+ case "System.DateTime":
406
+ return datetime;
407
+ case "System.DateTimeOffset":
408
+ return datetimeOffset;
409
+ case "System.TimeSpan":
410
+ return timespan;
411
+ case "System.Guid":
412
+ return guid;
413
+ case "System.Object":
414
+ return (x_1: any): any => x_1;
415
+ default:
416
+ return autoEncodeRecordsAndUnions(extra, caseStrategy, skipNullField, t);
417
+ }
418
+ }
419
+ }
420
+ else {
421
+ const encoderRef: FSharpRef<((arg0: any) => any)> = value_44(matchValue);
422
+ return (v: any): any => encoderRef.contents(v);
423
+ }
424
+ }
425
+
426
+ function makeExtra(extra: Option<ExtraCoders>): FSharpMap<string, FSharpRef<((arg0: any) => any)>> {
427
+ if (extra != null) {
428
+ return map_5<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))], FSharpRef<((arg0: any) => any)>>((_arg: string, tupledArg: [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]): FSharpRef<((arg0: any) => any)> => (new FSharpRef<((arg0: any) => any)>(tupledArg[0])), value_44(extra).Coders);
429
+ }
430
+ else {
431
+ return empty<string, FSharpRef<((arg0: any) => any)>>({
432
+ Compare: comparePrimitives,
433
+ });
434
+ }
435
+ }
436
+
437
+ export class Auto {
438
+ constructor() {
439
+ }
440
+ }
441
+
442
+ export function Auto_$reflection(): TypeInfo {
443
+ return class_type("Thoth.Json.Encode.Auto", undefined, Auto);
444
+ }
445
+
446
+ export function Auto_generateBoxedEncoderCached_437914C6(t: any, caseStrategy?: CaseStrategy_$union, extra?: ExtraCoders, skipNullField?: boolean): ((arg0: any) => any) {
447
+ let y_1: string, y: string;
448
+ const caseStrategy_1: CaseStrategy_$union = defaultArg<CaseStrategy_$union>(caseStrategy, CaseStrategy_PascalCase());
449
+ const skipNullField_1: boolean = defaultArg<boolean>(skipNullField, true);
450
+ return Util_Cache$1__GetOrAdd_43981464<((arg0: any) => any)>(Util_CachedEncoders, (y_1 = ((y = fullName_1(t), toString_5(caseStrategy_1) + y)), defaultArg(map_2<ExtraCoders, string>((e: ExtraCoders): string => e.Hash, extra), "") + y_1), (): ((arg0: any) => any) => autoEncoder(makeExtra(extra), caseStrategy_1, skipNullField_1, t));
451
+ }
452
+
453
+ export function Auto_generateBoxedEncoder_437914C6(t: any, caseStrategy?: CaseStrategy_$union, extra?: ExtraCoders, skipNullField?: boolean): ((arg0: any) => any) {
454
+ const caseStrategy_1: CaseStrategy_$union = defaultArg<CaseStrategy_$union>(caseStrategy, CaseStrategy_PascalCase());
455
+ const skipNullField_1: boolean = defaultArg<boolean>(skipNullField, true);
456
+ return autoEncoder(makeExtra(extra), caseStrategy_1, skipNullField_1, t);
457
+ }
458
+
459
+ /**
460
+ * **Description**
461
+ * Convert a `Value` into a prettified string.
462
+ * **Parameters**
463
+ * * `space` - parameter of type `int` - Amount of indentation
464
+ * * `value` - parameter of type `obj` - Value to convert
465
+ *
466
+ * **Output Type**
467
+ * * `string`
468
+ *
469
+ * **Exceptions**
470
+ */
471
+ export function encode(space: int32, value: any): string {
472
+ return toString(space, value);
473
+ }
474
+
475
+ //# sourceMappingURL=Encode.ts.map
@@ -0,0 +1,11 @@
1
+ import { empty as empty_1 } from "@fable-org/fable-library-js/Map.js";
2
+ import { comparePrimitives } from "@fable-org/fable-library-js/Util.js";
3
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
4
+ import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
5
+ import { ExtraCoders, ErrorReason_$union } from "./Types.js";
6
+
7
+ export const empty: ExtraCoders = new ExtraCoders("", empty_1<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>({
8
+ Compare: comparePrimitives,
9
+ }));
10
+
11
+ //# sourceMappingURL=Extra.ts.map
@@ -0,0 +1,176 @@
1
+ import { FSharpRef, Record, Union } from "@fable-org/fable-library-js/Types.js";
2
+ import { FSharpList } from "@fable-org/fable-library-js/List.js";
3
+ import { record_type, class_type, tuple_type, lambda_type, union_type, list_type, obj_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
4
+ import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
5
+ import { FSharpResult$2, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
6
+ import { defaultOf, IMap } from "@fable-org/fable-library-js/Util.js";
7
+ import { addToDict, tryGetValue } from "@fable-org/fable-library-js/MapUtil.js";
8
+ import { replace } from "@fable-org/fable-library-js/RegExp.js";
9
+
10
+ export type ErrorReason_$union =
11
+ | ErrorReason<0>
12
+ | ErrorReason<1>
13
+ | ErrorReason<2>
14
+ | ErrorReason<3>
15
+ | ErrorReason<4>
16
+ | ErrorReason<5>
17
+ | ErrorReason<6>
18
+ | ErrorReason<7>
19
+
20
+ export type ErrorReason_$cases = {
21
+ 0: ["BadPrimitive", [string, any]],
22
+ 1: ["BadPrimitiveExtra", [string, any, string]],
23
+ 2: ["BadType", [string, any]],
24
+ 3: ["BadField", [string, any]],
25
+ 4: ["BadPath", [string, any, string]],
26
+ 5: ["TooSmallArray", [string, any]],
27
+ 6: ["FailMessage", [string]],
28
+ 7: ["BadOneOf", [FSharpList<string>]]
29
+ }
30
+
31
+ export function ErrorReason_BadPrimitive(Item1: string, Item2: any) {
32
+ return new ErrorReason<0>(0, [Item1, Item2]);
33
+ }
34
+
35
+ export function ErrorReason_BadPrimitiveExtra(Item1: string, Item2: any, Item3: string) {
36
+ return new ErrorReason<1>(1, [Item1, Item2, Item3]);
37
+ }
38
+
39
+ export function ErrorReason_BadType(Item1: string, Item2: any) {
40
+ return new ErrorReason<2>(2, [Item1, Item2]);
41
+ }
42
+
43
+ export function ErrorReason_BadField(Item1: string, Item2: any) {
44
+ return new ErrorReason<3>(3, [Item1, Item2]);
45
+ }
46
+
47
+ export function ErrorReason_BadPath(Item1: string, Item2: any, Item3: string) {
48
+ return new ErrorReason<4>(4, [Item1, Item2, Item3]);
49
+ }
50
+
51
+ export function ErrorReason_TooSmallArray(Item1: string, Item2: any) {
52
+ return new ErrorReason<5>(5, [Item1, Item2]);
53
+ }
54
+
55
+ export function ErrorReason_FailMessage(Item: string) {
56
+ return new ErrorReason<6>(6, [Item]);
57
+ }
58
+
59
+ export function ErrorReason_BadOneOf(Item: FSharpList<string>) {
60
+ return new ErrorReason<7>(7, [Item]);
61
+ }
62
+
63
+ export class ErrorReason<Tag extends keyof ErrorReason_$cases> extends Union<Tag, ErrorReason_$cases[Tag][0]> {
64
+ constructor(readonly tag: Tag, readonly fields: ErrorReason_$cases[Tag][1]) {
65
+ super();
66
+ }
67
+ cases() {
68
+ return ["BadPrimitive", "BadPrimitiveExtra", "BadType", "BadField", "BadPath", "TooSmallArray", "FailMessage", "BadOneOf"];
69
+ }
70
+ }
71
+
72
+ export function ErrorReason_$reflection(): TypeInfo {
73
+ return union_type("Thoth.Json.ErrorReason", [], ErrorReason, () => [[["Item1", string_type], ["Item2", obj_type]], [["Item1", string_type], ["Item2", obj_type], ["Item3", string_type]], [["Item1", string_type], ["Item2", obj_type]], [["Item1", string_type], ["Item2", obj_type]], [["Item1", string_type], ["Item2", obj_type], ["Item3", string_type]], [["Item1", string_type], ["Item2", obj_type]], [["Item", string_type]], [["Item", list_type(string_type)]]]);
74
+ }
75
+
76
+ export type CaseStrategy_$union =
77
+ | CaseStrategy<0>
78
+ | CaseStrategy<1>
79
+ | CaseStrategy<2>
80
+
81
+ export type CaseStrategy_$cases = {
82
+ 0: ["PascalCase", []],
83
+ 1: ["CamelCase", []],
84
+ 2: ["SnakeCase", []]
85
+ }
86
+
87
+ export function CaseStrategy_PascalCase() {
88
+ return new CaseStrategy<0>(0, []);
89
+ }
90
+
91
+ export function CaseStrategy_CamelCase() {
92
+ return new CaseStrategy<1>(1, []);
93
+ }
94
+
95
+ export function CaseStrategy_SnakeCase() {
96
+ return new CaseStrategy<2>(2, []);
97
+ }
98
+
99
+ export class CaseStrategy<Tag extends keyof CaseStrategy_$cases> extends Union<Tag, CaseStrategy_$cases[Tag][0]> {
100
+ constructor(readonly tag: Tag, readonly fields: CaseStrategy_$cases[Tag][1]) {
101
+ super();
102
+ }
103
+ cases() {
104
+ return ["PascalCase", "CamelCase", "SnakeCase"];
105
+ }
106
+ }
107
+
108
+ export function CaseStrategy_$reflection(): TypeInfo {
109
+ return union_type("Thoth.Json.CaseStrategy", [], CaseStrategy, () => [[], [], []]);
110
+ }
111
+
112
+ export class ExtraCoders extends Record {
113
+ readonly Hash: string;
114
+ readonly Coders: FSharpMap<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>;
115
+ constructor(Hash: string, Coders: FSharpMap<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>) {
116
+ super();
117
+ this.Hash = Hash;
118
+ this.Coders = Coders;
119
+ }
120
+ }
121
+
122
+ export function ExtraCoders_$reflection(): TypeInfo {
123
+ return record_type("Thoth.Json.ExtraCoders", [], ExtraCoders, () => [["Hash", string_type], ["Coders", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, tuple_type(lambda_type(obj_type, obj_type), lambda_type(string_type, lambda_type(obj_type, union_type("Microsoft.FSharp.Core.FSharpResult`2", [obj_type, tuple_type(string_type, ErrorReason_$reflection())], FSharpResult$2, () => [[["ResultValue", obj_type]], [["ErrorValue", tuple_type(string_type, ErrorReason_$reflection())]]]))))])]]);
124
+ }
125
+
126
+ export class Util_Cache$1<Value> {
127
+ readonly cache: IMap<string, Value>;
128
+ constructor() {
129
+ this.cache = (new Map<string, Value>([]));
130
+ }
131
+ }
132
+
133
+ export function Util_Cache$1_$reflection(gen0: TypeInfo): TypeInfo {
134
+ return class_type("Thoth.Json.Util.Cache`1", [gen0], Util_Cache$1);
135
+ }
136
+
137
+ export function Util_Cache$1_$ctor<Value>(): Util_Cache$1<Value> {
138
+ return new Util_Cache$1();
139
+ }
140
+
141
+ export function Util_Cache$1__GetOrAdd_43981464<Value>(__: Util_Cache$1<Value>, key: string, factory: (() => Value)): Value {
142
+ let matchValue: [boolean, Value];
143
+ let outArg: Value = defaultOf();
144
+ matchValue = ([tryGetValue(__.cache, key, new FSharpRef<Value>((): Value => outArg, (v: Value): void => {
145
+ outArg = v;
146
+ })), outArg] as [boolean, Value]);
147
+ if (matchValue[0]) {
148
+ return matchValue[1];
149
+ }
150
+ else {
151
+ const x_1: Value = factory();
152
+ addToDict(__.cache, key, x_1);
153
+ return x_1;
154
+ }
155
+ }
156
+
157
+ export const Util_CachedEncoders: Util_Cache$1<((arg0: any) => any)> = Util_Cache$1_$ctor<((arg0: any) => any)>();
158
+
159
+ export const Util_CachedDecoders: Util_Cache$1<((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))> = Util_Cache$1_$ctor<((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))>();
160
+
161
+ export function Util_Casing_lowerFirst(str: string): string {
162
+ return str.slice(undefined, 0 + 1).toLowerCase() + str.slice(1, str.length);
163
+ }
164
+
165
+ export function Util_Casing_convert(caseStrategy: CaseStrategy_$union, fieldName: string): string {
166
+ switch (caseStrategy.tag) {
167
+ case /* SnakeCase */ 2:
168
+ return replace(Util_Casing_lowerFirst(fieldName), "[A-Z]", "_$0").toLowerCase();
169
+ case /* PascalCase */ 0:
170
+ return fieldName;
171
+ default:
172
+ return Util_Casing_lowerFirst(fieldName);
173
+ }
174
+ }
175
+
176
+ //# sourceMappingURL=Types.ts.map