@rotorsoft/act 1.33.4 → 1.33.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
@@ -4298,11 +4298,15 @@ var _this_ = ({ stream }) => ({
4298
4298
 
4299
4299
  // src/builders/builder-utils.ts
4300
4300
  function register_lane(config2, lanes) {
4301
+ resolveLaneConfig(config2);
4301
4302
  if (config2.name === DEFAULT_LANE)
4302
4303
  throw new Error(`Lane "${DEFAULT_LANE}" is reserved`);
4303
- if (lanes.some((l) => l.name === config2.name))
4304
- throw new Error(`Lane "${config2.name}" was already declared`);
4305
- lanes.push(config2);
4304
+ const existing = lanes.find((l) => l.name === config2.name);
4305
+ if (!existing) return void lanes.push(config2);
4306
+ if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
4307
+ throw new Error(
4308
+ `Lane "${config2.name}" was already declared with a different config`
4309
+ );
4306
4310
  }
4307
4311
  function reaction_on(event, events, builder) {
4308
4312
  const register = (handler, options, schedule) => {
@@ -4653,18 +4657,7 @@ function act() {
4653
4657
  }
4654
4658
  merge_event_register(registry.events, input.events);
4655
4659
  pending_projections.push(...input.projections);
4656
- for (const slice_lane of input.lanes) {
4657
- const existing = lanes.find((l) => l.name === slice_lane.name);
4658
- if (!existing) {
4659
- lanes.push(slice_lane);
4660
- continue;
4661
- }
4662
- if (existing.leaseMillis !== slice_lane.leaseMillis || existing.streamLimit !== slice_lane.streamLimit || existing.cycleMs !== slice_lane.cycleMs) {
4663
- throw new Error(
4664
- `Lane "${slice_lane.name}" was already declared with a different config`
4665
- );
4666
- }
4667
- }
4660
+ for (const lane of input.lanes) register_lane(lane, lanes);
4668
4661
  return builder;
4669
4662
  },
4670
4663
  withProjection: (proj) => {
@@ -4675,7 +4668,7 @@ function act() {
4675
4668
  withActor: () => builder,
4676
4669
  withLane: (config2) => {
4677
4670
  if (_built) closed("withLane");
4678
- register_lane(resolveLaneConfig(config2), lanes);
4671
+ register_lane(config2, lanes);
4679
4672
  return builder;
4680
4673
  },
4681
4674
  on: (event) => {
@@ -4897,7 +4890,7 @@ function slice() {
4897
4890
  return builder;
4898
4891
  },
4899
4892
  withLane: (config2) => {
4900
- register_lane(resolveLaneConfig(config2), lanes);
4893
+ register_lane(config2, lanes);
4901
4894
  return builder;
4902
4895
  },
4903
4896
  on: (event) => reaction_on(event, events, builder),