@actor-system/ask 0.0.17 → 0.1.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/dist/ask-sync.d.ts +7 -7
- package/dist/ask-sync.internal.d.ts +7 -7
- package/dist/ask-sync.js +32 -15
- package/dist/ask-with-callback.d.ts +1 -1
- package/dist/ask-with-callback.internal.d.ts +1 -1
- package/dist/ask-with-callback.js +6 -4
- package/dist/ask.d.ts +1 -7
- package/dist/ask.internal.d.ts +1 -7
- package/dist/ask.js +5 -4
- package/dist/errors.d.ts +44 -0
- package/dist/errors.internal.d.ts +44 -0
- package/dist/errors.js +62 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.internal.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/use-ask.d.ts +1 -1
- package/dist/use-ask.internal.d.ts +1 -1
- package/package.json +7 -6
- package/dist/timeout.d.ts +0 -13
- package/dist/timeout.internal.d.ts +0 -13
- package/dist/timeout.js +0 -16
package/dist/ask-sync.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ActorRef } from '@actor-system/core';
|
|
2
2
|
import { CreateRequest } from './ask-with-callback.js';
|
|
3
3
|
|
|
4
|
-
interface AskSyncOptions<out Req, in Res> {
|
|
5
|
-
to: ActorRef<Req>;
|
|
6
|
-
request: CreateRequest<Req, Res>;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* If an actor's mailbox uses a synchronous processing strategy,
|
|
10
6
|
* this function can be used to perform an ask operation synchronously.
|
|
11
7
|
*
|
|
12
|
-
* This method will throw an error if
|
|
8
|
+
* This method will throw an error if:
|
|
9
|
+
* - The target actor is not a local actor reference.
|
|
10
|
+
* - The target actor's mailbox does not support synchronous processing.
|
|
11
|
+
* - The actor is currently busy processing another message (reentrancy).
|
|
12
|
+
* - The actor is dead/stopped (and no tombstone response is available).
|
|
13
|
+
* - The ask operation does not receive a response immediately.
|
|
13
14
|
*/
|
|
14
|
-
declare const askSync: <const Req, Res>(
|
|
15
|
+
declare const askSync: <const Req, Res>(to: ActorRef<Req>, request: CreateRequest<Req, Res>) => Res;
|
|
15
16
|
|
|
16
17
|
export { askSync };
|
|
17
|
-
export type { AskSyncOptions };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ActorRef } from '@actor-system/core/internal';
|
|
2
2
|
import { CreateRequest } from './ask-with-callback.internal.js';
|
|
3
3
|
|
|
4
|
-
interface AskSyncOptions<out Req, in Res> {
|
|
5
|
-
to: ActorRef<Req>;
|
|
6
|
-
request: CreateRequest<Req, Res>;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* If an actor's mailbox uses a synchronous processing strategy,
|
|
10
6
|
* this function can be used to perform an ask operation synchronously.
|
|
11
7
|
*
|
|
12
|
-
* This method will throw an error if
|
|
8
|
+
* This method will throw an error if:
|
|
9
|
+
* - The target actor is not a local actor reference.
|
|
10
|
+
* - The target actor's mailbox does not support synchronous processing.
|
|
11
|
+
* - The actor is currently busy processing another message (reentrancy).
|
|
12
|
+
* - The actor is dead/stopped (and no tombstone response is available).
|
|
13
|
+
* - The ask operation does not receive a response immediately.
|
|
13
14
|
*/
|
|
14
|
-
declare const askSync: <const Req, Res>(
|
|
15
|
+
declare const askSync: <const Req, Res>(to: ActorRef<Req>, request: CreateRequest<Req, Res>) => Res;
|
|
15
16
|
|
|
16
17
|
export { askSync };
|
|
17
|
-
export type { AskSyncOptions };
|
package/dist/ask-sync.js
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isActorLookup } from '@actor-system/core';
|
|
2
|
+
import { sync } from '@actor-system/scheduler';
|
|
2
3
|
import { _askWithCallback } from './ask-with-callback.js';
|
|
3
|
-
import { AskTimeoutError } from './
|
|
4
|
+
import { UnsupportedSyncOperationError, NoSynchronousResponseError, AskTimeoutError } from './errors.js';
|
|
4
5
|
|
|
6
|
+
const profile = {
|
|
7
|
+
lane: sync,
|
|
8
|
+
budget: { throughput: Infinity, deadline: Infinity },
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* If an actor's mailbox uses a synchronous processing strategy,
|
|
7
12
|
* this function can be used to perform an ask operation synchronously.
|
|
8
13
|
*
|
|
9
|
-
* This method will throw an error if
|
|
14
|
+
* This method will throw an error if:
|
|
15
|
+
* - The target actor is not a local actor reference.
|
|
16
|
+
* - The target actor's mailbox does not support synchronous processing.
|
|
17
|
+
* - The actor is currently busy processing another message (reentrancy).
|
|
18
|
+
* - The actor is dead/stopped (and no tombstone response is available).
|
|
19
|
+
* - The ask operation does not receive a response immediately.
|
|
10
20
|
*/
|
|
11
|
-
const askSync = (
|
|
12
|
-
|
|
21
|
+
const askSync = (to, request) => {
|
|
22
|
+
assertsActorSupportsSync(to);
|
|
13
23
|
let msgRef = null;
|
|
14
24
|
let error;
|
|
15
25
|
_askWithCallback({
|
|
16
|
-
|
|
26
|
+
to,
|
|
27
|
+
request,
|
|
17
28
|
timeout: undefined,
|
|
18
29
|
callback: (response) => {
|
|
19
30
|
if (response instanceof AskTimeoutError) {
|
|
@@ -23,19 +34,25 @@ const askSync = (options) => {
|
|
|
23
34
|
msgRef = { msg: response };
|
|
24
35
|
}
|
|
25
36
|
},
|
|
26
|
-
props: {
|
|
27
|
-
mailbox: {
|
|
28
|
-
scheduler: PriorityScheduler.create("sync"),
|
|
29
|
-
},
|
|
30
|
-
},
|
|
37
|
+
props: { profile },
|
|
31
38
|
});
|
|
32
|
-
if (error)
|
|
39
|
+
if (error)
|
|
33
40
|
throw error;
|
|
41
|
+
assertsSynchronousResponse(to, msgRef);
|
|
42
|
+
return msgRef.msg;
|
|
43
|
+
};
|
|
44
|
+
const assertsSynchronousResponse = (to, response) => {
|
|
45
|
+
if (response === null) {
|
|
46
|
+
throw new NoSynchronousResponseError(`Synchronous ask received no response.`, to);
|
|
34
47
|
}
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
};
|
|
49
|
+
const assertsActorSupportsSync = (to) => {
|
|
50
|
+
if (!isActorLookup(to)) {
|
|
51
|
+
throw new UnsupportedSyncOperationError(`Synchronous ask operations are only supported for local actors. Actor '${to.path}' is not a local actor reference.`, to);
|
|
52
|
+
}
|
|
53
|
+
if (to._getActor().dispatcher.scheduler !== sync) {
|
|
54
|
+
throw new UnsupportedSyncOperationError(`Actor '${to.path}' does not support synchronous processing. Ensure the actor's mailbox is configured with a synchronous scheduler.`, to);
|
|
37
55
|
}
|
|
38
|
-
return msgRef.msg;
|
|
39
56
|
};
|
|
40
57
|
|
|
41
58
|
export { askSync };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { receiveMessage, stopped } from '@actor-system/behaviors';
|
|
2
|
-
import {
|
|
2
|
+
import { isSystemLookup, signal } from '@actor-system/core';
|
|
3
3
|
import { generateMonotonicULID } from './__bundle__/shared/dist/monotonicULID.js';
|
|
4
|
-
import { AskTimeoutError } from './
|
|
4
|
+
import { AskTimeoutError } from './errors.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
@@ -19,9 +19,11 @@ const _askWithCallback = (options) => {
|
|
|
19
19
|
if (done)
|
|
20
20
|
return; // If already done, do not proceed
|
|
21
21
|
replyTo.tell(new AskTimeoutError(`Ask to '${to.path}' timed out after ${timeout}ms`, to, timeout));
|
|
22
|
-
}, timeout);
|
|
22
|
+
}, Math.max(0, timeout));
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
if (!isSystemLookup(to))
|
|
25
|
+
throw new Error(`Ask target ${to.path} must be a system bound actor`);
|
|
26
|
+
const replyTo = to._getSystem().systemActorOf(receiveMessage((msg) => {
|
|
25
27
|
if (!(msg instanceof AskTimeoutError) && !done) {
|
|
26
28
|
clearTimeout(timer);
|
|
27
29
|
callback(msg);
|
package/dist/ask.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ActorRef } from '@actor-system/core';
|
|
2
2
|
import { CreateRequest } from './ask-with-callback.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
timeout?: number;
|
|
6
|
-
to: ActorRef<Req>;
|
|
7
|
-
request: CreateRequest<Req, Res>;
|
|
8
|
-
}
|
|
9
|
-
declare const ask: <const Req, Res>(options: AskOptions<Req, Res>) => Promise<Res>;
|
|
4
|
+
declare const ask: <const Req, Res>(to: ActorRef<Req>, request: CreateRequest<Req, Res>, timeout?: number) => Promise<Res>;
|
|
10
5
|
|
|
11
6
|
export { ask };
|
|
12
|
-
export type { AskOptions };
|
package/dist/ask.internal.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ActorRef } from '@actor-system/core/internal';
|
|
2
2
|
import { CreateRequest } from './ask-with-callback.internal.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
timeout?: number;
|
|
6
|
-
to: ActorRef<Req>;
|
|
7
|
-
request: CreateRequest<Req, Res>;
|
|
8
|
-
}
|
|
9
|
-
declare const ask: <const Req, Res>(options: AskOptions<Req, Res>) => Promise<Res>;
|
|
4
|
+
declare const ask: <const Req, Res>(to: ActorRef<Req>, request: CreateRequest<Req, Res>, timeout?: number) => Promise<Res>;
|
|
10
5
|
|
|
11
6
|
export { ask };
|
|
12
|
-
export type { AskOptions };
|
package/dist/ask.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { _askWithCallback } from './ask-with-callback.js';
|
|
2
|
-
import { AskTimeoutError } from './
|
|
2
|
+
import { AskTimeoutError } from './errors.js';
|
|
3
3
|
|
|
4
|
-
const ask = (
|
|
5
|
-
timeout
|
|
6
|
-
|
|
4
|
+
const ask = (to, request, timeout = 1000) => new Promise((resolve, reject) => _askWithCallback({
|
|
5
|
+
timeout,
|
|
6
|
+
to,
|
|
7
|
+
request,
|
|
7
8
|
callback: (response) => {
|
|
8
9
|
if (response instanceof AskTimeoutError) {
|
|
9
10
|
reject(response);
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ActorRef } from '@actor-system/core';
|
|
2
|
+
import { Letter } from '@actor-system/mail';
|
|
3
|
+
|
|
4
|
+
declare const $timeoutError = "@@ask.timeout-error";
|
|
5
|
+
declare const $unsupportedSyncOperationError = "@@ask.unsupported-sync-operation-error";
|
|
6
|
+
declare const $noSynchronousResponseError = "@@ask.no-synchronous-response-error";
|
|
7
|
+
declare const $disconnectedError = "@@ask.disconnected-error";
|
|
8
|
+
declare class AskTimeoutError extends Error implements Letter<typeof $timeoutError> {
|
|
9
|
+
readonly label: typeof $timeoutError;
|
|
10
|
+
readonly from?: ActorRef;
|
|
11
|
+
readonly to: ActorRef;
|
|
12
|
+
readonly timeout: number;
|
|
13
|
+
constructor(message: string, to: ActorRef, timeout: number, from?: ActorRef);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when attempting a synchronous ask operation on an actor
|
|
17
|
+
* that does not support synchronous processing (e.g., actor with async-only mailbox).
|
|
18
|
+
*/
|
|
19
|
+
declare class UnsupportedSyncOperationError extends Error implements Letter<typeof $unsupportedSyncOperationError> {
|
|
20
|
+
readonly label: typeof $unsupportedSyncOperationError;
|
|
21
|
+
readonly from?: ActorRef;
|
|
22
|
+
readonly to: ActorRef;
|
|
23
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when a synchronous ask operation receives no response. This can occur
|
|
27
|
+
* in several scenarios: the actor is busy processing another message (reentrancy),
|
|
28
|
+
* the actor is dead/stopped, or the actor has some other condition preventing
|
|
29
|
+
* immediate synchronous response.
|
|
30
|
+
*/
|
|
31
|
+
declare class NoSynchronousResponseError extends Error implements Letter<typeof $noSynchronousResponseError> {
|
|
32
|
+
readonly label: typeof $noSynchronousResponseError;
|
|
33
|
+
readonly from?: ActorRef;
|
|
34
|
+
readonly to: ActorRef;
|
|
35
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
36
|
+
}
|
|
37
|
+
declare class DisconnectedError extends Error implements Letter<typeof $disconnectedError> {
|
|
38
|
+
readonly label: typeof $disconnectedError;
|
|
39
|
+
readonly from?: ActorRef;
|
|
40
|
+
readonly to: ActorRef;
|
|
41
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ActorRef } from '@actor-system/core/internal';
|
|
2
|
+
import { Letter } from '@actor-system/mail/internal';
|
|
3
|
+
|
|
4
|
+
declare const $timeoutError = "@@ask.timeout-error";
|
|
5
|
+
declare const $unsupportedSyncOperationError = "@@ask.unsupported-sync-operation-error";
|
|
6
|
+
declare const $noSynchronousResponseError = "@@ask.no-synchronous-response-error";
|
|
7
|
+
declare const $disconnectedError = "@@ask.disconnected-error";
|
|
8
|
+
declare class AskTimeoutError extends Error implements Letter<typeof $timeoutError> {
|
|
9
|
+
readonly label: typeof $timeoutError;
|
|
10
|
+
readonly from?: ActorRef;
|
|
11
|
+
readonly to: ActorRef;
|
|
12
|
+
readonly timeout: number;
|
|
13
|
+
constructor(message: string, to: ActorRef, timeout: number, from?: ActorRef);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown when attempting a synchronous ask operation on an actor
|
|
17
|
+
* that does not support synchronous processing (e.g., actor with async-only mailbox).
|
|
18
|
+
*/
|
|
19
|
+
declare class UnsupportedSyncOperationError extends Error implements Letter<typeof $unsupportedSyncOperationError> {
|
|
20
|
+
readonly label: typeof $unsupportedSyncOperationError;
|
|
21
|
+
readonly from?: ActorRef;
|
|
22
|
+
readonly to: ActorRef;
|
|
23
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when a synchronous ask operation receives no response. This can occur
|
|
27
|
+
* in several scenarios: the actor is busy processing another message (reentrancy),
|
|
28
|
+
* the actor is dead/stopped, or the actor has some other condition preventing
|
|
29
|
+
* immediate synchronous response.
|
|
30
|
+
*/
|
|
31
|
+
declare class NoSynchronousResponseError extends Error implements Letter<typeof $noSynchronousResponseError> {
|
|
32
|
+
readonly label: typeof $noSynchronousResponseError;
|
|
33
|
+
readonly from?: ActorRef;
|
|
34
|
+
readonly to: ActorRef;
|
|
35
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
36
|
+
}
|
|
37
|
+
declare class DisconnectedError extends Error implements Letter<typeof $disconnectedError> {
|
|
38
|
+
readonly label: typeof $disconnectedError;
|
|
39
|
+
readonly from?: ActorRef;
|
|
40
|
+
readonly to: ActorRef;
|
|
41
|
+
constructor(message: string, to: ActorRef, from?: ActorRef);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError };
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const $timeoutError = "@@ask.timeout-error";
|
|
2
|
+
const $unsupportedSyncOperationError = "@@ask.unsupported-sync-operation-error";
|
|
3
|
+
const $noSynchronousResponseError = "@@ask.no-synchronous-response-error";
|
|
4
|
+
const $disconnectedError = "@@ask.disconnected-error";
|
|
5
|
+
class AskTimeoutError extends Error {
|
|
6
|
+
label = $timeoutError;
|
|
7
|
+
from;
|
|
8
|
+
to;
|
|
9
|
+
timeout;
|
|
10
|
+
constructor(message, to, timeout, from) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "AskTimeoutError";
|
|
13
|
+
this.from = from;
|
|
14
|
+
this.to = to;
|
|
15
|
+
this.timeout = timeout;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Error thrown when attempting a synchronous ask operation on an actor
|
|
20
|
+
* that does not support synchronous processing (e.g., actor with async-only mailbox).
|
|
21
|
+
*/
|
|
22
|
+
class UnsupportedSyncOperationError extends Error {
|
|
23
|
+
label = $unsupportedSyncOperationError;
|
|
24
|
+
from;
|
|
25
|
+
to;
|
|
26
|
+
constructor(message, to, from) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = "UnsupportedSyncOperationError";
|
|
29
|
+
this.from = from;
|
|
30
|
+
this.to = to;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a synchronous ask operation receives no response. This can occur
|
|
35
|
+
* in several scenarios: the actor is busy processing another message (reentrancy),
|
|
36
|
+
* the actor is dead/stopped, or the actor has some other condition preventing
|
|
37
|
+
* immediate synchronous response.
|
|
38
|
+
*/
|
|
39
|
+
class NoSynchronousResponseError extends Error {
|
|
40
|
+
label = $noSynchronousResponseError;
|
|
41
|
+
from;
|
|
42
|
+
to;
|
|
43
|
+
constructor(message, to, from) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = "NoSynchronousResponseError";
|
|
46
|
+
this.from = from;
|
|
47
|
+
this.to = to;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class DisconnectedError extends Error {
|
|
51
|
+
label = $disconnectedError;
|
|
52
|
+
from;
|
|
53
|
+
to;
|
|
54
|
+
constructor(message, to, from) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.name = "DisconnectedError";
|
|
57
|
+
this.from = from;
|
|
58
|
+
this.to = to;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { $timeoutError, AskTimeoutError } from './
|
|
1
|
+
export { askSync } from './ask-sync.js';
|
|
2
|
+
export { ask } from './ask.js';
|
|
3
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError } from './errors.js';
|
|
4
4
|
export { Ask, MapResponse, WithAskOptions, withAsk } from './use-ask.js';
|
package/dist/index.internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { $timeoutError, AskTimeoutError } from './
|
|
1
|
+
export { askSync } from './ask-sync.internal.js';
|
|
2
|
+
export { ask } from './ask.internal.js';
|
|
3
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError } from './errors.internal.js';
|
|
4
4
|
export { Ask, MapResponse, WithAskOptions, withAsk } from './use-ask.internal.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { askSync } from './ask-sync.js';
|
|
2
2
|
export { ask } from './ask.js';
|
|
3
|
-
export { $timeoutError, AskTimeoutError } from './
|
|
3
|
+
export { $disconnectedError, $noSynchronousResponseError, $timeoutError, $unsupportedSyncOperationError, AskTimeoutError, DisconnectedError, NoSynchronousResponseError, UnsupportedSyncOperationError } from './errors.js';
|
|
4
4
|
export { withAsk } from './use-ask.js';
|
package/dist/use-ask.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActorRef, ActorContext, behavior } from '@actor-system/core';
|
|
2
|
-
import { AskTimeoutError } from './
|
|
2
|
+
import { AskTimeoutError } from './errors.js';
|
|
3
3
|
import { CreateRequest } from './ask-with-callback.js';
|
|
4
4
|
|
|
5
5
|
type MapResponse<in Res, out T> = (response: Res | AskTimeoutError) => T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActorRef, ActorContext, behavior } from '@actor-system/core/internal';
|
|
2
|
-
import { AskTimeoutError } from './
|
|
2
|
+
import { AskTimeoutError } from './errors.internal.js';
|
|
3
3
|
import { CreateRequest } from './ask-with-callback.internal.js';
|
|
4
4
|
|
|
5
5
|
type MapResponse<in Res, out T> = (response: Res | AskTimeoutError) => T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actor-system/ask",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"type-check": "tsc -b src",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
"@actor-system/shared"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@actor-system/behaviors": "0.0
|
|
38
|
-
"@actor-system/core": "0.
|
|
39
|
-
"@actor-system/mail": "0.0.
|
|
37
|
+
"@actor-system/behaviors": "0.1.0",
|
|
38
|
+
"@actor-system/core": "0.2.0",
|
|
39
|
+
"@actor-system/mail": "0.0.3",
|
|
40
|
+
"@actor-system/scheduler": "0.1.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@actor-system/testing": "0.0
|
|
43
|
-
"@actor-system/shared": "0.0.
|
|
43
|
+
"@actor-system/testing": "0.1.0",
|
|
44
|
+
"@actor-system/shared": "0.0.3",
|
|
44
45
|
"config": "^1.0.0"
|
|
45
46
|
}
|
|
46
47
|
}
|
package/dist/timeout.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ActorRef } from '@actor-system/core';
|
|
2
|
-
import { Letter } from '@actor-system/mail';
|
|
3
|
-
|
|
4
|
-
declare const $timeoutError = "@@ask.timeout-error";
|
|
5
|
-
declare class AskTimeoutError extends Error implements Letter<typeof $timeoutError> {
|
|
6
|
-
readonly label: typeof $timeoutError;
|
|
7
|
-
readonly from?: ActorRef;
|
|
8
|
-
readonly to: ActorRef;
|
|
9
|
-
readonly timeout: number;
|
|
10
|
-
constructor(message: string, to: ActorRef, timeout: number, from?: ActorRef);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { $timeoutError, AskTimeoutError };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ActorRef } from '@actor-system/core/internal';
|
|
2
|
-
import { Letter } from '@actor-system/mail/internal';
|
|
3
|
-
|
|
4
|
-
declare const $timeoutError = "@@ask.timeout-error";
|
|
5
|
-
declare class AskTimeoutError extends Error implements Letter<typeof $timeoutError> {
|
|
6
|
-
readonly label: typeof $timeoutError;
|
|
7
|
-
readonly from?: ActorRef;
|
|
8
|
-
readonly to: ActorRef;
|
|
9
|
-
readonly timeout: number;
|
|
10
|
-
constructor(message: string, to: ActorRef, timeout: number, from?: ActorRef);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { $timeoutError, AskTimeoutError };
|
package/dist/timeout.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const $timeoutError = "@@ask.timeout-error";
|
|
2
|
-
class AskTimeoutError extends Error {
|
|
3
|
-
label = $timeoutError;
|
|
4
|
-
from;
|
|
5
|
-
to;
|
|
6
|
-
timeout;
|
|
7
|
-
constructor(message, to, timeout, from) {
|
|
8
|
-
super(message);
|
|
9
|
-
this.name = "AskTimeoutError";
|
|
10
|
-
this.from = from;
|
|
11
|
-
this.to = to;
|
|
12
|
-
this.timeout = timeout;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { $timeoutError, AskTimeoutError };
|