modmex-lambda 0.7.3__tar.gz → 0.8.0__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 (273) hide show
  1. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/PKG-INFO +36 -1
  2. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/README.md +35 -0
  3. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/dynamodb.py +42 -1
  4. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/api_gateway.py +21 -4
  5. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/__init__.py +11 -1
  6. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/runner.py +23 -5
  7. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/base.py +3 -0
  8. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/dynamodb.py +4 -0
  9. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/kinesis.py +4 -0
  10. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/s3.py +4 -0
  11. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/sns.py +4 -0
  12. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/sqs.py +4 -0
  13. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/pyproject.toml +1 -1
  14. modmex_lambda-0.8.0/tests/connectors/test_dynamodb_regressions.py +52 -0
  15. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_api_gateway.py +24 -0
  16. modmex_lambda-0.8.0/tests/mcp/test_include_mcp_origins.py +29 -0
  17. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_runner.py +55 -8
  18. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/.github/workflows/ci.yml +0 -0
  19. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/.github/workflows/release.yml +0 -0
  20. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/.gitignore +0 -0
  21. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/LICENSE +0 -0
  22. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/__init__.py +0 -0
  23. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/__init__.py +0 -0
  24. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/cloudwatch.py +0 -0
  25. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/eventbridge.py +0 -0
  26. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/eventbridge_scheduler.py +0 -0
  27. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/icloudwatch.py +0 -0
  28. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/idynamodb.py +0 -0
  29. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/ieventbridge.py +0 -0
  30. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/ieventbridge_scheduler.py +0 -0
  31. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/ilambda.py +0 -0
  32. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/is3.py +0 -0
  33. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/isns.py +0 -0
  34. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/isqs.py +0 -0
  35. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/lambda_.py +0 -0
  36. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/module.py +0 -0
  37. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/s3.py +0 -0
  38. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/sns.py +0 -0
  39. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/connectors/sqs.py +0 -0
  40. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/__init__.py +0 -0
  41. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/api_gateway_authorizer_event.py +0 -0
  42. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/api_gateway_proxy_event.py +0 -0
  43. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/api_gateway_websocket_event.py +0 -0
  44. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/cognito_user_pool_event.py +0 -0
  45. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/data_classes/common.py +0 -0
  46. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/dependencies.py +0 -0
  47. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/__init__.py +0 -0
  48. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/constants.py +0 -0
  49. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/content_types.py +0 -0
  50. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/cors.py +0 -0
  51. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/__init__.py +0 -0
  52. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/compat.py +0 -0
  53. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/dependant.py +0 -0
  54. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/dependency_middleware.py +0 -0
  55. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/depends.py +0 -0
  56. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/params.py +0 -0
  57. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/dependencies/types.py +0 -0
  58. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/exception_handler.py +0 -0
  59. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/exceptions.py +0 -0
  60. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/gateway_response.py +0 -0
  61. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/middlewares.py +0 -0
  62. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/params.py +0 -0
  63. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/request.py +0 -0
  64. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/response.py +0 -0
  65. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/routing.py +0 -0
  66. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/routing_fallbacks.py +0 -0
  67. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_handler/types.py +0 -0
  68. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/event_sources.py +0 -0
  69. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/exceptions.py +0 -0
  70. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/logging.py +0 -0
  71. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/middleware.py +0 -0
  72. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/prompt.py +0 -0
  73. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/protocol.py +0 -0
  74. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/registry.py +0 -0
  75. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/resource.py +0 -0
  76. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/schema.py +0 -0
  77. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/server.py +0 -0
  78. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/tool.py +0 -0
  79. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/transport.py +0 -0
  80. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/web_adapter.py +0 -0
  81. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/mcp/web_adapter_launcher.py +0 -0
  82. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/params.py +0 -0
  83. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/parser.py +0 -0
  84. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/__init__.py +0 -0
  85. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/dynamodb/__init__.py +0 -0
  86. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/dynamodb/expressions.py +0 -0
  87. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/dynamodb/keys.py +0 -0
  88. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/dynamodb/materialized_views.py +0 -0
  89. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/persistence/dynamodb/stream_fields.py +0 -0
  90. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/py.typed +0 -0
  91. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/request.py +0 -0
  92. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/resolver.py +0 -0
  93. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/response.py +0 -0
  94. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/routing.py +0 -0
  95. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/shared/__init__.py +0 -0
  96. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/shared/cookies.py +0 -0
  97. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/shared/headers_serializer.py +0 -0
  98. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/shared/json_encoder.py +0 -0
  99. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/shared/types.py +0 -0
  100. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/__init__.py +0 -0
  101. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/__init__.py +0 -0
  102. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/dynamodb.py +0 -0
  103. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/kinesis.py +0 -0
  104. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/s3.py +0 -0
  105. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/sns.py +0 -0
  106. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/events/sqs.py +0 -0
  107. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/filters/__init__.py +0 -0
  108. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/filters/content.py +0 -0
  109. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/filters/event_type.py +0 -0
  110. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/filters/latch.py +0 -0
  111. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/filters/skip.py +0 -0
  112. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/__init__.py +0 -0
  113. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/base_flavor.py +0 -0
  114. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/cdc.py +0 -0
  115. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/collect.py +0 -0
  116. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/correlate.py +0 -0
  117. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/evaluate.py +0 -0
  118. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/expired.py +0 -0
  119. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/iflavor.py +0 -0
  120. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/job.py +0 -0
  121. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/materialize.py +0 -0
  122. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/s3.py +0 -0
  123. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/schedule.py +0 -0
  124. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/sns.py +0 -0
  125. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/task.py +0 -0
  126. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/flavors/update.py +0 -0
  127. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/irules_registry.py +0 -0
  128. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/__init__.py +0 -0
  129. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/cloudwatch.py +0 -0
  130. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/dynamodb.py +0 -0
  131. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/ioperator.py +0 -0
  132. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/lambda_.py +0 -0
  133. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/publisher.py +0 -0
  134. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/s3.py +0 -0
  135. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/scheduler.py +0 -0
  136. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/sns.py +0 -0
  137. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/operators/sqs.py +0 -0
  138. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/rules_registry.py +0 -0
  139. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/schedulers.py +0 -0
  140. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/sources/__init__.py +0 -0
  141. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/__init__.py +0 -0
  142. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/apigateway.py +0 -0
  143. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/aws.py +0 -0
  144. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/batch.py +0 -0
  145. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/cloudwatch.py +0 -0
  146. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/concurrency.py +0 -0
  147. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/contracts.py +0 -0
  148. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/data_classes/__init__.py +0 -0
  149. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/data_classes/dynamodb.py +0 -0
  150. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/decorators.py +0 -0
  151. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/dynamodb.py +0 -0
  152. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/eventbridge.py +0 -0
  153. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/faults.py +0 -0
  154. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/filters.py +0 -0
  155. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/json_encoder.py +0 -0
  156. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/lambda_.py +0 -0
  157. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/operators.py +0 -0
  158. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/pluralize.py +0 -0
  159. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/print.py +0 -0
  160. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/retry.py +0 -0
  161. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/s3.py +0 -0
  162. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/sns.py +0 -0
  163. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/split.py +0 -0
  164. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/sqs.py +0 -0
  165. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/tags.py +0 -0
  166. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/time.py +0 -0
  167. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/stream/utils/uow.py +0 -0
  168. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/tracing.py +0 -0
  169. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/modmex_lambda/validation.py +0 -0
  170. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/poetry.lock +0 -0
  171. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/__init__.py +0 -0
  172. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/conftest.py +0 -0
  173. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/__init__.py +0 -0
  174. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/conftest.py +0 -0
  175. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_cloudwatch.py +0 -0
  176. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_dynamodb.py +0 -0
  177. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_lazy_clients.py +0 -0
  178. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_s3.py +0 -0
  179. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_simple_connectors.py +0 -0
  180. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_sns.py +0 -0
  181. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/connectors/test_sqs.py +0 -0
  182. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/data_classes/__init__.py +0 -0
  183. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/data_classes/test_api_gateway_proxy_event.py +0 -0
  184. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/data_classes/test_cognito_user_pool_event.py +0 -0
  185. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/data_classes/test_common.py +0 -0
  186. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/__init__.py +0 -0
  187. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_cors.py +0 -0
  188. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_dependencies.py +0 -0
  189. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_exception_handler.py +0 -0
  190. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_gateway_response.py +0 -0
  191. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_request.py +0 -0
  192. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_response.py +0 -0
  193. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/event_handler/test_routing.py +0 -0
  194. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/__init__.py +0 -0
  195. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/helpers.py +0 -0
  196. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_http.py +0 -0
  197. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_middleware.py +0 -0
  198. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_resources_prompts.py +0 -0
  199. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_server.py +0 -0
  200. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_tools.py +0 -0
  201. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/mcp/test_transport.py +0 -0
  202. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/persistence/__init__.py +0 -0
  203. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/persistence/test_dynamodb_expressions.py +0 -0
  204. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/persistence/test_dynamodb_keys.py +0 -0
  205. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/persistence/test_dynamodb_materialized_views.py +0 -0
  206. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/persistence/test_dynamodb_stream_fields.py +0 -0
  207. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/shared/__init__.py +0 -0
  208. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/shared/test_cookies_headers.py +0 -0
  209. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/shared/test_json_encoder.py +0 -0
  210. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/__init__.py +0 -0
  211. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/conftest.py +0 -0
  212. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/__init__.py +0 -0
  213. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/test_dynamodb.py +0 -0
  214. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/test_kinesis.py +0 -0
  215. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/test_s3.py +0 -0
  216. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/test_sns.py +0 -0
  217. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/events/test_sqs.py +0 -0
  218. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/filters/__init__.py +0 -0
  219. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/filters/test_content.py +0 -0
  220. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/filters/test_event_type.py +0 -0
  221. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/filters/test_latch.py +0 -0
  222. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/filters/test_skip.py +0 -0
  223. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/__init__.py +0 -0
  224. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/source_events.py +0 -0
  225. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_base_flavor.py +0 -0
  226. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_cdc.py +0 -0
  227. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_collect.py +0 -0
  228. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_correlate.py +0 -0
  229. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_evaluate.py +0 -0
  230. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_expired.py +0 -0
  231. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_job.py +0 -0
  232. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_materialize.py +0 -0
  233. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_s3.py +0 -0
  234. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_schedule.py +0 -0
  235. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_sns.py +0 -0
  236. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_task.py +0 -0
  237. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/flavors/test_update.py +0 -0
  238. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/operators/test_scheduler.py +0 -0
  239. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_dependency_resolver.py +0 -0
  240. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_faults.py +0 -0
  241. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_rules_registry.py +0 -0
  242. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_runner_pipeline.py +0 -0
  243. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/test_sources.py +0 -0
  244. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/__init__.py +0 -0
  245. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/faults.py +0 -0
  246. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_apigateway.py +0 -0
  247. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_aws.py +0 -0
  248. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_batch.py +0 -0
  249. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_cloudwatch.py +0 -0
  250. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_concurrency.py +0 -0
  251. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_decorators.py +0 -0
  252. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_dynamodb.py +0 -0
  253. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_eventbridge.py +0 -0
  254. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_filters.py +0 -0
  255. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_json_encoder.py +0 -0
  256. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_lambda.py +0 -0
  257. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_operators.py +0 -0
  258. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_pluralize.py +0 -0
  259. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_print.py +0 -0
  260. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_retry.py +0 -0
  261. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_s3.py +0 -0
  262. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_sns.py +0 -0
  263. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_split.py +0 -0
  264. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_sqs.py +0 -0
  265. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_tags.py +0 -0
  266. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_time.py +0 -0
  267. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/stream/utils/test_uow.py +0 -0
  268. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_lazy_imports.py +0 -0
  269. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_logging.py +0 -0
  270. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_parser_event_sources.py +0 -0
  271. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_reexports.py +0 -0
  272. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_tracing.py +0 -0
  273. {modmex_lambda-0.7.3 → modmex_lambda-0.8.0}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: modmex-lambda
