@rotorsoft/act 1.37.5 → 1.37.6

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
@@ -1458,7 +1458,7 @@ var CorrelateCycle = class {
1458
1458
  });
1459
1459
  } catch (error) {
1460
1460
  log().warn(
1461
- `Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(error)}`
1461
+ `Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(error.cause ?? error)}`
1462
1462
  );
1463
1463
  }
1464
1464
  }
@@ -4019,6 +4019,10 @@ function policy_min_after_days(options) {
4019
4019
  if (parsed.or?.after) windows.push(parsed.or.after.days);
4020
4020
  return windows.length ? Math.min(...windows) : void 0;
4021
4021
  }
4022
+ function policy_after_windows(options) {
4023
+ const parsed = AutoclosePolicySchema.parse(options);
4024
+ return [parsed.after, parsed.or?.after].flatMap((w) => w ? [w.days] : []);
4025
+ }
4022
4026
  function policy_keep_days(options) {
4023
4027
  const parsed = AutoclosePolicySchema.parse(options);
4024
4028
  return parsed.keep?.days;
@@ -4090,7 +4094,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4090
4094
  for (const st of states.values()) {
4091
4095
  const predicate = st.autoclose;
4092
4096
  if (!predicate) continue;
4093
- const after_days = st.autoclose_after_days;
4097
+ const after_windows = st.autoclose_after_windows;
4094
4098
  const keep_days = st.autoclose_keep_days;
4095
4099
  const archiver = st.archive;
4096
4100
  const reaction = {
@@ -4140,8 +4144,8 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4140
4144
  });
4141
4145
  }
4142
4146
  const dues = [];
4143
- if (after_days !== void 0)
4144
- dues.push(days_after(head.created, after_days));
4147
+ for (const days of after_windows)
4148
+ dues.push(days_after(head.created, days));
4145
4149
  if (keep_days !== void 0)
4146
4150
  dues.push(days_after(entry.tail.created, keep_days));
4147
4151
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
@@ -4231,6 +4235,7 @@ function autoclose_of(existing, state2) {
4231
4235
  return {
4232
4236
  autoclose: owner.autoclose,
4233
4237
  autoclose_after_days: owner.autoclose_after_days,
4238
+ autoclose_after_windows: owner.autoclose_after_windows,
4234
4239
  autoclose_keep_days: owner.autoclose_keep_days
4235
4240
  };
4236
4241
  }
@@ -5085,6 +5090,7 @@ function action_builder(state2) {
5085
5090
  policy
5086
5091
  );
5087
5092
  internal.autoclose_after_days = policy_min_after_days(policy);
5093
+ internal.autoclose_after_windows = policy_after_windows(policy);
5088
5094
  internal.autoclose_keep_days = policy_keep_days(policy);
5089
5095
  return builder;
5090
5096
  },