@graphrefly/graphrefly 0.46.0 → 0.47.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 (68) hide show
  1. package/dist/base/composition/index.cjs +69 -15
  2. package/dist/base/composition/index.cjs.map +1 -1
  3. package/dist/base/composition/index.d.cts +1 -2
  4. package/dist/base/composition/index.d.ts +1 -2
  5. package/dist/base/composition/index.js +1 -1
  6. package/dist/base/index.cjs +69 -15
  7. package/dist/base/index.cjs.map +1 -1
  8. package/dist/base/index.d.cts +1 -2
  9. package/dist/base/index.d.ts +1 -2
  10. package/dist/base/index.js +1 -1
  11. package/dist/{chunk-WKSWLSCX.js → chunk-22SG74BD.js} +2 -2
  12. package/dist/{chunk-OO5BM6CJ.js → chunk-5IMMNARC.js} +2 -2
  13. package/dist/{chunk-KIIXR252.js → chunk-EHRRQ4IC.js} +2 -2
  14. package/dist/{chunk-HULCUY35.js → chunk-GWRNLJNW.js} +2 -2
  15. package/dist/{chunk-5THCXDWY.js → chunk-JKTC747G.js} +2 -2
  16. package/dist/{chunk-RGL53X5G.js → chunk-TNX5ZGDJ.js} +3 -3
  17. package/dist/{chunk-LBAJK24K.js → chunk-VLAGJZSL.js} +11 -3
  18. package/dist/chunk-VLAGJZSL.js.map +1 -0
  19. package/dist/chunk-Z65DVDEQ.js +146 -0
  20. package/dist/chunk-Z65DVDEQ.js.map +1 -0
  21. package/dist/{chunk-GBCENOLN.js → chunk-ZT4WMQW4.js} +3 -3
  22. package/dist/{chunk-FR6RGA3B.js → chunk-ZVXXDWIB.js} +19 -14
  23. package/dist/{chunk-FR6RGA3B.js.map → chunk-ZVXXDWIB.js.map} +1 -1
  24. package/dist/compat/index.cjs +156 -93
  25. package/dist/compat/index.cjs.map +1 -1
  26. package/dist/compat/index.d.cts +3 -3
  27. package/dist/compat/index.d.ts +3 -3
  28. package/dist/compat/index.js +2 -2
  29. package/dist/compat/nestjs/index.cjs +156 -93
  30. package/dist/compat/nestjs/index.cjs.map +1 -1
  31. package/dist/compat/nestjs/index.d.cts +4 -4
  32. package/dist/compat/nestjs/index.d.ts +4 -4
  33. package/dist/compat/nestjs/index.js +4 -5
  34. package/dist/{index-5SU_O78r.d.cts → index-B_p8tnvf.d.cts} +19 -3
  35. package/dist/{index-CEXCtYYJ.d.ts → index-_HDSmPyp.d.ts} +19 -3
  36. package/dist/index.cjs +77 -18
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +1 -2
  39. package/dist/index.d.ts +1 -2
  40. package/dist/index.js +9 -9
  41. package/dist/observable-B25XqCbZ.d.cts +59 -0
  42. package/dist/observable-B25XqCbZ.d.ts +59 -0
  43. package/dist/presets/ai/index.js +5 -5
  44. package/dist/presets/harness/index.js +7 -7
  45. package/dist/presets/index.js +8 -8
  46. package/dist/solutions/index.js +6 -6
  47. package/dist/utils/ai/index.js +3 -3
  48. package/dist/utils/index.cjs +8 -3
  49. package/dist/utils/index.cjs.map +1 -1
  50. package/dist/utils/index.js +3 -3
  51. package/dist/utils/memory/index.cjs +8 -3
  52. package/dist/utils/memory/index.cjs.map +1 -1
  53. package/dist/utils/memory/index.d.cts +78 -0
  54. package/dist/utils/memory/index.d.ts +78 -0
  55. package/dist/utils/memory/index.js +1 -1
  56. package/package.json +1 -5
  57. package/dist/chunk-3QZY5BI7.js +0 -92
  58. package/dist/chunk-3QZY5BI7.js.map +0 -1
  59. package/dist/chunk-LBAJK24K.js.map +0 -1
  60. package/dist/observable-BXQoW1P-.d.cts +0 -36
  61. package/dist/observable-BXQoW1P-.d.ts +0 -36
  62. /package/dist/{chunk-WKSWLSCX.js.map → chunk-22SG74BD.js.map} +0 -0
  63. /package/dist/{chunk-OO5BM6CJ.js.map → chunk-5IMMNARC.js.map} +0 -0
  64. /package/dist/{chunk-KIIXR252.js.map → chunk-EHRRQ4IC.js.map} +0 -0
  65. /package/dist/{chunk-HULCUY35.js.map → chunk-GWRNLJNW.js.map} +0 -0
  66. /package/dist/{chunk-5THCXDWY.js.map → chunk-JKTC747G.js.map} +0 -0
  67. /package/dist/{chunk-RGL53X5G.js.map → chunk-TNX5ZGDJ.js.map} +0 -0
  68. /package/dist/{chunk-GBCENOLN.js.map → chunk-ZT4WMQW4.js.map} +0 -0
