@glutinum/cli 0.13.0 → 0.14.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/README.md +19 -1
- package/dist/Glutinum.Converter/Abbreviations.js +246 -0
- package/dist/Glutinum.Converter/FsharpAST.js +87 -28
- package/dist/Glutinum.Converter/Generate.js +55 -8
- package/dist/Glutinum.Converter/GlueAST.js +333 -34
- 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 +323 -186
- 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 -9
- 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 +1524 -253
- 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 +8292 -1119
- 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 +61 -12
- package/dist/Glutinum.Converter/Utils/String.js +7 -3
- package/dist/Program.js +230 -72
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/AsyncIterable.fs.js +29 -29
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs +842 -766
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs.js +26 -12
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs +31 -31
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs.js +5 -5
- 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.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs +89 -9
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs.js +13 -12
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOption.fs +50 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs +30 -39
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResult.fs +52 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs +26 -42
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOption.fs +17 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs +31 -33
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidation.fs +1 -6
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs +10 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs +68 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs.js +47 -41
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Option.fs +133 -2
- 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.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/OptionOp.fs +3 -3
- 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.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs +87 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs.js +8 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs +8 -23
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs.js +5 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs +1 -1
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs +7 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs.js +3 -3
- 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.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Validation.fs +0 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs +7 -13
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValueOption.fs +1 -4
- 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.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +3 -3
- 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.4.16.0/obj/Release/netstandard2.1 → FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0}/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- 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.4.14.0 → fable-library-js.5.17.2}/Array.js +192 -86
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Async.js +58 -53
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/AsyncBuilder.js +29 -8
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BigInt.js +71 -46
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Boolean.js +4 -3
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Char.js +64 -31
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Choice.js +2 -2
- 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.4.14.0 → fable-library-js.5.17.2}/Date.js +197 -112
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOffset.js +46 -62
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOnly.js +6 -6
- 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.4.14.0 → fable-library-js.5.17.2}/Decimal.js +39 -13
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Double.js +10 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Encoding.js +20 -8
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Event.js +10 -1
- 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.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.4.14.0 → fable-library-js.5.17.2}/Guid.js +33 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Int32.js +17 -17
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/List.js +170 -106
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MailboxProcessor.js +13 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Map.js +65 -61
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MapUtil.js +22 -4
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableMap.js +28 -16
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableSet.js +7 -7
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Numeric.js +44 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Option.js +11 -20
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Random.js +22 -20
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Range.js +12 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Reflection.js +50 -22
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/RegExp.js +68 -30
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Result.js +6 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq.js +229 -104
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq2.js +1 -1
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Set.js +153 -113
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/String.js +238 -50
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Collections.Generic.js +30 -14
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Text.js +69 -31
- 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.4.14.0 → fable-library-js.5.17.2}/TimeOnly.js +6 -6
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeSpan.js +18 -15
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Types.js +14 -24
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Uri.js +44 -21
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Util.js +49 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/lib/big.js +14 -11
- 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 +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.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.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
- 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.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
- 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.js.map +0 -1
- 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/Result.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
- 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.js.map +0 -1
- 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/ValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
- 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/Async.d.ts +0 -32
- 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/BigInt.d.ts +0 -115
- 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/Boolean.d.ts +0 -3
- 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/Choice.d.ts +0 -121
- 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/DateOffset.d.ts +0 -63
- 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/Decimal.d.ts +0 -45
- 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/Encoding.d.ts +0 -12
- 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/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.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/Int32.d.ts +0 -28
- 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/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/Map.d.ts +0 -178
- 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/MutableMap.d.ts +0 -52
- 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/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/Observable.d.ts +0 -32
- 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/Random.d.ts +0 -37
- 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/Reflection.d.ts +0 -119
- 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/Result.d.ts +0 -37
- 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/Seq2.d.ts +0 -18
- 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/String.d.ts +0 -50
- 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.Text.d.ts +0 -38
- 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/TimeSpan.d.ts +0 -34
- 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/Types.d.ts +0 -58
- 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/Uri.d.ts +0 -29
- 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/lib/big.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
- package/dist/fable_modules/project_cracked.json +0 -1
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/big.d.ts +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
open System.Threading.Tasks
|
|
5
|
+
|
|
6
|
+
[<AutoOpen>]
|
|
7
|
+
module ParallelAsyncResultCE =
|
|
8
|
+
|
|
9
|
+
type ParallelAsyncResultBuilder() =
|
|
10
|
+
|
|
11
|
+
member inline _.Return(value: 'ok) : Async<Result<'ok, 'error>> =
|
|
12
|
+
result.Return value
|
|
13
|
+
|> async.Return
|
|
14
|
+
|
|
15
|
+
member inline _.ReturnFrom(input: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
|
|
16
|
+
input
|
|
17
|
+
|
|
18
|
+
member inline _.Zero() : Async<Result<unit, 'error>> =
|
|
19
|
+
result.Zero()
|
|
20
|
+
|> async.Return
|
|
21
|
+
|
|
22
|
+
member inline _.Bind
|
|
23
|
+
(
|
|
24
|
+
asyncResult: Async<Result<'okInput, 'error>>,
|
|
25
|
+
[<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput, 'error>>
|
|
26
|
+
) : Async<Result<'okOutput, 'error>> =
|
|
27
|
+
AsyncResult.bind binder asyncResult
|
|
28
|
+
|
|
29
|
+
member inline _.Delay
|
|
30
|
+
([<InlineIfLambda>] generator: unit -> Async<Result<'ok, 'error>>)
|
|
31
|
+
: Async<Result<'ok, 'error>> =
|
|
32
|
+
async.Delay generator
|
|
33
|
+
|
|
34
|
+
member inline this.Combine
|
|
35
|
+
(computation1: Async<Result<unit, 'error>>, computation2: Async<Result<'ok, 'error>>)
|
|
36
|
+
: Async<Result<'ok, 'error>> =
|
|
37
|
+
this.Bind(computation1, (fun () -> computation2))
|
|
38
|
+
|
|
39
|
+
member inline _.TryWith
|
|
40
|
+
(
|
|
41
|
+
computation: Async<Result<'ok, 'error>>,
|
|
42
|
+
[<InlineIfLambda>] handler: System.Exception -> Async<Result<'ok, 'error>>
|
|
43
|
+
) : Async<Result<'ok, 'error>> =
|
|
44
|
+
async.TryWith(computation, handler)
|
|
45
|
+
|
|
46
|
+
member inline _.TryFinally
|
|
47
|
+
(computation: Async<Result<'ok, 'error>>, [<InlineIfLambda>] compensation: unit -> unit)
|
|
48
|
+
: Async<Result<'ok, 'error>> =
|
|
49
|
+
async.TryFinally(computation, compensation)
|
|
50
|
+
#if !FABLE_COMPILER
|
|
51
|
+
member inline _.TryFinallyAsync
|
|
52
|
+
(
|
|
53
|
+
computation: Async<Result<'ok, 'error>>,
|
|
54
|
+
[<InlineIfLambda>] compensation: unit -> ValueTask
|
|
55
|
+
) : Async<Result<'ok, 'error>> =
|
|
56
|
+
let compensation =
|
|
57
|
+
async {
|
|
58
|
+
let vTask = compensation ()
|
|
59
|
+
|
|
60
|
+
if vTask.IsCompletedSuccessfully then
|
|
61
|
+
return ()
|
|
62
|
+
else
|
|
63
|
+
return!
|
|
64
|
+
vTask.AsTask()
|
|
65
|
+
|> Async.AwaitTask
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Async.TryFinallyAsync(computation, compensation)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
member inline this.Using
|
|
72
|
+
(
|
|
73
|
+
resource: 'ok :> IAsyncDisposable,
|
|
74
|
+
[<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
|
|
75
|
+
) : Async<Result<'U, 'error>> =
|
|
76
|
+
this.TryFinallyAsync(
|
|
77
|
+
binder resource,
|
|
78
|
+
(fun () ->
|
|
79
|
+
if not (isNull (box resource)) then
|
|
80
|
+
resource.DisposeAsync()
|
|
81
|
+
else
|
|
82
|
+
ValueTask()
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
#endif
|
|
86
|
+
member inline this.While
|
|
87
|
+
([<InlineIfLambda>] guard: unit -> bool, computation: Async<Result<unit, 'error>>)
|
|
88
|
+
: Async<Result<unit, 'error>> =
|
|
89
|
+
if guard () then
|
|
90
|
+
let mutable whileAsync = Unchecked.defaultof<_>
|
|
91
|
+
|
|
92
|
+
whileAsync <-
|
|
93
|
+
this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
|
|
94
|
+
|
|
95
|
+
whileAsync
|
|
96
|
+
else
|
|
97
|
+
this.Zero()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
member inline _.BindReturn
|
|
101
|
+
(x: Async<Result<'okInput, 'error>>, [<InlineIfLambda>] f: 'okInput -> 'okOutput)
|
|
102
|
+
: Async<Result<'okOutput, 'error>> =
|
|
103
|
+
AsyncResult.map f x
|
|
104
|
+
|
|
105
|
+
/// <summary>
|
|
106
|
+
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
107
|
+
///
|
|
108
|
+
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
109
|
+
/// </summary>
|
|
110
|
+
member inline _.Source(result: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
|
|
111
|
+
result
|
|
112
|
+
|
|
113
|
+
member inline _.MergeSources(input1, input2) : Async<Result<'a * 'b, 'error>> =
|
|
114
|
+
ParallelAsyncResult.zip input1 input2
|
|
115
|
+
|
|
116
|
+
let parallelAsyncResult = ParallelAsyncResultBuilder()
|
|
117
|
+
|
|
118
|
+
[<AutoOpen>]
|
|
119
|
+
module MediumPriority =
|
|
120
|
+
|
|
121
|
+
type ParallelAsyncResultBuilder with
|
|
122
|
+
|
|
123
|
+
/// <summary>
|
|
124
|
+
/// Needed to allow `for..in` and `for..do` functionality
|
|
125
|
+
/// </summary>
|
|
126
|
+
member inline _.Source(s: #seq<'value>) : #seq<'value> = s
|
|
127
|
+
|
|
128
|
+
/// <summary>
|
|
129
|
+
/// Method lets us transform data types into our internal representation.
|
|
130
|
+
/// </summary>
|
|
131
|
+
member inline _.Source(result: Result<'ok, 'error>) : Async<Result<'ok, 'error>> =
|
|
132
|
+
Async.singleton result
|
|
133
|
+
|
|
134
|
+
/// <summary>
|
|
135
|
+
/// Method lets us transform data types into our internal representation.
|
|
136
|
+
/// </summary>
|
|
137
|
+
member inline _.Source(choice: Choice<'ok, 'error>) : Async<Result<'ok, 'error>> =
|
|
138
|
+
choice
|
|
139
|
+
|> Result.ofChoice
|
|
140
|
+
|> Async.singleton
|
|
141
|
+
|
|
142
|
+
/// <summary>
|
|
143
|
+
/// Method lets us transform data types into our internal representation.
|
|
144
|
+
/// </summary>
|
|
145
|
+
member inline _.Source(asyncComputation: Async<'ok>) : Async<Result<'ok, 'error>> =
|
|
146
|
+
asyncComputation
|
|
147
|
+
|> Async.map Ok
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
member inline _.Using
|
|
151
|
+
(
|
|
152
|
+
resource: 'ok :> IDisposableNull,
|
|
153
|
+
[<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
|
|
154
|
+
) : Async<Result<'U, 'error>> =
|
|
155
|
+
async.Using(resource, binder)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
member inline this.For
|
|
159
|
+
(sequence: #seq<'ok>, [<InlineIfLambda>] binder: 'ok -> Async<Result<unit, 'error>>)
|
|
160
|
+
: Async<Result<unit, 'error>> =
|
|
161
|
+
this.Using(
|
|
162
|
+
sequence.GetEnumerator(),
|
|
163
|
+
fun enum ->
|
|
164
|
+
this.While(
|
|
165
|
+
(fun () -> enum.MoveNext()),
|
|
166
|
+
this.Delay(fun () -> binder enum.Current)
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
#if !FABLE_COMPILER
|
|
171
|
+
/// <summary>
|
|
172
|
+
/// Method lets us transform data types into our internal representation.
|
|
173
|
+
/// </summary>
|
|
174
|
+
member inline _.Source(task: Task<'ok>) : Async<Result<'ok, 'error>> =
|
|
175
|
+
task
|
|
176
|
+
|> Async.AwaitTask
|
|
177
|
+
|> Async.map Ok
|
|
178
|
+
|
|
179
|
+
/// <summary>
|
|
180
|
+
/// Method lets us transform data types into our internal representation.
|
|
181
|
+
/// </summary>
|
|
182
|
+
member inline _.Source(task: Task) : Async<Result<unit, 'error>> =
|
|
183
|
+
task
|
|
184
|
+
|> Async.AwaitTask
|
|
185
|
+
|> Async.map Ok
|
|
186
|
+
#endif
|
|
187
|
+
|
|
188
|
+
#if !FABLE_COMPILER
|
|
189
|
+
[<AutoOpen>]
|
|
190
|
+
module HighPriority =
|
|
191
|
+
|
|
192
|
+
type ParallelAsyncResultBuilder with
|
|
193
|
+
|
|
194
|
+
/// <summary>
|
|
195
|
+
/// Method lets us transform data types into our internal representation.
|
|
196
|
+
/// </summary>
|
|
197
|
+
member inline _.Source(task: Task<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
|
|
198
|
+
task
|
|
199
|
+
|> Async.AwaitTask
|
|
200
|
+
#endif
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
3
|
+
|
|
4
|
+
export class ParallelAsyncResultBuilder {
|
|
5
|
+
constructor() {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ParallelAsyncResultBuilder_$reflection() {
|
|
10
|
+
return class_type("FsToolkit.ErrorHandling.ParallelAsyncResultCE.ParallelAsyncResultBuilder", undefined, ParallelAsyncResultBuilder);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ParallelAsyncResultBuilder_$ctor() {
|
|
14
|
+
return new ParallelAsyncResultBuilder();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const parallelAsyncResult = ParallelAsyncResultBuilder_$ctor();
|
|
18
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
[<RequireQualifiedAccess>]
|
|
4
|
+
module ParallelAsyncValidation =
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Execute two AsyncValidations concurrently and combines the results using the specified function.
|
|
8
|
+
/// Both are run to completion so that all errors are accumulated.
|
|
9
|
+
/// </summary>
|
|
10
|
+
/// <param name="mapper">The function to apply to the values of the AsyncValidation values.</param>
|
|
11
|
+
/// <param name="input1">The first AsyncValidation value to transform.</param>
|
|
12
|
+
/// <param name="input2">The second AsyncValidation value to transform.</param>
|
|
13
|
+
/// <returns>The transformed AsyncValidation value.</returns>
|
|
14
|
+
let inline map2
|
|
15
|
+
([<InlineIfLambda>] mapper: 'a -> 'b -> 'c)
|
|
16
|
+
(input1: AsyncValidation<'a, 'error>)
|
|
17
|
+
(input2: AsyncValidation<'b, 'error>)
|
|
18
|
+
: AsyncValidation<'c, 'error> =
|
|
19
|
+
Async.parallelMap2
|
|
20
|
+
(fun a b ->
|
|
21
|
+
match a, b with
|
|
22
|
+
| Ok a, Ok b -> Ok(mapper a b)
|
|
23
|
+
| Ok _, Error v -> Error v
|
|
24
|
+
| Error u, Ok _ -> Error u
|
|
25
|
+
| Error u, Error v -> Error(u @ v)
|
|
26
|
+
)
|
|
27
|
+
input1
|
|
28
|
+
input2
|
|
29
|
+
|
|
30
|
+
let inline zip
|
|
31
|
+
(a: AsyncValidation<'a, 'error>)
|
|
32
|
+
(b: AsyncValidation<'b, 'error>)
|
|
33
|
+
: AsyncValidation<'a * 'b, 'error> =
|
|
34
|
+
map2 (fun a b -> a, b) a b
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
|
|
5
|
+
[<AutoOpen>]
|
|
6
|
+
module ParallelAsyncValidationCE =
|
|
7
|
+
|
|
8
|
+
open System.Threading.Tasks
|
|
9
|
+
|
|
10
|
+
type ParallelAsyncValidationBuilder() =
|
|
11
|
+
member inline _.Return(value: 'ok) : AsyncValidation<'ok, 'error> = AsyncValidation.ok value
|
|
12
|
+
|
|
13
|
+
member inline _.ReturnFrom
|
|
14
|
+
(result: AsyncValidation<'ok, 'error>)
|
|
15
|
+
: AsyncValidation<'ok, 'error> =
|
|
16
|
+
result
|
|
17
|
+
|
|
18
|
+
member inline _.Bind
|
|
19
|
+
(
|
|
20
|
+
result: AsyncValidation<'okInput, 'error>,
|
|
21
|
+
[<InlineIfLambda>] binder: 'okInput -> AsyncValidation<'okOutput, 'error>
|
|
22
|
+
) : AsyncValidation<'okOutput, 'error> =
|
|
23
|
+
AsyncValidation.bind binder result
|
|
24
|
+
|
|
25
|
+
member inline this.Zero() : AsyncValidation<unit, 'error> = this.Return()
|
|
26
|
+
|
|
27
|
+
member inline _.Delay
|
|
28
|
+
([<InlineIfLambda>] generator: unit -> AsyncValidation<'ok, 'error>)
|
|
29
|
+
: AsyncValidation<'ok, 'error> =
|
|
30
|
+
async.Delay generator
|
|
31
|
+
|
|
32
|
+
member inline this.Combine
|
|
33
|
+
(validation1: AsyncValidation<unit, 'error>, validation2: AsyncValidation<'ok, 'error>)
|
|
34
|
+
: AsyncValidation<'ok, 'error> =
|
|
35
|
+
this.Bind(validation1, (fun () -> validation2))
|
|
36
|
+
|
|
37
|
+
member inline _.TryWith
|
|
38
|
+
(
|
|
39
|
+
computation: AsyncValidation<'ok, 'error>,
|
|
40
|
+
[<InlineIfLambda>] handler: exn -> AsyncValidation<'ok, 'error>
|
|
41
|
+
) : AsyncValidation<'ok, 'error> =
|
|
42
|
+
async.TryWith(computation, handler)
|
|
43
|
+
|
|
44
|
+
member inline _.TryFinally
|
|
45
|
+
(
|
|
46
|
+
computation: AsyncValidation<'ok, 'error>,
|
|
47
|
+
[<InlineIfLambda>] compensation: unit -> unit
|
|
48
|
+
) : AsyncValidation<'ok, 'error> =
|
|
49
|
+
async.TryFinally(computation, compensation)
|
|
50
|
+
|
|
51
|
+
member inline _.Using
|
|
52
|
+
(
|
|
53
|
+
resource: 'disposable :> IDisposableNull,
|
|
54
|
+
[<InlineIfLambda>] binder: 'disposable -> AsyncValidation<'okOutput, 'error>
|
|
55
|
+
) : AsyncValidation<'okOutput, 'error> =
|
|
56
|
+
async.Using(resource, binder)
|
|
57
|
+
|
|
58
|
+
member inline this.While
|
|
59
|
+
([<InlineIfLambda>] guard: unit -> bool, computation: AsyncValidation<unit, 'error>)
|
|
60
|
+
: AsyncValidation<unit, 'error> =
|
|
61
|
+
if guard () then
|
|
62
|
+
let mutable whileAsync = Unchecked.defaultof<_>
|
|
63
|
+
|
|
64
|
+
whileAsync <-
|
|
65
|
+
this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
|
|
66
|
+
|
|
67
|
+
whileAsync
|
|
68
|
+
else
|
|
69
|
+
this.Zero()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
member inline this.For
|
|
73
|
+
(sequence: #seq<'ok>, [<InlineIfLambda>] binder: 'ok -> AsyncValidation<unit, 'error>)
|
|
74
|
+
: AsyncValidation<unit, 'error> =
|
|
75
|
+
this.Using(
|
|
76
|
+
sequence.GetEnumerator(),
|
|
77
|
+
fun enum -> this.While(enum.MoveNext, this.Delay(fun () -> binder enum.Current))
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
member inline _.BindReturn
|
|
81
|
+
(
|
|
82
|
+
input: AsyncValidation<'okInput, 'error>,
|
|
83
|
+
[<InlineIfLambda>] mapper: 'okInput -> 'okOutput
|
|
84
|
+
) : AsyncValidation<'okOutput, 'error> =
|
|
85
|
+
AsyncValidation.map mapper input
|
|
86
|
+
|
|
87
|
+
member inline _.MergeSources
|
|
88
|
+
(left: AsyncValidation<'left, 'error>, right: AsyncValidation<'right, 'error>)
|
|
89
|
+
: AsyncValidation<'left * 'right, 'error> =
|
|
90
|
+
ParallelAsyncValidation.zip left right
|
|
91
|
+
|
|
92
|
+
let parallelAsyncValidation = ParallelAsyncValidationBuilder()
|
|
93
|
+
|
|
94
|
+
[<AutoOpen>]
|
|
95
|
+
module LowPriority =
|
|
96
|
+
|
|
97
|
+
type ParallelAsyncValidationBuilder with
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// Method lets us transform data types into our internal representation.
|
|
101
|
+
/// </summary>
|
|
102
|
+
/// <returns></returns>
|
|
103
|
+
member inline _.Source(a: Async<'ok>) : AsyncValidation<'ok, 'error> =
|
|
104
|
+
async {
|
|
105
|
+
let! result = a
|
|
106
|
+
return! AsyncValidation.ok result
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
/// Method lets us transform data types into our internal representation.
|
|
111
|
+
/// </summary>
|
|
112
|
+
member inline _.Source(s: Result<'ok, 'error>) : AsyncValidation<'ok, 'error> =
|
|
113
|
+
AsyncValidation.ofResult s
|
|
114
|
+
|
|
115
|
+
/// <summary>
|
|
116
|
+
/// Method lets us transform data types into our internal representation.
|
|
117
|
+
/// </summary>
|
|
118
|
+
/// <returns></returns>
|
|
119
|
+
member inline _.Source(choice: Choice<'ok, 'error>) : AsyncValidation<'ok, 'error> =
|
|
120
|
+
AsyncValidation.ofChoice choice
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
/// Needed to allow `for..in` and `for..do` functionality
|
|
124
|
+
/// </summary>
|
|
125
|
+
member inline _.Source(s: #seq<_>) : #seq<_> = s
|
|
126
|
+
|
|
127
|
+
#if !FABLE_COMPILER
|
|
128
|
+
|
|
129
|
+
/// <summary>
|
|
130
|
+
/// Method lets us transform data types into our internal representation.
|
|
131
|
+
/// </summary>
|
|
132
|
+
member inline _.Source(s: Task<'ok>) : AsyncValidation<'ok, 'error> =
|
|
133
|
+
Async.AwaitTask s
|
|
134
|
+
|> Async.map Result.Ok
|
|
135
|
+
|
|
136
|
+
/// <summary>
|
|
137
|
+
/// Method lets us transform data types into our internal representation.
|
|
138
|
+
/// </summary>
|
|
139
|
+
member inline _.Source(s: Task) : AsyncValidation<unit, 'error> =
|
|
140
|
+
Async.AwaitTask s
|
|
141
|
+
|> Async.map Result.Ok
|
|
142
|
+
|
|
143
|
+
member inline _.TryFinallyAsync
|
|
144
|
+
(
|
|
145
|
+
computation: Async<Result<'ok, 'error>>,
|
|
146
|
+
[<InlineIfLambda>] compensation: unit -> ValueTask
|
|
147
|
+
) : Async<Result<'ok, 'error>> =
|
|
148
|
+
let compensation =
|
|
149
|
+
async {
|
|
150
|
+
let vTask = compensation ()
|
|
151
|
+
|
|
152
|
+
if vTask.IsCompletedSuccessfully then
|
|
153
|
+
return ()
|
|
154
|
+
else
|
|
155
|
+
return!
|
|
156
|
+
vTask.AsTask()
|
|
157
|
+
|> Async.AwaitTask
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
Async.TryFinallyAsync(computation, compensation)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
member inline this.Using
|
|
164
|
+
(
|
|
165
|
+
resource: 'ok :> IAsyncDisposable,
|
|
166
|
+
[<InlineIfLambda>] binder: 'ok -> AsyncValidation<'U, 'error>
|
|
167
|
+
) : AsyncValidation<'U, 'error> =
|
|
168
|
+
this.TryFinallyAsync(
|
|
169
|
+
binder resource,
|
|
170
|
+
(fun () ->
|
|
171
|
+
if not (isNull (box resource)) then
|
|
172
|
+
resource.DisposeAsync()
|
|
173
|
+
else
|
|
174
|
+
ValueTask()
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
#endif
|
|
179
|
+
|
|
180
|
+
[<AutoOpen>]
|
|
181
|
+
module MediumPriority =
|
|
182
|
+
|
|
183
|
+
type ParallelAsyncValidationBuilder with
|
|
184
|
+
|
|
185
|
+
/// <summary>
|
|
186
|
+
/// Method lets us transform data types into our internal representation.
|
|
187
|
+
/// </summary>
|
|
188
|
+
member inline _.Source(s: Async<Result<'ok, 'error>>) : AsyncValidation<'ok, 'error> =
|
|
189
|
+
AsyncResult.mapError List.singleton s
|
|
190
|
+
|
|
191
|
+
#if !FABLE_COMPILER
|
|
192
|
+
|
|
193
|
+
/// <summary>
|
|
194
|
+
/// Method lets us transform data types into our internal representation.
|
|
195
|
+
/// </summary>
|
|
196
|
+
member inline _.Source(s: Task<Result<'ok, 'error>>) : AsyncValidation<'ok, 'error> =
|
|
197
|
+
Async.AwaitTask s
|
|
198
|
+
|> AsyncResult.mapError List.singleton
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
#endif
|
|
202
|
+
|
|
203
|
+
[<AutoOpen>]
|
|
204
|
+
module HighPriority =
|
|
205
|
+
|
|
206
|
+
// Having members as extensions gives them lower priority in
|
|
207
|
+
// overload resolution and allows skipping more type annotations.
|
|
208
|
+
type ParallelAsyncValidationBuilder with
|
|
209
|
+
|
|
210
|
+
/// <summary>
|
|
211
|
+
/// Method lets us transform data types into our internal representation.
|
|
212
|
+
/// </summary>
|
|
213
|
+
member inline _.Source(s: Validation<'ok, 'error>) : AsyncValidation<'ok, 'error> =
|
|
214
|
+
Async.singleton s
|
|
215
|
+
|
|
216
|
+
#if !FABLE_COMPILER
|
|
217
|
+
|
|
218
|
+
/// <summary>
|
|
219
|
+
/// Method lets us transform data types into our internal representation.
|
|
220
|
+
/// </summary>
|
|
221
|
+
member inline _.Source
|
|
222
|
+
(result: Task<Validation<'ok, 'error>>)
|
|
223
|
+
: AsyncValidation<'ok, 'error> =
|
|
224
|
+
Async.AwaitTask result
|
|
225
|
+
|
|
226
|
+
#endif
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
[<AutoOpen>]
|
|
230
|
+
module UltraPriority =
|
|
231
|
+
|
|
232
|
+
type ParallelAsyncValidationBuilder with
|
|
233
|
+
|
|
234
|
+
/// <summary>
|
|
235
|
+
/// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
|
|
236
|
+
///
|
|
237
|
+
/// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
|
|
238
|
+
/// </summary>
|
|
239
|
+
/// <param name="result"></param>
|
|
240
|
+
/// <returns></returns>
|
|
241
|
+
member inline _.Source
|
|
242
|
+
(result: AsyncValidation<'ok, 'error>)
|
|
243
|
+
: AsyncValidation<'ok, 'error> =
|
|
244
|
+
result
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
3
|
+
|
|
4
|
+
export class ParallelAsyncValidationBuilder {
|
|
5
|
+
constructor() {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function ParallelAsyncValidationBuilder_$reflection() {
|
|
10
|
+
return class_type("FsToolkit.ErrorHandling.ParallelAsyncValidationCE.ParallelAsyncValidationBuilder", undefined, ParallelAsyncValidationBuilder);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ParallelAsyncValidationBuilder_$ctor() {
|
|
14
|
+
return new ParallelAsyncValidationBuilder();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const parallelAsyncValidation = ParallelAsyncValidationBuilder_$ctor();
|
|
18
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
namespace FsToolkit.ErrorHandling
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
/// <summary>
|
|
4
5
|
/// Helper functions for working with <c>Result</c> values.
|
|
5
6
|
/// </summary>
|
|
@@ -306,6 +307,20 @@ module Result =
|
|
|
306
307
|
| Some x -> Ok x
|
|
307
308
|
| None -> Error error
|
|
308
309
|
|
|
310
|
+
/// <summary>
|
|
311
|
+
/// Requires a value to be <c>Some</c>, otherwise returns an error result using the given error factory.
|
|
312
|
+
/// </summary>
|
|
313
|
+
/// <param name="errorFactory">A function to produce the error value if the value is <c>None</c>.</param>
|
|
314
|
+
/// <param name="option">The <c>Option</c> value to check.</param>
|
|
315
|
+
/// <returns>An <c>Ok</c> result if the value is <c>Some</c>, otherwise an Error result with the value produced by <paramref name="errorFactory" />.</returns>
|
|
316
|
+
let inline requireSomeWith
|
|
317
|
+
([<InlineIfLambda>] errorFactory: unit -> 'error)
|
|
318
|
+
(option: 'ok option)
|
|
319
|
+
: Result<'ok, 'error> =
|
|
320
|
+
match option with
|
|
321
|
+
| Some x -> Ok x
|
|
322
|
+
| None -> Error(errorFactory ())
|
|
323
|
+
|
|
309
324
|
/// <summary>
|
|
310
325
|
/// Requires a value to be <c>None</c>, otherwise returns an error result.
|
|
311
326
|
///
|
|
@@ -319,6 +334,20 @@ module Result =
|
|
|
319
334
|
| Some _ -> Error error
|
|
320
335
|
| None -> Ok()
|
|
321
336
|
|
|
337
|
+
/// <summary>
|
|
338
|
+
/// Requires a value to be <c>None</c>, otherwise returns an error result using the given error factory.
|
|
339
|
+
/// </summary>
|
|
340
|
+
/// <param name="errorFactory">A function to produce the error value if the value is <c>Some</c>.</param>
|
|
341
|
+
/// <param name="option">The <c>Option</c> value to check.</param>
|
|
342
|
+
/// <returns>An <c>Ok</c> result if the value is <c>None</c>, otherwise an Error result with the value produced by <paramref name="errorFactory" />.</returns>
|
|
343
|
+
let inline requireNoneWith
|
|
344
|
+
([<InlineIfLambda>] errorFactory: unit -> 'error)
|
|
345
|
+
(option: 'value option)
|
|
346
|
+
: Result<unit, 'error> =
|
|
347
|
+
match option with
|
|
348
|
+
| Some _ -> Error(errorFactory ())
|
|
349
|
+
| None -> Ok()
|
|
350
|
+
|
|
322
351
|
/// <summary>
|
|
323
352
|
/// Requires a value to be <c>ValueSome</c>, otherwise returns an error result.
|
|
324
353
|
///
|
|
@@ -423,6 +452,28 @@ module Result =
|
|
|
423
452
|
| Some x -> Ok x
|
|
424
453
|
| None -> Error error
|
|
425
454
|
|
|
455
|
+
/// <summary>
|
|
456
|
+
/// If the input result is <c>Ok</c>, applies a predicate to the <c>Ok</c> value.
|
|
457
|
+
/// If the predicate returns true, then returns the original <c>Ok</c> Result.
|
|
458
|
+
/// Otherwise, returns a new <c>Error</c> result with the provided error.
|
|
459
|
+
///
|
|
460
|
+
/// If the input result is <c>Error</c>, just returns the input result.
|
|
461
|
+
///
|
|
462
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/result/requirefunctions#require</href>
|
|
463
|
+
/// </summary>
|
|
464
|
+
/// <param name="predicate">Predicate applied to the <c>Ok</c> value of the result. </param>
|
|
465
|
+
/// <param name="error">The error to return if the predicate returns false.</param>
|
|
466
|
+
/// <param name="result">The input result.</param>
|
|
467
|
+
/// <returns> The input <paramref name="result"/> if it is <c>Error</c> or if the provided <paramref name="predicate"/> returns true. Otherwise returns a new <c>Error</c> result with the value <paramref name="error"/>.</returns>
|
|
468
|
+
let inline require
|
|
469
|
+
([<InlineIfLambda>] predicate: 'ok -> bool)
|
|
470
|
+
(error: 'error)
|
|
471
|
+
(result: Result<'ok, 'error>)
|
|
472
|
+
: Result<'ok, 'error> =
|
|
473
|
+
match result with
|
|
474
|
+
| Error err -> Error err
|
|
475
|
+
| Ok ok -> if predicate ok then Ok ok else Error(error)
|
|
476
|
+
|
|
426
477
|
/// <summary>
|
|
427
478
|
/// Replaces an error value with a custom error value.
|
|
428
479
|
///
|
|
@@ -595,6 +646,19 @@ module Result =
|
|
|
595
646
|
: Async<Result<'okOutput, 'error>> =
|
|
596
647
|
sequenceAsync ((map f) res)
|
|
597
648
|
|
|
649
|
+
#if !FABLE_COMPILER
|
|
650
|
+
open System.Threading.Tasks
|
|
651
|
+
|
|
652
|
+
/// Converts a Result<Async<_>,_> to an Async<Result<_,_>>
|
|
653
|
+
let sequenceTask (resTask: Result<Task<'a>, 'b>) : Task<Result<'a, 'b>> =
|
|
654
|
+
task {
|
|
655
|
+
match resTask with
|
|
656
|
+
| Ok task ->
|
|
657
|
+
let! x = task
|
|
658
|
+
return Ok x
|
|
659
|
+
| Error err -> return Error err
|
|
660
|
+
}
|
|
661
|
+
#endif
|
|
598
662
|
|
|
599
663
|
/// <summary>
|
|
600
664
|
/// Returns the <c>Ok</c> value or runs the specified function over the error value.
|
|
@@ -642,3 +706,26 @@ module Result =
|
|
|
642
706
|
| Error x1res, Error x2res -> Error(x1res, x2res)
|
|
643
707
|
| Ok e, _ -> Ok e
|
|
644
708
|
| _, Ok e -> Ok e
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
/// <summary>
|
|
712
|
+
/// When <paramref name="result"/> is <c>Ok</c>, applies <paramref name="checkFunc"/> to the <c>Ok</c> value.
|
|
713
|
+
/// If <paramref name="checkFunc"/> returns an <c>Ok</c> unit value, returns <paramref name="result"/>.
|
|
714
|
+
/// Otherwise, returns the <c>Error</c> value from the <paramref name="checkFunc"/> as a new result.
|
|
715
|
+
///
|
|
716
|
+
/// When <paramref name="result"/> is <c>Error</c>, returns <paramref name="result"/>.
|
|
717
|
+
///
|
|
718
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/result/check</href>
|
|
719
|
+
/// </summary>
|
|
720
|
+
/// <param name="checkFunc">The function that performs a check against the <c>Ok</c> value of <paramref name="result"/>. Returns <c>Error</c> value from the function if error.</param>
|
|
721
|
+
/// <param name="result">The input result.</param>
|
|
722
|
+
/// <returns>The input <paramref name="result"/> if <c>Error</c> or <paramref name="checkFunc"/> returns a <c>Ok</c> result. Returns the <c>Error</c> value from <paramref name="checkFunc"/> if it returns an <c>Error</c> result.</returns>
|
|
723
|
+
let inline check
|
|
724
|
+
([<InlineIfLambda>] checkFunc: 'ok -> Result<unit, 'error>)
|
|
725
|
+
(result: Result<'ok, 'error>)
|
|
726
|
+
: Result<'ok, 'error> =
|
|
727
|
+
match result with
|
|
728
|
+
| Error err -> Error err
|
|
729
|
+
| Ok ok ->
|
|
730
|
+
checkFunc ok
|
|
731
|
+
|> Result.map (fun _ -> ok)
|