@fairfox/polly 0.33.0 → 0.34.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.
@@ -2583,15 +2583,7 @@ class HandlerExtractor {
2583
2583
  }
2584
2584
  extractPropertyAssignment(prop, assignments, signalName) {
2585
2585
  if (Node4.isPropertyAssignment(prop)) {
2586
- const name = prop.getName();
2587
- const initializer = prop.getInitializer();
2588
- if (!name || !initializer)
2589
- return;
2590
- const value = this.extractValue(initializer);
2591
- if (value === undefined)
2592
- return;
2593
- const field = signalName ? `${signalName}_${name}` : name;
2594
- assignments.push({ field, value });
2586
+ this.extractRegularPropertyAssignment(prop, assignments, signalName);
2595
2587
  return;
2596
2588
  }
2597
2589
  if (Node4.isShorthandPropertyAssignment(prop)) {
@@ -2604,6 +2596,37 @@ class HandlerExtractor {
2604
2596
  }
2605
2597
  }
2606
2598
  }
2599
+ extractRegularPropertyAssignment(prop, assignments, signalName) {
2600
+ if (!Node4.isPropertyAssignment(prop))
2601
+ return;
2602
+ const name = prop.getName();
2603
+ const initializer = prop.getInitializer();
2604
+ if (!name || !initializer)
2605
+ return;
2606
+ const field = signalName ? `${signalName}_${name}` : name;
2607
+ const value = this.extractValue(initializer);
2608
+ if (value !== undefined) {
2609
+ assignments.push({ field, value });
2610
+ return;
2611
+ }
2612
+ const paramName = this.extractPayloadPropertyParam(initializer);
2613
+ if (paramName !== null) {
2614
+ assignments.push({ field, value: `param:${paramName}` });
2615
+ }
2616
+ }
2617
+ extractPayloadPropertyParam(initializer) {
2618
+ if (!Node4.isPropertyAccessExpression(initializer))
2619
+ return null;
2620
+ const parts = this.getPropertyPath(initializer).split(".");
2621
+ if (parts.length !== 2)
2622
+ return null;
2623
+ const [paramName, fieldName] = parts;
2624
+ if (paramName === undefined || fieldName === undefined)
2625
+ return null;
2626
+ if (!this.currentFunctionParams.includes(paramName))
2627
+ return null;
2628
+ return fieldName;
2629
+ }
2607
2630
  extractElementAccessAssignment(left, right, assignments) {
2608
2631
  if (!Node4.isElementAccessExpression(left))
2609
2632
  return;
@@ -6212,4 +6235,4 @@ main().catch((_error) => {
6212
6235
  process.exit(1);
6213
6236
  });
6214
6237
 
6215
- //# debugId=84905818D609523864756E2164756E21
6238
+ //# debugId=ED3EBA8D328D579464756E2164756E21