sdk

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

BreakErr can be used inside the compute capability function to stop the execution of the workflow.

Functions

This section is empty.

Types

type CapDefinition

type CapDefinition[O any] interface {
	// contains filtered or unexported methods
}

func AccessField

func AccessField[I, O any](c CapDefinition[I], fieldName string) CapDefinition[O]

AccessField is meant to be used by generated code

func AnyMap added in v0.3.0

func AnyMap[M ~map[string]any](inputs CapMap) CapDefinition[M]

func ConstantDefinition

func ConstantDefinition[O any](o O) CapDefinition[O]

func Map added in v0.3.0

func Map[T any, M ~map[string]T](input map[string]CapDefinition[T]) CapDefinition[M]

type CapListDefinition

type CapListDefinition[O any] interface {
	CapDefinition[[]O]
	Index(i int) CapDefinition[O]
}

func AnyListOf added in v0.3.0

func AnyListOf(capabilities ...capDefinition) CapListDefinition[any]

func ListOf

func ListOf[O any](capabilities ...CapDefinition[O]) CapListDefinition[O]

func ToListDefinition

func ToListDefinition[O any](c CapDefinition[[]O]) CapListDefinition[O]

type CapMap added in v0.3.0

type CapMap map[string]capDefinition

type ComponentCapDefinition

type ComponentCapDefinition[O any] map[string]any

ComponentCapDefinition is meant to be used by generated code

func (ComponentCapDefinition[O]) Ref

func (c ComponentCapDefinition[O]) Ref() any

type Compute10Inputs

type Compute10Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any, T8 any, T9 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
	Arg8 CapDefinition[T8]
	Arg9 CapDefinition[T9]
}

Compute10Inputs contains the inputs for a Compute call with 10 arguments.

func (Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) ToSteps

func (input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9]) ToSteps() StepInputs

type Compute1Inputs

type Compute1Inputs[T0 any] struct {
	Arg0 CapDefinition[T0]
}

Compute1Inputs contains the inputs for a Compute call with 1 arguments.

func (Compute1Inputs[I0]) ToSteps

func (input Compute1Inputs[I0]) ToSteps() StepInputs

type Compute2Inputs

type Compute2Inputs[T0 any, T1 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
}

Compute2Inputs contains the inputs for a Compute call with 2 arguments.

func (Compute2Inputs[I0, I1]) ToSteps

func (input Compute2Inputs[I0, I1]) ToSteps() StepInputs

type Compute3Inputs

type Compute3Inputs[T0 any, T1 any, T2 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
}

Compute3Inputs contains the inputs for a Compute call with 3 arguments.

func (Compute3Inputs[I0, I1, I2]) ToSteps

func (input Compute3Inputs[I0, I1, I2]) ToSteps() StepInputs

type Compute4Inputs

type Compute4Inputs[T0 any, T1 any, T2 any, T3 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
}

Compute4Inputs contains the inputs for a Compute call with 4 arguments.

func (Compute4Inputs[I0, I1, I2, I3]) ToSteps

func (input Compute4Inputs[I0, I1, I2, I3]) ToSteps() StepInputs

type Compute5Inputs

type Compute5Inputs[T0 any, T1 any, T2 any, T3 any, T4 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
}

Compute5Inputs contains the inputs for a Compute call with 5 arguments.

func (Compute5Inputs[I0, I1, I2, I3, I4]) ToSteps

func (input Compute5Inputs[I0, I1, I2, I3, I4]) ToSteps() StepInputs

type Compute6Inputs

type Compute6Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
}

Compute6Inputs contains the inputs for a Compute call with 6 arguments.

func (Compute6Inputs[I0, I1, I2, I3, I4, I5]) ToSteps

func (input Compute6Inputs[I0, I1, I2, I3, I4, I5]) ToSteps() StepInputs

type Compute7Inputs

type Compute7Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
}

Compute7Inputs contains the inputs for a Compute call with 7 arguments.

func (Compute7Inputs[I0, I1, I2, I3, I4, I5, I6]) ToSteps

func (input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6]) ToSteps() StepInputs

type Compute8Inputs

type Compute8Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
}

Compute8Inputs contains the inputs for a Compute call with 8 arguments.

func (Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7]) ToSteps

func (input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7]) ToSteps() StepInputs

type Compute9Inputs

type Compute9Inputs[T0 any, T1 any, T2 any, T3 any, T4 any, T5 any, T6 any, T7 any, T8 any] struct {
	Arg0 CapDefinition[T0]
	Arg1 CapDefinition[T1]
	Arg2 CapDefinition[T2]
	Arg3 CapDefinition[T3]
	Arg4 CapDefinition[T4]
	Arg5 CapDefinition[T5]
	Arg6 CapDefinition[T6]
	Arg7 CapDefinition[T7]
	Arg8 CapDefinition[T8]
}