3
- Version: 0.7.3
3
+ Version: 0.8.0
4
4
  Summary: Ultra-lightweight AWS Lambda utilities for API Gateway routing and event handling.
5
5
  Author: Modmex
6
6
  License: MIT
@@ -474,6 +474,19 @@ def on_domain_error(exc: DomainError):
474
474
  If a custom exception handler raises, the resolver falls back to the default
475
475
  error response when one exists.
476
476
 
477
+ An exception with no handler is re-raised: the invocation fails, so Lambda's
478
+ `Errors` metric and alarms see it, and API Gateway answers with a generic 5xx.
479
+ That response carries no CORS headers, so a browser reports a CORS error instead
480
+ of the 500. If browsers call the API, register a catch-all handler, which gets
481
+ the route's CORS headers, and log the exception so it stays visible:
482
+
483
+ ```python
484
+ @app.exception_handler(Exception)
485
+ def on_unexpected(exc: Exception):
486
+ logger.exception("Unhandled error")
487
+ return Response(status_code=500, body={"message": "Internal server error"})
488
+ ```
489
+
477
490
  ## CORS
478
491
 
479
492
  Pass `CORSConfig` to the resolver to add CORS headers and automatic preflight
@@ -865,6 +878,23 @@ handler = KinesisSource(
865
878
 
866
879
  Use `concurrency=False` in tests when deterministic order matters.
867
880
 
881
+ Handled failures (steps wrapped with `faulty`) are published as `fault` events and
882
+ do not fail the invocation. An **unexpected** error that stops a pipeline (a bug,
883
+ an unwrapped step) is re-raised after every pipeline finished and pending faults
884
+ were flushed, so the Lambda invocation fails and AWS retries the batch: records
885
+ after the failure were never processed and must not be acknowledged. `on_error`
886
+ is still called first. Pass `raise_on_error=False` to a source (or `run`) only if
887
+ you deliberately want such errors reported through `on_error` alone.
888
+
889
+ Because a failing batch is retried, bound the retries on the event source so a
890
+ record that always fails (a poison pill) cannot block the stream:
891
+
892
+ - DynamoDB Streams / Kinesis: set `MaximumRetryAttempts`,
893
+ `BisectBatchOnFunctionError: true` (isolates the failing record) and an
894
+ on-failure destination (SQS/SNS) on the event source mapping. Otherwise the
895
+ shard retries until the record expires (24 h by default).
896
+ - SQS: configure a dead-letter queue (`maxReceiveCount` in the redrive policy).
897
+
868
898
  ### Publisher Options
869
899
 
870
900
  Flavors that publish to EventBridge use a shared publisher. Configure it with
@@ -1304,6 +1334,11 @@ app.include_mcp(mcp, path="/mcp")
1304
1334
  handler = app.handler
1305
1335
  ```
1306
1336
 
1337
+ Pass `allowed_origins=["https://app.example.com"]` to `include_mcp` to reject
1338
+ requests whose `Origin` header is not in the list (403). MCP asks servers to
1339
+ validate `Origin` against DNS-rebinding attacks; the default `None` leaves it to
1340
+ the infrastructure in front of the function, and `[]` denies every browser origin.
1341
+
1307
1342
  ### Choosing the resolver
1308
1343
 
1309
1344
  Choose the resolver from the AWS transport and whether the function must
@@ -451,6 +451,19 @@ def on_domain_error(exc: DomainError):
451
451
  If a custom exception handler raises, the resolver falls back to the default
452
452
  error response when one exists.
453
453
 
454
+ An exception with no handler is re-raised: the invocation fails, so Lambda's
455
+ `Errors` metric and alarms see it, and API Gateway answers with a generic 5xx.
456
+ That response carries no CORS headers, so a browser reports a CORS error instead
457
+ of the 500. If browsers call the API, register a catch-all handler, which gets
458
+ the route's CORS headers, and log the exception so it stays visible:
459
+
460
+ ```python
461
+ @app.exception_handler(Exception)
462
+ def on_unexpected(exc: Exception):
463
+ logger.exception("Unhandled error")
464
+ return Response(status_code=500, body={"message": "Internal server error"})
465
+ ```
466
+
454
467
  ## CORS
455
468
 
456
469
  Pass `CORSConfig` to the resolver to add CORS headers and automatic preflight
@@ -842,6 +855,23 @@ handler = KinesisSource(
842
855
 
843
856
  Use `concurrency=False` in tests when deterministic order matters.
844
857
 
858
+ Handled failures (steps wrapped with `faulty`) are published as `fault` events and
859
+ do not fail the invocation. An **unexpected** error that stops a pipeline (a bug,
860
+ an unwrapped step) is re-raised after every pipeline finished and pending faults
861
+ were flushed, so the Lambda invocation fails and AWS retries the batch: records
862
+ after the failure were never processed and must not be acknowledged. `on_error`
863
+ is still called first. Pass `raise_on_error=False` to a source (or `run`) only if
864
+ you deliberately want such errors reported through `on_error` alone.
865
+
866
+ Because a failing batch is retried, bound the retries on the event source so a
867
+ record that always fails (a poison pill) cannot block the stream:
868
+
869
+ - DynamoDB Streams / Kinesis: set `MaximumRetryAttempts`,
870
+ `BisectBatchOnFunctionError: true` (isolates the failing record) and an
871
+ on-failure destination (SQS/SNS) on the event source mapping. Otherwise the
872
+ shard retries until the record expires (24 h by default).
873
+ - SQS: configure a dead-letter queue (`maxReceiveCount` in the redrive policy).
874
+
845
875
  ### Publisher Options
846
876
 
847
877
  Flavors that publish to EventBridge use a shared publisher. Configure it with
@@ -1281,6 +1311,11 @@ app.include_mcp(mcp, path="/mcp")
1281
1311
  handler = app.handler
1282
1312
  ```
1283
1313
 
1314
+ Pass `allowed_origins=["https://app.example.com"]` to `include_mcp` to reject
1315
+ requests whose `Origin` header is not in the list (403). MCP asks servers to
1316
+ validate `Origin` against DNS-rebinding attacks; the default `None` leaves it to
1317
+ the infrastructure in front of the function, and `[]` denies every browser origin.
1318
+
1284
1319
  ### Choosing the resolver
1285
1320
 
1286
1321
  Choose the resolver from the AWS transport and whether the function must
@@ -68,6 +68,10 @@ class Connector(IDynamodbConnector):
68
68
  return self._unmarshall_response(response)
69
69
 
70
70
  def query_all(self, input_params):
71
+ # Paginate on a copy: callers often reuse a module-level params dict
72
+ # across warm invocations, and a leftover ExclusiveStartKey would make
73
+ # the next call silently start from the last page.
74
+ input_params = dict(input_params)
71
75
  items = []
72
76
  while True:
73
77
  result = self.query(input_params)
@@ -79,7 +83,19 @@ class Connector(IDynamodbConnector):
79
83
  return items
80
84
 
81
85
  def batch_get(self, input_params):
82
- return self._batch_get(input_params, [])
86
+ chunks = _batch_get_chunks(input_params)
87
+ if len(chunks) == 1:
88
+ return self._batch_get(chunks[0], [])
89
+ results = [self._batch_get(chunk, []) for chunk in chunks]
90
+ responses: dict = {}
91
+ for result in results:
92
+ for table, items in result.get('Responses', {}).items():
93
+ responses.setdefault(table, []).extend(items)
94
+ return {
95
+ **results[-1],
96
+ 'Responses': responses,
97
+ 'attempts': [attempt for result in results for attempt in result.get('attempts', [])],
98
+ }
83
99
 
84
100
  def _batch_get(self, params, attempts):
85
101
  assert_max_retries(attempts, self.retry_config['max_retries'])
@@ -255,6 +271,31 @@ class Connector(IDynamodbConnector):
255
271
  }
