1111
1212import type { Base44Client } from "./client" ;
1313
14+ export type ActorConnectionIdentity =
15+ | Readonly < { type : "authenticated" ; userId : string } >
16+ | Readonly < { type : "anonymous" ; anonymousId : string } > ;
17+
1418/**
1519 * A single client connection. `Send` is the message type this connection accepts
1620 * via {@link send} — the actor's *outgoing* (server→client) messages.
@@ -20,6 +24,8 @@ export interface Conn<Send = unknown> {
2024 * receives from `subscribe()`. Identifies a distinct client, so multiple
2125 * tabs are separate connections. */
2226 id : string ;
27+ /** Identity verified by the Actor Worker. Legacy Actors may not provide it. */
28+ identity ?: ActorConnectionIdentity ;
2329 send ( data : Send ) : void ;
2430 reject ( code : number , reason : string ) : void ;
2531}
@@ -112,9 +118,10 @@ export abstract class Actor<Incoming = unknown, Outgoing = unknown> {
112118
113119 /**
114120 * Anonymous Base44 client scoped to this actor instance — no user or service
115- * auth, so entity access is RLS-gated (same as a logged-out visitor). Always
116- * operates on production data: an actor runs server-side with no per-connection
117- * identity, so a Test DB preview selected in the editor does not apply here.
121+ * auth, so entity access is RLS-gated (same as a logged-out visitor). A
122+ * connection's verified `identity` is context only and is never applied to this
123+ * client. Always operates on production data, so a Test DB preview selected in
124+ * the editor does not apply here.
118125 * Example: `const rows = await this.client.entities.Score.list();`
119126 */
120127 protected get client ( ) : Base44Client {
0 commit comments