From 57d29ee601c7e6995c5ffe0c69c85609111bc742 Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Mon, 17 Jul 2023 17:22:43 -0700 Subject: [PATCH] Expose update interceptor input (#1166) --- interceptor/interceptor.go | 6 ++++++ internal/interceptor.go | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/interceptor/interceptor.go b/interceptor/interceptor.go index 949d86aaa..e1f4ee13e 100644 --- a/interceptor/interceptor.go +++ b/interceptor/interceptor.go @@ -125,6 +125,12 @@ type HandleSignalInput = internal.HandleSignalInput // HandleQueryInput is input for WorkflowInboundInterceptor.HandleQuery. type HandleQueryInput = internal.HandleQueryInput +// UpdateInput is input for WorkflowInboundInterceptor.ExecuteUpdate +// and WorkflowInboundInterceptor.ValidateUpdate. +// +// NOTE: Experimental +type UpdateInput = internal.UpdateInput + // WorkflowOutboundInterceptor is an interface for all workflow calls // originating from the SDK. // diff --git a/internal/interceptor.go b/internal/interceptor.go index aa572c025..e48dc0af6 100644 --- a/internal/interceptor.go +++ b/internal/interceptor.go @@ -127,12 +127,16 @@ type WorkflowInboundInterceptor interface { // as part of its optional configuration. The same prohibition against // mutating workflow state that is demanded of UpdateOptions.Validator // functions also applies to this function. + // + // NOTE: Experimental ValidateUpdate(ctx Context, in *UpdateInput) error // ExecuteUpdate is called after ValidateUpdate if and only if the latter // returns nil. interceptor.WorkflowHeader will return a non-nil map for // this context. ExecuteUpdate is allowed to mutate workflow state and // perform workflow actions such as scheduling activities, timers, etc. + // + // NOTE: Experimental ExecuteUpdate(ctx Context, in *UpdateInput) (interface{}, error) mustEmbedWorkflowInboundInterceptorBase()