256
272
 
257
273
 
274
+ BATCH_GET_MAX_KEYS = 100 # DynamoDB BatchGetItem limit, across all tables
275
+
276
+
277
+ def _batch_get_chunks(params):
278
+ """Split a BatchGetItem request into requests of at most 100 keys in total."""
279
+ pairs = [
280
+ (table, key)
281
+ for table, request in params.get('RequestItems', {}).items()
282
+ for key in request.get('Keys', [])
283
+ ]
284
+ if len(pairs) <= BATCH_GET_MAX_KEYS:
285
+ return [params]
286
+ chunks = []
287
+ for start in range(0, len(pairs), BATCH_GET_MAX_KEYS):
288
+ request_items = {}
289
+ for table, key in pairs[start:start + BATCH_GET_MAX_KEYS]:
290
+ table_request = request_items.setdefault(
291
+ table,
292
+ {**params['RequestItems'][table], 'Keys': []},
293
+ )
294
+ table_request['Keys'].append(key)
295
+ chunks.append({**params, 'RequestItems': request_items})
296
+ return chunks
297
+
298
+
258
299
  def unprocessed(params, resp):
259
300
  return {
260
301
  **params,
@@ -171,15 +171,27 @@ class ApiGatewayResolver(BaseRouter, IApiGatewayResolver):
171
171
  def include_router(self, router: Router, prefix: str = "") -> None:
172
172
  self._router.include_router(router, prefix=prefix)
173
173
 
174
- def include_mcp(self, server: Any, *, path: str = "/mcp") -> None:
175
- """Mount a transport-neutral MCP server as a normal HTTP route."""
174
+ def include_mcp(
175
+ self,
176
+ server: Any,
177
+ *,
178
+ path: str = "/mcp",
179
+ allowed_origins: list[str] | None = None,
180
+ ) -> None:
181
+ """Mount a transport-neutral MCP server as a normal HTTP route.
182
+
183
+ ``allowed_origins`` is an allowlist for the ``Origin`` header (MCP asks
184
+ servers to validate it against DNS-rebinding attacks); ``None`` leaves the
185
+ policy to the infrastructure in front of the function, ``[]`` denies every
186
+ browser origin.
187
+ """
176
188
  from modmex_lambda.mcp import MCPServer
177
189
  from modmex_lambda.mcp.transport import MCPHttpTransport
178
190
 
179
191
  if not isinstance(server, MCPServer):
180
192
  raise TypeError("include_mcp expects an MCPServer")
181
193
 
182
- transport = MCPHttpTransport(server)
194
+ transport = MCPHttpTransport(server, allowed_origins=allowed_origins)
183
195
 
184
196
  @self.route(path, method="POST", status_code=200)
185
197
  def mcp_handler(request: Request) -> Response:
@@ -252,7 +264,12 @@ class ApiGatewayResolver(BaseRouter, IApiGatewayResolver):
252
264
  return path[len(prefix) :]
253
265
 
254
266
  if isinstance(prefix, Pattern):
255
- path = re.sub(prefix, "", path)
267
+ # A prefix only strips the start of the path. re.sub removed every
268
+ # match, so "/v\d+" turned "/v1/users/7/v2/x" into "/users/7/x"
269
+ # and routed the request to a different handler.
270
+ match = prefix.match(path)
271
+ if match is not None and match.end() > 0:
272
+ path = path[match.end():]
256
273
 
257
274
  if not path:
258
275
  return "/"
@@ -13,7 +13,6 @@ from modmex_lambda.mcp.resource import MCPResource
13
13
  from modmex_lambda.mcp.prompt import MCPPrompt
14
14
  from modmex_lambda.mcp.transport import MCPHttpTransport, MCPStreamingHttpTransport, StreamingHTTPResponse, SSEEvent, encode_sse, encode_sse_stream, MCP_JSON_CONTENT_TYPE, MCP_SSE_CONTENT_TYPE
15
15
  from modmex_lambda.mcp.middleware import MCPContext, MCPMiddleware, MCPNextMiddleware, MCPProgressReporter, MCPCancellationToken
16
- from modmex_lambda.mcp.web_adapter import LambdaWebAdapterResolver
17
16
 
18
17
  __all__ = [
19
18
  "JSONRPCError",
@@ -41,3 +40,14 @@ __all__ = [
41
40
  "MCPCancellationToken",
42
41
  "LambdaWebAdapterResolver",
43
42
  ]
43
+
44
+
45
+ def __getattr__(name):
46
+ # LambdaWebAdapterResolver pulls in http.server and is only needed with the
47
+ # Lambda Web Adapter; load it on first access, not with every MCP import.
48
+ if name == "LambdaWebAdapterResolver":
49
+ from modmex_lambda.mcp.web_adapter import LambdaWebAdapterResolver
50
+
51
+ globals()[name] = LambdaWebAdapterResolver
52
+ return LambdaWebAdapterResolver
53
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -39,7 +39,19 @@ def run(
39
39
  on_completed=None,
40
40
  concurrency=True,
41
41
  on_fault: FaultHandler | None = None,
42
+ raise_on_error: bool = True,
42
43
  ):
44
+ """Run every registered pipeline over ``events``.
45
+
46
+ Handled failures (wrapped with ``faulty``) are published as fault events and
47
+ do not fail the invocation. An unexpected error that ends a pipeline is
48
+ re-raised once all pipelines finished and faults were flushed, so the Lambda
49
+ invocation fails and AWS retries the batch instead of acknowledging records
50
+ that were never processed. ``on_error`` is still called first (observability).
51
+ Pass ``raise_on_error=False`` to only report such errors through ``on_error``.
52
+ """
53
+ pipeline_errors: list[BaseException] = []
54
+ token: Token = active_fault_handler.set(on_fault)
43
55
  try:
44
56
  opt = {
45
57
  'bus_name': os.getenv('BUS_NAME'),
@@ -51,8 +63,6 @@ def run(
51
63
  pipeline_logger = opt.get('logger') or Logger()
52
64
 
53
65
 
54
- token: Token = active_fault_handler.set(on_fault)
55
-
56
66
  def make_lines(flavor):
57
67
  source = from_list( # pylint: disable=E1102
58
68
  copy.deepcopy(events)
@@ -88,9 +98,12 @@ def run(
88
98
  on_next(pipeline_id, uow)
89
99
 
90
100
  def _on_error(pipeline_id, err):
91
- if on_error:
92
- on_error(pipeline_id, err)
93
- mark_completed()
101
+ pipeline_errors.append(err)
102
+ try:
103
+ if on_error:
104
+ on_error(pipeline_id, err)
105
+ finally:
106
+ mark_completed()
94
107
 
95
108
  def _on_completed(pipeline_id):
96
109
  if on_completed:
@@ -117,3 +130,8 @@ def run(
117
130
 
118
131
  finally:
119
132
  active_fault_handler.reset(token)
133
+
134
+ if pipeline_errors and raise_on_error:
135
+ for extra in pipeline_errors[1:]:
136
+ pipeline_logger.error(f"Additional pipeline error: {extra!r}")
137
+ raise pipeline_errors[0]
@@ -23,6 +23,7 @@ class SourceHandler(Generic[S, E]):
23
23
  on_error: Optional[Callable] = None,
24
24
  on_completed: Optional[Callable] = None,
25
25
  on_fault: Optional[Callable] = None,
26
+ raise_on_error: bool = True,
26
27
  logger: Optional[object] = None,
27
28
  dependency_resolver: Optional[DependencyResolver] = None,
28
29
  ) -> None:
@@ -33,6 +34,7 @@ class SourceHandler(Generic[S, E]):
33
34
  self.on_error = on_error
34
35
  self.on_completed = on_completed
35
36
  self.on_fault = on_fault
37
+ self.raise_on_error = raise_on_error
36
38
  self.logger = logger or Logger()
37
39
  self.dependency_resolver = dependency_resolver or default_dependency_resolver()
38
40
  self.registry.bind(self.dependency_resolver)
@@ -60,4 +62,5 @@ class SourceHandler(Generic[S, E]):
60
62
  on_completed=self.on_completed,
61
63
  concurrency=self.concurrency,
62
64
  on_fault=self.on_fault,
65
+ raise_on_error=self.raise_on_error,
63
66
  )
@@ -25,6 +25,7 @@ class DynamoDBSource(SourceHandler[DynamoDBStreamEvent, DynamoDBEvent]):
25
25
  on_error: Optional[Callable] = None,
26
26
  on_completed: Optional[Callable] = None,
27
27
  on_fault: Optional[Callable] = None,
28
+ raise_on_error: bool = True,
28
29
  logger: Optional[object] = None,
29
30
  dependency_resolver: Optional[DependencyResolver] = None,
30
31
  parser_options: Optional[DynamodbParserOptions] = None,
@@ -45,6 +46,7 @@ class DynamoDBSource(SourceHandler[DynamoDBStreamEvent, DynamoDBEvent]):
45
46
  on_error=on_error,
46
47
  on_completed=on_completed,
47
48
  on_fault=on_fault,
49
+ raise_on_error=raise_on_error,
48
50
  logger=logger,
49
51
  dependency_resolver=dependency_resolver,
50
52
  )
@@ -58,6 +60,7 @@ def dynamodb_source(
58
60
  on_error: Optional[Callable] = None,
59
61
  on_completed: Optional[Callable] = None,
60
62
  on_fault: Optional[Callable] = None,
63
+ raise_on_error: bool = True,
61
64
  logger: Optional[object] = None,
62
65
  dependency_resolver: Optional[DependencyResolver] = None,
63
66
  parser_options: Optional[DynamodbParserOptions] = None,
@@ -69,6 +72,7 @@ def dynamodb_source(
69
72
  on_error=on_error,
70
73
  on_completed=on_completed,
71
74
  on_fault=on_fault,
75
+ raise_on_error=raise_on_error,
72
76
  logger=logger,
73
77
  dependency_resolver=dependency_resolver,
74
78
  parser_options=parser_options,
@@ -16,6 +16,7 @@ class KinesisSource(SourceHandler):
16
16
  on_error: Optional[Callable] = None,
17
17
  on_completed: Optional[Callable] = None,
18
18
  on_fault: Optional[Callable] = None,
19
+ raise_on_error: bool = True,
19
20
  logger: Optional[object] = None,
20
21
  dependency_resolver: Optional[DependencyResolver] = None,
21
22
  ) -> None:
@@ -27,6 +28,7 @@ class KinesisSource(SourceHandler):
27
28
  on_error=on_error,
28
29
  on_completed=on_completed,
29
30
  on_fault=on_fault,
31
+ raise_on_error=raise_on_error,
30
32
  logger=logger,
31
33
  dependency_resolver=dependency_resolver,
32
34
  )
@@ -40,6 +42,7 @@ def kinesis_source(
40
42
  on_error: Optional[Callable] = None,
41
43
  on_completed: Optional[Callable] = None,
42
44
  on_fault: Optional[Callable] = None,
45
+ raise_on_error: bool = True,
43
46
  logger: Optional[object] = None,
44
47
  dependency_resolver: Optional[DependencyResolver] = None,
45
48
  ):
@@ -50,6 +53,7 @@ def kinesis_source(
50
53
  on_error=on_error,
51
54
  on_completed=on_completed,
52
55
  on_fault=on_fault,
56
+ raise_on_error=raise_on_error,
53
57
  logger=logger,
54
58
  dependency_resolver=dependency_resolver,
55
59
  )
@@ -20,6 +20,7 @@ class S3Source(SourceHandler):
20
20
  on_error: Optional[Callable] = None,
21
21
  on_completed: Optional[Callable] = None,
22
22
  on_fault: Optional[Callable] = None,
23
+ raise_on_error: bool = True,
23
24
  logger: Optional[object] = None,
24
25
  dependency_resolver: Optional[DependencyResolver] = None,
25
26
  ) -> None:
@@ -31,6 +32,7 @@ class S3Source(SourceHandler):
31
32
  on_error=on_error,
32
33
  on_completed=on_completed,
33
34
  on_fault=on_fault,
35
+ raise_on_error=raise_on_error,
34
36
  logger=logger,
35
37
  dependency_resolver=dependency_resolver,
36
38
  )
@@ -56,6 +58,7 @@ def s3_source(
56
58
  on_error: Optional[Callable] = None,
57
59
  on_completed: Optional[Callable] = None,
58
60
  on_fault: Optional[Callable] = None,
61
+ raise_on_error: bool = True,
59
62
  logger: Optional[object] = None,
60
63
  dependency_resolver: Optional[DependencyResolver] = None,
61
64
  ):
@@ -66,6 +69,7 @@ def s3_source(
66
69
  on_error=on_error,
67
70
  on_completed=on_completed,
68
71
  on_fault=on_fault,
72
+ raise_on_error=raise_on_error,
69
73
  logger=logger,
70
74
  dependency_resolver=dependency_resolver,
71
75
  )
@@ -16,6 +16,7 @@ class SnsSource(SourceHandler):
16
16
  on_error: Optional[Callable] = None,
17
17
  on_completed: Optional[Callable] = None,
18
18
  on_fault: Optional[Callable] = None,
19
+ raise_on_error: bool = True,
19
20
  logger: Optional[object] = None,
20
21
  dependency_resolver: Optional[DependencyResolver] = None,
21
22
  ) -> None:
@@ -27,6 +28,7 @@ class SnsSource(SourceHandler):
27
28
  on_error=on_error,
28
29
  on_completed=on_completed,
29
30
  on_fault=on_fault,
31
+ raise_on_error=raise_on_error,
30
32
  logger=logger,
31
33
  dependency_resolver=dependency_resolver,
32
34
  )