@@ -1,20 +1,20 @@
1
1
  export { i as jotai } from '../index-dX9IzPqj.cjs';
2
2
  export { i as nanostores } from '../index-Brp888t0.cjs';
3
- export { i as nestjs } from '../index-5SU_O78r.cjs';
3
+ export { i as nestjs } from '../index-B_p8tnvf.cjs';
4
4
  export { i as react } from '../index-BFsng6v1.cjs';
5
5
  import { Node } from '@graphrefly/pure-ts/core';
6
6
  export { i as solid } from '../index-B6pxYJzO.cjs';
7
7
  export { i as svelte } from '../index-Bg-LwEt-.cjs';
8
8
  export { i as vue } from '../index-DeWbQzMe.cjs';
9
9
  export { i as zustand } from '../index-CDfk6jHN.cjs';
10
- import '../observable-BXQoW1P-.cjs';
11
- import 'rxjs';
12
10
  import '@graphrefly/pure-ts/graph';
13
11
  import '@nestjs/common';
14
12
  import '@nestjs/core';
15
13
  import '../utils/cqrs/index.cjs';
16
14
  import '@graphrefly/pure-ts/extra';
17
15
  import '../base/mutation/index.cjs';
16
+ import 'rxjs';
17
+ import '../observable-B25XqCbZ.cjs';
18
18
  import 'vue';
19
19
 
