langchain-trigger-server 0.1.7__tar.gz → 0.1.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langchain-trigger-server
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Generic event-driven triggers framework
5
5
  Project-URL: Homepage, https://github.com/langchain-ai/open-agent-platform
6
6
  Project-URL: Repository, https://github.com/langchain-ai/open-agent-platform
@@ -438,12 +438,13 @@ class TriggerServer:
438
438
  """Handle an incoming request with a handler function."""
439
439
  try:
440
440
  # Step 1: API Key Authentication (required for webhooks)
441
- api_key = request.headers.get("x-api-key")
441
+ # Check for API key in header first, then query params (for Pub/Sub compatibility)
442
+ api_key = request.headers.get("x-api-key") or request.query_params.get("api_key")
442
443
  if not api_key:
443
- logger.warning("Webhook request missing x-api-key header")
444
+ logger.warning("Webhook request missing x-api-key header or api_key query parameter")
444
445
  raise HTTPException(
445
446
  status_code=401,
446
- detail="Missing x-api-key header"
447
+ detail="Missing x-api-key header or api_key query parameter"
447
448
  )
448
449
 
449
450
  # Validate API key and get user_id
@@ -473,8 +474,8 @@ class TriggerServer:
473
474
  detail=f"Trigger {trigger.id} missing required registration_resolver"
474
475
  )
475
476
 
476
- # Extract resource identifiers from webhook payload
477
- resource_data = await trigger.registration_resolver(payload)
477
+ # Extract resource identifiers using resolver (gets both query params and payload)
478
+ resource_data = await trigger.registration_resolver(payload, dict(request.query_params))
478
479
 
479
480
  # Find matching registration for the authenticated user
480
481
  # Convert Pydantic model to dict for database lookup
@@ -486,10 +487,10 @@ class TriggerServer:
486
487
  )
487
488
 
488
489
  if not registration:
489
- logger.warning(f"No registration found for user {user_id}, trigger_id={trigger.id} with resource={resource_data}")
490
+ logger.warning(f"No registration found for user {user_id}, trigger_id={trigger.id} with resource={resource_dict}")
490
491
  raise HTTPException(
491
492
  status_code=400,
492
- detail=f"No registration found for {trigger.id} with resource {resource_data}"
493
+ detail=f"No registration found for {trigger.id} with resource {resource_dict}"
493
494
  )
494
495
 
495
496
  # Step 3: Inject OAuth tokens if needed
@@ -42,8 +42,8 @@ class TriggerTemplate:
42
42
  # Expected: async def handler(payload: Dict[str, Any], auth_user: UserAuthInfo, metadata: MetadataManager) -> TriggerHandlerResult
43
43
  self._validate_handler("trigger_handler", self.trigger_handler, [Dict[str, Any], UserAuthInfo, MetadataManager], TriggerHandlerResult)
44
44
 
45
- # Expected: async def resolver(payload: Dict[str, Any]) -> RegistrationModel
46
- self._validate_handler("registration_resolver", self.registration_resolver, [Dict[str, Any]], self.registration_model)
45
+ # Expected: async def resolver(payload: Dict[str, Any], query_params: Dict[str, str]) -> RegistrationModel
46
+ self._validate_handler("registration_resolver", self.registration_resolver, [Dict[str, Any], Dict[str, str]], self.registration_model)
47
47
 
48
48
  def _validate_handler(self, handler_name: str, handler_func, expected_types: List[Type], expected_return_type: Type = None):
49
49
  """Common validation logic for all handler functions."""
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "langchain-trigger-server"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Generic event-driven triggers framework"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"