@fable-org/fable-library-js 1.5.0 → 1.6.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.
- package/Async.d.ts +14 -19
- package/Async.js +1 -7
- package/AsyncBuilder.d.ts +13 -13
- package/CHANGELOG.md +10 -0
- package/MailboxProcessor.d.ts +2 -2
- package/package.json +1 -1
package/Async.d.ts
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
import { Continuation, Continuations } from "./AsyncBuilder.js";
|
|
2
|
-
import { CancellationToken } from "./AsyncBuilder.js";
|
|
3
|
-
import { IAsync } from "./AsyncBuilder.js";
|
|
4
|
-
import { IAsyncContext } from "./AsyncBuilder.js";
|
|
2
|
+
import { Async, IAsyncContext, CancellationToken } from "./AsyncBuilder.js";
|
|
5
3
|
import { FSharpChoice$2_$union } from "./Choice.js";
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function callThenInvoke<T, U>(ctx: IAsyncContext<T>, result1: U, part2: (x: U) => IAsync<T>): void;
|
|
11
|
-
export declare function bind<T, U>(ctx: IAsyncContext<T>, part1: IAsync<U>, part2: (x: U) => IAsync<T>): void;
|
|
4
|
+
export declare function makeAsync<T>(body: Async<T>): Async<T>;
|
|
5
|
+
export declare function invoke<T>(computation: Async<T>, ctx: IAsyncContext<T>): void;
|
|
6
|
+
export declare function callThenInvoke<T, U>(ctx: IAsyncContext<T>, result1: U, part2: (x: U) => Async<T>): void;
|
|
7
|
+
export declare function bind<T, U>(ctx: IAsyncContext<T>, part1: Async<U>, part2: (x: U) => Async<T>): void;
|
|
12
8
|
export declare function createCancellationToken(arg?: boolean | number): CancellationToken;
|
|
13
9
|
export declare function cancel(token: CancellationToken): void;
|
|
14
10
|
export declare function cancelAfter(token: CancellationToken, ms: number): void;
|
|
15
11
|
export declare function isCancellationRequested(token: CancellationToken): boolean;
|
|
16
12
|
export declare function throwIfCancellationRequested(token: CancellationToken): void;
|
|
17
|
-
export declare function startChild<T>(computation:
|
|
13
|
+
export declare function startChild<T>(computation: Async<T>, ms?: number): Async<Async<T>>;
|
|
18
14
|
export declare function awaitPromise<T>(p: Promise<T>): (ctx: IAsyncContext<T>) => void;
|
|
19
15
|
export declare function cancellationToken(): (ctx: IAsyncContext<CancellationToken>) => void;
|
|
20
16
|
export declare const defaultCancellationToken: CancellationToken;
|
|
21
|
-
export declare function catchAsync<T>(work:
|
|
17
|
+
export declare function catchAsync<T>(work: Async<T>): (ctx: IAsyncContext<FSharpChoice$2_$union<T, Error>>) => void;
|
|
22
18
|
export declare function fromContinuations<T>(f: (conts: Continuations<T>) => void): (ctx: IAsyncContext<T>) => void;
|
|
23
|
-
export declare function ignore<T>(computation:
|
|
24
|
-
export declare function parallel<T>(computations: Iterable<
|
|
25
|
-
export declare function sequential<T>(computations: Iterable<
|
|
19
|
+
export declare function ignore<T>(computation: Async<T>): (ctx: IAsyncContext<undefined>) => void;
|
|
20
|
+
export declare function parallel<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<Awaited<T>[]>) => void;
|
|
21
|
+
export declare function sequential<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<T[]>) => void;
|
|
26
22
|
export declare function sleep(millisecondsDueTime: number): (ctx: IAsyncContext<void>) => void;
|
|
27
23
|
export declare function runSynchronously(): never;
|
|
28
|
-
export declare function start<T>(computation:
|
|
29
|
-
export declare function startImmediate<T>(computation:
|
|
30
|
-
export declare function startWithContinuations<T>(computation:
|
|
31
|
-
export declare function startAsPromise<T>(computation:
|
|
32
|
-
export default Async;
|
|
24
|
+
export declare function start<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
|
|
25
|
+
export declare function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
|
|
26
|
+
export declare function startWithContinuations<T>(computation: Async<T>, continuation?: Continuation<T> | CancellationToken, exceptionContinuation?: Continuation<any>, cancellationContinuation?: Continuation<any>, cancelToken?: CancellationToken): void;
|
|
27
|
+
export declare function startAsPromise<T>(computation: Async<T>, cancellationToken?: CancellationToken): Promise<T>;
|
package/Async.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { OperationCanceledError, Trampoline } from "./AsyncBuilder.js";
|
|
2
2
|
import { CancellationToken } from "./AsyncBuilder.js";
|
|
3
|
-
import { protectedCont } from "./AsyncBuilder.js";
|
|
4
|
-
import { protectedBind } from "./AsyncBuilder.js";
|
|
5
|
-
import { protectedReturn } from "./AsyncBuilder.js";
|
|
3
|
+
import { protectedCont, protectedBind, protectedReturn } from "./AsyncBuilder.js";
|
|
6
4
|
import { Choice_makeChoice1Of2, Choice_makeChoice2Of2 } from "./Choice.js";
|
|
7
5
|
import { TimeoutException } from "./SystemException.js";
|
|
8
|
-
// Implemented just for type references
|
|
9
|
-
export class Async {
|
|
10
|
-
}
|
|
11
6
|
function emptyContinuation(_x) {
|
|
12
7
|
// NOP
|
|
13
8
|
}
|
|
@@ -155,4 +150,3 @@ export function startWithContinuations(computation, continuation, exceptionConti
|
|
|
155
150
|
export function startAsPromise(computation, cancellationToken) {
|
|
156
151
|
return new Promise((resolve, reject) => startWithContinuations(computation, resolve, reject, reject, cancellationToken ? cancellationToken : defaultCancellationToken));
|
|
157
152
|
}
|
|
158
|
-
export default Async;
|
package/AsyncBuilder.d.ts
CHANGED
|
@@ -39,21 +39,21 @@ export interface IAsyncContext<T> {
|
|
|
39
39
|
cancelToken: CancellationToken;
|
|
40
40
|
trampoline: Trampoline;
|
|
41
41
|
}
|
|
42
|
-
export type
|
|
43
|
-
export declare function protectedCont<T>(f:
|
|
44
|
-
export declare function protectedBind<T, U>(computation:
|
|
42
|
+
export type Async<T> = (x: IAsyncContext<T>) => void;
|
|
43
|
+
export declare function protectedCont<T>(f: Async<T>): (ctx: IAsyncContext<T>) => void;
|
|
44
|
+
export declare function protectedBind<T, U>(computation: Async<T>, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
|
|
45
45
|
export declare function protectedReturn<T>(value: T): (ctx: IAsyncContext<T>) => void;
|
|
46
46
|
export declare class AsyncBuilder {
|
|
47
|
-
Bind<T, U>(computation:
|
|
48
|
-
Combine<T>(computation1:
|
|
49
|
-
Delay<T>(generator: () =>
|
|
50
|
-
For<T>(sequence: Iterable<T>, body: (x: T) =>
|
|
51
|
-
Return<T>(value
|
|
52
|
-
ReturnFrom<T>(computation:
|
|
53
|
-
TryFinally<T>(computation:
|
|
54
|
-
TryWith<T>(computation:
|
|
55
|
-
Using<T extends IDisposable, U>(resource: T, binder: (x: T) =>
|
|
56
|
-
While(guard: () => boolean, computation:
|
|
47
|
+
Bind<T, U>(computation: Async<T>, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
|
|
48
|
+
Combine<T>(computation1: Async<void>, computation2: Async<T>): (ctx: IAsyncContext<T>) => void;
|
|
49
|
+
Delay<T>(generator: () => Async<T>): (ctx: IAsyncContext<T>) => void;
|
|
50
|
+
For<T>(sequence: Iterable<T>, body: (x: T) => Async<void>): Async<void>;
|
|
51
|
+
Return<T>(value: T): (ctx: IAsyncContext<T>) => void;
|
|
52
|
+
ReturnFrom<T>(computation: Async<T>): Async<T>;
|
|
53
|
+
TryFinally<T>(computation: Async<T>, compensation: () => void): (ctx: IAsyncContext<T>) => void;
|
|
54
|
+
TryWith<T>(computation: Async<T>, catchHandler: (e: any) => Async<T>): (ctx: IAsyncContext<T>) => void;
|
|
55
|
+
Using<T extends IDisposable, U>(resource: T, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
|
|
56
|
+
While(guard: () => boolean, computation: Async<void>): Async<void>;
|
|
57
57
|
Zero(): (ctx: IAsyncContext<void>) => void;
|
|
58
58
|
}
|
|
59
59
|
export declare const singleton: AsyncBuilder;
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 1.6.0 - 2024-10-02
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
|
|
14
|
+
* Remove `Async` (from `Async.ts`) class (by @MangelMaxime)
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
* Renamed `IAsync` to `Async` in `AsyncBuilder.ts` (#3906) (by @ncave)
|
|
19
|
+
|
|
10
20
|
## 1.5.0 - 2024-09-19
|
|
11
21
|
|
|
12
22
|
### Added
|
package/MailboxProcessor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Async } from "./AsyncBuilder.js";
|
|
2
2
|
import { Continuation } from "./AsyncBuilder.js";
|
|
3
3
|
import { CancellationToken } from "./AsyncBuilder.js";
|
|
4
4
|
declare class MailboxQueue<Msg> {
|
|
@@ -6,7 +6,7 @@ declare class MailboxQueue<Msg> {
|
|
|
6
6
|
add(message: Msg): void;
|
|
7
7
|
tryGet(): Msg | undefined;
|
|
8
8
|
}
|
|
9
|
-
export type MailboxBody<Msg> = (m: MailboxProcessor<Msg>) =>
|
|
9
|
+
export type MailboxBody<Msg> = (m: MailboxProcessor<Msg>) => Async<void>;
|
|
10
10
|
export interface AsyncReplyChannel<Reply> {
|
|
11
11
|
reply: (r: Reply) => void;
|
|
12
12
|
}
|
package/package.json
CHANGED