@glutinum/cli 0.12.0 → 0.14.0
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/README.md +35 -3
- package/dist/Glutinum.Converter/Abbreviations.js +246 -0
- package/dist/Glutinum.Converter/FsharpAST.js +98 -34
- package/dist/Glutinum.Converter/Generate.js +55 -8
- package/dist/Glutinum.Converter/GlueAST.js +446 -30
- package/dist/Glutinum.Converter/Log.js +7 -8
- package/dist/Glutinum.Converter/Merge.js +683 -31
- package/dist/Glutinum.Converter/Packages.js +308 -0
- package/dist/Glutinum.Converter/Printer.js +332 -170
- package/dist/Glutinum.Converter/Read.js +279 -6
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +13 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +102 -17
- package/dist/Glutinum.Converter/Reader/Documentation.js +168 -73
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +7 -51
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +64 -15
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +165 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -5
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +122 -4
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +83 -7
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +11 -8
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +3 -2
- package/dist/Glutinum.Converter/Reader/Node.js +24 -10
- package/dist/Glutinum.Converter/Reader/Parameters.js +110 -7
- package/dist/Glutinum.Converter/Reader/Report.js +31 -12
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +4 -3
- package/dist/Glutinum.Converter/Reader/TypeNode.js +1527 -248
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +75 -20
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +8 -5
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +184 -50
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +32 -13
- package/dist/Glutinum.Converter/Reader/Types.js +180 -0
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +99 -43
- package/dist/Glutinum.Converter/Reader/Utils.js +1143 -55
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +59 -14
- package/dist/Glutinum.Converter/Transform.js +8710 -1137
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +3 -3
- package/dist/Glutinum.Converter/TypeScript.js +3 -3
- package/dist/Glutinum.Converter/Utils/Keywords.js +6 -6
- package/dist/Glutinum.Converter/Utils/List.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +76 -14
- package/dist/Glutinum.Converter/Utils/String.js +7 -3
- package/dist/Program.js +230 -72
- package/package.json +4 -4
- package/src/Glutinum.Converter/js/bootstrap.js +109 -2
- package/src/Glutinum.Converter/js/host.js +144 -0
- package/src/Glutinum.Converter/js/npm.js +137 -0
- package/src/Glutinum.Converter/js/resolve.js +402 -0
- package/dist/Glutinum.Converter/FsharpAST.js.map +0 -1
- package/dist/Glutinum.Converter/Generate.js.map +0 -1
- package/dist/Glutinum.Converter/GlueAST.js.map +0 -1
- package/dist/Glutinum.Converter/Log.js.map +0 -1
- package/dist/Glutinum.Converter/Merge.js.map +0 -1
- package/dist/Glutinum.Converter/Printer.js.map +0 -1
- package/dist/Glutinum.Converter/Read.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Documentation.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Node.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Report.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Utils.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +0 -1
- package/dist/Glutinum.Converter/Transform.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Keywords.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/List.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Naming.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/String.js.map +0 -1
- package/dist/Program.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +0 -57
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +0 -105
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +0 -20
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs +0 -766
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +0 -218
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +0 -31
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +0 -20
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AssemblyInfo.fs +0 -19
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs +0 -207
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js +0 -127
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOption.fs +0 -81
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs +0 -183
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js +0 -37
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionOp.fs +0 -24
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResult.fs +0 -439
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs +0 -217
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOp.fs +0 -24
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs +0 -75
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +0 -26
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs +0 -238
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionOp.fs +0 -24
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidation.fs +0 -190
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs +0 -194
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationOp.fs +0 -35
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +0 -51
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs +0 -218
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js +0 -358
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Option.fs +0 -331
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +0 -186
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionOp.fs +0 -21
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs +0 -644
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js +0 -45
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs +0 -155
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js +0 -23
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOp.fs +0 -45
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs +0 -201
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js +0 -65
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs +0 -146
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionOp.fs +0 -57
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +0 -19
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +0 -31
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +0 -22
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Validation.fs +0 -172
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs +0 -148
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationOp.fs +0 -35
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOption.fs +0 -151
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
- package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +0 -123
- package/dist/fable_modules/fable-library-js.4.14.0/Array.js +0 -1242
- package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/Async.js +0 -158
- package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +0 -59
- package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.js +0 -183
- package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +0 -115
- package/dist/fable_modules/fable-library-js.4.14.0/BigInt.js +0 -282
- package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.js +0 -138
- package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/Boolean.js +0 -21
- package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +0 -65
- package/dist/fable_modules/fable-library-js.4.14.0/Char.js +0 -169
- package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +0 -121
- package/dist/fable_modules/fable-library-js.4.14.0/Choice.js +0 -184
- package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +0 -70
- package/dist/fable_modules/fable-library-js.4.14.0/Date.js +0 -749
- package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +0 -63
- package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.js +0 -268
- package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.js +0 -124
- package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +0 -45
- package/dist/fable_modules/fable-library-js.4.14.0/Decimal.js +0 -212
- package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +0 -11
- package/dist/fable_modules/fable-library-js.4.14.0/Double.js +0 -46
- package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Encoding.js +0 -173
- package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +0 -31
- package/dist/fable_modules/fable-library-js.4.14.0/Event.js +0 -93
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +0 -7
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.js +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +0 -17
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +0 -69
- package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +0 -24
- package/dist/fable_modules/fable-library-js.4.14.0/Global.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/Guid.js +0 -142
- package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/Int32.js +0 -135
- package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +0 -143
- package/dist/fable_modules/fable-library-js.4.14.0/List.js +0 -1273
- package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/Long.js +0 -46
- package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +0 -25
- package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.js +0 -93
- package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +0 -178
- package/dist/fable_modules/fable-library-js.4.14.0/Map.js +0 -1396
- package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.js +0 -112
- package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +0 -52
- package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.js +0 -327
- package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +0 -39
- package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.js +0 -233
- package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Native.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Numeric.js +0 -71
- package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/Observable.js +0 -113
- package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/Option.js +0 -96
- package/dist/fable_modules/fable-library-js.4.14.0/README.md +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Random.js +0 -170
- package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Range.js +0 -45
- package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +0 -119
- package/dist/fable_modules/fable-library-js.4.14.0/Reflection.js +0 -461
- package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/RegExp.js +0 -132
- package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Result.js +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Seq.js +0 -1379
- package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/Seq2.js +0 -111
- package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +0 -190
- package/dist/fable_modules/fable-library-js.4.14.0/Set.js +0 -1789
- package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +0 -50
- package/dist/fable_modules/fable-library-js.4.14.0/String.js +0 -543
- package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +0 -79
- package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.js +0 -317
- package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +0 -38
- package/dist/fable_modules/fable-library-js.4.14.0/System.Text.js +0 -162
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +0 -15
- package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.js +0 -122
- package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +0 -34
- package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.js +0 -177
- package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Timer.js +0 -67
- package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +0 -58
- package/dist/fable_modules/fable-library-js.4.14.0/Types.js +0 -208
- package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.js +0 -4
- package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +0 -29
- package/dist/fable_modules/fable-library-js.4.14.0/Uri.js +0 -142
- package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +0 -207
- package/dist/fable_modules/fable-library-js.4.14.0/Util.js +0 -770
- package/dist/fable_modules/fable-library-js.4.14.0/big.d.ts +0 -338
- package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/lib/big.js +0 -826
- package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
- package/dist/fable_modules/project_cracked.json +0 -1
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling
|
|
2
|
-
|
|
3
|
-
open System
|
|
4
|
-
|
|
5
|
-
[<AutoOpen>]
|
|
6
|
-
module ResultOptionCE =
|
|
7
|
-
|
|
8
|
-
type ResultOptionBuilder() =
|
|
9
|
-
member inline _.Return value = ResultOption.retn value
|
|
10
|
-
|
|
11
|
-
member inline _.ReturnFrom value : Result<'ok option, 'error> = value
|
|
12
|
-
|
|
13
|
-
member inline _.Zero() =
|
|
14
|
-
option.Zero()
|
|
15
|
-
|> Ok
|
|
16
|
-
|
|
17
|
-
member inline _.Bind
|
|
18
|
-
(
|
|
19
|
-
resultOpt: Result<'okInput option, 'error>,
|
|
20
|
-
[<InlineIfLambda>] binder: 'okInput -> Result<'okOutput option, 'error>
|
|
21
|
-
) : Result<'okOutput option, 'error> =
|
|
22
|
-
ResultOption.bind binder resultOpt
|
|
23
|
-
|
|
24
|
-
member inline _.Combine
|
|
25
|
-
(
|
|
26
|
-
resultOpt: Result<unit option, 'error>,
|
|
27
|
-
[<InlineIfLambda>] binder: unit -> Result<'ok option, 'error>
|
|
28
|
-
) : Result<'ok option, 'error> =
|
|
29
|
-
ResultOption.bind binder resultOpt
|
|
30
|
-
|
|
31
|
-
member inline _.Delay([<InlineIfLambda>] delayer: unit -> Result<'ok option, 'error>) =
|
|
32
|
-
delayer
|
|
33
|
-
|
|
34
|
-
member inline _.Run
|
|
35
|
-
([<InlineIfLambda>] generator: unit -> Result<'ok option, 'error>)
|
|
36
|
-
: Result<'ok option, 'error> =
|
|
37
|
-
generator ()
|
|
38
|
-
|
|
39
|
-
member inline this.TryWith
|
|
40
|
-
(
|
|
41
|
-
[<InlineIfLambda>] generator: unit -> Result<'T option, 'TError>,
|
|
42
|
-
[<InlineIfLambda>] handler: exn -> Result<'T option, 'TError>
|
|
43
|
-
) : Result<'T option, 'TError> =
|
|
44
|
-
try
|
|
45
|
-
this.Run generator
|
|
46
|
-
with e ->
|
|
47
|
-
handler e
|
|
48
|
-
|
|
49
|
-
member inline this.TryFinally
|
|
50
|
-
(
|
|
51
|
-
[<InlineIfLambda>] generator: unit -> Result<'ok option, 'error>,
|
|
52
|
-
[<InlineIfLambda>] compensation: unit -> unit
|
|
53
|
-
) : Result<'ok option, 'error> =
|
|
54
|
-
try
|
|
55
|
-
this.Run generator
|
|
56
|
-
finally
|
|
57
|
-
compensation ()
|
|
58
|
-
|
|
59
|
-
member inline this.Using
|
|
60
|
-
(
|
|
61
|
-
resource: 'disposable :> IDisposable,
|
|
62
|
-
binder: 'disposable -> Result<'ok option, 'error>
|
|
63
|
-
) : Result<'ok option, 'error> =
|
|
64
|
-
this.TryFinally(
|
|
65
|
-
(fun () -> binder resource),
|
|
66
|
-
(fun () ->
|
|
67
|
-
if not (obj.ReferenceEquals(resource, null)) then
|
|
68
|
-
resource.Dispose()
|
|
69
|
-
)
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
member inline this.While
|
|
73
|
-
(
|
|
74
|
-
[<InlineIfLambda>] guard: unit -> bool,
|
|
75
|
-
[<InlineIfLambda>] generator: unit -> Result<unit option, 'error>
|
|
76
|
-
) : Result<unit option, 'error> =
|
|
77
|
-
|
|
78
|
-
let mutable doContinue = true
|
|
79
|
-
let mutable result = Ok(Some())
|
|
80
|
-
|
|
81
|
-
while doContinue
|
|
82
|
-
&& guard () do
|
|
83
|
-
match generator () with
|
|
84
|
-
| Ok option ->
|
|
85
|
-
match option with
|
|
86
|
-
| Some _ -> ()
|
|
87
|
-
| None ->
|
|
88
|
-
doContinue <- false
|
|
89
|
-
result <- Ok None
|
|
90
|
-
| Error e ->
|
|
91
|
-
doContinue <- false
|
|
92
|
-
result <- Error e
|
|
93
|
-
|
|
94
|
-
result
|
|
95
|
-
|
|
96
|
-
member inline this.For
|
|
97
|
-
(
|
|
98
|
-
sequence: #seq<'T>,
|
|
99
|
-
[<InlineIfLambda>] binder: 'T -> Result<unit option, 'TError>
|
|
100
|
-
) : Result<unit option, 'TError> =
|
|
101
|
-
this.Using(
|
|
102
|
-
sequence.GetEnumerator(),
|
|
103
|
-
fun enum ->
|
|
104
|
-
this.While(
|
|
105
|
-
(fun () -> enum.MoveNext()),
|
|
106
|
-
this.Delay(fun () -> binder enum.Current)
|
|
107
|
-
)
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
member inline _.BindReturn
|
|
111
|
-
(
|
|
112
|
-
resultOpt: Result<'T option, 'TError>,
|
|
113
|
-
[<InlineIfLambda>] binder: 'T -> 'U
|
|
114
|
-
) : Result<'U option, 'TError> =
|
|
115
|
-
ResultOption.map binder resultOpt
|
|
116
|
-
|
|
117
|
-
member inline _.MergeSources
|
|
118
|
-
(
|
|
119
|
-
left: Result<'left option, 'error>,
|
|
120
|
-
right: Result<'right option, 'error>
|
|
121
|
-
) : Result<('left * 'right) option, 'error> =
|
|
122
|
-
ResultOption.zip left right
|
|
123
|
-
|
|
124
|
-
member inline _.Source(result: Result<'ok option, 'error>) : Result<'ok option, 'error> =
|
|
125
|
-
result
|
|
126
|
-
|
|
127
|
-
let resultOption = ResultOptionBuilder()
|
|
128
|
-
|
|
129
|
-
[<AutoOpen>]
|
|
130
|
-
module ResultOptionCEExtensions =
|
|
131
|
-
|
|
132
|
-
type ResultOptionBuilder with
|
|
133
|
-
|
|
134
|
-
/// <summary>
|
|
135
|
-
/// Needed to allow `for..in` and `for..do` functionality
|
|
136
|
-
/// </summary>
|
|
137
|
-
member inline _.Source(s: #seq<'value>) : #seq<'value> = s
|
|
138
|
-
|
|
139
|
-
member inline _.Source(result: Result<'ok, 'error>) : Result<'ok option, 'error> =
|
|
140
|
-
ResultOption.ofResult result
|
|
141
|
-
|
|
142
|
-
member inline _.Source(option: 'T option) : Result<'T option, 'error> =
|
|
143
|
-
ResultOption.ofOption option
|
|
144
|
-
|
|
145
|
-
member inline _.Source(choice: Choice<'T, 'Error>) : Result<'T option, 'Error> =
|
|
146
|
-
ResultOption.ofChoice choice
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
|
|
2
|
-
|
|
3
|
-
export class ResultOptionCE_ResultOptionBuilder {
|
|
4
|
-
constructor() {
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function ResultOptionCE_ResultOptionBuilder_$reflection() {
|
|
9
|
-
return class_type("FsToolkit.ErrorHandling.ResultOptionCE.ResultOptionBuilder", void 0, ResultOptionCE_ResultOptionBuilder);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function ResultOptionCE_ResultOptionBuilder_$ctor() {
|
|
13
|
-
return new ResultOptionCE_ResultOptionBuilder();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const ResultOptionCE_resultOption = ResultOptionCE_ResultOptionBuilder_$ctor();
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=ResultOptionCE.fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["./ResultOptionCE.fs"],"names":["\u0060\u0060.ctor\u0060\u0060"],"mappings":";;;;;;;;;;;;;;;2CA8HuB,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling.Operator.ResultOption
|
|
2
|
-
|
|
3
|
-
open FsToolkit.ErrorHandling
|
|
4
|
-
|
|
5
|
-
/// <summary>
|
|
6
|
-
/// Operators for working with the <c>Result</c> and <c>Option</c> types.
|
|
7
|
-
/// </summary>
|
|
8
|
-
[<AutoOpen>]
|
|
9
|
-
module ResultOption =
|
|
10
|
-
|
|
11
|
-
/// <summary>
|
|
12
|
-
/// Shorthand for <c>ResultOption.map</c>
|
|
13
|
-
/// </summary>
|
|
14
|
-
/// <param name="mapper">The function to map over the <c>Result</c> value.</param>
|
|
15
|
-
/// <param name="input">The <c>Result</c> value to map over.</param>
|
|
16
|
-
/// <returns>The result of mapping the function over the <c>Result</c> value.</returns>
|
|
17
|
-
let inline (<!>)
|
|
18
|
-
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
|
|
19
|
-
(input: Result<'okInput option, 'error>)
|
|
20
|
-
: Result<'okOutput option, 'error> =
|
|
21
|
-
ResultOption.map mapper input
|
|
22
|
-
|
|
23
|
-
/// <summary>
|
|
24
|
-
/// Shortand for <c>ResultOption.apply</c>
|
|
25
|
-
/// </summary>
|
|
26
|
-
/// <param name="applier">The <c>Result</c> value containing the function to apply.</param>
|
|
27
|
-
/// <param name="input">The <c>Result</c> value containing the value to apply the function to.</param>
|
|
28
|
-
/// <returns>The result of applying the function in the <c>Result</c> value to the value in the other <c>Result</c> value.</returns>
|
|
29
|
-
let inline (<*>)
|
|
30
|
-
(applier: Result<('okInput -> 'okOutput) option, 'error>)
|
|
31
|
-
(input: Result<'okInput option, 'error>)
|
|
32
|
-
: Result<'okOutput option, 'error> =
|
|
33
|
-
ResultOption.apply applier input
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
/// Shorthand for <c>ResultOption.apply</c>, where the value is wrapped in an <c>Option</c> for you
|
|
37
|
-
/// </summary>
|
|
38
|
-
/// <param name="applier">The <c>Result</c> value containing the function to apply.</param>
|
|
39
|
-
/// <param name="input">The <c>Result</c> value containing the value to apply the function to.</param>
|
|
40
|
-
/// <returns>The result of applying the function in the <c>Result</c> value to the value in the other <c>Result</c> value.</returns>
|
|
41
|
-
let inline (<*^>)
|
|
42
|
-
(applier: Result<('okInput -> 'okOutput) option, 'error>)
|
|
43
|
-
(input: Result<'okInput, 'error>)
|
|
44
|
-
: Result<'okOutput option, 'error> =
|
|
45
|
-
ResultOption.apply applier (Result.map Some input)
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
/// Shorthand for <c>ResultOption.bind</c>
|
|
49
|
-
/// </summary>
|
|
50
|
-
/// <param name="input">The <c>Result</c> value to bind over.</param>
|
|
51
|
-
/// <param name="binder">The function to bind over the <c>Result</c> value.</param>
|
|
52
|
-
/// <returns>The result of binding the function over the <c>Result</c> value.</returns>
|
|
53
|
-
let inline (>>=)
|
|
54
|
-
(input: Result<'okInput option, 'error>)
|
|
55
|
-
([<InlineIfLambda>] binder: 'okInput -> Result<'okOutput option, 'error>)
|
|
56
|
-
: Result<'okOutput option, 'error> =
|
|
57
|
-
ResultOption.bind binder input
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling
|
|
2
|
-
|
|
3
|
-
[<RequireQualifiedAccess>]
|
|
4
|
-
module Seq =
|
|
5
|
-
|
|
6
|
-
let sequenceResultM (xs: seq<Result<'t, 'e>>) : Result<'t seq, 'e> =
|
|
7
|
-
let rec loop xs ts =
|
|
8
|
-
match Seq.tryHead xs with
|
|
9
|
-
| Some x ->
|
|
10
|
-
x
|
|
11
|
-
|> Result.bind (fun t -> loop (Seq.tail xs) (t :: ts))
|
|
12
|
-
| None ->
|
|
13
|
-
Ok(
|
|
14
|
-
List.rev ts
|
|
15
|
-
|> List.toSeq
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
// Seq.cache prevents double evaluation in Seq.tail
|
|
19
|
-
loop (Seq.cache xs) []
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { cache, tail, tryHead } from "../fable-library-js.4.14.0/Seq.js";
|
|
2
|
-
import { empty, cons, reverse } from "../fable-library-js.4.14.0/List.js";
|
|
3
|
-
import { FSharpResult$2 } from "../fable-library-js.4.14.0/Result.js";
|
|
4
|
-
|
|
5
|
-
export function sequenceResultM(xs) {
|
|
6
|
-
const loop = (xs_1_mut, ts_mut) => {
|
|
7
|
-
loop:
|
|
8
|
-
while (true) {
|
|
9
|
-
const xs_1 = xs_1_mut, ts = ts_mut;
|
|
10
|
-
const matchValue = tryHead(xs_1);
|
|
11
|
-
if (matchValue == null) {
|
|
12
|
-
return new FSharpResult$2(0, [reverse(ts)]);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const input_1 = matchValue;
|
|
16
|
-
if (input_1.tag === 1) {
|
|
17
|
-
return new FSharpResult$2(1, [input_1.fields[0]]);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
xs_1_mut = tail(xs_1);
|
|
21
|
-
ts_mut = cons(input_1.fields[0], ts);
|
|
22
|
-
continue loop;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
return loop(cache(xs), empty());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=Seq.fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["./Seq.fs","./Result.fs"],"names":["loop","xs","ts","matchValue","input"],"mappings":";;;;;AAMgBA;;;kBAAKC,iBAAGC;AACNC,\u002BBAAA,QAAYF;AAAZ,gBAAA,AAAAE;AAKF,uBAAA,uBACI,QAASD;;;ACwCpBE,gCD5COD;AC8CF,oBAAA,AAAAC;AAEO,2BAAA,uBAAA,AAAAA;;;\u002BBD/C0B,KAASH;6BAAK,KC8C3C,AAAAG,mBD9CgDF;AAAzB;;;;;;AAQjC,WAAA,AAAAF,KAAM,MAAUC,KAAI","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
#if NETSTANDARD2_0
|
|
5
|
-
open System
|
|
6
|
-
|
|
7
|
-
/// InlineIfLambda doesn't exist until FSharp.Core 6.0.
|
|
8
|
-
/// Since we're targeting netstandard2.0 with FSharp.Core 4.7 to keep this libraries' reach
|
|
9
|
-
/// we need to create a fake attribute that does nothing instead of having ifdefs in each function argument
|
|
10
|
-
[<AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)>]
|
|
11
|
-
[<Sealed>]
|
|
12
|
-
type internal InlineIfLambdaAttribute() =
|
|
13
|
-
inherit System.Attribute()
|
|
14
|
-
|
|
15
|
-
open System.Runtime.CompilerServices
|
|
16
|
-
|
|
17
|
-
// Let all the child libraries have access to this shim as well
|
|
18
|
-
[<assembly: InternalsVisibleTo("FsToolkit.ErrorHandling.TaskResult")>]
|
|
19
|
-
[<assembly: InternalsVisibleTo("FsToolkit.ErrorHandling.JobResult")>]
|
|
20
|
-
[<assembly: InternalsVisibleTo("FsToolkit.ErrorHandling.AsyncSeq")>]
|
|
21
|
-
do ()
|
|
22
|
-
#endif
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Attribute } from "../fable-library-js.4.14.0/Types.js";
|
|
2
|
-
import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
|
|
3
|
-
|
|
4
|
-
export class InlineIfLambdaAttribute extends Attribute {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function InlineIfLambdaAttribute_$reflection() {
|
|
11
|
-
return class_type("FsToolkit.ErrorHandling.InlineIfLambdaAttribute", void 0, InlineIfLambdaAttribute, class_type("System.Attribute"));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function InlineIfLambdaAttribute_$ctor() {
|
|
15
|
-
return new InlineIfLambdaAttribute();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=Shims.fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":null,"sourcesContent":null,"sourceRoot":null}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling
|
|
2
|
-
|
|
3
|
-
/// Validation<'a, 'err> is defined as Result<'a, 'err list> meaning you can use many of the functions found in the Result module.
|
|
4
|
-
type Validation<'ok, 'error> = Result<'ok, 'error list>
|
|
5
|
-
|
|
6
|
-
[<RequireQualifiedAccess>]
|
|
7
|
-
module Validation =
|
|
8
|
-
|
|
9
|
-
let inline ok (value: 'ok) : Validation<'ok, 'error> = Ok value
|
|
10
|
-
let inline error (error: 'error) : Validation<'ok, 'error> = Error [ error ]
|
|
11
|
-
|
|
12
|
-
let inline ofResult (result: Result<'ok, 'error>) : Validation<'ok, 'error> =
|
|
13
|
-
Result.mapError List.singleton result
|
|
14
|
-
|
|
15
|
-
let inline ofChoice (choice: Choice<'ok, 'error>) : Validation<'ok, 'error> =
|
|
16
|
-
match choice with
|
|
17
|
-
| Choice1Of2 x -> ok x
|
|
18
|
-
| Choice2Of2 e -> error e
|
|
19
|
-
|
|
20
|
-
let inline apply
|
|
21
|
-
(applier: Validation<'okInput -> 'okOutput, 'error>)
|
|
22
|
-
(input: Validation<'okInput, 'error>)
|
|
23
|
-
: Validation<'okOutput, 'error> =
|
|
24
|
-
match applier, input with
|
|
25
|
-
| Ok f, Ok x -> Ok(f x)
|
|
26
|
-
| Error errs, Ok _
|
|
27
|
-
| Ok _, Error errs -> Error errs
|
|
28
|
-
| Error errs1, Error errs2 ->
|
|
29
|
-
Error(
|
|
30
|
-
errs1
|
|
31
|
-
@ errs2
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
let inline retn (value: 'ok) : Validation<'ok, 'error> = ok value
|
|
35
|
-
|
|
36
|
-
let inline returnError (error: 'error) : Validation<'ok, 'error> = Error [ error ]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/// <summary>
|
|
40
|
-
/// Returns <paramref name="result"/> if it is <c>Ok</c>, otherwise returns <paramref name="ifError"/>
|
|
41
|
-
/// </summary>
|
|
42
|
-
/// <param name="ifError">The value to use if <paramref name="result"/> is <c>Error</c></param>
|
|
43
|
-
/// <param name="result">The input result.</param>
|
|
44
|
-
/// <remarks>
|
|
45
|
-
/// </remarks>
|
|
46
|
-
/// <example>
|
|
47
|
-
/// <code>
|
|
48
|
-
/// Error (["First"]) |> Validation.orElse (Error (["Second"])) // evaluates to Error (["Second"])
|
|
49
|
-
/// Error (["First"]) |> Validation.orElseWith (Ok ("Second")) // evaluates to Ok ("Second")
|
|
50
|
-
/// Ok ("First") |> Validation.orElseWith (Error (["Second"])) // evaluates to Ok ("First")
|
|
51
|
-
/// Ok ("First") |> Validation.orElseWith (Ok ("Second")) // evaluates to Ok ("First")
|
|
52
|
-
/// </code>
|
|
53
|
-
/// </example>
|
|
54
|
-
/// <returns>
|
|
55
|
-
/// The result if the result is Ok, else returns <paramref name="ifError"/>.
|
|
56
|
-
/// </returns>
|
|
57
|
-
let inline orElse
|
|
58
|
-
(ifError: Validation<'ok, 'errorOutput>)
|
|
59
|
-
(result: Validation<'ok, 'errorInput>)
|
|
60
|
-
: Validation<'ok, 'errorOutput> =
|
|
61
|
-
result
|
|
62
|
-
|> Result.either ok (fun _ -> ifError)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/// <summary>
|
|
66
|
-
/// Returns <paramref name="result"/> if it is <c>Ok</c>, otherwise executes <paramref name="ifErrorFunc"/> and returns the result.
|
|
67
|
-
/// </summary>
|
|
68
|
-
/// <param name="ifErrorFunc">A function that provides an alternate result when evaluated.</param>
|
|
69
|
-
/// <param name="result">The input result.</param>
|
|
70
|
-
/// <remarks>
|
|
71
|
-
/// <paramref name="ifErrorFunc"/> is not executed unless <paramref name="result"/> is an <c>Error</c>.
|
|
72
|
-
/// </remarks>
|
|
73
|
-
/// <example>
|
|
74
|
-
/// <code>
|
|
75
|
-
/// Error (["First"]) |> Validation.orElseWith (fun _ -> Error (["Second"])) // evaluates to Error (["Second"])
|
|
76
|
-
/// Error (["First"]) |> Validation.orElseWith (fun _ -> Ok ("Second")) // evaluates to Ok ("Second")
|
|
77
|
-
/// Ok ("First") |> Validation.orElseWith (fun _ -> Error (["Second"])) // evaluates to Ok ("First")
|
|
78
|
-
/// Ok ("First") |> Validation.orElseWith (fun _ -> Ok ("Second")) // evaluates to Ok ("First")
|
|
79
|
-
/// </code>
|
|
80
|
-
/// </example>
|
|
81
|
-
/// <returns>
|
|
82
|
-
/// The result if the result is Ok, else the result of executing <paramref name="ifErrorFunc"/>.
|
|
83
|
-
/// </returns>
|
|
84
|
-
let inline orElseWith
|
|
85
|
-
([<InlineIfLambda>] ifErrorFunc: 'errorInput list -> Validation<'ok, 'errorOutput>)
|
|
86
|
-
(result: Validation<'ok, 'errorInput>)
|
|
87
|
-
: Validation<'ok, 'errorOutput> =
|
|
88
|
-
result
|
|
89
|
-
|> Result.either ok ifErrorFunc
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
let inline map
|
|
93
|
-
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
|
|
94
|
-
(input: Validation<'okInput, 'error>)
|
|
95
|
-
: Validation<'okOutput, 'error> =
|
|
96
|
-
Result.map mapper input
|
|
97
|
-
|
|
98
|
-
let inline map2
|
|
99
|
-
([<InlineIfLambda>] mapper: 'okInput1 -> 'okInput2 -> 'okOutput)
|
|
100
|
-
(input1: Validation<'okInput1, 'error>)
|
|
101
|
-
(input2: Validation<'okInput2, 'error>)
|
|
102
|
-
: Validation<'okOutput, 'error> =
|
|
103
|
-
match input1, input2 with
|
|
104
|
-
| Ok x, Ok y -> Ok(mapper x y)
|
|
105
|
-
| Ok _, Error errs -> Error errs
|
|
106
|
-
| Error errs, Ok _ -> Error errs
|
|
107
|
-
| Error errs1, Error errs2 ->
|
|
108
|
-
Error(
|
|
109
|
-
errs1
|
|
110
|
-
@ errs2
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
let inline map3
|
|
114
|
-
([<InlineIfLambda>] mapper: 'okInput1 -> 'okInput2 -> 'okInput3 -> 'okOutput)
|
|
115
|
-
(input1: Validation<'okInput1, 'error>)
|
|
116
|
-
(input2: Validation<'okInput2, 'error>)
|
|
117
|
-
(input3: Validation<'okInput3, 'error>)
|
|
118
|
-
: Validation<'okOutput, 'error> =
|
|
119
|
-
match input1, input2, input3 with
|
|
120
|
-
| Ok x, Ok y, Ok z -> Ok(mapper x y z)
|
|
121
|
-
| Error errs, Ok _, Ok _ -> Error errs
|
|
122
|
-
| Ok _, Error errs, Ok _ -> Error errs
|
|
123
|
-
| Ok _, Ok _, Error errs -> Error errs
|
|
124
|
-
| Error errs1, Error errs2, Ok _ ->
|
|
125
|
-
Error(
|
|
126
|
-
errs1
|
|
127
|
-
@ errs2
|
|
128
|
-
)
|
|
129
|
-
| Ok _, Error errs1, Error errs2 ->
|
|
130
|
-
Error(
|
|
131
|
-
errs1
|
|
132
|
-
@ errs2
|
|
133
|
-
)
|
|
134
|
-
| Error errs1, Ok _, Error errs2 ->
|
|
135
|
-
Error(
|
|
136
|
-
errs1
|
|
137
|
-
@ errs2
|
|
138
|
-
)
|
|
139
|
-
| Error errs1, Error errs2, Error errs3 ->
|
|
140
|
-
Error(
|
|
141
|
-
errs1
|
|
142
|
-
@ errs2
|
|
143
|
-
@ errs3
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
let inline mapError
|
|
147
|
-
([<InlineIfLambda>] errorMapper: 'errorInput -> 'errorOutput)
|
|
148
|
-
(input: Validation<'ok, 'errorInput>)
|
|
149
|
-
: Validation<'ok, 'errorOutput> =
|
|
150
|
-
Result.mapError (List.map errorMapper) input
|
|
151
|
-
|
|
152
|
-
let inline mapErrors
|
|
153
|
-
([<InlineIfLambda>] errorMapper: 'errorInput list -> 'errorOutput list)
|
|
154
|
-
(input: Validation<'ok, 'errorInput>)
|
|
155
|
-
: Validation<'ok, 'errorOutput> =
|
|
156
|
-
Result.mapError (errorMapper) input
|
|
157
|
-
|
|
158
|
-
let inline bind
|
|
159
|
-
([<InlineIfLambda>] binder: 'okInput -> Validation<'okOutput, 'error>)
|
|
160
|
-
(input: Validation<'okInput, 'error>)
|
|
161
|
-
: Validation<'okOutput, 'error> =
|
|
162
|
-
Result.bind binder input
|
|
163
|
-
|
|
164
|
-
let inline zip
|
|
165
|
-
(left: Validation<'left, 'error>)
|
|
166
|
-
(right: Validation<'right, 'error>)
|
|
167
|
-
: Validation<'left * 'right, 'error> =
|
|
168
|
-
match left, right with
|
|
169
|
-
| Ok x1res, Ok x2res -> Ok(x1res, x2res)
|
|
170
|
-
| Error e, Ok _ -> Error e
|
|
171
|
-
| Ok _, Error e -> Error e
|
|
172
|
-
| Error e1, Error e2 -> Error(e1 @ e2)
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
namespace FsToolkit.ErrorHandling
|
|
2
|
-
|
|
3
|
-
open System
|
|
4
|
-
|
|
5
|
-
[<AutoOpen>]
|
|
6
|
-
module ValidationCE =
|
|
7
|
-
type ValidationBuilder() =
|
|
8
|
-
member inline _.Return(value: 'ok) : Validation<'ok, 'error> = Validation.ok value
|
|
9
|
-
|
|
10
|
-
member inline _.ReturnFrom(result: Validation<'ok, 'error>) : Validation<'ok, 'error> =
|
|
11
|
-
result
|
|
12
|
-
|
|
13
|
-
member inline _.Bind
|
|
14
|
-
(
|
|
15
|
-
result: Validation<'okInput, 'error>,
|
|
16
|
-
[<InlineIfLambda>] binder: 'okInput -> Validation<'okOutput, 'error>
|
|
17
|
-
) : Validation<'okOutput, 'error> =
|
|
18
|
-
Validation.bind binder result
|
|
19
|
-
|
|
20
|
-
member inline this.Zero() : Validation<unit, 'error> = this.Return()
|
|
21
|
-
|
|
22
|
-
member inline _.Delay
|
|
23
|
-
([<InlineIfLambda>] generator: unit -> Validation<'ok, 'error>)
|
|
24
|
-
: unit -> Validation<'ok, 'error> =
|
|
25
|
-
generator
|
|
26
|
-
|
|
27
|
-
member inline _.Run
|
|
28
|
-
([<InlineIfLambda>] generator: unit -> Validation<'ok, 'error>)
|
|
29
|
-
: Validation<'ok, 'error> =
|
|
30
|
-
generator ()
|
|
31
|
-
|
|
32
|
-
member inline this.Combine
|
|
33
|
-
(
|
|
34
|
-
result: Validation<unit, 'error>,
|
|
35
|
-
[<InlineIfLambda>] binder: unit -> Validation<'ok, 'error>
|
|
36
|
-
) : Validation<'ok, 'error> =
|
|
37
|
-
this.Bind(result, binder)
|
|
38
|
-
|
|
39
|
-
member inline this.TryWith
|
|
40
|
-
(
|
|
41
|
-
[<InlineIfLambda>] generator: unit -> Validation<'ok, 'error>,
|
|
42
|
-
[<InlineIfLambda>] handler: exn -> Validation<'ok, 'error>
|
|
43
|
-
) : Validation<'ok, 'error> =
|
|
44
|
-
try
|
|
45
|
-
this.Run generator
|
|
46
|
-
with e ->
|
|
47
|
-
handler e
|
|
48
|
-
|
|
49
|
-
member inline this.TryFinally
|
|
50
|
-
(
|
|
51
|
-
[<InlineIfLambda>] generator: unit -> Validation<'ok, 'error>,
|
|
52
|
-
[<InlineIfLambda>] compensation: unit -> unit
|
|
53
|
-
) : Validation<'ok, 'error> =
|
|
54
|
-
try
|
|
55
|
-
this.Run generator
|
|
56
|
-
finally
|
|
57
|
-
compensation ()
|
|
58
|
-
|
|
59
|
-
member inline this.Using
|
|
60
|
-
(
|
|
61
|
-
resource: 'disposable :> IDisposable,
|
|
62
|
-
[<InlineIfLambda>] binder: 'disposable -> Validation<'okOutput, 'error>
|
|
63
|
-
) : Validation<'okOutput, 'error> =
|
|
64
|
-
this.TryFinally(
|
|
65
|
-
(fun () -> binder resource),
|
|
66
|
-
(fun () ->
|
|
67
|
-
if not (obj.ReferenceEquals(resource, null)) then
|
|
68
|
-
resource.Dispose()
|
|
69
|
-
)
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
member inline this.While
|
|
73
|
-
(
|
|
74
|
-
[<InlineIfLambda>] guard: unit -> bool,
|
|
75
|
-
[<InlineIfLambda>] generator: unit -> Validation<unit, 'error>
|
|
76
|
-
) : Validation<unit, 'error> =
|
|
77
|
-
let mutable doContinue = true
|
|
78
|
-
let mutable result = Ok()
|
|
79
|
-
|
|
80
|
-
while doContinue
|
|
81
|
-
&& guard () do
|
|
82
|
-
match generator () with
|
|
83
|
-
| Ok() -> ()
|
|
84
|
-
| Error e ->
|
|
85
|
-
doContinue <- false
|
|
86
|
-
result <- Error e
|
|
87
|
-
|
|
88
|
-
result
|
|
89
|
-
|
|
90
|
-
member inline this.For
|
|
91
|
-
(
|
|
92
|
-
sequence: #seq<'ok>,
|
|
93
|
-
[<InlineIfLambda>] binder: 'ok -> Validation<unit, 'error>
|
|
94
|
-
) : Validation<unit, 'error> =
|
|
95
|
-
this.Using(
|
|
96
|
-
sequence.GetEnumerator(),
|
|
97
|
-
fun enum -> this.While(enum.MoveNext, this.Delay(fun () -> binder enum.Current))
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
member inline _.BindReturn
|
|
101
|
-
(
|
|
102
|
-
input: Validation<'okInput, 'error>,
|
|
103
|
-
[<InlineIfLambda>] mapper: 'okInput -> 'okOutput
|
|
104
|
-
) : Validation<'okOutput, 'error> =
|
|
105
|
-
Validation.map mapper input
|
|
106
|
-
|
|
107
|
-
member inline _.MergeSources
|
|
108
|
-
(
|
|
109
|
-
left: Validation<'left, 'error>,
|
|
110
|
-
right: Validation<'right, 'error>
|
|
111
|
-
) : Validation<'left * 'right, 'error> =
|
|
112
|
-
Validation.zip left right
|
|
113
|
-
|
|
114
|
-
/// <summary>
|
|
115
|
-
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
116
|
-
///
|
|
117
|
-
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
118
|
-
/// </summary>
|
|
119
|
-
/// <param name="result"></param>
|
|
120
|
-
/// <returns></returns>
|
|
121
|
-
member inline _.Source(result: Validation<'ok, 'error>) : Validation<'ok, 'error> = result
|
|
122
|
-
|
|
123
|
-
let validation = ValidationBuilder()
|
|
124
|
-
|
|
125
|
-
[<AutoOpen>]
|
|
126
|
-
module ValidationCEExtensions =
|
|
127
|
-
|
|
128
|
-
// Having members as extensions gives them lower priority in
|
|
129
|
-
// overload resolution and allows skipping more type annotations.
|
|
130
|
-
type ValidationBuilder with
|
|
131
|
-
|
|
132
|
-
/// <summary>
|
|
133
|
-
/// Needed to allow `for..in` and `for..do` functionality
|
|
134
|
-
/// </summary>
|
|
135
|
-
member inline _.Source(s: #seq<_>) : #seq<_> = s
|
|
136
|
-
|
|
137
|
-
/// <summary>
|
|
138
|
-
/// Method lets us transform data types into our internal representation.
|
|
139
|
-
/// </summary>
|
|
140
|
-
member inline _.Source(s: Result<'ok, 'error>) : Validation<'ok, 'error> =
|
|
141
|
-
Validation.ofResult s
|
|
142
|
-
|
|
143
|
-
/// <summary>
|
|
144
|
-
/// Method lets us transform data types into our internal representation.
|
|
145
|
-
/// </summary>
|
|
146
|
-
/// <returns></returns>
|
|
147
|
-
member inline _.Source(choice: Choice<'ok, 'error>) : Validation<'ok, 'error> =
|
|
148
|
-
Validation.ofChoice choice
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
|
|
2
|
-
|
|
3
|
-
export class ValidationCE_ValidationBuilder {
|
|
4
|
-
constructor() {
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function ValidationCE_ValidationBuilder_$reflection() {
|
|
9
|
-
return class_type("FsToolkit.ErrorHandling.ValidationCE.ValidationBuilder", void 0, ValidationCE_ValidationBuilder);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function ValidationCE_ValidationBuilder_$ctor() {
|
|
13
|
-
return new ValidationCE_ValidationBuilder();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const ValidationCE_validation = ValidationCE_ValidationBuilder_$ctor();
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=ValidationCE.fs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["./ValidationCE.fs"],"names":["\u0060\u0060.ctor\u0060\u0060"],"mappings":";;;;;;;;;;;;;;;uCA0HqB,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
|