@graphrefly/graphrefly 0.15.0 → 0.17.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/{chunk-4APC3AFN.js → chunk-2PORF4RP.js} +22 -49
- package/dist/chunk-2PORF4RP.js.map +1 -0
- package/dist/{chunk-QVYZD65U.js → chunk-646OG3PO.js} +10 -38
- package/dist/chunk-646OG3PO.js.map +1 -0
- package/dist/{chunk-H243FWYP.js → chunk-BV3TPSBK.js} +1 -2
- package/dist/chunk-BV3TPSBK.js.map +1 -0
- package/dist/chunk-EBNKJULL.js +231 -0
- package/dist/chunk-EBNKJULL.js.map +1 -0
- package/dist/{chunk-XQ4UMAU7.js → chunk-F2ULI3Q3.js} +2 -2
- package/dist/{chunk-CRACCCJY.js → chunk-IHJHBADD.js} +29 -5
- package/dist/chunk-IHJHBADD.js.map +1 -0
- package/dist/{chunk-YW6LFCFS.js → chunk-R6OHUUYB.js} +3 -3
- package/dist/{chunk-2ZICUAUJ.js → chunk-XJ6EMQ22.js} +10 -12
- package/dist/chunk-XJ6EMQ22.js.map +1 -0
- package/dist/{chunk-GKRKDYNT.js → chunk-YXROQFXZ.js} +3 -3
- package/dist/compat/nestjs/index.cjs +38 -42
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +7 -7
- package/dist/core/index.cjs +0 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +3 -3
- package/dist/extra/index.cjs +27 -79
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +4 -4
- package/dist/extra/index.d.ts +4 -4
- package/dist/extra/index.js +3 -3
- package/dist/graph/index.cjs +151 -5
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +10 -6
- package/dist/{graph-BXIK5Dq5.d.ts → graph-Dc-P9BVm.d.ts} +15 -3
- package/dist/{graph-BhADtuFU.d.cts → graph-fCsaaVIa.d.cts} +15 -3
- package/dist/{index-BkToATim.d.ts → index-4OIX-q0C.d.cts} +88 -3
- package/dist/{index-DSp5R3Xq.d.ts → index-BBVBYPxr.d.cts} +4 -4
- package/dist/{index-BNB0KjKe.d.ts → index-BmoUvOGN.d.ts} +1 -1
- package/dist/{index-DBhLjWSV.d.cts → index-ClaKZFPl.d.cts} +100 -31
- package/dist/{index-Wa8jXne6.d.cts → index-D7y9Q8W4.d.ts} +88 -3
- package/dist/{index-Dqemj9q0.d.cts → index-DWq0P9T6.d.ts} +4 -4
- package/dist/{index-fYObbpUw.d.ts → index-DhXznWyH.d.ts} +2 -2
- package/dist/{index-DANO9Gg7.d.cts → index-DlGMf_Qe.d.cts} +2 -2
- package/dist/{index-CKyYg4IP.d.ts → index-N704txAA.d.ts} +100 -31
- package/dist/{index-DKIyo4Bq.d.cts → index-YlOH1Gw6.d.cts} +1 -1
- package/dist/index.cjs +302 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -41
- package/dist/index.d.ts +71 -41
- package/dist/index.js +131 -151
- package/dist/index.js.map +1 -1
- package/dist/{meta-CrZUQAJ6.d.cts → meta-BV4pj9ML.d.cts} +6 -0
- package/dist/{meta-CrZUQAJ6.d.ts → meta-BV4pj9ML.d.ts} +6 -0
- package/dist/observable-Cz-AWhwR.d.cts +42 -0
- package/dist/observable-DCqlwGyl.d.ts +42 -0
- package/dist/patterns/reactive-layout/index.cjs +26 -3
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-2ZICUAUJ.js.map +0 -1
- package/dist/chunk-4APC3AFN.js.map +0 -1
- package/dist/chunk-CRACCCJY.js.map +0 -1
- package/dist/chunk-H243FWYP.js.map +0 -1
- package/dist/chunk-QVYZD65U.js.map +0 -1
- package/dist/chunk-ZHTHUX5D.js +0 -107
- package/dist/chunk-ZHTHUX5D.js.map +0 -1
- package/dist/reactive-log-ChbpUrY2.d.cts +0 -137
- package/dist/reactive-log-DV--7BWd.d.ts +0 -137
- /package/dist/{chunk-XQ4UMAU7.js.map → chunk-F2ULI3Q3.js.map} +0 -0
- /package/dist/{chunk-YW6LFCFS.js.map → chunk-R6OHUUYB.js.map} +0 -0
- /package/dist/{chunk-GKRKDYNT.js.map → chunk-YXROQFXZ.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/index.ts","../src/graph/codec.ts"],"sourcesContent":["/**\n * Graph container: registry, wiring, introspection (Phase 1).\n */\n\nexport {\n\tcreateDagCborCodec,\n\tcreateDagCborZstdCodec,\n\ttype DeltaCheckpoint,\n\ttype EvictedSubgraphInfo,\n\ttype EvictionPolicy,\n\ttype GraphCodec,\n\tJsonCodec,\n\ttype LazyGraphCodec,\n\tnegotiateCodec,\n\treplayWAL,\n\ttype WALEntry,\n} from \"./codec.js\";\nexport {\n\ttype AutoCheckpointAdapter,\n\ttype DescribeFilter,\n\tGRAPH_META_SEGMENT,\n\tGraph,\n\ttype GraphActorOptions,\n\ttype GraphAutoCheckpointHandle,\n\ttype GraphAutoCheckpointOptions,\n\ttype GraphCheckpointRecord,\n\ttype GraphDescribeOptions,\n\ttype GraphDescribeOutput,\n\ttype GraphDiagramDirection,\n\ttype GraphDiagramOptions,\n\ttype GraphDiffChange,\n\ttype GraphDiffResult,\n\ttype GraphDumpOptions,\n\ttype GraphFactoryContext,\n\ttype GraphNodeFactory,\n\ttype GraphObserveAll,\n\ttype GraphObserveOne,\n\ttype GraphOptions,\n\ttype GraphPersistSnapshot,\n\ttype GraphSpyHandle,\n\ttype GraphSpyOptions,\n\ttype GraphSpyTheme,\n\ttype GraphSpyThemeName,\n\ttype ObserveDetail,\n\ttype ObserveEvent,\n\ttype ObserveOptions,\n\ttype ObserveResult,\n\ttype ReachableDirection,\n\ttype ReachableOptions,\n\treachable,\n\ttype TraceEntry,\n} from \"./graph.js\";\n","/**\n * GraphCodec — pluggable serialization for graph snapshots (Phase 8.6).\n *\n * Design reference: `archive/docs/SESSION-serialization-memory-footprint.md`\n *\n * The codec interface decouples snapshot format from graph internals.\n * Default is JSON (current behavior). DAG-CBOR and compressed variants\n * ship as optional codecs. FlatBuffers/Arrow for advanced tiers.\n *\n * Tiered representation:\n * HOT — JS objects (live propagation, no codec involved)\n * WARM — DAG-CBOR in-memory buffer (lazy hydration, delta checkpoints)\n * COLD — Arrow/Parquet (bulk storage, ML pipelines, archival)\n * PEEK — FlatBuffers (zero-copy read from dormant graph)\n */\n\nimport type { GraphPersistSnapshot } from \"./graph.js\";\n\n// ---------------------------------------------------------------------------\n// Core codec interface\n// ---------------------------------------------------------------------------\n\n/**\n * Encode/decode graph snapshots to/from binary.\n *\n * Implementations must be deterministic: `encode(x)` always produces the\n * same bytes for the same input. This is critical for CID computation (V1)\n * and snapshot hash-comparison.\n */\nexport interface GraphCodec {\n\t/** MIME-like content type identifier (e.g. \"application/dag-cbor+zstd\"). */\n\treadonly contentType: string;\n\n\t/** Human-readable name for diagnostics. */\n\treadonly name: string;\n\n\t/** Encode a snapshot to binary. */\n\tencode(snapshot: GraphPersistSnapshot): Uint8Array;\n\n\t/**\n\t * Decode binary back to a snapshot.\n\t *\n\t * For lazy codecs, this may return a proxy that decodes nodes on access\n\t * (see {@link LazyGraphCodec}).\n\t */\n\tdecode(buffer: Uint8Array): GraphPersistSnapshot;\n}\n\n/**\n * Extended codec that supports lazy (on-demand) node decoding.\n *\n * `decodeLazy` returns a snapshot where `nodes` is a Proxy — individual\n * nodes are decoded only when accessed. This enables near-zero cold-start\n * for large graphs (decode envelope + topology, skip node values until read).\n */\nexport interface LazyGraphCodec extends GraphCodec {\n\t/** Decode envelope and topology; defer node value decoding to access time. */\n\tdecodeLazy(buffer: Uint8Array): GraphPersistSnapshot;\n}\n\n// ---------------------------------------------------------------------------\n// Delta checkpoint types (requires V0 — Phase 6.0)\n// ---------------------------------------------------------------------------\n\n/**\n * A delta checkpoint: only the nodes that changed since last checkpoint.\n *\n * Append-only: each delta is identified by `seq` (monotonic). A full\n * snapshot is taken every `compactEvery` deltas for WAL compaction.\n */\nexport interface DeltaCheckpoint {\n\t/** Monotonic sequence number. */\n\tseq: number;\n\t/** Graph name. */\n\tname: string;\n\t/** Base snapshot seq this delta applies to (0 = initial full snapshot). */\n\tbaseSec: number;\n\t/** Only nodes with version > lastCheckpoint. Keyed by node name. */\n\tnodes: Record<\n\t\tstring,\n\t\t{\n\t\t\t/** V0 version at time of checkpoint. */\n\t\t\tversion: number;\n\t\t\t/** Serialized node value (codec-dependent). */\n\t\t\tvalue: unknown;\n\t\t\t/** Meta snapshot (only if materialized). */\n\t\t\tmeta?: Record<string, unknown>;\n\t\t}\n\t>;\n\t/** Nodes removed since last checkpoint. */\n\tremoved: string[];\n\t/** Edges added since last checkpoint. */\n\tedgesAdded: ReadonlyArray<{ from: string; to: string }>;\n\t/** Edges removed since last checkpoint. */\n\tedgesRemoved: ReadonlyArray<{ from: string; to: string }>;\n\t/** Timestamp (wall-clock ns) of this checkpoint. */\n\ttimestampNs: bigint;\n}\n\n/**\n * WAL entry: either a full snapshot or a delta.\n */\nexport type WALEntry =\n\t| { type: \"full\"; snapshot: GraphPersistSnapshot; seq: number }\n\t| { type: \"delta\"; delta: DeltaCheckpoint };\n\n// ---------------------------------------------------------------------------\n// Eviction policy (dormant subgraph management)\n// ---------------------------------------------------------------------------\n\n/**\n * Policy for evicting dormant subgraphs to reduce memory.\n *\n * When a subgraph hasn't propagated for `idleTimeoutMs`, it is serialized\n * using the graph's codec and JS objects are released. Re-hydrated on next\n * access (read, propagation, describe).\n */\nexport interface EvictionPolicy {\n\t/** Milliseconds of inactivity before eviction. */\n\tidleTimeoutMs: number;\n\t/** Codec to use for serializing evicted subgraphs (default: graph's codec). */\n\tcodec?: GraphCodec;\n}\n\n/** Metadata about an evicted subgraph, exposed via describe(). */\nexport interface EvictedSubgraphInfo {\n\t/** True if currently evicted (serialized, JS objects released). */\n\tevicted: true;\n\t/** Wall-clock ns of last propagation before eviction. */\n\tlastActiveNs: bigint;\n\t/** Size of serialized buffer in bytes. */\n\tserializedBytes: number;\n\t/** Codec used for serialization. */\n\tcodecName: string;\n}\n\n// ---------------------------------------------------------------------------\n// JSON codec (default — wraps current behavior)\n// ---------------------------------------------------------------------------\n\n/**\n * Default JSON codec. Wraps `JSON.stringify`/`JSON.parse` with deterministic\n * key ordering (matching current `snapshot()` behavior).\n */\nexport const JsonCodec: GraphCodec = {\n\tcontentType: \"application/json\",\n\tname: \"json\",\n\n\tencode(snapshot: GraphPersistSnapshot): Uint8Array {\n\t\t// Deterministic: snapshot() already sorts keys.\n\t\tconst json = JSON.stringify(snapshot);\n\t\treturn new TextEncoder().encode(json);\n\t},\n\n\tdecode(buffer: Uint8Array): GraphPersistSnapshot {\n\t\tconst json = new TextDecoder().decode(buffer);\n\t\treturn JSON.parse(json) as GraphPersistSnapshot;\n\t},\n};\n\n// ---------------------------------------------------------------------------\n// DAG-CBOR codec (stub — requires @ipld/dag-cbor)\n// ---------------------------------------------------------------------------\n\n/**\n * Create a DAG-CBOR codec.\n *\n * Requires `@ipld/dag-cbor` as a peer dependency. ~40-50% smaller than JSON,\n * deterministic encoding (required for V1 CID), CID links as native type.\n *\n * @example\n * ```ts\n * import * as dagCbor from \"@ipld/dag-cbor\";\n * const codec = createDagCborCodec(dagCbor);\n * const bytes = codec.encode(graph.snapshot());\n * ```\n */\nexport function createDagCborCodec(dagCbor: {\n\tencode: (value: unknown) => Uint8Array;\n\tdecode: (bytes: Uint8Array) => unknown;\n}): GraphCodec {\n\treturn {\n\t\tcontentType: \"application/dag-cbor\",\n\t\tname: \"dag-cbor\",\n\t\tencode: (snapshot) => dagCbor.encode(snapshot),\n\t\tdecode: (buffer) => dagCbor.decode(buffer) as GraphPersistSnapshot,\n\t};\n}\n\n/**\n * Create a DAG-CBOR + zstd codec. ~80-90% smaller than JSON.\n *\n * Requires `@ipld/dag-cbor` and a zstd implementation (e.g. `fzstd` for\n * browser, `node:zlib` for Node.js).\n *\n * @example\n * ```ts\n * import * as dagCbor from \"@ipld/dag-cbor\";\n * import { compressSync, decompressSync } from \"fzstd\";\n * const codec = createDagCborZstdCodec(dagCbor, { compressSync, decompressSync });\n * ```\n */\nexport function createDagCborZstdCodec(\n\tdagCbor: {\n\t\tencode: (value: unknown) => Uint8Array;\n\t\tdecode: (bytes: Uint8Array) => unknown;\n\t},\n\tzstd: {\n\t\tcompressSync: (data: Uint8Array) => Uint8Array;\n\t\tdecompressSync: (data: Uint8Array) => Uint8Array;\n\t},\n): GraphCodec {\n\treturn {\n\t\tcontentType: \"application/dag-cbor+zstd\",\n\t\tname: \"dag-cbor-zstd\",\n\t\tencode: (snapshot) => zstd.compressSync(dagCbor.encode(snapshot)),\n\t\tdecode: (buffer) => dagCbor.decode(zstd.decompressSync(buffer)) as GraphPersistSnapshot,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Codec negotiation (for peerGraph)\n// ---------------------------------------------------------------------------\n\n/**\n * Negotiate a common codec between two peers.\n *\n * Each peer advertises its supported codecs (ordered by preference).\n * Returns the first codec supported by both, or null if none.\n */\nexport function negotiateCodec(\n\tlocalPreference: readonly GraphCodec[],\n\tremoteContentTypes: readonly string[],\n): GraphCodec | null {\n\tconst remoteSet = new Set(remoteContentTypes);\n\tfor (const codec of localPreference) {\n\t\tif (remoteSet.has(codec.contentType)) return codec;\n\t}\n\treturn null;\n}\n\n// ---------------------------------------------------------------------------\n// WAL helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Reconstruct a snapshot from a WAL (full snapshot + sequence of deltas).\n *\n * Applies deltas in order on top of the base snapshot. Validates that\n * delta `baseSec` chains correctly.\n */\nexport function replayWAL(entries: readonly WALEntry[]): GraphPersistSnapshot {\n\tif (entries.length === 0) {\n\t\tthrow new Error(\"WAL is empty — need at least one full snapshot\");\n\t}\n\n\tconst first = entries[0]!;\n\tif (first.type !== \"full\") {\n\t\tthrow new Error(\"WAL must start with a full snapshot\");\n\t}\n\n\t// Deep clone the base snapshot so we can mutate it.\n\tconst result: GraphPersistSnapshot = JSON.parse(JSON.stringify(first.snapshot));\n\n\tfor (let i = 1; i < entries.length; i++) {\n\t\tconst entry = entries[i]!;\n\t\tif (entry.type === \"full\") {\n\t\t\t// A compaction point — replace the entire result.\n\t\t\tObject.assign(result, JSON.parse(JSON.stringify(entry.snapshot)));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst delta = entry.delta;\n\n\t\t// Apply node changes.\n\t\tfor (const [name, patch] of Object.entries(delta.nodes)) {\n\t\t\tif (result.nodes[name]) {\n\t\t\t\tresult.nodes[name]!.value = patch.value;\n\t\t\t\tif (patch.meta) {\n\t\t\t\t\tresult.nodes[name]!.meta = patch.meta;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Apply removals.\n\t\tfor (const name of delta.removed) {\n\t\t\tdelete result.nodes[name];\n\t\t}\n\n\t\t// Apply edge changes.\n\t\tconst edges = [...result.edges];\n\t\tfor (const edge of delta.edgesRemoved) {\n\t\t\tconst idx = edges.findIndex((e) => e.from === edge.from && e.to === edge.to);\n\t\t\tif (idx !== -1) edges.splice(idx, 1);\n\t\t}\n\t\tfor (const edge of delta.edgesAdded) {\n\t\t\tedges.push(edge);\n\t\t}\n\t\t(result as unknown as { edges: typeof edges }).edges = edges;\n\t}\n\n\treturn result;\n}\n"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgJO,IAAM,YAAwB;AAAA,EACpC,aAAa;AAAA,EACb,MAAM;AAAA,EAEN,OAAO,UAA4C;AAElD,UAAM,OAAO,KAAK,UAAU,QAAQ;AACpC,WAAO,IAAI,YAAY,EAAE,OAAO,IAAI;AAAA,EACrC;AAAA,EAEA,OAAO,QAA0C;AAChD,UAAM,OAAO,IAAI,YAAY,EAAE,OAAO,MAAM;AAC5C,WAAO,KAAK,MAAM,IAAI;AAAA,EACvB;AACD;AAmBO,SAAS,mBAAmB,SAGpB;AACd,SAAO;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QAAQ,CAAC,aAAa,QAAQ,OAAO,QAAQ;AAAA,IAC7C,QAAQ,CAAC,WAAW,QAAQ,OAAO,MAAM;AAAA,EAC1C;AACD;AAeO,SAAS,uBACf,SAIA,MAIa;AACb,SAAO;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,QAAQ,CAAC,aAAa,KAAK,aAAa,QAAQ,OAAO,QAAQ,CAAC;AAAA,IAChE,QAAQ,CAAC,WAAW,QAAQ,OAAO,KAAK,eAAe,MAAM,CAAC;AAAA,EAC/D;AACD;AAYO,SAAS,eACf,iBACA,oBACoB;AACpB,QAAM,YAAY,IAAI,IAAI,kBAAkB;AAC5C,aAAW,SAAS,iBAAiB;AACpC,QAAI,UAAU,IAAI,MAAM,WAAW,EAAG,QAAO;AAAA,EAC9C;AACA,SAAO;AACR;AAYO,SAAS,UAAU,SAAoD;AAC7E,MAAI,QAAQ,WAAW,GAAG;AACzB,UAAM,IAAI,MAAM,qDAAgD;AAAA,EACjE;AAEA,QAAM,QAAQ,QAAQ,CAAC;AACvB,MAAI,MAAM,SAAS,QAAQ;AAC1B,UAAM,IAAI,MAAM,qCAAqC;AAAA,EACtD;AAGA,QAAM,SAA+B,KAAK,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC;AAE9E,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACxC,UAAM,QAAQ,QAAQ,CAAC;AACvB,QAAI,MAAM,SAAS,QAAQ;AAE1B,aAAO,OAAO,QAAQ,KAAK,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC,CAAC;AAChE;AAAA,IACD;AAEA,UAAM,QAAQ,MAAM;AAGpB,eAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,MAAM,KAAK,GAAG;AACxD,UAAI,OAAO,MAAM,IAAI,GAAG;AACvB,eAAO,MAAM,IAAI,EAAG,QAAQ,MAAM;AAClC,YAAI,MAAM,MAAM;AACf,iBAAO,MAAM,IAAI,EAAG,OAAO,MAAM;AAAA,QAClC;AAAA,MACD;AAAA,IACD;AAGA,eAAW,QAAQ,MAAM,SAAS;AACjC,aAAO,OAAO,MAAM,IAAI;AAAA,IACzB;AAGA,UAAM,QAAQ,CAAC,GAAG,OAAO,KAAK;AAC9B,eAAW,QAAQ,MAAM,cAAc;AACtC,YAAM,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,SAAS,KAAK,QAAQ,EAAE,OAAO,KAAK,EAAE;AAC3E,UAAI,QAAQ,GAAI,OAAM,OAAO,KAAK,CAAC;AAAA,IACpC;AACA,eAAW,QAAQ,MAAM,YAAY;AACpC,YAAM,KAAK,IAAI;AAAA,IAChB;AACA,IAAC,OAA8C,QAAQ;AAAA,EACxD;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { m as Messages, N as Node } from './meta-CrZUQAJ6.cjs';
|
|
3
|
-
import { G as Graph, x as ObserveOptions } from './graph-BhADtuFU.cjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Bridge a `Node<T>` to an RxJS `Observable<T>`.
|
|
7
|
-
*
|
|
8
|
-
* Emits the node's value on each `DATA` message. Maps `ERROR` to
|
|
9
|
-
* `subscriber.error()` and `COMPLETE` to `subscriber.complete()`.
|
|
10
|
-
* Protocol-internal signals (DIRTY, RESOLVED, PAUSE, etc.) are skipped.
|
|
11
|
-
*
|
|
12
|
-
* Unsubscribing the Observable unsubscribes the node.
|
|
13
|
-
*/
|
|
14
|
-
declare function toObservable<T>(node: Node<T>): Observable<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Bridge a `Node<T>` to an `Observable<Messages>` — raw message batches.
|
|
17
|
-
*
|
|
18
|
-
* Each emission is a full `[[Type, Data?], ...]` batch. The Observable
|
|
19
|
-
* terminates on ERROR or COMPLETE (the terminal batch is still emitted
|
|
20
|
-
* as the final `next()` before the Observable signal).
|
|
21
|
-
*/
|
|
22
|
-
declare function toMessages$<T>(node: Node<T>): Observable<Messages>;
|
|
23
|
-
/**
|
|
24
|
-
* Observe a single node in a `Graph` as an `Observable<T>`.
|
|
25
|
-
*
|
|
26
|
-
* Equivalent to `toObservable(graph.resolve(path))` but routes through
|
|
27
|
-
* `graph.observe()` so actor guards are respected when provided.
|
|
28
|
-
*/
|
|
29
|
-
declare function observeNode$<T>(graph: Graph, path: string, options?: ObserveOptions): Observable<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Observe all nodes in a `Graph` as an `Observable<{ path, messages }>`.
|
|
32
|
-
*
|
|
33
|
-
* Each emission carries the qualified node path and the raw message batch.
|
|
34
|
-
* The Observable never self-completes (graphs are long-lived); dispose by
|
|
35
|
-
* unsubscribing.
|
|
36
|
-
*/
|
|
37
|
-
declare function observeGraph$(graph: Graph, options?: ObserveOptions): Observable<{
|
|
38
|
-
path: string;
|
|
39
|
-
messages: Messages;
|
|
40
|
-
}>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Shared internals for roadmap §3.2 data structures (option B — versioned snapshots).
|
|
44
|
-
*
|
|
45
|
-
* @remarks
|
|
46
|
-
* Not re-exported from the package barrel; consumers use concrete factories
|
|
47
|
-
* (`reactiveMap`, …). Keeps `equals` / snapshot wiring consistent across
|
|
48
|
-
* collections without exposing a second public protocol.
|
|
49
|
-
*
|
|
50
|
-
* @packageDocumentation
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* Immutable value paired with a monotonic version for {@link NodeOptions.equals}.
|
|
55
|
-
* Downstream nodes can treat unchanged versions as `RESOLVED`-eligible via `equals`.
|
|
56
|
-
*
|
|
57
|
-
* When the backing node has V0 versioning (GRAPHREFLY-SPEC §7), `v0` carries
|
|
58
|
-
* the node's identity (`id`) and version counter for diff-friendly observation
|
|
59
|
-
* and cross-snapshot dedup (roadmap §6.0b).
|
|
60
|
-
*/
|
|
61
|
-
type Versioned<T> = {
|
|
62
|
-
readonly version: number;
|
|
63
|
-
readonly value: T;
|
|
64
|
-
/** V0 identity from the backing node, when versioning is enabled. */
|
|
65
|
-
readonly v0?: {
|
|
66
|
-
readonly id: string;
|
|
67
|
-
readonly version: number;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type ReactiveLogSnapshot<T> = Versioned<{
|
|
72
|
-
entries: readonly T[];
|
|
73
|
-
}>;
|
|
74
|
-
type ReactiveLogOptions = {
|
|
75
|
-
name?: string;
|
|
76
|
-
maxSize?: number;
|
|
77
|
-
};
|
|
78
|
-
type ReactiveLogBundle<T> = {
|
|
79
|
-
/** Emits {@link ReactiveLogSnapshot} on each append/clear (two-phase). */
|
|
80
|
-
readonly entries: Node<ReactiveLogSnapshot<T>>;
|
|
81
|
-
append: (value: T) => void;
|
|
82
|
-
/** Push all values, trim once, emit one snapshot. */
|
|
83
|
-
appendMany: (values: readonly T[]) => void;
|
|
84
|
-
clear: () => void;
|
|
85
|
-
/** Remove the first `n` entries; emits snapshot. */
|
|
86
|
-
trimHead: (n: number) => void;
|
|
87
|
-
/** Last `n` entries (or fewer); updates when the log changes. */
|
|
88
|
-
tail: (n: number) => Node<readonly T[]>;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Creates an append-only reactive log with versioned tuple snapshots.
|
|
92
|
-
*
|
|
93
|
-
* @param initial - Optional seed entries (copied).
|
|
94
|
-
* @param options - Optional `name` for `describe()` / debugging.
|
|
95
|
-
* @returns Bundle with `entries` (state node), `append`, `clear`, and {@link ReactiveLogBundle.tail}.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* **Derived views:** {@link tail} and {@link logSlice} install an internal noop subscription so
|
|
99
|
-
* `get()` stays wired without an external sink; creating very many disposable derived nodes can
|
|
100
|
-
* retain subscriptions until the log bundle is unreachable.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* import { reactiveLog } from "@graphrefly/graphrefly-ts";
|
|
105
|
-
*
|
|
106
|
-
* const lg = reactiveLog<number>([1, 2], { name: "audit" });
|
|
107
|
-
* lg.append(3);
|
|
108
|
-
* lg.entries.subscribe((msgs) => console.log(msgs));
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* @category extra
|
|
112
|
-
*/
|
|
113
|
-
declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions): ReactiveLogBundle<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Builds a derived node for `entries.slice(start, stop)` (same semantics as `Array.prototype.slice`; `stop` exclusive).
|
|
116
|
-
*
|
|
117
|
-
* @param log - Log from {@link reactiveLog}.
|
|
118
|
-
* @param start - Start index (must be `>= 0`).
|
|
119
|
-
* @param stop - End index (exclusive); omit to slice to the end.
|
|
120
|
-
* @returns Derived node emitting the sliced readonly array.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```ts
|
|
124
|
-
* import { reactiveLog, logSlice } from "@graphrefly/graphrefly-ts";
|
|
125
|
-
*
|
|
126
|
-
* const lg = reactiveLog<number>([10, 20, 30, 40, 50]);
|
|
127
|
-
* const slice$ = logSlice(lg, 1, 4); // reactive view of [20, 30, 40]
|
|
128
|
-
* slice$.subscribe((msgs) => console.log(msgs));
|
|
129
|
-
*
|
|
130
|
-
* lg.append(60); // slice$ now reflects [20, 30, 40] (indices 1–3 of updated log)
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @category extra
|
|
134
|
-
*/
|
|
135
|
-
declare function logSlice<T>(log: ReactiveLogBundle<T>, start: number, stop?: number): Node<readonly T[]>;
|
|
136
|
-
|
|
137
|
-
export { type ReactiveLogSnapshot as R, type Versioned as V, type ReactiveLogBundle as a, type ReactiveLogOptions as b, observeNode$ as c, toObservable as d, logSlice as l, observeGraph$ as o, reactiveLog as r, toMessages$ as t };
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { m as Messages, N as Node } from './meta-CrZUQAJ6.js';
|
|
3
|
-
import { G as Graph, x as ObserveOptions } from './graph-BXIK5Dq5.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Bridge a `Node<T>` to an RxJS `Observable<T>`.
|
|
7
|
-
*
|
|
8
|
-
* Emits the node's value on each `DATA` message. Maps `ERROR` to
|
|
9
|
-
* `subscriber.error()` and `COMPLETE` to `subscriber.complete()`.
|
|
10
|
-
* Protocol-internal signals (DIRTY, RESOLVED, PAUSE, etc.) are skipped.
|
|
11
|
-
*
|
|
12
|
-
* Unsubscribing the Observable unsubscribes the node.
|
|
13
|
-
*/
|
|
14
|
-
declare function toObservable<T>(node: Node<T>): Observable<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Bridge a `Node<T>` to an `Observable<Messages>` — raw message batches.
|
|
17
|
-
*
|
|
18
|
-
* Each emission is a full `[[Type, Data?], ...]` batch. The Observable
|
|
19
|
-
* terminates on ERROR or COMPLETE (the terminal batch is still emitted
|
|
20
|
-
* as the final `next()` before the Observable signal).
|
|
21
|
-
*/
|
|
22
|
-
declare function toMessages$<T>(node: Node<T>): Observable<Messages>;
|
|
23
|
-
/**
|
|
24
|
-
* Observe a single node in a `Graph` as an `Observable<T>`.
|
|
25
|
-
*
|
|
26
|
-
* Equivalent to `toObservable(graph.resolve(path))` but routes through
|
|
27
|
-
* `graph.observe()` so actor guards are respected when provided.
|
|
28
|
-
*/
|
|
29
|
-
declare function observeNode$<T>(graph: Graph, path: string, options?: ObserveOptions): Observable<T>;
|
|
30
|
-
/**
|
|
31
|
-
* Observe all nodes in a `Graph` as an `Observable<{ path, messages }>`.
|
|
32
|
-
*
|
|
33
|
-
* Each emission carries the qualified node path and the raw message batch.
|
|
34
|
-
* The Observable never self-completes (graphs are long-lived); dispose by
|
|
35
|
-
* unsubscribing.
|
|
36
|
-
*/
|
|
37
|
-
declare function observeGraph$(graph: Graph, options?: ObserveOptions): Observable<{
|
|
38
|
-
path: string;
|
|
39
|
-
messages: Messages;
|
|
40
|
-
}>;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Shared internals for roadmap §3.2 data structures (option B — versioned snapshots).
|
|
44
|
-
*
|
|
45
|
-
* @remarks
|
|
46
|
-
* Not re-exported from the package barrel; consumers use concrete factories
|
|
47
|
-
* (`reactiveMap`, …). Keeps `equals` / snapshot wiring consistent across
|
|
48
|
-
* collections without exposing a second public protocol.
|
|
49
|
-
*
|
|
50
|
-
* @packageDocumentation
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* Immutable value paired with a monotonic version for {@link NodeOptions.equals}.
|
|
55
|
-
* Downstream nodes can treat unchanged versions as `RESOLVED`-eligible via `equals`.
|
|
56
|
-
*
|
|
57
|
-
* When the backing node has V0 versioning (GRAPHREFLY-SPEC §7), `v0` carries
|
|
58
|
-
* the node's identity (`id`) and version counter for diff-friendly observation
|
|
59
|
-
* and cross-snapshot dedup (roadmap §6.0b).
|
|
60
|
-
*/
|
|
61
|
-
type Versioned<T> = {
|
|
62
|
-
readonly version: number;
|
|
63
|
-
readonly value: T;
|
|
64
|
-
/** V0 identity from the backing node, when versioning is enabled. */
|
|
65
|
-
readonly v0?: {
|
|
66
|
-
readonly id: string;
|
|
67
|
-
readonly version: number;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
type ReactiveLogSnapshot<T> = Versioned<{
|
|
72
|
-
entries: readonly T[];
|
|
73
|
-
}>;
|
|
74
|
-
type ReactiveLogOptions = {
|
|
75
|
-
name?: string;
|
|
76
|
-
maxSize?: number;
|
|
77
|
-
};
|
|
78
|
-
type ReactiveLogBundle<T> = {
|
|
79
|
-
/** Emits {@link ReactiveLogSnapshot} on each append/clear (two-phase). */
|
|
80
|
-
readonly entries: Node<ReactiveLogSnapshot<T>>;
|
|
81
|
-
append: (value: T) => void;
|
|
82
|
-
/** Push all values, trim once, emit one snapshot. */
|
|
83
|
-
appendMany: (values: readonly T[]) => void;
|
|
84
|
-
clear: () => void;
|
|
85
|
-
/** Remove the first `n` entries; emits snapshot. */
|
|
86
|
-
trimHead: (n: number) => void;
|
|
87
|
-
/** Last `n` entries (or fewer); updates when the log changes. */
|
|
88
|
-
tail: (n: number) => Node<readonly T[]>;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Creates an append-only reactive log with versioned tuple snapshots.
|
|
92
|
-
*
|
|
93
|
-
* @param initial - Optional seed entries (copied).
|
|
94
|
-
* @param options - Optional `name` for `describe()` / debugging.
|
|
95
|
-
* @returns Bundle with `entries` (state node), `append`, `clear`, and {@link ReactiveLogBundle.tail}.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* **Derived views:** {@link tail} and {@link logSlice} install an internal noop subscription so
|
|
99
|
-
* `get()` stays wired without an external sink; creating very many disposable derived nodes can
|
|
100
|
-
* retain subscriptions until the log bundle is unreachable.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* import { reactiveLog } from "@graphrefly/graphrefly-ts";
|
|
105
|
-
*
|
|
106
|
-
* const lg = reactiveLog<number>([1, 2], { name: "audit" });
|
|
107
|
-
* lg.append(3);
|
|
108
|
-
* lg.entries.subscribe((msgs) => console.log(msgs));
|
|
109
|
-
* ```
|
|
110
|
-
*
|
|
111
|
-
* @category extra
|
|
112
|
-
*/
|
|
113
|
-
declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions): ReactiveLogBundle<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Builds a derived node for `entries.slice(start, stop)` (same semantics as `Array.prototype.slice`; `stop` exclusive).
|
|
116
|
-
*
|
|
117
|
-
* @param log - Log from {@link reactiveLog}.
|
|
118
|
-
* @param start - Start index (must be `>= 0`).
|
|
119
|
-
* @param stop - End index (exclusive); omit to slice to the end.
|
|
120
|
-
* @returns Derived node emitting the sliced readonly array.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```ts
|
|
124
|
-
* import { reactiveLog, logSlice } from "@graphrefly/graphrefly-ts";
|
|
125
|
-
*
|
|
126
|
-
* const lg = reactiveLog<number>([10, 20, 30, 40, 50]);
|
|
127
|
-
* const slice$ = logSlice(lg, 1, 4); // reactive view of [20, 30, 40]
|
|
128
|
-
* slice$.subscribe((msgs) => console.log(msgs));
|
|
129
|
-
*
|
|
130
|
-
* lg.append(60); // slice$ now reflects [20, 30, 40] (indices 1–3 of updated log)
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* @category extra
|
|
134
|
-
*/
|
|
135
|
-
declare function logSlice<T>(log: ReactiveLogBundle<T>, start: number, stop?: number): Node<readonly T[]>;
|
|
136
|
-
|
|
137
|
-
export { type ReactiveLogSnapshot as R, type Versioned as V, type ReactiveLogBundle as a, type ReactiveLogOptions as b, observeNode$ as c, toObservable as d, logSlice as l, observeGraph$ as o, reactiveLog as r, toMessages$ as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|