@glutinum/cli 0.6.0 → 0.8.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 (146) hide show
  1. package/dist/Glutinum.Converter/FsharpAST.js +44 -12
  2. package/dist/Glutinum.Converter/FsharpAST.js.map +1 -1
  3. package/dist/Glutinum.Converter/GlueAST.js +73 -26
  4. package/dist/Glutinum.Converter/GlueAST.js.map +1 -1
  5. package/dist/Glutinum.Converter/Printer.js +91 -39
  6. package/dist/Glutinum.Converter/Printer.js.map +1 -1
  7. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +4 -4
  8. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +1 -1
  9. package/dist/Glutinum.Converter/Reader/Declaration.js +21 -7
  10. package/dist/Glutinum.Converter/Reader/Declaration.js.map +1 -1
  11. package/dist/Glutinum.Converter/Reader/Documentation.js +65 -22
  12. package/dist/Glutinum.Converter/Reader/Documentation.js.map +1 -1
  13. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +1 -1
  14. package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +1 -1
  15. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -2
  16. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +1 -1
  17. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +1 -1
  18. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +1 -1
  19. package/dist/Glutinum.Converter/Reader/TypeNode.js +32 -29
  20. package/dist/Glutinum.Converter/Reader/TypeNode.js.map +1 -1
  21. package/dist/Glutinum.Converter/Reader/Utils.js +21 -1
  22. package/dist/Glutinum.Converter/Reader/Utils.js.map +1 -1
  23. package/dist/Glutinum.Converter/Reader/VariableStatement.js +8 -3
  24. package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +1 -1
  25. package/dist/Glutinum.Converter/Transform.js +554 -304
  26. package/dist/Glutinum.Converter/Transform.js.map +1 -1
  27. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
  28. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +105 -0
  29. package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
  30. package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
  31. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
  32. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +218 -0
  33. package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
  34. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
  35. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +20 -0
  36. package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
  37. package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +123 -0
  38. package/dist/fable_modules/fable-library-js.4.14.0/Array.js +1242 -0
  39. package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +32 -0
  40. package/dist/fable_modules/fable-library-js.4.14.0/Async.js +158 -0
  41. package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +59 -0
  42. package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.js +183 -0
  43. package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +115 -0
  44. package/dist/fable_modules/fable-library-js.4.14.0/BigInt.js +282 -0
  45. package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +27 -0
  46. package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.js +138 -0
  47. package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +3 -0
  48. package/dist/fable_modules/fable-library-js.4.14.0/Boolean.js +21 -0
  49. package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +37 -0
  50. package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +65 -0
  51. package/dist/fable_modules/fable-library-js.4.14.0/Char.js +169 -0
  52. package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +121 -0
  53. package/dist/fable_modules/fable-library-js.4.14.0/Choice.js +184 -0
  54. package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +70 -0
  55. package/dist/fable_modules/fable-library-js.4.14.0/Date.js +749 -0
  56. package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +63 -0
  57. package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.js +268 -0
  58. package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +18 -0
  59. package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.js +124 -0
  60. package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +45 -0
  61. package/dist/fable_modules/fable-library-js.4.14.0/Decimal.js +212 -0
  62. package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +11 -0
  63. package/dist/fable_modules/fable-library-js.4.14.0/Double.js +46 -0
  64. package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +12 -0
  65. package/dist/fable_modules/fable-library-js.4.14.0/Encoding.js +173 -0
  66. package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +31 -0
  67. package/dist/fable_modules/fable-library-js.4.14.0/Event.js +93 -0
  68. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +7 -0
  69. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +27 -0
  70. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +12 -0
  71. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.js +27 -0
  72. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +17 -0
  73. package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +69 -0
  74. package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +24 -0
  75. package/dist/fable_modules/fable-library-js.4.14.0/Global.js +8 -0
  76. package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +10 -0
  77. package/dist/fable_modules/fable-library-js.4.14.0/Guid.js +142 -0
  78. package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +28 -0
  79. package/dist/fable_modules/fable-library-js.4.14.0/Int32.js +135 -0
  80. package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +143 -0
  81. package/dist/fable_modules/fable-library-js.4.14.0/List.js +1273 -0
  82. package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +3 -0
  83. package/dist/fable_modules/fable-library-js.4.14.0/Long.js +46 -0
  84. package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +25 -0
  85. package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.js +93 -0
  86. package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +178 -0
  87. package/dist/fable_modules/fable-library-js.4.14.0/Map.js +1396 -0
  88. package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +10 -0
  89. package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.js +112 -0
  90. package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +52 -0
  91. package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.js +327 -0
  92. package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +39 -0
  93. package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.js +233 -0
  94. package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +2 -0
  95. package/dist/fable_modules/fable-library-js.4.14.0/Native.js +8 -0
  96. package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +19 -0
  97. package/dist/fable_modules/fable-library-js.4.14.0/Numeric.js +71 -0
  98. package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +32 -0
  99. package/dist/fable_modules/fable-library-js.4.14.0/Observable.js +113 -0
  100. package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +28 -0
  101. package/dist/fable_modules/fable-library-js.4.14.0/Option.js +96 -0
  102. package/dist/fable_modules/fable-library-js.4.14.0/README.md +3 -0
  103. package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +37 -0
  104. package/dist/fable_modules/fable-library-js.4.14.0/Random.js +170 -0
  105. package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +12 -0
  106. package/dist/fable_modules/fable-library-js.4.14.0/Range.js +45 -0
  107. package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +119 -0
  108. package/dist/fable_modules/fable-library-js.4.14.0/Reflection.js +461 -0
  109. package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +10 -0
  110. package/dist/fable_modules/fable-library-js.4.14.0/RegExp.js +132 -0
  111. package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +37 -0
  112. package/dist/fable_modules/fable-library-js.4.14.0/Result.js +165 -0
  113. package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +165 -0
  114. package/dist/fable_modules/fable-library-js.4.14.0/Seq.js +1379 -0
  115. package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +18 -0
  116. package/dist/fable_modules/fable-library-js.4.14.0/Seq2.js +111 -0
  117. package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +190 -0
  118. package/dist/fable_modules/fable-library-js.4.14.0/Set.js +1789 -0
  119. package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +50 -0
  120. package/dist/fable_modules/fable-library-js.4.14.0/String.js +543 -0
  121. package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +79 -0
  122. package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.js +317 -0
  123. package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +38 -0
  124. package/dist/fable_modules/fable-library-js.4.14.0/System.Text.js +162 -0
  125. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +5 -0
  126. package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +5 -0
  127. package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +15 -0
  128. package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.js +122 -0
  129. package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +34 -0
  130. package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.js +177 -0
  131. package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +19 -0
  132. package/dist/fable_modules/fable-library-js.4.14.0/Timer.js +67 -0
  133. package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +58 -0
  134. package/dist/fable_modules/fable-library-js.4.14.0/Types.js +208 -0
  135. package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +2 -0
  136. package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.js +4 -0
  137. package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +29 -0
  138. package/dist/fable_modules/fable-library-js.4.14.0/Uri.js +142 -0
  139. package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +207 -0
  140. package/dist/fable_modules/fable-library-js.4.14.0/Util.js +770 -0
  141. package/dist/fable_modules/fable-library-js.4.14.0/big.d.ts +338 -0
  142. package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +5 -0
  143. package/dist/fable_modules/fable-library-js.4.14.0/lib/big.js +826 -0
  144. package/dist/fable_modules/fable-library-js.4.14.0/package.json +24 -0
  145. package/dist/fable_modules/project_cracked.json +1 -0
  146. package/package.json +1 -1
