@base44-preview/sdk 0.8.53-pr.289.a08165d → 0.8.53-pr.289.e840a51
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 +12 -15
- 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 {@linkcode 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 {@linkcode ActorRef.connect | connect()} opens.
|
|
48
48
|
*/
|
|
49
49
|
export interface ActorConnectOptions {
|
|
50
50
|
/**
|
|
@@ -53,15 +53,12 @@ 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).
|
|
59
56
|
*/
|
|
60
57
|
id?: string;
|
|
61
58
|
}
|
|
62
59
|
/**
|
|
63
60
|
* Represents a listener for messages from the actor, registered with
|
|
64
|
-
*
|
|
61
|
+
* {@linkcode Connection.subscribe | subscribe()}.
|
|
65
62
|
*/
|
|
66
63
|
export interface ActorSubscription {
|
|
67
64
|
/**
|
|
@@ -108,10 +105,10 @@ export interface Connection<N extends string = string> {
|
|
|
108
105
|
/**
|
|
109
106
|
* Sends a message to the actor.
|
|
110
107
|
*
|
|
111
|
-
* The socket queues messages until it opens. When you call
|
|
108
|
+
* The socket queues messages until it opens. When you call {@linkcode Connection.close | close()},
|
|
112
109
|
* the socket drops any further sent messages.
|
|
113
110
|
*
|
|
114
|
-
* @param data - Message to send to the actor. The type comes from
|
|
111
|
+
* @param data - Message to send to the actor. The type comes from {@linkcode ActorRegistry} when you register the actor there.
|
|
115
112
|
*
|
|
116
113
|
* @example
|
|
117
114
|
* ```typescript
|
|
@@ -137,7 +134,7 @@ export interface Connection<N extends string = string> {
|
|
|
137
134
|
/**
|
|
138
135
|
* Represents a reference to an actor session, identified by actor name and session ID.
|
|
139
136
|
*
|
|
140
|
-
* Call
|
|
137
|
+
* Call {@linkcode ActorRef.connect | connect()} to open the WebSocket and get a [Connection](#returns).
|
|
141
138
|
*/
|
|
142
139
|
export interface ActorRef<N extends string = string> {
|
|
143
140
|
/**
|
|
@@ -164,7 +161,7 @@ export interface ActorRef<N extends string = string> {
|
|
|
164
161
|
* Selects a session for a named actor.
|
|
165
162
|
*
|
|
166
163
|
* TypeScript infers message types when you register the actor in
|
|
167
|
-
*
|
|
164
|
+
* {@linkcode ActorRegistry}. {@linkcode ActorNameRegistry}
|
|
168
165
|
* provides autocomplete for actor names only.
|
|
169
166
|
*/
|
|
170
167
|
export interface ActorClient<N extends string = string> {
|
|
@@ -193,11 +190,11 @@ export interface ActorClient<N extends string = string> {
|
|
|
193
190
|
*
|
|
194
191
|
* The actors module supports the following functionality:
|
|
195
192
|
*
|
|
196
|
-
* -
|
|
197
|
-
* -
|
|
198
|
-
* -
|
|
199
|
-
* -
|
|
200
|
-
* -
|
|
193
|
+
* - {@linkcode ActorRef.connect | connect()}: Open a WebSocket connection to a session.
|
|
194
|
+
* - {@linkcode Connection.subscribe | subscribe()}: Receive messages from the actor.
|
|
195
|
+
* - {@linkcode ActorSubscription.unsubscribe | unsubscribe()}: Stop receiving messages from the actor without closing the connection.
|
|
196
|
+
* - {@linkcode Connection.send | send()}: Send messages to the actor.
|
|
197
|
+
* - {@linkcode Connection.close | close()}: Close the WebSocket connection to the actor.
|
|
201
198
|
*
|
|
202
199
|
* For a sample flow, see
|
|
203
200
|
* [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
|