@base44-preview/sdk 0.8.53-pr.289.545edf7 → 0.8.53-pr.289.762dbd5

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.
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * Maps actor names to their incoming and outgoing message types.
3
3
  *
4
- * Extend this interface when you want typed actor
5
- * messages without generating types with the CLI:
6
- * - `toServer`: Defines incoming messages that a client sends to the actor.
7
- * - `toClient`: Defines outgoing messages that the actor sends to connected clients.
4
+ * Extend this interface through module augmentation when you want typed actor
5
+ * messages without generating types with the CLI. For each actor, `toServer`
6
+ * defines incoming messages that a client sends to the actor. `toClient` defines
7
+ * outgoing messages that the actor sends to connected clients.
8
8
  *
9
- * To generate types from deployed actors, use the
9
+ * To generate types from deployed actors instead, use the
10
10
  * [`types generate`](/developers/references/cli/commands/types-generate) CLI command.
11
- *
12
11
  * To learn how incoming and outgoing messages work, see
13
12
  * [message types](/developers/backend/resources/actors/overview#message-types).
14
13
  *
@@ -32,7 +31,7 @@ export interface ActorRegistry {
32
31
  * with [`types generate`](/developers/references/cli/commands/types-generate).
33
32
  *
34
33
  * The generated names provide autocomplete for deployed actors. To define
35
- * incoming and outgoing message types manually, augment {@linkcode ActorRegistry}.
34
+ * incoming and outgoing message types manually, augment [ActorRegistry](#actorregistry).
36
35
  */
37
36
  export interface ActorNameRegistry {
38
37
  }
@@ -44,21 +43,24 @@ type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
44
43
  toServer: infer O;
45
44
  } ? O : unknown : unknown;
46
45
  /**
47
- * Configures the connection that {@linkcode ActorRef.connect | connect()} opens.
46
+ * Configures the connection that [ActorRef.connect](#connect) opens.
48
47
  */
49
48
  export interface ActorConnectOptions {
50
49
  /**
51
50
  * Connection ID that the actor receives as `conn.id`.
52
51
  *
53
- * To let the actor recognize a client when it reconnects, use a stable
52
+ * To let the actor recognize the same client if it reconnects, use a stable
54
53
  * value, such as an ID stored per browser tab. If you omit this property, the
55
- * SDK generates a new connection ID.
54
+ * SDK generates a connection ID.
55
+ *
56
+ * For more about connection IDs, see
57
+ * [connections](/developers/backend/resources/actors/reference#connections).
56
58
  */
57
59
  id?: string;
58
60
  }
59
61
  /**
60
62
  * Represents a listener for messages from the actor, registered with
61
- * {@linkcode Connection.subscribe | subscribe()}.
63
+ * [Connection.subscribe](#subscribe).
62
64
  */
63
65
  export interface ActorSubscription {
64
66
  /**
@@ -73,11 +75,10 @@ export interface ActorSubscription {
73
75
  unsubscribe(): void;
74
76
  }
75
77
  /**
76
- * Represents a client's WebSocket connection to an actor session, returned after calling
77
- * [`connect()`](#connect). The socket queues messages you send before it opens.
78
+ * Represents a client's WebSocket connection to an actor session.
78
79
  *
79
- * Learn more about
80
- * [connections](/developers/backend/resources/actors/reference#connections).
80
+ * [ActorRef.connect](#connect) returns this object. The socket buffers messages
81
+ * you send before it opens.
81
82
  */
82
83
  export interface Connection<N extends string = string> {
83
84
  /** Connection ID that the actor receives as `conn.id`. */
@@ -105,10 +106,10 @@ export interface Connection<N extends string = string> {
105
106
  /**
106
107
  * Sends a message to the actor.
107
108
  *
108
- * The socket queues messages until it opens. When you call {@linkcode Connection.close | close()},
109
- * the socket drops any further sent messages.
109
+ * The socket buffers messages until it opens. After you call [close](#close),
110
+ * the socket drops further sends.
110
111
  *
111
- * @param data - Message to send to the actor. The type comes from {@linkcode ActorRegistry} when you register the actor there.
112
+ * @param data - Message to send to the actor. The type comes from [ActorRegistry](#actorregistry) when you register the actor there.
112
113
  *
113
114
  * @example
114
115
  * ```typescript
@@ -121,7 +122,8 @@ export interface Connection<N extends string = string> {
121
122
  * Closes the connection and removes all listeners.
122
123
  *
123
124
  * You can call this method more than once. A connection also closes itself
124
- * when it fails permanently.
125
+ * when it fails permanently. To open a new connection, call
126
+ * [ActorRef.connect](#connect) again.
125
127
  *
126
128
  * @example
127
129
  * ```typescript
@@ -134,20 +136,22 @@ export interface Connection<N extends string = string> {
134
136
  /**
135
137
  * Represents a reference to an actor session, identified by actor name and session ID.
136
138
  *
137
- * Call {@linkcode ActorRef.connect | connect()} to open the WebSocket and get a [Connection](#returns).
139
+ * Call [connect](#connect) to open the WebSocket and get a [Connection](#connection).
138
140
  */
139
141
  export interface ActorRef<N extends string = string> {
140
142
  /**
141
- * Creates or returns the [Connection](#returns) for this session.
143
+ * Creates or returns the [Connection](#connection) for this session.
142
144
  *
143
- * Calling `connect()` again on the same session reference returns the same
144
- * connection until it closes.
145
+ * Repeated calls return the same connection until it closes. If the connection
146
+ * fails permanently, for example because the actor doesn't exist or the actor
147
+ * denies the connection, fix the cause and call `connect()` again. Then
148
+ * subscribe again on the new connection.
145
149
  *
146
150
  * For a sample flow, see
147
151
  * [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
148
152
  *
149
153
  * @param options - Optional connection settings, such as a stable connection ID.
150
- * @returns The [Connection](#returns) for this actor session.
154
+ * @returns The [Connection](#connection) for this actor session.
151
155
  *
152
156
  * @example
153
157
  * ```typescript
@@ -161,7 +165,7 @@ export interface ActorRef<N extends string = string> {
161
165
  * Selects a session for a named actor.
162
166
  *
163
167
  * TypeScript infers message types when you register the actor in
164
- * {@linkcode ActorRegistry}. {@linkcode ActorNameRegistry}
168
+ * [ActorRegistry](#actorregistry). [ActorNameRegistry](#actornameregistry)
165
169
  * provides autocomplete for actor names only.
166
170
  */
167
171
  export interface ActorClient<N extends string = string> {
@@ -182,19 +186,19 @@ export interface ActorClient<N extends string = string> {
182
186
  (instanceId: string): ActorRef<N>;
183
187
  }
184
188
  /**
185
- * Actors module for connecting a client to an [actor](/developers/backend/resources/actors/overview) sessions, managing connections, and exchanging messages.
189
+ * Actors module for connecting a client to an [actor](/developers/backend/resources/actors/overview) session and exchanging messages.
186
190
  *
187
191
  * An actor is a long-running backend process that multiple clients connect to simultaneously. A session
188
192
  * is a running instance of an actor, identified by the actor name and a session ID. Each
189
193
  * session manages its own state, storage, and client connections independently.
190
194
  *
191
- * The actors module supports several objects with the following functionality:
195
+ * The actors module supports the following functionality:
192
196
  *
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.
197
+ * - [`connect()`](#connect): Open a WebSocket connection to a session.
198
+ * - [`subscribe()`](#subscribe): Receive messages from the actor.
199
+ * - [`unsubscribe()`](#unsubscribe): Stop receiving messages from the actor without closing the connection.
200
+ * - [`send()`](#send): Send messages to the actor.
201
+ * - [`close()`](#close): Close the WebSocket connection to the actor.
198
202
  *
199
203
  * For a sample flow, see
200
204
  * [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.53-pr.289.545edf7",
3
+ "version": "0.8.53-pr.289.762dbd5",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",