20
20
  /**
@@ -1,20 +1,20 @@
1
1
  export { i as jotai } from '../index-dX9IzPqj.js';
2
2
  export { i as nanostores } from '../index-Brp888t0.js';
3
- export { i as nestjs } from '../index-CEXCtYYJ.js';
3
+ export { i as nestjs } from '../index-_HDSmPyp.js';
4
4
  export { i as react } from '../index-BFsng6v1.js';
5
5
  import { Node } from '@graphrefly/pure-ts/core';
6
6
  export { i as solid } from '../index-B6pxYJzO.js';
7
7
  export { i as svelte } from '../index-Bg-LwEt-.js';
8
8
  export { i as vue } from '../index-DeWbQzMe.js';
9
9
  export { i as zustand } from '../index-CDfk6jHN.js';
10
- import '../observable-BXQoW1P-.js';
11
- import 'rxjs';
12
10
  import '@graphrefly/pure-ts/graph';
13
11
  import '@nestjs/common';
14
12
  import '@nestjs/core';
15
13
  import '../utils/cqrs/index.js';
16
14
  import '@graphrefly/pure-ts/extra';
17
15
  import '../base/mutation/index.js';
16
+ import 'rxjs';
17
+ import '../observable-B25XqCbZ.js';
18
18
  import 'vue';
19
19
 
20
20
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  nestjs_exports
3
- } from "../chunk-LBAJK24K.js";
3
+ } from "../chunk-VLAGJZSL.js";
4
4
  import {
5
5
  react_exports
6
6
  } from "../chunk-3MUSLI6E.js";
@@ -26,7 +26,7 @@ import "../chunk-7EGRP2VX.js";
26
26
  import "../chunk-NY2PYHNC.js";
27
27
  import "../chunk-FMPF42Q4.js";
28
28
  import "../chunk-BXGZFGZ4.js";
29
- import "../chunk-3QZY5BI7.js";
29
+ import "../chunk-Z65DVDEQ.js";
30
30
  import {
31
31
  __export
32
32
  } from "../chunk-AZDQPQ3V.js";
@@ -14,11 +14,11 @@ var __export = (target, all) => {
14
14
  for (var name in all)
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
17
+ var __copyProps = (to, from2, except, desc) => {
18
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
19
+ for (let key of __getOwnPropNames(from2))
20
20
  if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
22
22
  }
23
23
  return to;
24
24
  };
@@ -97,52 +97,10 @@ __export(nestjs_exports, {
97
97
  getNodeToken: () => getNodeToken,
98
98
  observeSSE: () => observeSSE,
99
99
  observeSubscription: () => observeSubscription,
100
- toObservable: () => toObservable
100
+ toObservable: () => toObservable2
101
101
  });
102
102
  module.exports = __toCommonJS(nestjs_exports);
103
103
 
104
- // src/base/composition/observable.ts
105
- var import_core = require("@graphrefly/pure-ts/core");
106
- var import_rxjs = require("rxjs");
107
- function toObservable(node4, options) {
108
- if (options?.raw) {
109
- return new import_rxjs.Observable((subscriber) => {
110
- const unsub = node4.subscribe((msgs) => {
111
- if (subscriber.closed) return;
112
- subscriber.next(msgs);
113
- for (const m of msgs) {
114
- if (m[0] === import_core.ERROR) {
115
- subscriber.error(m[1]);
116
- return;
117
- }
118
- if (m[0] === import_core.COMPLETE) {
119
- subscriber.complete();
120
- return;
121
- }
122
- }
123
- });
124
- return unsub;
125
- });
126
- }
127
- return new import_rxjs.Observable((subscriber) => {
128
- const unsub = node4.subscribe((msgs) => {
129
- for (const m of msgs) {
130
- if (subscriber.closed) return;
131
- if (m[0] === import_core.DATA) {
132
- subscriber.next(m[1]);
133
- } else if (m[0] === import_core.ERROR) {
134
- subscriber.error(m[1]);
135
- return;
136
- } else if (m[0] === import_core.COMPLETE) {
137
- subscriber.complete();
138
- return;
139
- }
140
- }
141
- });
142
- return unsub;
143
- });
144
- }
145
-
146
104
  // src/compat/nestjs/decorators.ts
147
105
  var import_common = require("@nestjs/common");
148
106
 
@@ -253,11 +211,11 @@ function SagaHandler(cqrsName, sagaName, eventNames) {
253
211
  }
254
212
 
255
213
  // src/compat/nestjs/explorer.ts
256
- var import_core3 = require("@graphrefly/pure-ts/core");
214
+ var import_core2 = require("@graphrefly/pure-ts/core");
257
215
  var import_extra = require("@graphrefly/pure-ts/extra");
258
216
 
259
217
  // src/base/sources/event/cron.ts
260
- var import_core2 = require("@graphrefly/pure-ts/core");
218
+ var import_core = require("@graphrefly/pure-ts/core");
261
219
  function sourceOpts(opts) {
262
220
  return { describeKind: "producer", ...opts };
263
221
  }
@@ -307,7 +265,7 @@ function fromCron(expr, opts) {
307
265
  const { tickMs: tickOpt, output, ...rest } = opts ?? {};
308
266
  const tickMs = tickOpt ?? 6e4;
309
267
  const emitDate = output === "date";
310
- return (0, import_core2.node)(
268
+ return (0, import_core.node)(
311
269
  (_data, a) => {
312
270
  let lastFiredKey = -1;
313
271
  const check = () => {
@@ -315,7 +273,7 @@ function fromCron(expr, opts) {
315
273
  const key = now.getFullYear() * 1e8 + (now.getMonth() + 1) * 1e6 + now.getDate() * 1e4 + now.getHours() * 100 + now.getMinutes();
316
274
  if (key !== lastFiredKey && matchesCron(schedule, now)) {
317
275
  lastFiredKey = key;
318
- a.emit(emitDate ? now : (0, import_core2.wallClockNs)());
276
+ a.emit(emitDate ? now : (0, import_core.wallClockNs)());
319
277
  }
320
278
  };
321
279
  check();
@@ -374,7 +332,7 @@ var GraphReflyEventExplorer = class {
374
332
  const handle = this.observeNode(meta.nodeName);
375
333
  const unsub = handle.subscribe((msgs) => {
376
334
  for (const m of msgs) {
377
- if (m[0] === import_core3.DATA) {
335
+ if (m[0] === import_core2.DATA) {
378
336
  bound(m[1]);
379
337
  }
380
338
  }
@@ -405,7 +363,7 @@ var GraphReflyEventExplorer = class {
405
363
  const handle = this.observeNode(nodeName);
406
364
  const unsub = handle.subscribe((msgs) => {
407
365
  for (const m of msgs) {
408
- if (m[0] === import_core3.DATA) bound(m[1]);
366
+ if (m[0] === import_core2.DATA) bound(m[1]);
409
367
  }
410
368
  });
411
369
  this.disposers.push(unsub);
@@ -434,7 +392,7 @@ var GraphReflyEventExplorer = class {
434
392
  const handle = this.observeNode(nodeName);
435
393
  const unsub = handle.subscribe((msgs) => {
436
394
  for (const m of msgs) {
437
- if (m[0] === import_core3.DATA) bound(m[1]);
395
+ if (m[0] === import_core2.DATA) bound(m[1]);
438
396
  }
439
397
  });
440
398
  this.disposers.push(unsub);
@@ -484,7 +442,7 @@ var GraphReflyEventExplorer = class {
484
442
  const handle = this.observeNodeOn(cqrsGraph, meta.eventName);
485
443
  const unsub = handle.subscribe((msgs) => {
486
444
  for (const m of msgs) {
487
- if (m[0] === import_core3.DATA) {
445
+ if (m[0] === import_core2.DATA) {
488
446
  const entries = m[1];
489
447
  for (const entry of entries) {
490
448
  if (entry.seq > lastSeq) {
@@ -518,7 +476,7 @@ var GraphReflyEventExplorer = class {
518
476
  const handle = this.observeNodeOn(cqrsGraph, meta.projectionName);
519
477
  const unsub = handle.subscribe((msgs) => {
520
478
  for (const m of msgs) {
521
- if (m[0] === import_core3.DATA) {
479
+ if (m[0] === import_core2.DATA) {
522
480
  bound(m[1]);
523
481
  }
524
482
  }
@@ -574,10 +532,10 @@ var GraphReflyEventExplorer = class {
574
532
  };
575
533
 
576
534
  // src/compat/nestjs/gateway.ts
577
- var import_core5 = require("@graphrefly/pure-ts/core");
535
+ var import_core4 = require("@graphrefly/pure-ts/core");
578
536
 
579
537
  // src/base/composition/backpressure.ts
580
- var import_core4 = require("@graphrefly/pure-ts/core");
538
+ var import_core3 = require("@graphrefly/pure-ts/core");
581
539
  var nextLockId = 0;
582
540
  function createWatermarkController(sendUp, opts) {
583
541
  if (opts.highWaterMark < 1) throw new RangeError("highWaterMark must be >= 1");
@@ -592,7 +550,7 @@ function createWatermarkController(sendUp, opts) {
592
550
  pending += 1;
593
551
  if (!paused && pending >= opts.highWaterMark) {
594
552
  paused = true;
595
- sendUp([[import_core4.PAUSE, lockId]]);
553
+ sendUp([[import_core3.PAUSE, lockId]]);
596
554
  return true;
597
555
  }
598
556
  return false;
@@ -601,7 +559,7 @@ function createWatermarkController(sendUp, opts) {
601
559
  if (pending > 0) pending -= 1;
602
560
  if (paused && pending <= opts.lowWaterMark) {
603
561
  paused = false;
604
- sendUp([[import_core4.RESUME, lockId]]);
562
+ sendUp([[import_core3.RESUME, lockId]]);
605
563
  return true;
606
564
  }
607
565
  return false;
@@ -615,7 +573,7 @@ function createWatermarkController(sendUp, opts) {
615
573
  dispose() {
616
574
  if (paused) {
617
575
  paused = false;
618
- sendUp([[import_core4.RESUME, lockId]]);
576
+ sendUp([[import_core3.RESUME, lockId]]);
619
577
  }
620
578
  }
621
579
  };
@@ -662,7 +620,7 @@ function observeSSE(graph, path, opts) {
662
620
  for (const msg of msgs) {
663
621
  if (closed) return;
664
622
  const t = msg[0];
665
- if (t === import_core5.DATA) {
623
+ if (t === import_core4.DATA) {
666
624
  const frame = encoder.encode(sseFrame("data", serialize(msg[1])));
667
625
  if (useBackpressure) {
668
626
  taggedBuf.push({ frame, counted: true });
@@ -672,7 +630,7 @@ function observeSSE(graph, path, opts) {
672
630
  } else {
673
631
  controller.enqueue(frame);
674
632
  }
675
- } else if (t === import_core5.ERROR) {
633
+ } else if (t === import_core4.ERROR) {
676
634
  const frame = encoder.encode(sseFrame("error", serialize(msg[1])));
677
635
  if (useBackpressure) {
678
636
  taggedBuf.push({ frame, counted: false });
@@ -683,8 +641,8 @@ function observeSSE(graph, path, opts) {
683
641
  }
684
642
  close();
685
643
  return;
686
- } else if (t === import_core5.COMPLETE || t === import_core5.TEARDOWN) {
687
- if (t === import_core5.COMPLETE) {
644
+ } else if (t === import_core4.COMPLETE || t === import_core4.TEARDOWN) {
645
+ if (t === import_core4.COMPLETE) {
688
646
  const frame = encoder.encode(sseFrame("complete"));
689
647
  if (useBackpressure) {
690
648
  taggedBuf.push({ frame, counted: false });
@@ -766,16 +724,16 @@ function observeSubscription(graph, path, opts) {
766
724
  const unsub = handle.subscribe((msgs) => {
767
725
  for (const msg of msgs) {
768
726
  const t = msg[0];
769
- if (t === import_core5.DATA) {
727
+ if (t === import_core4.DATA) {
770
728
  const value = msg[1];
771
729
  if (filter && !filter(value)) continue;
772
730
  push({ done: false, value });
773
- } else if (t === import_core5.ERROR) {
731
+ } else if (t === import_core4.ERROR) {
774
732
  const err = msg[1] instanceof Error ? msg[1] : new Error(String(msg[1]));
775
733
  push({ done: true, error: err });
776
734
  dispose();
777
735
  return;
778
- } else if (t === import_core5.COMPLETE || t === import_core5.TEARDOWN) {
736
+ } else if (t === import_core4.COMPLETE || t === import_core4.TEARDOWN) {
779
737
  push({ done: true });
780
738
  dispose();
781
739
  return;
@@ -921,15 +879,15 @@ var ObserveGateway = class {
921
879
  const unsub = handle.subscribe((msgs) => {
922
880
  for (const msg of msgs) {
923
881
  const t = msg[0];
924
- if (t === import_core5.DATA) {
882
+ if (t === import_core4.DATA) {
925
883
  wm?.onEnqueue();
926
884
  trySend(send, { type: "data", path, value: msg[1] });
927
- } else if (t === import_core5.ERROR) {
885
+ } else if (t === import_core4.ERROR) {
928
886
  const errMsg = msg[1] instanceof Error ? msg[1].message : String(msg[1]);
929
887
  trySend(send, { type: "error", path, error: errMsg });
930
888
  cleanup();
931
889
  return;
932
- } else if (t === import_core5.COMPLETE || t === import_core5.TEARDOWN) {
890
+ } else if (t === import_core4.COMPLETE || t === import_core4.TEARDOWN) {
933
891
  trySend(send, { type: "complete", path });
934
892
  cleanup();
935
893
  return;
@@ -993,7 +951,7 @@ function trySend(send, msg) {
993
951
  }
994
952
 
995
953
  // src/compat/nestjs/guard.ts
996
- var import_core6 = require("@graphrefly/pure-ts/core");
954
+ var import_core5 = require("@graphrefly/pure-ts/core");
997
955
  var ACTOR_KEY = "graphReflyActor";
998
956
  function fromJwtPayload(mapping) {
999
957
  return (context) => {
@@ -1018,14 +976,14 @@ function fromHeader(headerName = "x-graphrefly-actor") {
1018
976
  }
1019
977
  function getActor(req) {
1020
978
  const actor = req?.[ACTOR_KEY];
1021
- return actor != null ? (0, import_core6.normalizeActor)(actor) : import_core6.DEFAULT_ACTOR;
979
+ return actor != null ? (0, import_core5.normalizeActor)(actor) : import_core5.DEFAULT_ACTOR;
1022
980
  }
1023
981
  var GraphReflyGuardImpl = class {
1024
982
  constructor(extractor) {
1025
983
  this.extractor = extractor;
1026
984
  }
1027
985
  canActivate(context) {
1028
- const actor = (0, import_core6.normalizeActor)(this.extractor(context));
986
+ const actor = (0, import_core5.normalizeActor)(this.extractor(context));
1029
987
  const req = context.switchToHttp().getRequest();
1030
988
  if (req != null) {
1031
989
  req[ACTOR_KEY] = actor;
@@ -1040,18 +998,18 @@ function GraphReflyGuard(extractor) {
1040
998
  // src/compat/nestjs/module.ts
1041
999
  var import_graph3 = require("@graphrefly/pure-ts/graph");
1042
1000
  var import_common2 = require("@nestjs/common");
1043
- var import_core9 = require("@nestjs/core");
1001
+ var import_core8 = require("@nestjs/core");
1044
1002
 
1045
1003
  // src/utils/cqrs/index.ts
1046
- var import_core8 = require("@graphrefly/pure-ts/core");
1004
+ var import_core7 = require("@graphrefly/pure-ts/core");
1047
1005
  var import_extra3 = require("@graphrefly/pure-ts/extra");
1048
1006
  var import_graph2 = require("@graphrefly/pure-ts/graph");
1049
1007
 
1050
1008
  // src/base/mutation/index.ts
1051
- var import_core7 = require("@graphrefly/pure-ts/core");
1009
+ var import_core6 = require("@graphrefly/pure-ts/core");
1052
1010
  var import_extra2 = require("@graphrefly/pure-ts/extra");
1053
1011
  var import_graph = require("@graphrefly/pure-ts/graph");
1054
- var DEFAULT_AUDIT_GUARD = (0, import_core7.policy)((allow, deny) => {
1012
+ var DEFAULT_AUDIT_GUARD = (0, import_core6.policy)((allow, deny) => {
1055
1013
  allow("observe");
1056
1014
  allow("signal");
1057
1015
  deny("write");
@@ -1082,7 +1040,7 @@ function mutate(act, opts) {
1082
1040
  if (opts.frame === "inline") {
1083
1041
  return function wrapped(...args) {
1084
1042
  const sealed = freeze ? args.map(deepFreeze) : args;
1085
- const t_ns = (0, import_core7.wallClockNs)();
1043
+ const t_ns = (0, import_core6.wallClockNs)();
1086
1044
  const seq = opts.seq ? bumpCursor(opts.seq) : void 0;
1087
1045
  try {
1088
1046
  const result = up(...sealed);
@@ -1115,13 +1073,13 @@ function mutate(act, opts) {
1115
1073
  }
1116
1074
  return function wrapped(...args) {
1117
1075
  const sealed = freeze ? args.map(deepFreeze) : args;
1118
- const t_ns = (0, import_core7.wallClockNs)();
1076
+ const t_ns = (0, import_core6.wallClockNs)();
1119
1077
  let result;
1120
1078
  let captured;
1121
1079
  let captureSet = false;
1122
1080
  let seq;
1123
1081
  try {
1124
- (0, import_core7.batch)(() => {
1082
+ (0, import_core6.batch)(() => {
1125
1083
  if (opts.seq) seq = bumpCursor(opts.seq);
1126
1084
  try {
1127
1085
  result = up(...sealed);
@@ -1180,7 +1138,7 @@ function bumpCursor(seq) {
1180
1138
  }
1181
1139
  const cur = valid ? raw : 0;
1182
1140
  const next = cur + 1;
1183
- seq.down([[import_core7.DIRTY], [import_core7.DATA, next]]);
1141
+ seq.down([[import_core6.DIRTY], [import_core6.DATA, next]]);
1184
1142
  return next;
1185
1143
  }
1186
1144
  function appendAudit(audit, builder, args, value, meta, handlerVersion) {
@@ -1190,7 +1148,7 @@ function appendAudit(audit, builder, args, value, meta, handlerVersion) {
1190
1148
  audit.append(stamped);
1191
1149
  }
1192
1150
  function registerCursor(graph, name, initial = 0) {
1193
- const cursor = (0, import_core7.node)([], { initial, name, describeKind: "state" });
1151
+ const cursor = (0, import_core6.node)([], { initial, name, describeKind: "state" });
1194
1152
  graph.add(cursor, { name });
1195
1153
  return cursor;
1196
1154
  }
@@ -1198,7 +1156,7 @@ function registerCursorMap(graph, name, keys, initial = 0) {
1198
1156
  const out = {};
1199
1157
  const sub = new import_graph.Graph(name);
1200
1158
  for (const k of keys) {
1201
- const cursor = (0, import_core7.node)([], {
1159
+ const cursor = (0, import_core6.node)([], {
1202
1160
  initial,
1203
1161
  name: k,
1204
1162
  describeKind: "state"
@@ -1282,17 +1240,17 @@ function domainMeta(domain, kind, extra) {
1282
1240
  }
1283
1241
 
1284
1242
  // src/utils/cqrs/index.ts
1285
- var COMMAND_GUARD = (0, import_core8.policy)((allow, deny) => {
1243
+ var COMMAND_GUARD = (0, import_core7.policy)((allow, deny) => {
1286
1244
  allow("write");
1287
1245
  allow("signal");
1288
1246
  deny("observe");
1289
1247
  });
1290
- var PROJECTION_GUARD = (0, import_core8.policy)((allow, deny) => {
1248
+ var PROJECTION_GUARD = (0, import_core7.policy)((allow, deny) => {
1291
1249
  allow("observe");
1292
1250
  allow("signal");
1293
1251
  deny("write");
1294
1252
  });
1295
- var EVENT_GUARD = (0, import_core8.policy)((allow, deny) => {
1253
+ var EVENT_GUARD = (0, import_core7.policy)((allow, deny) => {
1296
1254
  allow("observe");
1297
1255
  allow("signal");
1298
1256
  deny("write");
@@ -1399,7 +1357,7 @@ var CqrsGraph = class extends import_graph2.Graph {
1399
1357
  aggregateId,
1400
1358
  type,
1401
1359
  lastVersion,
1402
- t_ns: (0, import_core8.wallClockNs)()
1360
+ t_ns: (0, import_core7.wallClockNs)()
1403
1361
  });
1404
1362
  }
1405
1363
  }
@@ -1534,7 +1492,7 @@ var CqrsGraph = class extends import_graph2.Graph {
1534
1492
  }
1535
1493
  );
1536
1494
  } catch {
1537
- guarded = (0, import_core8.node)(
1495
+ guarded = (0, import_core7.node)(
1538
1496
  [entries],
1539
1497
  (batchData, actions, ctx) => {
1540
1498
  const latest = batchData[0] != null && batchData[0].length > 0 ? batchData[0].at(-1) : ctx.prevData[0];
@@ -1592,7 +1550,7 @@ var CqrsGraph = class extends import_graph2.Graph {
1592
1550
  const evt = {
1593
1551
  type: eventName,
1594
1552
  payload: frozenPayload,
1595
- timestampNs: (0, import_core8.wallClockNs)(),
1553
+ timestampNs: (0, import_core7.wallClockNs)(),
1596
1554
  seq: ++this._seq,
1597
1555
  ...extra?.aggregateId !== void 0 ? { aggregateId: extra.aggregateId } : {},
1598
1556
  ...aggregateVersion !== void 0 ? { aggregateVersion } : {},
@@ -1950,7 +1908,7 @@ var CqrsGraph = class extends import_graph2.Graph {
1950
1908
  const cursor = cursors[eName];
1951
1909
  latestCursors.set(eName, cursor.cache ?? 0);
1952
1910
  const sub = cursor.subscribe((msgs) => {
1953
- for (const m of msgs) if (m[0] === import_core8.DATA) latestCursors.set(eName, m[1]);
1911
+ for (const m of msgs) if (m[0] === import_core7.DATA) latestCursors.set(eName, m[1]);
1954
1912
  });
1955
1913
  this.addDisposer(sub);
1956
1914
  }
@@ -2043,7 +2001,7 @@ var CqrsGraph = class extends import_graph2.Graph {
2043
2001
  function cqrs(name, opts) {
2044
2002
  const g = new CqrsGraph(name, opts);
2045
2003
  const { factory: _f, factoryArgs: _fa, ...tagArgs } = opts ?? {};
2046
- g.tagFactory("cqrs", (0, import_core8.placeholderArgs)(tagArgs));
2004
+ g.tagFactory("cqrs", (0, import_core7.placeholderArgs)(tagArgs));
2047
2005
  return g;
2048
2006
  }
2049
2007
 
@@ -2099,7 +2057,7 @@ var _GraphReflyModule = class _GraphReflyModule {
2099
2057
  {
2100
2058
  provide: GraphReflyEventExplorer,
2101
2059
  useFactory: (graph, moduleRef) => new GraphReflyEventExplorer(graph, moduleRef),
2102
- inject: [GRAPHREFLY_ROOT_GRAPH, import_core9.ModuleRef]
2060
+ inject: [GRAPHREFLY_ROOT_GRAPH, import_core8.ModuleRef]
2103
2061
  }
2104
2062
  ];
2105
2063
  if (options.nodes) {
@@ -2240,4 +2198,109 @@ _init = __decoratorStart(null);
2240
2198
  _GraphReflyModule = __decorateElement(_init, 0, "GraphReflyModule", _GraphReflyModule_decorators, _GraphReflyModule);
2241
2199
  __runInitializers(_init, 1, _GraphReflyModule);
2242
2200
  var GraphReflyModule = _GraphReflyModule;
2201
+
2202
+ // src/compat/nestjs/observable.ts
2203
+ var import_rxjs = require("rxjs");
2204
+
2205
+ // src/base/composition/observable.ts
2206
+ var import_core9 = require("@graphrefly/pure-ts/core");
2207
+ var OBSERVABLE_KEY = typeof Symbol === "function" && Symbol.observable || "@@observable";
2208
+ function normalizeObserver(observer) {
2209
+ return typeof observer === "function" ? { next: observer } : observer;
2210
+ }
2211
+ function makeInterop(onSubscribe) {
2212
+ const obs = {
2213
+ subscribe(rawObserver) {
2214
+ const observer = normalizeObserver(rawObserver);
2215
+ let closed = false;
2216
+ let teardown;
2217
+ let teardownPending = false;
2218
+ const runTeardown = () => {
2219
+ if (teardown) teardown();
2220
+ else teardownPending = true;
2221
+ };
2222
+ const guarded = {
2223
+ get closed() {
2224
+ return closed;
2225
+ },
2226
+ next(value) {
2227
+ if (!closed) observer.next?.(value);
2228
+ },
2229
+ error(err) {
2230
+ if (closed) return;
2231
+ closed = true;
2232
+ try {
2233
+ observer.error?.(err);
2234
+ } finally {
2235
+ runTeardown();
2236
+ }
2237
+ },
2238
+ complete() {
2239
+ if (closed) return;
2240
+ closed = true;
2241
+ try {
2242
+ observer.complete?.();
2243
+ } finally {
2244
+ runTeardown();
2245
+ }
2246
+ }
2247
+ };
2248
+ teardown = onSubscribe(guarded);
2249
+ if (teardownPending) teardown();
2250
+ return {
2251
+ unsubscribe() {
2252
+ if (closed) return;
2253
+ closed = true;
2254
+ teardown?.();
2255
+ }
2256
+ };
2257
+ }
2258
+ };
2259
+ obs[OBSERVABLE_KEY] = function() {
2260
+ return this;
2261
+ };
2262
+ return obs;
2263
+ }
2264
+ function toObservable(node4, options) {
2265
+ if (options?.raw) {
2266
+ return makeInterop((observer) => {
2267
+ return node4.subscribe((msgs) => {
2268
+ if (observer.closed) return;
2269
+ observer.next?.(msgs);
2270
+ for (const m of msgs) {
2271
+ if (m[0] === import_core9.ERROR) {
2272
+ observer.error?.(m[1]);
2273
+ return;
2274
+ }
2275
+ if (m[0] === import_core9.COMPLETE) {
2276
+ observer.complete?.();
2277
+ return;
2278
+ }
2279
+ }
2280
+ });
2281
+ });
2282
+ }
2283
+ return makeInterop((observer) => {
2284
+ return node4.subscribe((msgs) => {
2285
+ for (const m of msgs) {
2286
+ if (observer.closed) return;
2287
+ if (m[0] === import_core9.DATA) {
2288
+ observer.next?.(m[1]);
2289
+ } else if (m[0] === import_core9.ERROR) {
2290
+ observer.error?.(m[1]);
2291
+ return;
2292
+ } else if (m[0] === import_core9.COMPLETE) {
2293
+ observer.complete?.();
2294
+ return;
2295
+ }
2296
+ }
2297
+ });
2298
+ });
2299
+ }
2300
+
2301
+ // src/compat/nestjs/observable.ts
2302
+ function toObservable2(node4, options) {
2303
+ const base = options?.raw ? toObservable(node4, { raw: true }) : toObservable(node4);
2304
+ return (0, import_rxjs.from)(base);
2305
+ }
2243
2306
  //# sourceMappingURL=index.cjs.map