compostjs 0.0.8 → 0.0.12

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 (141) hide show
  1. package/README.md +4 -4
  2. package/dist/fable_modules/fable-library-js.4.28.0/Array.d.ts +123 -0
  3. package/dist/fable_modules/fable-library-js.4.28.0/Array.js +1242 -0
  4. package/dist/fable_modules/fable-library-js.4.28.0/Async.d.ts +26 -0
  5. package/dist/fable_modules/fable-library-js.4.28.0/Async.js +145 -0
  6. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.d.ts +59 -0
  7. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.js +183 -0
  8. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.d.ts +115 -0
  9. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.js +283 -0
  10. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.d.ts +27 -0
  11. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.js +138 -0
  12. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.d.ts +3 -0
  13. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.js +21 -0
  14. package/dist/fable_modules/fable-library-js.4.28.0/CHANGELOG.md +100 -0
  15. package/dist/fable_modules/fable-library-js.4.28.0/Char.d.ts +65 -0
  16. package/dist/fable_modules/fable-library-js.4.28.0/Char.js +169 -0
  17. package/dist/fable_modules/fable-library-js.4.28.0/Choice.d.ts +121 -0
  18. package/dist/fable_modules/fable-library-js.4.28.0/Choice.js +184 -0
  19. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.d.ts +7 -0
  20. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.js +182 -0
  21. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.d.ts +9 -0
  22. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.js +21 -0
  23. package/dist/fable_modules/fable-library-js.4.28.0/Date.d.ts +70 -0
  24. package/dist/fable_modules/fable-library-js.4.28.0/Date.js +748 -0
  25. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.d.ts +63 -0
  26. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.js +268 -0
  27. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.d.ts +18 -0
  28. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.js +124 -0
  29. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.d.ts +45 -0
  30. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.js +212 -0
  31. package/dist/fable_modules/fable-library-js.4.28.0/Double.d.ts +11 -0
  32. package/dist/fable_modules/fable-library-js.4.28.0/Double.js +46 -0
  33. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.d.ts +12 -0
  34. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.js +173 -0
  35. package/dist/fable_modules/fable-library-js.4.28.0/Event.d.ts +31 -0
  36. package/dist/fable_modules/fable-library-js.4.28.0/Event.js +93 -0
  37. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.d.ts +7 -0
  38. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.js +27 -0
  39. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.d.ts +12 -0
  40. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.js +27 -0
  41. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.d.ts +17 -0
  42. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.js +69 -0
  43. package/dist/fable_modules/fable-library-js.4.28.0/Global.d.ts +24 -0
  44. package/dist/fable_modules/fable-library-js.4.28.0/Global.js +8 -0
  45. package/dist/fable_modules/fable-library-js.4.28.0/Guid.d.ts +10 -0
  46. package/dist/fable_modules/fable-library-js.4.28.0/Guid.js +142 -0
  47. package/dist/fable_modules/fable-library-js.4.28.0/Int32.d.ts +28 -0
  48. package/dist/fable_modules/fable-library-js.4.28.0/Int32.js +135 -0
  49. package/dist/fable_modules/fable-library-js.4.28.0/List.d.ts +143 -0
  50. package/dist/fable_modules/fable-library-js.4.28.0/List.js +1273 -0
  51. package/dist/fable_modules/fable-library-js.4.28.0/Long.d.ts +3 -0
  52. package/dist/fable_modules/fable-library-js.4.28.0/Long.js +46 -0
  53. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.d.ts +25 -0
  54. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.js +93 -0
  55. package/dist/fable_modules/fable-library-js.4.28.0/Map.d.ts +178 -0
  56. package/dist/fable_modules/fable-library-js.4.28.0/Map.js +1396 -0
  57. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.d.ts +12 -0
  58. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.js +127 -0
  59. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.d.ts +52 -0
  60. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.js +327 -0
  61. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.d.ts +39 -0
  62. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.js +233 -0
  63. package/dist/fable_modules/fable-library-js.4.28.0/Native.d.ts +2 -0
  64. package/dist/fable_modules/fable-library-js.4.28.0/Native.js +8 -0
  65. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.d.ts +19 -0
  66. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.js +71 -0
  67. package/dist/fable_modules/fable-library-js.4.28.0/Observable.d.ts +32 -0
  68. package/dist/fable_modules/fable-library-js.4.28.0/Observable.js +113 -0
  69. package/dist/fable_modules/fable-library-js.4.28.0/Option.d.ts +28 -0
  70. package/dist/fable_modules/fable-library-js.4.28.0/Option.js +96 -0
  71. package/dist/fable_modules/fable-library-js.4.28.0/README.md +3 -0
  72. package/dist/fable_modules/fable-library-js.4.28.0/Random.d.ts +37 -0
  73. package/dist/fable_modules/fable-library-js.4.28.0/Random.js +170 -0
  74. package/dist/fable_modules/fable-library-js.4.28.0/Range.d.ts +12 -0
  75. package/dist/fable_modules/fable-library-js.4.28.0/Range.js +45 -0
  76. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.d.ts +119 -0
  77. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.js +461 -0
  78. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.d.ts +10 -0
  79. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.js +131 -0
  80. package/dist/fable_modules/fable-library-js.4.28.0/Result.d.ts +37 -0
  81. package/dist/fable_modules/fable-library-js.4.28.0/Result.js +165 -0
  82. package/dist/fable_modules/fable-library-js.4.28.0/Seq.d.ts +165 -0
  83. package/dist/fable_modules/fable-library-js.4.28.0/Seq.js +1378 -0
  84. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.d.ts +18 -0
  85. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.js +111 -0
  86. package/dist/fable_modules/fable-library-js.4.28.0/Set.d.ts +190 -0
  87. package/dist/fable_modules/fable-library-js.4.28.0/Set.js +1789 -0
  88. package/dist/fable_modules/fable-library-js.4.28.0/String.d.ts +58 -0
  89. package/dist/fable_modules/fable-library-js.4.28.0/String.js +554 -0
  90. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.d.ts +79 -0
  91. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.js +317 -0
  92. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.d.ts +38 -0
  93. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.js +162 -0
  94. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.d.ts +5 -0
  95. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.js +5 -0
  96. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.d.ts +15 -0
  97. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.js +122 -0
  98. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.d.ts +34 -0
  99. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.js +177 -0
  100. package/dist/fable_modules/fable-library-js.4.28.0/Timer.d.ts +19 -0
  101. package/dist/fable_modules/fable-library-js.4.28.0/Timer.js +67 -0
  102. package/dist/fable_modules/fable-library-js.4.28.0/Types.d.ts +58 -0
  103. package/dist/fable_modules/fable-library-js.4.28.0/Types.js +208 -0
  104. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.d.ts +2 -0
  105. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.js +4 -0
  106. package/dist/fable_modules/fable-library-js.4.28.0/Uri.d.ts +31 -0
  107. package/dist/fable_modules/fable-library-js.4.28.0/Uri.js +159 -0
  108. package/dist/fable_modules/fable-library-js.4.28.0/Util.d.ts +210 -0
  109. package/dist/fable_modules/fable-library-js.4.28.0/Util.js +769 -0
  110. package/dist/fable_modules/fable-library-js.4.28.0/big.d.ts +338 -0
  111. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.d.ts +5 -0
  112. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.js +825 -0
  113. package/dist/fable_modules/fable-library-js.4.28.0/package.json +24 -0
  114. package/dist/fable_modules/project_cracked.json +1 -0
  115. package/package.json +6 -5
  116. package/.claude/settings.local.json +0 -11
  117. package/dist/fable-library.2.10.1/Array.js +0 -1336
  118. package/dist/fable-library.2.10.1/Async.js +0 -121
  119. package/dist/fable-library.2.10.1/AsyncBuilder.js +0 -200
  120. package/dist/fable-library.2.10.1/Date.js +0 -501
  121. package/dist/fable-library.2.10.1/Decimal.js +0 -208
  122. package/dist/fable-library.2.10.1/Event.js +0 -193
  123. package/dist/fable-library.2.10.1/Int32.js +0 -157
  124. package/dist/fable-library.2.10.1/List.js +0 -1234
  125. package/dist/fable-library.2.10.1/Long.js +0 -155
  126. package/dist/fable-library.2.10.1/Map.js +0 -1292
  127. package/dist/fable-library.2.10.1/MutableMap.js +0 -360
  128. package/dist/fable-library.2.10.1/MutableSet.js +0 -279
  129. package/dist/fable-library.2.10.1/Observable.js +0 -131
  130. package/dist/fable-library.2.10.1/Option.js +0 -118
  131. package/dist/fable-library.2.10.1/Reflection.js +0 -345
  132. package/dist/fable-library.2.10.1/RegExp.js +0 -118
  133. package/dist/fable-library.2.10.1/Seq.js +0 -917
  134. package/dist/fable-library.2.10.1/Set.js +0 -1692
  135. package/dist/fable-library.2.10.1/String.js +0 -679
  136. package/dist/fable-library.2.10.1/Types.js +0 -308
  137. package/dist/fable-library.2.10.1/Util.js +0 -761
  138. package/dist/helpers.js +0 -31
  139. package/dist/lib/big.js +0 -905
  140. package/dist/lib/long.js +0 -1375
  141. package/index.html +0 -49
