@fairfox/polly 0.37.0 → 0.38.0

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.
@@ -401,6 +401,32 @@ async function generateTLA(config, analysis) {
401
401
  const generator = new TLAGenerator;
402
402
  return await generator.generate(config, analysis);
403
403
  }
404
+ function applySubsystemBounds(messages, subsystem, handlerNames) {
405
+ if (messages.perMessageBounds) {
406
+ const filtered = {};
407
+ for (const [msg, bound] of Object.entries(messages.perMessageBounds)) {
408
+ if (handlerNames.has(msg)) {
409
+ filtered[msg] = bound;
410
+ }
411
+ }
412
+ messages.perMessageBounds = filtered;
413
+ }
414
+ const override = subsystem.bounds;
415
+ if (!override)
416
+ return;
417
+ if (override.maxInFlight !== undefined) {
418
+ messages.maxInFlight = override.maxInFlight;
419
+ }
420
+ if (override.perMessageBounds) {
421
+ const merged = { ...messages.perMessageBounds ?? {} };
422
+ for (const [msg, bound] of Object.entries(override.perMessageBounds)) {
423
+ if (handlerNames.has(msg)) {
424
+ merged[msg] = bound;
425
+ }
426
+ }
427
+ messages.perMessageBounds = merged;
428
+ }
429
+ }
404
430
  async function generateSubsystemTLA(_subsystemName, subsystem, config, analysis) {
405
431
  const stateFields = new Set(subsystem.state);
406
432
  const handlerNames = new Set(subsystem.handlers);
@@ -415,15 +441,7 @@ async function generateSubsystemTLA(_subsystemName, subsystem, config, analysis)
415
441
  include: subsystem.handlers
416
442
  };
417
443
  filteredMessages.exclude = undefined;
418
- if (filteredMessages.perMessageBounds) {
419
- const filteredBounds = {};
420
- for (const [msg, bound] of Object.entries(filteredMessages.perMessageBounds)) {
421
- if (handlerNames.has(msg)) {
422
- filteredBounds[msg] = bound;
423
- }
424
- }
425
- filteredMessages.perMessageBounds = filteredBounds;
426
- }
444
+ applySubsystemBounds(filteredMessages, subsystem, handlerNames);
427
445
  const filteredConfig = {
428
446
  ...config,
429
447
  state: filteredState,
@@ -7724,4 +7742,4 @@ main().catch((error) => {
7724
7742
  process.exit(1);
7725
7743
  });
7726
7744
 
7727
- //# debugId=550B2383F1F1827964756E2164756E21
7745
+ //# debugId=93D3E9EFDD87727A64756E2164756E21