@glutinum/cli 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +19 -1
  2. package/dist/Glutinum.Converter/Abbreviations.js +246 -0
  3. package/dist/Glutinum.Converter/FsharpAST.js +87 -28
  4. package/dist/Glutinum.Converter/Generate.js +55 -8
  5. package/dist/Glutinum.Converter/GlueAST.js +333 -34
  6. package/dist/Glutinum.Converter/Log.js +7 -8
  7. package/dist/Glutinum.Converter/Merge.js +683 -31
  8. package/dist/Glutinum.Converter/Packages.js +308 -0
  9. package/dist/Glutinum.Converter/Printer.js +323 -186
  10. package/dist/Glutinum.Converter/Read.js +279 -6
  11. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +13 -7
  12. package/dist/Glutinum.Converter/Reader/Declaration.js +102 -17
  13. package/dist/Glutinum.Converter/Reader/Documentation.js +168 -73
  14. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +7 -51
  15. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +64 -15
  16. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +165 -0
  17. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -5
  18. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +122 -4
  19. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +83 -7
  20. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +8 -8
  21. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +11 -9
  22. package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +3 -2
  23. package/dist/Glutinum.Converter/Reader/Node.js +24 -10
  24. package/dist/Glutinum.Converter/Reader/Parameters.js +110 -7
  25. package/dist/Glutinum.Converter/Reader/Report.js +31 -12
  26. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +4 -3
  27. package/dist/Glutinum.Converter/Reader/TypeNode.js +1524 -253
  28. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +75 -20
  29. package/dist/Glutinum.Converter/Reader/TypeParameters.js +8 -5
  30. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +184 -50
  31. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +32 -13
  32. package/dist/Glutinum.Converter/Reader/Types.js +180 -0
  33. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +99 -43
  34. package/dist/Glutinum.Converter/Reader/Utils.js +1143 -55
  35. package/dist/Glutinum.Converter/Reader/VariableStatement.js +59 -14
  36. package/dist/Glutinum.Converter/Transform.js +8292 -1119
  37. package/dist/Glutinum.Converter/TypeScript.Extensions.js +3 -3
  38. package/dist/Glutinum.Converter/TypeScript.js +3 -3
  39. package/dist/Glutinum.Converter/Utils/Keywords.js +6 -6
  40. package/dist/Glutinum.Converter/Utils/List.js +3 -3
  41. package/dist/Glutinum.Converter/Utils/Naming.js +61 -12
  42. package/dist/Glutinum.Converter/Utils/String.js +7 -3
  43. package/dist/Program.js +230 -72
  44. package/package.json +4 -4
  45. package/src/Glutinum.Converter/js/bootstrap.js +109 -2
  46. package/src/Glutinum.Converter/js/host.js +144 -0
  47. package/src/Glutinum.Converter/js/npm.js +137 -0
  48. package/src/Glutinum.Converter/js/resolve.js +402 -0
  49. package/dist/Glutinum.Converter/FsharpAST.js.map +0 -1
  50. package/dist/Glutinum.Converter/Generate.js.map +0 -1
  51. package/dist/Glutinum.Converter/GlueAST.js.map +0 -1
  52. package/dist/Glutinum.Converter/Log.js.map +0 -1
  53. package/dist/Glutinum.Converter/Merge.js.map +0 -1
  54. package/dist/Glutinum.Converter/Printer.js.map +0 -1
  55. package/dist/Glutinum.Converter/Read.js.map +0 -1
  56. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +0 -1
  57. package/dist/Glutinum.Converter/Reader/Declaration.js.map +0 -1
  58. package/dist/Glutinum.Converter/Reader/Documentation.js.map +0 -1
  59. package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +0 -1
  60. package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +0 -1
  61. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +0 -1
  62. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +0 -1
  63. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +0 -1
  64. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +0 -1
  65. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +0 -1
  66. package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +0 -1
  67. package/dist/Glutinum.Converter/Reader/Node.js.map +0 -1
  68. package/dist/Glutinum.Converter/Reader/Parameters.js.map +0 -1
  69. package/dist/Glutinum.Converter/Reader/Report.js.map +0 -1
  70. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +0 -1
  71. package/dist/Glutinum.Converter/Reader/TypeNode.js.map +0 -1
  72. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +0 -1
  73. package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +0 -1
  74. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +0 -1
  75. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +0 -1
  76. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +0 -1
  77. package/dist/Glutinum.Converter/Reader/Utils.js.map +0 -1
  78. package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +0 -1
  79. package/dist/Glutinum.Converter/Transform.js.map +0 -1
  80. package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +0 -1
  81. package/dist/Glutinum.Converter/TypeScript.js.map +0 -1
  82. package/dist/Glutinum.Converter/Utils/Keywords.js.map +0 -1
  83. package/dist/Glutinum.Converter/Utils/List.js.map +0 -1
  84. package/dist/Glutinum.Converter/Utils/Naming.js.map +0 -1
  85. package/dist/Glutinum.Converter/Utils/String.js.map +0 -1
  86. package/dist/Program.js.map +0 -1
  87. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +0 -57
  88. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +0 -105
  89. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +0 -1
  90. package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +0 -20
  91. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs +0 -766
  92. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +0 -218
  93. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +0 -1
  94. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +0 -31
  95. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +0 -20
  96. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
  97. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AssemblyInfo.fs +0 -19
  98. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs +0 -207
  99. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js +0 -127
  100. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
  101. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOption.fs +0 -81
  102. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs +0 -183
  103. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js +0 -37
  104. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
  105. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionOp.fs +0 -24
  106. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResult.fs +0 -439
  107. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs +0 -217
  108. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js +0 -18
  109. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
  110. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOp.fs +0 -24
  111. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs +0 -75
  112. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +0 -26
  113. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +0 -1
  114. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs +0 -238
  115. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js +0 -18
  116. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +0 -1
  117. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionOp.fs +0 -24
  118. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidation.fs +0 -190
  119. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs +0 -194
  120. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js +0 -18
  121. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
  122. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationOp.fs +0 -35
  123. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +0 -51
  124. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs +0 -218
  125. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js +0 -358
  126. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +0 -1
  127. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Option.fs +0 -331
  128. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +0 -186
  129. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +0 -18
  130. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +0 -1
  131. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionOp.fs +0 -21
  132. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs +0 -644
  133. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js +0 -45
  134. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +0 -1
  135. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs +0 -155
  136. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js +0 -23
  137. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
  138. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOp.fs +0 -45
  139. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs +0 -201
  140. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js +0 -65
  141. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +0 -1
  142. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs +0 -146
  143. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js +0 -18
  144. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +0 -1
  145. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionOp.fs +0 -57
  146. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +0 -19
  147. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +0 -31
  148. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +0 -1
  149. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +0 -22
  150. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +0 -18
  151. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +0 -1
  152. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Validation.fs +0 -172
  153. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs +0 -148
  154. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js +0 -18
  155. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +0 -1
  156. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationOp.fs +0 -35
  157. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOption.fs +0 -151
  158. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
  159. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -3
  160. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
  161. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -3
  162. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
  163. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -3
  164. package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +0 -20
  165. package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +0 -123
  166. package/dist/fable_modules/fable-library-js.4.14.0/Array.js +0 -1242
  167. package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +0 -32
  168. package/dist/fable_modules/fable-library-js.4.14.0/Async.js +0 -158
  169. package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +0 -59
  170. package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.js +0 -183
  171. package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +0 -115
  172. package/dist/fable_modules/fable-library-js.4.14.0/BigInt.js +0 -282
  173. package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +0 -27
  174. package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.js +0 -138
  175. package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +0 -3
  176. package/dist/fable_modules/fable-library-js.4.14.0/Boolean.js +0 -21
  177. package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +0 -37
  178. package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +0 -65
  179. package/dist/fable_modules/fable-library-js.4.14.0/Char.js +0 -169
  180. package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +0 -121
  181. package/dist/fable_modules/fable-library-js.4.14.0/Choice.js +0 -184
  182. package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +0 -70
  183. package/dist/fable_modules/fable-library-js.4.14.0/Date.js +0 -749
  184. package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +0 -63
  185. package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.js +0 -268
  186. package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +0 -18
  187. package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.js +0 -124
  188. package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +0 -45
  189. package/dist/fable_modules/fable-library-js.4.14.0/Decimal.js +0 -212
  190. package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +0 -11
  191. package/dist/fable_modules/fable-library-js.4.14.0/Double.js +0 -46
  192. package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +0 -12
  193. package/dist/fable_modules/fable-library-js.4.14.0/Encoding.js +0 -173
  194. package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +0 -31
  195. package/dist/fable_modules/fable-library-js.4.14.0/Event.js +0 -93
  196. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +0 -7
  197. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +0 -27
  198. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +0 -12
  199. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.js +0 -27
  200. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +0 -17
  201. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +0 -69
  202. package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +0 -24
  203. package/dist/fable_modules/fable-library-js.4.14.0/Global.js +0 -8
  204. package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +0 -10
  205. package/dist/fable_modules/fable-library-js.4.14.0/Guid.js +0 -142
  206. package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +0 -28
  207. package/dist/fable_modules/fable-library-js.4.14.0/Int32.js +0 -135
  208. package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +0 -143
  209. package/dist/fable_modules/fable-library-js.4.14.0/List.js +0 -1273
  210. package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +0 -3
  211. package/dist/fable_modules/fable-library-js.4.14.0/Long.js +0 -46
  212. package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +0 -25
  213. package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.js +0 -93
  214. package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +0 -178
  215. package/dist/fable_modules/fable-library-js.4.14.0/Map.js +0 -1396
  216. package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +0 -10
  217. package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.js +0 -112
  218. package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +0 -52
  219. package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.js +0 -327
  220. package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +0 -39
  221. package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.js +0 -233
  222. package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +0 -2
  223. package/dist/fable_modules/fable-library-js.4.14.0/Native.js +0 -8
  224. package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +0 -19
  225. package/dist/fable_modules/fable-library-js.4.14.0/Numeric.js +0 -71
  226. package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +0 -32
  227. package/dist/fable_modules/fable-library-js.4.14.0/Observable.js +0 -113
  228. package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +0 -28
  229. package/dist/fable_modules/fable-library-js.4.14.0/Option.js +0 -96
  230. package/dist/fable_modules/fable-library-js.4.14.0/README.md +0 -3
  231. package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +0 -37
  232. package/dist/fable_modules/fable-library-js.4.14.0/Random.js +0 -170
  233. package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +0 -12
  234. package/dist/fable_modules/fable-library-js.4.14.0/Range.js +0 -45
  235. package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +0 -119
  236. package/dist/fable_modules/fable-library-js.4.14.0/Reflection.js +0 -461
  237. package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +0 -10
  238. package/dist/fable_modules/fable-library-js.4.14.0/RegExp.js +0 -132
  239. package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +0 -37
  240. package/dist/fable_modules/fable-library-js.4.14.0/Result.js +0 -165
  241. package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +0 -165
  242. package/dist/fable_modules/fable-library-js.4.14.0/Seq.js +0 -1379
  243. package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +0 -18
  244. package/dist/fable_modules/fable-library-js.4.14.0/Seq2.js +0 -111
  245. package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +0 -190
  246. package/dist/fable_modules/fable-library-js.4.14.0/Set.js +0 -1789
  247. package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +0 -50
  248. package/dist/fable_modules/fable-library-js.4.14.0/String.js +0 -543
  249. package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +0 -79
  250. package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.js +0 -317
  251. package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +0 -38
  252. package/dist/fable_modules/fable-library-js.4.14.0/System.Text.js +0 -162
  253. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +0 -5
  254. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +0 -5
  255. package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +0 -15
  256. package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.js +0 -122
  257. package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +0 -34
  258. package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.js +0 -177
  259. package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +0 -19
  260. package/dist/fable_modules/fable-library-js.4.14.0/Timer.js +0 -67
  261. package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +0 -58
  262. package/dist/fable_modules/fable-library-js.4.14.0/Types.js +0 -208
  263. package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +0 -2
  264. package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.js +0 -4
  265. package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +0 -29
  266. package/dist/fable_modules/fable-library-js.4.14.0/Uri.js +0 -142
  267. package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +0 -207
  268. package/dist/fable_modules/fable-library-js.4.14.0/Util.js +0 -770
  269. package/dist/fable_modules/fable-library-js.4.14.0/big.d.ts +0 -338
  270. package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +0 -5
  271. package/dist/fable_modules/fable-library-js.4.14.0/lib/big.js +0 -826
  272. package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
  273. package/dist/fable_modules/project_cracked.json +0 -1
