@c9up/aurora 0.1.22 → 0.1.24

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/Pages.js CHANGED
@@ -28,7 +28,11 @@ export class Pages {
28
28
  extension;
29
29
  registry = new Map();
30
30
  constructor(config) {
31
- this.root = config.root;
31
+ // Normalize the root ONCE so the `startsWith(root + sep)` containment
32
+ // check below compares like-for-like against the resolved page path.
33
+ // A raw root with a trailing slash, a relative segment, or `..` would
34
+ // otherwise never match the resolved absolute path → spurious 403s.
35
+ this.root = resolvePath(config.root);
32
36
  this.urlPrefix = (config.urlPrefix ?? "/__assets/pages").replace(/\/$/, "");
33
37
  this.extension = config.extension ?? ".js";
34
38
  }
package/dist/browser.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * without `typeof window` guards at every call site. Node-free — part of the
7
7
  * client barrel.
8
8
  */
9
- import { effect, signal } from "./reactive.js";
9
+ import { effect, onCleanup, signal } from "./reactive.js";
10
10
  /** Navigate to `url` with a full page load. No-op during SSR. */
11
11
  export function redirect(url) {
12
12
  if (typeof window !== "undefined") {
@@ -185,7 +185,7 @@ export function persistedSignal(key, initial, options = {}) {
185
185
  (options.area ?? "local") === "local" &&
186
186
  typeof window !== "undefined") {
187
187
  const fullKey = store.fullKey(key);
188
- window.addEventListener("storage", (event) => {
188
+ const onStorage = (event) => {
189
189
  if (event.key !== fullKey || event.newValue === null)
190
190
  return;
191
191
  try {
@@ -194,7 +194,14 @@ export function persistedSignal(key, initial, options = {}) {
194
194
  catch {
195
195
  // Ignore a malformed cross-tab write.
196
196
  }
197
- });
197
+ };
198
+ window.addEventListener("storage", onStorage);
199
+ // Tie the listener to the owning reactive scope so a persistedSignal
200
+ // created in a component's setup removes it on dispose (matching the
201
+ // mirror effect above — the JSDoc promises disposal-with-the-component).
202
+ // At module scope onCleanup is a no-op, so the listener lives for the
203
+ // page lifetime, as intended for a shared module-level signal.
204
+ onCleanup(() => window.removeEventListener("storage", onStorage));
198
205
  }
199
206
  return sig;
200
207
  }
package/dist/live.d.ts CHANGED
@@ -1,60 +1,20 @@
1
1
  /**
2
- * Live componentsserver-resident reactive UI. The state lives on the server
3
- * as ordinary aurora signals; this module turns a fine-grained signal change
4
- * into a PRECISE per-slot patch (`{slot, value}`) instead of re-rendering the
5
- * whole component. That precision — each signal already knows which template
6
- * slot it feeds — is the angle that beats HTML-diffing live-view libraries.
2
+ * `@c9up/aurora/live` barrelthe whole Live surface behind ONE subpath.
7
3
  *
8
- * This is the transport-agnostic CORE (Stage 1): mount a session, render its
9
- * initial HTML, dispatch events that mutate signals, and drain / subscribe to
10
- * the patches produced. Wiring patches over `@c9up/relay` (SSE down, POST up)
11
- * and the thin client applier live in later stages.
4
+ * The transport-agnostic core (`mountLiveSession` + its types) lives in
5
+ * `./liveSession.js`; the transport stack (broadcast / client / registry /
6
+ * router / server) builds on it. Re-exporting everything here keeps the niche
7
+ * surface behind a single subpath and keeps the main `.` barrel lean (it no
8
+ * longer eager-pulls these into every browser graph), consistent with how
9
+ * `./ssr`, `./relay`, `./rpc` and `./hydrate` are already subpath-gated.
12
10
  *
13
- * Node-free / isomorphic: uses only `signal`/`effect`/`renderToString`, so it
14
- * sits in the main barrel alongside the rest of aurora's runtime.
11
+ * The core lives in a SEPARATE module (not inline here) so the transport files
12
+ * import it directly from `./liveSession.js` rather than through this barrel
13
+ * which would otherwise form an import cycle (barrel → transport → barrel).
15
14
  */
16
- import type { TemplateResult } from "./types.js";
17
- /** A precise per-slot update: slot index (positional in the template) + value. */
18
- export interface SlotPatch {
19
- slot: number;
20
- value: string;
21
- }
22
- /** A live component: its reactive view + named event handlers that mutate it. */
23
- export interface LiveComponentDefinition {
24
- /** The reactive view. Slots reading signals become live-patchable. */
25
- view: TemplateResult;
26
- /**
27
- * Event handlers, by name. A client interaction (`@click="increment"`)
28
- * dispatches one of these; it mutates the component's signals, which the
29
- * patch tracker turns into a `{slot, value}` patch.
30
- */
31
- handlers?: Record<string, (payload?: unknown) => void>;
32
- }
33
- /** A mounted live component instance — one per connected client session. */
34
- export interface LiveSession {
35
- /** Initial server-side render (the first full-HTML response). */
36
- renderToString(): string;
37
- /** Run a named handler (mutates signals); emits a patch for the batch. */
38
- dispatch(event: string, payload?: unknown): void;
39
- /** Collect + clear the patches accumulated since the last drain (pull model). */
40
- drainPatches(): SlotPatch[];
41
- /**
42
- * Subscribe to patches as they are produced (push model — what the relay
43
- * transport hooks into). Use `onPatch` OR `drainPatches`, not both.
44
- */
45
- onPatch(listener: (patch: SlotPatch[]) => void): () => void;
46
- /** Stop every effect — call on client disconnect to free the session. */
47
- dispose(): void;
48
- }
49
- /**
50
- * Mount a live session from a definition factory. Call once per connected
51
- * client: the factory's signals become that session's private state. To SHARE
52
- * state across sessions, close the factory over a signal created OUTSIDE it —
53
- * every session then reads the same signal and patches on its change.
54
- */
55
- export declare function mountLiveSession(factory: () => LiveComponentDefinition): LiveSession;
56
15
  export { connectPatches, type LiveStore, liveStore, type RelayBroadcaster, } from "./liveBroadcast.js";
57
16
  export { buildLiveTransport, type LiveClientOptions, type LiveClientTransport, type LiveHttpPoster, liveClient, type RelaySubscribeClient, } from "./liveClient.js";
58
17
  export { createLiveRegistry, type LiveRegistry, type LiveSessionHandle, } from "./liveRegistry.js";
59
18
  export { createLiveRouter, type LiveMount, type LiveRouter, } from "./liveRouter.js";
60
19
  export { DEFAULT_LIVE_EVENT_PATH, type LiveHttpContext, type LiveHttpRouter, type WireLiveEventsOptions, wireLiveEvents, } from "./liveServer.js";
20
+ export { type LiveComponentDefinition, type LiveSession, mountLiveSession, type SlotPatch, } from "./liveSession.js";
package/dist/live.js CHANGED
@@ -1,108 +1,20 @@
1
1
  /**
2
- * Live componentsserver-resident reactive UI. The state lives on the server
3
- * as ordinary aurora signals; this module turns a fine-grained signal change
4
- * into a PRECISE per-slot patch (`{slot, value}`) instead of re-rendering the
5
- * whole component. That precision — each signal already knows which template
6
- * slot it feeds — is the angle that beats HTML-diffing live-view libraries.
2
+ * `@c9up/aurora/live` barrelthe whole Live surface behind ONE subpath.
7
3
  *
8
- * This is the transport-agnostic CORE (Stage 1): mount a session, render its
9
- * initial HTML, dispatch events that mutate signals, and drain / subscribe to
10
- * the patches produced. Wiring patches over `@c9up/relay` (SSE down, POST up)
11
- * and the thin client applier live in later stages.
4
+ * The transport-agnostic core (`mountLiveSession` + its types) lives in
5
+ * `./liveSession.js`; the transport stack (broadcast / client / registry /
6
+ * router / server) builds on it. Re-exporting everything here keeps the niche
7
+ * surface behind a single subpath and keeps the main `.` barrel lean (it no
8
+ * longer eager-pulls these into every browser graph), consistent with how
9
+ * `./ssr`, `./relay`, `./rpc` and `./hydrate` are already subpath-gated.
12
10
  *
13
- * Node-free / isomorphic: uses only `signal`/`effect`/`renderToString`, so it
14
- * sits in the main barrel alongside the rest of aurora's runtime.
11
+ * The core lives in a SEPARATE module (not inline here) so the transport files
12
+ * import it directly from `./liveSession.js` rather than through this barrel
13
+ * which would otherwise form an import cycle (barrel → transport → barrel).
15
14
  */
16
- import { effect, isSignal } from "./reactive.js";
17
- import { renderToString } from "./ssr.js";
18
- /**
19
- * Mount a live session from a definition factory. Call once per connected
20
- * client: the factory's signals become that session's private state. To SHARE
21
- * state across sessions, close the factory over a signal created OUTSIDE it —
22
- * every session then reads the same signal and patches on its change.
23
- */
24
- export function mountLiveSession(factory) {
25
- const { view, handlers = {} } = factory();
26
- const listeners = new Set();
27
- // slot → latest value. `pending` = current (un-flushed) batch; `buffer` =
28
- // accumulated for pull consumers. Both keyed by slot so repeated writes in
29
- // one batch collapse to the last value.
30
- const pending = new Map();
31
- const buffer = new Map();
32
- let priming = true;
33
- let flushScheduled = false;
34
- const flush = () => {
35
- flushScheduled = false;
36
- if (pending.size === 0)
37
- return;
38
- const patch = [];
39
- for (const [slot, value] of pending) {
40
- patch.push({ slot, value });
41
- buffer.set(slot, value);
42
- }
43
- pending.clear();
44
- for (const listener of listeners)
45
- listener(patch);
46
- };
47
- const scheduleFlush = () => {
48
- if (flushScheduled)
49
- return;
50
- flushScheduled = true;
51
- queueMicrotask(flush);
52
- };
53
- // One fine-grained effect per reactive slot. The priming run only
54
- // subscribes; later runs (a signal changed) record the slot's new value.
55
- const stops = view.values.map((value, slot) => {
56
- if (!isSignal(value) && typeof value !== "function")
57
- return () => { };
58
- return effect(() => {
59
- const next = String(value());
60
- if (priming)
61
- return;
62
- pending.set(slot, next);
63
- scheduleFlush();
64
- });
65
- });
66
- priming = false;
67
- return {
68
- renderToString: () => renderToString(view),
69
- dispatch(event, payload) {
70
- const handler = handlers[event];
71
- if (!handler)
72
- return;
73
- handler(payload);
74
- flush(); // synchronous — one patch per dispatch (batches the handler's writes)
75
- },
76
- drainPatches() {
77
- flush();
78
- const patch = [];
79
- for (const [slot, value] of buffer)
80
- patch.push({ slot, value });
81
- buffer.clear();
82
- return patch;
83
- },
84
- onPatch(listener) {
85
- listeners.add(listener);
86
- return () => listeners.delete(listener);
87
- },
88
- dispose() {
89
- for (const stop of stops)
90
- stop();
91
- listeners.clear();
92
- pending.clear();
93
- buffer.clear();
94
- },
95
- };
96
- }
97
- // ─── `@c9up/aurora/live` barrel ──────────────────────────────────────
98
- //
99
- // The Live stack (broadcast / client / registry / router / server) is
100
- // re-exported here so the whole niche surface lives behind ONE subpath,
101
- // `@c9up/aurora/live` — keeping the main `.` barrel lean (it no longer
102
- // eager-pulls these into every browser graph), consistent with how `./ssr`,
103
- // `./relay`, `./rpc` and `./hydrate` are already subpath-gated.
104
15
  export { connectPatches, liveStore, } from "./liveBroadcast.js";
105
16
  export { buildLiveTransport, liveClient, } from "./liveClient.js";
106
17
  export { createLiveRegistry, } from "./liveRegistry.js";
107
18
  export { createLiveRouter, } from "./liveRouter.js";
108
19
  export { DEFAULT_LIVE_EVENT_PATH, wireLiveEvents, } from "./liveServer.js";
20
+ export { mountLiveSession, } from "./liveSession.js";
@@ -14,7 +14,7 @@
14
14
  * one mutation → one patch computed once → relay fans it out to all subscribers
15
15
  * (O(1) compute, O(N) network).
16
16
  */
17
- import { type LiveComponentDefinition, type LiveSession } from "./live.js";
17
+ import { type LiveComponentDefinition, type LiveSession } from "./liveSession.js";
18
18
  /**
19
19
  * Minimal relay surface aurora needs. The real `@c9up/relay` `Relay` satisfies
20
20
  * it (`broadcast(channel, data) → recipient count`); aurora never imports it.
@@ -14,7 +14,7 @@
14
14
  * one mutation → one patch computed once → relay fans it out to all subscribers
15
15
  * (O(1) compute, O(N) network).
16
16
  */
17
- import { mountLiveSession, } from "./live.js";
17
+ import { mountLiveSession, } from "./liveSession.js";
18
18
  /**
19
19
  * Pipe a session's patches onto a relay channel as they are produced. Returns
20
20
  * an unsubscribe. Each patch becomes one `broadcast(channel, patch)`.
@@ -14,7 +14,7 @@
14
14
  * `subscribe` to `@c9up/aurora/relay`'s `relay().subscribe` and `post` to an
15
15
  * `HttpClient`. Browser-only (uses the DOM) — part of the client barrel.
16
16
  */
17
- import type { SlotPatch } from "./live.js";
17
+ import type { SlotPatch } from "./liveSession.js";
18
18
  import type { TemplateResult } from "./types.js";
19
19
  /** The transport the live client needs: a patch subscription + an event POST. */
20
20
  export interface LiveClientTransport {
@@ -10,7 +10,7 @@
10
10
  * `get(id)?.dispatch(...)`; disconnect → `disposeOwner(uid)`. Transport-agnostic
11
11
  * and node-free (only `mountLiveSession` + `crypto.randomUUID`, both isomorphic).
12
12
  */
13
- import { type LiveComponentDefinition, type LiveSession } from "./live.js";
13
+ import { type LiveComponentDefinition, type LiveSession } from "./liveSession.js";
14
14
  /** A mounted instance: its id, the owner (e.g. relay uid), and the session. */
15
15
  export interface LiveSessionHandle {
16
16
  id: string;
@@ -10,7 +10,7 @@
10
10
  * `get(id)?.dispatch(...)`; disconnect → `disposeOwner(uid)`. Transport-agnostic
11
11
  * and node-free (only `mountLiveSession` + `crypto.randomUUID`, both isomorphic).
12
12
  */
13
- import { mountLiveSession, } from "./live.js";
13
+ import { mountLiveSession, } from "./liveSession.js";
14
14
  /** Create an isolated live-session registry (one per app / per relay instance). */
15
15
  export function createLiveRegistry() {
16
16
  const defs = new Map();
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Live components — server-resident reactive UI CORE. The state lives on the
3
+ * server as ordinary aurora signals; this module turns a fine-grained signal
4
+ * change into a PRECISE per-slot patch (`{slot, value}`) instead of re-rendering
5
+ * the whole component. That precision — each signal already knows which template
6
+ * slot it feeds — is the angle that beats HTML-diffing live-view libraries.
7
+ *
8
+ * This is the transport-agnostic core: mount a session, render its initial HTML,
9
+ * dispatch events that mutate signals, and drain / subscribe to the patches
10
+ * produced. The transport stack (broadcast / client / registry / router /
11
+ * server) builds ON this and re-exports through the `./live.js` barrel — kept in
12
+ * a separate module so those transport files import the core WITHOUT forming an
13
+ * import cycle back through the barrel.
14
+ *
15
+ * Node-free / isomorphic: uses only `signal`/`effect`/`renderToString`.
16
+ */
17
+ import type { TemplateResult } from "./types.js";
18
+ /** A precise per-slot update: slot index (positional in the template) + value. */
19
+ export interface SlotPatch {
20
+ slot: number;
21
+ value: string;
22
+ }
23
+ /** A live component: its reactive view + named event handlers that mutate it. */
24
+ export interface LiveComponentDefinition {
25
+ /** The reactive view. Slots reading signals become live-patchable. */
26
+ view: TemplateResult;
27
+ /**
28
+ * Event handlers, by name. A client interaction (`@click="increment"`)
29
+ * dispatches one of these; it mutates the component's signals, which the
30
+ * patch tracker turns into a `{slot, value}` patch.
31
+ */
32
+ handlers?: Record<string, (payload?: unknown) => void>;
33
+ }
34
+ /** A mounted live component instance — one per connected client session. */
35
+ export interface LiveSession {
36
+ /** Initial server-side render (the first full-HTML response). */
37
+ renderToString(): string;
38
+ /** Run a named handler (mutates signals); emits a patch for the batch. */
39
+ dispatch(event: string, payload?: unknown): void;
40
+ /** Collect + clear the patches accumulated since the last drain (pull model). */
41
+ drainPatches(): SlotPatch[];
42
+ /**
43
+ * Subscribe to patches as they are produced (push model — what the relay
44
+ * transport hooks into). Use `onPatch` OR `drainPatches`, not both.
45
+ */
46
+ onPatch(listener: (patch: SlotPatch[]) => void): () => void;
47
+ /** Stop every effect — call on client disconnect to free the session. */
48
+ dispose(): void;
49
+ }
50
+ /**
51
+ * Mount a live session from a definition factory. Call once per connected
52
+ * client: the factory's signals become that session's private state. To SHARE
53
+ * state across sessions, close the factory over a signal created OUTSIDE it —
54
+ * every session then reads the same signal and patches on its change.
55
+ */
56
+ export declare function mountLiveSession(factory: () => LiveComponentDefinition): LiveSession;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Live components — server-resident reactive UI CORE. The state lives on the
3
+ * server as ordinary aurora signals; this module turns a fine-grained signal
4
+ * change into a PRECISE per-slot patch (`{slot, value}`) instead of re-rendering
5
+ * the whole component. That precision — each signal already knows which template
6
+ * slot it feeds — is the angle that beats HTML-diffing live-view libraries.
7
+ *
8
+ * This is the transport-agnostic core: mount a session, render its initial HTML,
9
+ * dispatch events that mutate signals, and drain / subscribe to the patches
10
+ * produced. The transport stack (broadcast / client / registry / router /
11
+ * server) builds ON this and re-exports through the `./live.js` barrel — kept in
12
+ * a separate module so those transport files import the core WITHOUT forming an
13
+ * import cycle back through the barrel.
14
+ *
15
+ * Node-free / isomorphic: uses only `signal`/`effect`/`renderToString`.
16
+ */
17
+ import { effect, isSignal } from "./reactive.js";
18
+ import { renderToString } from "./ssr.js";
19
+ /**
20
+ * Mount a live session from a definition factory. Call once per connected
21
+ * client: the factory's signals become that session's private state. To SHARE
22
+ * state across sessions, close the factory over a signal created OUTSIDE it —
23
+ * every session then reads the same signal and patches on its change.
24
+ */
25
+ export function mountLiveSession(factory) {
26
+ const { view, handlers = {} } = factory();
27
+ const listeners = new Set();
28
+ // slot → latest value. `pending` = current (un-flushed) batch; `buffer` =
29
+ // accumulated for pull consumers. Both keyed by slot so repeated writes in
30
+ // one batch collapse to the last value.
31
+ const pending = new Map();
32
+ const buffer = new Map();
33
+ let priming = true;
34
+ let flushScheduled = false;
35
+ const flush = () => {
36
+ flushScheduled = false;
37
+ if (pending.size === 0)
38
+ return;
39
+ const patch = [];
40
+ for (const [slot, value] of pending) {
41
+ patch.push({ slot, value });
42
+ buffer.set(slot, value);
43
+ }
44
+ pending.clear();
45
+ for (const listener of listeners)
46
+ listener(patch);
47
+ };
48
+ const scheduleFlush = () => {
49
+ if (flushScheduled)
50
+ return;
51
+ flushScheduled = true;
52
+ queueMicrotask(flush);
53
+ };
54
+ // One fine-grained effect per reactive slot. The priming run only
55
+ // subscribes; later runs (a signal changed) record the slot's new value.
56
+ const stops = view.values.map((value, slot) => {
57
+ if (!isSignal(value) && typeof value !== "function")
58
+ return () => { };
59
+ return effect(() => {
60
+ const next = String(value());
61
+ if (priming)
62
+ return;
63
+ pending.set(slot, next);
64
+ scheduleFlush();
65
+ });
66
+ });
67
+ priming = false;
68
+ return {
69
+ renderToString: () => renderToString(view),
70
+ dispatch(event, payload) {
71
+ const handler = handlers[event];
72
+ if (!handler)
73
+ return;
74
+ handler(payload);
75
+ flush(); // synchronous — one patch per dispatch (batches the handler's writes)
76
+ },
77
+ drainPatches() {
78
+ flush();
79
+ const patch = [];
80
+ for (const [slot, value] of buffer)
81
+ patch.push({ slot, value });
82
+ buffer.clear();
83
+ return patch;
84
+ },
85
+ onPatch(listener) {
86
+ listeners.add(listener);
87
+ return () => listeners.delete(listener);
88
+ },
89
+ dispose() {
90
+ for (const stop of stops)
91
+ stop();
92
+ listeners.clear();
93
+ pending.clear();
94
+ buffer.clear();
95
+ },
96
+ };
97
+ }
@@ -20,7 +20,7 @@ export interface AuroraRequestRenderer {
20
20
  /** Request context the middleware needs: render target + optional resolver/slot. */
21
21
  interface AuroraMiddlewareContext extends RenderHttpContext {
22
22
  containerResolver?: {
23
- make(token: unknown): unknown;
23
+ make(token: unknown): Promise<unknown>;
24
24
  };
25
25
  aurora?: AuroraRequestRenderer;
26
26
  }
@@ -19,9 +19,9 @@ function isManager(value) {
19
19
  "render" in value &&
20
20
  typeof value.render === "function");
21
21
  }
22
- function resolveManager(resolver) {
22
+ async function resolveManager(resolver) {
23
23
  try {
24
- const resolved = resolver?.make("aurora");
24
+ const resolved = await resolver?.make("aurora");
25
25
  return isManager(resolved) ? resolved : undefined;
26
26
  }
27
27
  catch {
@@ -32,8 +32,8 @@ function resolveManager(resolver) {
32
32
  * Middleware: attach `ctx.aurora` for the request. No-op (passes through) when
33
33
  * the AuroraManager isn't registered, so it's safe to mount unconditionally.
34
34
  */
35
- export function auroraContext(ctx, next) {
36
- const manager = resolveManager(ctx.containerResolver);
35
+ export async function auroraContext(ctx, next) {
36
+ const manager = await resolveManager(ctx.containerResolver);
37
37
  if (manager) {
38
38
  ctx.aurora = {
39
39
  render: (name, props, options) => manager.render(ctx, name, props, options),
package/dist/relay.d.ts CHANGED
@@ -17,8 +17,19 @@
17
17
  * `@c9up/aurora`. Node-side code that pulls it will trip on
18
18
  * `EventSource` being undefined.
19
19
  */
20
+ /**
21
+ * Connection lifecycle status. Mirrors `@adonisjs/transmit-client`'s
22
+ * `TransmitStatus` (minus `initializing`, which the singleton never
23
+ * exposes — the first `relay()` call opens straight into `connecting`).
24
+ */
25
+ export type RelayStatus = "connecting" | "connected" | "disconnected" | "reconnecting";
20
26
  export interface RelayClient {
21
27
  subscribe<E>(channel: string, handler: (event: E) => void): () => void;
28
+ /**
29
+ * Register a connection-status listener. Returns a detacher. Mirrors
30
+ * `transmit.on('connected' | 'disconnected' | ...)`.
31
+ */
32
+ on(status: RelayStatus, callback: (status: RelayStatus) => void): () => void;
22
33
  close(): void;
23
34
  }
24
35
  export interface RelayOptions {
@@ -26,13 +37,25 @@ export interface RelayOptions {
26
37
  sseUrl?: string;
27
38
  /** Subscribe POST endpoint. Defaults to `/__relay/subscribe`. */
28
39
  subscribeUrl?: string;
40
+ /** Unsubscribe POST endpoint. Defaults to `/__relay/unsubscribe`. */
41
+ unsubscribeUrl?: string;
29
42
  /** Optional bearer token (for guarded relay routes). */
30
43
  bearer?: string;
44
+ /**
45
+ * Give up after this many consecutive reconnect attempts. Default 5
46
+ * (Transmit parity). `0` disables the cap — the browser's native
47
+ * EventSource keeps retrying forever.
48
+ */
49
+ maxReconnectAttempts?: number;
50
+ /** Fired before each reconnect attempt with the 1-based attempt count. */
51
+ onReconnectAttempt?: (attempt: number) => void;
52
+ /** Fired once when `maxReconnectAttempts` is exhausted and we give up. */
53
+ onReconnectFailed?: () => void;
31
54
  }
32
55
  /**
33
- * Configure the relay endpoints + bearer. Call once at boot if you
34
- * need to override the defaults. Multiple calls overwrite — last call
35
- * wins.
56
+ * Configure the relay endpoints + bearer + reconnect policy. Call once
57
+ * at boot if you need to override the defaults. Multiple calls overwrite
58
+ * — last call wins.
36
59
  */
37
60
  export declare function configureRelay(options: RelayOptions): void;
38
61
  /**