@base44-preview/sdk 0.8.49-pr.289.dd3fb8f → 0.8.49-pr.289.e36026d

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.
@@ -30,7 +30,7 @@ export interface ActorRegistry {
30
30
  * with [`types generate`](/developers/references/cli/commands/types-generate).
31
31
  *
32
32
  * The generated names provide autocomplete for deployed actors. To define
33
- * incoming and outgoing message types manually, augment {@link ActorRegistry}.
33
+ * incoming and outgoing message types manually, augment [ActorRegistry](#actorregistry).
34
34
  */
35
35
  export interface ActorNameRegistry {
36
36
  }
@@ -42,7 +42,7 @@ type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
42
42
  toServer: infer O;
43
43
  } ? O : unknown : unknown;
44
44
  /**
45
- * Options for {@link ActorRef.connect}.
45
+ * Options for [ActorRef.connect](#connect).
46
46
  */
47
47
  export interface ActorConnectOptions {
48
48
  /**
@@ -58,7 +58,7 @@ export interface ActorConnectOptions {
58
58
  }
59
59
  /**
60
60
  * Represents an outgoing-message listener registered with
61
- * {@link Connection.subscribe}.
61
+ * [Connection.subscribe](#subscribe).
62
62
  */
63
63
  export interface ActorSubscription {
64
64
  /**
@@ -69,7 +69,7 @@ export interface ActorSubscription {
69
69
  /**
70
70
  * Represents a client's WebSocket connection to an actor session.
71
71
  *
72
- * {@link ActorRef.connect} returns this object while the socket connects.
72
+ * [ActorRef.connect](#connect) returns this object while the socket connects.
73
73
  * The socket buffers messages sent during connection setup until it opens.
74
74
  */
75
75
  export interface Connection<N extends string = string> {
@@ -87,28 +87,28 @@ export interface Connection<N extends string = string> {
87
87
  /**
88
88
  * Sends an incoming message to the actor.
89
89
  *
90
- * The socket buffers messages until it opens. After {@link close}, the socket
90
+ * The socket buffers messages until it opens. After [close](#close), the socket
91
91
  * drops further sends.
92
92
  *
93
- * @param data - Incoming message to send. Typed through {@link ActorRegistry} when configured.
93
+ * @param data - Incoming message to send. Typed through [ActorRegistry](#actorregistry) when configured.
94
94
  */
95
95
  send(data: ToServerFor<N>): void;
96
96
  /**
97
97
  * Closes the connection and removes all listeners.
98
98
  *
99
99
  * Safe to call more than once. A connection also closes itself when it fails
100
- * permanently. See {@link ActorRef.connect} for how to open a fresh connection.
100
+ * permanently. See [ActorRef.connect](#connect) for how to open a fresh connection.
101
101
  */
102
102
  close(): void;
103
103
  }
104
104
  /**
105
105
  * Represents an actor session selected by actor name and session ID.
106
106
  *
107
- * Call {@link connect} to open the WebSocket and get a {@link Connection}.
107
+ * Call [connect](#connect) to open the WebSocket and get a [Connection](#connection).
108
108
  */
109
109
  export interface ActorRef<N extends string = string> {
110
110
  /**
111
- * Creates or returns the {@link Connection} for this session.
111
+ * Creates or returns the [Connection](#connection) for this session.
112
112
  *
113
113
  * Repeated calls return the same connection until it closes. After a permanent
114
114
  * failure, such as a missing actor or denied connection, fix the cause and call
@@ -118,15 +118,15 @@ export interface ActorRef<N extends string = string> {
118
118
  * for a sample flow.
119
119
  *
120
120
  * @param options - Optional connection settings, such as a stable connection ID.
121
- * @returns The {@link Connection} for this actor session.
121
+ * @returns The [Connection](#connection) for this actor session.
122
122
  */
123
123
  connect(options?: ActorConnectOptions): Connection<N>;
124
124
  }
125
125
  /**
126
126
  * Selects a session for a named actor.
127
127
  *
128
- * Typed automatically when the actor is registered in {@link ActorRegistry} or
129
- * {@link ActorNameRegistry}.
128
+ * Typed automatically when the actor is registered in [ActorRegistry](#actorregistry) or
129
+ * [ActorNameRegistry](#actornameregistry).
130
130
  */
131
131
  export interface ActorClient<N extends string = string> {
132
132
  /**
@@ -140,34 +140,35 @@ export interface ActorClient<N extends string = string> {
140
140
  (instanceId: string): ActorRef<N>;
141
141
  }
142
142
  /**
143
- * Provides access to actors and their shared, live sessions.
143
+ * Use `base44.actors` to connect your frontend to [actor sessions](/developers/backend/resources/actors/overview),
144
+ * shared live backend processes where clients can exchange messages in realtime.
144
145
  *
145
- * Select an actor by name and session ID, then connect a client to the
146
- * session. Clients in the same session can exchange realtime messages through the
147
- * actor. The client works in the browser and in Node.
148
- *
149
- * ## Connection flow
146
+ * With the Actors SDK module you can:
150
147
  *
151
148
  * - Connect to a session with `base44.actors.<ActorName>(sessionId).connect()`.
152
- * - Subscribe to outgoing messages with {@link Connection.subscribe}.
153
- * - Send incoming messages with {@link Connection.send}.
154
- * - Close the connection with {@link Connection.close}.
149
+ * - Subscribe to messages the actor sends using [Connection.subscribe](#subscribe),
150
+ * either broadcast to all clients or sent directly to your client.
151
+ * - Send messages to the actor with [Connection.send](#send).
152
+ * - Share a session across multiple clients: any clients with the same actor
153
+ * name and session ID connect to the same session.
154
+ * - Type your messages using [ActorRegistry](#actorregistry) for autocomplete
155
+ * and compile-time safety.
155
156
  *
156
- * See [Actors Overview](/developers/backend/resources/actors/overview)
157
- * for actor concepts and terminology, [Actor Class Reference](/developers/backend/resources/actors/reference)
158
- * for the backend class API, and [Sample Flows](/developers/backend/resources/actors/samples)
159
- * for common patterns.
157
+ * Learn more about [actors](/developers/backend/resources/actors/overview).
160
158
  *
161
159
  * ## Authentication modes
162
160
  *
163
- * This module is available in anonymous or user authentication mode
164
- * (`base44.actors`). It isn't available with service role authentication. Apps that
165
- * require login can reject anonymous connections in the actor's `handleConnect()` method.
166
- * See [Manage client connections](/developers/backend/resources/actors/samples#manage-client-connections)
167
- * for a sample flow.
168
- *
161
+ * This module is available in anonymous or user authentication mode.
162
+ * Apps that require login can reject anonymous connections in the actor's `handleConnect()` method.
163
+ * Learn more about [managing client connections](/developers/backend/resources/actors/samples#manage-client-connections).
164
+
165
+
169
166
  * @example
167
+ *
168
+ * The following example displays the general lifecycle of a client connected to an actor named `Chat`:
169
+ *
170
170
  * ```typescript
171
+ * Example
171
172
  * const conn = base44.actors.Chat("session-1").connect({ id: "tab-1" });
172
173
  * const sub = conn.subscribe((msg) => console.log(msg));
173
174
  * conn.send({ type: "message", text: "hi" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.49-pr.289.dd3fb8f",
3
+ "version": "0.8.49-pr.289.e36026d",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",