@fairfox/polly 0.36.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,
@@ -5289,6 +5307,13 @@ class HandlerExtractor {
5289
5307
  assignments.push({ field, value });
5290
5308
  return;
5291
5309
  }
5310
+ if (Node2.isIdentifier(initializer)) {
5311
+ const paramName2 = initializer.getText();
5312
+ if (this.currentFunctionParams.includes(paramName2)) {
5313
+ assignments.push({ field, value: `param:${paramName2}` });
5314
+ return;
5315
+ }
5316
+ }
5292
5317
  const paramName = this.extractPayloadPropertyParam(initializer);
5293
5318
  if (paramName !== null) {
5294
5319
  assignments.push({ field, value: `param:${paramName}` });
@@ -7717,4 +7742,4 @@ main().catch((error) => {
7717
7742
  process.exit(1);
7718
7743
  });
7719
7744
 
7720
- //# debugId=F1333D1589EFA94964756E2164756E21
7745
+ //# debugId=93D3E9EFDD87727A64756E2164756E21