Compute9Inputs contains the inputs for a Compute call with 9 arguments.

func (Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8]) ToSteps

func (input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8]) ToSteps() StepInputs

type ComputeConfig added in v0.4.0

type ComputeConfig[C any] struct {
	Config C
}

func EmptyComputeConfig added in v0.4.0

func EmptyComputeConfig() *ComputeConfig[struct{}]

func (*ComputeConfig[C]) ToMap added in v0.4.0

func (c *ComputeConfig[C]) ToMap() (map[string]any, error)

type ComputeOutput

type ComputeOutput[T any] struct {
	Value T
}

type ComputeOutputCap

type ComputeOutputCap[T any] interface {
	CapDefinition[ComputeOutput[T]]
	Value() CapDefinition[T]
}

func Compute1

func Compute1[I0 any, O any](w *WorkflowSpecFactory, ref string, input Compute1Inputs[I0], compute func(Runtime, I0) (O, error)) ComputeOutputCap[O]

Compute1 is used to instantiate a Compute step with 1 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute10

func Compute10[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, I9 any, O any](w *WorkflowSpecFactory, ref string, input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9) (O, error)) ComputeOutputCap[O]

Compute10 is used to instantiate a Compute step with 10 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute10WithConfig added in v0.4.0

func Compute10WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, I9 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9], compute func(Runtime, C, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9) (O, error)) ComputeOutputCap[O]

Compute10 is an alternative to instantiate a Compute step with 10 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute10WithMetadata added in v0.4.0

func Compute10WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, I9 any, O any](w *WorkflowSpecFactory, ref string, input Compute10Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8, I9], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute10WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute1WithConfig added in v0.4.0

func Compute1WithConfig[I0 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute1Inputs[I0], compute func(Runtime, C, I0) (O, error)) ComputeOutputCap[O]

Compute1 is an alternative to instantiate a Compute step with 1 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute1WithMetadata added in v0.4.0