@@ -40,6 +42,7 @@ def sns_source(
40
42
  on_error: Optional[Callable] = None,
41
43
  on_completed: Optional[Callable] = None,
42
44
  on_fault: Optional[Callable] = None,
45
+ raise_on_error: bool = True,
43
46
  logger: Optional[object] = None,
44
47
  dependency_resolver: Optional[DependencyResolver] = None,
45
48
  ):
@@ -50,6 +53,7 @@ def sns_source(
50
53
  on_error=on_error,
51
54
  on_completed=on_completed,
52
55
  on_fault=on_fault,
56
+ raise_on_error=raise_on_error,
53
57
  logger=logger,
54
58
  dependency_resolver=dependency_resolver,
55
59
  )
@@ -16,6 +16,7 @@ class SqsSource(SourceHandler):
16
16
  on_error: Optional[Callable] = None,
17
17
  on_completed: Optional[Callable] = None,
18
18
  on_fault: Optional[Callable] = None,
19
+ raise_on_error: bool = True,
19
20
  logger: Optional[object] = None,
20
21
  dependency_resolver: Optional[DependencyResolver] = None,
21
22
  ) -> None:
@@ -27,6 +28,7 @@ class SqsSource(SourceHandler):
27
28
  on_error=on_error,
28
29
  on_completed=on_completed,
