@ikonai/sdk 1.0.52 → 1.0.54

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -0,0 +1,41 @@
1
+ import { FunctionRegistry } from '../functions/function-registry';
2
+ export type ReactiveCallback<T> = (value: T) => void;
3
+ export interface ReactiveSubscribeOptions {
4
+ /**
5
+ * Mount id when subscribing to a server-side <c>MountReactive&lt;T&gt;</c>. Empty/omitted
6
+ * means "no mount scope" — works for unscoped <c>Reactive&lt;T&gt;</c>, <c>ClientReactive&lt;T&gt;</c>,
7
+ * and <c>UserReactive&lt;T&gt;</c>.
8
+ */
9
+ mount?: string;
10
+ }
11
+ /**
12
+ * Subscribes a local callback to a server-side <c>Reactive&lt;T&gt;</c> over the existing
13
+ * function-call wire. The current value is fetched on first subscribe and pushed
14
+ * by the server on every change. Polling is unnecessary.
15
+ *
16
+ * Routing rides the same <c>FunctionRegistry</c> machinery used for any other RPC:
17
+ * subscribe is an <c>Ikon.Reactive.Subscribe</c> call; updates arrive as targeted
18
+ * <c>Ikon.Reactive.Update</c> calls from the app server. No new opcodes.
19
+ */
20
+ export declare class ReactiveRegistry {
21
+ private readonly subscribersByKey;
22
+ private readonly functionRegistry;
23
+ private updateHandlerUnregister;
24
+ constructor(functionRegistry: FunctionRegistry);
25
+ /**
26
+ * Subscribe to a server-side reactive identified by its stable id.
27
+ * The callback fires once with the current value, then on every server-side change.
28
+ * Returns an unsubscribe function.
29
+ *
30
+ * Pass <c>options.mount</c> when subscribing to a <c>MountReactive&lt;T&gt;</c>.
31
+ */
32
+ subscribe<T>(stableId: string, callback: ReactiveCallback<T>, options?: ReactiveSubscribeOptions): Promise<() => void>;
33
+ /**
34
+ * Drop all subscriptions. Intended for use during client teardown — does not
35
+ * notify the server (the server's per-session subscription map is cleaned up
36
+ * when the session disconnects).
37
+ */
38
+ detach(): void;
39
+ private unsubscribeOne;
40
+ private registerUpdateHandler;
41
+ }