@glutinum/cli 0.14.0 → 1.0.0-beta.1
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/Glutinum.Converter/FsharpAST.js +38 -4
- package/dist/Glutinum.Converter/Generate.js +15 -7
- package/dist/Glutinum.Converter/GlueAST.js +45 -36
- package/dist/Glutinum.Converter/Hosting.js +918 -0
- package/dist/Glutinum.Converter/Merge.js +218 -82
- package/dist/Glutinum.Converter/Packages.js +44 -8
- package/dist/Glutinum.Converter/Printer.js +77 -49
- package/dist/Glutinum.Converter/Read.js +8 -8
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
- package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/Node.js +20 -20
- package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
- package/dist/Glutinum.Converter/Reader/Types.js +6 -6
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
- package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
- package/dist/Glutinum.Converter/Transform.js +2057 -700
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
- package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
- package/dist/Glutinum.Converter/Utils/String.js +2 -2
- package/dist/Program.js +38 -26
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +105 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs +842 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +232 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs +31 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AssemblyInfo.fs +19 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs +287 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +128 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOption.fs +127 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs +174 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +37 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResult.fs +483 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs +87 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs +236 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidation.fs +185 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs +186 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs +276 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +364 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Option.fs +462 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionOp.fs +21 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs +731 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs +140 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +23 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOp.fs +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +65 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs +135 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionOp.fs +57 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Validation.fs +167 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs +142 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueOption.fs +148 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Array.js +1348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Async.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/AsyncBuilder.js +204 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BigInt.js +307 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Boolean.js +22 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Char.js +202 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Date.js +834 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOffset.js +252 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Decimal.js +238 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Double.js +53 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Encoding.js +185 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Event.js +102 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Guid.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.5.17.2/List.js +1337 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MailboxProcessor.js +100 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Map.js +1400 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MapUtil.js +130 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableMap.js +339 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Numeric.js +112 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Observable.js +115 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Option.js +87 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/fable-library-js.5.17.2/README.md +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Random.js +172 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Reflection.js +489 -0
- package/dist/fable_modules/fable-library-js.5.17.2/RegExp.js +170 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq.js +1504 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Set.js +1829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/String.js +731 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Collections.Generic.js +333 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Text.js +200 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpan.js +180 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Types.js +198 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Uri.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Util.js +807 -0
- package/dist/fable_modules/fable-library-js.5.17.2/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.5.17.2/lib/big.js +829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
- package/package.json +2 -2
- package/dist/Glutinum.Converter/TypeScript.js +0 -12
- package/src/Glutinum.Converter/js/bootstrap.js +0 -123
- package/src/Glutinum.Converter/js/host.js +0 -144
- package/src/Glutinum.Converter/js/npm.js +0 -137
- package/src/Glutinum.Converter/js/resolve.js +0 -402
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
|
|
2
|
+
import { append, singleton as singleton_1, empty, reverse, tail, cons, head, isEmpty } from "../fable-library-js.5.17.2/List.js";
|
|
3
|
+
import { FSharpResult$2 } from "../fable-library-js.5.17.2/Result.js";
|
|
4
|
+
import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
|
|
5
|
+
import { some, value as value_10 } from "../fable-library-js.5.17.2/Option.js";
|
|
6
|
+
|
|
7
|
+
function traverseResultM$0027(state_mut, f_mut, xs_mut) {
|
|
8
|
+
traverseResultM$0027:
|
|
9
|
+
while (true) {
|
|
10
|
+
const state = state_mut, f = f_mut, xs = xs_mut;
|
|
11
|
+
if (!isEmpty(xs)) {
|
|
12
|
+
let r;
|
|
13
|
+
const input_4 = f(head(xs));
|
|
14
|
+
if (input_4.tag === 1) {
|
|
15
|
+
r = (new FSharpResult$2(/* Error */ 1, [input_4.fields[0]]));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const input_2 = state;
|
|
19
|
+
r = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_2.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [cons(input_4.fields[0], input_2.fields[0])])));
|
|
20
|
+
}
|
|
21
|
+
if (r.tag === 1) {
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
state_mut = r;
|
|
26
|
+
f_mut = f;
|
|
27
|
+
xs_mut = tail(xs);
|
|
28
|
+
continue traverseResultM$0027;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const input_1 = state;
|
|
33
|
+
if (input_1.tag === 1) {
|
|
34
|
+
return new FSharpResult$2(/* Error */ 1, [input_1.fields[0]]);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return new FSharpResult$2(/* Ok */ 0, [reverse(input_1.fields[0])]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function traverseAsyncResultM$0027(state, f, xs) {
|
|
45
|
+
if (!isEmpty(xs)) {
|
|
46
|
+
return singleton.Delay(() => singleton.Bind(singleton.Delay(() => singleton.Bind(state, (input_1_3) => {
|
|
47
|
+
const input_10 = input_1_3;
|
|
48
|
+
if (input_10.tag === 1) {
|
|
49
|
+
return singleton.Return(new FSharpResult$2(/* Error */ 1, [input_10.fields[0]]));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const x_2 = f(head(xs));
|
|
53
|
+
return singleton.Bind(x_2, (x$0027_1) => {
|
|
54
|
+
let value_2;
|
|
55
|
+
const input_6 = x$0027_1;
|
|
56
|
+
value_2 = ((input_6.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_6.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [cons(input_6.fields[0], input_10.fields[0])])));
|
|
57
|
+
return singleton.Return(value_2);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
})), (_arg_2) => {
|
|
61
|
+
const r = _arg_2;
|
|
62
|
+
return (r.tag === 1) ? singleton.Return(r) : singleton.ReturnFrom(traverseAsyncResultM$0027(singleton.Return(r), f, tail(xs)));
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return singleton.Bind(state, (x$0027) => {
|
|
67
|
+
let value;
|
|
68
|
+
const input_2 = x$0027;
|
|
69
|
+
value = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_2.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [reverse(input_2.fields[0])])));
|
|
70
|
+
return singleton.Return(value);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function traverseResultM(f, xs) {
|
|
76
|
+
return traverseResultM$0027(new FSharpResult$2(/* Ok */ 0, [empty()]), f, xs);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function sequenceResultM(xs) {
|
|
80
|
+
return traverseResultM((x) => x, xs);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function traverseAsyncResultM(f, xs) {
|
|
84
|
+
return traverseAsyncResultM$0027(singleton.Return(new FSharpResult$2(/* Ok */ 0, [empty()])), f, xs);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function sequenceAsyncResultM(xs) {
|
|
88
|
+
return traverseAsyncResultM((x) => x, xs);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function traverseResultA$0027(state_mut, f_mut, xs_mut) {
|
|
92
|
+
traverseResultA$0027:
|
|
93
|
+
while (true) {
|
|
94
|
+
const state = state_mut, f = f_mut, xs = xs_mut;
|
|
95
|
+
if (!isEmpty(xs)) {
|
|
96
|
+
const xs_1 = tail(xs);
|
|
97
|
+
const matchValue = f(head(xs));
|
|
98
|
+
const copyOfStruct = state;
|
|
99
|
+
if (copyOfStruct.tag === 1) {
|
|
100
|
+
const copyOfStruct_1 = matchValue;
|
|
101
|
+
if (copyOfStruct_1.tag === 0) {
|
|
102
|
+
state_mut = (new FSharpResult$2(/* Error */ 1, [copyOfStruct.fields[0]]));
|
|
103
|
+
f_mut = f;
|
|
104
|
+
xs_mut = xs_1;
|
|
105
|
+
continue traverseResultA$0027;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
state_mut = (new FSharpResult$2(/* Error */ 1, [cons(copyOfStruct_1.fields[0], copyOfStruct.fields[0])]));
|
|
109
|
+
f_mut = f;
|
|
110
|
+
xs_mut = xs_1;
|
|
111
|
+
continue traverseResultA$0027;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const copyOfStruct_2 = matchValue;
|
|
116
|
+
if (copyOfStruct_2.tag === 1) {
|
|
117
|
+
state_mut = (new FSharpResult$2(/* Error */ 1, [singleton_1(copyOfStruct_2.fields[0])]));
|
|
118
|
+
f_mut = f;
|
|
119
|
+
xs_mut = xs_1;
|
|
120
|
+
continue traverseResultA$0027;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
state_mut = (new FSharpResult$2(/* Ok */ 0, [cons(copyOfStruct_2.fields[0], copyOfStruct.fields[0])]));
|
|
124
|
+
f_mut = f;
|
|
125
|
+
xs_mut = xs_1;
|
|
126
|
+
continue traverseResultA$0027;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
const input_1 = state;
|
|
132
|
+
if (input_1.tag === 1) {
|
|
133
|
+
return new FSharpResult$2(/* Error */ 1, [reverse(input_1.fields[0])]);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return new FSharpResult$2(/* Ok */ 0, [reverse(input_1.fields[0])]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function traverseAsyncResultA$0027(state, f, xs) {
|
|
144
|
+
if (!isEmpty(xs)) {
|
|
145
|
+
const xs_1 = tail(xs);
|
|
146
|
+
return singleton.Delay(() => singleton.Bind(state, (_arg) => singleton.Bind(f(head(xs)), (_arg_1) => {
|
|
147
|
+
const fR = _arg_1;
|
|
148
|
+
const copyOfStruct = _arg;
|
|
149
|
+
if (copyOfStruct.tag === 1) {
|
|
150
|
+
const copyOfStruct_1 = fR;
|
|
151
|
+
return (copyOfStruct_1.tag === 0) ? singleton.ReturnFrom(traverseAsyncResultA$0027(singleton.Return(new FSharpResult$2(/* Error */ 1, [copyOfStruct.fields[0]])), f, xs_1)) : singleton.ReturnFrom(traverseAsyncResultA$0027(singleton.Return(new FSharpResult$2(/* Error */ 1, [cons(copyOfStruct_1.fields[0], copyOfStruct.fields[0])])), f, xs_1));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const copyOfStruct_2 = fR;
|
|
155
|
+
return (copyOfStruct_2.tag === 1) ? singleton.ReturnFrom(traverseAsyncResultA$0027(singleton.Return(new FSharpResult$2(/* Error */ 1, [singleton_1(copyOfStruct_2.fields[0])])), f, xs_1)) : singleton.ReturnFrom(traverseAsyncResultA$0027(singleton.Return(new FSharpResult$2(/* Ok */ 0, [cons(copyOfStruct_2.fields[0], copyOfStruct.fields[0])])), f, xs_1));
|
|
156
|
+
}
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return singleton.Bind(state, (x$0027) => {
|
|
161
|
+
let value;
|
|
162
|
+
const input_2 = x$0027;
|
|
163
|
+
value = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [reverse(input_2.fields[0])])) : (new FSharpResult$2(/* Ok */ 0, [reverse(input_2.fields[0])])));
|
|
164
|
+
return singleton.Return(value);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function traverseResultA(f, xs) {
|
|
170
|
+
return traverseResultA$0027(new FSharpResult$2(/* Ok */ 0, [empty()]), f, xs);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function sequenceResultA(xs) {
|
|
174
|
+
return traverseResultA((x) => x, xs);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function traverseValidationA$0027(state_mut, f_mut, xs_mut) {
|
|
178
|
+
traverseValidationA$0027:
|
|
179
|
+
while (true) {
|
|
180
|
+
const state = state_mut, f = f_mut, xs = xs_mut;
|
|
181
|
+
if (!isEmpty(xs)) {
|
|
182
|
+
const xs_1 = tail(xs);
|
|
183
|
+
const fR = f(head(xs));
|
|
184
|
+
let matchResult, y, ys, errs1, errs2, errs;
|
|
185
|
+
const copyOfStruct = state;
|
|
186
|
+
if (copyOfStruct.tag === 1) {
|
|
187
|
+
const copyOfStruct_1 = fR;
|
|
188
|
+
if (copyOfStruct_1.tag === 0) {
|
|
189
|
+
matchResult = 2;
|
|
190
|
+
errs = copyOfStruct.fields[0];
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
matchResult = 1;
|
|
194
|
+
errs1 = copyOfStruct.fields[0];
|
|
195
|
+
errs2 = copyOfStruct_1.fields[0];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const copyOfStruct_2 = fR;
|
|
200
|
+
if (copyOfStruct_2.tag === 1) {
|
|
201
|
+
matchResult = 2;
|
|
202
|
+
errs = copyOfStruct_2.fields[0];
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
matchResult = 0;
|
|
206
|
+
y = copyOfStruct_2.fields[0];
|
|
207
|
+
ys = copyOfStruct.fields[0];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
switch (matchResult) {
|
|
211
|
+
case 0: {
|
|
212
|
+
state_mut = (new FSharpResult$2(/* Ok */ 0, [cons(y, ys)]));
|
|
213
|
+
f_mut = f;
|
|
214
|
+
xs_mut = xs_1;
|
|
215
|
+
continue traverseValidationA$0027;
|
|
216
|
+
}
|
|
217
|
+
case 1: {
|
|
218
|
+
state_mut = (new FSharpResult$2(/* Error */ 1, [append(errs2, errs1)]));
|
|
219
|
+
f_mut = f;
|
|
220
|
+
xs_mut = xs_1;
|
|
221
|
+
continue traverseValidationA$0027;
|
|
222
|
+
}
|
|
223
|
+
default: {
|
|
224
|
+
state_mut = (new FSharpResult$2(/* Error */ 1, [errs]));
|
|
225
|
+
f_mut = f;
|
|
226
|
+
xs_mut = xs_1;
|
|
227
|
+
continue traverseValidationA$0027;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
const input_1 = state;
|
|
233
|
+
if (input_1.tag === 1) {
|
|
234
|
+
return new FSharpResult$2(/* Error */ 1, [reverse(input_1.fields[0])]);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return new FSharpResult$2(/* Ok */ 0, [reverse(input_1.fields[0])]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function traverseValidationA(f, xs) {
|
|
245
|
+
return traverseValidationA$0027(new FSharpResult$2(/* Ok */ 0, [empty()]), f, xs);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function sequenceValidationA(xs) {
|
|
249
|
+
return traverseValidationA((x) => x, xs);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function traverseAsyncResultA(f, xs) {
|
|
253
|
+
return traverseAsyncResultA$0027(singleton.Return(new FSharpResult$2(/* Ok */ 0, [empty()])), f, xs);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function sequenceAsyncResultA(xs) {
|
|
257
|
+
return traverseAsyncResultA((x) => x, xs);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function traverseOptionM$0027(state_mut, f_mut, xs_mut) {
|
|
261
|
+
traverseOptionM$0027:
|
|
262
|
+
while (true) {
|
|
263
|
+
const state = state_mut, f = f_mut, xs = xs_mut;
|
|
264
|
+
if (!isEmpty(xs)) {
|
|
265
|
+
let r;
|
|
266
|
+
let matchValue;
|
|
267
|
+
let x_4;
|
|
268
|
+
const opt = f(head(xs));
|
|
269
|
+
x_4 = ((opt == null) ? undefined : some(value_10(opt)));
|
|
270
|
+
if (x_4 == null) {
|
|
271
|
+
matchValue = undefined;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const _arg = value_10(x_4);
|
|
275
|
+
let x_2;
|
|
276
|
+
const opt_1 = state;
|
|
277
|
+
x_2 = ((opt_1 == null) ? undefined : opt_1);
|
|
278
|
+
matchValue = ((x_2 == null) ? undefined : cons(_arg, x_2));
|
|
279
|
+
}
|
|
280
|
+
r = ((matchValue == null) ? undefined : matchValue);
|
|
281
|
+
if (r == null) {
|
|
282
|
+
return r;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
state_mut = r;
|
|
286
|
+
f_mut = f;
|
|
287
|
+
xs_mut = tail(xs);
|
|
288
|
+
continue traverseOptionM$0027;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
const input_1 = state;
|
|
293
|
+
if (input_1 == null) {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
return reverse(input_1);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function traverseAsyncOptionM$0027(state, f, xs) {
|
|
305
|
+
if (!isEmpty(xs)) {
|
|
306
|
+
return singleton.Delay(() => singleton.Bind(singleton.Delay(() => {
|
|
307
|
+
const input_8 = f(head(xs));
|
|
308
|
+
return singleton.Bind(input_8, (x_2) => {
|
|
309
|
+
if (x_2 == null) {
|
|
310
|
+
return singleton.Return(undefined);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
const _arg = value_10(x_2);
|
|
314
|
+
return singleton.Bind(state, (x_1) => {
|
|
315
|
+
if (x_1 == null) {
|
|
316
|
+
return singleton.Return(undefined);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
const _arg_1 = x_1;
|
|
320
|
+
return singleton.Return(cons(_arg, _arg_1));
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}), (_arg_2) => {
|
|
326
|
+
const o = _arg_2;
|
|
327
|
+
return (o == null) ? singleton.Return(o) : singleton.ReturnFrom(traverseAsyncOptionM$0027(singleton.Return(o), f, tail(xs)));
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
return singleton.Bind(state, (x$0027) => {
|
|
332
|
+
let value;
|
|
333
|
+
const input_2 = x$0027;
|
|
334
|
+
value = ((input_2 == null) ? undefined : reverse(input_2));
|
|
335
|
+
return singleton.Return(value);
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Applies the given function <paramref name="f"/> to each element in the input list <paramref name="xs"/>,
|
|
342
|
+
* and returns an option containing a list of the results. If any of the function applications return None,
|
|
343
|
+
* the entire result will be None.
|
|
344
|
+
*/
|
|
345
|
+
export function traverseOptionM(f, xs) {
|
|
346
|
+
return traverseOptionM$0027(empty(), f, xs);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Applies the monadic function <paramref name="id"/> to each element in the input list <paramref name="xs"/>,
|
|
351
|
+
* and returns the result as an option. If any element in the list is None, the entire result will be None.
|
|
352
|
+
*/
|
|
353
|
+
export function sequenceOptionM(xs) {
|
|
354
|
+
return traverseOptionM((x) => x, xs);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export function traverseAsyncOptionM(f, xs) {
|
|
358
|
+
return traverseAsyncOptionM$0027(singleton.Return(empty()), f, xs);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function sequenceAsyncOptionM(xs) {
|
|
362
|
+
return traverseAsyncOptionM((x) => x, xs);
|
|
363
|
+
}
|
|
364
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
(*
|
|
4
|
+
This Polyfills the F# 9.0 and later types for nullability, which are not available in earlier versions of F# or in Fable.
|
|
5
|
+
This is useful for keeping compatibility with older versions of F# or when using Fable, which does not support the new nullability features.
|
|
6
|
+
*)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
open System
|
|
10
|
+
|
|
11
|
+
/// Represents errors that occur during application execution. In F# 9.0 and later, this type is marked as nullable.
|
|
12
|
+
type ExceptionNull =
|
|
13
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
14
|
+
Exception | null
|
|
15
|
+
#else
|
|
16
|
+
Exception
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
/// Provides a mechanism for releasing unmanaged resources. In F# 9.0 and later, this type is marked as nullable.
|
|
20
|
+
type IDisposableNull =
|
|
21
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
22
|
+
IDisposable | null
|
|
23
|
+
#else
|
|
24
|
+
IDisposable
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/// Provides a mechanism for releasing unmanaged resources asynchronously. In F# 9.0 and later, this type is marked as nullable.
|
|
28
|
+
type IAsyncDisposableNull =
|
|
29
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
30
|
+
IAsyncDisposable | null
|
|
31
|
+
#else
|
|
32
|
+
IAsyncDisposable
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
/// An abbreviation for the CLI type System.Object. In F# 9.0 and later, this type is marked as nullable.
|
|
36
|
+
type ObjNull =
|
|
37
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
38
|
+
objnull
|
|
39
|
+
#else
|
|
40
|
+
obj
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/// An abbreviation for the CLI type System.Collections.Generic.IEnumerable. In F# 9.0 and later, this type is marked as nullable.
|
|
45
|
+
type SeqNull<'T> =
|
|
46
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
47
|
+
seq<'T> | null
|
|
48
|
+
#else
|
|
49
|
+
seq<'T>
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
/// An abbreviation for the CLI type System.String. In F# 9.0 and later, this type is marked as nullable.
|
|
53
|
+
type StringNull =
|
|
54
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
55
|
+
string | null
|
|
56
|
+
#else
|
|
57
|
+
string
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/// An abbreviation for the CLI type System.Collections.Generic.List`1 . In F# 9.0 and later, this type is marked as nullable.
|
|
61
|
+
type ResizeArrayNull<'T> =
|
|
62
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
63
|
+
ResizeArray<'T> | null
|
|
64
|
+
#else
|
|
65
|
+
ResizeArray<'T>
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
module internal Nullness =
|
|
70
|
+
|
|
71
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
72
|
+
/// Throw a System.ArgumentNullException if the given value is null exception
|
|
73
|
+
let inline nullArgCheck name value = nullArgCheck name value
|
|
74
|
+
#else
|
|
75
|
+
/// Throw a System.ArgumentNullException if the given value is null exception
|
|
76
|
+
let inline nullArgCheck (name: string) (value: 'T) : 'T =
|
|
77
|
+
if isNull value then
|
|
78
|
+
raise (ArgumentNullException(name))
|
|
79
|
+
else
|
|
80
|
+
value
|
|
81
|
+
#endif
|