@graphrefly/graphrefly 0.7.0 → 0.9.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 (66) hide show
  1. package/dist/{chunk-L4J2K2RT.js → chunk-A2AJJOSJ.js} +3 -3
  2. package/dist/{chunk-ISGMZ2T3.js → chunk-E7OH6ZAZ.js} +3 -3
  3. package/dist/{chunk-47YJEZUJ.js → chunk-LR2CLSEF.js} +2 -2
  4. package/dist/{chunk-3EVXOI5C.js → chunk-QTZSBQGJ.js} +35 -21
  5. package/dist/chunk-QTZSBQGJ.js.map +1 -0
  6. package/dist/{chunk-ONLYF6GA.js → chunk-TZLX4KIT.js} +3 -3
  7. package/dist/{chunk-FGLZ5QID.js → chunk-UCW3VWMN.js} +4 -4
  8. package/dist/{chunk-BLCXEMAD.js → chunk-WYI7YW54.js} +16 -8
  9. package/dist/chunk-WYI7YW54.js.map +1 -0
  10. package/dist/{chunk-OSR3G3DP.js → chunk-XCZPGOVP.js} +3 -3
  11. package/dist/{chunk-PEBORXRA.js → chunk-YWTP2XRJ.js} +2 -2
  12. package/dist/compat/nestjs/index.cjs +47 -25
  13. package/dist/compat/nestjs/index.cjs.map +1 -1
  14. package/dist/compat/nestjs/index.d.cts +3 -3
  15. package/dist/compat/nestjs/index.d.ts +3 -3
  16. package/dist/compat/nestjs/index.js +7 -7
  17. package/dist/core/index.cjs +34 -20
  18. package/dist/core/index.cjs.map +1 -1
  19. package/dist/core/index.d.cts +1 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.js +3 -3
  22. package/dist/extra/index.cjs +34 -20
  23. package/dist/extra/index.cjs.map +1 -1
  24. package/dist/extra/index.d.cts +3 -3
  25. package/dist/extra/index.d.ts +3 -3
  26. package/dist/extra/index.js +3 -3
  27. package/dist/graph/index.cjs +47 -25
  28. package/dist/graph/index.cjs.map +1 -1
  29. package/dist/graph/index.d.cts +2 -2
  30. package/dist/graph/index.d.ts +2 -2
  31. package/dist/graph/index.js +4 -4
  32. package/dist/{graph-B3BoJjcb.d.cts → graph-DqTICAY2.d.cts} +11 -5
  33. package/dist/{graph-CmiUuhaN.d.ts → graph-X9uwnD_z.d.ts} +11 -5
  34. package/dist/{index-D0cx-Yht.d.cts → index-3U0WxdD-.d.cts} +1 -1
  35. package/dist/{index-D1hgSTzr.d.cts → index-BP1t_38S.d.cts} +2 -2
  36. package/dist/{index-CsUq2rrK.d.ts → index-BPCeYDS4.d.ts} +1 -1
  37. package/dist/{index-BrgtEG-C.d.ts → index-BVG5pjin.d.ts} +3 -1
  38. package/dist/{index-D8NIq6om.d.cts → index-BYEgosAX.d.cts} +3 -1
  39. package/dist/{index-BsuKSs4L.d.cts → index-BYa2YMat.d.cts} +2 -2
  40. package/dist/{index-DFFNKYig.d.ts → index-DLO8wnYU.d.ts} +2 -2
  41. package/dist/{index-Bf2X1YSI.d.ts → index-DMv1Etbi.d.ts} +1 -1
  42. package/dist/{index-Bl7hJcc3.d.cts → index-DbwgQ4Cw.d.cts} +1 -1
  43. package/dist/{index-Pm68AYPh.d.ts → index-a5gHmH5b.d.ts} +2 -2
  44. package/dist/index.cjs +322 -26
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +200 -25
  47. package/dist/index.d.ts +200 -25
  48. package/dist/index.js +291 -18
  49. package/dist/index.js.map +1 -1
  50. package/dist/patterns/reactive-layout/index.cjs +47 -25
  51. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  52. package/dist/patterns/reactive-layout/index.d.cts +2 -2
  53. package/dist/patterns/reactive-layout/index.d.ts +2 -2
  54. package/dist/patterns/reactive-layout/index.js +4 -4
  55. package/dist/{reactive-log-CAXzJ7hw.d.cts → reactive-log-BfX6bOSZ.d.cts} +1 -1
  56. package/dist/{reactive-log-DwNhOe0g.d.ts → reactive-log-RhgIog2Z.d.ts} +1 -1
  57. package/package.json +1 -1
  58. package/dist/chunk-3EVXOI5C.js.map +0 -1
  59. package/dist/chunk-BLCXEMAD.js.map +0 -1
  60. /package/dist/{chunk-L4J2K2RT.js.map → chunk-A2AJJOSJ.js.map} +0 -0
  61. /package/dist/{chunk-ISGMZ2T3.js.map → chunk-E7OH6ZAZ.js.map} +0 -0
  62. /package/dist/{chunk-47YJEZUJ.js.map → chunk-LR2CLSEF.js.map} +0 -0
  63. /package/dist/{chunk-ONLYF6GA.js.map → chunk-TZLX4KIT.js.map} +0 -0
  64. /package/dist/{chunk-FGLZ5QID.js.map → chunk-UCW3VWMN.js.map} +0 -0
  65. /package/dist/{chunk-OSR3G3DP.js.map → chunk-XCZPGOVP.js.map} +0 -0
  66. /package/dist/{chunk-PEBORXRA.js.map → chunk-YWTP2XRJ.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- export { o as observeGraph$, c as observeNode$, t as toMessages$, d as toObservable } from '../../reactive-log-CAXzJ7hw.cjs';
2
- export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, d as CRON_HANDLERS, e as CommandHandler, f as CommandHandlerMeta, E as EVENT_HANDLERS, g as EventHandler, h as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, j as GRAPHREFLY_ROOT_GRAPH, k as GraphCron, l as GraphCronMeta, m as GraphInterval, n as GraphIntervalMeta, o as GraphReflyCqrsOptions, p as GraphReflyEventExplorer, q as GraphReflyFeatureOptions, r as GraphReflyGuard, s as GraphReflyGuardImpl, t as GraphReflyModule, u as GraphReflyRootOptions, I as INTERVAL_HANDLERS, v as InjectCqrsGraph, w as InjectGraph, x as InjectNode, O as ObserveGateway, y as ObserveGatewayOptions, z as ObserveSSEOptions, B as ObserveSubscriptionOptions, D as ObserveWsCommand, F as ObserveWsMessage, H as OnGraphEvent, J as OnGraphEventMeta, Q as QUERY_HANDLERS, K as QueryHandler, L as QueryHandlerMeta, S as SAGA_HANDLERS, M as SagaHandler, N as SagaHandlerMeta, P as fromHeader, R as fromJwtPayload, T as getActor, U as getGraphToken, V as getNodeToken, W as observeSSE, X as observeSubscription } from '../../index-BsuKSs4L.cjs';
1
+ export { o as observeGraph$, c as observeNode$, t as toMessages$, d as toObservable } from '../../reactive-log-BfX6bOSZ.cjs';
2
+ export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, d as CRON_HANDLERS, e as CommandHandler, f as CommandHandlerMeta, E as EVENT_HANDLERS, g as EventHandler, h as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, j as GRAPHREFLY_ROOT_GRAPH, k as GraphCron, l as GraphCronMeta, m as GraphInterval, n as GraphIntervalMeta, o as GraphReflyCqrsOptions, p as GraphReflyEventExplorer, q as GraphReflyFeatureOptions, r as GraphReflyGuard, s as GraphReflyGuardImpl, t as GraphReflyModule, u as GraphReflyRootOptions, I as INTERVAL_HANDLERS, v as InjectCqrsGraph, w as InjectGraph, x as InjectNode, O as ObserveGateway, y as ObserveGatewayOptions, z as ObserveSSEOptions, B as ObserveSubscriptionOptions, D as ObserveWsCommand, F as ObserveWsMessage, H as OnGraphEvent, J as OnGraphEventMeta, Q as QUERY_HANDLERS, K as QueryHandler, L as QueryHandlerMeta, S as SAGA_HANDLERS, M as SagaHandler, N as SagaHandlerMeta, P as fromHeader, R as fromJwtPayload, T as getActor, U as getGraphToken, V as getNodeToken, W as observeSSE, X as observeSubscription } from '../../index-BYa2YMat.cjs';
3
3
  import 'rxjs';
