@rotorsoft/act-http 1.7.4 → 1.8.0
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/sse/broadcast.d.ts +17 -3
- package/dist/@types/sse/broadcast.d.ts.map +1 -1
- package/dist/@types/sse/presence.d.ts +6 -2
- package/dist/@types/sse/presence.d.ts.map +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/{chunk-G5AY4DWG.js → chunk-AV57CGSG.js} +2 -2
- package/dist/{chunk-G5AY4DWG.js.map → chunk-AV57CGSG.js.map} +1 -1
- package/dist/hono/index.cjs +2 -2
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/sse/index.cjs +34 -6
- package/dist/sse/index.cjs.map +1 -1
- package/dist/sse/index.js +34 -6
- package/dist/sse/index.js.map +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.cjs.map +1 -1
- package/dist/trpc/index.js +1 -1
- package/package.json +10 -10
|
@@ -25,7 +25,7 @@ import type { BroadcastState, PatchMessage, Subscriber } from "./types.js";
|
|
|
25
25
|
* });
|
|
26
26
|
*
|
|
27
27
|
* // Initial state for reconnects:
|
|
28
|
-
* const cached = broadcast.
|
|
28
|
+
* const cached = broadcast.state(streamId);
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
31
|
* ## Version Contract
|
|
@@ -37,7 +37,15 @@ import type { BroadcastState, PatchMessage, Subscriber } from "./types.js";
|
|
|
37
37
|
export declare class BroadcastChannel<S extends BroadcastState = BroadcastState> {
|
|
38
38
|
private channels;
|
|
39
39
|
private state_cache;
|
|
40
|
+
/**
|
|
41
|
+
* @param options.cacheSize - Max number of stream states kept in the LRU
|
|
42
|
+
* cache (default 50).
|
|
43
|
+
* @param options.cache_size - Deprecated alias of `cacheSize` — removal in
|
|
44
|
+
* the next major. When both are given, `cacheSize` wins.
|
|
45
|
+
*/
|
|
40
46
|
constructor(options?: {
|
|
47
|
+
cacheSize?: number;
|
|
48
|
+
/** @deprecated use `cacheSize` — removal in the next major */
|
|
41
49
|
cache_size?: number;
|
|
42
50
|
});
|
|
43
51
|
/**
|
|
@@ -54,15 +62,21 @@ export declare class BroadcastChannel<S extends BroadcastState = BroadcastState>
|
|
|
54
62
|
* (e.g. presence overlay, computed field refresh).
|
|
55
63
|
* Uses the same version as the cached state, single entry.
|
|
56
64
|
*/
|
|
57
|
-
|
|
65
|
+
overlay(streamId: string, overlay_patch: Partial<S>): PatchMessage<S> | undefined;
|
|
58
66
|
/**
|
|
59
67
|
* Subscribe to broadcast messages for a stream.
|
|
60
68
|
* Returns a cleanup function that removes the subscription.
|
|
61
69
|
*/
|
|
62
70
|
subscribe(streamId: string, cb: Subscriber<S>): () => void;
|
|
63
71
|
/** Get the number of subscribers for a stream. */
|
|
64
|
-
|
|
72
|
+
subscriberCount(streamId: string): number;
|
|
65
73
|
/** Get the cached state for a stream (for reconnects / initial SSE yield). */
|
|
74
|
+
state(streamId: string): S | undefined;
|
|
75
|
+
/** @deprecated use `overlay` — removal in the next major */
|
|
76
|
+
publish_overlay(streamId: string, overlay_patch: Partial<S>): PatchMessage<S> | undefined;
|
|
77
|
+
/** @deprecated use `subscriberCount` — removal in the next major */
|
|
78
|
+
get_subscriber_count(streamId: string): number;
|
|
79
|
+
/** @deprecated use `state` — removal in the next major */
|
|
66
80
|
get_state(streamId: string): S | undefined;
|
|
67
81
|
/** Direct access to the state cache (for app-specific reads like presence). */
|
|
68
82
|
get cache(): StateCache<S>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../src/sse/broadcast.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE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,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItC,4DAA4D;IAC5D,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,GACxB,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAI9B,oEAAoE;IACpE,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI9C,0DAA0D;IAC1D,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI1C,+EAA+E;IAC/E,IAAI,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAEzB;CACF"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* presence.remove(game_id, player_id);
|
|
18
18
|
*
|
|
19
19
|
* // Query:
|
|
20
|
-
* presence.
|
|
20
|
+
* presence.online(game_id); // Set<string>
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare class PresenceTracker {
|
|
@@ -27,8 +27,12 @@ export declare class PresenceTracker {
|
|
|
27
27
|
/** Decrement ref count. Removes the identity when count reaches 0. */
|
|
28
28
|
remove(streamId: string, identity_id: string): void;
|
|
29
29
|
/** Get the set of online identity IDs for a stream. */
|
|
30
|
-
|
|
30
|
+
online(streamId: string): Set<string>;
|
|
31
31
|
/** Check if a specific identity is online for a stream. */
|
|
32
|
+
isOnline(streamId: string, identity_id: string): boolean;
|
|
33
|
+
/** @deprecated use `online` — removal in the next major */
|
|
34
|
+
get_online(streamId: string): Set<string>;
|
|
35
|
+
/** @deprecated use `isOnline` — removal in the next major */
|
|
32
36
|
is_online(streamId: string, identity_id: string): boolean;
|
|
33
37
|
}
|
|
34
38
|
//# sourceMappingURL=presence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../../src/sse/presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAA0C;IAEzD,uDAAuD;IACvD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAMhD,sEAAsE;IACtE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IASnD,uDAAuD;IACvD,
|
|
1
|
+
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../../src/sse/presence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAA0C;IAEzD,uDAAuD;IACvD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAMhD,sEAAsE;IACtE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IASnD,uDAAuD;IACvD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAKrC,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAIxD,2DAA2D;IAC3D,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAIzC,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;CAG1D"}
|
package/dist/api/index.cjs
CHANGED
|
@@ -14660,7 +14660,7 @@ async function* runSseSubscription(channel, stream_id, accounting, signal, on_ca
|
|
|
14660
14660
|
const on_abort = () => resolve_wait?.();
|
|
14661
14661
|
signal?.addEventListener("abort", on_abort);
|
|
14662
14662
|
try {
|
|
14663
|
-
const cached2 = channel.
|
|
14663
|
+
const cached2 = channel.state(stream_id);
|
|
14664
14664
|
if (cached2 !== void 0) {
|
|
14665
14665
|
yield { kind: "state", data: cached2 };
|
|
14666
14666
|
}
|