@rotorsoft/act 1.35.1 → 1.35.2
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/.tsbuildinfo +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +3 -2
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-L66OOP2F.cjs → chunk-4KDMNSPJ.cjs} +1 -1
- package/dist/chunk-4KDMNSPJ.cjs.map +1 -0
- package/dist/{chunk-BNTVE7RQ.cjs → chunk-F2YAA4SE.cjs} +13 -13
- package/dist/{chunk-BNTVE7RQ.cjs.map → chunk-F2YAA4SE.cjs.map} +1 -1
- package/dist/{chunk-DH2HW5XJ.js → chunk-H2QN755D.js} +1 -1
- package/dist/chunk-H2QN755D.js.map +1 -0
- package/dist/{chunk-MHPUVTMX.js → chunk-SVVVS6GA.js} +2 -2
- package/dist/index.cjs +155 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -26
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +4 -4
- package/dist/test/index.js +2 -2
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-DH2HW5XJ.js.map +0 -1
- package/dist/chunk-L66OOP2F.cjs.map +0 -1
- /package/dist/{chunk-MHPUVTMX.js.map → chunk-SVVVS6GA.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
sleep,
|
|
41
41
|
store,
|
|
42
42
|
validate
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-SVVVS6GA.js";
|
|
44
44
|
import {
|
|
45
45
|
ActorSchema,
|
|
46
46
|
CausationEventSchema,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
pii_fields,
|
|
72
72
|
pii_schemas,
|
|
73
73
|
sensitive
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-H2QN755D.js";
|
|
75
75
|
|
|
76
76
|
// src/signals.ts
|
|
77
77
|
process.once("SIGINT", async (arg) => {
|
|
@@ -1927,7 +1927,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1927
1927
|
);
|
|
1928
1928
|
if (snapshot.event?.name === TOMBSTONE_EVENT)
|
|
1929
1929
|
throw new StreamClosedError(stream);
|
|
1930
|
-
const expected = expectedVersion ??
|
|
1930
|
+
const expected = expectedVersion ?? snapshot.version;
|
|
1931
1931
|
for (const { valid, description } of me.given?.[action2] ?? [])
|
|
1932
1932
|
if (!valid(snapshot.state, actor))
|
|
1933
1933
|
throw new InvariantError(
|
|
@@ -1999,14 +1999,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1999
1999
|
);
|
|
2000
2000
|
let committed;
|
|
2001
2001
|
try {
|
|
2002
|
-
committed = await store().commit(
|
|
2003
|
-
stream,
|
|
2004
|
-
emitted,
|
|
2005
|
-
meta,
|
|
2006
|
-
// Reactions skip the inferred version guard (leases already
|
|
2007
|
-
// serialize them); an explicit expectedVersion is still honored.
|
|
2008
|
-
reactingTo ? expectedVersion : expected
|
|
2009
|
-
);
|
|
2002
|
+
committed = await store().commit(stream, emitted, meta, expected);
|
|
2010
2003
|
} catch (error) {
|
|
2011
2004
|
if (error instanceof ConcurrencyError) void cache_drop(stream);
|
|
2012
2005
|
throw error;
|
|
@@ -2023,21 +2016,16 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2023
2016
|
replayed: snapshot.replayed
|
|
2024
2017
|
}));
|
|
2025
2018
|
const last = snapshots.at(-1);
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
patches: snap_event ? 0 : last.patches,
|
|
2037
|
-
snaps: snap_event ? last.snaps + 1 : last.snaps
|
|
2038
|
-
});
|
|
2039
|
-
else void cache_drop(stream);
|
|
2040
|
-
}
|
|
2019
|
+
const snap_event = me.snap?.(last) ? await snap(last) : void 0;
|
|
2020
|
+
if (!me.pii_aware)
|
|
2021
|
+
void cache_put(stream, {
|
|
2022
|
+
stream,
|
|
2023
|
+
state: last.state,
|
|
2024
|
+
version: snap_event?.version ?? last.event.version,
|
|
2025
|
+
event_id: snap_event?.id ?? last.event.id,
|
|
2026
|
+
patches: snap_event ? 0 : last.patches,
|
|
2027
|
+
snaps: snap_event ? last.snaps + 1 : last.snaps
|
|
2028
|
+
});
|
|
2041
2029
|
return snapshots;
|
|
2042
2030
|
} catch (error) {
|
|
2043
2031
|
if (!(error instanceof ConcurrencyError)) throw error;
|