@glutinum/cli 0.14.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/Glutinum.Converter/FsharpAST.js +38 -4
  2. package/dist/Glutinum.Converter/Generate.js +15 -7
  3. package/dist/Glutinum.Converter/GlueAST.js +45 -36
  4. package/dist/Glutinum.Converter/Hosting.js +918 -0
  5. package/dist/Glutinum.Converter/Merge.js +218 -82
  6. package/dist/Glutinum.Converter/Packages.js +44 -8
  7. package/dist/Glutinum.Converter/Printer.js +77 -49
  8. package/dist/Glutinum.Converter/Read.js +8 -8
  9. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
  10. package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
  11. package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
  12. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
  13. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
  14. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
  15. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
  16. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
  17. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
  18. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
  19. package/dist/Glutinum.Converter/Reader/Node.js +20 -20
  20. package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
  21. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
  22. package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
  23. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
  24. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
  25. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
  26. package/dist/Glutinum.Converter/Reader/Types.js +6 -6
  27. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
  28. package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
  29. package/dist/Glutinum.Converter/Transform.js +2057 -700
  30. package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
  31. package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
  32. package/dist/Glutinum.Converter/Utils/String.js +2 -2
  33. package/dist/Program.js +38 -26
  34. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
  35. package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +105 -0
  36. package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
  37. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs +842 -0
  38. package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +232 -0
  39. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs +31 -0
  40. package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +20 -0
  41. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
  42. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
  43. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AssemblyInfo.fs +19 -0
  44. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs +287 -0
  45. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +128 -0
  46. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOption.fs +127 -0
  47. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs +174 -0
  48. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +37 -0
  49. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionOp.fs +24 -0
  50. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResult.fs +483 -0
  51. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs +201 -0
  52. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +18 -0
  53. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOp.fs +24 -0
  54. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs +87 -0
  55. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
  56. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs +236 -0
  57. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +18 -0
  58. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionOp.fs +24 -0
  59. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidation.fs +185 -0
  60. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs +186 -0
  61. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +18 -0
  62. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationOp.fs +35 -0
  63. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
  64. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs +276 -0
  65. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +364 -0
  66. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
  67. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Option.fs +462 -0
  68. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
  69. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
  70. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionOp.fs +21 -0
  71. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
  72. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
  73. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
  74. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
  75. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
  76. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
  77. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
  78. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs +731 -0
  79. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +45 -0
  80. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs +140 -0
  81. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +23 -0
  82. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOp.fs +45 -0
  83. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs +201 -0
  84. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +65 -0
  85. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs +135 -0
  86. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +18 -0
  87. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionOp.fs +57 -0
  88. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
  89. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
  90. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Validation.fs +167 -0
  91. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs +142 -0
  92. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +18 -0
  93. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationOp.fs +35 -0
  94. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueOption.fs +148 -0
  95. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
  96. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
  97. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
  98. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
  99. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  100. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
  101. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  102. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  103. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  104. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
  105. package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
  106. package/dist/fable_modules/fable-library-js.5.17.2/Array.js +1348 -0
  107. package/dist/fable_modules/fable-library-js.5.17.2/Async.js +163 -0
  108. package/dist/fable_modules/fable-library-js.5.17.2/AsyncBuilder.js +204 -0
  109. package/dist/fable_modules/fable-library-js.5.17.2/BigInt.js +307 -0
  110. package/dist/fable_modules/fable-library-js.5.17.2/BitConverter.js +138 -0
  111. package/dist/fable_modules/fable-library-js.5.17.2/Boolean.js +22 -0
  112. package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
  113. package/dist/fable_modules/fable-library-js.5.17.2/Char.js +202 -0
  114. package/dist/fable_modules/fable-library-js.5.17.2/Choice.js +184 -0
  115. package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
  116. package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
  117. package/dist/fable_modules/fable-library-js.5.17.2/Date.js +834 -0
  118. package/dist/fable_modules/fable-library-js.5.17.2/DateOffset.js +252 -0
  119. package/dist/fable_modules/fable-library-js.5.17.2/DateOnly.js +124 -0
  120. package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
  121. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
  122. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
  123. package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
  124. package/dist/fable_modules/fable-library-js.5.17.2/Decimal.js +238 -0
  125. package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
  126. package/dist/fable_modules/fable-library-js.5.17.2/Double.js +53 -0
  127. package/dist/fable_modules/fable-library-js.5.17.2/Encoding.js +185 -0
  128. package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
  129. package/dist/fable_modules/fable-library-js.5.17.2/Event.js +102 -0
  130. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
  131. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.CompilerServices.js +27 -0
  132. package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
  133. package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
  134. package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
  135. package/dist/fable_modules/fable-library-js.5.17.2/Guid.js +163 -0
  136. package/dist/fable_modules/fable-library-js.5.17.2/Int32.js +135 -0
  137. package/dist/fable_modules/fable-library-js.5.17.2/List.js +1337 -0
  138. package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
  139. package/dist/fable_modules/fable-library-js.5.17.2/MailboxProcessor.js +100 -0
  140. package/dist/fable_modules/fable-library-js.5.17.2/Map.js +1400 -0
  141. package/dist/fable_modules/fable-library-js.5.17.2/MapUtil.js +130 -0
  142. package/dist/fable_modules/fable-library-js.5.17.2/MutableMap.js +339 -0
  143. package/dist/fable_modules/fable-library-js.5.17.2/MutableSet.js +233 -0
  144. package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
  145. package/dist/fable_modules/fable-library-js.5.17.2/Numeric.js +112 -0
  146. package/dist/fable_modules/fable-library-js.5.17.2/Observable.js +115 -0
  147. package/dist/fable_modules/fable-library-js.5.17.2/Option.js +87 -0
  148. package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
  149. package/dist/fable_modules/fable-library-js.5.17.2/README.md +3 -0
  150. package/dist/fable_modules/fable-library-js.5.17.2/Random.js +172 -0
  151. package/dist/fable_modules/fable-library-js.5.17.2/Range.js +45 -0
  152. package/dist/fable_modules/fable-library-js.5.17.2/Reflection.js +489 -0
  153. package/dist/fable_modules/fable-library-js.5.17.2/RegExp.js +170 -0
  154. package/dist/fable_modules/fable-library-js.5.17.2/Result.js +165 -0
  155. package/dist/fable_modules/fable-library-js.5.17.2/Seq.js +1504 -0
  156. package/dist/fable_modules/fable-library-js.5.17.2/Seq2.js +111 -0
  157. package/dist/fable_modules/fable-library-js.5.17.2/Set.js +1829 -0
  158. package/dist/fable_modules/fable-library-js.5.17.2/String.js +731 -0
  159. package/dist/fable_modules/fable-library-js.5.17.2/System.Collections.Generic.js +333 -0
  160. package/dist/fable_modules/fable-library-js.5.17.2/System.Text.js +200 -0
  161. package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
  162. package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
  163. package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
  164. package/dist/fable_modules/fable-library-js.5.17.2/TimeOnly.js +122 -0
  165. package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
  166. package/dist/fable_modules/fable-library-js.5.17.2/TimeSpan.js +180 -0
  167. package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
  168. package/dist/fable_modules/fable-library-js.5.17.2/Timer.js +67 -0
  169. package/dist/fable_modules/fable-library-js.5.17.2/Types.js +198 -0
  170. package/dist/fable_modules/fable-library-js.5.17.2/Unicode.13.0.0.js +4 -0
  171. package/dist/fable_modules/fable-library-js.5.17.2/Uri.js +165 -0
  172. package/dist/fable_modules/fable-library-js.5.17.2/Util.js +807 -0
  173. package/dist/fable_modules/fable-library-js.5.17.2/big.d.ts +338 -0
  174. package/dist/fable_modules/fable-library-js.5.17.2/lib/big.js +829 -0
  175. package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
  176. package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
  177. package/package.json +2 -2
  178. package/dist/Glutinum.Converter/TypeScript.js +0 -12
  179. package/src/Glutinum.Converter/js/bootstrap.js +0 -123
  180. package/src/Glutinum.Converter/js/host.js +0 -144
  181. package/src/Glutinum.Converter/js/npm.js +0 -137
  182. package/src/Glutinum.Converter/js/resolve.js +0 -402