func Compute1WithMetadata[I0 any, O any](w *WorkflowSpecFactory, ref string, input Compute1Inputs[I0], compute func(Runtime, I0, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute1WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute2

func Compute2[I0 any, I1 any, O any](w *WorkflowSpecFactory, ref string, input Compute2Inputs[I0, I1], compute func(Runtime, I0, I1) (O, error)) ComputeOutputCap[O]

Compute2 is used to instantiate a Compute step with 2 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute2WithConfig added in v0.4.0

func Compute2WithConfig[I0 any, I1 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute2Inputs[I0, I1], compute func(Runtime, C, I0, I1) (O, error)) ComputeOutputCap[O]

Compute2 is an alternative to instantiate a Compute step with 2 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute2WithMetadata added in v0.4.0

func Compute2WithMetadata[I0 any, I1 any, O any](w *WorkflowSpecFactory, ref string, input Compute2Inputs[I0, I1], compute func(Runtime, I0, I1, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute2WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute3

func Compute3[I0 any, I1 any, I2 any, O any](w *WorkflowSpecFactory, ref string, input Compute3Inputs[I0, I1, I2], compute func(Runtime, I0, I1, I2) (O, error)) ComputeOutputCap[O]

Compute3 is used to instantiate a Compute step with 3 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute3WithConfig added in v0.4.0

func Compute3WithConfig[I0 any, I1 any, I2 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute3Inputs[I0, I1, I2], compute func(Runtime, C, I0, I1, I2) (O, error)) ComputeOutputCap[O]

Compute3 is an alternative to instantiate a Compute step with 3 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute3WithMetadata added in v0.4.0

func Compute3WithMetadata[I0 any, I1 any, I2 any, O any](w *WorkflowSpecFactory, ref string, input Compute3Inputs[I0, I1, I2], compute func(Runtime, I0, I1, I2, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute3WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute4

func Compute4[I0 any, I1 any, I2 any, I3 any, O any](w *WorkflowSpecFactory, ref string, input Compute4Inputs[I0, I1, I2, I3], compute func(Runtime, I0, I1, I2, I3) (O, error)) ComputeOutputCap[O]

Compute4 is used to instantiate a Compute step with 4 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute4WithConfig added in v0.4.0

func Compute4WithConfig[I0 any, I1 any, I2 any, I3 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute4Inputs[I0, I1, I2, I3], compute func(Runtime, C, I0, I1, I2, I3) (O, error)) ComputeOutputCap[O]

Compute4 is an alternative to instantiate a Compute step with 4 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute4WithMetadata added in v0.4.0

func Compute4WithMetadata[I0 any, I1 any, I2 any, I3 any, O any](w *WorkflowSpecFactory, ref string, input Compute4Inputs[I0, I1, I2, I3], compute func(Runtime, I0, I1, I2, I3, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute4WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute5

func Compute5[I0 any, I1 any, I2 any, I3 any, I4 any, O any](w *WorkflowSpecFactory, ref string, input Compute5Inputs[I0, I1, I2, I3, I4], compute func(Runtime, I0, I1, I2, I3, I4) (O, error)) ComputeOutputCap[O]

Compute5 is used to instantiate a Compute step with 5 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute5WithConfig added in v0.4.0

func Compute5WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute5Inputs[I0, I1, I2, I3, I4], compute func(Runtime, C, I0, I1, I2, I3, I4) (O, error)) ComputeOutputCap[O]

Compute5 is an alternative to instantiate a Compute step with 5 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute5WithMetadata added in v0.4.0

func Compute5WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, O any](w *WorkflowSpecFactory, ref string, input Compute5Inputs[I0, I1, I2, I3, I4], compute func(Runtime, I0, I1, I2, I3, I4, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute5WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute6

func Compute6[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, O any](w *WorkflowSpecFactory, ref string, input Compute6Inputs[I0, I1, I2, I3, I4, I5], compute func(Runtime, I0, I1, I2, I3, I4, I5) (O, error)) ComputeOutputCap[O]

Compute6 is used to instantiate a Compute step with 6 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute6WithConfig added in v0.4.0

func Compute6WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute6Inputs[I0, I1, I2, I3, I4, I5], compute func(Runtime, C, I0, I1, I2, I3, I4, I5) (O, error)) ComputeOutputCap[O]

Compute6 is an alternative to instantiate a Compute step with 6 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute6WithMetadata added in v0.4.0

func Compute6WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, O any](w *WorkflowSpecFactory, ref string, input Compute6Inputs[I0, I1, I2, I3, I4, I5], compute func(Runtime, I0, I1, I2, I3, I4, I5, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute6WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute7

func Compute7[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, O any](w *WorkflowSpecFactory, ref string, input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6) (O, error)) ComputeOutputCap[O]

Compute7 is used to instantiate a Compute step with 7 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute7WithConfig added in v0.4.0

func Compute7WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6], compute func(Runtime, C, I0, I1, I2, I3, I4, I5, I6) (O, error)) ComputeOutputCap[O]

Compute7 is an alternative to instantiate a Compute step with 7 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute7WithMetadata added in v0.4.0

func Compute7WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, O any](w *WorkflowSpecFactory, ref string, input Compute7Inputs[I0, I1, I2, I3, I4, I5, I6], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute7WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute8

func Compute8[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, O any](w *WorkflowSpecFactory, ref string, input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7) (O, error)) ComputeOutputCap[O]

Compute8 is used to instantiate a Compute step with 8 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute8WithConfig added in v0.4.0

func Compute8WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7], compute func(Runtime, C, I0, I1, I2, I3, I4, I5, I6, I7) (O, error)) ComputeOutputCap[O]

Compute8 is an alternative to instantiate a Compute step with 8 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute8WithMetadata added in v0.4.0

func Compute8WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, O any](w *WorkflowSpecFactory, ref string, input Compute8Inputs[I0, I1, I2, I3, I4, I5, I6, I7], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute8WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

func Compute9

func Compute9[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, O any](w *WorkflowSpecFactory, ref string, input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8) (O, error)) ComputeOutputCap[O]

Compute9 is used to instantiate a Compute step with 9 arguments.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), and I1->I<N> (the inputs that were passed in)

func Compute9WithConfig added in v0.4.0

func Compute9WithConfig[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, O any, C any](w *WorkflowSpecFactory, ref string, config *ComputeConfig[C], input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8], compute func(Runtime, C, I0, I1, I2, I3, I4, I5, I6, I7, I8) (O, error)) ComputeOutputCap[O]

Compute9 is an alternative to instantiate a Compute step with 9 arguments, including config as well.

  • `w` is the spec factory instantiated via sdk.NewWorkflowSpecFactory()
  • `ref` is the name name of the step. This must be unique at the workflow level.
  • `config` contains the config of the step, wrapped in a `ComputeConfig` struct.
  • `input` contains the inputs to the step
  • `compute` is the function that performs the user-defined computation. The inputs to this function are `Runtime` (used to access external APIs like the logger and fetch), `C` (the unwrapped config that was passed in), and I1->I<N> (the inputs that were passed in)

