@rotorsoft/act 1.35.1 → 1.35.3
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/act.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/projection-builder.d.ts +25 -3
- package/dist/@types/builders/projection-builder.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts +23 -23
- package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
- package/dist/@types/internal/classify.d.ts +4 -4
- package/dist/@types/internal/classify.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/internal/projection-fold.d.ts +2 -2
- package/dist/@types/internal/projection-fold.d.ts.map +1 -1
- package/dist/@types/internal/tracing.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 +198 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -37
- 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) => {
|
|
@@ -746,7 +746,7 @@ var CircuitBreaker = class {
|
|
|
746
746
|
};
|
|
747
747
|
|
|
748
748
|
// src/internal/classify.ts
|
|
749
|
-
var ALL_LANES = /* @__PURE__ */ Symbol("act
|
|
749
|
+
var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
|
|
750
750
|
function classify_registry(registry, states) {
|
|
751
751
|
const statics = /* @__PURE__ */ new Map();
|
|
752
752
|
const target_lanes = /* @__PURE__ */ new Map();
|
|
@@ -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;
|
|
@@ -2109,7 +2097,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
2109
2097
|
action_name,
|
|
2110
2098
|
target,
|
|
2111
2099
|
payload,
|
|
2112
|
-
{
|
|
2100
|
+
{ ...options, correlator: options?.correlator ?? correlator },
|
|
2113
2101
|
patch_fn
|
|
2114
2102
|
);
|
|
2115
2103
|
const bound_load = (me, target, callback) => load(me, target, callback, patch_fn);
|
|
@@ -2149,17 +2137,15 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
2149
2137
|
action: traced(
|
|
2150
2138
|
bound_action,
|
|
2151
2139
|
(snapshots, _me, _action, target) => {
|
|
2152
|
-
|
|
2153
|
-
if (committed.length) {
|
|
2140
|
+
if (snapshots[0].patch)
|
|
2154
2141
|
logger.trace(
|
|
2155
|
-
|
|
2142
|
+
snapshots.map((s) => s.event.data),
|
|
2156
2143
|
es_caption(
|
|
2157
2144
|
"committed",
|
|
2158
2145
|
C_ORANGE,
|
|
2159
|
-
`${target.stream}.${
|
|
2146
|
+
`${target.stream}.${snapshots.map((s) => s.event.name).join(", ")}`
|
|
2160
2147
|
)
|
|
2161
2148
|
);
|
|
2162
|
-
}
|
|
2163
2149
|
},
|
|
2164
2150
|
(_me, action2, target, payload) => {
|
|
2165
2151
|
logger.trace(
|
|
@@ -2598,7 +2584,7 @@ function pii_strip(event, fields) {
|
|
|
2598
2584
|
|
|
2599
2585
|
// src/internal/projection-fold.ts
|
|
2600
2586
|
var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
|
|
2601
|
-
function make_fold_handler(me, flush, config2,
|
|
2587
|
+
function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
2602
2588
|
const load_me = {
|
|
2603
2589
|
...me,
|
|
2604
2590
|
view: (raw, actor) => {
|
|
@@ -2628,7 +2614,7 @@ function make_fold_handler(me, flush, config2, patch_fn, sensitive_fields) {
|
|
|
2628
2614
|
if (evictee.dirty) await flush([row(evictee)]);
|
|
2629
2615
|
cache2.delete(oldest);
|
|
2630
2616
|
}
|
|
2631
|
-
const snapshot = await load(load_me, { stream }
|
|
2617
|
+
const snapshot = await load(load_me, { stream });
|
|
2632
2618
|
const seated = {
|
|
2633
2619
|
stream,
|
|
2634
2620
|
state: snapshot.state,
|
|
@@ -2659,7 +2645,7 @@ function make_fold_handler(me, flush, config2, patch_fn, sensitive_fields) {
|
|
|
2659
2645
|
}
|
|
2660
2646
|
if (event.id > fold.event_id) {
|
|
2661
2647
|
const reducer = me.patch[event.name];
|
|
2662
|
-
fold.state =
|
|
2648
|
+
fold.state = bare_patch(
|
|
2663
2649
|
me,
|
|
2664
2650
|
fold.state,
|
|
2665
2651
|
reducer(event, fold.state),
|
|
@@ -3371,6 +3357,7 @@ var Act = class {
|
|
|
3371
3357
|
payload,
|
|
3372
3358
|
do_options
|
|
3373
3359
|
);
|
|
3360
|
+
if (!snapshots[0].patch) return snapshots;
|
|
3374
3361
|
this._wake(snapshots.map((s) => s.event.name));
|
|
3375
3362
|
this.emit("committed", snapshots);
|
|
3376
3363
|
return snapshots;
|
|
@@ -4675,7 +4662,6 @@ function act() {
|
|
|
4675
4662
|
spec.merged,
|
|
4676
4663
|
spec.flush,
|
|
4677
4664
|
spec.config,
|
|
4678
|
-
bare_patch,
|
|
4679
4665
|
// Head loads strip sensitive keys like the warm path.
|
|
4680
4666
|
registry.sensitive_fields
|
|
4681
4667
|
)
|