(ctx context.Context, body []byte, headers http.Header, node models.CanvasNode, onNewEvents func([]models.CanvasEvent))
| 1225 | } |
| 1226 | |
| 1227 | func (s *Server) executeTriggerNode(ctx context.Context, body []byte, headers http.Header, node models.CanvasNode, onNewEvents func([]models.CanvasEvent)) (int, *core.WebhookResponseBody, error) { |
| 1228 | ref := node.Ref.Data() |
| 1229 | trigger, err := s.registry.GetTrigger(ref.Trigger.Name) |
| 1230 | if err != nil { |
| 1231 | return http.StatusInternalServerError, nil, fmt.Errorf("trigger not found: %w", err) |
| 1232 | } |
| 1233 | |
| 1234 | logger := logging.ForNode(node) |
| 1235 | tx := database.Conn() |
| 1236 | var integrationCtx core.IntegrationContext |
| 1237 | if node.AppInstallationID != nil { |
| 1238 | integration, integrationErr := models.FindUnscopedIntegrationInTransaction(tx, *node.AppInstallationID) |
| 1239 | if integrationErr != nil { |
| 1240 | return http.StatusInternalServerError, nil, integrationErr |
| 1241 | } |
| 1242 | |
| 1243 | logger = logging.WithIntegration(logger, *integration) |
| 1244 | integrationCtx = contexts.NewIntegrationContext(tx, &node, integration, s.encryptor, s.registry, onNewEvents) |
| 1245 | } |
| 1246 | |
| 1247 | return trigger.HandleWebhook(core.WebhookRequestContext{ |
| 1248 | Body: body, |
| 1249 | Headers: headers, |
| 1250 | WorkflowID: node.WorkflowID.String(), |
| 1251 | NodeID: node.NodeID, |
| 1252 | Configuration: node.Configuration.Data(), |
| 1253 | Metadata: contexts.NewNodeMetadataContext(tx, &node), |
| 1254 | Logger: logger, |
| 1255 | HTTP: s.registry.HTTPContext(), |
| 1256 | Webhook: contexts.NewNodeWebhookContext(ctx, tx, s.encryptor, &node, s.BaseURL+s.BasePath), |
| 1257 | Events: contexts.NewEventContext(tx, &node, onNewEvents), |
| 1258 | Integration: integrationCtx, |
| 1259 | }) |
| 1260 | } |
| 1261 | |
| 1262 | func (s *Server) executeActionNode(ctx context.Context, body []byte, headers http.Header, node models.CanvasNode, onNewEvents func([]models.CanvasEvent), recordExecution func(workflowID, executionID uuid.UUID)) (int, *core.WebhookResponseBody, error) { |
| 1263 | ref := node.Ref.Data() |
no test coverage detected