@base44-preview/sdk 0.8.53-pr.289.762dbd5 → 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.
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * Maps actor names to their incoming and outgoing message types.
3
3
  *
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.
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.
8
8
  *
9
- * To generate types from deployed actors instead, use the
9
+ * To generate types from deployed actors, use the
10
10
  * [`types generate`](/developers/references/cli/commands/types-generate) CLI command.
11
+ *
11
12
  * To learn how incoming and outgoing messages work, see
12
13
  * [message types](/developers/backend/resources/actors/overview#message-types).
13
14
  *
@@ -43,24 +44,24 @@ type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
43
44
  toServer: infer O;
44
45
  } ? O : unknown : unknown;
45
46
  /**
46
- * Configures the connection that [ActorRef.connect](#connect) opens.
47
+ * Configures the connection that [`connect()`](#connect) opens.
47
48
  */
48
49
  export interface ActorConnectOptions {
49
50
  /**
50
51
  * Connection ID that the actor receives as `conn.id`.
51
52
  *
52
- * To let the actor recognize the same client if it reconnects, use a stable
53
+ * To let the actor recognize a client when it reconnects, use a stable
53
54
  * value, such as an ID stored per browser tab. If you omit this property, the
54
- * SDK generates a connection ID.
55
+ * SDK generates a new connection ID.
55
56
  *
56
- * For more about connection IDs, see
57
+ * Learn more about
57
58
  * [connections](/developers/backend/resources/actors/reference#connections).
58
59
  */
59
60
  id?: string;
60
61
  }
61
62
  /**
62
63
  * Represents a listener for messages from the actor, registered with
63
- * [Connection.subscribe](#subscribe).
64
+ * [`subscribe()`](#subscribe).
64
65
  */
65
66
  export interface ActorSubscription {
66
67
  /**
@@ -75,10 +76,11 @@ export interface ActorSubscription {
75
76
  unsubscribe(): void;
76
77
  }
77
78
  /**
78
- * Represents a client's WebSocket connection to an actor session.
79
+ * Represents a client's WebSocket connection to an actor session, returned after calling
80
+ * [`connect()`](#connect). The socket queues messages you send before it opens.
79
81
  *
80
- * [ActorRef.connect](#connect) returns this object. The socket buffers messages
81
- * you send before it opens.
82
+ * Learn more about
83
+ * [connections](/developers/backend/resources/actors/reference#connections).
82
84
  */
83
85
  export interface Connection<N extends string = string> {
84
86
  /** Connection ID that the actor receives as `conn.id`. */
@@ -106,8 +108,8 @@ export interface Connection<N extends string = string> {
106
108
  /**
107
109
  * Sends a message to the actor.
108
110
  *
109
- * The socket buffers messages until it opens. After you call [close](#close),
110
- * the socket drops further sends.
111
+ * The socket queues messages until it opens. When you call [`close()`](#close),
112
+ * the socket drops any further sent messages.
111
113
  *
112
114
  * @param data - Message to send to the actor. The type comes from [ActorRegistry](#actorregistry) when you register the actor there.
113
115
  *
@@ -122,8 +124,7 @@ export interface Connection<N extends string = string> {
122
124
  * Closes the connection and removes all listeners.
123
125
  *
124
126
  * You can call this method more than once. A connection also closes itself
125
- * when it fails permanently. To open a new connection, call
126
- * [ActorRef.connect](#connect) again.
127
+ * when it fails permanently.
127
128
  *
128
129
  * @example
129
130
  * ```typescript
@@ -136,22 +137,20 @@ export interface Connection<N extends string = string> {
136
137
  /**
137
138
  * Represents a reference to an actor session, identified by actor name and session ID.
138
139
  *
139
- * Call [connect](#connect) to open the WebSocket and get a [Connection](#connection).
140
+ * Call [`connect()`](#connect) to open the WebSocket and get a [Connection](#returns).
140
141
  */
141
142
  export interface ActorRef<N extends string = string> {
142
143
  /**
143
- * Creates or returns the [Connection](#connection) for this session.
144
+ * Creates or returns the [Connection](#returns) for this session.
144
145
  *
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.
146
+ * Calling `connect()` again on the same session reference returns the same
147
+ * connection until it closes.
149
148
  *
150
149
  * For a sample flow, see
151
150
  * [connect a client to a session](/developers/backend/resources/actors/sample-flows#connect-a-client-to-a-session).
152
151
  *
153
152
  * @param options - Optional connection settings, such as a stable connection ID.
154
- * @returns The [Connection](#connection) for this actor session.
153
+ * @returns The [Connection](#returns) for this actor session.
155
154
  *
156
155
  * @example
157
156
  * ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.53-pr.289.762dbd5",
3
+ "version": "0.8.53-pr.289.a08165d",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",