@mmstack/mesh 21.15.0 → 21.15.1
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": "@mmstack/mesh",
|
|
3
|
-
"version": "21.15.
|
|
3
|
+
"version": "21.15.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"angular",
|
|
6
6
|
"signals",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@angular/core": ">=21 <22",
|
|
23
23
|
"@mmstack/primitives": ">=21.25 <22",
|
|
24
|
-
"@mmstack/mesh-protocol": ">=0.15 <1"
|
|
24
|
+
"@mmstack/mesh-protocol": ">=0.15.1 <1"
|
|
25
25
|
},
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"module": "fesm2022/mmstack-mesh.mjs",
|
package/types/mmstack-mesh.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import { StoreOp, ClientMsg, ServerMsg, Relay, PrincipalCtx, IceServer, ClientSignalMsg, PresenceState, OpPolicy } from '@mmstack/mesh-protocol';
|
|
2
|
-
import { OpEnvelope, OpSync, MergePolicyEntry, DiffOpsOptions, AsyncStore, ForkStoreOptions, SyncedFork, WritableSignalStore, StoreOp as StoreOp$1, toStoreOptions } from '@mmstack/primitives/core';
|
|
3
1
|
import { Signal, Injector, WritableSignal } from '@angular/core';
|
|
2
|
+
import { StoreOp, GenerationReason, TailPolicy, Hlc, ClientMsg, ServerMsg, Relay, PrincipalCtx, IceServer, ClientSignalMsg, PresenceState, OpPolicy } from '@mmstack/mesh-protocol';
|
|
3
|
+
import { OpEnvelope, OpSync, MergePolicyEntry, DiffOpsOptions, AsyncStore, ForkStoreOptions, SyncedFork, WritableSignalStore, StoreOp as StoreOp$1, toStoreOptions } from '@mmstack/primitives/core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* The client half of a room generation: the record fields a snapshot welcome carries, the admission
|
|
7
|
+
* evidence the client keeps for its pre-check, and the pure decisions the session takes on them
|
|
8
|
+
* (which welcome to install, what a new generation does with the pending tail, whether a replayed
|
|
9
|
+
* envelope may be sent, when a member is ready for a consensus cut). Nothing here touches a socket,
|
|
10
|
+
* a store or a timer, so a harness can drive the same decisions the session does.
|
|
11
|
+
*/
|
|
12
|
+
/** The immutable fields of the installed generation, as the client keeps them in its record. */
|
|
13
|
+
type InstalledGeneration = {
|
|
14
|
+
readonly instance: string;
|
|
15
|
+
readonly index: number;
|
|
16
|
+
readonly reason: GenerationReason;
|
|
17
|
+
readonly policy: TailPolicy;
|
|
18
|
+
readonly extent: Readonly<Record<string, Readonly<Record<string, Hlc>>>>;
|
|
19
|
+
readonly preCutMax: Readonly<Record<string, Hlc>>;
|
|
20
|
+
/** The seq of the snapshot welcome that installed it (or a later one of the same generation). */
|
|
21
|
+
readonly seq: number;
|
|
22
|
+
};
|
|
5
23
|
/**
|
|
6
24
|
* The authored intent of an envelope: its raw op list and one bump flag, what a re-author rebuilds
|
|
7
25
|
* from. The raws are the stamped ops without their expansion clears (a diffed write never emits a
|
|
@@ -71,6 +89,8 @@ type CompactionState = {
|
|
|
71
89
|
/** Origins of the members currently declared ready for a consensus cut. */
|
|
72
90
|
readonly ready: readonly string[];
|
|
73
91
|
};
|
|
92
|
+
/** The room generation the client installed, as its snapshot welcome named it. */
|
|
93
|
+
type GenerationState = Pick<InstalledGeneration, 'instance' | 'index' | 'reason' | 'policy'>;
|
|
74
94
|
type MeshStatus = 'connecting'
|
|
75
95
|
/** Queued behind another tab that owns this key's durable outbox (`crossTab: 'queue'`). */
|
|
76
96
|
| 'waiting' | 'live' | 'reconnecting' | 'ejected' | 'closed';
|
|
@@ -325,7 +345,7 @@ type MeshSyncOptions = {
|
|
|
325
345
|
/** The connection dropped and a reconnect is scheduled; `code` is the close code (1009 = message too big, 1006 = dropped). */
|
|
326
346
|
readonly onDisconnect?: (code: number, reason: string) => void;
|
|
327
347
|
/** A write the relay refused (see `MeshSessionHooks.onRefused`); the envelope carries its values. */
|
|
328
|
-
readonly onRefused?: (env: OpEnvelope, reason: 'generation' | 'schema' | 'order') => void;
|
|
348
|
+
readonly onRefused?: (env: OpEnvelope, reason: 'generation' | 'schema' | 'order' | 'compacting') => void;
|
|
329
349
|
/**
|
|
330
350
|
* Hold the connection until the local base is assembled. `meshSync` awaits this before it connects
|
|
331
351
|
* (and before it restores an `outbox`), so a store hydrated from another source first (a worker
|
|
@@ -432,6 +452,12 @@ type MeshSyncRef<T extends object = Record<string, unknown>> = {
|
|
|
432
452
|
readonly conflicts: Signal<readonly MeshConflict[]>;
|
|
433
453
|
/** The room's compaction state as the relay last announced it; undefined before any notice. */
|
|
434
454
|
readonly compaction: Signal<CompactionState | undefined>;
|
|
455
|
+
/**
|
|
456
|
+
* The room generation this client installed: set by every snapshot welcome of a new generation
|
|
457
|
+
* (a cut's welcome flips it), untouched by one of the installed generation. Undefined until the
|
|
458
|
+
* first snapshot welcome and after a room was recreated without its record.
|
|
459
|
+
*/
|
|
460
|
+
readonly generation: Signal<GenerationState | undefined>;
|
|
435
461
|
/**
|
|
436
462
|
* The member pressed (`true`) or released Compact: the client declares itself ready for a
|
|
437
463
|
* consensus cut whenever nothing it wrote is outstanding, re-declaring on every change. A
|
|
@@ -510,7 +536,7 @@ type AgentSeatOptions = {
|
|
|
510
536
|
readonly context?: toStoreOptions;
|
|
511
537
|
readonly onEject?: (reason: string) => void;
|
|
512
538
|
/** A write the relay refused; it is not in the room, and the doc was rehydrated. The envelope carries its values. */
|
|
513
|
-
readonly onRefused?: (env: OpEnvelope, reason: 'generation' | 'schema' | 'order') => void;
|
|
539
|
+
readonly onRefused?: (env: OpEnvelope, reason: 'generation' | 'schema' | 'order' | 'compacting') => void;
|
|
514
540
|
};
|
|
515
541
|
type AgentSeat<T extends object> = {
|
|
516
542
|
/** The live converging replica. Reads exactly like a local signal store. */
|
|
@@ -531,6 +557,14 @@ type AgentSeat<T extends object> = {
|
|
|
531
557
|
* carry, or a relay refusal), each with `discard()` and `reauthor()`.
|
|
532
558
|
*/
|
|
533
559
|
conflicts(): readonly MeshConflict[];
|
|
560
|
+
/** The room's compaction state as the relay last announced it; undefined before any notice. */
|
|
561
|
+
readonly compaction: Signal<CompactionState | undefined>;
|
|
562
|
+
/**
|
|
563
|
+
* The seat pressed (`true`) or released Compact: it declares itself ready for a consensus cut
|
|
564
|
+
* whenever it is connected and nothing it wrote is outstanding, re-declaring on every change. A
|
|
565
|
+
* reconnect or a new generation releases it.
|
|
566
|
+
*/
|
|
567
|
+
declareReady(pressed: boolean): void;
|
|
534
568
|
/** Path-addressed write (`'a.b.c'` or segments), emitted immediately. */
|
|
535
569
|
setAtPath(path: string | readonly (string | number)[], value: unknown): void;
|
|
536
570
|
/**
|