@graphrefly/graphrefly 0.14.0 → 0.16.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.
Files changed (71) hide show
  1. package/dist/{chunk-2ZICUAUJ.js → chunk-26A4E7J7.js} +10 -12
  2. package/dist/chunk-26A4E7J7.js.map +1 -0
  3. package/dist/{chunk-CRACCCJY.js → chunk-3BLRREFM.js} +29 -5
  4. package/dist/chunk-3BLRREFM.js.map +1 -0
  5. package/dist/{chunk-XQ4UMAU7.js → chunk-ITDVOCFO.js} +2 -2
  6. package/dist/{chunk-YW6LFCFS.js → chunk-LKP7IWRV.js} +3 -3
  7. package/dist/{chunk-4APC3AFN.js → chunk-RLVFZDCE.js} +22 -49
  8. package/dist/chunk-RLVFZDCE.js.map +1 -0
  9. package/dist/{chunk-GKRKDYNT.js → chunk-RZSQ7P2C.js} +3 -3
  10. package/dist/{chunk-ZHTHUX5D.js → chunk-SHRJH2DN.js} +3 -3
  11. package/dist/{chunk-H243FWYP.js → chunk-VZY2B2LU.js} +1 -1
  12. package/dist/{chunk-H243FWYP.js.map → chunk-VZY2B2LU.js.map} +1 -1
  13. package/dist/{chunk-QVYZD65U.js → chunk-YX263TXI.js} +10 -38
  14. package/dist/chunk-YX263TXI.js.map +1 -0
  15. package/dist/compat/nestjs/index.cjs +38 -41
  16. package/dist/compat/nestjs/index.cjs.map +1 -1
  17. package/dist/compat/nestjs/index.d.cts +4 -4
  18. package/dist/compat/nestjs/index.d.ts +4 -4
  19. package/dist/compat/nestjs/index.js +7 -7
  20. package/dist/core/index.cjs.map +1 -1
  21. package/dist/core/index.d.cts +2 -2
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.js +3 -3
  24. package/dist/extra/index.cjs +27 -78
  25. package/dist/extra/index.cjs.map +1 -1
  26. package/dist/extra/index.d.cts +4 -4
  27. package/dist/extra/index.d.ts +4 -4
  28. package/dist/extra/index.js +3 -3
  29. package/dist/graph/index.cjs +26 -2
  30. package/dist/graph/index.cjs.map +1 -1
  31. package/dist/graph/index.d.cts +3 -3
  32. package/dist/graph/index.d.ts +3 -3
  33. package/dist/graph/index.js +4 -4
  34. package/dist/{graph-BXIK5Dq5.d.ts → graph-Dc-P9BVm.d.ts} +15 -3
  35. package/dist/{graph-BhADtuFU.d.cts → graph-fCsaaVIa.d.cts} +15 -3
  36. package/dist/{index-DSp5R3Xq.d.ts → index-BBVBYPxr.d.cts} +4 -4
  37. package/dist/{index-BkToATim.d.ts → index-BR19vQME.d.ts} +1 -1
  38. package/dist/{index-BNB0KjKe.d.ts → index-BmoUvOGN.d.ts} +1 -1
  39. package/dist/{index-DBhLjWSV.d.cts → index-ClaKZFPl.d.cts} +100 -31
  40. package/dist/{index-Dqemj9q0.d.cts → index-DWq0P9T6.d.ts} +4 -4
  41. package/dist/{index-Wa8jXne6.d.cts → index-Db27z6Ki.d.cts} +1 -1
  42. package/dist/{index-fYObbpUw.d.ts → index-DhXznWyH.d.ts} +2 -2
  43. package/dist/{index-DANO9Gg7.d.cts → index-DlGMf_Qe.d.cts} +2 -2
  44. package/dist/{index-CKyYg4IP.d.ts → index-N704txAA.d.ts} +100 -31
  45. package/dist/{index-DKIyo4Bq.d.cts → index-YlOH1Gw6.d.cts} +1 -1
  46. package/dist/index.cjs +185 -224
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +35 -39
  49. package/dist/index.d.ts +35 -39
  50. package/dist/index.js +143 -153
  51. package/dist/index.js.map +1 -1
  52. package/dist/{meta-CrZUQAJ6.d.cts → meta-BV4pj9ML.d.cts} +6 -0
  53. package/dist/{meta-CrZUQAJ6.d.ts → meta-BV4pj9ML.d.ts} +6 -0
  54. package/dist/observable-Cz-AWhwR.d.cts +42 -0
  55. package/dist/observable-DCqlwGyl.d.ts +42 -0
  56. package/dist/patterns/reactive-layout/index.cjs +26 -2
  57. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  58. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  59. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  60. package/dist/patterns/reactive-layout/index.js +4 -4
  61. package/package.json +3 -2
  62. package/dist/chunk-2ZICUAUJ.js.map +0 -1
  63. package/dist/chunk-4APC3AFN.js.map +0 -1
  64. package/dist/chunk-CRACCCJY.js.map +0 -1
  65. package/dist/chunk-QVYZD65U.js.map +0 -1
  66. package/dist/reactive-log-ChbpUrY2.d.cts +0 -137
  67. package/dist/reactive-log-DV--7BWd.d.ts +0 -137
  68. /package/dist/{chunk-XQ4UMAU7.js.map → chunk-ITDVOCFO.js.map} +0 -0
  69. /package/dist/{chunk-YW6LFCFS.js.map → chunk-LKP7IWRV.js.map} +0 -0
  70. /package/dist/{chunk-GKRKDYNT.js.map → chunk-RZSQ7P2C.js.map} +0 -0
  71. /package/dist/{chunk-ZHTHUX5D.js.map → chunk-SHRJH2DN.js.map} +0 -0
