@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,81 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
(*
|
|
4
|
+
This Polyfills the F# 9.0 and later types for nullability, which are not available in earlier versions of F# or in Fable.
|
|
5
|
+
This is useful for keeping compatibility with older versions of F# or when using Fable, which does not support the new nullability features.
|
|
6
|
+
*)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
open System
|
|
10
|
+
|
|
11
|
+
/// Represents errors that occur during application execution. In F# 9.0 and later, this type is marked as nullable.
|
|
12
|
+
type ExceptionNull =
|
|
13
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
14
|
+
Exception | null
|
|
15
|
+
#else
|
|
16
|
+
Exception
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
/// Provides a mechanism for releasing unmanaged resources. In F# 9.0 and later, this type is marked as nullable.
|
|
20
|
+
type IDisposableNull =
|
|
21
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
22
|
+
IDisposable | null
|
|
23
|
+
#else
|
|
24
|
+
IDisposable
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/// Provides a mechanism for releasing unmanaged resources asynchronously. In F# 9.0 and later, this type is marked as nullable.
|
|
28
|
+
type IAsyncDisposableNull =
|
|
29
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
30
|
+
IAsyncDisposable | null
|
|
31
|
+
#else
|
|
32
|
+
IAsyncDisposable
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
/// An abbreviation for the CLI type System.Object. In F# 9.0 and later, this type is marked as nullable.
|
|
36
|
+
type ObjNull =
|
|
37
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
38
|
+
objnull
|
|
39
|
+
#else
|
|
40
|
+
obj
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/// An abbreviation for the CLI type System.Collections.Generic.IEnumerable. In F# 9.0 and later, this type is marked as nullable.
|
|
45
|
+
type SeqNull<'T> =
|
|
46
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
47
|
+
seq<'T> | null
|
|
48
|
+
#else
|
|
49
|
+
seq<'T>
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
/// An abbreviation for the CLI type System.String. In F# 9.0 and later, this type is marked as nullable.
|
|
53
|
+
type StringNull =
|
|
54
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
55
|
+
string | null
|
|
56
|
+
#else
|
|
57
|
+
string
|
|
58
|
+
#endif
|
|
59
|
+
|
|
60
|
+
/// An abbreviation for the CLI type System.Collections.Generic.List`1 . In F# 9.0 and later, this type is marked as nullable.
|
|
61
|
+
type ResizeArrayNull<'T> =
|
|
62
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
63
|
+
ResizeArray<'T> | null
|
|
64
|
+
#else
|
|
65
|
+
ResizeArray<'T>
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
module internal Nullness =
|
|
70
|
+
|
|
71
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
72
|
+
/// Throw a System.ArgumentNullException if the given value is null exception
|
|
73
|
+
let inline nullArgCheck name value = nullArgCheck name value
|
|
74
|
+
#else
|
|
75
|
+
/// Throw a System.ArgumentNullException if the given value is null exception
|
|
76
|
+
let inline nullArgCheck (name: string) (value: 'T) : 'T =
|
|
77
|
+
if isNull value then
|
|
78
|
+
raise (ArgumentNullException(name))
|
|
79
|
+
else
|
|
80
|
+
value
|
|
81
|
+
#endif
|
|
@@ -83,7 +83,7 @@ module Option =
|
|
|
83
83
|
/// </summary>
|
|
84
84
|
/// <param name="opt">The option to ignore.</param>
|
|
85
85
|
/// <returns>A unit option.</returns>
|
|
86
|
-
let inline ignore (opt: 'T option) : unit option =
|
|
86
|
+
let inline ignore<'T> (opt: 'T option) : unit option =
|
|
87
87
|
match opt with
|
|
88
88
|
| Some _ -> Some()
|
|
89
89
|
| None -> None
|
|
@@ -128,6 +128,11 @@ module Option =
|
|
|
128
128
|
binder v
|
|
129
129
|
|> Result.map Some
|
|
130
130
|
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// Flips around the option and result structures of an option that contains a result.
|
|
133
|
+
/// </summary>
|
|
134
|
+
/// <param name="opt">The option containing a result.</param>
|
|
135
|
+
/// <returns>A result containing an option.</returns>
|
|
131
136
|
let inline sequenceResult (opt: Result<'ok, 'error> option) : Result<'ok option, 'error> =
|
|
132
137
|
traverseResult id opt
|
|
133
138
|
|
|
@@ -235,7 +240,7 @@ module Option =
|
|
|
235
240
|
/// <seealso cref="ofNull"/>
|
|
236
241
|
let inline bindNull
|
|
237
242
|
([<InlineIfLambda>] binder: 'value -> 'nullableValue)
|
|
238
|
-
(option:
|
|
243
|
+
(option: 'value option)
|
|
239
244
|
: 'nullableValue option =
|
|
240
245
|
match option with
|
|
241
246
|
| Some x ->
|
|
@@ -316,6 +321,132 @@ module Option =
|
|
|
316
321
|
|
|
317
322
|
opt
|
|
318
323
|
|
|
324
|
+
#if !FABLE_COMPILER
|
|
325
|
+
open System.Threading.Tasks
|
|
326
|
+
|
|
327
|
+
/// <summary>
|
|
328
|
+
/// Converts an <c>Option<Task<_>></c> to an <c>Task<Option<_>></c><br />
|
|
329
|
+
///
|
|
330
|
+
/// Documentation is found here: <see href="https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/sequencetask" />
|
|
331
|
+
/// </summary>
|
|
332
|
+
let inline sequenceTask (optTask: Task<'T> option) : Task<'T option> =
|
|
333
|
+
task {
|
|
334
|
+
match optTask with
|
|
335
|
+
| Some tsk ->
|
|
336
|
+
let! x = tsk
|
|
337
|
+
return Some x
|
|
338
|
+
| None -> return None
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/// <summary>
|
|
342
|
+
/// Maps a <c>Task</c> function over an <c>option</c>, returning a <c>Task<'U option></c><br/>
|
|
343
|
+
///
|
|
344
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/traversetask</href>
|
|
345
|
+
/// </summary>
|
|
346
|
+
/// <param name="f">The function to map over the <c>option</c>.</param>
|
|
347
|
+
/// <param name="opt">The <c>option</c> to map over.</param>
|
|
348
|
+
/// <returns>A <c>Task<'U option></c> with the mapped value.</returns>
|
|
349
|
+
let inline traverseTask
|
|
350
|
+
([<InlineIfLambda>] f: 'T -> Task<'U>)
|
|
351
|
+
(opt: 'T option)
|
|
352
|
+
: Task<'U option> =
|
|
353
|
+
sequenceTask ((map f) opt)
|
|
354
|
+
|
|
355
|
+
/// <summary>
|
|
356
|
+
/// Converts an <c>Task<Result<'ok,'error>> option</c> to an <c>Task<Result<'ok option,'error>></c><br />
|
|
357
|
+
///
|
|
358
|
+
/// Documentation is found here: <see href="https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/sequencetaskresult" />
|
|
359
|
+
/// </summary>
|
|
360
|
+
let inline sequenceTaskResult
|
|
361
|
+
(optTaskResult: Task<Result<'T, 'E>> option)
|
|
362
|
+
: Task<Result<'T option, 'E>> =
|
|
363
|
+
task {
|
|
364
|
+
match optTaskResult with
|
|
365
|
+
| Some taskRes ->
|
|
366
|
+
let! xRes = taskRes
|
|
367
|
+
|
|
368
|
+
return
|
|
369
|
+
xRes
|
|
370
|
+
|> Result.map Some
|
|
371
|
+
| None -> return Ok None
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/// <summary>
|
|
375
|
+
/// Maps a <c>TaskResult</c> function over an <c>option</c>, returning a <c>Task<Result<'U option, 'E>></c>.<br />
|
|
376
|
+
///
|
|
377
|
+
/// Documentation is found here: <see href="https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/traversetaskresult" />
|
|
378
|
+
/// </summary>
|
|
379
|
+
/// <param name="f">The function to map over the <c>option</c>.</param>
|
|
380
|
+
/// <param name="opt">The <c>option</c> to map over.</param>
|
|
381
|
+
/// <returns>A <c>Task<Result<'U option, 'E>></c> with the mapped value.</returns>
|
|
382
|
+
let inline traverseTaskResult
|
|
383
|
+
([<InlineIfLambda>] f: 'T -> Task<Result<'U, 'E>>)
|
|
384
|
+
(opt: 'T option)
|
|
385
|
+
: Task<Result<'U option, 'E>> =
|
|
386
|
+
sequenceTaskResult ((map f) opt)
|
|
387
|
+
#endif
|
|
388
|
+
|
|
389
|
+
/// <summary>
|
|
390
|
+
/// Converts a Async<'T> option to an Async<'T option>
|
|
391
|
+
///
|
|
392
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/sequenceasync</href>
|
|
393
|
+
/// </summary>
|
|
394
|
+
let inline sequenceAsync (optAsync: Async<'T> option) : Async<'T option> =
|
|
395
|
+
async {
|
|
396
|
+
match optAsync with
|
|
397
|
+
| Some asnc ->
|
|
398
|
+
let! x = asnc
|
|
399
|
+
return Some x
|
|
400
|
+
| None -> return None
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/// <summary>
|
|
404
|
+
/// Maps an Async function over an Option, returning an Async Option.
|
|
405
|
+
///
|
|
406
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/traverseasync</href>
|
|
407
|
+
/// </summary>
|
|
408
|
+
/// <param name="f">The function to map over the Option.</param>
|
|
409
|
+
/// <param name="opt">The Option to map over.</param>
|
|
410
|
+
/// <returns>An <c>Async<'U option></c> with the mapped value.</returns>
|
|
411
|
+
let inline traverseAsync
|
|
412
|
+
([<InlineIfLambda>] f: 'T -> Async<'U>)
|
|
413
|
+
(opt: 'T option)
|
|
414
|
+
: Async<'U option> =
|
|
415
|
+
sequenceAsync ((map f) opt)
|
|
416
|
+
|
|
417
|
+
/// <summary>
|
|
418
|
+
/// Converts a Async<Result<'ok,'error>> option to an Async<Result<'ok option,'error>>
|
|
419
|
+
///
|
|
420
|
+
/// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/sequenceasyncresult</href>
|
|
421
|
+
/// </summary>
|
|
422
|
+
let inline sequenceAsyncResult
|
|
423
|
+
(optAsyncResult: Async<Result<'T, 'E>> option)
|
|
424
|
+
: Async<Result<'T option, 'E>> =
|
|
425
|
+
async {
|
|
426
|
+
match optAsyncResult with
|
|
427
|
+
| Some asncRes ->
|
|
428
|
+
let! xRes = asncRes
|
|
429
|
+
|
|
430
|
+
return
|
|
431
|
+
xRes
|
|
432
|
+
|> Result.map Some
|
|
433
|
+
| None -> return Ok None
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/// <summary>
|
|
437
|
+
/// Maps an AsyncResult function over an option, returning an AsyncResult option.
|
|
438
|
+
///
|
|
439
|
+
/// /// Documentation is found here: <href>https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/option/traverseasyncresult</href>
|
|
440
|
+
/// </summary>
|
|
441
|
+
/// <param name="f">The function to map over the Option.</param>
|
|
442
|
+
/// <param name="opt">The Option to map over.</param>
|
|
443
|
+
/// <returns>An AsyncResult Option with the mapped value.</returns>
|
|
444
|
+
let inline traverseAsyncResult
|
|
445
|
+
([<InlineIfLambda>] f: 'T -> Async<Result<'U, 'E>>)
|
|
446
|
+
(opt: 'T option)
|
|
447
|
+
: Async<Result<'U option, 'E>> =
|
|
448
|
+
sequenceAsyncResult ((map f) opt)
|
|
449
|
+
|
|
319
450
|
/// <summary>
|
|
320
451
|
/// Creates an option from a boolean value and a value of type 'a.
|
|
321
452
|
/// If the boolean value is true, returns <c>Some</c> value.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
[<AutoOpen>]
|
|
4
|
+
module OptionCE =
|
|
5
|
+
open System
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type OptionBuilderBase() =
|
|
9
|
+
|
|
10
|
+
member inline _.Bind(x: 'b voption, [<InlineIfLambda>] f: 'b -> voption<'c>) : voption<'c> =
|
|
11
|
+
ValueOption.bind f x
|
|
12
|
+
|
|
13
|
+
member inline _.BindReturn(x: 'b voption, [<InlineIfLambda>] f: 'b -> 'c) : voption<'c> =
|
|
14
|
+
ValueOption.map f x
|
|
15
|
+
|
|
16
|
+
member inline _.Return(x: 'a) = ValueSome x
|
|
17
|
+
|
|
18
|
+
member inline _.ReturnFrom(x: 'a voption) = x
|
|
19
|
+
|
|
20
|
+
member inline _.Zero() = ValueSome()
|
|
21
|
+
|
|
22
|
+
member inline _.Delay([<InlineIfLambda>] f: unit -> voption<_>) = f
|
|
23
|
+
|
|
24
|
+
member inline _.Combine
|
|
25
|
+
(m: 'input voption, [<InlineIfLambda>] binder: 'input -> 'output voption)
|
|
26
|
+
: 'output voption =
|
|
27
|
+
ValueOption.bind binder m
|
|
28
|
+
|
|
29
|
+
member inline this.Combine(m1: unit voption, m2: 'output voption) : 'output voption =
|
|
30
|
+
this.Bind(m1, (fun () -> m2))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
member inline this.TryWith([<InlineIfLambda>] computation, handler) : 'value =
|
|
34
|
+
try
|
|
35
|
+
computation ()
|
|
36
|
+
with e ->
|
|
37
|
+
handler e
|
|
38
|
+
|
|
39
|
+
member inline this.TryFinally([<InlineIfLambda>] computation, compensation) =
|
|
40
|
+
try
|
|
41
|
+
computation ()
|
|
42
|
+
finally
|
|
43
|
+
compensation ()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
member inline this.Using
|
|
47
|
+
(
|
|
48
|
+
resource: 'disposable :> IDisposableNull,
|
|
49
|
+
[<InlineIfLambda>] binder: 'disposable -> 'value voption
|
|
50
|
+
) : 'value voption =
|
|
51
|
+
this.TryFinally(
|
|
52
|
+
(fun () -> binder resource),
|
|
53
|
+
(fun () ->
|
|
54
|
+
if not (obj.ReferenceEquals(resource, null)) then
|
|
55
|
+
resource.Dispose()
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
member inline this.While
|
|
60
|
+
(
|
|
61
|
+
[<InlineIfLambda>] guard: unit -> bool,
|
|
62
|
+
[<InlineIfLambda>] generator: unit -> unit voption
|
|
63
|
+
) : unit voption =
|
|
64
|
+
|
|
65
|
+
let mutable doContinue = true
|
|
66
|
+
let mutable result = ValueSome()
|
|
67
|
+
|
|
68
|
+
while doContinue
|
|
69
|
+
&& guard () do
|
|
70
|
+
match generator () with
|
|
71
|
+
| ValueSome() -> ()
|
|
72
|
+
| ValueNone ->
|
|
73
|
+
doContinue <- false
|
|
74
|
+
result <- ValueNone
|
|
75
|
+
|
|
76
|
+
result
|
|
77
|
+
|
|
78
|
+
member inline this.For
|
|
79
|
+
(sequence: #seq<'value> voption, [<InlineIfLambda>] binder: 'value -> unit voption)
|
|
80
|
+
: unit voption =
|
|
81
|
+
sequence
|
|
82
|
+
|> ValueOption.bind (fun sequence ->
|
|
83
|
+
this.Using(
|
|
84
|
+
sequence.GetEnumerator(),
|
|
85
|
+
fun enum ->
|
|
86
|
+
this.While(enum.MoveNext, this.Delay(fun () -> binder enum.Current))
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[<AutoOpen>]
|
|
92
|
+
module BuilderExtensions =
|
|
93
|
+
type OptionBuilderBase with
|
|
94
|
+
member inline _.Source(o) = ValueOption.ofObj o
|
|
95
|
+
member inline _.Source(o: Nullable<'a>) = ValueOption.ofNullable o
|
|
96
|
+
|
|
97
|
+
[<AutoOpen>]
|
|
98
|
+
module BuilderExtensions3 =
|
|
99
|
+
type OptionBuilderBase with
|
|
100
|
+
/// <summary>
|
|
101
|
+
/// Needed to allow `for..in` and `for..do` functionality
|
|
102
|
+
/// </summary>
|
|
103
|
+
// member inline _.Source(s: string) = ValueOption.ofObj s
|
|
104
|
+
#if NET9_0_OR_GREATER && !FABLE_COMPILER
|
|
105
|
+
member inline _.Source(s: #seq<'value> | null) = ValueOption.ofObj s
|
|
106
|
+
#else
|
|
107
|
+
member inline _.Source(s: #seq<'value>) = ValueOption.ofNull s
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
type OptionBuilder() =
|
|
111
|
+
|
|
112
|
+
inherit OptionBuilderBase()
|
|
113
|
+
|
|
114
|
+
member inline _.Source(o: 'a option) = Option.toValueOption o
|
|
115
|
+
|
|
116
|
+
member inline _.Run(f) =
|
|
117
|
+
match f () with
|
|
118
|
+
| ValueSome x -> Some x
|
|
119
|
+
| ValueNone -> None
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
type ValueOptionBuilder() =
|
|
123
|
+
|
|
124
|
+
inherit OptionBuilderBase()
|
|
125
|
+
|
|
126
|
+
member inline _.Source(o: 'a voption) = o
|
|
127
|
+
|
|
128
|
+
member inline _.Run(f) = f ()
|
|
129
|
+
|
|
130
|
+
[<AutoOpen>]
|
|
131
|
+
module OptionCEExtensions =
|
|
132
|
+
let option = OptionBuilder()
|
|
133
|
+
let voption = ValueOptionBuilder()
|
|
134
|
+
|
|
135
|
+
type ValueOptionBuilder with
|
|
136
|
+
member inline _.Source(o: 'a option) = Option.toValueOption o
|
|
137
|
+
|
|
138
|
+
type OptionBuilder with
|
|
139
|
+
member inline _.Source(o: 'a voption) = o
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
3
|
+
|
|
4
|
+
export class OptionBuilderBase {
|
|
5
|
+
constructor() {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function OptionBuilderBase_$reflection() {
|
|
10
|
+
return class_type("FsToolkit.ErrorHandling.OptionCE.OptionBuilderBase", undefined, OptionBuilderBase);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function OptionBuilderBase_$ctor() {
|
|
14
|
+
return new OptionBuilderBase();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class OptionBuilder extends OptionBuilderBase {
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function OptionBuilder_$reflection() {
|
|
24
|
+
return class_type("FsToolkit.ErrorHandling.OptionCE.OptionBuilder", undefined, OptionBuilder, OptionBuilderBase_$reflection());
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function OptionBuilder_$ctor() {
|
|
28
|
+
return new OptionBuilder();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class ValueOptionBuilder extends OptionBuilderBase {
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ValueOptionBuilder_$reflection() {
|
|
38
|
+
return class_type("FsToolkit.ErrorHandling.OptionCE.ValueOptionBuilder", undefined, ValueOptionBuilder, OptionBuilderBase_$reflection());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function ValueOptionBuilder_$ctor() {
|
|
42
|
+
return new ValueOptionBuilder();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const OptionCEExtensions_option = OptionBuilder_$ctor();
|
|
46
|
+
|
|
47
|
+
export const OptionCEExtensions_voption = ValueOptionBuilder_$ctor();
|
|
48
|
+
|
|
@@ -15,7 +15,7 @@ module Option =
|
|
|
15
15
|
/// <param name="binder">The function to bind over the <c>Option</c> value.</param>
|
|
16
16
|
/// <returns>The result of binding the function over the <c>Option</c> value.</returns>
|
|
17
17
|
let inline (>>=)
|
|
18
|
-
(input:
|
|
19
|
-
([<InlineIfLambda>] binder: 'input ->
|
|
20
|
-
:
|
|
18
|
+
(input: 'input option)
|
|
19
|
+
([<InlineIfLambda>] binder: 'input -> 'output option)
|
|
20
|
+
: 'output option =
|
|
21
21
|
Option.bind binder input
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
namespace FsToolkit.ErrorHandling
|
|
2
|
+
|
|
3
|
+
open System
|
|
4
|
+
|
|
5
|
+
[<RequireQualifiedAccess>]
|
|
6
|
+
module ParallelAsyncResult =
|
|
7
|
+
|
|
8
|
+
[<AutoOpen>]
|
|
9
|
+
module InternalHelpers =
|
|
10
|
+
|
|
11
|
+
type AsyncResultErrorException<'a>(value: 'a) =
|
|
12
|
+
inherit Exception()
|
|
13
|
+
member this.Value = value
|
|
14
|
+
|
|
15
|
+
let toBoxedAsync (input: Async<Result<'ok, 'error>>) : Async<ObjNull> =
|
|
16
|
+
async {
|
|
17
|
+
match! input with
|
|
18
|
+
| Ok x -> return box x
|
|
19
|
+
| Error e -> return raise (AsyncResultErrorException<'error>(e))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Transforms two AsyncResults in one that executes them concurrently and combines the results using the specified function.
|
|
24
|
+
/// If either AsyncResult resolves to an error, then the other is cancelled and only the first error is returned.
|
|
25
|
+
/// </summary>
|
|
26
|
+
/// <param name="mapper">The function to apply to the values of the AsyncResult values.</param>
|
|
27
|
+
/// <param name="input1">The first AsyncResult value to transform.</param>
|
|
28
|
+
/// <param name="input2">The second AsyncResult value to transform.</param>
|
|
29
|
+
/// <returns>The transformed AsyncResult value.</returns>
|
|
30
|
+
let inline map2
|
|
31
|
+
([<InlineIfLambda>] mapper: 'a -> 'b -> 'c)
|
|
32
|
+
(input1: Async<Result<'a, 'error>>)
|
|
33
|
+
(input2: Async<Result<'b, 'error>>)
|
|
34
|
+
: Async<Result<'c, 'error>> =
|
|
35
|
+
async {
|
|
36
|
+
try
|
|
37
|
+
return!
|
|
38
|
+
Async.parallelMap2
|
|
39
|
+
(fun a b ->
|
|
40
|
+
let a = unbox<'a> a
|
|
41
|
+
let b = unbox<'b> b
|
|
42
|
+
Ok(mapper a b)
|
|
43
|
+
)
|
|
44
|
+
(toBoxedAsync input1)
|
|
45
|
+
(toBoxedAsync input2)
|
|
46
|
+
|
|
47
|
+
with :? AsyncResultErrorException<'error> as exn ->
|
|
48
|
+
return Error exn.Value
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// <summary>
|
|
52
|
+
/// Transforms three AsyncResults in one that executes them concurrently and combines the results using the specified function.
|
|
53
|
+
/// If any AsyncResult resolves to an error, then the others are cancelled and only the first error is returned.
|
|
54
|
+
/// </summary>
|
|
55
|
+
/// <param name="mapper">The function to apply to the values of the AsyncResult values.</param>
|
|
56
|
+
/// <param name="input1">The first AsyncResult value to transform.</param>
|
|
57
|
+
/// <param name="input2">The second AsyncResult value to transform.</param>
|
|
58
|
+
/// <param name="input3">The third AsyncResult value to transform.</param>
|
|
59
|
+
/// <returns>The transformed AsyncResult value.</returns>
|
|
60
|
+
let inline map3
|
|
61
|
+
([<InlineIfLambda>] mapper: 'a -> 'b -> 'c -> 'd)
|
|
62
|
+
(input1: Async<Result<'a, 'error>>)
|
|
63
|
+
(input2: Async<Result<'b, 'error>>)
|
|
64
|
+
(input3: Async<Result<'c, 'error>>)
|
|
65
|
+
: Async<Result<'d, 'error>> =
|
|
66
|
+
async {
|
|
67
|
+
try
|
|
68
|
+
return!
|
|
69
|
+
Async.parallelMap3
|
|
70
|
+
(fun a b c ->
|
|
71
|
+
let a = unbox<'a> a
|
|
72
|
+
let b = unbox<'b> b
|
|
73
|
+
let c = unbox<'c> c
|
|
74
|
+
Ok(mapper a b c)
|
|
75
|
+
)
|
|
76
|
+
(toBoxedAsync input1)
|
|
77
|
+
(toBoxedAsync input2)
|
|
78
|
+
(toBoxedAsync input3)
|
|
79
|
+
|
|
80
|
+
with :? AsyncResultErrorException<'error> as exn ->
|
|
81
|
+
return Error exn.Value
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let inline zip
|
|
85
|
+
(a: Async<Result<'a, 'error>>)
|
|
86
|
+
(b: Async<Result<'b, 'error>>)
|
|
87
|
+
: Async<Result<'a * 'b, 'error>> =
|
|
88
|
+
map2 (fun a b -> a, b) a b
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import { Exception } from "../fable-library-js.5.17.2/Util.js";
|
|
3
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
4
|
+
import { singleton } from "../fable-library-js.5.17.2/AsyncBuilder.js";
|
|
5
|
+
|
|
6
|
+
export class InternalHelpers_AsyncResultErrorException$1 extends Exception {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
super();
|
|
9
|
+
this.value = value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function InternalHelpers_AsyncResultErrorException$1_$reflection(gen0) {
|
|
14
|
+
return class_type("FsToolkit.ErrorHandling.ParallelAsyncResult.InternalHelpers.AsyncResultErrorException`1", [gen0], InternalHelpers_AsyncResultErrorException$1, class_type("System.Exception"));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function InternalHelpers_AsyncResultErrorException$1_$ctor_2B595(value) {
|
|
18
|
+
return new InternalHelpers_AsyncResultErrorException$1(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function InternalHelpers_AsyncResultErrorException$1__get_Value(this$) {
|
|
22
|
+
return this$.value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function InternalHelpers_toBoxedAsync(input) {
|
|
26
|
+
return singleton.Delay(() => singleton.Bind(input, (_arg) => ((_arg.tag === 1) ? singleton.Return((() => {
|
|
27
|
+
throw InternalHelpers_AsyncResultErrorException$1_$ctor_2B595(_arg.fields[0]);
|
|
28
|
+
})()) : singleton.Return(_arg.fields[0]))));
|
|
29
|
+
}
|
|
30
|
+
|