4
4
  import '../../meta-BJEU8fYz.cjs';
5
- import '../../graph-B3BoJjcb.cjs';
5
+ import '../../graph-DqTICAY2.cjs';
6
6
  import '@nestjs/common';
7
7
  import '@nestjs/core';
@@ -1,7 +1,7 @@
1
- export { o as observeGraph$, c as observeNode$, t as toMessages$, d as toObservable } from '../../reactive-log-DwNhOe0g.js';
2
- export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, d as CRON_HANDLERS, e as CommandHandler, f as CommandHandlerMeta, E as EVENT_HANDLERS, g as EventHandler, h as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, j as GRAPHREFLY_ROOT_GRAPH, k as GraphCron, l as GraphCronMeta, m as GraphInterval, n as GraphIntervalMeta, o as GraphReflyCqrsOptions, p as GraphReflyEventExplorer, q as GraphReflyFeatureOptions, r as GraphReflyGuard, s as GraphReflyGuardImpl, t as GraphReflyModule, u as GraphReflyRootOptions, I as INTERVAL_HANDLERS, v as InjectCqrsGraph, w as InjectGraph, x as InjectNode, O as ObserveGateway, y as ObserveGatewayOptions, z as ObserveSSEOptions, B as ObserveSubscriptionOptions, D as ObserveWsCommand, F as ObserveWsMessage, H as OnGraphEvent, J as OnGraphEventMeta, Q as QUERY_HANDLERS, K as QueryHandler, L as QueryHandlerMeta, S as SAGA_HANDLERS, M as SagaHandler, N as SagaHandlerMeta, P as fromHeader, R as fromJwtPayload, T as getActor, U as getGraphToken, V as getNodeToken, W as observeSSE, X as observeSubscription } from '../../index-DFFNKYig.js';
1
+ export { o as observeGraph$, c as observeNode$, t as toMessages$, d as toObservable } from '../../reactive-log-RhgIog2Z.js';
2
+ export { A as ACTOR_KEY, a as ActorExtractor, C as COMMAND_HANDLERS, b as CQRS_EVENT_HANDLERS, d as CRON_HANDLERS, e as CommandHandler, f as CommandHandlerMeta, E as EVENT_HANDLERS, g as EventHandler, h as EventHandlerMeta, G as GRAPHREFLY_REQUEST_GRAPH, j as GRAPHREFLY_ROOT_GRAPH, k as GraphCron, l as GraphCronMeta, m as GraphInterval, n as GraphIntervalMeta, o as GraphReflyCqrsOptions, p as GraphReflyEventExplorer, q as GraphReflyFeatureOptions, r as GraphReflyGuard, s as GraphReflyGuardImpl, t as GraphReflyModule, u as GraphReflyRootOptions, I as INTERVAL_HANDLERS, v as InjectCqrsGraph, w as InjectGraph, x as InjectNode, O as ObserveGateway, y as ObserveGatewayOptions, z as ObserveSSEOptions, B as ObserveSubscriptionOptions, D as ObserveWsCommand, F as ObserveWsMessage, H as OnGraphEvent, J as OnGraphEventMeta, Q as QUERY_HANDLERS, K as QueryHandler, L as QueryHandlerMeta, S as SAGA_HANDLERS, M as SagaHandler, N as SagaHandlerMeta, P as fromHeader, R as fromJwtPayload, T as getActor, U as getGraphToken, V as getNodeToken, W as observeSSE, X as observeSubscription } from '../../index-DLO8wnYU.js';
3
3
  import 'rxjs';