func Compute9WithMetadata added in v0.4.0

func Compute9WithMetadata[I0 any, I1 any, I2 any, I3 any, I4 any, I5 any, I6 any, I7 any, I8 any, O any](w *WorkflowSpecFactory, ref string, input Compute9Inputs[I0, I1, I2, I3, I4, I5, I6, I7, I8], compute func(Runtime, I0, I1, I2, I3, I4, I5, I6, I7, I8, capabilities.RequestMetadata) (O, error)) ComputeOutputCap[O]

Compute9WithMetadata DO NOT USE, this functions is for internal local testing while other tools are being developed and is temporary

type FetchRequest added in v0.3.0

type FetchRequest struct {
	URL       string         `json:"url"`                 // URL to query, only http and https protocols are supported.
	Method    string         `json:"method,omitempty"`    // HTTP verb, defaults to GET.
	Headers   map[string]any `json:"headers,omitempty"`   // HTTP headers, defaults to empty.
	Body      []byte         `json:"body,omitempty"`      // HTTP request body
	TimeoutMs uint32         `json:"timeoutMs,omitempty"` // Timeout in milliseconds
}

type FetchResponse added in v0.3.0

type FetchResponse struct {
	ExecutionError bool           `json:"executionError"`         // true if there were non-HTTP errors. false if HTTP request was sent regardless of status (2xx, 4xx, 5xx)
	ErrorMessage   string         `json:"errorMessage,omitempty"` // error message in case of failure
	StatusCode     uint8          `json:"statusCode"`             // HTTP status code
	Headers        map[string]any `json:"headers,omitempty"`      // HTTP headers
	Body           []byte         `json:"body,omitempty"`         // HTTP response body
}

type MessageEmitter added in v0.4.0

type MessageEmitter interface {
	// Emit sends a message to the labeler's destination.
	Emit(string) error

	// With sets the labels for the message to be emitted.  Labels are passed as key-value pairs
	// and are cumulative.
	With(kvs ...string) MessageEmitter
}

type Runner

type Runner interface {
	Run(factory *WorkflowSpecFactory)
	Config() []byte
}

type Runtime

type Runtime interface {
	Logger() logger.Logger
	Fetch(req FetchRequest) (FetchResponse, error)

	// Emitter sends the given message and labels to the configured collector.
	Emitter() MessageEmitter
}

Runtime exposes external system calls to workflow authors. - `Logger` can be used to log messages - `Emitter` can be used to send messages to beholder - `Fetch` can be used to make external HTTP calls

type SecretValue added in v0.4.0

type SecretValue string

func Secret added in v0.4.0

func Secret(named string) SecretValue

func Secrets added in v0.4.0

func Secrets() SecretValue

func (SecretValue) Ref added in v0.4.0

func (s SecretValue) Ref() any

type Step

type Step[O any] struct {
	Definition StepDefinition
}

func (*Step[O]) AddTo

func (step *Step[O]) AddTo(w *WorkflowSpecFactory) CapDefinition[O]

AddTo is meant to be called by generated code

type StepDefinition

type StepDefinition struct {
	ID     string
	Ref    string
	Inputs StepInputs
	Config map[string]any

	CapabilityType capabilities.CapabilityType
}

StepDefinition is the parsed representation of a step in a workflow.

Within the workflow spec, they are called "Capability Properties".

type StepInputs

type StepInputs struct {
	OutputRef string
	Mapping   map[string]any
}

type WorkflowSpec

type WorkflowSpec struct {
	Name      string
	Owner     string
	Triggers  []StepDefinition
	Actions   []StepDefinition
	Consensus []StepDefinition
	Targets   []StepDefinition
}

func (*WorkflowSpec) Steps

func (w *WorkflowSpec) Steps() []StepDefinition

type WorkflowSpecFactory

type WorkflowSpecFactory struct {
	// contains filtered or unexported fields
}

WorkflowSpecFactory is used to build WorkflowSpecs.

func NewWorkflowSpecFactory

func NewWorkflowSpecFactory() *WorkflowSpecFactory

NewWorkflowSpecFactory initializes a WorkflowSpecFactory. This is usually the first function that is called when writing a new workflow.

func (*WorkflowSpecFactory) AddErr added in v0.4.0

func (w *WorkflowSpecFactory) AddErr(err error)

func (*WorkflowSpecFactory) GetFn

func (*WorkflowSpecFactory) Spec

func (w *WorkflowSpecFactory) Spec() (WorkflowSpec, error)

Directories

Path Synopsis
v2
pb module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL