@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.
- package/dist/base/composition/index.cjs +69 -15
- package/dist/base/composition/index.cjs.map +1 -1
- package/dist/base/composition/index.d.cts +1 -2
- package/dist/base/composition/index.d.ts +1 -2
- package/dist/base/composition/index.js +1 -1
- package/dist/base/index.cjs +69 -15
- package/dist/base/index.cjs.map +1 -1
- package/dist/base/index.d.cts +1 -2
- package/dist/base/index.d.ts +1 -2
- package/dist/base/index.js +1 -1
- package/dist/{chunk-WKSWLSCX.js → chunk-22SG74BD.js} +2 -2
- package/dist/{chunk-OO5BM6CJ.js → chunk-5IMMNARC.js} +2 -2
- package/dist/{chunk-KIIXR252.js → chunk-EHRRQ4IC.js} +2 -2
- package/dist/{chunk-HULCUY35.js → chunk-GWRNLJNW.js} +2 -2
- package/dist/{chunk-5THCXDWY.js → chunk-JKTC747G.js} +2 -2
- package/dist/{chunk-RGL53X5G.js → chunk-TNX5ZGDJ.js} +3 -3
- package/dist/{chunk-LBAJK24K.js → chunk-VLAGJZSL.js} +11 -3
- package/dist/chunk-VLAGJZSL.js.map +1 -0
- package/dist/chunk-Z65DVDEQ.js +146 -0
- package/dist/chunk-Z65DVDEQ.js.map +1 -0
- package/dist/{chunk-GBCENOLN.js → chunk-ZT4WMQW4.js} +3 -3
- package/dist/{chunk-FR6RGA3B.js → chunk-ZVXXDWIB.js} +19 -14
- package/dist/{chunk-FR6RGA3B.js.map → chunk-ZVXXDWIB.js.map} +1 -1
- package/dist/compat/index.cjs +156 -93
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +2 -2
- package/dist/compat/nestjs/index.cjs +156 -93
- 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 +4 -5
- package/dist/{index-5SU_O78r.d.cts → index-B_p8tnvf.d.cts} +19 -3
- package/dist/{index-CEXCtYYJ.d.ts → index-_HDSmPyp.d.ts} +19 -3
- package/dist/index.cjs +77 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +9 -9
- package/dist/observable-B25XqCbZ.d.cts +59 -0
- package/dist/observable-B25XqCbZ.d.ts +59 -0
- package/dist/presets/ai/index.js +5 -5
- package/dist/presets/harness/index.js +7 -7
- package/dist/presets/index.js +8 -8
- package/dist/solutions/index.js +6 -6
- package/dist/utils/ai/index.js +3 -3
- package/dist/utils/index.cjs +8 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/memory/index.cjs +8 -3
- package/dist/utils/memory/index.cjs.map +1 -1
- package/dist/utils/memory/index.d.cts +78 -0
- package/dist/utils/memory/index.d.ts +78 -0
- package/dist/utils/memory/index.js +1 -1
- package/package.json +1 -5
- package/dist/chunk-3QZY5BI7.js +0 -92
- package/dist/chunk-3QZY5BI7.js.map +0 -1
- package/dist/chunk-LBAJK24K.js.map +0 -1
- package/dist/observable-BXQoW1P-.d.cts +0 -36
- package/dist/observable-BXQoW1P-.d.ts +0 -36
- /package/dist/{chunk-WKSWLSCX.js.map → chunk-22SG74BD.js.map} +0 -0
- /package/dist/{chunk-OO5BM6CJ.js.map → chunk-5IMMNARC.js.map} +0 -0
- /package/dist/{chunk-KIIXR252.js.map → chunk-EHRRQ4IC.js.map} +0 -0
- /package/dist/{chunk-HULCUY35.js.map → chunk-GWRNLJNW.js.map} +0 -0
- /package/dist/{chunk-5THCXDWY.js.map → chunk-JKTC747G.js.map} +0 -0
- /package/dist/{chunk-RGL53X5G.js.map → chunk-TNX5ZGDJ.js.map} +0 -0
- /package/dist/{chunk-GBCENOLN.js.map → chunk-ZT4WMQW4.js.map} +0 -0
package/dist/compat/index.cjs
CHANGED
|
@@ -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,
|
|
18
|
-
if (
|
|
19
|
-
for (let key of __getOwnPropNames(
|
|
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: () =>
|
|
21
|
+
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
22
22
|
}
|
|
23
23
|
return to;
|
|
24
24
|
};
|
|
@@ -426,51 +426,9 @@ __export(nestjs_exports, {
|
|
|
426
426
|
getNodeToken: () => getNodeToken,
|
|
427
427
|
observeSSE: () => observeSSE,
|
|
428
428
|
observeSubscription: () => observeSubscription,
|
|
429
|
-
toObservable: () =>
|
|
429
|
+
toObservable: () => toObservable2
|
|
430
430
|
});
|
|
431
431
|
|
|
432
|
-
// src/base/composition/observable.ts
|
|
433
|
-
var import_core3 = require("@graphrefly/pure-ts/core");
|
|
434
|
-
var import_rxjs = require("rxjs");
|
|
435
|
-
function toObservable(node7, options) {
|
|
436
|
-
if (options?.raw) {
|
|
437
|
-
return new import_rxjs.Observable((subscriber) => {
|
|
438
|
-
const unsub = node7.subscribe((msgs) => {
|
|
439
|
-
if (subscriber.closed) return;
|
|
440
|
-
subscriber.next(msgs);
|
|
441
|
-
for (const m of msgs) {
|
|
442
|
-
if (m[0] === import_core3.ERROR) {
|
|
443
|
-
subscriber.error(m[1]);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
if (m[0] === import_core3.COMPLETE) {
|
|
447
|
-
subscriber.complete();
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
});
|
|
452
|
-
return unsub;
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
return new import_rxjs.Observable((subscriber) => {
|
|
456
|
-
const unsub = node7.subscribe((msgs) => {
|
|
457
|
-
for (const m of msgs) {
|
|
458
|
-
if (subscriber.closed) return;
|
|
459
|
-
if (m[0] === import_core3.DATA) {
|
|
460
|
-
subscriber.next(m[1]);
|
|
461
|
-
} else if (m[0] === import_core3.ERROR) {
|
|
462
|
-
subscriber.error(m[1]);
|
|
463
|
-
return;
|
|
464
|
-
} else if (m[0] === import_core3.COMPLETE) {
|
|
465
|
-
subscriber.complete();
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
});
|
|
470
|
-
return unsub;
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
|
|
474
432
|
// src/compat/nestjs/decorators.ts
|
|
475
433
|
var import_common = require("@nestjs/common");
|
|
476
434
|
|
|
@@ -581,11 +539,11 @@ function SagaHandler(cqrsName, sagaName, eventNames) {
|
|
|
581
539
|
}
|
|
582
540
|
|
|
583
541
|
// src/compat/nestjs/explorer.ts
|
|
584
|
-
var
|
|
542
|
+
var import_core4 = require("@graphrefly/pure-ts/core");
|
|
585
543
|
var import_extra = require("@graphrefly/pure-ts/extra");
|
|
586
544
|
|
|
587
545
|
// src/base/sources/event/cron.ts
|
|
588
|
-
var
|
|
546
|
+
var import_core3 = require("@graphrefly/pure-ts/core");
|
|
589
547
|
function sourceOpts(opts) {
|
|
590
548
|
return { describeKind: "producer", ...opts };
|
|
591
549
|
}
|
|
@@ -635,7 +593,7 @@ function fromCron(expr, opts) {
|
|
|
635
593
|
const { tickMs: tickOpt, output, ...rest } = opts ?? {};
|
|
636
594
|
const tickMs = tickOpt ?? 6e4;
|
|
637
595
|
const emitDate = output === "date";
|
|
638
|
-
return (0,
|
|
596
|
+
return (0, import_core3.node)(
|
|
639
597
|
(_data, a) => {
|
|
640
598
|
let lastFiredKey = -1;
|
|
641
599
|
const check = () => {
|
|
@@ -643,7 +601,7 @@ function fromCron(expr, opts) {
|
|
|
643
601
|
const key = now.getFullYear() * 1e8 + (now.getMonth() + 1) * 1e6 + now.getDate() * 1e4 + now.getHours() * 100 + now.getMinutes();
|
|
644
602
|
if (key !== lastFiredKey && matchesCron(schedule, now)) {
|
|
645
603
|
lastFiredKey = key;
|
|
646
|
-
a.emit(emitDate ? now : (0,
|
|
604
|
+
a.emit(emitDate ? now : (0, import_core3.wallClockNs)());
|
|
647
605
|
}
|
|
648
606
|
};
|
|
649
607
|
check();
|
|
@@ -702,7 +660,7 @@ var GraphReflyEventExplorer = class {
|
|
|
702
660
|
const handle = this.observeNode(meta.nodeName);
|
|
703
661
|
const unsub = handle.subscribe((msgs) => {
|
|
704
662
|
for (const m of msgs) {
|
|
705
|
-
if (m[0] ===
|
|
663
|
+
if (m[0] === import_core4.DATA) {
|
|
706
664
|
bound(m[1]);
|
|
707
665
|
}
|
|
708
666
|
}
|
|
@@ -733,7 +691,7 @@ var GraphReflyEventExplorer = class {
|
|
|
733
691
|
const handle = this.observeNode(nodeName);
|
|
734
692
|
const unsub = handle.subscribe((msgs) => {
|
|
735
693
|
for (const m of msgs) {
|
|
736
|
-
if (m[0] ===
|
|
694
|
+
if (m[0] === import_core4.DATA) bound(m[1]);
|
|
737
695
|
}
|
|
738
696
|
});
|
|
739
697
|
this.disposers.push(unsub);
|
|
@@ -762,7 +720,7 @@ var GraphReflyEventExplorer = class {
|
|
|
762
720
|
const handle = this.observeNode(nodeName);
|
|
763
721
|
const unsub = handle.subscribe((msgs) => {
|
|
764
722
|
for (const m of msgs) {
|
|
765
|
-
if (m[0] ===
|
|
723
|
+
if (m[0] === import_core4.DATA) bound(m[1]);
|
|
766
724
|
}
|
|
767
725
|
});
|
|
768
726
|
this.disposers.push(unsub);
|
|
@@ -812,7 +770,7 @@ var GraphReflyEventExplorer = class {
|
|
|
812
770
|
const handle = this.observeNodeOn(cqrsGraph, meta.eventName);
|
|
813
771
|
const unsub = handle.subscribe((msgs) => {
|
|
814
772
|
for (const m of msgs) {
|
|
815
|
-
if (m[0] ===
|
|
773
|
+
if (m[0] === import_core4.DATA) {
|
|
816
774
|
const entries = m[1];
|
|
817
775
|
for (const entry of entries) {
|
|
818
776
|
if (entry.seq > lastSeq) {
|
|
@@ -846,7 +804,7 @@ var GraphReflyEventExplorer = class {
|
|
|
846
804
|
const handle = this.observeNodeOn(cqrsGraph, meta.projectionName);
|
|
847
805
|
const unsub = handle.subscribe((msgs) => {
|
|
848
806
|
for (const m of msgs) {
|
|
849
|
-
if (m[0] ===
|
|
807
|
+
if (m[0] === import_core4.DATA) {
|
|
850
808
|
bound(m[1]);
|
|
851
809
|
}
|
|
852
810
|
}
|
|
@@ -902,10 +860,10 @@ var GraphReflyEventExplorer = class {
|
|
|
902
860
|
};
|
|
903
861
|
|
|
904
862
|
// src/compat/nestjs/gateway.ts
|
|
905
|
-
var
|
|
863
|
+
var import_core6 = require("@graphrefly/pure-ts/core");
|
|
906
864
|
|
|
907
865
|
// src/base/composition/backpressure.ts
|
|
908
|
-
var
|
|
866
|
+
var import_core5 = require("@graphrefly/pure-ts/core");
|
|
909
867
|
var nextLockId = 0;
|
|
910
868
|
function createWatermarkController(sendUp, opts) {
|
|
911
869
|
if (opts.highWaterMark < 1) throw new RangeError("highWaterMark must be >= 1");
|
|
@@ -920,7 +878,7 @@ function createWatermarkController(sendUp, opts) {
|
|
|
920
878
|
pending += 1;
|
|
921
879
|
if (!paused && pending >= opts.highWaterMark) {
|
|
922
880
|
paused = true;
|
|
923
|
-
sendUp([[
|
|
881
|
+
sendUp([[import_core5.PAUSE, lockId]]);
|
|
924
882
|
return true;
|
|
925
883
|
}
|
|
926
884
|
return false;
|
|
@@ -929,7 +887,7 @@ function createWatermarkController(sendUp, opts) {
|
|
|
929
887
|
if (pending > 0) pending -= 1;
|
|
930
888
|
if (paused && pending <= opts.lowWaterMark) {
|
|
931
889
|
paused = false;
|
|
932
|
-
sendUp([[
|
|
890
|
+
sendUp([[import_core5.RESUME, lockId]]);
|
|
933
891
|
return true;
|
|
934
892
|
}
|
|
935
893
|
return false;
|
|
@@ -943,7 +901,7 @@ function createWatermarkController(sendUp, opts) {
|
|
|
943
901
|
dispose() {
|
|
944
902
|
if (paused) {
|
|
945
903
|
paused = false;
|
|
946
|
-
sendUp([[
|
|
904
|
+
sendUp([[import_core5.RESUME, lockId]]);
|
|
947
905
|
}
|
|
948
906
|
}
|
|
949
907
|
};
|
|
@@ -990,7 +948,7 @@ function observeSSE(graph, path, opts) {
|
|
|
990
948
|
for (const msg of msgs) {
|
|
991
949
|
if (closed) return;
|
|
992
950
|
const t = msg[0];
|
|
993
|
-
if (t ===
|
|
951
|
+
if (t === import_core6.DATA) {
|
|
994
952
|
const frame = encoder.encode(sseFrame("data", serialize(msg[1])));
|
|
995
953
|
if (useBackpressure) {
|
|
996
954
|
taggedBuf.push({ frame, counted: true });
|
|
@@ -1000,7 +958,7 @@ function observeSSE(graph, path, opts) {
|
|
|
1000
958
|
} else {
|
|
1001
959
|
controller.enqueue(frame);
|
|
1002
960
|
}
|
|
1003
|
-
} else if (t ===
|
|
961
|
+
} else if (t === import_core6.ERROR) {
|
|
1004
962
|
const frame = encoder.encode(sseFrame("error", serialize(msg[1])));
|
|
1005
963
|
if (useBackpressure) {
|
|
1006
964
|
taggedBuf.push({ frame, counted: false });
|
|
@@ -1011,8 +969,8 @@ function observeSSE(graph, path, opts) {
|
|
|
1011
969
|
}
|
|
1012
970
|
close();
|
|
1013
971
|
return;
|
|
1014
|
-
} else if (t ===
|
|
1015
|
-
if (t ===
|
|
972
|
+
} else if (t === import_core6.COMPLETE || t === import_core6.TEARDOWN) {
|
|
973
|
+
if (t === import_core6.COMPLETE) {
|
|
1016
974
|
const frame = encoder.encode(sseFrame("complete"));
|
|
1017
975
|
if (useBackpressure) {
|
|
1018
976
|
taggedBuf.push({ frame, counted: false });
|
|
@@ -1094,16 +1052,16 @@ function observeSubscription(graph, path, opts) {
|
|
|
1094
1052
|
const unsub = handle.subscribe((msgs) => {
|
|
1095
1053
|
for (const msg of msgs) {
|
|
1096
1054
|
const t = msg[0];
|
|
1097
|
-
if (t ===
|
|
1055
|
+
if (t === import_core6.DATA) {
|
|
1098
1056
|
const value = msg[1];
|
|
1099
1057
|
if (filter && !filter(value)) continue;
|
|
1100
1058
|
push({ done: false, value });
|
|
1101
|
-
} else if (t ===
|
|
1059
|
+
} else if (t === import_core6.ERROR) {
|
|
1102
1060
|
const err = msg[1] instanceof Error ? msg[1] : new Error(String(msg[1]));
|
|
1103
1061
|
push({ done: true, error: err });
|
|
1104
1062
|
dispose();
|
|
1105
1063
|
return;
|
|
1106
|
-
} else if (t ===
|
|
1064
|
+
} else if (t === import_core6.COMPLETE || t === import_core6.TEARDOWN) {
|
|
1107
1065
|
push({ done: true });
|
|
1108
1066
|
dispose();
|
|
1109
1067
|
return;
|
|
@@ -1249,15 +1207,15 @@ var ObserveGateway = class {
|
|
|
1249
1207
|
const unsub = handle.subscribe((msgs) => {
|
|
1250
1208
|
for (const msg of msgs) {
|
|
1251
1209
|
const t = msg[0];
|
|
1252
|
-
if (t ===
|
|
1210
|
+
if (t === import_core6.DATA) {
|
|
1253
1211
|
wm?.onEnqueue();
|
|
1254
1212
|
trySend(send, { type: "data", path, value: msg[1] });
|
|
1255
|
-
} else if (t ===
|
|
1213
|
+
} else if (t === import_core6.ERROR) {
|
|
1256
1214
|
const errMsg = msg[1] instanceof Error ? msg[1].message : String(msg[1]);
|
|
1257
1215
|
trySend(send, { type: "error", path, error: errMsg });
|
|
1258
1216
|
cleanup();
|
|
1259
1217
|
return;
|
|
1260
|
-
} else if (t ===
|
|
1218
|
+
} else if (t === import_core6.COMPLETE || t === import_core6.TEARDOWN) {
|
|
1261
1219
|
trySend(send, { type: "complete", path });
|
|
1262
1220
|
cleanup();
|
|
1263
1221
|
return;
|
|
@@ -1321,7 +1279,7 @@ function trySend(send, msg) {
|
|
|
1321
1279
|
}
|
|
1322
1280
|
|
|
1323
1281
|
// src/compat/nestjs/guard.ts
|
|
1324
|
-
var
|
|
1282
|
+
var import_core7 = require("@graphrefly/pure-ts/core");
|
|
1325
1283
|
var ACTOR_KEY = "graphReflyActor";
|
|
1326
1284
|
function fromJwtPayload(mapping) {
|
|
1327
1285
|
return (context) => {
|
|
@@ -1346,14 +1304,14 @@ function fromHeader(headerName = "x-graphrefly-actor") {
|
|
|
1346
1304
|
}
|
|
1347
1305
|
function getActor(req) {
|
|
1348
1306
|
const actor = req?.[ACTOR_KEY];
|
|
1349
|
-
return actor != null ? (0,
|
|
1307
|
+
return actor != null ? (0, import_core7.normalizeActor)(actor) : import_core7.DEFAULT_ACTOR;
|
|
1350
1308
|
}
|
|
1351
1309
|
var GraphReflyGuardImpl = class {
|
|
1352
1310
|
constructor(extractor) {
|
|
1353
1311
|
this.extractor = extractor;
|
|
1354
1312
|
}
|
|
1355
1313
|
canActivate(context) {
|
|
1356
|
-
const actor = (0,
|
|
1314
|
+
const actor = (0, import_core7.normalizeActor)(this.extractor(context));
|
|
1357
1315
|
const req = context.switchToHttp().getRequest();
|
|
1358
1316
|
if (req != null) {
|
|
1359
1317
|
req[ACTOR_KEY] = actor;
|
|
@@ -1368,18 +1326,18 @@ function GraphReflyGuard(extractor) {
|
|
|
1368
1326
|
// src/compat/nestjs/module.ts
|
|
1369
1327
|
var import_graph3 = require("@graphrefly/pure-ts/graph");
|
|
1370
1328
|
var import_common2 = require("@nestjs/common");
|
|
1371
|
-
var
|
|
1329
|
+
var import_core10 = require("@nestjs/core");
|
|
1372
1330
|
|
|
1373
1331
|
// src/utils/cqrs/index.ts
|
|
1374
|
-
var
|
|
1332
|
+
var import_core9 = require("@graphrefly/pure-ts/core");
|
|
1375
1333
|
var import_extra3 = require("@graphrefly/pure-ts/extra");
|
|
1376
1334
|
var import_graph2 = require("@graphrefly/pure-ts/graph");
|
|
1377
1335
|
|
|
1378
1336
|
// src/base/mutation/index.ts
|
|
1379
|
-
var
|
|
1337
|
+
var import_core8 = require("@graphrefly/pure-ts/core");
|
|
1380
1338
|
var import_extra2 = require("@graphrefly/pure-ts/extra");
|
|
1381
1339
|
var import_graph = require("@graphrefly/pure-ts/graph");
|
|
1382
|
-
var DEFAULT_AUDIT_GUARD = (0,
|
|
1340
|
+
var DEFAULT_AUDIT_GUARD = (0, import_core8.policy)((allow, deny) => {
|
|
1383
1341
|
allow("observe");
|
|
1384
1342
|
allow("signal");
|
|
1385
1343
|
deny("write");
|
|
@@ -1410,7 +1368,7 @@ function mutate(act, opts) {
|
|
|
1410
1368
|
if (opts.frame === "inline") {
|
|
1411
1369
|
return function wrapped(...args) {
|
|
1412
1370
|
const sealed = freeze ? args.map(deepFreeze) : args;
|
|
1413
|
-
const t_ns = (0,
|
|
1371
|
+
const t_ns = (0, import_core8.wallClockNs)();
|
|
1414
1372
|
const seq = opts.seq ? bumpCursor(opts.seq) : void 0;
|
|
1415
1373
|
try {
|
|
1416
1374
|
const result = up(...sealed);
|
|
@@ -1443,13 +1401,13 @@ function mutate(act, opts) {
|
|
|
1443
1401
|
}
|
|
1444
1402
|
return function wrapped(...args) {
|
|
1445
1403
|
const sealed = freeze ? args.map(deepFreeze) : args;
|
|
1446
|
-
const t_ns = (0,
|
|
1404
|
+
const t_ns = (0, import_core8.wallClockNs)();
|
|
1447
1405
|
let result;
|
|
1448
1406
|
let captured;
|
|
1449
1407
|
let captureSet = false;
|
|
1450
1408
|
let seq;
|
|
1451
1409
|
try {
|
|
1452
|
-
(0,
|
|
1410
|
+
(0, import_core8.batch)(() => {
|
|
1453
1411
|
if (opts.seq) seq = bumpCursor(opts.seq);
|
|
1454
1412
|
try {
|
|
1455
1413
|
result = up(...sealed);
|
|
@@ -1508,7 +1466,7 @@ function bumpCursor(seq) {
|
|
|
1508
1466
|
}
|
|
1509
1467
|
const cur = valid ? raw : 0;
|
|
1510
1468
|
const next = cur + 1;
|
|
1511
|
-
seq.down([[
|
|
1469
|
+
seq.down([[import_core8.DIRTY], [import_core8.DATA, next]]);
|
|
1512
1470
|
return next;
|
|
1513
1471
|
}
|
|
1514
1472
|
function appendAudit(audit, builder, args, value, meta, handlerVersion) {
|
|
@@ -1518,7 +1476,7 @@ function appendAudit(audit, builder, args, value, meta, handlerVersion) {
|
|
|
1518
1476
|
audit.append(stamped);
|
|
1519
1477
|
}
|
|
1520
1478
|
function registerCursor(graph, name, initial = 0) {
|
|
1521
|
-
const cursor = (0,
|
|
1479
|
+
const cursor = (0, import_core8.node)([], { initial, name, describeKind: "state" });
|
|
1522
1480
|
graph.add(cursor, { name });
|
|
1523
1481
|
return cursor;
|
|
1524
1482
|
}
|
|
@@ -1526,7 +1484,7 @@ function registerCursorMap(graph, name, keys, initial = 0) {
|
|
|
1526
1484
|
const out = {};
|
|
1527
1485
|
const sub = new import_graph.Graph(name);
|
|
1528
1486
|
for (const k of keys) {
|
|
1529
|
-
const cursor = (0,
|
|
1487
|
+
const cursor = (0, import_core8.node)([], {
|
|
1530
1488
|
initial,
|
|
1531
1489
|
name: k,
|
|
1532
1490
|
describeKind: "state"
|
|
@@ -1610,17 +1568,17 @@ function domainMeta(domain, kind, extra) {
|
|
|
1610
1568
|
}
|
|
1611
1569
|
|
|
1612
1570
|
// src/utils/cqrs/index.ts
|
|
1613
|
-
var COMMAND_GUARD = (0,
|
|
1571
|
+
var COMMAND_GUARD = (0, import_core9.policy)((allow, deny) => {
|
|
1614
1572
|
allow("write");
|
|
1615
1573
|
allow("signal");
|
|
1616
1574
|
deny("observe");
|
|
1617
1575
|
});
|
|
1618
|
-
var PROJECTION_GUARD = (0,
|
|
1576
|
+
var PROJECTION_GUARD = (0, import_core9.policy)((allow, deny) => {
|
|
1619
1577
|
allow("observe");
|
|
1620
1578
|
allow("signal");
|
|
1621
1579
|
deny("write");
|
|
1622
1580
|
});
|
|
1623
|
-
var EVENT_GUARD = (0,
|
|
1581
|
+
var EVENT_GUARD = (0, import_core9.policy)((allow, deny) => {
|
|
1624
1582
|
allow("observe");
|
|
1625
1583
|
allow("signal");
|
|
1626
1584
|
deny("write");
|
|
@@ -1727,7 +1685,7 @@ var CqrsGraph = class extends import_graph2.Graph {
|
|
|
1727
1685
|
aggregateId,
|
|
1728
1686
|
type,
|
|
1729
1687
|
lastVersion,
|
|
1730
|
-
t_ns: (0,
|
|
1688
|
+
t_ns: (0, import_core9.wallClockNs)()
|
|
1731
1689
|
});
|
|
1732
1690
|
}
|
|
1733
1691
|
}
|
|
@@ -1862,7 +1820,7 @@ var CqrsGraph = class extends import_graph2.Graph {
|
|
|
1862
1820
|
}
|
|
1863
1821
|
);
|
|
1864
1822
|
} catch {
|
|
1865
|
-
guarded = (0,
|
|
1823
|
+
guarded = (0, import_core9.node)(
|
|
1866
1824
|
[entries],
|
|
1867
1825
|
(batchData, actions, ctx) => {
|
|
1868
1826
|
const latest = batchData[0] != null && batchData[0].length > 0 ? batchData[0].at(-1) : ctx.prevData[0];
|
|
@@ -1920,7 +1878,7 @@ var CqrsGraph = class extends import_graph2.Graph {
|
|
|
1920
1878
|
const evt = {
|
|
1921
1879
|
type: eventName,
|
|
1922
1880
|
payload: frozenPayload,
|
|
1923
|
-
timestampNs: (0,
|
|
1881
|
+
timestampNs: (0, import_core9.wallClockNs)(),
|
|
1924
1882
|
seq: ++this._seq,
|
|
1925
1883
|
...extra?.aggregateId !== void 0 ? { aggregateId: extra.aggregateId } : {},
|
|
1926
1884
|
...aggregateVersion !== void 0 ? { aggregateVersion } : {},
|
|
@@ -2278,7 +2236,7 @@ var CqrsGraph = class extends import_graph2.Graph {
|
|
|
2278
2236
|
const cursor = cursors[eName];
|
|
2279
2237
|
latestCursors.set(eName, cursor.cache ?? 0);
|
|
2280
2238
|
const sub = cursor.subscribe((msgs) => {
|
|
2281
|
-
for (const m of msgs) if (m[0] ===
|
|
2239
|
+
for (const m of msgs) if (m[0] === import_core9.DATA) latestCursors.set(eName, m[1]);
|
|
2282
2240
|
});
|
|
2283
2241
|
this.addDisposer(sub);
|
|
2284
2242
|
}
|
|
@@ -2371,7 +2329,7 @@ var CqrsGraph = class extends import_graph2.Graph {
|
|
|
2371
2329
|
function cqrs(name, opts) {
|
|
2372
2330
|
const g = new CqrsGraph(name, opts);
|
|
2373
2331
|
const { factory: _f, factoryArgs: _fa, ...tagArgs } = opts ?? {};
|
|
2374
|
-
g.tagFactory("cqrs", (0,
|
|
2332
|
+
g.tagFactory("cqrs", (0, import_core9.placeholderArgs)(tagArgs));
|
|
2375
2333
|
return g;
|
|
2376
2334
|
}
|
|
2377
2335
|
|
|
@@ -2427,7 +2385,7 @@ var _GraphReflyModule = class _GraphReflyModule {
|
|
|
2427
2385
|
{
|
|
2428
2386
|
provide: GraphReflyEventExplorer,
|
|
2429
2387
|
useFactory: (graph, moduleRef) => new GraphReflyEventExplorer(graph, moduleRef),
|
|
2430
|
-
inject: [GRAPHREFLY_ROOT_GRAPH,
|
|
2388
|
+
inject: [GRAPHREFLY_ROOT_GRAPH, import_core10.ModuleRef]
|
|
2431
2389
|
}
|
|
2432
2390
|
];
|
|
2433
2391
|
if (options.nodes) {
|
|
@@ -2569,6 +2527,111 @@ _GraphReflyModule = __decorateElement(_init, 0, "GraphReflyModule", _GraphReflyM
|
|
|
2569
2527
|
__runInitializers(_init, 1, _GraphReflyModule);
|
|
2570
2528
|
var GraphReflyModule = _GraphReflyModule;
|
|
2571
2529
|
|
|
2530
|
+
// src/compat/nestjs/observable.ts
|
|
2531
|
+
var import_rxjs = require("rxjs");
|
|
2532
|
+
|
|
2533
|
+
// src/base/composition/observable.ts
|
|
2534
|
+
var import_core11 = require("@graphrefly/pure-ts/core");
|
|
2535
|
+
var OBSERVABLE_KEY = typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
2536
|
+
function normalizeObserver(observer) {
|
|
2537
|
+
return typeof observer === "function" ? { next: observer } : observer;
|
|
2538
|
+
}
|
|
2539
|
+
function makeInterop(onSubscribe) {
|
|
2540
|
+
const obs = {
|
|
2541
|
+
subscribe(rawObserver) {
|
|
2542
|
+
const observer = normalizeObserver(rawObserver);
|
|
2543
|
+
let closed = false;
|
|
2544
|
+
let teardown;
|
|
2545
|
+
let teardownPending = false;
|
|
2546
|
+
const runTeardown = () => {
|
|
2547
|
+
if (teardown) teardown();
|
|
2548
|
+
else teardownPending = true;
|
|
2549
|
+
};
|
|
2550
|
+
const guarded = {
|
|
2551
|
+
get closed() {
|
|
2552
|
+
return closed;
|
|
2553
|
+
},
|
|
2554
|
+
next(value) {
|
|
2555
|
+
if (!closed) observer.next?.(value);
|
|
2556
|
+
},
|
|
2557
|
+
error(err) {
|
|
2558
|
+
if (closed) return;
|
|
2559
|
+
closed = true;
|
|
2560
|
+
try {
|
|
2561
|
+
observer.error?.(err);
|
|
2562
|
+
} finally {
|
|
2563
|
+
runTeardown();
|
|
2564
|
+
}
|
|
2565
|
+
},
|
|
2566
|
+
complete() {
|
|
2567
|
+
if (closed) return;
|
|
2568
|
+
closed = true;
|
|
2569
|
+
try {
|
|
2570
|
+
observer.complete?.();
|
|
2571
|
+
} finally {
|
|
2572
|
+
runTeardown();
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
};
|
|
2576
|
+
teardown = onSubscribe(guarded);
|
|
2577
|
+
if (teardownPending) teardown();
|
|
2578
|
+
return {
|
|
2579
|
+
unsubscribe() {
|
|
2580
|
+
if (closed) return;
|
|
2581
|
+
closed = true;
|
|
2582
|
+
teardown?.();
|
|
2583
|
+
}
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
};
|
|
2587
|
+
obs[OBSERVABLE_KEY] = function() {
|
|
2588
|
+
return this;
|
|
2589
|
+
};
|
|
2590
|
+
return obs;
|
|
2591
|
+
}
|
|
2592
|
+
function toObservable(node7, options) {
|
|
2593
|
+
if (options?.raw) {
|
|
2594
|
+
return makeInterop((observer) => {
|
|
2595
|
+
return node7.subscribe((msgs) => {
|
|
2596
|
+
if (observer.closed) return;
|
|
2597
|
+
observer.next?.(msgs);
|
|
2598
|
+
for (const m of msgs) {
|
|
2599
|
+
if (m[0] === import_core11.ERROR) {
|
|
2600
|
+
observer.error?.(m[1]);
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
if (m[0] === import_core11.COMPLETE) {
|
|
2604
|
+
observer.complete?.();
|
|
2605
|
+
return;
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
});
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
return makeInterop((observer) => {
|
|
2612
|
+
return node7.subscribe((msgs) => {
|
|
2613
|
+
for (const m of msgs) {
|
|
2614
|
+
if (observer.closed) return;
|
|
2615
|
+
if (m[0] === import_core11.DATA) {
|
|
2616
|
+
observer.next?.(m[1]);
|
|
2617
|
+
} else if (m[0] === import_core11.ERROR) {
|
|
2618
|
+
observer.error?.(m[1]);
|
|
2619
|
+
return;
|
|
2620
|
+
} else if (m[0] === import_core11.COMPLETE) {
|
|
2621
|
+
observer.complete?.();
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
});
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
// src/compat/nestjs/observable.ts
|
|
2630
|
+
function toObservable2(node7, options) {
|
|
2631
|
+
const base = options?.raw ? toObservable(node7, { raw: true }) : toObservable(node7);
|
|
2632
|
+
return (0, import_rxjs.from)(base);
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2572
2635
|
// src/compat/react/index.ts
|
|
2573
2636
|
var react_exports = {};
|
|
2574
2637
|
__export(react_exports, {
|