@@ -0,0 +1,218 @@
1
+ import { Result_MapError, Result_Map, FSharpResult$2 } from "../fable-library-js.4.14.0/Result.js";
2
+ import { class_type } from "../fable-library-js.4.14.0/Reflection.js";
3
+ import { disposeSafe, getEnumerator } from "../fable-library-js.4.14.0/Util.js";
4
+
5
+ /**
6
+ * This is an identity function, it calls the given function and return the promise value untouched.
7
+ * <example>
8
+ * <code lang="fsharp">
9
+ * fetchUser ()
10
+ * |> Promise.tap (fun user ->
11
+ * // Do something
12
+ * console.log "The user has been received"
13
+ * )
14
+ * |> Promise.map (fun user ->
15
+ * // user value is available here untouched
16
+ * )
17
+ * </code>
18
+ * </example>
19
+ */
20
+ export function tap(fn, a) {
21
+ return a.then((x) => {
22
+ fn(x);
23
+ return x;
24
+ });
25
+ }
26
+
27
+ /**
28
+ * Map the <c>Promise</c> result into a <c>Result</c> type.
29
+ * <example>
30
+ * <code lang="fsharp">
31
+ * Success example
32
+ * Promise.lift 42
33
+ * |> Promise.result
34
+ * |> Promise.map (fun value ->
35
+ * // value = Ok 42
36
+ * )
37
+ *
38
+ * // Fail example
39
+ * Promise.reject "Invalid value"
40
+ * |> Promise.result
41
+ * |> Promise.map (fun value ->
42
+ * // value = Error "Invalid value"
43
+ * )
44
+ * </code>
45
+ * </example>
46
+ */
47
+ export function result(a) {
48
+ return a.then((ResultValue) => (new FSharpResult$2(0, [ResultValue]))).catch((ErrorValue) => (new FSharpResult$2(1, [ErrorValue])));
49
+ }
50
+
51
+ /**
52
+ * Evaluates to `myPromise |> Promise.map (Result.map fn)`
53
+ * <example>
54
+ * <code lang="fsharp">
55
+ * Promise.lift 42
56
+ * |> Promise.result
57
+ * |> Promise.mapResult (fun value ->
58
+ * value + 10
59
+ * )
60
+ * |> Promise.map (fun value ->
61
+ * // value = Ok 52
62
+ * )
63
+ * </code>
64
+ * </example>
65
+ */
66
+ export function mapResult(fn, a) {
67
+ return a.then((result_1) => Result_Map(fn, result_1));
68
+ }
69
+
70
+ /**
71
+ * Transform the success part of a result promise into another promise.
72
+ * <example>
73
+ * <code lang="fsharp">
74
+ * let multiplyBy2 (value : int) =
75
+ * Promise.create (fun resolve reject ->
76
+ * resolve (value * 2)
77
+ * )
78
+ *
79
+ * Promise.lift 42
80
+ * |> Promise.result
81
+ * |> Promise.bindResult (fun value ->
82
+ * multiplyBy2 value
83
+ * )
84
+ * |> Promise.map (fun value ->
85
+ * // value = Ok 84
86
+ * )
87
+ * </code>
88
+ * </example>
89
+ */
90
+ export function bindResult(fn, a) {
91
+ return a.then((a_1) => {
92
+ if (a_1.tag === 1) {
93
+ return Promise.resolve(new FSharpResult$2(1, [a_1.fields[0]]));
94
+ }
95
+ else {
96
+ const pr = fn(a_1.fields[0]);
97
+ return pr.then((ResultValue) => (new FSharpResult$2(0, [ResultValue])));
98
+ }
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Evaluates to <c>myPromise |> Promise.map (Result.map fn)</c>
104
+ * <example>
105
+ * <code lang="fsharp">
106
+ * Promise.reject -1
107
+ * |> Promise.result
108
+ * |> Promise.mapResultError (fun value ->
109
+ * $"%s{value} is not a valid value"
110
+ * )
111
+ * |> Promise.map (fun value ->
112
+ * // value = Error "-1 is not a valid value"
113
+ * )
114
+ * </code>
115
+ * </example>
116
+ */
117
+ export function mapResultError(fn, a) {
118
+ return a.then((result_1) => Result_MapError(fn, result_1));
119
+ }
120
+
121
+ export class PromiseBuilder {
122
+ constructor() {
123
+ }
124
+ }
125
+
126
+ export function PromiseBuilder_$reflection() {
127
+ return class_type("Promise.PromiseBuilder", void 0, PromiseBuilder);
128
+ }
129
+
130
+ export function PromiseBuilder_$ctor() {
131
+ return new PromiseBuilder();
132
+ }
133
+
134
+ export function PromiseBuilder__For_1565554B(_, seq, body) {
135
+ let pr;
136
+ let p = Promise.resolve(void 0);
137
+ const enumerator = getEnumerator(seq);
138
+ try {
139
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
140
+ const a = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
141
+ p = ((pr = p, pr.then(() => body(a))));
142
+ }
143
+ }
144
+ finally {
145
+ disposeSafe(enumerator);
146
+ }
147
+ return p;
148
+ }
149
+
150
+ export function PromiseBuilder__While_2044D34(this$, guard, p) {
151
+ if (guard()) {
152
+ return p.then(() => PromiseBuilder__While_2044D34(this$, guard, p));
153
+ }
154
+ else {
155
+ return Promise.resolve(void 0);
156
+ }
157
+ }
158
+
159
+ export function PromiseBuilder__TryFinally_7D49A2FD(_, p, compensation) {
160
+ return p.then((x) => {
161
+ compensation();
162
+ return x;
163
+ }).catch((er) => {
164
+ compensation();
165
+ throw er;
166
+ });
167
+ }
168
+
169
+ export function PromiseBuilder__Delay_62FBFDE1(_, generator) {
170
+ return {
171
+ then: (onSuccess, onError) => {
172
+ try {
173
+ return generator().then(onSuccess, onError);
174
+ }
175
+ catch (er) {
176
+ if (onError == null) {
177
+ return Promise.reject(er);
178
+ }
179
+ else {
180
+ try {
181
+ const a = onError(er);
182
+ return Promise.resolve(a);
183
+ }
184
+ catch (er_1) {
185
+ return Promise.reject(er_1);
186
+ }
187
+ }
188
+ }
189
+ },
190
+ catch: (onError_1) => {
191
+ try {
192
+ return generator().catch(onError_1);
193
+ }
194
+ catch (er_2) {
195
+ try {
196
+ const a_1 = onError_1(er_2);
197
+ return Promise.resolve(a_1);
198
+ }
199
+ catch (er_3) {
200
+ return Promise.reject(er_3);
201
+ }
202
+ }
203
+ },
204
+ };
205
+ }
206
+
207
+ export function PromiseBuilder__Run_212F1D4B(_, p) {
208
+ return p.then((x) => x);
209
+ }
210
+
211
+ export function PromiseBuilder__Using_74F7E79D(this$, resource, binder) {
212
+ return PromiseBuilder__TryFinally_7D49A2FD(this$, binder(resource), () => {
213
+ let copyOfStruct = resource;
214
+ disposeSafe(copyOfStruct);
215
+ });
216
+ }
217
+
218
+ //# sourceMappingURL=Promise.fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["./Promise.fs"],"names":["a","fn","x","ResultValue","ErrorValue","result","pr","p","enumerator","seq","body","guard","While","this","compensation","er","generator","onSuccess","onError","TryFinally","binder","resource","copyOfStruct"],"mappings":";;;;;;;;;;;;;;;;;;;;WA4LS,AAALA;AAAmB,AAAAC,WAAGC;eAAGA;;;;;;;;;;;;;;;;;;;;;;;;;WA6YzB,AAAgBF,yBAAT,uBAAAG,uCAAG,uBAAAC;;;;;;;;;;;;;;;;;;;WAwBL,AAALJ,qBAAU,WAAAC,IAAAI;;;;;;;;;;;;;;;;;;;;;;;;WA8BL,AAALL;AACU,YAAA,AAAAA;AAIF,mBAAA,gBAAM,uBAAN,AAAAA;;;AAFQM,uBAAR,AAAAL,GAAA,AAAAD;AAAQ,mBAAA,AAAAM,0BAAI,uBAAAH;;;;;;;;;;;;;;;;;;;;;WA0Bf,AAALH,qBAAU,gBAAAC,IAAAI;;;;;;;;;;;;;;;;;QA4BQC;AAFFC,YAAI,gBAAK;AACZC,uBAAA,cAAAC;AAAT;AAAA,eAAS,AAAAD;AAALR,sBAAK,AAAAQ;AACL,AAAAD,kBAAUD,KAALC,GAAK,AAAAD,cAAgB,AAAAI,KAAKV;;;;AADnC,oBAASQ;;WAETD;;;;AAMA,QAAG,AAAAI;AACE,eAAA,AAAsCJ,aAAtB,AAAAK,8BAAAC,OAAWF,OAAOJ;;;AAClC,eAAA,gBAAI;;;;;WAYT,AAA\u002BEA;AAAxD,AAAAO;eAAgBZ;;AAAc,AAAAY;AAAgB,cAAMC;;;;;;;AAUnE;AAAI,uBAAA,AAAAC,iBAAqBC,WAAWC;;;AAEhC,oBAAG,AAAWA;AAAc,2BAAA,eAAOH;;;AAE/B;AAAkBf,kCAAd,AAAAkB,QAAQH;AAAM,\u002BBAAA,gBAAAf;;;AACP,\u002BBAAA,eAAOe;;;;;;AAE1B;AAAI,uBAAA,AAAAC,kBAAkBE;;;AAElB;AAAkBlB,gCAAd,AAAAkB,UAAQH;AAAM,2BAAA,gBAAAf;;;AACP,2BAAA,eAAOe;;;;;;;;WAIe,AAAAR,cAAWL;;;;WAGxD,AAAAiB,oCAAAN,OAAgB,AAAAO,OAAOC;AAAqBC,2BAAAD;AAAA,oBAAAC","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,31 @@
1
+ [<AutoOpen>]
2
+ module PromiseImpl
3
+
4
+ let promise = Promise.PromiseBuilder()
5
+
6
+ [<RequireQualifiedAccess>]
7
+ module SettledValue =
8
+
9
+ /// <summary>
10
+ /// Helper functionm to convert a settled result into an F# result
11
+ /// </summary>
12
+ /// <param name="p">The settled result</param>
13
+ /// <typeparam name="'T"></typeparam>
14
+ /// <returns>The F# result</returns>
15
+ /// <example>
16
+ /// <code lang="fsharp">
17
+ /// Promise.allSettled [success; rejection]
18
+ /// |> Promise.iter (fun results ->
19
+ /// for result in results do
20
+ /// match SettledValue.toResult result with
21
+ /// | Ok value ->
22
+ /// printfn "Success: %A" value
23
+ /// | Error err ->
24
+ /// eprintfn "Error: %O" err
25
+ /// )
26
+ /// </code>
27
+ /// </example>
28
+ let toResult (p: Promise.SettledValue<'T>) =
29
+ match p.status with
30
+ | Promise.Fulfilled -> Ok p.value.Value
31
+ | Promise.Rejected -> Error p.reason.Value
@@ -0,0 +1,20 @@
1
+ import { PromiseBuilder_$ctor } from "./Promise.fs.js";
2
+ import { value } from "../fable-library-js.4.14.0/Option.js";
3
+ import { FSharpResult$2 } from "../fable-library-js.4.14.0/Result.js";
4
+
5
+ export const promise = PromiseBuilder_$ctor();
6
+
7
+ /**
8
+ * Helper functionm to convert a settled result into an F# result
9
+ */
10
+ export function SettledValue_toResult(p) {
11
+ const matchValue = p.status;
12
+ if (matchValue === "rejected") {
13
+ return new FSharpResult$2(1, [value(p.reason)]);
14
+ }
15
+ else {
16
+ return new FSharpResult$2(0, [value(p.value)]);
17
+ }
18
+ }
19
+
20
+ //# sourceMappingURL=PromiseImpl.fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["./PromiseImpl.fs"],"names":["matchValue","p"],"mappings":";;;;uBAGc;;;;;;AAyBAA,uBAAA,AAAAC;AAAA,QAAA,AAAAD;AAEgB,eAAA,uBAAM,MAAA,AAAAC;;;AADL,eAAA,uBAAG,MAAA,AAAAA","file":null,"sourcesContent":null,"sourceRoot":null}
@@ -0,0 +1,123 @@
1
+ import { int32 } from "./Int32.js";
2
+ import { Option } from "./Option.js";
3
+ import { IComparer, IEqualityComparer } from "./Util.js";
4
+ import { FSharpRef } from "./Types.js";
5
+ export declare function append<T>(array1: T[], array2: T[], cons?: any): T[];
6
+ export declare function filter<T>(predicate: ((arg0: T) => boolean), array: T[]): T[];
7
+ export declare function fill<T>(target: T[], targetIndex: int32, count: int32, value: T): T[];
8
+ export declare function getSubArray<T>(array: T[], start: int32, count: int32): T[];
9
+ export declare function last<T>(array: T[]): T;
10
+ export declare function tryLast<T>(array: T[]): Option<T>;
11
+ export declare function mapIndexed<T, U>(f: ((arg0: int32, arg1: T) => U), source: T[], cons?: any): U[];
12
+ export declare function map<T, U>(f: ((arg0: T) => U), source: T[], cons?: any): U[];
13
+ export declare function mapIndexed2<T1, T2, U>(f: ((arg0: int32, arg1: T1, arg2: T2) => U), source1: T1[], source2: T2[], cons?: any): U[];
14
+ export declare function map2<T1, T2, U>(f: ((arg0: T1, arg1: T2) => U), source1: T1[], source2: T2[], cons?: any): U[];
15
+ export declare function mapIndexed3<T1, T2, T3, U>(f: ((arg0: int32, arg1: T1, arg2: T2, arg3: T3) => U), source1: T1[], source2: T2[], source3: T3[], cons?: any): U[];
16
+ export declare function map3<T1, T2, T3, U>(f: ((arg0: T1, arg1: T2, arg2: T3) => U), source1: T1[], source2: T2[], source3: T3[], cons?: any): U[];
17
+ export declare function mapFold<T, State, Result>(mapping: ((arg0: State, arg1: T) => [Result, State]), state: State, array: T[], cons?: any): [Result[], State];
18
+ export declare function mapFoldBack<T, State, Result>(mapping: ((arg0: T, arg1: State) => [Result, State]), array: T[], state: State, cons?: any): [Result[], State];
19
+ export declare function indexed<T>(source: T[]): [int32, T][];
20
+ export declare function truncate<T>(count: int32, array: T[]): T[];
21
+ export declare function concat<T>(arrays: Iterable<T[]>, cons?: any): T[];
22
+ export declare function collect<T, U>(mapping: ((arg0: T) => U[]), array: T[], cons?: any): U[];
23
+ export declare function where<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): $a[];
24
+ export declare function indexOf<T>(array: T[], item_1: T, start: Option<int32>, count: Option<int32>, eq: IEqualityComparer<T>): int32;
25
+ export declare function contains<T>(value: T, array: T[], eq: IEqualityComparer<T>): boolean;
26
+ export declare function empty<$a>(cons: any): $a[];
27
+ export declare function singleton<T>(value: T, cons?: any): T[];
28
+ export declare function initialize<T>(count: int32, initializer: ((arg0: int32) => T), cons?: any): T[];
29
+ export declare function pairwise<T>(array: T[]): [T, T][];
30
+ export declare function replicate<T>(count: int32, initial: T, cons?: any): T[];
31
+ export declare function copy<T>(array: T[]): T[];
32
+ export declare function copyTo<T>(source: T[], sourceIndex: int32, target: T[], targetIndex: int32, count: int32): void;
33
+ export declare function reverse<T>(array: T[]): T[];
34
+ export declare function scan<T, State>(folder: ((arg0: State, arg1: T) => State), state: State, array: T[], cons?: any): State[];
35
+ export declare function scanBack<T, State>(folder: ((arg0: T, arg1: State) => State), array: T[], state: State, cons?: any): State[];
36
+ export declare function skip<T>(count: int32, array: T[], cons?: any): T[];
37
+ export declare function skipWhile<T>(predicate: ((arg0: T) => boolean), array: T[], cons?: any): T[];
38
+ export declare function take<T>(count: int32, array: T[], cons?: any): T[];
39
+ export declare function takeWhile<T>(predicate: ((arg0: T) => boolean), array: T[], cons?: any): T[];
40
+ export declare function addInPlace<T>(x: T, array: T[]): void;
41
+ export declare function addRangeInPlace<T>(range: Iterable<T>, array: T[]): void;
42
+ export declare function insertRangeInPlace<T>(index: int32, range: Iterable<T>, array: T[]): void;
43
+ export declare function removeInPlace<T>(item_1: T, array: T[], eq: IEqualityComparer<T>): boolean;
44
+ export declare function removeAllInPlace<T>(predicate: ((arg0: T) => boolean), array: T[]): int32;
45
+ export declare function partition<T>(f: ((arg0: T) => boolean), source: T[], cons?: any): [T[], T[]];
46
+ export declare function find<T>(predicate: ((arg0: T) => boolean), array: T[]): T;
47
+ export declare function tryFind<T>(predicate: ((arg0: T) => boolean), array: T[]): Option<T>;
48
+ export declare function findIndex<T>(predicate: ((arg0: T) => boolean), array: T[]): int32;
49
+ export declare function tryFindIndex<T>(predicate: ((arg0: T) => boolean), array: T[]): Option<int32>;
50
+ export declare function pick<$a, $b>(chooser: ((arg0: $a) => Option<$b>), array: $a[]): $b;
51
+ export declare function tryPick<$a, $b>(chooser: ((arg0: $a) => Option<$b>), array: $a[]): Option<$b>;
52
+ export declare function findBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): $a;
53
+ export declare function tryFindBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): Option<$a>;
54
+ export declare function findLastIndex<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): int32;
55
+ export declare function findIndexBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): int32;
56
+ export declare function tryFindIndexBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): Option<int32>;
57
+ export declare function choose<T, U>(chooser: ((arg0: T) => Option<U>), array: T[], cons?: any): U[];
58
+ export declare function foldIndexed<T, State>(folder: ((arg0: int32, arg1: State, arg2: T) => State), state: State, array: T[]): State;
59
+ export declare function fold<T, State>(folder: ((arg0: State, arg1: T) => State), state: State, array: T[]): State;
60
+ export declare function iterate<T>(action: ((arg0: T) => void), array: T[]): void;
61
+ export declare function iterateIndexed<T>(action: ((arg0: int32, arg1: T) => void), array: T[]): void;
62
+ export declare function iterate2<T1, T2>(action: ((arg0: T1, arg1: T2) => void), array1: T1[], array2: T2[]): void;
63
+ export declare function iterateIndexed2<T1, T2>(action: ((arg0: int32, arg1: T1, arg2: T2) => void), array1: T1[], array2: T2[]): void;
64
+ export declare function isEmpty<T>(array: T[]): boolean;
65
+ export declare function forAll<T>(predicate: ((arg0: T) => boolean), array: T[]): boolean;
66
+ export declare function permute<T>(f: ((arg0: int32) => int32), array: T[]): T[];
67
+ export declare function setSlice<T>(target: T[], lower: Option<int32>, upper: Option<int32>, source: T[]): void;
68
+ export declare function sortInPlaceBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): void;
69
+ export declare function sortInPlace<T>(xs: T[], comparer: IComparer<T>): void;
70
+ export declare function sort<T>(xs: T[], comparer: IComparer<T>): T[];
71
+ export declare function sortBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a[];
72
+ export declare function sortDescending<T>(xs: T[], comparer: IComparer<T>): T[];
73
+ export declare function sortByDescending<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a[];
74
+ export declare function sortWith<T>(comparer: ((arg0: T, arg1: T) => int32), xs: T[]): T[];
75
+ export declare function allPairs<T1, T2>(xs: T1[], ys: T2[]): [T1, T2][];
76
+ export declare function unfold<T, State>(generator: ((arg0: State) => Option<[T, State]>), state: State): T[];
77
+ export declare function unzip<$a, $b>(array: [$a, $b][]): [$a[], $b[]];
78
+ export declare function unzip3<$a, $b, $c>(array: [$a, $b, $c][]): [$a[], $b[], $c[]];
79
+ export declare function zip<T, U>(array1: T[], array2: U[]): [T, U][];
80
+ export declare function zip3<T, U, V>(array1: T[], array2: U[], array3: V[]): [T, U, V][];
81
+ export declare function chunkBySize<T>(chunkSize: int32, array: T[]): T[][];
82
+ export declare function splitAt<T>(index: int32, array: T[]): [T[], T[]];
83
+ export declare function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
84
+ export declare function compareTo<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
85
+ export declare function equalsWith<T>(equals: ((arg0: T, arg1: T) => boolean), array1: T[], array2: T[]): boolean;
86
+ export declare function exactlyOne<T>(array: T[]): T;
87
+ export declare function tryExactlyOne<T>(array: T[]): Option<T>;
88
+ export declare function head<T>(array: T[]): T;
89
+ export declare function tryHead<T>(array: T[]): Option<T>;
90
+ export declare function tail<T>(array: T[]): T[];
91
+ export declare function item<T>(index: int32, array: T[]): T;
92
+ export declare function setItem<T>(array: T[], index: int32, value: T): void;
93
+ export declare function tryItem<T>(index: int32, array: T[]): Option<T>;
94
+ export declare function foldBackIndexed<T, State>(folder: ((arg0: int32, arg1: T, arg2: State) => State), array: T[], state: State): State;
95
+ export declare function foldBack<T, State>(folder: ((arg0: T, arg1: State) => State), array: T[], state: State): State;
96
+ export declare function foldIndexed2<$a, $b, $c>(folder: ((arg0: int32, arg1: $a, arg2: $b, arg3: $c) => $a), state: $a, array1: $b[], array2: $c[]): $a;
97
+ export declare function fold2<T1, T2, State>(folder: ((arg0: State, arg1: T1, arg2: T2) => State), state: State, array1: T1[], array2: T2[]): State;
98
+ export declare function foldBackIndexed2<T1, T2, State>(folder: ((arg0: int32, arg1: T1, arg2: T2, arg3: State) => State), array1: T1[], array2: T2[], state: State): State;
99
+ export declare function foldBack2<T1, T2, State>(f: ((arg0: T1, arg1: T2, arg2: State) => State), array1: T1[], array2: T2[], state: State): State;
100
+ export declare function reduce<T>(reduction: ((arg0: T, arg1: T) => T), array: T[]): T;
101
+ export declare function reduceBack<T>(reduction: ((arg0: T, arg1: T) => T), array: T[]): T;
102
+ export declare function forAll2<$a, $b>(predicate: ((arg0: $a, arg1: $b) => boolean), array1: $a[], array2: $b[]): boolean;
103
+ export declare function existsOffset<T>(predicate_mut: ((arg0: T) => boolean), array_mut: T[], index_mut: int32): boolean;
104
+ export declare function exists<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): boolean;
105
+ export declare function existsOffset2<$a, $b>(predicate_mut: ((arg0: $a, arg1: $b) => boolean), array1_mut: $a[], array2_mut: $b[], index_mut: int32): boolean;
106
+ export declare function exists2<$a, $b>(predicate: ((arg0: $a, arg1: $b) => boolean), array1: $a[], array2: $b[]): boolean;
107
+ export declare function sum<T>(array: T[], adder: any): T;
108
+ export declare function sumBy<T, T2>(projection: ((arg0: T) => T2), array: T[], adder: any): T2;
109
+ export declare function maxBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a;
110
+ export declare function max<a>(xs: a[], comparer: IComparer<a>): a;
111
+ export declare function minBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a;
112
+ export declare function min<a>(xs: a[], comparer: IComparer<a>): a;
113
+ export declare function average<T>(array: T[], averager: any): T;
114
+ export declare function averageBy<T, T2>(projection: ((arg0: T) => T2), array: T[], averager: any): T2;
115
+ export declare function windowed<T>(windowSize: int32, source: T[]): T[][];
116
+ export declare function splitInto<T>(chunks: int32, array: T[]): T[][];
117
+ export declare function transpose<T>(arrays: Iterable<T[]>, cons?: any): T[][];
118
+ export declare function insertAt<T>(index: int32, y: T, xs: T[], cons?: any): T[];
119
+ export declare function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: T[], cons?: any): T[];
120
+ export declare function removeAt<T>(index: int32, xs: T[]): T[];
121
+ export declare function removeManyAt<T>(index: int32, count: int32, xs: T[]): T[];
122
+ export declare function updateAt<T>(index: int32, y: T, xs: T[], cons?: any): T[];
123
+ export declare function resize<T>(xs: FSharpRef<T[]>, newSize: int32, zero?: Option<T>, cons?: any): void;