@base44-preview/sdk 0.8.35-pr.212.e4f0f07 → 0.8.35-pr.212.f5f8839
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.
|
@@ -15,13 +15,20 @@ export interface Conn {
|
|
|
15
15
|
send(data: unknown): void;
|
|
16
16
|
reject(code: number, reason: string): void;
|
|
17
17
|
}
|
|
18
|
+
export interface Storage {
|
|
19
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
20
|
+
put(key: string, value: unknown): Promise<void>;
|
|
21
|
+
delete(key: string): Promise<boolean>;
|
|
22
|
+
}
|
|
18
23
|
export declare abstract class RealtimeHandler<_State = unknown, Message = unknown> {
|
|
19
24
|
abstract handleConnect(conn: Conn): void | Promise<void>;
|
|
20
25
|
abstract handleMessage(conn: Conn, msg: Message): void | Promise<void>;
|
|
21
26
|
abstract handleClose(conn: Conn): void | Promise<void>;
|
|
22
27
|
abstract handleTick(): void | Promise<void>;
|
|
28
|
+
onStart(): void | Promise<void>;
|
|
23
29
|
protected broadcast(_data: unknown): void;
|
|
24
30
|
protected getConnections(): Conn[];
|
|
25
31
|
protected startLoop(_ms: number): Promise<void>;
|
|
26
32
|
protected stopLoop(): Promise<void>;
|
|
33
|
+
protected get storage(): Storage;
|
|
27
34
|
}
|
package/dist/realtime-handler.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Cloudflare Durable Object implementation — this file provides types only.
|
|
10
10
|
*/
|
|
11
11
|
export class RealtimeHandler {
|
|
12
|
+
onStart() { }
|
|
12
13
|
broadcast(_data) {
|
|
13
14
|
throw new Error("RealtimeHandler.broadcast() is only available inside a deployed handler");
|
|
14
15
|
}
|
|
@@ -21,4 +22,7 @@ export class RealtimeHandler {
|
|
|
21
22
|
stopLoop() {
|
|
22
23
|
throw new Error("RealtimeHandler.stopLoop() is only available inside a deployed handler");
|
|
23
24
|
}
|
|
25
|
+
get storage() {
|
|
26
|
+
throw new Error("RealtimeHandler.storage is only available inside a deployed handler");
|
|
27
|
+
}
|
|
24
28
|
}
|