starlight-fsharp-oracle 0.1.0 → 0.1.2
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/dist/Extensions/StringBuilder.js +2 -5
- package/dist/Extensions/TextNode.js +29 -54
- package/dist/FSharp.Oracle.Schema/Schema.js +113 -218
- package/dist/Generate.js +33 -63
- package/dist/Helpers.js +1 -2
- package/dist/Plugin.js +17 -31
- package/dist/Render/Documentation.js +1 -2
- package/dist/Render/Entries.js +29 -34
- package/dist/Render/Pages.js +10 -19
- package/dist/Render/Primitives.js +19 -32
- package/dist/Themes.js +3 -5
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +105 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +232 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +20 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Decode.fs +1592 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Decode.fs.js +1417 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/DecoderCE.fs +106 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/DecoderCE.fs.js +63 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Encode.fs +380 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Encode.fs.js +289 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Thoth.Json.Core.fableproj +37 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Types.fs +76 -0
- package/dist/fable_modules/Thoth.Json.Core.0.9.0/Types.fs.js +37 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Casing.fs +113 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Casing.fs.js +173 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Decode.fs +1153 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Decode.fs.js +622 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Domain.fs +91 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Domain.fs.js +103 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Encode.fs +893 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Encode.fs.js +836 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Prelude.fs +435 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Prelude.fs.js +389 -0
- package/dist/fable_modules/Thoth.Json.Core.Auto.0.1.0/Thoth.Json.Core.Auto.fableproj +43 -0
- package/dist/fable_modules/Thoth.Json.JavaScript.0.5.0/Decode.fs +88 -0
- package/dist/fable_modules/Thoth.Json.JavaScript.0.5.0/Decode.fs.js +102 -0
- package/dist/fable_modules/Thoth.Json.JavaScript.0.5.0/Encode.fs +40 -0
- package/dist/fable_modules/Thoth.Json.JavaScript.0.5.0/Encode.fs.js +59 -0
- package/dist/fable_modules/Thoth.Json.JavaScript.0.5.0/Thoth.Json.JavaScript.fableproj +31 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Array.js +1347 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Async.js +134 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/AsyncBuilder.js +183 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/BigInt.js +306 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Boolean.js +22 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/CHANGELOG.md +191 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Char.js +202 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Date.js +755 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/DateOffset.js +261 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Decimal.js +236 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Double.js +47 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Encoding.js +185 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Event.js +93 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Global.js +29 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Guid.js +161 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/List.js +1323 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Long.js +47 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/MailboxProcessor.js +94 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Map.js +1396 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/MapUtil.js +130 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/MutableMap.js +339 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Native.js +14 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Numeric.js +75 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Observable.js +113 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Option.js +104 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/README.md +3 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Random.js +172 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Reflection.js +460 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/RegExp.js +141 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Seq.js +1409 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Set.js +1788 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/String.js +649 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/System.Collections.Generic.js +333 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/System.Text.js +168 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/System.js +283 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/TimeSpan.js +180 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Types.js +198 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Uri.js +165 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/Util.js +792 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/lib/big.js +825 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.0.0-rc.7/quotation.js +618 -0
- package/package.json +4 -5
- package/packages/FSharp.Oracle/XmlDoc.fs +12 -1
- package/packages/FSharp.Oracle/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.fs +3 -0
- package/packages/FSharp.Oracle/obj/Debug/net10.0/FSharp.Oracle.AssemblyInfo.fs +17 -0
- package/packages/FSharp.Oracle/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.fs +3 -0
- package/packages/FSharp.Oracle/obj/Release/net10.0/FSharp.Oracle.AssemblyInfo.fs +17 -0
- package/packages/FSharp.Oracle.Schema/obj/Debug/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.fs +3 -0
- package/packages/FSharp.Oracle.Schema/obj/Debug/net10.0/FSharp.Oracle.Schema.AssemblyInfo.fs +17 -0
- package/packages/FSharp.Oracle.Schema/obj/Release/net10.0/.NETCoreApp,Version=v10.0.AssemblyAttributes.fs +3 -0
- package/packages/FSharp.Oracle.Schema/obj/Release/net10.0/FSharp.Oracle.Schema.AssemblyInfo.fs +17 -0
- package/oracle-bin/FSharp.Compiler.Service.dll +0 -0
- package/oracle-bin/FSharp.Core.dll +0 -0
- package/oracle-bin/FSharp.DependencyManager.Nuget.dll +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.dll +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.pdb +0 -0
- package/oracle-bin/FSharp.Oracle.Schema.xml +0 -219
- package/oracle-bin/Fable.Core.dll +0 -0
- package/oracle-bin/Oracle +0 -0
- package/oracle-bin/Oracle.deps.json +0 -280
- package/oracle-bin/Oracle.dll +0 -0
- package/oracle-bin/Oracle.pdb +0 -0
- package/oracle-bin/Oracle.runtimeconfig.json +0 -13
- package/oracle-bin/Oracle.xml +0 -111
- package/oracle-bin/Thoth.Json.Core.Auto.dll +0 -0
- package/oracle-bin/Thoth.Json.Core.dll +0 -0
- package/oracle-bin/Thoth.Json.System.Text.Json.dll +0 -0
- package/oracle-bin/cs/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/cs/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/cs/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/de/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/de/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/de/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/es/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/es/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/es/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/fr/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/it/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/it/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/it/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ja/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ko/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/pl/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/pt-BR/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/ru/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/tr/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/zh-Hans/FSharp.DependencyManager.Nuget.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.Compiler.Service.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.Core.resources.dll +0 -0
- package/oracle-bin/zh-Hant/FSharp.DependencyManager.Nuget.resources.dll +0 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
|
|
2
|
+
import { map as map_1 } from "../fable-library-js.5.0.0-rc.7/List.js";
|
|
3
|
+
import { map as map_2 } from "../fable-library-js.5.0.0-rc.7/Seq.js";
|
|
4
|
+
import { disposeSafe, getEnumerator } from "../fable-library-js.5.0.0-rc.7/Util.js";
|
|
5
|
+
import { toList, toSeq } from "../fable-library-js.5.0.0-rc.7/Map.js";
|
|
6
|
+
import { map as map_3 } from "../fable-library-js.5.0.0-rc.7/Array.js";
|
|
7
|
+
import { value as value_6, map as map_4, defaultArgWith } from "../fable-library-js.5.0.0-rc.7/Option.js";
|
|
8
|
+
|
|
9
|
+
export function float32(value_1) {
|
|
10
|
+
return {
|
|
11
|
+
Encode(helpers) {
|
|
12
|
+
return helpers.encodeDecimalNumber(value_1);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function list(values) {
|
|
18
|
+
return {
|
|
19
|
+
Encode(helpers) {
|
|
20
|
+
const arg = map_1((v) => v.Encode(helpers), values);
|
|
21
|
+
return helpers.encodeList(arg);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function seq(values) {
|
|
27
|
+
return {
|
|
28
|
+
Encode(helpers) {
|
|
29
|
+
const arg = map_2((v) => v.Encode(helpers), values);
|
|
30
|
+
return helpers.encodeSeq(arg);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function resizeArray(values) {
|
|
36
|
+
return {
|
|
37
|
+
Encode(helpers) {
|
|
38
|
+
const result = [];
|
|
39
|
+
let enumerator = getEnumerator(values);
|
|
40
|
+
try {
|
|
41
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
42
|
+
const v = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
43
|
+
void (result.push(v.Encode(helpers)));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
disposeSafe(enumerator);
|
|
48
|
+
}
|
|
49
|
+
return helpers.encodeResizeArray(result);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function dict(values) {
|
|
55
|
+
const values_1 = toSeq(values);
|
|
56
|
+
return {
|
|
57
|
+
Encode(helpers) {
|
|
58
|
+
const arg = map_2((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers)], values_1);
|
|
59
|
+
return helpers.encodeObject(arg);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function tuple2(enc1, enc2, v1, v2) {
|
|
65
|
+
const values = [enc1(v1), enc2(v2)];
|
|
66
|
+
return {
|
|
67
|
+
Encode(helpers) {
|
|
68
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
69
|
+
return helpers.encodeArray(arg);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function tuple3(enc1, enc2, enc3, v1, v2, v3) {
|
|
75
|
+
const values = [enc1(v1), enc2(v2), enc3(v3)];
|
|
76
|
+
return {
|
|
77
|
+
Encode(helpers) {
|
|
78
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
79
|
+
return helpers.encodeArray(arg);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function tuple4(enc1, enc2, enc3, enc4, v1, v2, v3, v4) {
|
|
85
|
+
const values = [enc1(v1), enc2(v2), enc3(v3), enc4(v4)];
|
|
86
|
+
return {
|
|
87
|
+
Encode(helpers) {
|
|
88
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
89
|
+
return helpers.encodeArray(arg);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function tuple5(enc1, enc2, enc3, enc4, enc5, v1, v2, v3, v4, v5) {
|
|
95
|
+
const values = [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5)];
|
|
96
|
+
return {
|
|
97
|
+
Encode(helpers) {
|
|
98
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
99
|
+
return helpers.encodeArray(arg);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function tuple6(enc1, enc2, enc3, enc4, enc5, enc6, v1, v2, v3, v4, v5, v6) {
|
|
105
|
+
const values = [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6)];
|
|
106
|
+
return {
|
|
107
|
+
Encode(helpers) {
|
|
108
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
109
|
+
return helpers.encodeArray(arg);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function tuple7(enc1, enc2, enc3, enc4, enc5, enc6, enc7, v1, v2, v3, v4, v5, v6, v7) {
|
|
115
|
+
const values = [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7)];
|
|
116
|
+
return {
|
|
117
|
+
Encode(helpers) {
|
|
118
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
119
|
+
return helpers.encodeArray(arg);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function tuple8(enc1, enc2, enc3, enc4, enc5, enc6, enc7, enc8, v1, v2, v3, v4, v5, v6, v7, v8) {
|
|
125
|
+
const values = [enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7), enc8(v8)];
|
|
126
|
+
return {
|
|
127
|
+
Encode(helpers) {
|
|
128
|
+
const arg = map_3((v) => v.Encode(helpers), values);
|
|
129
|
+
return helpers.encodeArray(arg);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function map(keyEncoder, valueEncoder, values) {
|
|
135
|
+
return list(map_1((tupledArg) => tuple2(keyEncoder, valueEncoder, tupledArg[0], tupledArg[1]), toList(values)));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function lazily(enc, x) {
|
|
139
|
+
return enc.Value(x);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function Enum_byte(value_1) {
|
|
143
|
+
return {
|
|
144
|
+
Encode(helpers) {
|
|
145
|
+
return helpers.encodeUnsignedIntegralNumber(value_1);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function Enum_sbyte(value_1) {
|
|
151
|
+
return {
|
|
152
|
+
Encode(helpers) {
|
|
153
|
+
return helpers.encodeSignedIntegralNumber(value_1);
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function Enum_int16(value_1) {
|
|
159
|
+
return {
|
|
160
|
+
Encode(helpers) {
|
|
161
|
+
return helpers.encodeSignedIntegralNumber(value_1);
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function Enum_uint16(value_1) {
|
|
167
|
+
return {
|
|
168
|
+
Encode(helpers) {
|
|
169
|
+
return helpers.encodeUnsignedIntegralNumber(value_1);
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function Enum_int(value_1) {
|
|
175
|
+
return {
|
|
176
|
+
Encode(helpers) {
|
|
177
|
+
return helpers.encodeSignedIntegralNumber(value_1);
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function Enum_uint32(value_1) {
|
|
183
|
+
return {
|
|
184
|
+
Encode(helpers) {
|
|
185
|
+
return helpers.encodeUnsignedIntegralNumber(value_1);
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Encodes an option value using the provided encoder.
|
|
192
|
+
*
|
|
193
|
+
* Attention, this encoder is lossy, it's result will not be able to distinguish between `'T option` and `'T option option`.
|
|
194
|
+
*
|
|
195
|
+
* If you need to distinguish between `'T option` and `'T option option`, use `losslessOption`.
|
|
196
|
+
*/
|
|
197
|
+
export function lossyOption(encoder) {
|
|
198
|
+
return (arg) => defaultArgWith(map_4(encoder, arg), () => ({
|
|
199
|
+
Encode(helpers) {
|
|
200
|
+
return helpers.encodeNull();
|
|
201
|
+
},
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Encodes an option value using the provided encoder.
|
|
207
|
+
*
|
|
208
|
+
* This encoder is lossless, it's result will be able to distinguish between `'T option` and `'T option option`.
|
|
209
|
+
*
|
|
210
|
+
* If you don't need to distinguish between `'T option` and `'T option option`, use `lossyOption`.
|
|
211
|
+
*/
|
|
212
|
+
export function losslessOption(encoder, value_1) {
|
|
213
|
+
if (value_1 == null) {
|
|
214
|
+
const values_1 = [["$type", {
|
|
215
|
+
Encode(helpers_3) {
|
|
216
|
+
return helpers_3.encodeString("option");
|
|
217
|
+
},
|
|
218
|
+
}], ["$case", {
|
|
219
|
+
Encode(helpers_4) {
|
|
220
|
+
return helpers_4.encodeString("none");
|
|
221
|
+
},
|
|
222
|
+
}]];
|
|
223
|
+
return {
|
|
224
|
+
Encode(helpers_5) {
|
|
225
|
+
const arg_1 = map_2((tupledArg_1) => [tupledArg_1[0], tupledArg_1[1].Encode(helpers_5)], values_1);
|
|
226
|
+
return helpers_5.encodeObject(arg_1);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
const v = value_6(value_1);
|
|
232
|
+
const values = [["$type", {
|
|
233
|
+
Encode(helpers) {
|
|
234
|
+
return helpers.encodeString("option");
|
|
235
|
+
},
|
|
236
|
+
}], ["$case", {
|
|
237
|
+
Encode(helpers_1) {
|
|
238
|
+
return helpers_1.encodeString("some");
|
|
239
|
+
},
|
|
240
|
+
}], ["$value", encoder(v)]];
|
|
241
|
+
return {
|
|
242
|
+
Encode(helpers_2) {
|
|
243
|
+
const arg = map_2((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers_2)], values);
|
|
244
|
+
return helpers_2.encodeObject(arg);
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function value(json) {
|
|
251
|
+
switch (json.tag) {
|
|
252
|
+
case 3:
|
|
253
|
+
return {
|
|
254
|
+
Encode(helpers_1) {
|
|
255
|
+
return helpers_1.encodeBool(json.fields[0]);
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
case 0:
|
|
259
|
+
return {
|
|
260
|
+
Encode(helpers_2) {
|
|
261
|
+
return helpers_2.encodeString(json.fields[0]);
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
case 1:
|
|
265
|
+
return {
|
|
266
|
+
Encode(helpers_3) {
|
|
267
|
+
return helpers_3.encodeDecimalNumber(json.fields[0]);
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
case 5:
|
|
271
|
+
return list(map_1(value, json.fields[0]));
|
|
272
|
+
case 4: {
|
|
273
|
+
const values = map_2((tupledArg) => [tupledArg[0], value(tupledArg[1])], json.fields[0]);
|
|
274
|
+
return {
|
|
275
|
+
Encode(helpers_4) {
|
|
276
|
+
const arg = map_2((tupledArg_1) => [tupledArg_1[0], tupledArg_1[1].Encode(helpers_4)], values);
|
|
277
|
+
return helpers_4.encodeObject(arg);
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
default:
|
|
282
|
+
return {
|
|
283
|
+
Encode(helpers) {
|
|
284
|
+
return helpers.encodeNull();
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<Description>
|
|
5
|
+
Elm-inspired encoder and decoder for JSON, this package is the core library which can be used on any F# project.
|
|
6
|
+
|
|
7
|
+
Pick the right additional package for your runtime:
|
|
8
|
+
|
|
9
|
+
- Thoth.Json.JavaScript
|
|
10
|
+
- Thoth.Json.Python
|
|
11
|
+
- Thoth.Json.Newtonsoft
|
|
12
|
+
- Thoth.Json.System.Text.Json
|
|
13
|
+
</Description>
|
|
14
|
+
<FablePackageType>library</FablePackageType>
|
|
15
|
+
<PackageTags>fable-all;fsharp;json</PackageTags>
|
|
16
|
+
</PropertyGroup>
|
|
17
|
+
<PropertyGroup>
|
|
18
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
|
19
|
+
</PropertyGroup>
|
|
20
|
+
<ItemGroup>
|
|
21
|
+
<Compile Include="Types.fs" />
|
|
22
|
+
<Compile Include="Decode.fs" />
|
|
23
|
+
<Compile Include="Encode.fs" />
|
|
24
|
+
<!-- <Compile Include="Extra.fs" /> -->
|
|
25
|
+
<Compile Include="DecoderCE.fs" />
|
|
26
|
+
</ItemGroup>
|
|
27
|
+
<ItemGroup>
|
|
28
|
+
<PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks">
|
|
29
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
30
|
+
<PrivateAssets>all</PrivateAssets>
|
|
31
|
+
</PackageReference>
|
|
32
|
+
<PackageReference Include="Fable.Package.SDK">
|
|
33
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
34
|
+
<PrivateAssets>all</PrivateAssets>
|
|
35
|
+
</PackageReference>
|
|
36
|
+
</ItemGroup>
|
|
37
|
+
</Project>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
namespace Thoth.Json.Core
|
|
2
|
+
|
|
3
|
+
type IDecoderHelpers<'JsonValue> =
|
|
4
|
+
abstract isString: 'JsonValue -> bool
|
|
5
|
+
abstract isNumber: 'JsonValue -> bool
|
|
6
|
+
abstract isBoolean: 'JsonValue -> bool
|
|
7
|
+
abstract isNullValue: 'JsonValue -> bool
|
|
8
|
+
abstract isArray: 'JsonValue -> bool
|
|
9
|
+
abstract isObject: 'JsonValue -> bool
|
|
10
|
+
abstract hasProperty: string -> 'JsonValue -> bool
|
|
11
|
+
abstract isIntegralValue: 'JsonValue -> bool
|
|
12
|
+
abstract asString: 'JsonValue -> string
|
|
13
|
+
abstract asFloat: 'JsonValue -> float
|
|
14
|
+
abstract asFloat32: 'JsonValue -> float32
|
|
15
|
+
abstract asInt: 'JsonValue -> int
|
|
16
|
+
abstract asBoolean: 'JsonValue -> bool
|
|
17
|
+
abstract asArray: 'JsonValue -> 'JsonValue[]
|
|
18
|
+
abstract getProperty: string * 'JsonValue -> 'JsonValue
|
|
19
|
+
abstract getProperties: 'JsonValue -> string seq
|
|
20
|
+
abstract anyToString: 'JsonValue -> string
|
|
21
|
+
|
|
22
|
+
type IEncoderHelpers<'JsonValue> =
|
|
23
|
+
abstract encodeString: string -> 'JsonValue
|
|
24
|
+
abstract encodeChar: char -> 'JsonValue
|
|
25
|
+
abstract encodeDecimalNumber: float -> 'JsonValue
|
|
26
|
+
abstract encodeBool: bool -> 'JsonValue
|
|
27
|
+
abstract encodeNull: unit -> 'JsonValue
|
|
28
|
+
abstract encodeObject: (string * 'JsonValue) seq -> 'JsonValue
|
|
29
|
+
abstract encodeArray: 'JsonValue array -> 'JsonValue
|
|
30
|
+
abstract encodeList: 'JsonValue list -> 'JsonValue
|
|
31
|
+
abstract encodeSeq: 'JsonValue seq -> 'JsonValue
|
|
32
|
+
abstract encodeResizeArray: ResizeArray<'JsonValue> -> 'JsonValue
|
|
33
|
+
// See https://github.com/thoth-org/Thoth.Json/issues/187 for more information
|
|
34
|
+
// about why we make a distinction between signed and unsigned integral numbers
|
|
35
|
+
// when encoding them.
|
|
36
|
+
abstract encodeSignedIntegralNumber: int32 -> 'JsonValue
|
|
37
|
+
abstract encodeUnsignedIntegralNumber: uint32 -> 'JsonValue
|
|
38
|
+
|
|
39
|
+
type ErrorReason<'JsonValue> =
|
|
40
|
+
| BadPrimitive of string * 'JsonValue
|
|
41
|
+
| BadPrimitiveExtra of string * 'JsonValue * string
|
|
42
|
+
| BadType of string * 'JsonValue
|
|
43
|
+
| BadField of string * 'JsonValue
|
|
44
|
+
| BadPath of string * 'JsonValue * string
|
|
45
|
+
| TooSmallArray of string * 'JsonValue
|
|
46
|
+
| FailMessage of string
|
|
47
|
+
| BadOneOf of DecoderError<'JsonValue> list
|
|
48
|
+
|
|
49
|
+
and DecoderError<'JsonValue> = string * ErrorReason<'JsonValue>
|
|
50
|
+
|
|
51
|
+
type Decoder<'T> =
|
|
52
|
+
abstract member Decode<'JsonValue> :
|
|
53
|
+
helpers: IDecoderHelpers<'JsonValue> * value: 'JsonValue ->
|
|
54
|
+
Result<'T, DecoderError<'JsonValue>>
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
/// A JSON value
|
|
58
|
+
/// </summary>
|
|
59
|
+
/// <remarks>
|
|
60
|
+
/// Although theoretically numbers are arbitrary prevision in JSON,
|
|
61
|
+
/// here they are representated as `float`, which is in line with most implementations.
|
|
62
|
+
/// </remarks>
|
|
63
|
+
[<RequireQualifiedAccess; NoComparison>]
|
|
64
|
+
type Json =
|
|
65
|
+
| String of string
|
|
66
|
+
| Number of float
|
|
67
|
+
| Null
|
|
68
|
+
| Boolean of bool
|
|
69
|
+
| Object of (string * Json) list
|
|
70
|
+
| Array of Json list
|
|
71
|
+
|
|
72
|
+
type IEncodable =
|
|
73
|
+
abstract member Encode<'JsonValue> :
|
|
74
|
+
helpers: IEncoderHelpers<'JsonValue> -> 'JsonValue
|
|
75
|
+
|
|
76
|
+
type Encoder<'T> = 'T -> IEncodable
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
import { Union } from "../fable-library-js.5.0.0-rc.7/Types.js";
|
|
3
|
+
import { bool_type, float64_type, union_type, list_type, tuple_type, string_type } from "../fable-library-js.5.0.0-rc.7/Reflection.js";
|
|
4
|
+
|
|
5
|
+
export class ErrorReason$1 extends Union {
|
|
6
|
+
constructor(tag, fields) {
|
|
7
|
+
super();
|
|
8
|
+
this.tag = tag;
|
|
9
|
+
this.fields = fields;
|
|
10
|
+
}
|
|
11
|
+
cases() {
|
|
12
|
+
return ["BadPrimitive", "BadPrimitiveExtra", "BadType", "BadField", "BadPath", "TooSmallArray", "FailMessage", "BadOneOf"];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function ErrorReason$1_$reflection(gen0) {
|
|
17
|
+
return union_type("Thoth.Json.Core.ErrorReason`1", [gen0], ErrorReason$1, () => [[["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0], ["Item3", string_type]], [["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0], ["Item3", string_type]], [["Item1", string_type], ["Item2", gen0]], [["Item", string_type]], [["Item", list_type(tuple_type(string_type, ErrorReason$1_$reflection(gen0)))]]]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A JSON value
|
|
22
|
+
*/
|
|
23
|
+
export class Json extends Union {
|
|
24
|
+
constructor(tag, fields) {
|
|
25
|
+
super();
|
|
26
|
+
this.tag = tag;
|
|
27
|
+
this.fields = fields;
|
|
28
|
+
}
|
|
29
|
+
cases() {
|
|
30
|
+
return ["String", "Number", "Null", "Boolean", "Object", "Array"];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function Json_$reflection() {
|
|
35
|
+
return union_type("Thoth.Json.Core.Json", [], Json, () => [[["Item", string_type]], [["Item", float64_type]], [], [["Item", bool_type]], [["Item", list_type(tuple_type(string_type, Json_$reflection()))]], [["Item", list_type(Json_$reflection())]]]);
|
|
36
|
+
}
|
|
37
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
module Thoth.Json.Core.Auto.Casing
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
open System.Text
|
|
5
|
+
|
|
6
|
+
let private upperFirst (str: string) =
|
|
7
|
+
str.[..0].ToUpperInvariant() + str.[1..]
|
|
8
|
+
|
|
9
|
+
/// Well-known two-letter acronyms that should remain all-caps in .NET naming conventions.
|
|
10
|
+
/// Per Microsoft's guidelines, common acronyms like ID and IP should be kept uppercase
|
|
11
|
+
/// (e.g., UserID instead of UserId, CustomerIP instead of CustomerIp).
|
|
12
|
+
/// This matches how .NET Framework types are named (IPAddress, IDisposable, etc.).
|
|
13
|
+
let private dotNetAcronyms =
|
|
14
|
+
Set.ofSeq
|
|
15
|
+
[
|
|
16
|
+
"id"
|
|
17
|
+
"ip"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
let convertCase (source: CaseStrategy) (dest: CaseStrategy) (text: string) =
|
|
21
|
+
if source = dest then
|
|
22
|
+
text
|
|
23
|
+
else
|
|
24
|
+
let words =
|
|
25
|
+
match source with
|
|
26
|
+
| SnakeCase
|
|
27
|
+
| ScreamingSnakeCase ->
|
|
28
|
+
text.Split([| '_' |], StringSplitOptions.RemoveEmptyEntries)
|
|
29
|
+
|> Seq.toList
|
|
30
|
+
| PascalCase
|
|
31
|
+
| CamelCase
|
|
32
|
+
| DotNetPascalCase
|
|
33
|
+
| DotNetCamelCase ->
|
|
34
|
+
seq {
|
|
35
|
+
let sb = StringBuilder()
|
|
36
|
+
|
|
37
|
+
for c in text do
|
|
38
|
+
if Char.IsUpper c && sb.Length > 0 then
|
|
39
|
+
sb.ToString()
|
|
40
|
+
sb.Clear() |> ignore
|
|
41
|
+
|
|
42
|
+
sb.Append(c) |> ignore
|
|
43
|
+
|
|
44
|
+
if sb.Length > 0 then
|
|
45
|
+
sb.ToString()
|
|
46
|
+
}
|
|
47
|
+
|> Seq.fold
|
|
48
|
+
(fun state next ->
|
|
49
|
+
if next.Length > 1 then
|
|
50
|
+
next :: state
|
|
51
|
+
else
|
|
52
|
+
match state with
|
|
53
|
+
| [] -> [ next ]
|
|
54
|
+
| x :: xs ->
|
|
55
|
+
if
|
|
56
|
+
x.Length = 1
|
|
57
|
+
|| x |> Seq.forall Char.IsUpper
|
|
58
|
+
then
|
|
59
|
+
(x + next) :: xs
|
|
60
|
+
else
|
|
61
|
+
next :: x :: xs
|
|
62
|
+
)
|
|
63
|
+
[]
|
|
64
|
+
|> Seq.rev
|
|
65
|
+
|> Seq.toList
|
|
66
|
+
|
|
67
|
+
match dest with
|
|
68
|
+
| ScreamingSnakeCase ->
|
|
69
|
+
words
|
|
70
|
+
|> Seq.map (fun x -> x.ToUpperInvariant())
|
|
71
|
+
|> String.concat "_"
|
|
72
|
+
| SnakeCase ->
|
|
73
|
+
words
|
|
74
|
+
|> Seq.map (fun x -> x.ToLowerInvariant())
|
|
75
|
+
|> String.concat "_"
|
|
76
|
+
| PascalCase ->
|
|
77
|
+
words
|
|
78
|
+
|> Seq.map (fun x -> x.ToLowerInvariant() |> upperFirst)
|
|
79
|
+
|> String.concat ""
|
|
80
|
+
| CamelCase ->
|
|
81
|
+
words
|
|
82
|
+
|> Seq.mapi (fun i x ->
|
|
83
|
+
if i = 0 then
|
|
84
|
+
x.ToLowerInvariant()
|
|
85
|
+
else
|
|
86
|
+
x.ToLowerInvariant() |> upperFirst
|
|
87
|
+
)
|
|
88
|
+
|> String.concat ""
|
|
89
|
+
| DotNetPascalCase ->
|
|
90
|
+
words
|
|
91
|
+
|> Seq.map (fun x ->
|
|
92
|
+
let u = x.ToLowerInvariant()
|
|
93
|
+
|
|
94
|
+
if Set.contains u dotNetAcronyms then
|
|
95
|
+
u.ToUpperInvariant()
|
|
96
|
+
else
|
|
97
|
+
upperFirst u
|
|
98
|
+
)
|
|
99
|
+
|> String.concat ""
|
|
100
|
+
| DotNetCamelCase ->
|
|
101
|
+
words
|
|
102
|
+
|> Seq.mapi (fun i x ->
|
|
103
|
+
if i = 0 then
|
|
104
|
+
x.ToLowerInvariant()
|
|
105
|
+
else
|
|
106
|
+
let u = x.ToLowerInvariant()
|
|
107
|
+
|
|
108
|
+
if Set.contains u dotNetAcronyms then
|
|
109
|
+
u.ToUpperInvariant()
|
|
110
|
+
else
|
|
111
|
+
upperFirst u
|
|
112
|
+
)
|
|
113
|
+
|> String.concat ""
|