@rotorsoft/act 1.23.13 → 1.23.15

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
@@ -199,6 +199,24 @@ var make_schema_pass = (deps) => {
199
199
  drain: () => findings
200
200
  };
201
201
  };
202
+ var classify_deprecated_by_state = (deps) => {
203
+ const names_by_state = /* @__PURE__ */ new Map();
204
+ for (const [name, state2] of deps.event_to_state) {
205
+ let set = names_by_state.get(state2);
206
+ if (!set) {
207
+ set = /* @__PURE__ */ new Set();
208
+ names_by_state.set(state2, set);
209
+ }
210
+ set.add(name);
211
+ }
212
+ const deprecated_to_current = /* @__PURE__ */ new Map();
213
+ for (const names of names_by_state.values()) {
214
+ for (const name of deprecated_event_names(names)) {
215
+ deprecated_to_current.set(name, current_version_of(name, names));
216
+ }
217
+ }
218
+ return deprecated_to_current;
219
+ };
202
220
  var make_deprecated_load_pass = (deps, options) => {
203
221
  const share_min = options.thresholds?.deprecated_min ?? DEFAULTS.deprecated_min;
204
222
  const totals = /* @__PURE__ */ new Map();
@@ -220,12 +238,12 @@ var make_deprecated_load_pass = (deps, options) => {
220
238
  const findings = [];
221
239
  const grand = [...totals.values()].reduce((s, n) => s + n, 0);
222
240
  if (grand === 0) return findings;
223
- const deprecated = deprecated_event_names(deps.known_events);
224
- const sorted = [...deprecated].map((name) => ({ name, count: totals.get(name) ?? 0 })).sort((a, b) => b.count - a.count);
241
+ const deprecated = classify_deprecated_by_state(deps);
242
+ const sorted = [...deprecated.keys()].map((name) => ({ name, count: totals.get(name) ?? 0 })).sort((a, b) => b.count - a.count);
225
243
  for (const { name, count } of sorted) {
226
244
  if (count === 0) continue;
227
245
  if (count / grand < share_min) continue;
228
- const current_version = current_version_of(name, deps.known_events);
246
+ const current_version = deprecated.get(name);
229
247
  const top_streams = [...per_stream.get(name).entries()].map(([stream, c]) => ({ stream, count: c })).sort((a, b) => b.count - a.count).slice(0, 10);
230
248
  findings.push({
231
249
  category: "deprecated-load",
@@ -2828,13 +2846,14 @@ var SettleLoop = class {
2828
2846
  await this._deps.init();
2829
2847
  let last_drain;
2830
2848
  for (let i = 0; i < maxPasses; i++) {
2831
- const { subscribed } = await this._deps.correlate({
2849
+ const after_before = this._deps.checkpoint();
2850
+ const { subscribed, last_id } = await this._deps.correlate({
2832
2851
  ...correlate_query,
2833
- after: this._deps.checkpoint()
2852
+ after: after_before
2834
2853
  });
2835
2854
  this._deps.breaker.passed();
2836
2855
  last_drain = await this._deps.drain(drain_options);
2837
- const made_progress = subscribed > 0 || last_drain.acked.length > 0 || last_drain.blocked.length > 0;
2856
+ const made_progress = subscribed > 0 || last_drain.acked.length > 0 || last_drain.blocked.length > 0 || last_id > after_before;
2838
2857
  if (!made_progress) break;
2839
2858
  }
2840
2859
  if (last_drain) this._deps.on_settled(last_drain);
@@ -3209,7 +3228,6 @@ var Act = class {
3209
3228
  logger: this._logger,
3210
3229
  event_to_state: this._event_to_state,
3211
3230
  states: this._states,
3212
- known_events: new Set(this._event_to_state.keys()),
3213
3231
  // The DECLARED lane universe — the implicit "default" plus every
3214
3232
  // `.withLane(...)` name — NOT `_drain_controllers.keys()` (#1224).
3215
3233
  // An `onlyLanes`-filtered instance builds a controller only for its
@@ -4031,8 +4049,13 @@ var Act = class {
4031
4049
  * @param options - Query window + per-category thresholds.
4032
4050
  * @returns Async iterable of {@link AuditFinding}.
4033
4051
  */
4034
- audit(categories, options) {
4035
- return audit(this._audit_deps, categories, options);
4052
+ async *audit(categories, options) {
4053
+ const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
4054
+ while (true) {
4055
+ const { value, done } = await this._scoped(() => it.next());
4056
+ if (done) break;
4057
+ yield value;
4058
+ }
4036
4059
  }
4037
4060
  /**
4038
4061
  * Bulk-update scheduling priority for streams matching `filter`.