@base44-preview/sdk 0.8.53-pr.289.545edf7 → 0.8.53-pr.289.a08165d
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/modules/actors.types.d.ts +17 -14
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ export interface ActorRegistry {
|
|
|
32
32
|
* with [`types generate`](/developers/references/cli/commands/types-generate).
|
|
33
33
|
*
|
|
34
34
|
* The generated names provide autocomplete for deployed actors. To define
|
|
35
|
-
* incoming and outgoing message types manually, augment
|
|
35
|
+
* incoming and outgoing message types manually, augment [ActorRegistry](#actorregistry).
|
|
36
36
|
*/
|
|
37
37
|
export interface ActorNameRegistry {
|
|
38
38
|
}
|
|
@@ -44,7 +44,7 @@ type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
|
|
|
44
44
|
toServer: infer O;
|
|
45
45
|
} ? O : unknown : unknown;
|
|
46
46
|
/**
|
|
47
|
-
* Configures the connection that
|
|
47
|
+
* Configures the connection that [`connect()`](#connect) opens.
|
|
48
48
|
*/
|
|
49
49
|
export interface ActorConnectOptions {
|
|
50
50
|
/**
|
|
@@ -53,12 +53,15 @@ export interface ActorConnectOptions {
|
|
|
53
53
|
* To let the actor recognize a client when it reconnects, use a stable
|
|
54
54
|
* value, such as an ID stored per browser tab. If you omit this property, the
|
|
55
55
|
* SDK generates a new connection ID.
|
|
56
|
+
*
|
|
57
|
+
* Learn more about
|
|
58
|
+
* [connections](/developers/backend/resources/actors/reference#connections).
|
|
56
59
|
*/
|
|
57
60
|
id?: string;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
63
|
* Represents a listener for messages from the actor, registered with
|
|
61
|
-
*
|
|
64
|
+
* [`subscribe()`](#subscribe).
|
|
62
65
|
*/
|
|
63
66
|
export interface ActorSubscription {
|
|
64
67
|
/**
|
|
@@ -105,10 +108,10 @@ export interface Connection<N extends string = string> {
|
|
|
105
108
|
/**
|
|
106
109
|
* Sends a message to the actor.
|
|
107
110
|
*
|
|
108
|
-
* The socket queues messages until it opens. When you call
|
|
111
|
+
* The socket queues messages until it opens. When you call [`close()`](#close),
|
|
109
112
|
* the socket drops any further sent messages.
|
|
110
113
|
*
|
|
111
|
-
* @param data - Message to send to the actor. The type comes from
|
|
114
|
+
* @param data - Message to send to the actor. The type comes from [ActorRegistry](#actorregistry) when you register the actor there.
|
|
112
115
|
*
|
|
113
116
|
* @example
|
|
114
117
|
* ```typescript
|
|
@@ -134,7 +137,7 @@ export interface Connection<N extends string = string> {
|
|
|
134
137
|
/**
|
|
135
138
|
* Represents a reference to an actor session, identified by actor name and session ID.
|
|
136
139
|
*
|
|
137
|
-
* Call
|
|
140
|
+
* Call [`connect()`](#connect) to open the WebSocket and get a [Connection](#returns).
|
|
138
141
|
*/
|
|
139
142
|
export interface ActorRef<N extends string = string> {
|
|
140
143
|
/**
|
|
@@ -161,7 +164,7 @@ export interface ActorRef<N extends string = string> {
|
|
|
161
164
|
* Selects a session for a named actor.
|
|
162
165
|
*
|
|
163
166
|
* TypeScript infers message types when you register the actor in
|
|
164
|
-
*
|
|
167
|
+
* [ActorRegistry](#actorregistry). [ActorNameRegistry](#actornameregistry)
|
|
165
168
|
* provides autocomplete for actor names only.
|
|
166
169
|
*/
|
|
167
170
|
export interface ActorClient<N extends string = string> {
|
|
@@ -182,19 +185,19 @@ export interface ActorClient<N extends string = string> {
|
|
|
182
185
|
(instanceId: string): ActorRef<N>;
|
|
183
186
|
}
|
|
184
187
|
/**
|
|
185
|
-
* Actors module for connecting a client to an [actor](/developers/backend/resources/actors/overview)
|
|
188
|
+
* Actors module for connecting a client to an [actor](/developers/backend/resources/actors/overview) session and exchanging messages.
|
|
186
189
|
*
|
|
187
190
|
* An actor is a long-running backend process that multiple clients connect to simultaneously. A session
|
|
188
191
|
* is a running instance of an actor, identified by the actor name and a session ID. Each
|
|
189
192
|
* session manages its own state, storage, and client connections independently.
|
|
190
193
|
*
|
|
191
|
-
* The actors module supports
|
|
194
|
+
* The actors module supports the following functionality:
|
|
192
195
|
*
|
|
193
|
-
* -
|
|
194
|
-
* -
|
|
195
|
-
* -
|
|
196
|
-
* -
|
|
197
|
-
* -
|
|
196
|
+
* - [`connect()`](#connect): Open a WebSocket connection to a session.
|
|
197
|
+
* - [`subscribe()`](#subscribe): Receive messages from the actor.
|
|
198
|
+
* - [`unsubscribe()`](#unsubscribe): Stop receiving messages from the actor without closing the connection.
|
|
199
|
+
* - [`send()`](#send): Send messages to the actor.
|
|
200
|
+
* - [`close()`](#close): Close the WebSocket connection to the actor.
|
|
198
201
|
*
|
|
199
202
|
* For a sample flow, see
|
|
200
203
|
* [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
|