MCPcopy
hub / github.com/superplanehq/superplane / executeTriggerNode

Method executeTriggerNode

pkg/public/server.go:1227–1260  ·  view source on GitHub ↗
(ctx context.Context, body []byte, headers http.Header, node models.CanvasNode, onNewEvents func([]models.CanvasEvent))

Source from the content-addressed store, hash-verified

1225}
1226
1227func (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
1262func (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()

Callers 1

executeWebhookNodeMethod · 0.95

Calls 14

ForNodeFunction · 0.92
ConnFunction · 0.92
WithIntegrationFunction · 0.92
NewIntegrationContextFunction · 0.92
NewNodeMetadataContextFunction · 0.92
NewNodeWebhookContextFunction · 0.92
NewEventContextFunction · 0.92
ErrorfMethod · 0.80
HTTPContextMethod · 0.80
DataMethod · 0.65
HandleWebhookMethod · 0.65

Tested by

no test coverage detected