29
30
  on_fault=on_fault,
31
+ raise_on_error=raise_on_error,
30
32
  logger=logger,
31
33
  dependency_resolver=dependency_resolver,
32
34
  )
@@ -40,6 +42,7 @@ def sqs_source(
40
42
  on_error: Optional[Callable] = None,
41
43
  on_completed: Optional[Callable] = None,
42
44
  on_fault: Optional[Callable] = None,
45
+ raise_on_error: bool = True,
43
46
  logger: Optional[object] = None,
44
47
  dependency_resolver: Optional[DependencyResolver] = None,
45
48
  ):
@@ -50,6 +53,7 @@ def sqs_source(
50
53
  on_error=on_error,
51
54
  on_completed=on_completed,
52
55
  on_fault=on_fault,
56
+ raise_on_error=raise_on_error,
53
57
  logger=logger,
54
58
  dependency_resolver=dependency_resolver,
55
59
  )
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "modmex-lambda"
7
- version = "0.7.3"
7
+ version = "0.8.0"
8
8
  description = "Ultra-lightweight AWS Lambda utilities for API Gateway routing and event handling."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10,<4.0"
@@ -0,0 +1,52 @@
1
+ from boto3.dynamodb.types import TypeSerializer
2
+
3
+ from modmex_lambda.connectors.dynamodb import Connector
4
+
5
+ _serializer = TypeSerializer()
6
+
7
+
8
+ def _marshall(item):
9
+ return {key: _serializer.serialize(value) for key, value in item.items()}
10
+
11
+
12
+ class PagedClient:
13
+ pages = [[{"pk": "a"}], [{"pk": "b"}], [{"pk": "c"}]]
14
+
15
+ def query(self, **kwargs):
16
+ start = kwargs.get("ExclusiveStartKey")
17
+ index = 0 if start is None else int(start["n"]["N"]) + 1
18
+ response = {"Items": [_marshall(item) for item in self.pages[index]]}
19
+ if index < len(self.pages) - 1:
20
+ response["LastEvaluatedKey"] = _marshall({"n": index})
21
+ return response
22
+
23
+
24
+ def test_query_all_does_not_mutate_reused_params():
25
+ connector = Connector(table_name="t", client=PagedClient())
26
+ query = {"KeyConditionExpression": "pk = :p"} # e.g. a module-level template
27
+ assert [item["pk"] for item in connector.query_all(query)] == ["a", "b", "c"]
28
+ assert [item["pk"] for item in connector.query_all(query)] == ["a", "b", "c"]
29
+ assert query == {"KeyConditionExpression": "pk = :p"}
30
+
31
+
32
+ class BatchClient:
33
+ def __init__(self):
34
+ self.sizes = []
35
+
36
+ def batch_get_item(self, **kwargs):
37
+ keys = [key for request in kwargs["RequestItems"].values() for key in request["Keys"]]
38
+ self.sizes.append(len(keys))
39
+ assert len(keys) <= 100, "DynamoDB rejects more than 100 keys"
40
+ return {
41
+ "Responses": {table: request["Keys"] for table, request in kwargs["RequestItems"].items()},
42
+ "UnprocessedKeys": {},
43
+ }
44
+
45
+
46
+ def test_batch_get_splits_requests_over_100_keys():
47
+ client = BatchClient()
48
+ connector = Connector(table_name="t", client=client)
49
+ keys = [{"pk": f"k{i}"} for i in range(150)]
50
+ result = connector.batch_get({"RequestItems": {"t": {"Keys": keys, "ConsistentRead": True}}})
51
+ assert client.sizes == [100, 50]
52
+ assert sorted(item["pk"] for item in result["Responses"]["t"]) == sorted(f"k{i}" for i in range(150))
@@ -767,3 +767,27 @@ def test_cache_control_and_gzip_compression() -> None:
767
767
  assert response["headers"]["Content-Encoding"] == "gzip"
