@base44-preview/sdk 0.8.46-pr.273.8e0d2f8 → 0.8.46-pr.273.f546cdd
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Extend this interface to add typed `subscribe` callbacks and `send` payloads
|
|
3
3
|
* for your deployed Actors.
|
|
4
4
|
*
|
|
5
|
-
* This is separate from
|
|
5
|
+
* This is separate from {@link ActorNameRegistry} (which is auto-generated
|
|
6
6
|
* by `base44 types generate`), so there are no conflicts.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -22,7 +22,7 @@ export interface ActorRegistry {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Auto-populated by `base44 types generate` with the names of your deployed actors.
|
|
25
|
-
* Do not edit this interface manually. Use
|
|
25
|
+
* Do not edit this interface manually. Use {@link ActorRegistry} for message types.
|
|
26
26
|
*/
|
|
27
27
|
export interface ActorNameRegistry {
|
|
28
28
|
}
|
|
@@ -33,7 +33,7 @@ type ToClientFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
|
|
|
33
33
|
type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegistry[N] extends {
|
|
34
34
|
toServer: infer O;
|
|
35
35
|
} ? O : unknown : unknown;
|
|
36
|
-
/** Options for
|
|
36
|
+
/** Options for {@link ActorRef.connect}. */
|
|
37
37
|
export interface ActorConnectOptions {
|
|
38
38
|
/**
|
|
39
39
|
* The connection id, used as the actor's `conn.id`. Supply a stable value,
|
|
@@ -42,12 +42,12 @@ export interface ActorConnectOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
id?: string;
|
|
44
44
|
}
|
|
45
|
-
/** Handle for one listener registered via
|
|
45
|
+
/** Handle for one listener registered via {@link Connection.subscribe}. */
|
|
46
46
|
export interface ActorSubscription {
|
|
47
47
|
/**
|
|
48
48
|
* Removes this listener. Other listeners on the same connection, and the
|
|
49
49
|
* connection itself, stay live. To close the connection as well, call
|
|
50
|
-
*
|
|
50
|
+
* {@link Connection.close}.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* ```typescript
|
|
@@ -59,7 +59,7 @@ export interface ActorSubscription {
|
|
|
59
59
|
unsubscribe(): void;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* A live connection to an actor instance, returned by
|
|
62
|
+
* A live connection to an actor instance, returned by {@link ActorRef.connect}.
|
|
63
63
|
* `subscribe`/`send` are always valid. You only get a `Connection` once the
|
|
64
64
|
* socket has been opened, so there's no pre-connect state to guard against.
|
|
65
65
|
*/
|
|
@@ -72,10 +72,10 @@ export interface Connection<N extends string = string> {
|
|
|
72
72
|
* message.
|
|
73
73
|
*
|
|
74
74
|
* The callback payload is typed when the actor is declared in
|
|
75
|
-
*
|
|
75
|
+
* {@link ActorRegistry}, and is `unknown` otherwise.
|
|
76
76
|
*
|
|
77
77
|
* @param callback - Called with each message the actor sends to this client.
|
|
78
|
-
* @returns An
|
|
78
|
+
* @returns An {@link ActorSubscription} that removes this one listener.
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
81
|
* ```typescript
|
|
@@ -92,7 +92,7 @@ export interface Connection<N extends string = string> {
|
|
|
92
92
|
* Messages sent before the socket finishes opening are buffered and flushed
|
|
93
93
|
* on open. Messages sent after {@link close} are dropped silently.
|
|
94
94
|
*
|
|
95
|
-
* The payload is typed when the actor is declared in
|
|
95
|
+
* The payload is typed when the actor is declared in {@link ActorRegistry},
|
|
96
96
|
* and is `unknown` otherwise.
|
|
97
97
|
*
|
|
98
98
|
* @param data - The message to send to the actor.
|
|
@@ -109,7 +109,7 @@ export interface Connection<N extends string = string> {
|
|
|
109
109
|
* listener registered on it. Safe to call more than once.
|
|
110
110
|
*
|
|
111
111
|
* A connection also closes itself when it fails permanently. See
|
|
112
|
-
*
|
|
112
|
+
* {@link ActorRef.connect} for how to recover from that.
|
|
113
113
|
*
|
|
114
114
|
* @example
|
|
115
115
|
* ```typescript
|
|
@@ -125,26 +125,26 @@ export interface Connection<N extends string = string> {
|
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* A handle to one actor instance, obtained from `base44.actors.MyActor(id)`. Call
|
|
128
|
-
* {@link connect} to open the socket and get a
|
|
128
|
+
* {@link connect} to open the socket and get a {@link Connection}.
|
|
129
129
|
*/
|
|
130
130
|
export interface ActorRef<N extends string = string> {
|
|
131
131
|
/**
|
|
132
132
|
* Opens the WebSocket to this actor instance and returns the
|
|
133
|
-
*
|
|
133
|
+
* {@link Connection}. Idempotent while the connection is open, so calling it
|
|
134
134
|
* again returns the same connection rather than opening a second socket.
|
|
135
135
|
*
|
|
136
136
|
* The returned connection is usable straight away. Messages passed to
|
|
137
|
-
*
|
|
137
|
+
* {@link Connection.send} before the socket finishes opening are buffered and
|
|
138
138
|
* flushed on open.
|
|
139
139
|
*
|
|
140
140
|
* A connection that fails permanently, for example because the actor doesn't
|
|
141
141
|
* exist or the caller isn't allowed to connect, closes itself and reports the
|
|
142
142
|
* error to the client's `onError` handler. Call `connect()` again once the
|
|
143
|
-
* cause is fixed to get a fresh
|
|
143
|
+
* cause is fixed to get a fresh {@link Connection}, then re-subscribe, as
|
|
144
144
|
* listeners do not carry over.
|
|
145
145
|
*
|
|
146
|
-
* @param options - Connection options. See
|
|
147
|
-
* @returns A live
|
|
146
|
+
* @param options - Connection options. See {@link ActorConnectOptions}.
|
|
147
|
+
* @returns A live {@link Connection} to this actor instance.
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```typescript
|
|
@@ -166,8 +166,8 @@ export interface ActorRef<N extends string = string> {
|
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* Client for a single named Actor. Call it with an instance id to get an
|
|
169
|
-
*
|
|
170
|
-
*
|
|
169
|
+
* {@link ActorRef}. Typed automatically when the actor is registered in
|
|
170
|
+
* {@link ActorRegistry}.
|
|
171
171
|
*/
|
|
172
172
|
export interface ActorClient<N extends string = string> {
|
|
173
173
|
(instanceId: string): ActorRef<N>;
|
|
@@ -182,17 +182,17 @@ export interface ActorClient<N extends string = string> {
|
|
|
182
182
|
* state. Clients open a WebSocket to an instance and exchange messages with it.
|
|
183
183
|
*
|
|
184
184
|
* This module provides:
|
|
185
|
-
* - Per-instance WebSocket connections, opened with
|
|
186
|
-
* - Message listeners, registered with
|
|
187
|
-
* - Message sending, with
|
|
185
|
+
* - Per-instance WebSocket connections, opened with {@link ActorRef.connect}
|
|
186
|
+
* - Message listeners, registered with {@link Connection.subscribe}
|
|
187
|
+
* - Message sending, with {@link Connection.send}
|
|
188
188
|
* - Automatic reconnection with backoff, including recovery from half-open
|
|
189
189
|
* sockets that stop delivering messages without emitting a close event
|
|
190
|
-
* - End-to-end typing of message payloads through
|
|
190
|
+
* - End-to-end typing of message payloads through {@link ActorRegistry}
|
|
191
191
|
*
|
|
192
192
|
* This module is available to use with a client in anonymous and user
|
|
193
193
|
* authentication modes. Connecting anonymously requires a browser environment.
|
|
194
194
|
*
|
|
195
|
-
* Connections stay open until you call
|
|
195
|
+
* Connections stay open until you call {@link Connection.close}, so close them
|
|
196
196
|
* when the view that opened them goes away.
|
|
197
197
|
*
|
|
198
198
|
* @example
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type AppPublicSettings = "private_with_login" | "public_with_login" | "public_without_login" | "workspace_with_login" | string;
|
|
6
6
|
/**
|
|
7
|
-
* The app's public configuration, as returned by
|
|
7
|
+
* The app's public configuration, as returned by {@link AppModule.getPublicSettings}.
|
|
8
8
|
*/
|
|
9
9
|
export interface AppPublicSettingsResponse {
|
|
10
10
|
/** The app's ID. */
|