@@ -1,439 +0,0 @@
1
- namespace FsToolkit.ErrorHandling
2
-
3
- open System.Threading.Tasks
4
-
5
- [<RequireQualifiedAccess>]
6
- module AsyncResult =
7
-
8
-
9
- let inline retn (value: 'ok) : Async<Result<'ok, 'error>> =
10
- Ok value
11
- |> Async.singleton
12
-
13
- let inline ok (value: 'ok) : Async<Result<'ok, 'error>> = retn value
14
-
15
- let inline returnError (error: 'error) : Async<Result<'ok, 'error>> =
16
- Error error
17
- |> Async.singleton
18
-
19
- let inline error (error: 'error) : Async<Result<'ok, 'error>> = returnError error
20
-
21
- let inline map
22
- ([<InlineIfLambda>] mapper: 'input -> 'output)
23
- (input: Async<Result<'input, 'error>>)
24
- : Async<Result<'output, 'error>> =
25
- Async.map (Result.map mapper) input
26
-
27
- let inline mapError
28
- ([<InlineIfLambda>] mapper: 'inputError -> 'outputError)
29
- (input: Async<Result<'ok, 'inputError>>)
30
- : Async<Result<'ok, 'outputError>> =
31
- Async.map (Result.mapError mapper) input
32
-
33
- let inline bind
34
- ([<InlineIfLambda>] binder: 'input -> Async<Result<'output, 'error>>)
35
- (input: Async<Result<'input, 'error>>)
36
- : Async<Result<'output, 'error>> =
37
- Async.bind (Result.either binder returnError) input
38
-
39
- let inline foldResult
40
- ([<InlineIfLambda>] onSuccess: 'input -> 'output)
41
- ([<InlineIfLambda>] onError: 'inputError -> 'output)
42
- (input: Async<Result<'input, 'inputError>>)
43
- : Async<'output> =
44
- Async.map (Result.either onSuccess onError) input
45
-
46
- let inline eitherMap ([<InlineIfLambda>] onSuccess) ([<InlineIfLambda>] onError) input =
47
- Async.map (Result.eitherMap onSuccess onError) input
48
-
49
- #if !FABLE_COMPILER
50
-
51
- let inline ofTask (aTask: Task<'ok>) : Async<Result<'ok, exn>> =
52
- async.Delay(fun () ->
53
- aTask
54
- |> Async.AwaitTask
55
- |> Async.Catch
56
- |> Async.map Result.ofChoice
57
- )
58
-
59
- let inline ofTaskAction (aTask: Task) : Async<Result<unit, exn>> =
60
- async.Delay(fun () ->
61
- aTask
62
- |> Async.AwaitTask
63
- |> Async.Catch
64
- |> Async.map Result.ofChoice
65
- )
66
-
67
- #endif
68
-
69
-
70
- let inline map2
71
- ([<InlineIfLambda>] mapper: 'input1 -> 'input2 -> 'output)
72
- (input1: Async<Result<'input1, 'error>>)
73
- (input2: Async<Result<'input2, 'error>>)
74
- : Async<Result<'output, 'error>> =
75
- Async.map2 (Result.map2 mapper) input1 input2
76
-
77
- let inline map3
78
- ([<InlineIfLambda>] mapper: 'input1 -> 'input2 -> 'input3 -> 'output)
79
- (input1: Async<Result<'input1, 'error>>)
80
- (input2: Async<Result<'input2, 'error>>)
81
- (input3: Async<Result<'input3, 'error>>)
82
- : Async<Result<'output, 'error>> =
83
- Async.map3 (Result.map3 mapper) input1 input2 input3
84
-
85
- let inline apply
86
- (applier: Async<Result<'input -> 'output, 'error>>)
87
- (input: Async<Result<'input, 'error>>)
88
- : Async<Result<'output, 'error>> =
89
- map2 (fun f x -> f x) applier input
90
-
91
-
92
- /// <summary>
93
- /// Returns <paramref name="input"/> if it is <c>Ok</c>, otherwise returns <paramref name="ifError"/>
94
- /// </summary>
95
- /// <param name="ifError">The value to use if <paramref name="input"/> is <c>Error</c></param>
96
- /// <param name="input">The input result.</param>
97
- /// <remarks>
98
- /// </remarks>
99
- /// <example>
100
- /// <code>
101
- /// AsyncResult.error "First" |> AsyncResult.orElse (AsyncResult.error "Second") // evaluates to Error ("Second")
102
- /// AsyncResult.error "First" |> AsyncResult.orElse (AsyncResult.ok "Second") // evaluates to Ok ("Second")
103
- /// AsyncResult.ok "First" |> AsyncResult.orElse (AsyncResult.error "Second") // evaluates to Ok ("First")
104
- /// AsyncResult.ok "First" |> AsyncResult.orElse (AsyncResult.ok "Second") // evaluates to Ok ("First")
105
- /// </code>
106
- /// </example>
107
- /// <returns>
108
- /// The result if the result is Ok, else returns <paramref name="ifError"/>.
109
- /// </returns>
110
- let inline orElse
111
- (ifError: Async<Result<'ok, 'errorOutput>>)
112
- (input: Async<Result<'ok, 'errorInput>>)
113
- : Async<Result<'ok, 'errorOutput>> =
114
- Async.bind (Result.either ok (fun _ -> ifError)) input
115
-
116
- /// <summary>
117
- /// Returns <paramref name="input"/> if it is <c>Ok</c>, otherwise executes <paramref name="ifErrorFunc"/> and returns the result.
118
- /// </summary>
119
- /// <param name="ifErrorFunc">A function that provides an alternate result when evaluated.</param>
120
- /// <param name="input">The input result.</param>
121
- /// <remarks>
122
- /// <paramref name="ifErrorFunc"/> is not executed unless <paramref name="input"/> is an <c>Error</c>.
123
- /// </remarks>
124
- /// <example>
125
- /// <code>
126
- /// AsyncResult.error "First" |> AsyncResult.orElseWith (fun _ -> AsyncResult.error "Second") // evaluates to Error ("Second")
127
- /// AsyncResult.error "First" |> AsyncResult.orElseWith (fun _ -> AsyncResult.ok "Second") // evaluates to Ok ("Second")
128
- /// AsyncResult.ok "First" |> AsyncResult.orElseWith (fun _ -> AsyncResult.error "Second") // evaluates to Ok ("First")
129
- /// AsyncResult.ok "First" |> AsyncResult.orElseWith (fun _ -> AsyncResult.ok "Second") // evaluates to Ok ("First")
130
- /// </code>
131
- /// </example>
132
- /// <returns>
133
- /// The result if the result is Ok, else the result of executing <paramref name="ifErrorFunc"/>.
134
- /// </returns>
135
- let inline orElseWith
136
- ([<InlineIfLambda>] ifErrorFunc: 'errorInput -> Async<Result<'ok, 'errorOutput>>)
137
- (input: Async<Result<'ok, 'errorInput>>)
138
- : Async<Result<'ok, 'errorOutput>> =
139
- Async.bind (Result.either ok ifErrorFunc) input
140
-
141
- /// Replaces the wrapped value with unit
142
- let inline ignore<'ok, 'error>
143
- (value: Async<Result<'ok, 'error>>)
144
- : Async<Result<unit, 'error>> =
145
- value
146
- |> map ignore<'ok>
147
-
148
- /// Returns the specified error if the async-wrapped value is false.
149
- let inline requireTrue (error: 'error) (value: Async<bool>) : Async<Result<unit, 'error>> =
150
- value
151
- |> Async.map (Result.requireTrue error)
152
-
153
- /// Returns the specified error if the async-wrapped value is true.
154
- let inline requireFalse (error: 'error) (value: Async<bool>) : Async<Result<unit, 'error>> =
155
- value
156
- |> Async.map (Result.requireFalse error)
157
-
158
- // Converts an async-wrapped Option to a Result, using the given error if None.
159
- let inline requireSome (error: 'error) (value: Async<'ok option>) : Async<Result<'ok, 'error>> =
160
- value
161
- |> Async.map (Result.requireSome error)
162
-
163
- // Converts an async-wrapped Option to a Result, using the given error if Some.
164
- let inline requireNone
165
- (error: 'error)
166
- (value: Async<'ok option>)
167
- : Async<Result<unit, 'error>> =
168
- value
169
- |> Async.map (Result.requireNone error)
170
-
171
- // Converts an async-wrapped ValueOption to a Result, using the given error if ValueNone.
172
- let inline requireValueSome
173
- (error: 'error)
174
- (value: Async<'ok voption>)
175
- : Async<Result<'ok, 'error>> =
176
- value
177
- |> Async.map (Result.requireValueSome error)
178
-
179
- // Converts an async-wrapped ValueOption to a Result, using the given error if ValueSome.
180
- let inline requireValueNone
181
- (error: 'error)
182
- (value: Async<'ok voption>)
183
- : Async<Result<unit, 'error>> =
184
- value
185
- |> Async.map (Result.requireValueNone error)
186
-
187
- /// Returns Ok if the async-wrapped value and the provided value are equal, or the specified error if not.
188
- let inline requireEqual
189
- (value1: 'value)
190
- (value2: Async<'value>)
191
- (error: 'error)
192
- : Async<Result<unit, 'error>> =
193
- value2
194
- |> Async.map (fun x2' -> Result.requireEqual value1 x2' error)
195
-
196
- /// Returns Ok if the two values are equal, or the specified error if not.
197
- let inline requireEqualTo
198
- (other: 'value)
199
- (error: 'error)
200
- (this: Async<'value>)
201
- : Async<Result<unit, 'error>> =
202
- this
203
- |> Async.map (Result.requireEqualTo other error)
204
-
205
- /// Returns Ok if the async-wrapped sequence is empty, or the specified error if not.
206
- let inline requireEmpty
207
- (error: 'error)
208
- (values: Async<#seq<'ok>>)
209
- : Async<Result<unit, 'error>> =
210
- values
211
- |> Async.map (Result.requireEmpty error)
212
-
213
- /// Returns Ok if the async-wrapped sequence is not-empty, or the specified error if not.
214
- let inline requireNotEmpty
215
- (error: 'error)
216
- (values: Async<#seq<'ok>>)
217
- : Async<Result<unit, 'error>> =
218
- values
219
- |> Async.map (Result.requireNotEmpty error)
220
-
221
- /// Returns the first item of the async-wrapped sequence if it exists, or the specified
222
- /// error if the sequence is empty
223
- let inline requireHead (error: 'error) (values: Async<#seq<'ok>>) : Async<Result<'ok, 'error>> =
224
- values
225
- |> Async.map (Result.requireHead error)
226
-
227
- /// Replaces an error value of an async-wrapped result with a custom error
228
- /// value.
229
- let inline setError
230
- (error: 'errorOutput)
231
- (asyncResult: Async<Result<'ok, 'errorInput>>)
232
- : Async<Result<'ok, 'errorOutput>> =
233
- asyncResult
234
- |> Async.map (Result.setError error)
235
-
236
- /// Replaces a unit error value of an async-wrapped result with a custom
237
- /// error value. Safer than setError since you're not losing any information.
238
- let inline withError
239
- (error: 'errorOutput)
240
- (asyncResult: Async<Result<'ok, unit>>)
241
- : Async<Result<'ok, 'errorOutput>> =
242
- asyncResult
243
- |> Async.map (Result.withError error)
244
-
245
- /// Extracts the contained value of an async-wrapped result if Ok, otherwise
246
- /// uses ifError.
247
- let inline defaultValue (ifError: 'ok) (asyncResult: Async<Result<'ok, 'error>>) : Async<'ok> =
248
- asyncResult
249
- |> Async.map (Result.defaultValue ifError)
250
-
251
- /// Extracts the contained value of an async-wrapped result if Error, otherwise
252
- /// uses ifOk.
253
- let inline defaultError
254
- (ifOk: 'error)
255
- (asyncResult: Async<Result<'ok, 'error>>)
256
- : Async<'error> =
257
- asyncResult
258
- |> Async.map (Result.defaultError ifOk)
259
-
260
- /// Extracts the contained value of an async-wrapped result if Ok, otherwise
261
- /// evaluates ifErrorThunk and uses the result.
262
- let inline defaultWith
263
- ([<InlineIfLambda>] ifErrorThunk: 'error -> 'ok)
264
- (asyncResult: Async<Result<'ok, 'error>>)
265
- : Async<'ok> =
266
- asyncResult
267
- |> Async.map (Result.defaultWith ifErrorThunk)
268
-
269
- /// Same as defaultValue for a result where the Ok value is unit. The name
270
- /// describes better what is actually happening in this case.
271
- let inline ignoreError<'error> (result: Async<Result<unit, 'error>>) : Async<unit> =
272
- defaultValue () result
273
-
274
- /// If the async-wrapped result is Ok, executes the function on the Ok value.
275
- /// Passes through the input value.
276
- let inline tee
277
- ([<InlineIfLambda>] inspector: 'ok -> unit)
278
- (asyncResult: Async<Result<'ok, 'error>>)
279
- : Async<Result<'ok, 'error>> =
280
- asyncResult
281
- |> Async.map (Result.tee inspector)
282
-
283
- /// If the async-wrapped result is Ok and the predicate returns true, executes
284
- /// the function on the Ok value. Passes through the input value.
285
- let inline teeIf
286
- ([<InlineIfLambda>] predicate: 'ok -> bool)
287
- ([<InlineIfLambda>] inspector: 'ok -> unit)
288
- (asyncResult: Async<Result<'ok, 'error>>)
289
- : Async<Result<'ok, 'error>> =
290
- asyncResult
291
- |> Async.map (Result.teeIf predicate inspector)
292
-
293
- /// If the async-wrapped result is Error, executes the function on the Error
294
- /// value. Passes through the input value.
295
- let inline teeError
296
- ([<InlineIfLambda>] teeFunction: 'error -> unit)
297
- (asyncResult: Async<Result<'ok, 'error>>)
298
- : Async<Result<'ok, 'error>> =
299
- asyncResult
300
- |> Async.map (Result.teeError teeFunction)
301
-
302
- /// If the async-wrapped result is Error and the predicate returns true,
303
- /// executes the function on the Error value. Passes through the input value.
304
- let inline teeErrorIf
305
- ([<InlineIfLambda>] predicate: 'error -> bool)
306
- ([<InlineIfLambda>] teeFunction: 'error -> unit)
307
- (asyncResult: Async<Result<'ok, 'error>>)
308
- : Async<Result<'ok, 'error>> =
309
- asyncResult
310
- |> Async.map (Result.teeErrorIf predicate teeFunction)
311
-
312
-
313
- /// Takes two results and returns a tuple of the pair
314
- let inline zip
315
- (left: Async<Result<'leftOk, 'error>>)
316
- (right: Async<Result<'rightOk, 'error>>)
317
- : Async<Result<'leftOk * 'rightOk, 'error>> =
318
- Async.zip left right
319
- |> Async.map (fun (r1, r2) -> Result.zip r1 r2)
320
-
321
- /// Takes two results and returns a tuple of the error pair
322
- let inline zipError
323
- (left: Async<Result<'ok, 'leftError>>)
324
- (right: Async<Result<'ok, 'rightError>>)
325
- : Async<Result<'ok, 'leftError * 'rightError>> =
326
- Async.zip left right
327
- |> Async.map (fun (r1, r2) -> Result.zipError r1 r2)
328
-
329
- /// Catches exceptions and maps them to the Error case using the provided function.
330
- let inline catch
331
- ([<InlineIfLambda>] exnMapper: exn -> 'error)
332
- (input: Async<Result<'ok, 'error>>)
333
- : Async<Result<'ok, 'error>> =
334
- input
335
- |> Async.Catch
336
- |> Async.map (
337
- function
338
- | Choice1Of2(Ok v) -> Ok v
339
- | Choice1Of2(Error err) -> Error err
340
- | Choice2Of2 ex -> Error(exnMapper ex)
341
- )
342
-
343
- /// Lift Async to AsyncResult
344
- let inline ofAsync (value: Async<'ok>) : Async<Result<'ok, 'error>> =
345
- value
346
- |> Async.map Ok
347
-
348
- /// Lift Result to AsyncResult
349
- let inline ofResult (x: Result<'ok, 'error>) : Async<Result<'ok, 'error>> =
350
- x
351
- |> Async.singleton
352
-
353
- /// Bind the AsyncResult and requireSome on the inner option value.
354
- let inline bindRequireSome error x =
355
- x
356
- |> bind (
357
- Result.requireSome error
358
- >> Async.singleton
359
- )
360
-
361
- /// Bind the AsyncResult and requireNone on the inner option value.
362
- let inline bindRequireNone error x =
363
- x
364
- |> bind (
365
- Result.requireNone error
366
- >> Async.singleton
367
- )
368
-
369
- /// Bind the AsyncResult and requireValueSome on the inner voption value.
370
- let inline bindRequireValueSome error x =
371
- x
372
- |> bind (
373
- Result.requireValueSome error
374
- >> Async.singleton
375
- )
376
-
377
- /// Bind the AsyncResult and requireValueNone on the inner voption value.
378
- let inline bindRequireValueNone error x =
379
- x
380
- |> bind (
381
- Result.requireValueNone error
382
- >> Async.singleton
383
- )
384
-
385
- /// Bind the AsyncResult and requireTrue on the inner value.
386
- let inline bindRequireTrue error x =
387
- x
388
- |> bind (
389
- Result.requireTrue error
390
- >> Async.singleton
391
- )
392
-
393
- /// Bind the AsyncResult and requireFalse on the inner value.
394
- let inline bindRequireFalse error x =
395
- x
396
- |> bind (
397
- Result.requireFalse error
398
- >> Async.singleton
399
- )
400
-
401
- /// Bind the AsyncResult and requireNotNull on the inner value.
402
- let inline bindRequireNotNull error x =
403
- x
404
- |> bind (
405
- Result.requireNotNull error
406
- >> Async.singleton
407
- )
408
-
409
- /// Bind the AsyncResult and requireEequal on the inner value.
410
- let inline bindRequireEqual y error x =
411
- x
412
- |> bind (fun x ->
413
- Result.requireEqual x y error
414
- |> Async.singleton
415
- )
416
-
417
- /// Bind the AsyncResult and requireEmpty on the inner value.
418
- let inline bindRequireEmpty error x =
419
- x
420
- |> bind (
421
- Result.requireEmpty error
422
- >> Async.singleton
423
- )
424
-
425
- /// Bind the AsyncResult and requireNotEmpty on the inner value.
426
- let inline bindRequireNotEmpty error x =
427
- x
428
- |> bind (
429
- Result.requireNotEmpty error
430
- >> Async.singleton
431
- )
432
-
433
- /// Bind the AsyncResult and requireHead on the inner value
434
- let inline bindRequireHead error x =
435
- x
436
- |> bind (
437
- Result.requireHead error
438
- >> Async.singleton
439
- )
@@ -1,217 +0,0 @@
1
- namespace FsToolkit.ErrorHandling
2
-
3
- open System.Threading.Tasks
4
- open System
5
-
6
- [<AutoOpen>]
7
- module AsyncResultCE =
8
-
9
- type AsyncResultBuilder() =
10
-
11
- member inline _.Return(value: 'ok) : Async<Result<'ok, 'error>> =
12
- result.Return value
13
- |> async.Return
14
-
15
- member inline _.ReturnFrom
16
- (asyncResult: Async<Result<'ok, 'error>>)
17
- : Async<Result<'ok, 'error>> =
18
- asyncResult
19
-
20
- member inline _.Zero() : Async<Result<unit, 'error>> =
21
- result.Zero()
22
- |> async.Return
23
-
24
- member inline _.Bind
25
- (
26
- asyncResult: Async<Result<'okInput, 'error>>,
27
- [<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput, 'error>>
28
- ) : Async<Result<'okOutput, 'error>> =
29
- AsyncResult.bind binder asyncResult
30
-
31
- member inline _.Delay
32
- ([<InlineIfLambda>] generator: unit -> Async<Result<'ok, 'error>>)
33
- : Async<Result<'ok, 'error>> =
34
- async.Delay generator
35
-
36
- member inline this.Combine
37
- (
38
- computation1: Async<Result<unit, 'error>>,
39
- computation2: Async<Result<'ok, 'error>>
40
- ) : Async<Result<'ok, 'error>> =
41
- this.Bind(computation1, (fun () -> computation2))
42
-
43
- member inline _.TryWith
44
- (
45
- computation: Async<Result<'ok, 'error>>,
46
- [<InlineIfLambda>] handler: System.Exception -> Async<Result<'ok, 'error>>
47
- ) : Async<Result<'ok, 'error>> =
48
- async.TryWith(computation, handler)
49
-
50
- member inline _.TryFinally
51
- (
52
- computation: Async<Result<'ok, 'error>>,
53
- [<InlineIfLambda>] compensation: unit -> unit
54
- ) : Async<Result<'ok, 'error>> =
55
- async.TryFinally(computation, compensation)
56
-
57
- #if NETSTANDARD2_1
58
-
59
- member inline _.TryFinallyAsync
60
- (
61
- computation: Async<Result<'ok, 'error>>,
62
- [<InlineIfLambda>] compensation: unit -> ValueTask
63
- ) : Async<Result<'ok, 'error>> =
64
- let compensation =
65
- async {
66
- let vTask = compensation ()
67
-
68
- if vTask.IsCompletedSuccessfully then
69
- return ()
70
- else
71
- return!
72
- vTask.AsTask()
73
- |> Async.AwaitTask
74
- }
75
-
76
- Async.TryFinallyAsync(computation, compensation)
77
-
78
-
79
- member inline this.Using
80
- (
81
- resource: 'ok :> IAsyncDisposable,
82
- [<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
83
- ) : Async<Result<'U, 'error>> =
84
- this.TryFinallyAsync(
85
- binder resource,
86
- (fun () ->
87
- if not (isNull (box resource)) then
88
- resource.DisposeAsync()
89
- else
90
- ValueTask()
91
- )
92
- )
93
- #endif
94
-
95
-
96
- member inline this.While
97
- (
98
- [<InlineIfLambda>] guard: unit -> bool,
99
- computation: Async<Result<unit, 'error>>
100
- ) : Async<Result<unit, 'error>> =
101
- if guard () then
102
- let mutable whileAsync = Unchecked.defaultof<_>
103
-
104
- whileAsync <-
105
- this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
106
-
107
- whileAsync
108
- else
109
- this.Zero()
110
-
111
-
112
- member inline _.BindReturn
113
- (
114
- x: Async<Result<'okInput, 'error>>,
115
- [<InlineIfLambda>] f: 'okInput -> 'okOutput
116
- ) : Async<Result<'okOutput, 'error>> =
117
- AsyncResult.map f x
118
-
119
- member inline _.MergeSources
120
- (
121
- t1: Async<Result<'leftOk, 'error>>,
122
- t2: Async<Result<'rightOk, 'error>>
123
- ) : Async<Result<'leftOk * 'rightOk, 'error>> =
124
- AsyncResult.zip t1 t2
125
-
126
-
127
- /// <summary>
128
- /// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
129
- ///
130
- /// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
131
- /// </summary>
132
- member inline _.Source(result: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
133
- result
134
-
135
- #if !FABLE_COMPILER
136
- /// <summary>
137
- /// Method lets us transform data types into our internal representation.
138
- /// </summary>
139
- member inline _.Source(task: Task<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
140
- task
141
- |> Async.AwaitTask
142
- #endif
143
-
144
- let asyncResult = AsyncResultBuilder()
145
-
146
- [<AutoOpen>]
147
- module AsyncResultCEExtensions =
148
-
149
- type AsyncResultBuilder with
150
-
151
- /// <summary>
152
- /// Needed to allow `for..in` and `for..do` functionality
153
- /// </summary>
154
- member inline _.Source(s: #seq<'value>) : #seq<'value> = s
155
-
156
- /// <summary>
157
- /// Method lets us transform data types into our internal representation.
158
- /// </summary>
159
- member inline _.Source(result: Result<'ok, 'error>) : Async<Result<'ok, 'error>> =
160
- Async.singleton result
161
-
162
- /// <summary>
163
- /// Method lets us transform data types into our internal representation.
164
- /// </summary>
165
- member inline _.Source(choice: Choice<'ok, 'error>) : Async<Result<'ok, 'error>> =
166
- choice
167
- |> Result.ofChoice
168
- |> Async.singleton
169
-
170
- /// <summary>
171
- /// Method lets us transform data types into our internal representation.
172
- /// </summary>
173
- member inline _.Source(asyncComputation: Async<'ok>) : Async<Result<'ok, 'error>> =
174
- asyncComputation
175
- |> Async.map Ok
176
-
177
-
178
- member inline _.Using
179
- (
180
- resource: 'ok :> IDisposable,
181
- [<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
182
- ) : Async<Result<'U, 'error>> =
183
- async.Using(resource, binder)
184
-
185
-
186
- member inline this.For
187
- (
188
- sequence: #seq<'ok>,
189
- [<InlineIfLambda>] binder: 'ok -> Async<Result<unit, 'error>>
190
- ) : Async<Result<unit, 'error>> =
191
- this.Using(
192
- sequence.GetEnumerator(),
193
- fun enum ->
194
- this.While(
195
- (fun () -> enum.MoveNext()),
196
- this.Delay(fun () -> binder enum.Current)
197
- )
198
- )
199
-
200
-
201
- #if !FABLE_COMPILER
202
- /// <summary>
203
- /// Method lets us transform data types into our internal representation.
204
- /// </summary>
205
- member inline _.Source(task: Task<'ok>) : Async<Result<'ok, 'error>> =
206
- task
207
- |> Async.AwaitTask
208
- |> Async.map Ok
209
-
210
- /// <summary>
211
- /// Method lets us transform data types into our internal representation.
212
- /// </summary>
213
- member inline _.Source(task: Task) : Async<Result<unit, 'error>> =
214
- task
215
- |> Async.AwaitTask
216
- |> Async.map Ok
217
- #endif
@@ -1,18 +0,0 @@
1
- import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
2
-
3
- export class AsyncResultCE_AsyncResultBuilder {
4
- constructor() {
5
- }
6
- }
7
-
8
- export function AsyncResultCE_AsyncResultBuilder_$reflection() {
9
- return class_type("FsToolkit.ErrorHandling.AsyncResultCE.AsyncResultBuilder", void 0, AsyncResultCE_AsyncResultBuilder);
10
- }
11
-
12
- export function AsyncResultCE_AsyncResultBuilder_$ctor() {
13
- return new AsyncResultCE_AsyncResultBuilder();
14
- }
15
-
16
- export const AsyncResultCE_asyncResult = AsyncResultCE_AsyncResultBuilder_$ctor();
17
-
18
- //# sourceMappingURL=AsyncResultCE.fs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["./AsyncResultCE.fs"],"names":["\u0060\u0060.ctor\u0060\u0060"],"mappings":";;;;;;;;;;;;;;;yCA\u002BIsB,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}