@@ -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
+
@@ -0,0 +1,200 @@
1
+ namespace FsToolkit.ErrorHandling
2
+
3
+ open System
4
+ open System.Threading.Tasks
5
+
6
+ [<AutoOpen>]
7
+ module ParallelAsyncResultCE =
8
+
9
+ type ParallelAsyncResultBuilder() =
10
+
11
+ member inline _.Return(value: 'ok) : Async<Result<'ok, 'error>> =
12
+ result.Return value
13
+ |> async.Return
14
+
15
+ member inline _.ReturnFrom(input: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
16
+ input
17
+
18
+ member inline _.Zero() : Async<Result<unit, 'error>> =
19
+ result.Zero()
20
+ |> async.Return
21
+
22
+ member inline _.Bind
23
+ (
24
+ asyncResult: Async<Result<'okInput, 'error>>,
25
+ [<InlineIfLambda>] binder: 'okInput -> Async<Result<'okOutput, 'error>>
26
+ ) : Async<Result<'okOutput, 'error>> =
27
+ AsyncResult.bind binder asyncResult
28
+
29
+ member inline _.Delay
30
+ ([<InlineIfLambda>] generator: unit -> Async<Result<'ok, 'error>>)
31
+ : Async<Result<'ok, 'error>> =
32
+ async.Delay generator
33
+
34
+ member inline this.Combine
35
+ (computation1: Async<Result<unit, 'error>>, computation2: Async<Result<'ok, 'error>>)
36
+ : Async<Result<'ok, 'error>> =
37
+ this.Bind(computation1, (fun () -> computation2))
38
+
39
+ member inline _.TryWith
40
+ (
41
+ computation: Async<Result<'ok, 'error>>,
42
+ [<InlineIfLambda>] handler: System.Exception -> Async<Result<'ok, 'error>>
43
+ ) : Async<Result<'ok, 'error>> =
44
+ async.TryWith(computation, handler)
45
+
46
+ member inline _.TryFinally
47
+ (computation: Async<Result<'ok, 'error>>, [<InlineIfLambda>] compensation: unit -> unit)
48
+ : Async<Result<'ok, 'error>> =
49
+ async.TryFinally(computation, compensation)
50
+ #if !FABLE_COMPILER
51
+ member inline _.TryFinallyAsync
52
+ (
53
+ computation: Async<Result<'ok, 'error>>,
54
+ [<InlineIfLambda>] compensation: unit -> ValueTask
55
+ ) : Async<Result<'ok, 'error>> =
56
+ let compensation =
57
+ async {
58
+ let vTask = compensation ()
59
+
60
+ if vTask.IsCompletedSuccessfully then
61
+ return ()
62
+ else
63
+ return!
64
+ vTask.AsTask()
65
+ |> Async.AwaitTask
66
+ }
67
+
68
+ Async.TryFinallyAsync(computation, compensation)
69
+
70
+
71
+ member inline this.Using
72
+ (
73
+ resource: 'ok :> IAsyncDisposable,
74
+ [<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
75
+ ) : Async<Result<'U, 'error>> =
76
+ this.TryFinallyAsync(
77
+ binder resource,
78
+ (fun () ->
79
+ if not (isNull (box resource)) then
80
+ resource.DisposeAsync()
81
+ else
82
+ ValueTask()
83
+ )
84
+ )
85
+ #endif
86
+ member inline this.While
87
+ ([<InlineIfLambda>] guard: unit -> bool, computation: Async<Result<unit, 'error>>)
88
+ : Async<Result<unit, 'error>> =
89
+ if guard () then
90
+ let mutable whileAsync = Unchecked.defaultof<_>
91
+
92
+ whileAsync <-
93
+ this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
94
+
95
+ whileAsync
96
+ else
97
+ this.Zero()
98
+
99
+
100
+ member inline _.BindReturn
101
+ (x: Async<Result<'okInput, 'error>>, [<InlineIfLambda>] f: 'okInput -> 'okOutput)
102
+ : Async<Result<'okOutput, 'error>> =
103
+ AsyncResult.map f x
104
+
105
+ /// <summary>
106
+ /// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
107
+ ///
108
+ /// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
109
+ /// </summary>
110
+ member inline _.Source(result: Async<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
111
+ result
112
+
113
+ member inline _.MergeSources(input1, input2) : Async<Result<'a * 'b, 'error>> =
114
+ ParallelAsyncResult.zip input1 input2
115
+
116
+ let parallelAsyncResult = ParallelAsyncResultBuilder()
117
+
118
+ [<AutoOpen>]
119
+ module MediumPriority =
120
+
121
+ type ParallelAsyncResultBuilder with
122
+
123
+ /// <summary>
124
+ /// Needed to allow `for..in` and `for..do` functionality
125
+ /// </summary>
126
+ member inline _.Source(s: #seq<'value>) : #seq<'value> = s
127
+
128
+ /// <summary>
129
+ /// Method lets us transform data types into our internal representation.
130
+ /// </summary>
131
+ member inline _.Source(result: Result<'ok, 'error>) : Async<Result<'ok, 'error>> =
132
+ Async.singleton result
133
+
134
+ /// <summary>
135
+ /// Method lets us transform data types into our internal representation.
136
+ /// </summary>
137
+ member inline _.Source(choice: Choice<'ok, 'error>) : Async<Result<'ok, 'error>> =
138
+ choice
139
+ |> Result.ofChoice
140
+ |> Async.singleton
141
+
142
+ /// <summary>
143
+ /// Method lets us transform data types into our internal representation.
144
+ /// </summary>
145
+ member inline _.Source(asyncComputation: Async<'ok>) : Async<Result<'ok, 'error>> =
146
+ asyncComputation
147
+ |> Async.map Ok
148
+
149
+
150
+ member inline _.Using
151
+ (
152
+ resource: 'ok :> IDisposableNull,
153
+ [<InlineIfLambda>] binder: 'ok -> Async<Result<'U, 'error>>
154
+ ) : Async<Result<'U, 'error>> =
155
+ async.Using(resource, binder)
156
+
157
+
158
+ member inline this.For
159
+ (sequence: #seq<'ok>, [<InlineIfLambda>] binder: 'ok -> Async<Result<unit, 'error>>)
160
+ : Async<Result<unit, 'error>> =
161
+ this.Using(
162
+ sequence.GetEnumerator(),
163
+ fun enum ->
164
+ this.While(
165
+ (fun () -> enum.MoveNext()),
166
+ this.Delay(fun () -> binder enum.Current)
167
+ )
168
+ )
169
+
170
+ #if !FABLE_COMPILER
171
+ /// <summary>
172
+ /// Method lets us transform data types into our internal representation.
173
+ /// </summary>
174
+ member inline _.Source(task: Task<'ok>) : Async<Result<'ok, 'error>> =
175
+ task
176
+ |> Async.AwaitTask
177
+ |> Async.map Ok
178
+
179
+ /// <summary>
180
+ /// Method lets us transform data types into our internal representation.
181
+ /// </summary>
182
+ member inline _.Source(task: Task) : Async<Result<unit, 'error>> =
183
+ task
184
+ |> Async.AwaitTask
185
+ |> Async.map Ok
186
+ #endif
187
+
188
+ #if !FABLE_COMPILER
189
+ [<AutoOpen>]
190
+ module HighPriority =
191
+
192
+ type ParallelAsyncResultBuilder with
193
+
194
+ /// <summary>
195
+ /// Method lets us transform data types into our internal representation.
196
+ /// </summary>
197
+ member inline _.Source(task: Task<Result<'ok, 'error>>) : Async<Result<'ok, 'error>> =
198
+ task
199
+ |> Async.AwaitTask
200
+ #endif
@@ -0,0 +1,18 @@
1
+
2
+ import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
3
+
4
+ export class ParallelAsyncResultBuilder {
5
+ constructor() {
6
+ }
7
+ }
8
+
9
+ export function ParallelAsyncResultBuilder_$reflection() {
10
+ return class_type("FsToolkit.ErrorHandling.ParallelAsyncResultCE.ParallelAsyncResultBuilder", undefined, ParallelAsyncResultBuilder);
11
+ }
12
+
13
+ export function ParallelAsyncResultBuilder_$ctor() {
14
+ return new ParallelAsyncResultBuilder();
15
+ }
16
+
17
+ export const parallelAsyncResult = ParallelAsyncResultBuilder_$ctor();
18
+
@@ -0,0 +1,34 @@
1
+ namespace FsToolkit.ErrorHandling
2
+
3
+ [<RequireQualifiedAccess>]
4
+ module ParallelAsyncValidation =
5
+
6
+ /// <summary>
7
+ /// Execute two AsyncValidations concurrently and combines the results using the specified function.
8
+ /// Both are run to completion so that all errors are accumulated.
9
+ /// </summary>
10
+ /// <param name="mapper">The function to apply to the values of the AsyncValidation values.</param>
11
+ /// <param name="input1">The first AsyncValidation value to transform.</param>
12
+ /// <param name="input2">The second AsyncValidation value to transform.</param>
13
+ /// <returns>The transformed AsyncValidation value.</returns>
14
+ let inline map2
15
+ ([<InlineIfLambda>] mapper: 'a -> 'b -> 'c)
16
+ (input1: AsyncValidation<'a, 'error>)
17
+ (input2: AsyncValidation<'b, 'error>)
18
+ : AsyncValidation<'c, 'error> =
19
+ Async.parallelMap2
20
+ (fun a b ->
21
+ match a, b with
22
+ | Ok a, Ok b -> Ok(mapper a b)
23
+ | Ok _, Error v -> Error v
24
+ | Error u, Ok _ -> Error u
25
+ | Error u, Error v -> Error(u @ v)
26
+ )
27
+ input1
28
+ input2
29
+
30
+ let inline zip
31
+ (a: AsyncValidation<'a, 'error>)
32
+ (b: AsyncValidation<'b, 'error>)
33
+ : AsyncValidation<'a * 'b, 'error> =
34
+ map2 (fun a b -> a, b) a b
@@ -0,0 +1,244 @@
1
+ namespace FsToolkit.ErrorHandling
2
+
3
+ open System
4
+
5
+ [<AutoOpen>]
6
+ module ParallelAsyncValidationCE =
7
+
8
+ open System.Threading.Tasks
9
+
10
+ type ParallelAsyncValidationBuilder() =
11
+ member inline _.Return(value: 'ok) : AsyncValidation<'ok, 'error> = AsyncValidation.ok value
12
+
13
+ member inline _.ReturnFrom
14
+ (result: AsyncValidation<'ok, 'error>)
15
+ : AsyncValidation<'ok, 'error> =
16
+ result
17
+
18
+ member inline _.Bind
19
+ (
20
+ result: AsyncValidation<'okInput, 'error>,
21
+ [<InlineIfLambda>] binder: 'okInput -> AsyncValidation<'okOutput, 'error>
22
+ ) : AsyncValidation<'okOutput, 'error> =
23
+ AsyncValidation.bind binder result
24
+
25
+ member inline this.Zero() : AsyncValidation<unit, 'error> = this.Return()
26
+
27
+ member inline _.Delay
28
+ ([<InlineIfLambda>] generator: unit -> AsyncValidation<'ok, 'error>)
29
+ : AsyncValidation<'ok, 'error> =
30
+ async.Delay generator
31
+
32
+ member inline this.Combine
33
+ (validation1: AsyncValidation<unit, 'error>, validation2: AsyncValidation<'ok, 'error>)
34
+ : AsyncValidation<'ok, 'error> =
35
+ this.Bind(validation1, (fun () -> validation2))
36
+
37
+ member inline _.TryWith
38
+ (
39
+ computation: AsyncValidation<'ok, 'error>,
40
+ [<InlineIfLambda>] handler: exn -> AsyncValidation<'ok, 'error>
41
+ ) : AsyncValidation<'ok, 'error> =
42
+ async.TryWith(computation, handler)
43
+
44
+ member inline _.TryFinally
45
+ (
46
+ computation: AsyncValidation<'ok, 'error>,
47
+ [<InlineIfLambda>] compensation: unit -> unit
48
+ ) : AsyncValidation<'ok, 'error> =
49
+ async.TryFinally(computation, compensation)
50
+
51
+ member inline _.Using
52
+ (
53
+ resource: 'disposable :> IDisposableNull,
54
+ [<InlineIfLambda>] binder: 'disposable -> AsyncValidation<'okOutput, 'error>
55
+ ) : AsyncValidation<'okOutput, 'error> =
56
+ async.Using(resource, binder)
57
+
58
+ member inline this.While
59
+ ([<InlineIfLambda>] guard: unit -> bool, computation: AsyncValidation<unit, 'error>)
60
+ : AsyncValidation<unit, 'error> =
61
+ if guard () then
62
+ let mutable whileAsync = Unchecked.defaultof<_>
63
+
64
+ whileAsync <-
65
+ this.Bind(computation, (fun () -> if guard () then whileAsync else this.Zero()))
66
+
67
+ whileAsync
68
+ else
69
+ this.Zero()
70
+
71
+
72
+ member inline this.For
73
+ (sequence: #seq<'ok>, [<InlineIfLambda>] binder: 'ok -> AsyncValidation<unit, 'error>)
74
+ : AsyncValidation<unit, 'error> =
75
+ this.Using(
76
+ sequence.GetEnumerator(),
77
+ fun enum -> this.While(enum.MoveNext, this.Delay(fun () -> binder enum.Current))
78
+ )
79
+
80
+ member inline _.BindReturn
81
+ (
82
+ input: AsyncValidation<'okInput, 'error>,
83
+ [<InlineIfLambda>] mapper: 'okInput -> 'okOutput
84
+ ) : AsyncValidation<'okOutput, 'error> =
85
+ AsyncValidation.map mapper input
86
+
87
+ member inline _.MergeSources
88
+ (left: AsyncValidation<'left, 'error>, right: AsyncValidation<'right, 'error>)
89
+ : AsyncValidation<'left * 'right, 'error> =
90
+ ParallelAsyncValidation.zip left right
91
+
92
+ let parallelAsyncValidation = ParallelAsyncValidationBuilder()
93
+
94
+ [<AutoOpen>]
95
+ module LowPriority =
96
+
97
+ type ParallelAsyncValidationBuilder with
98
+
99
+ /// <summary>
100
+ /// Method lets us transform data types into our internal representation.
101
+ /// </summary>
102
+ /// <returns></returns>
103
+ member inline _.Source(a: Async<'ok>) : AsyncValidation<'ok, 'error> =
104
+ async {
105
+ let! result = a
106
+ return! AsyncValidation.ok result
107
+ }
108
+
109
+ /// <summary>
110
+ /// Method lets us transform data types into our internal representation.
111
+ /// </summary>
112
+ member inline _.Source(s: Result<'ok, 'error>) : AsyncValidation<'ok, 'error> =
113
+ AsyncValidation.ofResult s
114
+
115
+ /// <summary>
116
+ /// Method lets us transform data types into our internal representation.
117
+ /// </summary>
118
+ /// <returns></returns>
119
+ member inline _.Source(choice: Choice<'ok, 'error>) : AsyncValidation<'ok, 'error> =
120
+ AsyncValidation.ofChoice choice
121
+
122
+ /// <summary>
123
+ /// Needed to allow `for..in` and `for..do` functionality
124
+ /// </summary>
125
+ member inline _.Source(s: #seq<_>) : #seq<_> = s
126
+
127
+ #if !FABLE_COMPILER
128
+
129
+ /// <summary>
130
+ /// Method lets us transform data types into our internal representation.
131
+ /// </summary>
132
+ member inline _.Source(s: Task<'ok>) : AsyncValidation<'ok, 'error> =
133
+ Async.AwaitTask s
134
+ |> Async.map Result.Ok
135
+
136
+ /// <summary>
137
+ /// Method lets us transform data types into our internal representation.
138
+ /// </summary>
139
+ member inline _.Source(s: Task) : AsyncValidation<unit, 'error> =
140
+ Async.AwaitTask s
141
+ |> Async.map Result.Ok
142
+
143
+ member inline _.TryFinallyAsync
144
+ (
145
+ computation: Async<Result<'ok, 'error>>,
146
+ [<InlineIfLambda>] compensation: unit -> ValueTask
147
+ ) : Async<Result<'ok, 'error>> =
148
+ let compensation =
149
+ async {
150
+ let vTask = compensation ()
151
+
152
+ if vTask.IsCompletedSuccessfully then
153
+ return ()
154
+ else
155
+ return!
156
+ vTask.AsTask()
157
+ |> Async.AwaitTask
158
+ }
159
+
160
+ Async.TryFinallyAsync(computation, compensation)
161
+
162
+
163
+ member inline this.Using
164
+ (
165
+ resource: 'ok :> IAsyncDisposable,
166
+ [<InlineIfLambda>] binder: 'ok -> AsyncValidation<'U, 'error>
167
+ ) : AsyncValidation<'U, 'error> =
168
+ this.TryFinallyAsync(
169
+ binder resource,
170
+ (fun () ->
171
+ if not (isNull (box resource)) then
172
+ resource.DisposeAsync()
173
+ else
174
+ ValueTask()
175
+ )
176
+ )
177
+
178
+ #endif
179
+
180
+ [<AutoOpen>]
181
+ module MediumPriority =
182
+
183
+ type ParallelAsyncValidationBuilder with
184
+
185
+ /// <summary>
186
+ /// Method lets us transform data types into our internal representation.
187
+ /// </summary>
188
+ member inline _.Source(s: Async<Result<'ok, 'error>>) : AsyncValidation<'ok, 'error> =
189
+ AsyncResult.mapError List.singleton s
190
+
191
+ #if !FABLE_COMPILER
192
+
193
+ /// <summary>
194
+ /// Method lets us transform data types into our internal representation.
195
+ /// </summary>
196
+ member inline _.Source(s: Task<Result<'ok, 'error>>) : AsyncValidation<'ok, 'error> =
197
+ Async.AwaitTask s
198
+ |> AsyncResult.mapError List.singleton
199
+
200
+
201
+ #endif
202
+
203
+ [<AutoOpen>]
204
+ module HighPriority =
205
+
206
+ // Having members as extensions gives them lower priority in
207
+ // overload resolution and allows skipping more type annotations.
208
+ type ParallelAsyncValidationBuilder with
209
+
210
+ /// <summary>
211
+ /// Method lets us transform data types into our internal representation.
212
+ /// </summary>
213
+ member inline _.Source(s: Validation<'ok, 'error>) : AsyncValidation<'ok, 'error> =
214
+ Async.singleton s
215
+
216
+ #if !FABLE_COMPILER
217
+
218
+ /// <summary>
219
+ /// Method lets us transform data types into our internal representation.
220
+ /// </summary>
221
+ member inline _.Source
222
+ (result: Task<Validation<'ok, 'error>>)
223
+ : AsyncValidation<'ok, 'error> =
224
+ Async.AwaitTask result
225
+
226
+ #endif
227
+
228
+
229
+ [<AutoOpen>]
230
+ module UltraPriority =
231
+
232
+ type ParallelAsyncValidationBuilder with
233
+
234
+ /// <summary>
235
+ /// Method lets us transform data types into our internal representation. This is the identity method to recognize the self type.
236
+ ///
237
+ /// See https://stackoverflow.com/questions/35286541/why-would-you-use-builder-source-in-a-custom-computation-expression-builder
238
+ /// </summary>
239
+ /// <param name="result"></param>
240
+ /// <returns></returns>
241
+ member inline _.Source
242
+ (result: AsyncValidation<'ok, 'error>)
243
+ : AsyncValidation<'ok, 'error> =
244
+ result
@@ -0,0 +1,18 @@
1
+
2
+ import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
3
+
4
+ export class ParallelAsyncValidationBuilder {
5
+ constructor() {
6
+ }
7
+ }
8
+
9
+ export function ParallelAsyncValidationBuilder_$reflection() {
10
+ return class_type("FsToolkit.ErrorHandling.ParallelAsyncValidationCE.ParallelAsyncValidationBuilder", undefined, ParallelAsyncValidationBuilder);
11
+ }
12
+
13
+ export function ParallelAsyncValidationBuilder_$ctor() {
14
+ return new ParallelAsyncValidationBuilder();
15
+ }
16
+
17
+ export const parallelAsyncValidation = ParallelAsyncValidationBuilder_$ctor();
18
+