@@ -559,6 +559,12 @@ declare function cleanupResult<T>(cleanup: () => void, value: T): CleanupResult<
559
559
  * @remarks
560
560
  * **Protocol:** DIRTY / DATA / RESOLVED ordering, completion, and batch deferral follow `~/src/graphrefly/GRAPHREFLY-SPEC.md`.
561
561
  *
562
+ * **`equals` and mutable values:** The default `Object.is` identity check is
563
+ * correct for the common immutable-value case. If your node produces mutable
564
+ * objects (e.g. arrays or maps mutated in place), provide a custom `equals`
565
+ * function — otherwise `Object.is` will always return `true` for the same
566
+ * reference and the node will emit `RESOLVED` instead of `DATA`.
567
+ *
562
568
  * @example
563
569
  * ```ts
564
570
  * import { node, state } from "@graphrefly/graphrefly-ts";
@@ -559,6 +559,12 @@ declare function cleanupResult<T>(cleanup: () => void, value: T): CleanupResult<
559
559
  * @remarks
560
560
  * **Protocol:** DIRTY / DATA / RESOLVED ordering, completion, and batch deferral follow `~/src/graphrefly/GRAPHREFLY-SPEC.md`.
561
561
  *
562
+ * **`equals` and mutable values:** The default `Object.is` identity check is
563
+ * correct for the common immutable-value case. If your node produces mutable
564
+ * objects (e.g. arrays or maps mutated in place), provide a custom `equals`
565
+ * function — otherwise `Object.is` will always return `true` for the same
566
+ * reference and the node will emit `RESOLVED` instead of `DATA`.
567
+ *
562
568
  * @example
563
569
  * ```ts
564
570
  * import { node, state } from "@graphrefly/graphrefly-ts";
@@ -0,0 +1,42 @@
1
+ import { Observable } from 'rxjs';
2
+ import { m as Messages, N as Node } from './meta-BV4pj9ML.cjs';
3
+ import { G as Graph, x as ObserveOptions } from './graph-fCsaaVIa.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
+ export { observeNode$ as a, toObservable as b, observeGraph$ as o, toMessages$ as t };
@@ -0,0 +1,42 @@
1
+ import { Observable } from 'rxjs';
2
+ import { m as Messages, N as Node } from './meta-BV4pj9ML.js';
3
+ import { G as Graph, x as ObserveOptions } from './graph-Dc-P9BVm.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
+ export { observeNode$ as a, toObservable as b, observeGraph$ as o, toMessages$ as t };
@@ -2035,6 +2035,7 @@ var Graph = class _Graph {
2035
2035
  /** @internal — exposed for {@link teardownMountedGraph}. */
2036
2036
  _mounts = /* @__PURE__ */ new Map();
2037
2037
  _autoCheckpointDisposers = /* @__PURE__ */ new Set();
2038
+ _disposers = /* @__PURE__ */ new Set();
2038
2039
  _defaultVersioningLevel;
2039
2040
  static registerFactory(pattern, factory) {
2040
2041
  if (!pattern) {
@@ -3170,10 +3171,33 @@ var Graph = class _Graph {
3170
3171
  // Lifecycle & persistence (§3.7–§3.8)
3171
3172
  // ——————————————————————————————————————————————————————————————
3172
3173
  /**
3173
- * Sends `[[TEARDOWN]]` to all nodes, then clears registries on this graph and every
3174
- * mounted subgraph (§3.7). The instance is left empty and may be reused with {@link Graph.add}.
3174
+ * Register a cleanup function to be called on {@link Graph.destroy}.
3175
+ *
3176
+ * Factories use this to attach teardown logic for internal nodes, keepalive
3177
+ * subscriptions, or other resources that are not registered on the graph and
3178
+ * would otherwise leak on repeated create/destroy cycles.
3179
+ *
3180
+ * Returns a removal function — call it to unregister the disposer early.
3181
+ */
3182
+ addDisposer(fn) {
3183
+ this._disposers.add(fn);
3184
+ return () => {
3185
+ this._disposers.delete(fn);
3186
+ };
3187
+ }
3188
+ /**
3189
+ * Drains disposers (registered via {@link addDisposer}), then sends `[[TEARDOWN]]` to all
3190
+ * nodes and clears registries on this graph and every mounted subgraph (§3.7).
3191
+ * The instance is left empty and may be reused with {@link Graph.add}.
3175
3192
  */
3176
3193
  destroy() {
3194
+ for (const dispose of [...this._disposers]) {
3195
+ try {
3196
+ dispose();
3197
+ } catch {
3198
+ }
3199
+ }
3200
+ this._disposers.clear();
3177
3201
  this.signal([[TEARDOWN]], { internal: true });
3178
3202
  for (const dispose of [...this._autoCheckpointDisposers]) {
3179
3203
  try {