4
4
  import '../../meta-BJEU8fYz.js';
5
- import '../../graph-CmiUuhaN.js';
5
+ import '../../graph-X9uwnD_z.js';
6
6
  import '@nestjs/common';
7
7
  import '@nestjs/core';
@@ -31,19 +31,19 @@ import {
31
31
  getNodeToken,
32
32
  observeSSE,
33
33
  observeSubscription
34
- } from "../../chunk-FGLZ5QID.js";
35
- import "../../chunk-ISGMZ2T3.js";
34
+ } from "../../chunk-UCW3VWMN.js";
35
+ import "../../chunk-A2AJJOSJ.js";
36
36
  import {
37
37
  observeGraph$,
38
38
  observeNode$,
39
39
  toMessages$,
40
40
  toObservable
41
- } from "../../chunk-PEBORXRA.js";
41
+ } from "../../chunk-YWTP2XRJ.js";
42
+ import "../../chunk-E7OH6ZAZ.js";
42
43
  import "../../chunk-WZ2Z2CRV.js";
43
- import "../../chunk-L4J2K2RT.js";
44
- import "../../chunk-BLCXEMAD.js";
45
- import "../../chunk-47YJEZUJ.js";
46
- import "../../chunk-3EVXOI5C.js";
44
+ import "../../chunk-WYI7YW54.js";
45
+ import "../../chunk-LR2CLSEF.js";
46
+ import "../../chunk-QTZSBQGJ.js";
47
47
  export {
48
48
  ACTOR_KEY,
49
49
  COMMAND_HANDLERS,
@@ -463,6 +463,7 @@ function isV1(info) {
463
463
  }
464
464
 
465
465
  // src/core/node.ts
466
+ var NO_VALUE = /* @__PURE__ */ Symbol.for("graphrefly/NO_VALUE");
466
467
  function createIntBitSet() {
467
468
  let bits = 0;
468
469
  return {
@@ -563,7 +564,6 @@ var NodeImpl = class {
563
564
  _producerStarted = false;
564
565
  _connecting = false;
565
566
  _manualEmitUsed = false;
566
- _hasEmittedData = false;
567
567
  _sinkCount = 0;
568
568
  _singleDepSinkCount = 0;
569
569
  // --- Object/collection state ---
@@ -593,10 +593,10 @@ var NodeImpl = class {
593
593
  this._hasDeps = deps.length > 0;
594
594
  this._autoComplete = opts.completeWhenDepsComplete ?? true;
595
595
  this._isSingleDep = deps.length === 1 && fn != null;
596
- this._cached = opts.initial;
596
+ this._cached = "initial" in opts ? opts.initial : NO_VALUE;
597
597
  this._status = this._hasDeps ? "disconnected" : "settled";
598
598
  this._hashFn = opts.versioningHash ?? defaultHash;
599
- this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached, {
599
+ this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached === NO_VALUE ? void 0 : this._cached, {
600
600
  id: opts.versioningId,
601
601
  hash: this._hashFn
602
602
  }) : void 0;
@@ -680,10 +680,14 @@ var NodeImpl = class {
680
680
  _applyVersioning(level, opts) {
681
681
  if (this._versioning != null) return;
682
682
  this._hashFn = opts?.hash ?? this._hashFn;
683
- this._versioning = createVersioning(level, this._cached, {
684
- id: opts?.id,
685
- hash: this._hashFn
686
- });
683
+ this._versioning = createVersioning(
684
+ level,
685
+ this._cached === NO_VALUE ? void 0 : this._cached,
686
+ {
687
+ id: opts?.id,
688
+ hash: this._hashFn
689
+ }
690
+ );
687
691
  }
688
692
  hasGuard() {
689
693
  return this._guard != null;
@@ -693,7 +697,7 @@ var NodeImpl = class {
693
697
  return this._guard(normalizeActor(actor), "observe");
694
698
  }
695
699
  get() {
696
- return this._cached;
700
+ return this._cached === NO_VALUE ? void 0 : this._cached;
697
701
  }
698
702
  down(messages, options) {
699
703
  if (messages.length === 0) return;
@@ -750,6 +754,7 @@ var NodeImpl = class {
750
754
  }
751
755
  if (this._terminal && this._opts.resubscribable) {
752
756
  this._terminal = false;
757
+ this._cached = NO_VALUE;
753
758
  this._status = this._hasDeps ? "disconnected" : "settled";
754
759
  this._opts.onResubscribe?.();
755
760
  }
@@ -849,8 +854,7 @@ var NodeImpl = class {
849
854
  const cleanupFn = this._cleanup;
850
855
  this._cleanup = void 0;
851
856
  cleanupFn?.();
852
- this._cached = void 0;
853
- this._hasEmittedData = false;
857
+ this._cached = NO_VALUE;
854
858
  this._lastDepValues = void 0;
855
859
  }
856
860
  this._status = statusAfterMessage(this._status, m);
@@ -859,8 +863,7 @@ var NodeImpl = class {
859
863
  }
860
864
  if (t === TEARDOWN) {
861
865
  if (this._opts.resetOnTeardown) {
862
- this._cached = void 0;
863
- this._hasEmittedData = false;
866
+ this._cached = NO_VALUE;
864
867
  }
865
868
  const teardownCleanup = this._cleanup;
866
869
  this._cleanup = void 0;
@@ -893,14 +896,13 @@ var NodeImpl = class {
893
896
  const wasDirty = this._status === "dirty";
894
897
  let unchanged;
895
898
  try {
896
- unchanged = this._hasEmittedData && this._equals(this._cached, value);
899
+ unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
897
900
  } catch (eqErr) {
898
901
  const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
899
902
  const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
900
903
  this._downInternal([[ERROR, wrapped]]);
901
904
  return;
902
905
  }
903
- this._hasEmittedData = true;
904
906
  if (unchanged) {
905
907
  this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
906
908
  return;
@@ -1124,7 +1126,7 @@ var DynamicNodeImpl = class {
1124
1126
  _actions;
1125
1127
  _boundEmitToSinks;
1126
1128
  // Mutable state
1127
- _cached;
1129
+ _cached = NO_VALUE;
1128
1130
  _status = "disconnected";
1129
1131
  _terminal = false;
1130
1132
  _connected = false;
@@ -1218,7 +1220,7 @@ var DynamicNodeImpl = class {
1218
1220
  return this._guard(normalizeActor(actor), "observe");
1219
1221
  }
1220
1222
  get() {
1221
- return this._cached;
1223
+ return this._cached === NO_VALUE ? void 0 : this._cached;
1222
1224
  }
1223
1225
  down(messages, options) {
1224
1226
  if (messages.length === 0) return;
@@ -1276,6 +1278,7 @@ var DynamicNodeImpl = class {
1276
1278
  }
1277
1279
  if (this._terminal && this._resubscribable) {
1278
1280
  this._terminal = false;
1281
+ this._cached = NO_VALUE;
1279
1282
  this._status = "disconnected";
1280
1283
  this._onResubscribe?.();
1281
1284
  }
@@ -1353,10 +1356,13 @@ var DynamicNodeImpl = class {
1353
1356
  const t = m[0];
1354
1357
  if (t === DATA) this._cached = m[1];
1355
1358
  if (t === INVALIDATE) {
1356
- this._cached = void 0;
1359
+ this._cached = NO_VALUE;
1360
+ this._status = "dirty";
1357
1361
  }
1358
- if (t === DATA || t === RESOLVED) {
1362
+ if (t === DATA) {
1359
1363
  this._status = "settled";
1364
+ } else if (t === RESOLVED) {
1365
+ this._status = "resolved";
1360
1366
  } else if (t === DIRTY) {
1361
1367
  this._status = "dirty";
1362
1368
  } else if (t === COMPLETE) {
@@ -1367,7 +1373,7 @@ var DynamicNodeImpl = class {
1367
1373
  this._terminal = true;
1368
1374
  }
1369
1375
  if (t === TEARDOWN) {
1370
- if (this._resetOnTeardown) this._cached = void 0;
1376
+ if (this._resetOnTeardown) this._cached = NO_VALUE;
1371
1377
  try {
1372
1378
  this._propagateToMeta(t);
1373
1379
  } finally {
@@ -1390,7 +1396,15 @@ var DynamicNodeImpl = class {
1390
1396
  }
1391
1397
  _emitAutoValue(value) {
1392
1398
  const wasDirty = this._status === "dirty";
1393
- const unchanged = this._equals(this._cached, value);
1399
+ let unchanged;
1400
+ try {
1401
+ unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
1402
+ } catch (eqErr) {
1403
+ const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
1404
+ const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
1405
+ this._downInternal([[ERROR, wrapped]]);
1406
+ return;
1407
+ }
1394
1408
  if (unchanged) {
1395
1409
  this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
1396
1410
  return;