async-lambda-unstable 0.6.1__tar.gz → 0.6.2__tar.gz

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.
Files changed (30) hide show
  1. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/PKG-INFO +1 -1
  2. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/__init__.py +1 -1
  3. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/controller.py +49 -7
  4. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/.gitignore +0 -0
  5. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/README.md +0 -0
  6. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/build_config.py +0 -0
  7. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/cli.py +0 -0
  8. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/client.py +0 -0
  9. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/config.py +0 -0
  10. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/defer.py +0 -0
  11. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/env.py +0 -0
  12. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/middleware.py +0 -0
  13. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/__init__.py +0 -0
  14. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/api_response.py +0 -0
  15. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/case_insensitive_dict.py +0 -0
  16. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/__init__.py +0 -0
  17. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/api_event.py +0 -0
  18. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/base_event.py +0 -0
  19. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/dynamodb_event.py +0 -0
  20. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/managed_sqs_batch_event.py +0 -0
  21. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/managed_sqs_event.py +0 -0
  22. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/scheduled_event.py +0 -0
  23. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/events/unmanaged_sqs_event.py +0 -0
  24. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/mock/mock_context.py +0 -0
  25. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/mock/mock_event.py +0 -0
  26. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/models/task.py +0 -0
  27. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/payload_encoder.py +0 -0
  28. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/py.typed +0 -0
  29. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/async_lambda/util.py +0 -0
  30. {async_lambda_unstable-0.6.1 → async_lambda_unstable-0.6.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: async-lambda-unstable
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: A framework for creating AWS Lambda Async Workflows. - Unstable Branch
5
5
  Author-email: "Nuclei, Inc" <engineering@nuclei.ai>
6
6
  Requires-Dist: click>=8.0.0
@@ -21,4 +21,4 @@ from .models.events.managed_sqs_event import ManagedSQSEvent as ManagedSQSEvent
21
21
  from .models.events.scheduled_event import ScheduledEvent as ScheduledEvent
22
22
  from .models.events.unmanaged_sqs_event import UnmanagedSQSEvent as UnmanagedSQSEvent
23
23
 
24
- __version__ = "0.6.1"
24
+ __version__ = "0.6.2"
@@ -814,6 +814,7 @@ class AsyncLambdaController:
814
814
  destination_task_id: str,
815
815
  sqs_payloads: Sequence[dict],
816
816
  delay: Union[int, Sequence[int]] = 0,
817
+ message_group_id: Union[Optional[str], Sequence[Optional[str]]] = None,
817
818
  force_sync: bool = False,
818
819
  lane: Optional[int] = None,
819
820
  index: int = 0,
@@ -899,8 +900,28 @@ class AsyncLambdaController:
899
900
  time.sleep(delay[i])
900
901
  else:
901
902
  time.sleep(delay)
903
+
904
+ _message_group_id = (
905
+ message_group_id[i]
906
+ if isinstance(message_group_id, Sequence)
907
+ and not isinstance(message_group_id, str)
908
+ else message_group_id
909
+ )
910
+ if (
911
+ _message_group_id is None
912
+ and (
913
+ current_message_group_id := self.get_current_message_group_id()
914
+ )
915
+ is not None
916
+ and self.should_propagate_message_group_id()
917
+ ):
918
+ _message_group_id = current_message_group_id
919
+
920
+ current_message_group_id = self.get_current_message_group_id()
902
921
  mock_event = MockSQSLambdaEvent(
903
- json.dumps(sqs_payload), source_queue_arn=queue_arn
922
+ json.dumps(sqs_payload),
923
+ source_queue_arn=queue_arn,
924
+ message_group_id=_message_group_id,
904
925
  )
905
926
  mock_context = MockLambdaContext(destination_task.task_id)
906
927
  self.handle_invocation(
@@ -908,6 +929,7 @@ class AsyncLambdaController:
908
929
  )
909
930
  self.set_current_lane(current_lane)
910
931
  self.set_current_task_id(current_task_id)
932
+ self.set_current_message_group_id(current_message_group_id)
911
933
  else:
912
934
  entries: List[dict] = []
913
935
  for i, sqs_payload in enumerate(sqs_payloads):
@@ -915,13 +937,31 @@ class AsyncLambdaController:
915
937
  _delay = delay[i]
916
938
  else:
917
939
  _delay = delay
918
- entries.append(
919
- {
920
- "MessageBody": json.dumps(sqs_payload),
921
- "DelaySeconds": _delay,
922
- "Id": f"index_{index + i}",
923
- }
940
+
941
+ _message_group_id = (
942
+ message_group_id[i]
943
+ if isinstance(message_group_id, Sequence)
944
+ and not isinstance(message_group_id, str)
945
+ else message_group_id
924
946
  )
947
+ if (
948
+ _message_group_id is None
949
+ and (
950
+ current_message_group_id := self.get_current_message_group_id()
951
+ )
952
+ is not None
953
+ and self.should_propagate_message_group_id()
954
+ ):
955
+ _message_group_id = current_message_group_id
956
+
957
+ entry = {
958
+ "MessageBody": json.dumps(sqs_payload),
959
+ "DelaySeconds": _delay,
960
+ "Id": f"index_{index + i}",
961
+ }
962
+ if _message_group_id:
963
+ entry["MessageGroupId"] = _message_group_id
964
+ entries.append(entry)
925
965
  if is_external_task:
926
966
  url = f"https://sqs.{env.get_aws_region()}.amazonaws.com/{env.get_aws_account_id()}/{destination_task_id}"
927
967
  else:
@@ -1088,6 +1128,7 @@ class AsyncLambdaController:
1088
1128
  task_id: str,
1089
1129
  payloads: Sequence[Any],
1090
1130
  delay: Union[int, Sequence[int]] = 0,
1131
+ message_group_id: Union[Optional[str], Sequence[Optional[str]]] = None,
1091
1132
  force_sync: bool = False,
1092
1133
  lane: Optional[int] = None,
1093
1134
  ):
@@ -1120,6 +1161,7 @@ class AsyncLambdaController:
1120
1161
  destination_task_id=task_id,
1121
1162
  sqs_payloads=sqs_payloads,
1122
1163
  delay=delay,
1164
+ message_group_id=message_group_id,
1123
1165
  force_sync=force_sync,
1124
1166
  lane=lane,
1125
1167
  index=i,