@rotorsoft/act 1.18.2 → 1.18.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/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  sleep,
20
20
  store,
21
21
  validate
22
- } from "./chunk-KL37CDMW.js";
22
+ } from "./chunk-TODGOWEZ.js";
23
23
  import {
24
24
  ActorSchema,
25
25
  CausationEventSchema,
@@ -1467,7 +1467,6 @@ async function fetch(leased, eventLimit) {
1467
1467
  }
1468
1468
  var ack = (leases) => store().ack(leases);
1469
1469
  var block = (leases) => store().block(leases);
1470
- var defer = (input, deferred_at) => store().defer(input, deferred_at);
1471
1470
  var subscribe = (streams) => store().subscribe(streams);
1472
1471
 
1473
1472
  // src/internal/event-sourcing.ts
@@ -1948,7 +1947,6 @@ function build_drain(logger) {
1948
1947
  fetch,
1949
1948
  ack,
1950
1949
  block,
1951
- defer,
1952
1950
  subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
1953
1951
  if (!result.subscribed) return;
1954
1952
  const lanes = new Set(streams.map((s) => s.lane ?? "default"));
@@ -2052,21 +2050,13 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2052
2050
  })
2053
2051
  );
2054
2052
  const acked = await ops.ack(
2055
- handled.filter((h) => h.defer === void 0 && (h.handled > 0 || !h.error)).map((h) => ({ ...h.lease, at: h.acked_at }))
2053
+ handled.flatMap(
2054
+ (h) => h.defer !== void 0 ? { ...h.lease, due: h.defer } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : []
2055
+ )
2056
2056
  );
2057
2057
  const blocked = await ops.block(
2058
2058
  handled.filter(({ block: block2 }) => block2).map(({ lease, error }) => ({ ...lease, error }))
2059
2059
  );
2060
- const deferrals = handled.filter((h) => h.defer !== void 0);
2061
- if (deferrals.length) {
2062
- const by_time = /* @__PURE__ */ new Map();
2063
- for (const h of deferrals) {
2064
- const list = by_time.get(h.defer);
2065
- if (list) list.push(h.lease.stream);
2066
- else by_time.set(h.defer, [h.lease.stream]);
2067
- }
2068
- for (const [at, streams] of by_time) await ops.defer(streams, at);
2069
- }
2070
2060
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
2071
2061
  return { leased, fetched, handled, acked, blocked, closeable };
2072
2062
  }