@@ -1,121 +0,0 @@
1
- import { OperationCanceledError, Trampoline } from "./AsyncBuilder";
2
- import { CancellationToken } from "./AsyncBuilder";
3
- import { protectedCont } from "./AsyncBuilder";
4
- import { protectedBind } from "./AsyncBuilder";
5
- import { protectedReturn } from "./AsyncBuilder";
6
- import { choice1Of2, choice2Of2 } from "./Option";
7
- import { map } from "./Seq"; // Implemented just for type references
8
-
9
- export default class Async {}
10
-
11
- function emptyContinuation(_x) {} // NOP
12
- // MakeAsync: body:(AsyncActivation<'T> -> AsyncReturn) -> Async<'T>
13
-
14
-
15
- export function makeAsync(body) {
16
- return body;
17
- } // Invoke: computation: Async<'T> -> ctxt:AsyncActivation<'T> -> AsyncReturn
18
-
19
- export function invoke(computation, ctx) {
20
- return computation(ctx);
21
- } // CallThenInvoke: ctxt:AsyncActivation<'T> -> result1:'U -> part2:('U -> Async<'T>) -> AsyncReturn
22
-
23
- export function callThenInvoke(ctx, result1, part2) {
24
- return part2(result1)(ctx);
25
- } // Bind: ctxt:AsyncActivation<'T> -> part1:Async<'U> -> part2:('U -> Async<'T>) -> AsyncReturn
26
-
27
- export function bind(ctx, part1, part2) {
28
- return protectedBind(part1, part2)(ctx);
29
- }
30
- export function createCancellationToken(arg) {
31
- const token = new CancellationToken(typeof arg === "boolean" ? arg : false);
32
-
33
- if (typeof arg === "number") {
34
- setTimeout(() => {
35
- token.cancel();
36
- }, arg);
37
- }
38
-
39
- return token;
40
- }
41
- export function cancel(token) {
42
- token.cancel();
43
- }
44
- export function cancelAfter(token, ms) {
45
- setTimeout(() => {
46
- token.cancel();
47
- }, ms);
48
- }
49
- export function isCancellationRequested(token) {
50
- return token != null && token.isCancelled;
51
- }
52
- export function startChild(computation) {
53
- const promise = startAsPromise(computation); // JS Promises are hot, computation has already started
54
- // but we delay returning the result
55
-
56
- return protectedCont(ctx => protectedReturn(awaitPromise(promise))(ctx));
57
- }
58
- export function awaitPromise(p) {
59
- return fromContinuations(conts => p.then(conts[0]).catch(err => (err instanceof OperationCanceledError ? conts[2] : conts[1])(err)));
60
- }
61
- export function cancellationToken() {
62
- return protectedCont(ctx => ctx.onSuccess(ctx.cancelToken));
63
- }
64
- export const defaultCancellationToken = new CancellationToken();
65
- export function catchAsync(work) {
66
- return protectedCont(ctx => {
67
- work({
68
- onSuccess: x => ctx.onSuccess(choice1Of2(x)),
69
- onError: ex => ctx.onSuccess(choice2Of2(ex)),
70
- onCancel: ctx.onCancel,
71
- cancelToken: ctx.cancelToken,
72
- trampoline: ctx.trampoline
73
- });
74
- });
75
- }
76
- export function fromContinuations(f) {
77
- return protectedCont(ctx => f([ctx.onSuccess, ctx.onError, ctx.onCancel]));
78
- }
79
- export function ignore(computation) {
80
- return protectedBind(computation, _x => protectedReturn(void 0));
81
- }
82
- export function parallel(computations) {
83
- return awaitPromise(Promise.all(map(w => startAsPromise(w), computations)));
84
- }
85
- export function sleep(millisecondsDueTime) {
86
- return protectedCont(ctx => {
87
- let tokenId;
88
- const timeoutId = setTimeout(() => {
89
- ctx.cancelToken.removeListener(tokenId);
90
- ctx.onSuccess(void 0);
91
- }, millisecondsDueTime);
92
- tokenId = ctx.cancelToken.addListener(() => {
93
- clearTimeout(timeoutId);
94
- ctx.onCancel(new OperationCanceledError());
95
- });
96
- });
97
- }
98
- export function start(computation, cancellationToken) {
99
- return startWithContinuations(computation, cancellationToken);
100
- }
101
- export function startImmediate(computation, cancellationToken) {
102
- return start(computation, cancellationToken);
103
- }
104
- export function startWithContinuations(computation, continuation, exceptionContinuation, cancellationContinuation, cancelToken) {
105
- if (typeof continuation !== "function") {
106
- cancelToken = continuation;
107
- continuation = undefined;
108
- }
109
-
110
- const trampoline = new Trampoline();
111
- computation({
112
- onSuccess: continuation ? continuation : emptyContinuation,
113
- onError: exceptionContinuation ? exceptionContinuation : emptyContinuation,
114
- onCancel: cancellationContinuation ? cancellationContinuation : emptyContinuation,
115
- cancelToken: cancelToken ? cancelToken : defaultCancellationToken,
116
- trampoline
117
- });
118
- }
119
- export function startAsPromise(computation, cancellationToken) {
120
- return new Promise((resolve, reject) => startWithContinuations(computation, resolve, reject, reject, cancellationToken ? cancellationToken : defaultCancellationToken));
121
- }
@@ -1,200 +0,0 @@
1
- export class CancellationToken {
2
- constructor(cancelled = false) {
3
- this._id = 0;
4
- this._cancelled = cancelled;
5
- this._listeners = new Map();
6
- }
7
-
8
- get isCancelled() {
9
- return this._cancelled;
10
- }
11
-
12
- cancel() {
13
- if (!this._cancelled) {
14
- this._cancelled = true;
15
-
16
- for (const [, listener] of this._listeners) {
17
- listener();
18
- }
19
- }
20
- }
21
-
22
- addListener(f) {
23
- const id = this._id;
24
-
25
- this._listeners.set(this._id++, f);
26
-
27
- return id;
28
- }
29
-
30
- removeListener(id) {
31
- return this._listeners.delete(id);
32
- }
33
-
34
- register(f, state) {
35
- const $ = this;
36
- const id = this.addListener(state == null ? f : () => f(state));
37
- return {
38
- Dispose() {
39
- $.removeListener(id);
40
- }
41
-
42
- };
43
- }
44
-
45
- }
46
- export class OperationCanceledError extends Error {
47
- constructor() {
48
- super("The operation was canceled");
49
- Object.setPrototypeOf(this, OperationCanceledError.prototype);
50
- }
51
-
52
- }
53
- export class Trampoline {
54
- constructor() {
55
- this.callCount = 0;
56
- }
57
-
58
- static get maxTrampolineCallCount() {
59
- return 2000;
60
- }
61
-
62
- incrementAndCheck() {
63
- return this.callCount++ > Trampoline.maxTrampolineCallCount;
64
- }
65
-
66
- hijack(f) {
67
- this.callCount = 0;
68
- setTimeout(f, 0);
69
- }
70
-
71
- }
72
- export function protectedCont(f) {
73
- return ctx => {
74
- if (ctx.cancelToken.isCancelled) {
75
- ctx.onCancel(new OperationCanceledError());
76
- } else if (ctx.trampoline.incrementAndCheck()) {
77
- ctx.trampoline.hijack(() => {
78
- try {
79
- f(ctx);
80
- } catch (err) {
81
- ctx.onError(err);
82
- }
83
- });
84
- } else {
85
- try {
86
- f(ctx);
87
- } catch (err) {
88
- ctx.onError(err);
89
- }
90
- }
91
- };
92
- }
93
- export function protectedBind(computation, binder) {
94
- return protectedCont(ctx => {
95
- computation({
96
- onSuccess: x => {
97
- try {
98
- binder(x)(ctx);
99
- } catch (ex) {
100
- ctx.onError(ex);
101
- }
102
- },
103
- onError: ctx.onError,
104
- onCancel: ctx.onCancel,
105
- cancelToken: ctx.cancelToken,
106
- trampoline: ctx.trampoline
107
- });
108
- });
109
- }
110
- export function protectedReturn(value) {
111
- return protectedCont(ctx => ctx.onSuccess(value));
112
- }
113
- export class AsyncBuilder {
114
- Bind(computation, binder) {
115
- return protectedBind(computation, binder);
116
- }
117
-
118
- Combine(computation1, computation2) {
119
- return this.Bind(computation1, () => computation2);
120
- }
121
-
122
- Delay(generator) {
123
- return protectedCont(ctx => generator()(ctx));
124
- }
125
-
126
- For(sequence, body) {
127
- const iter = sequence[Symbol.iterator]();
128
- let cur = iter.next();
129
- return this.While(() => !cur.done, this.Delay(() => {
130
- const res = body(cur.value);
131
- cur = iter.next();
132
- return res;
133
- }));
134
- }
135
-
136
- Return(value) {
137
- return protectedReturn(value);
138
- }
139
-
140
- ReturnFrom(computation) {
141
- return computation;
142
- }
143
-
144
- TryFinally(computation, compensation) {
145
- return protectedCont(ctx => {
146
- computation({
147
- onSuccess: x => {
148
- compensation();
149
- ctx.onSuccess(x);
150
- },
151
- onError: x => {
152
- compensation();
153
- ctx.onError(x);
154
- },
155
- onCancel: x => {
156
- compensation();
157
- ctx.onCancel(x);
158
- },
159
- cancelToken: ctx.cancelToken,
160
- trampoline: ctx.trampoline
161
- });
162
- });
163
- }
164
-
165
- TryWith(computation, catchHandler) {
166
- return protectedCont(ctx => {
167
- computation({
168
- onSuccess: ctx.onSuccess,
169
- onCancel: ctx.onCancel,
170
- cancelToken: ctx.cancelToken,
171
- trampoline: ctx.trampoline,
172
- onError: ex => {
173
- try {
174
- catchHandler(ex)(ctx);
175
- } catch (ex2) {
176
- ctx.onError(ex2);
177
- }
178
- }
179
- });
180
- });
181
- }
182
-
183
- Using(resource, binder) {
184
- return this.TryFinally(binder(resource), () => resource.Dispose());
185
- }
186
-
187
- While(guard, computation) {
188
- if (guard()) {
189
- return this.Bind(computation, () => this.While(guard, computation));
190
- } else {
191
- return this.Return(void 0);
192
- }
193
- }
194
-
195
- Zero() {
196
- return protectedCont(ctx => ctx.onSuccess(void 0));
197
- }
198
-
199
- }
200
- export const singleton = new AsyncBuilder();