768
768
  assert response["isBase64Encoded"] is True
769
769
  assert json.loads(gzip.decompress(base64.b64decode(response["body"]))) == {"message": "hello"}
770
+
771
+
772
+ def test_regex_strip_prefix_only_strips_the_start_of_the_path():
773
+ import re
774
+
775
+ from modmex_lambda import APIGatewayRestResolver
776
+
777
+ app = APIGatewayRestResolver(strip_prefixes=[re.compile(r"/v\d+")])
778
+
779
+ @app.get("/users/<uid>/v2/settings")
780
+ def versioned_settings(uid):
781
+ return {"handler": "versioned", "uid": uid}
782
+
783
+ @app.get("/users/<uid>/settings")
784
+ def plain_settings(uid):
785
+ return {"handler": "plain", "uid": uid}
786
+
787
+ event = {
788
+ "httpMethod": "GET", "path": "/v1/users/7/v2/settings", "resource": "/{proxy+}",
789
+ "headers": {}, "requestContext": {"stage": "prod"},
790
+ "queryStringParameters": None, "body": None, "isBase64Encoded": False,
791
+ }
792
+ assert app.resolve(event, None)["body"] == '{"handler":"versioned","uid":"7"}'
793
+ assert app.resolve({**event, "path": "/v1"}, None)["statusCode"] == 404 # stripped to "/"
@@ -0,0 +1,29 @@
1
+ import subprocess
2
+ import sys
3
+
4
+ from modmex_lambda import APIGatewayHttpResolver
5
+ from modmex_lambda.mcp import MCPServer
6
+ from tests.conftest import http_v2_event
7
+ from tests.mcp.helpers import modern
8
+
9
+
10
+ def _event(origin):
11
+ headers = {"Accept": "application/json, text/event-stream", "MCP-Protocol-Version": "2026-07-28", "Mcp-Method": "server/discover"}
12
+ if origin:
13
+ headers["Origin"] = origin
14
+ return http_v2_event("POST", "/mcp", headers=headers, body=modern("server/discover"))
15
+
16
+
17
+ def test_include_mcp_enforces_allowed_origins():
18
+ app = APIGatewayHttpResolver()
19
+ app.include_mcp(MCPServer(name="t"), allowed_origins=["https://app.example.com"])
20
+ assert app.resolve(_event("https://evil.example"), None)["statusCode"] == 403
21
+ assert app.resolve(_event("https://app.example.com"), None)["statusCode"] == 200
22
+
23
+
24
+ def test_mcp_import_does_not_load_the_web_adapter():
25
+ code = "import sys, modmex_lambda.mcp; print('modmex_lambda.mcp.web_adapter' in sys.modules, 'http.server' in sys.modules)"
26
+ out = subprocess.run([sys.executable, "-c", code], capture_output=True, text=True, check=True).stdout.split()
27
+ assert out == ["False", "False"]
28
+ from modmex_lambda.mcp import LambdaWebAdapterResolver # still importable on demand
29
+ assert LambdaWebAdapterResolver.__name__ == "LambdaWebAdapterResolver"