diff --git a/docs/docs/08-api.md b/docs/docs/08-api.md index 8170029e3..55e912c29 100644 --- a/docs/docs/08-api.md +++ b/docs/docs/08-api.md @@ -777,6 +777,7 @@ have to worry about this in daily LittleHorse usage. | `format_string` | oneof `source`| [VariableAssignment.FormatString](#variableassignmentformatstring) | Assign a format string | | `node_output` | oneof `source`| [VariableAssignment.NodeOutputReference](#variableassignmentnodeoutputreference) | Assign the value of a NodeOutput. | | `expression` | oneof `source`| [VariableAssignment.Expression](#variableassignmentexpression) | Assign the value of an Expression. | +| `type_to_cast_to` | optional| [VariableType](#variabletype) | Allows casting this Variable Assignment to a specific type | @@ -792,6 +793,7 @@ An Expression allows you to combine multiple values into one. | `lhs` | | [VariableAssignment](#variableassignment) | The left-hand-side of the expression. | | `operation` | | [VariableMutationType](#variablemutationtype) | The operator in the expression. | | `rhs` | | [VariableAssignment](#variableassignment) | The right-hand-side of the expression. | +| `type_to_cast_to` | optional| [VariableType](#variabletype) | Allows casting this expression to a specific type | diff --git a/schemas/littlehorse/common_wfspec.proto b/schemas/littlehorse/common_wfspec.proto index 153ff1f77..8f1bc7b48 100644 --- a/schemas/littlehorse/common_wfspec.proto +++ b/schemas/littlehorse/common_wfspec.proto @@ -47,6 +47,8 @@ message VariableAssignment { VariableMutationType operation = 2; // The right-hand-side of the expression. VariableAssignment rhs = 3; + // Allows casting this expression to a specific type + optional VariableType type_to_cast_to = 4; } // If you provide a `variable_name` and the specified variable is JSON_OBJ or @@ -67,6 +69,8 @@ message VariableAssignment { // Assign the value of an Expression. Expression expression = 6; } + // Allows casting this Variable Assignment to a specific type + optional VariableType type_to_cast_to = 7; } // Enumerates the available operations to mutate a variable in a WfRun. diff --git a/sdk-go/lhproto/common_wfspec.pb.go b/sdk-go/lhproto/common_wfspec.pb.go index 511cab212..4c5f4005a 100644 --- a/sdk-go/lhproto/common_wfspec.pb.go +++ b/sdk-go/lhproto/common_wfspec.pb.go @@ -257,6 +257,8 @@ type VariableAssignment struct { // *VariableAssignment_NodeOutput // *VariableAssignment_Expression_ Source isVariableAssignment_Source `protobuf_oneof:"source"` + // Allows casting this Variable Assignment to a specific type + TypeToCastTo *VariableType `protobuf:"varint,7,opt,name=type_to_cast_to,json=typeToCastTo,proto3,enum=littlehorse.VariableType,oneof" json:"type_to_cast_to,omitempty"` } func (x *VariableAssignment) Reset() { @@ -340,6 +342,13 @@ func (x *VariableAssignment) GetExpression() *VariableAssignment_Expression { return nil } +func (x *VariableAssignment) GetTypeToCastTo() VariableType { + if x != nil && x.TypeToCastTo != nil { + return *x.TypeToCastTo + } + return VariableType_JSON_OBJ +} + type isVariableAssignment_Source interface { isVariableAssignment_Source() } @@ -1047,6 +1056,8 @@ type VariableAssignment_Expression struct { Operation VariableMutationType `protobuf:"varint,2,opt,name=operation,proto3,enum=littlehorse.VariableMutationType" json:"operation,omitempty"` // The right-hand-side of the expression. Rhs *VariableAssignment `protobuf:"bytes,3,opt,name=rhs,proto3" json:"rhs,omitempty"` + // Allows casting this expression to a specific type + TypeToCastTo *VariableType `protobuf:"varint,4,opt,name=type_to_cast_to,json=typeToCastTo,proto3,enum=littlehorse.VariableType,oneof" json:"type_to_cast_to,omitempty"` } func (x *VariableAssignment_Expression) Reset() { @@ -1102,6 +1113,13 @@ func (x *VariableAssignment_Expression) GetRhs() *VariableAssignment { return nil } +func (x *VariableAssignment_Expression) GetTypeToCastTo() VariableType { + if x != nil && x.TypeToCastTo != nil { + return *x.TypeToCastTo + } + return VariableType_JSON_OBJ +} + // Specifies to use the output of a NodeRun as the RHS. type VariableMutation_NodeOutputSource struct { state protoimpl.MessageState @@ -1316,7 +1334,7 @@ var file_common_wfspec_proto_rawDesc = []byte{ 0x73, 0x65, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, - 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x06, 0x0a, 0x12, 0x56, 0x61, 0x72, 0x69, + 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x07, 0x0a, 0x12, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, @@ -1342,175 +1360,187 @@ var file_common_wfspec_proto_rawDesc = []byte{ 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x7c, 0x0a, 0x0c, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x37, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, - 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, - 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x33, - 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x0f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x74, 0x6f, + 0x5f, 0x63, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, + 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x02, 0x52, 0x0c, 0x74, 0x79, 0x70, + 0x65, 0x54, 0x6f, 0x43, 0x61, 0x73, 0x74, 0x54, 0x6f, 0x88, 0x01, 0x01, 0x1a, 0x7c, 0x0a, 0x0c, + 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x37, 0x0a, 0x06, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x61, - 0x72, 0x67, 0x73, 0x1a, 0x32, 0x0a, 0x13, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, - 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, - 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0xb3, 0x01, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x03, 0x6c, 0x68, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, + 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x33, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, 0x6c, 0x68, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x6f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x6c, - 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x03, 0x72, 0x68, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, - 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, - 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, 0x72, 0x68, 0x73, 0x42, 0x08, 0x0a, - 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, - 0x5f, 0x70, 0x61, 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x10, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x68, - 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x68, - 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0d, 0x6c, 0x68, 0x73, 0x5f, 0x6a, 0x73, 0x6f, - 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, - 0x6c, 0x68, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x3f, - 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x21, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x1a, 0x32, 0x0a, 0x13, 0x4e, 0x6f, + 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x8e, + 0x02, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, + 0x03, 0x6c, 0x68, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, + 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, 0x6c, 0x68, 0x73, + 0x12, 0x3f, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, + 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x31, 0x0a, 0x03, 0x72, 0x68, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, + 0x03, 0x72, 0x68, 0x73, 0x12, 0x45, 0x0a, 0x0f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x74, 0x6f, 0x5f, + 0x63, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, + 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x74, 0x79, 0x70, 0x65, + 0x54, 0x6f, 0x43, 0x61, 0x73, 0x74, 0x54, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x12, 0x0a, 0x10, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x63, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x42, + 0x08, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6a, 0x73, + 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x74, 0x6f, 0x5f, 0x63, 0x61, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x22, 0xd8, 0x03, 0x0a, 0x10, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x48, 0x0a, 0x0e, 0x72, 0x68, 0x73, 0x5f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, - 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, - 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x72, 0x68, 0x73, 0x41, - 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0d, 0x6c, 0x69, 0x74, - 0x65, 0x72, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x68, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6c, 0x68, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0d, 0x6c, + 0x68, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x6c, 0x68, 0x73, 0x4a, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x12, 0x3f, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, + 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0e, 0x72, 0x68, 0x73, 0x5f, 0x61, 0x73, 0x73, + 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, + 0x52, 0x0d, 0x72, 0x68, 0x73, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x41, 0x0a, 0x0d, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, + 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x51, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, + 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x4f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x1a, 0x40, 0x0a, 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x6a, 0x73, 0x6f, + 0x6e, 0x70, 0x61, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x6a, + 0x73, 0x6f, 0x6e, 0x70, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6a, + 0x73, 0x6f, 0x6e, 0x70, 0x61, 0x74, 0x68, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x68, 0x73, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x6c, 0x68, 0x73, 0x5f, 0x6a, 0x73, 0x6f, + 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x22, 0xcb, 0x01, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, + 0x62, 0x6c, 0x65, 0x44, 0x65, 0x66, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, + 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x64, 0x65, 0x66, + 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0c, - 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x51, 0x0a, 0x0b, - 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2e, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, - 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x48, 0x00, 0x52, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x1a, - 0x40, 0x0a, 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x61, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x70, 0x61, 0x74, - 0x68, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x68, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x10, - 0x0a, 0x0e, 0x5f, 0x6c, 0x68, 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, - 0x22, 0xcb, 0x01, 0x0a, 0x0b, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x66, - 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, - 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x74, - 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x73, - 0x6b, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0b, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x10, 0x0a, 0x0e, - 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, - 0x05, 0x0a, 0x0f, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, - 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x55, - 0x54, 0x41, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x40, - 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, - 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x55, 0x54, 0x41, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x12, 0x46, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, + 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x21, 0x0a, 0x0c, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6d, 0x61, 0x73, 0x6b, 0x65, 0x64, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbf, 0x05, 0x0a, 0x0f, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, + 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x2e, 0x55, 0x54, 0x41, 0x54, 0x61, 0x73, 0x6b, 0x48, 0x00, 0x52, 0x04, + 0x74, 0x61, 0x73, 0x6b, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, + 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x2e, 0x55, 0x54, 0x41, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x46, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x73, 0x73, 0x69, + 0x67, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, + 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x55, 0x54, 0x41, 0x52, 0x65, 0x61, 0x73, 0x73, 0x69, + 0x67, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x44, + 0x0a, 0x0d, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, + 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, + 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x37, 0x0a, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x2e, 0x55, 0x54, 0x41, 0x52, 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x48, 0x00, 0x52, 0x08, - 0x72, 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x44, 0x0a, 0x0d, 0x64, 0x65, 0x6c, 0x61, - 0x79, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, - 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x37, - 0x0a, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6c, - 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x55, 0x54, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x55, 0x54, 0x48, 0x6f, 0x6f, - 0x6b, 0x52, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x1a, 0x0b, 0x0a, 0x09, 0x55, 0x54, 0x41, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x71, 0x0a, 0x07, 0x55, 0x54, 0x41, 0x54, 0x61, 0x73, 0x6b, 0x12, - 0x29, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x3b, 0x0a, 0x09, 0x6d, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, - 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6d, 0x75, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0xac, 0x01, 0x0a, 0x0b, 0x55, 0x54, 0x41, 0x52, - 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x3d, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, - 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, - 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x43, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x67, - 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, - 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x01, 0x52, 0x09, 0x75, - 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x75, 0x73, 0x65, 0x72, - 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2e, 0x0a, 0x06, 0x55, 0x54, 0x48, 0x6f, 0x6f, 0x6b, - 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x4e, 0x5f, 0x41, 0x52, 0x52, 0x49, 0x56, 0x41, 0x4c, 0x10, 0x00, - 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x4e, 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x41, 0x53, 0x53, 0x49, - 0x47, 0x4e, 0x45, 0x44, 0x10, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, - 0x63, 0x79, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x76, 0x61, 0x6c, 0x5f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x62, 0x61, - 0x73, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x4d, 0x73, 0x12, 0x20, 0x0a, 0x0c, - 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x73, 0x12, 0x1e, - 0x0a, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x02, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x22, 0x99, - 0x03, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x74, - 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x65, 0x66, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x54, - 0x61, 0x73, 0x6b, 0x44, 0x65, 0x66, 0x49, 0x64, 0x48, 0x00, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, - 0x44, 0x65, 0x66, 0x49, 0x64, 0x12, 0x44, 0x0a, 0x0c, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, - 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, - 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x27, 0x0a, 0x0f, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, - 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x73, 0x12, 0x60, - 0x0a, 0x13, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x62, 0x61, - 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x69, - 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x65, 0x74, 0x72, - 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x01, 0x52, 0x12, 0x65, 0x78, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x88, 0x01, 0x01, - 0x12, 0x3d, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, - 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x42, - 0x11, 0x0a, 0x0f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x74, 0x6f, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x65, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2a, 0x98, 0x01, 0x0a, 0x14, 0x56, - 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x10, 0x00, 0x12, - 0x07, 0x0a, 0x03, 0x41, 0x44, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x58, 0x54, 0x45, - 0x4e, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x55, 0x42, 0x54, 0x52, 0x41, 0x43, 0x54, - 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x50, 0x4c, 0x59, 0x10, 0x04, - 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x49, 0x56, 0x49, 0x44, 0x45, 0x10, 0x05, 0x12, 0x15, 0x0a, 0x11, - 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x49, 0x46, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, - 0x54, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x49, 0x4e, - 0x44, 0x45, 0x58, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, - 0x4b, 0x45, 0x59, 0x10, 0x08, 0x2a, 0x84, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0d, 0x0a, 0x09, 0x4c, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x48, 0x41, - 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x52, 0x45, 0x41, 0x54, 0x45, 0x52, 0x5f, 0x54, - 0x48, 0x41, 0x4e, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x4c, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x48, - 0x41, 0x4e, 0x5f, 0x45, 0x51, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x47, 0x52, 0x45, 0x41, 0x54, - 0x45, 0x52, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x5f, 0x45, 0x51, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, - 0x45, 0x51, 0x55, 0x41, 0x4c, 0x53, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x4f, 0x54, 0x5f, - 0x45, 0x51, 0x55, 0x41, 0x4c, 0x53, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x49, 0x4e, 0x10, 0x06, - 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, 0x10, 0x07, 0x42, 0x49, 0x0a, 0x1f, - 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x73, - 0x64, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0xaa, 0x02, 0x18, 0x4c, - 0x69, 0x74, 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x55, 0x54, 0x48, 0x6f, 0x6f, 0x6b, 0x52, 0x04, 0x68, 0x6f, 0x6f, 0x6b, 0x1a, 0x0b, 0x0a, + 0x09, 0x55, 0x54, 0x41, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x71, 0x0a, 0x07, 0x55, 0x54, + 0x41, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, + 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, + 0x12, 0x3b, 0x0a, 0x09, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, + 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x09, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0xac, 0x01, + 0x0a, 0x0b, 0x55, 0x54, 0x41, 0x52, 0x65, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x3d, 0x0a, + 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x48, + 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x43, 0x0a, 0x0a, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, + 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, + 0x74, 0x48, 0x01, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x88, 0x01, + 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0d, 0x0a, + 0x0b, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x2e, 0x0a, 0x06, + 0x55, 0x54, 0x48, 0x6f, 0x6f, 0x6b, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x4e, 0x5f, 0x41, 0x52, 0x52, + 0x49, 0x56, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x4e, 0x5f, 0x54, 0x41, 0x53, + 0x4b, 0x5f, 0x41, 0x53, 0x53, 0x49, 0x47, 0x4e, 0x45, 0x44, 0x10, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x45, 0x78, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x65, 0x74, + 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x10, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x5f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0e, 0x62, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x4d, 0x73, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x5f, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x6c, + 0x61, 0x79, 0x4d, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x22, 0x99, 0x03, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64, + 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x65, 0x66, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, + 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x65, 0x66, 0x49, 0x64, 0x48, 0x00, + 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x44, 0x65, 0x66, 0x49, 0x64, 0x12, 0x44, 0x0a, 0x0c, 0x64, + 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, + 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, + 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x54, 0x61, 0x73, + 0x6b, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, + 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x74, 0x69, 0x6d, 0x65, + 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, + 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x74, + 0x72, 0x69, 0x65, 0x73, 0x12, 0x60, 0x0a, 0x13, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x69, 0x61, 0x6c, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, + 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x63, 0x6b, 0x6f, + 0x66, 0x66, 0x52, 0x65, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x48, 0x01, 0x52, + 0x12, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x42, 0x61, 0x63, 0x6b, + 0x6f, 0x66, 0x66, 0x88, 0x01, 0x01, 0x12, 0x3d, 0x0a, 0x09, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, + 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, + 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, + 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x76, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x74, 0x6f, + 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x65, 0x78, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, + 0x2a, 0x98, 0x01, 0x0a, 0x14, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x53, 0x53, + 0x49, 0x47, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x44, 0x44, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x55, + 0x42, 0x54, 0x52, 0x41, 0x43, 0x54, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x55, 0x4c, 0x54, + 0x49, 0x50, 0x4c, 0x59, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x49, 0x56, 0x49, 0x44, 0x45, + 0x10, 0x05, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x49, 0x46, 0x5f, + 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, 0x4d, + 0x4f, 0x56, 0x45, 0x5f, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x10, 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x52, + 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x08, 0x2a, 0x84, 0x01, 0x0a, 0x0a, + 0x43, 0x6f, 0x6d, 0x70, 0x61, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x0d, 0x0a, 0x09, 0x4c, 0x45, + 0x53, 0x53, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x47, 0x52, 0x45, + 0x41, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x4c, + 0x45, 0x53, 0x53, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x5f, 0x45, 0x51, 0x10, 0x02, 0x12, 0x13, 0x0a, + 0x0f, 0x47, 0x52, 0x45, 0x41, 0x54, 0x45, 0x52, 0x5f, 0x54, 0x48, 0x41, 0x4e, 0x5f, 0x45, 0x51, + 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x53, 0x10, 0x04, 0x12, 0x0e, + 0x0a, 0x0a, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x53, 0x10, 0x05, 0x12, 0x06, + 0x0a, 0x02, 0x49, 0x4e, 0x10, 0x06, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x54, 0x5f, 0x49, 0x4e, + 0x10, 0x07, 0x42, 0x49, 0x0a, 0x1f, 0x69, 0x6f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, + 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x09, 0x2e, 0x3b, 0x6c, 0x68, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0xaa, 0x02, 0x18, 0x4c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x48, 0x6f, 0x72, 0x73, 0x65, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1553,35 +1583,37 @@ var file_common_wfspec_proto_depIdxs = []int32{ 9, // 1: littlehorse.VariableAssignment.format_string:type_name -> littlehorse.VariableAssignment.FormatString 10, // 2: littlehorse.VariableAssignment.node_output:type_name -> littlehorse.VariableAssignment.NodeOutputReference 11, // 3: littlehorse.VariableAssignment.expression:type_name -> littlehorse.VariableAssignment.Expression - 0, // 4: littlehorse.VariableMutation.operation:type_name -> littlehorse.VariableMutationType - 3, // 5: littlehorse.VariableMutation.rhs_assignment:type_name -> littlehorse.VariableAssignment - 16, // 6: littlehorse.VariableMutation.literal_value:type_name -> littlehorse.VariableValue - 12, // 7: littlehorse.VariableMutation.node_output:type_name -> littlehorse.VariableMutation.NodeOutputSource - 17, // 8: littlehorse.VariableDef.type:type_name -> littlehorse.VariableType - 16, // 9: littlehorse.VariableDef.default_value:type_name -> littlehorse.VariableValue - 14, // 10: littlehorse.UTActionTrigger.task:type_name -> littlehorse.UTActionTrigger.UTATask - 13, // 11: littlehorse.UTActionTrigger.cancel:type_name -> littlehorse.UTActionTrigger.UTACancel - 15, // 12: littlehorse.UTActionTrigger.reassign:type_name -> littlehorse.UTActionTrigger.UTAReassign - 3, // 13: littlehorse.UTActionTrigger.delay_seconds:type_name -> littlehorse.VariableAssignment - 2, // 14: littlehorse.UTActionTrigger.hook:type_name -> littlehorse.UTActionTrigger.UTHook - 18, // 15: littlehorse.TaskNode.task_def_id:type_name -> littlehorse.TaskDefId - 3, // 16: littlehorse.TaskNode.dynamic_task:type_name -> littlehorse.VariableAssignment - 7, // 17: littlehorse.TaskNode.exponential_backoff:type_name -> littlehorse.ExponentialBackoffRetryPolicy - 3, // 18: littlehorse.TaskNode.variables:type_name -> littlehorse.VariableAssignment - 3, // 19: littlehorse.VariableAssignment.FormatString.format:type_name -> littlehorse.VariableAssignment - 3, // 20: littlehorse.VariableAssignment.FormatString.args:type_name -> littlehorse.VariableAssignment - 3, // 21: littlehorse.VariableAssignment.Expression.lhs:type_name -> littlehorse.VariableAssignment - 0, // 22: littlehorse.VariableAssignment.Expression.operation:type_name -> littlehorse.VariableMutationType - 3, // 23: littlehorse.VariableAssignment.Expression.rhs:type_name -> littlehorse.VariableAssignment - 8, // 24: littlehorse.UTActionTrigger.UTATask.task:type_name -> littlehorse.TaskNode - 4, // 25: littlehorse.UTActionTrigger.UTATask.mutations:type_name -> littlehorse.VariableMutation - 3, // 26: littlehorse.UTActionTrigger.UTAReassign.user_id:type_name -> littlehorse.VariableAssignment - 3, // 27: littlehorse.UTActionTrigger.UTAReassign.user_group:type_name -> littlehorse.VariableAssignment - 28, // [28:28] is the sub-list for method output_type - 28, // [28:28] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name + 17, // 4: littlehorse.VariableAssignment.type_to_cast_to:type_name -> littlehorse.VariableType + 0, // 5: littlehorse.VariableMutation.operation:type_name -> littlehorse.VariableMutationType + 3, // 6: littlehorse.VariableMutation.rhs_assignment:type_name -> littlehorse.VariableAssignment + 16, // 7: littlehorse.VariableMutation.literal_value:type_name -> littlehorse.VariableValue + 12, // 8: littlehorse.VariableMutation.node_output:type_name -> littlehorse.VariableMutation.NodeOutputSource + 17, // 9: littlehorse.VariableDef.type:type_name -> littlehorse.VariableType + 16, // 10: littlehorse.VariableDef.default_value:type_name -> littlehorse.VariableValue + 14, // 11: littlehorse.UTActionTrigger.task:type_name -> littlehorse.UTActionTrigger.UTATask + 13, // 12: littlehorse.UTActionTrigger.cancel:type_name -> littlehorse.UTActionTrigger.UTACancel + 15, // 13: littlehorse.UTActionTrigger.reassign:type_name -> littlehorse.UTActionTrigger.UTAReassign + 3, // 14: littlehorse.UTActionTrigger.delay_seconds:type_name -> littlehorse.VariableAssignment + 2, // 15: littlehorse.UTActionTrigger.hook:type_name -> littlehorse.UTActionTrigger.UTHook + 18, // 16: littlehorse.TaskNode.task_def_id:type_name -> littlehorse.TaskDefId + 3, // 17: littlehorse.TaskNode.dynamic_task:type_name -> littlehorse.VariableAssignment + 7, // 18: littlehorse.TaskNode.exponential_backoff:type_name -> littlehorse.ExponentialBackoffRetryPolicy + 3, // 19: littlehorse.TaskNode.variables:type_name -> littlehorse.VariableAssignment + 3, // 20: littlehorse.VariableAssignment.FormatString.format:type_name -> littlehorse.VariableAssignment + 3, // 21: littlehorse.VariableAssignment.FormatString.args:type_name -> littlehorse.VariableAssignment + 3, // 22: littlehorse.VariableAssignment.Expression.lhs:type_name -> littlehorse.VariableAssignment + 0, // 23: littlehorse.VariableAssignment.Expression.operation:type_name -> littlehorse.VariableMutationType + 3, // 24: littlehorse.VariableAssignment.Expression.rhs:type_name -> littlehorse.VariableAssignment + 17, // 25: littlehorse.VariableAssignment.Expression.type_to_cast_to:type_name -> littlehorse.VariableType + 8, // 26: littlehorse.UTActionTrigger.UTATask.task:type_name -> littlehorse.TaskNode + 4, // 27: littlehorse.UTActionTrigger.UTATask.mutations:type_name -> littlehorse.VariableMutation + 3, // 28: littlehorse.UTActionTrigger.UTAReassign.user_id:type_name -> littlehorse.VariableAssignment + 3, // 29: littlehorse.UTActionTrigger.UTAReassign.user_group:type_name -> littlehorse.VariableAssignment + 30, // [30:30] is the sub-list for method output_type + 30, // [30:30] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name } func init() { file_common_wfspec_proto_init() } @@ -1772,6 +1804,7 @@ func file_common_wfspec_proto_init() { (*TaskNode_TaskDefId)(nil), (*TaskNode_DynamicTask)(nil), } + file_common_wfspec_proto_msgTypes[8].OneofWrappers = []interface{}{} file_common_wfspec_proto_msgTypes[9].OneofWrappers = []interface{}{} file_common_wfspec_proto_msgTypes[12].OneofWrappers = []interface{}{} type x struct{} diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonWfspec.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonWfspec.java index 6e90f7ce1..d01ab33ea 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonWfspec.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/CommonWfspec.java @@ -90,7 +90,7 @@ public static void registerAllExtensions( java.lang.String[] descriptorData = { "\n\023common_wfspec.proto\022\013littlehorse\032\022comm" + "on_enums.proto\032\016variable.proto\032\017object_i" + - "d.proto\"\242\005\n\022VariableAssignment\022\026\n\tjson_p" + + "d.proto\"\274\006\n\022VariableAssignment\022\026\n\tjson_p" + "ath\030\001 \001(\tH\001\210\001\001\022\027\n\rvariable_name\030\002 \001(\tH\000\022" + "3\n\rliteral_value\030\003 \001(\0132\032.littlehorse.Var" + "iableValueH\000\022E\n\rformat_string\030\004 \001(\0132,.li" + @@ -98,65 +98,69 @@ public static void registerAllExtensions( "gH\000\022J\n\013node_output\030\005 \001(\01323.littlehorse.V" + "ariableAssignment.NodeOutputReferenceH\000\022" + "@\n\nexpression\030\006 \001(\0132*.littlehorse.Variab" + - "leAssignment.ExpressionH\000\032n\n\014FormatStrin" + - "g\022/\n\006format\030\001 \001(\0132\037.littlehorse.Variable" + - "Assignment\022-\n\004args\030\002 \003(\0132\037.littlehorse.V" + - "ariableAssignment\032(\n\023NodeOutputReference" + - "\022\021\n\tnode_name\030\001 \001(\t\032\236\001\n\nExpression\022,\n\003lh" + - "s\030\001 \001(\0132\037.littlehorse.VariableAssignment" + - "\0224\n\toperation\030\002 \001(\0162!.littlehorse.Variab" + - "leMutationType\022,\n\003rhs\030\003 \001(\0132\037.littlehors" + - "e.VariableAssignmentB\010\n\006sourceB\014\n\n_json_" + - "path\"\204\003\n\020VariableMutation\022\020\n\010lhs_name\030\001 " + - "\001(\t\022\032\n\rlhs_json_path\030\002 \001(\tH\001\210\001\001\0224\n\topera" + - "tion\030\003 \001(\0162!.littlehorse.VariableMutatio" + - "nType\0229\n\016rhs_assignment\030\004 \001(\0132\037.littleho" + - "rse.VariableAssignmentH\000\0223\n\rliteral_valu" + - "e\030\005 \001(\0132\032.littlehorse.VariableValueH\000\022E\n" + - "\013node_output\030\006 \001(\0132..littlehorse.Variabl" + - "eMutation.NodeOutputSourceH\000\0326\n\020NodeOutp" + - "utSource\022\025\n\010jsonpath\030\n \001(\tH\000\210\001\001B\013\n\t_json" + - "pathB\013\n\trhs_valueB\020\n\016_lhs_json_path\"\244\001\n\013" + - "VariableDef\022\'\n\004type\030\001 \001(\0162\031.littlehorse." + - "VariableType\022\014\n\004name\030\002 \001(\t\0226\n\rdefault_va" + - "lue\030\003 \001(\0132\032.littlehorse.VariableValueH\000\210" + - "\001\001\022\024\n\014masked_value\030\004 \001(\010B\020\n\016_default_val" + - "ue\"\357\004\n\017UTActionTrigger\0224\n\004task\030\001 \001(\0132$.l" + - "ittlehorse.UTActionTrigger.UTATaskH\000\0228\n\006" + - "cancel\030\002 \001(\0132&.littlehorse.UTActionTrigg" + - "er.UTACancelH\000\022<\n\010reassign\030\003 \001(\0132(.littl" + - "ehorse.UTActionTrigger.UTAReassignH\000\0226\n\r" + - "delay_seconds\030\005 \001(\0132\037.littlehorse.Variab" + - "leAssignment\0221\n\004hook\030\006 \001(\0162#.littlehorse" + - ".UTActionTrigger.UTHook\032\013\n\tUTACancel\032`\n\007" + - "UTATask\022#\n\004task\030\001 \001(\0132\025.littlehorse.Task" + - "Node\0220\n\tmutations\030\002 \003(\0132\035.littlehorse.Va" + - "riableMutation\032\231\001\n\013UTAReassign\0225\n\007user_i" + - "d\030\001 \001(\0132\037.littlehorse.VariableAssignment" + - "H\000\210\001\001\0228\n\nuser_group\030\002 \001(\0132\037.littlehorse." + - "VariableAssignmentH\001\210\001\001B\n\n\010_user_idB\r\n\013_" + - "user_group\".\n\006UTHook\022\016\n\nON_ARRIVAL\020\000\022\024\n\020" + - "ON_TASK_ASSIGNED\020\001B\010\n\006action\"c\n\035Exponent" + - "ialBackoffRetryPolicy\022\030\n\020base_interval_m" + - "s\030\001 \001(\005\022\024\n\014max_delay_ms\030\002 \001(\003\022\022\n\nmultipl" + - "ier\030\003 \001(\002\"\311\002\n\010TaskNode\022-\n\013task_def_id\030\001 " + - "\001(\0132\026.littlehorse.TaskDefIdH\000\0227\n\014dynamic" + - "_task\030\006 \001(\0132\037.littlehorse.VariableAssign" + - "mentH\000\022\027\n\017timeout_seconds\030\002 \001(\005\022\017\n\007retri" + - "es\030\003 \001(\005\022L\n\023exponential_backoff\030\005 \001(\0132*." + - "littlehorse.ExponentialBackoffRetryPolic" + - "yH\001\210\001\001\0222\n\tvariables\030\004 \003(\0132\037.littlehorse." + - "VariableAssignmentB\021\n\017task_to_executeB\026\n" + - "\024_exponential_backoff*\230\001\n\024VariableMutati" + - "onType\022\n\n\006ASSIGN\020\000\022\007\n\003ADD\020\001\022\n\n\006EXTEND\020\002\022" + - "\014\n\010SUBTRACT\020\003\022\014\n\010MULTIPLY\020\004\022\n\n\006DIVIDE\020\005\022" + - "\025\n\021REMOVE_IF_PRESENT\020\006\022\020\n\014REMOVE_INDEX\020\007" + - "\022\016\n\nREMOVE_KEY\020\010*\204\001\n\nComparator\022\r\n\tLESS_" + - "THAN\020\000\022\020\n\014GREATER_THAN\020\001\022\020\n\014LESS_THAN_EQ" + - "\020\002\022\023\n\017GREATER_THAN_EQ\020\003\022\n\n\006EQUALS\020\004\022\016\n\nN" + - "OT_EQUALS\020\005\022\006\n\002IN\020\006\022\n\n\006NOT_IN\020\007BI\n\037io.li" + - "ttlehorse.sdk.common.protoP\001Z\t.;lhproto\252" + - "\002\030LittleHorse.Common.Protob\006proto3" + "leAssignment.ExpressionH\000\0227\n\017type_to_cas" + + "t_to\030\007 \001(\0162\031.littlehorse.VariableTypeH\002\210" + + "\001\001\032n\n\014FormatString\022/\n\006format\030\001 \001(\0132\037.lit" + + "tlehorse.VariableAssignment\022-\n\004args\030\002 \003(" + + "\0132\037.littlehorse.VariableAssignment\032(\n\023No" + + "deOutputReference\022\021\n\tnode_name\030\001 \001(\t\032\353\001\n" + + "\nExpression\022,\n\003lhs\030\001 \001(\0132\037.littlehorse.V" + + "ariableAssignment\0224\n\toperation\030\002 \001(\0162!.l" + + "ittlehorse.VariableMutationType\022,\n\003rhs\030\003" + + " \001(\0132\037.littlehorse.VariableAssignment\0227\n" + + "\017type_to_cast_to\030\004 \001(\0162\031.littlehorse.Var" + + "iableTypeH\000\210\001\001B\022\n\020_type_to_cast_toB\010\n\006so" + + "urceB\014\n\n_json_pathB\022\n\020_type_to_cast_to\"\204" + + "\003\n\020VariableMutation\022\020\n\010lhs_name\030\001 \001(\t\022\032\n" + + "\rlhs_json_path\030\002 \001(\tH\001\210\001\001\0224\n\toperation\030\003" + + " \001(\0162!.littlehorse.VariableMutationType\022" + + "9\n\016rhs_assignment\030\004 \001(\0132\037.littlehorse.Va" + + "riableAssignmentH\000\0223\n\rliteral_value\030\005 \001(" + + "\0132\032.littlehorse.VariableValueH\000\022E\n\013node_" + + "output\030\006 \001(\0132..littlehorse.VariableMutat" + + "ion.NodeOutputSourceH\000\0326\n\020NodeOutputSour" + + "ce\022\025\n\010jsonpath\030\n \001(\tH\000\210\001\001B\013\n\t_jsonpathB\013" + + "\n\trhs_valueB\020\n\016_lhs_json_path\"\244\001\n\013Variab" + + "leDef\022\'\n\004type\030\001 \001(\0162\031.littlehorse.Variab" + + "leType\022\014\n\004name\030\002 \001(\t\0226\n\rdefault_value\030\003 " + + "\001(\0132\032.littlehorse.VariableValueH\000\210\001\001\022\024\n\014" + + "masked_value\030\004 \001(\010B\020\n\016_default_value\"\357\004\n" + + "\017UTActionTrigger\0224\n\004task\030\001 \001(\0132$.littleh" + + "orse.UTActionTrigger.UTATaskH\000\0228\n\006cancel" + + "\030\002 \001(\0132&.littlehorse.UTActionTrigger.UTA" + + "CancelH\000\022<\n\010reassign\030\003 \001(\0132(.littlehorse" + + ".UTActionTrigger.UTAReassignH\000\0226\n\rdelay_" + + "seconds\030\005 \001(\0132\037.littlehorse.VariableAssi" + + "gnment\0221\n\004hook\030\006 \001(\0162#.littlehorse.UTAct" + + "ionTrigger.UTHook\032\013\n\tUTACancel\032`\n\007UTATas" + + "k\022#\n\004task\030\001 \001(\0132\025.littlehorse.TaskNode\0220" + + "\n\tmutations\030\002 \003(\0132\035.littlehorse.Variable" + + "Mutation\032\231\001\n\013UTAReassign\0225\n\007user_id\030\001 \001(" + + "\0132\037.littlehorse.VariableAssignmentH\000\210\001\001\022" + + "8\n\nuser_group\030\002 \001(\0132\037.littlehorse.Variab" + + "leAssignmentH\001\210\001\001B\n\n\010_user_idB\r\n\013_user_g" + + "roup\".\n\006UTHook\022\016\n\nON_ARRIVAL\020\000\022\024\n\020ON_TAS" + + "K_ASSIGNED\020\001B\010\n\006action\"c\n\035ExponentialBac" + + "koffRetryPolicy\022\030\n\020base_interval_ms\030\001 \001(" + + "\005\022\024\n\014max_delay_ms\030\002 \001(\003\022\022\n\nmultiplier\030\003 " + + "\001(\002\"\311\002\n\010TaskNode\022-\n\013task_def_id\030\001 \001(\0132\026." + + "littlehorse.TaskDefIdH\000\0227\n\014dynamic_task\030" + + "\006 \001(\0132\037.littlehorse.VariableAssignmentH\000" + + "\022\027\n\017timeout_seconds\030\002 \001(\005\022\017\n\007retries\030\003 \001" + + "(\005\022L\n\023exponential_backoff\030\005 \001(\0132*.little" + + "horse.ExponentialBackoffRetryPolicyH\001\210\001\001" + + "\0222\n\tvariables\030\004 \003(\0132\037.littlehorse.Variab" + + "leAssignmentB\021\n\017task_to_executeB\026\n\024_expo" + + "nential_backoff*\230\001\n\024VariableMutationType" + + "\022\n\n\006ASSIGN\020\000\022\007\n\003ADD\020\001\022\n\n\006EXTEND\020\002\022\014\n\010SUB" + + "TRACT\020\003\022\014\n\010MULTIPLY\020\004\022\n\n\006DIVIDE\020\005\022\025\n\021REM" + + "OVE_IF_PRESENT\020\006\022\020\n\014REMOVE_INDEX\020\007\022\016\n\nRE" + + "MOVE_KEY\020\010*\204\001\n\nComparator\022\r\n\tLESS_THAN\020\000" + + "\022\020\n\014GREATER_THAN\020\001\022\020\n\014LESS_THAN_EQ\020\002\022\023\n\017" + + "GREATER_THAN_EQ\020\003\022\n\n\006EQUALS\020\004\022\016\n\nNOT_EQU" + + "ALS\020\005\022\006\n\002IN\020\006\022\n\n\006NOT_IN\020\007BI\n\037io.littleho" + + "rse.sdk.common.protoP\001Z\t.;lhproto\252\002\030Litt" + + "leHorse.Common.Protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -170,7 +174,7 @@ public static void registerAllExtensions( internal_static_littlehorse_VariableAssignment_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_VariableAssignment_descriptor, - new java.lang.String[] { "JsonPath", "VariableName", "LiteralValue", "FormatString", "NodeOutput", "Expression", "Source", "JsonPath", }); + new java.lang.String[] { "JsonPath", "VariableName", "LiteralValue", "FormatString", "NodeOutput", "Expression", "TypeToCastTo", "Source", "JsonPath", "TypeToCastTo", }); internal_static_littlehorse_VariableAssignment_FormatString_descriptor = internal_static_littlehorse_VariableAssignment_descriptor.getNestedTypes().get(0); internal_static_littlehorse_VariableAssignment_FormatString_fieldAccessorTable = new @@ -188,7 +192,7 @@ public static void registerAllExtensions( internal_static_littlehorse_VariableAssignment_Expression_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_VariableAssignment_Expression_descriptor, - new java.lang.String[] { "Lhs", "Operation", "Rhs", }); + new java.lang.String[] { "Lhs", "Operation", "Rhs", "TypeToCastTo", "TypeToCastTo", }); internal_static_littlehorse_VariableMutation_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_littlehorse_VariableMutation_fieldAccessorTable = new diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignment.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignment.java index 170fd87d2..9f340454f 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignment.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignment.java @@ -27,6 +27,7 @@ private VariableAssignment(com.google.protobuf.GeneratedMessageV3.Builder bui } private VariableAssignment() { jsonPath_ = ""; + typeToCastTo_ = 0; } @java.lang.Override @@ -1900,6 +1901,34 @@ public interface ExpressionOrBuilder extends * .littlehorse.VariableAssignment rhs = 3; */ io.littlehorse.sdk.common.proto.VariableAssignmentOrBuilder getRhsOrBuilder(); + + /** + *
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return Whether the typeToCastTo field is set. + */ + boolean hasTypeToCastTo(); + /** + *
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The enum numeric value on the wire for typeToCastTo. + */ + int getTypeToCastToValue(); + /** + *
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The typeToCastTo. + */ + io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo(); } /** *
@@ -1919,6 +1948,7 @@ private Expression(com.google.protobuf.GeneratedMessageV3.Builder builder) {
     }
     private Expression() {
       operation_ = 0;
+      typeToCastTo_ = 0;
     }
 
     @java.lang.Override
@@ -1941,6 +1971,7 @@ protected java.lang.Object newInstance(
               io.littlehorse.sdk.common.proto.VariableAssignment.Expression.class, io.littlehorse.sdk.common.proto.VariableAssignment.Expression.Builder.class);
     }
 
+    private int bitField0_;
     public static final int LHS_FIELD_NUMBER = 1;
     private io.littlehorse.sdk.common.proto.VariableAssignment lhs_;
     /**
@@ -2043,6 +2074,43 @@ public io.littlehorse.sdk.common.proto.VariableAssignmentOrBuilder getRhsOrBuild
       return rhs_ == null ? io.littlehorse.sdk.common.proto.VariableAssignment.getDefaultInstance() : rhs_;
     }
 
+    public static final int TYPE_TO_CAST_TO_FIELD_NUMBER = 4;
+    private int typeToCastTo_ = 0;
+    /**
+     * 
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return Whether the typeToCastTo field is set. + */ + @java.lang.Override public boolean hasTypeToCastTo() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The enum numeric value on the wire for typeToCastTo. + */ + @java.lang.Override public int getTypeToCastToValue() { + return typeToCastTo_; + } + /** + *
+     * Allows casting this expression to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The typeToCastTo. + */ + @java.lang.Override public io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo() { + io.littlehorse.sdk.common.proto.VariableType result = io.littlehorse.sdk.common.proto.VariableType.forNumber(typeToCastTo_); + return result == null ? io.littlehorse.sdk.common.proto.VariableType.UNRECOGNIZED : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -2066,6 +2134,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (rhs_ != null) { output.writeMessage(3, getRhs()); } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeEnum(4, typeToCastTo_); + } getUnknownFields().writeTo(output); } @@ -2087,6 +2158,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, getRhs()); } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, typeToCastTo_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2113,6 +2188,10 @@ public boolean equals(final java.lang.Object obj) { if (!getRhs() .equals(other.getRhs())) return false; } + if (hasTypeToCastTo() != other.hasTypeToCastTo()) return false; + if (hasTypeToCastTo()) { + if (typeToCastTo_ != other.typeToCastTo_) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2134,6 +2213,10 @@ public int hashCode() { hash = (37 * hash) + RHS_FIELD_NUMBER; hash = (53 * hash) + getRhs().hashCode(); } + if (hasTypeToCastTo()) { + hash = (37 * hash) + TYPE_TO_CAST_TO_FIELD_NUMBER; + hash = (53 * hash) + typeToCastTo_; + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -2280,6 +2363,7 @@ public Builder clear() { rhsBuilder_.dispose(); rhsBuilder_ = null; } + typeToCastTo_ = 0; return this; } @@ -2326,6 +2410,12 @@ private void buildPartial0(io.littlehorse.sdk.common.proto.VariableAssignment.Ex ? rhs_ : rhsBuilder_.build(); } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.typeToCastTo_ = typeToCastTo_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -2381,6 +2471,9 @@ public Builder mergeFrom(io.littlehorse.sdk.common.proto.VariableAssignment.Expr if (other.hasRhs()) { mergeRhs(other.getRhs()); } + if (other.hasTypeToCastTo()) { + setTypeToCastTo(other.getTypeToCastTo()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -2426,6 +2519,11 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 32: { + typeToCastTo_ = input.readEnum(); + bitField0_ |= 0x00000008; + break; + } // case 32 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -2825,6 +2923,90 @@ public io.littlehorse.sdk.common.proto.VariableAssignmentOrBuilder getRhsOrBuild } return rhsBuilder_; } + + private int typeToCastTo_ = 0; + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return Whether the typeToCastTo field is set. + */ + @java.lang.Override public boolean hasTypeToCastTo() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The enum numeric value on the wire for typeToCastTo. + */ + @java.lang.Override public int getTypeToCastToValue() { + return typeToCastTo_; + } + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @param value The enum numeric value on the wire for typeToCastTo to set. + * @return This builder for chaining. + */ + public Builder setTypeToCastToValue(int value) { + typeToCastTo_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return The typeToCastTo. + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo() { + io.littlehorse.sdk.common.proto.VariableType result = io.littlehorse.sdk.common.proto.VariableType.forNumber(typeToCastTo_); + return result == null ? io.littlehorse.sdk.common.proto.VariableType.UNRECOGNIZED : result; + } + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @param value The typeToCastTo to set. + * @return This builder for chaining. + */ + public Builder setTypeToCastTo(io.littlehorse.sdk.common.proto.VariableType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + typeToCastTo_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+       * Allows casting this expression to a specific type
+       * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 4; + * @return This builder for chaining. + */ + public Builder clearTypeToCastTo() { + bitField0_ = (bitField0_ & ~0x00000008); + typeToCastTo_ = 0; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { @@ -3239,6 +3421,43 @@ public io.littlehorse.sdk.common.proto.VariableAssignment.ExpressionOrBuilder ge return io.littlehorse.sdk.common.proto.VariableAssignment.Expression.getDefaultInstance(); } + public static final int TYPE_TO_CAST_TO_FIELD_NUMBER = 7; + private int typeToCastTo_ = 0; + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return Whether the typeToCastTo field is set. + */ + @java.lang.Override public boolean hasTypeToCastTo() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The enum numeric value on the wire for typeToCastTo. + */ + @java.lang.Override public int getTypeToCastToValue() { + return typeToCastTo_; + } + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The typeToCastTo. + */ + @java.lang.Override public io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo() { + io.littlehorse.sdk.common.proto.VariableType result = io.littlehorse.sdk.common.proto.VariableType.forNumber(typeToCastTo_); + return result == null ? io.littlehorse.sdk.common.proto.VariableType.UNRECOGNIZED : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -3271,6 +3490,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (sourceCase_ == 6) { output.writeMessage(6, (io.littlehorse.sdk.common.proto.VariableAssignment.Expression) source_); } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeEnum(7, typeToCastTo_); + } getUnknownFields().writeTo(output); } @@ -3302,6 +3524,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(6, (io.littlehorse.sdk.common.proto.VariableAssignment.Expression) source_); } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(7, typeToCastTo_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -3322,6 +3548,10 @@ public boolean equals(final java.lang.Object obj) { if (!getJsonPath() .equals(other.getJsonPath())) return false; } + if (hasTypeToCastTo() != other.hasTypeToCastTo()) return false; + if (hasTypeToCastTo()) { + if (typeToCastTo_ != other.typeToCastTo_) return false; + } if (!getSourceCase().equals(other.getSourceCase())) return false; switch (sourceCase_) { case 2: @@ -3362,6 +3592,10 @@ public int hashCode() { hash = (37 * hash) + JSON_PATH_FIELD_NUMBER; hash = (53 * hash) + getJsonPath().hashCode(); } + if (hasTypeToCastTo()) { + hash = (37 * hash) + TYPE_TO_CAST_TO_FIELD_NUMBER; + hash = (53 * hash) + typeToCastTo_; + } switch (sourceCase_) { case 2: hash = (37 * hash) + VARIABLE_NAME_FIELD_NUMBER; @@ -3540,6 +3774,7 @@ public Builder clear() { if (expressionBuilder_ != null) { expressionBuilder_.clear(); } + typeToCastTo_ = 0; sourceCase_ = 0; source_ = null; return this; @@ -3581,6 +3816,10 @@ private void buildPartial0(io.littlehorse.sdk.common.proto.VariableAssignment re result.jsonPath_ = jsonPath_; to_bitField0_ |= 0x00000001; } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.typeToCastTo_ = typeToCastTo_; + to_bitField0_ |= 0x00000002; + } result.bitField0_ |= to_bitField0_; } @@ -3654,6 +3893,9 @@ public Builder mergeFrom(io.littlehorse.sdk.common.proto.VariableAssignment othe bitField0_ |= 0x00000001; onChanged(); } + if (other.hasTypeToCastTo()) { + setTypeToCastTo(other.getTypeToCastTo()); + } switch (other.getSourceCase()) { case VARIABLE_NAME: { sourceCase_ = 2; @@ -3746,6 +3988,11 @@ public Builder mergeFrom( sourceCase_ = 6; break; } // case 50 + case 56: { + typeToCastTo_ = input.readEnum(); + bitField0_ |= 0x00000040; + break; + } // case 56 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -4721,6 +4968,90 @@ public io.littlehorse.sdk.common.proto.VariableAssignment.ExpressionOrBuilder ge onChanged(); return expressionBuilder_; } + + private int typeToCastTo_ = 0; + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return Whether the typeToCastTo field is set. + */ + @java.lang.Override public boolean hasTypeToCastTo() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The enum numeric value on the wire for typeToCastTo. + */ + @java.lang.Override public int getTypeToCastToValue() { + return typeToCastTo_; + } + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @param value The enum numeric value on the wire for typeToCastTo to set. + * @return This builder for chaining. + */ + public Builder setTypeToCastToValue(int value) { + typeToCastTo_ = value; + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The typeToCastTo. + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo() { + io.littlehorse.sdk.common.proto.VariableType result = io.littlehorse.sdk.common.proto.VariableType.forNumber(typeToCastTo_); + return result == null ? io.littlehorse.sdk.common.proto.VariableType.UNRECOGNIZED : result; + } + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @param value The typeToCastTo to set. + * @return This builder for chaining. + */ + public Builder setTypeToCastTo(io.littlehorse.sdk.common.proto.VariableType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + typeToCastTo_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * Allows casting this Variable Assignment to a specific type
+     * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return This builder for chaining. + */ + public Builder clearTypeToCastTo() { + bitField0_ = (bitField0_ & ~0x00000040); + typeToCastTo_ = 0; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignmentOrBuilder.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignmentOrBuilder.java index a7b17eee3..7735a8fca 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignmentOrBuilder.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/VariableAssignmentOrBuilder.java @@ -179,5 +179,33 @@ public interface VariableAssignmentOrBuilder extends */ io.littlehorse.sdk.common.proto.VariableAssignment.ExpressionOrBuilder getExpressionOrBuilder(); + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return Whether the typeToCastTo field is set. + */ + boolean hasTypeToCastTo(); + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The enum numeric value on the wire for typeToCastTo. + */ + int getTypeToCastToValue(); + /** + *
+   * Allows casting this Variable Assignment to a specific type
+   * 
+ * + * optional .littlehorse.VariableType type_to_cast_to = 7; + * @return The typeToCastTo. + */ + io.littlehorse.sdk.common.proto.VariableType getTypeToCastTo(); + io.littlehorse.sdk.common.proto.VariableAssignment.SourceCase getSourceCase(); } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/LHExpression.java b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/LHExpression.java index e143bc8f9..e23eaf158 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/LHExpression.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/LHExpression.java @@ -80,4 +80,25 @@ public interface LHExpression extends Serializable { * by `key` removed. */ LHExpression removeKey(Serializable key); + + /** + * Casts the expression to a string. Returns this LHExpression. + * + * @return this LHExpression. + */ + LHExpression asStr(); + + /** + * Casts the expression to an INT. Returns this LHExpression. + * + * @return this LHExpression. + */ + LHExpression asInt(); + + /** + * Casts the expression to a double. Returns this LHExpression. + * + * @return this LHExpression. + */ + LHExpression asDouble(); } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/NodeOutput.java b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/NodeOutput.java index ddb1ea51b..24b4ea36a 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/NodeOutput.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/NodeOutput.java @@ -1,10 +1,12 @@ package io.littlehorse.sdk.wfsdk; +import java.io.Serializable; + /** * `NodeOutput` represents the output of a Node execution. It can be used to set a timeout on a * node, or as input for a Variable Mutation. */ -public interface NodeOutput extends LHExpression { +public interface NodeOutput extends Serializable { /** * Valid only for output of the JSON_OBJ or JSON_ARR types. Returns a new NodeOutput handle * which points to Json element referred to by the json path. @@ -26,4 +28,81 @@ public interface NodeOutput extends LHExpression { * @return the NodeOutput. */ public NodeOutput timeout(int timeoutSeconds); + + /** + * Returns an expression whose value is the `other` added to this node's output. + * @param other the value to be added to this node's output. + * @return an expression whose value is the `other` added to this node's output. + */ + LHExpression add(Serializable other); + + /** + * Returns an expression whose value is the `other` subtracted from this node's output. + * @param other the value to be subtracted from this node's output. + * @return an expression whose value is the `other` subtracted from this node's output. + */ + LHExpression subtract(Serializable other); + + /** + * Returns an expression whose value is the `other` multiplied by this node's output. + * @param other the value to be multiplied by this node's output. + * @return an expression whose value is the `other` multiplied by this node's output. + */ + LHExpression multiply(Serializable other); + + /** + * Returns an expression whose value is this node's output divided by the `other`. + * @param other the value to divide this node's output by. + * @return an expression whose value is this node's output divided by the `other`. + */ + LHExpression divide(Serializable other); + + /** + * Returns an expression whose value is this node's output extended by the `other`. + * @param other the value to extend this node's output by. + * @return an expression whose value is this node's output extended by the `other`. + */ + LHExpression extend(Serializable other); + + /** + * Returns an expression whose value is this node's output with all occurrences of + * `other` removed. + * @param other the value to remove from this node's output. + * @return an expression whose value is this node's output with all occurrences of + * `other` removed. + */ + LHExpression removeIfPresent(Serializable other); + + /** + * Returns an expression whose value is this node's output with the index specified + * by `other` removed. + * + * Valid only for JSON_ARR expressions. + * @param index the index at which to insert the `other`. + * @return an expression whose value is this node's output with the `other` inserted + * at the specified `index`. + */ + LHExpression removeIndex(int index); + + /** + * Returns an expression whose value is this node's output with the index specified + * by `index` removed. + * + * Valid only for JSON_ARR expressions. + * @param index the index at which to remove the value. + * @return an expression whose value is this node's output with the value at the + * specified `index` removed. + */ + LHExpression removeIndex(LHExpression index); + + /** + * Returns an expression whose value is this node's output with the key specified + * by `key` removed. + * + * Valid only for JSON_OBJ expressions. + * @param key the key to remove from this node's output. + * @return an expression whose value is this node's output with the key specified + * by `key` removed. + */ + LHExpression removeKey(Serializable key); } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/BuilderUtil.java b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/BuilderUtil.java index 6e6f8dbae..0ea6fb813 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/BuilderUtil.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/BuilderUtil.java @@ -20,6 +20,9 @@ static VariableAssignment assignVariable(Object variable) { builder.setJsonPath(wrv.jsonPath); } builder.setVariableName(wrv.name); + if (wrv.getTypeToCastTo() != null) { + builder.setTypeToCastTo(wrv.getTypeToCastTo()); + } } else if (NodeOutputImpl.class.isAssignableFrom(variable.getClass())) { // We can use the new `VariableAssignment` feature: NodeOutputReference NodeOutputImpl nodeReference = (NodeOutputImpl) variable; @@ -43,6 +46,10 @@ static VariableAssignment assignVariable(Object variable) { .setLhs(assignVariable(expr.getLhs())) .setOperation(expr.getOperation()) .setRhs(assignVariable(expr.getRhs()))); + + if (expr.getTypeToCastTo() != null) { + builder.getExpressionBuilder().setTypeToCastTo(expr.getTypeToCastTo()); + } } else { try { VariableValue defVal = LHLibUtil.objToVarVal(variable); diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/LHExpressionImpl.java b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/LHExpressionImpl.java index 956a619ca..0c1576a89 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/LHExpressionImpl.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/LHExpressionImpl.java @@ -1,9 +1,11 @@ package io.littlehorse.sdk.wfsdk.internal; import io.littlehorse.sdk.common.proto.VariableMutationType; +import io.littlehorse.sdk.common.proto.VariableType; import io.littlehorse.sdk.wfsdk.LHExpression; import java.io.Serializable; import lombok.Getter; +import lombok.Setter; @Getter public class LHExpressionImpl implements LHExpression { @@ -12,6 +14,9 @@ public class LHExpressionImpl implements LHExpression { private Serializable rhs; private VariableMutationType operation; + @Setter + private VariableType typeToCastTo; + public LHExpressionImpl(Serializable lhs, VariableMutationType operation, Serializable rhs) { this.lhs = lhs; this.rhs = rhs; @@ -62,4 +67,22 @@ public LHExpression removeIndex(LHExpression index) { public LHExpression removeKey(Serializable key) { return new LHExpressionImpl(this, VariableMutationType.REMOVE_KEY, key); } + + @Override + public LHExpression asStr() { + this.typeToCastTo = VariableType.STR; + return this; + } + + @Override + public LHExpression asInt() { + this.typeToCastTo = VariableType.INT; + return this; + } + + @Override + public LHExpression asDouble() { + this.typeToCastTo = VariableType.DOUBLE; + return this; + } } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/WfRunVariableImpl.java b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/WfRunVariableImpl.java index 48f6bd5ec..47ff24505 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/WfRunVariableImpl.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/wfsdk/internal/WfRunVariableImpl.java @@ -31,6 +31,9 @@ class WfRunVariableImpl implements WfRunVariable { private List jsonIndexes = new ArrayList<>(); private WfRunVariableAccessLevel accessLevel; + @Getter + private VariableType typeToCastTo; + public String jsonPath; private final WorkflowThreadImpl parent; @@ -224,6 +227,27 @@ public LHExpression removeKey(Serializable key) { return new LHExpressionImpl(this, VariableMutationType.REMOVE_KEY, key); } + @Override + public LHExpression asInt() { + WfRunVariableImpl result = new WfRunVariableImpl(name, typeOrDefaultVal, parent); + result.typeToCastTo = VariableType.INT; + return result; + } + + @Override + public LHExpression asStr() { + WfRunVariableImpl result = new WfRunVariableImpl(name, typeOrDefaultVal, parent); + result.typeToCastTo = VariableType.STR; + return result; + } + + @Override + public LHExpression asDouble() { + WfRunVariableImpl result = new WfRunVariableImpl(name, typeOrDefaultVal, parent); + result.typeToCastTo = VariableType.DOUBLE; + return result; + } + public ThreadVarDef getSpec() { VariableDef.Builder varDef = VariableDef.newBuilder() .setType(this.getType()) diff --git a/sdk-js/src/proto/common_wfspec.ts b/sdk-js/src/proto/common_wfspec.ts index 5f890e2a0..8bbcf2036 100644 --- a/sdk-js/src/proto/common_wfspec.ts +++ b/sdk-js/src/proto/common_wfspec.ts @@ -221,7 +221,11 @@ export interface VariableAssignment { | VariableAssignment_NodeOutputReference | undefined; /** Assign the value of an Expression. */ - expression?: VariableAssignment_Expression | undefined; + expression?: + | VariableAssignment_Expression + | undefined; + /** Allows casting this Variable Assignment to a specific type */ + typeToCastTo?: VariableType | undefined; } /** A FormatString formats a template String with values from the WfRun. */ @@ -257,7 +261,11 @@ export interface VariableAssignment_Expression { /** The operator in the expression. */ operation: VariableMutationType; /** The right-hand-side of the expression. */ - rhs: VariableAssignment | undefined; + rhs: + | VariableAssignment + | undefined; + /** Allows casting this expression to a specific type */ + typeToCastTo?: VariableType | undefined; } /** @@ -493,6 +501,7 @@ function createBaseVariableAssignment(): VariableAssignment { formatString: undefined, nodeOutput: undefined, expression: undefined, + typeToCastTo: undefined, }; } @@ -516,6 +525,9 @@ export const VariableAssignment = { if (message.expression !== undefined) { VariableAssignment_Expression.encode(message.expression, writer.uint32(50).fork()).ldelim(); } + if (message.typeToCastTo !== undefined) { + writer.uint32(56).int32(variableTypeToNumber(message.typeToCastTo)); + } return writer; }, @@ -568,6 +580,13 @@ export const VariableAssignment = { message.expression = VariableAssignment_Expression.decode(reader, reader.uint32()); continue; + case 7: + if (tag !== 56) { + break; + } + + message.typeToCastTo = variableTypeFromJSON(reader.int32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -596,6 +615,7 @@ export const VariableAssignment = { message.expression = (object.expression !== undefined && object.expression !== null) ? VariableAssignment_Expression.fromPartial(object.expression) : undefined; + message.typeToCastTo = object.typeToCastTo ?? undefined; return message; }, }; @@ -704,7 +724,7 @@ export const VariableAssignment_NodeOutputReference = { }; function createBaseVariableAssignment_Expression(): VariableAssignment_Expression { - return { lhs: undefined, operation: VariableMutationType.ASSIGN, rhs: undefined }; + return { lhs: undefined, operation: VariableMutationType.ASSIGN, rhs: undefined, typeToCastTo: undefined }; } export const VariableAssignment_Expression = { @@ -718,6 +738,9 @@ export const VariableAssignment_Expression = { if (message.rhs !== undefined) { VariableAssignment.encode(message.rhs, writer.uint32(26).fork()).ldelim(); } + if (message.typeToCastTo !== undefined) { + writer.uint32(32).int32(variableTypeToNumber(message.typeToCastTo)); + } return writer; }, @@ -749,6 +772,13 @@ export const VariableAssignment_Expression = { message.rhs = VariableAssignment.decode(reader, reader.uint32()); continue; + case 4: + if (tag !== 32) { + break; + } + + message.typeToCastTo = variableTypeFromJSON(reader.int32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -770,6 +800,7 @@ export const VariableAssignment_Expression = { message.rhs = (object.rhs !== undefined && object.rhs !== null) ? VariableAssignment.fromPartial(object.rhs) : undefined; + message.typeToCastTo = object.typeToCastTo ?? undefined; return message; }, }; diff --git a/sdk-python/littlehorse/model/common_wfspec_pb2.py b/sdk-python/littlehorse/model/common_wfspec_pb2.py index 35fdfd883..1e542bea9 100644 --- a/sdk-python/littlehorse/model/common_wfspec_pb2.py +++ b/sdk-python/littlehorse/model/common_wfspec_pb2.py @@ -16,7 +16,7 @@ import littlehorse.model.object_id_pb2 as object__id__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13\x63ommon_wfspec.proto\x12\x0blittlehorse\x1a\x12\x63ommon_enums.proto\x1a\x0evariable.proto\x1a\x0fobject_id.proto\"\xa2\x05\n\x12VariableAssignment\x12\x16\n\tjson_path\x18\x01 \x01(\tH\x01\x88\x01\x01\x12\x17\n\rvariable_name\x18\x02 \x01(\tH\x00\x12\x33\n\rliteral_value\x18\x03 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x12\x45\n\rformat_string\x18\x04 \x01(\x0b\x32,.littlehorse.VariableAssignment.FormatStringH\x00\x12J\n\x0bnode_output\x18\x05 \x01(\x0b\x32\x33.littlehorse.VariableAssignment.NodeOutputReferenceH\x00\x12@\n\nexpression\x18\x06 \x01(\x0b\x32*.littlehorse.VariableAssignment.ExpressionH\x00\x1an\n\x0c\x46ormatString\x12/\n\x06\x66ormat\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12-\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x1f.littlehorse.VariableAssignment\x1a(\n\x13NodeOutputReference\x12\x11\n\tnode_name\x18\x01 \x01(\t\x1a\x9e\x01\n\nExpression\x12,\n\x03lhs\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12\x34\n\toperation\x18\x02 \x01(\x0e\x32!.littlehorse.VariableMutationType\x12,\n\x03rhs\x18\x03 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentB\x08\n\x06sourceB\x0c\n\n_json_path\"\x84\x03\n\x10VariableMutation\x12\x10\n\x08lhs_name\x18\x01 \x01(\t\x12\x1a\n\rlhs_json_path\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x34\n\toperation\x18\x03 \x01(\x0e\x32!.littlehorse.VariableMutationType\x12\x39\n\x0erhs_assignment\x18\x04 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x12\x33\n\rliteral_value\x18\x05 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x12\x45\n\x0bnode_output\x18\x06 \x01(\x0b\x32..littlehorse.VariableMutation.NodeOutputSourceH\x00\x1a\x36\n\x10NodeOutputSource\x12\x15\n\x08jsonpath\x18\n \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_jsonpathB\x0b\n\trhs_valueB\x10\n\x0e_lhs_json_path\"\xa4\x01\n\x0bVariableDef\x12\'\n\x04type\x18\x01 \x01(\x0e\x32\x19.littlehorse.VariableType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x36\n\rdefault_value\x18\x03 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x88\x01\x01\x12\x14\n\x0cmasked_value\x18\x04 \x01(\x08\x42\x10\n\x0e_default_value\"\xef\x04\n\x0fUTActionTrigger\x12\x34\n\x04task\x18\x01 \x01(\x0b\x32$.littlehorse.UTActionTrigger.UTATaskH\x00\x12\x38\n\x06\x63\x61ncel\x18\x02 \x01(\x0b\x32&.littlehorse.UTActionTrigger.UTACancelH\x00\x12<\n\x08reassign\x18\x03 \x01(\x0b\x32(.littlehorse.UTActionTrigger.UTAReassignH\x00\x12\x36\n\rdelay_seconds\x18\x05 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12\x31\n\x04hook\x18\x06 \x01(\x0e\x32#.littlehorse.UTActionTrigger.UTHook\x1a\x0b\n\tUTACancel\x1a`\n\x07UTATask\x12#\n\x04task\x18\x01 \x01(\x0b\x32\x15.littlehorse.TaskNode\x12\x30\n\tmutations\x18\x02 \x03(\x0b\x32\x1d.littlehorse.VariableMutation\x1a\x99\x01\n\x0bUTAReassign\x12\x35\n\x07user_id\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x88\x01\x01\x12\x38\n\nuser_group\x18\x02 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x01\x88\x01\x01\x42\n\n\x08_user_idB\r\n\x0b_user_group\".\n\x06UTHook\x12\x0e\n\nON_ARRIVAL\x10\x00\x12\x14\n\x10ON_TASK_ASSIGNED\x10\x01\x42\x08\n\x06\x61\x63tion\"c\n\x1d\x45xponentialBackoffRetryPolicy\x12\x18\n\x10\x62\x61se_interval_ms\x18\x01 \x01(\x05\x12\x14\n\x0cmax_delay_ms\x18\x02 \x01(\x03\x12\x12\n\nmultiplier\x18\x03 \x01(\x02\"\xc9\x02\n\x08TaskNode\x12-\n\x0btask_def_id\x18\x01 \x01(\x0b\x32\x16.littlehorse.TaskDefIdH\x00\x12\x37\n\x0c\x64ynamic_task\x18\x06 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x12\x17\n\x0ftimeout_seconds\x18\x02 \x01(\x05\x12\x0f\n\x07retries\x18\x03 \x01(\x05\x12L\n\x13\x65xponential_backoff\x18\x05 \x01(\x0b\x32*.littlehorse.ExponentialBackoffRetryPolicyH\x01\x88\x01\x01\x12\x32\n\tvariables\x18\x04 \x03(\x0b\x32\x1f.littlehorse.VariableAssignmentB\x11\n\x0ftask_to_executeB\x16\n\x14_exponential_backoff*\x98\x01\n\x14VariableMutationType\x12\n\n\x06\x41SSIGN\x10\x00\x12\x07\n\x03\x41\x44\x44\x10\x01\x12\n\n\x06\x45XTEND\x10\x02\x12\x0c\n\x08SUBTRACT\x10\x03\x12\x0c\n\x08MULTIPLY\x10\x04\x12\n\n\x06\x44IVIDE\x10\x05\x12\x15\n\x11REMOVE_IF_PRESENT\x10\x06\x12\x10\n\x0cREMOVE_INDEX\x10\x07\x12\x0e\n\nREMOVE_KEY\x10\x08*\x84\x01\n\nComparator\x12\r\n\tLESS_THAN\x10\x00\x12\x10\n\x0cGREATER_THAN\x10\x01\x12\x10\n\x0cLESS_THAN_EQ\x10\x02\x12\x13\n\x0fGREATER_THAN_EQ\x10\x03\x12\n\n\x06\x45QUALS\x10\x04\x12\x0e\n\nNOT_EQUALS\x10\x05\x12\x06\n\x02IN\x10\x06\x12\n\n\x06NOT_IN\x10\x07\x42I\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x18LittleHorse.Common.Protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13\x63ommon_wfspec.proto\x12\x0blittlehorse\x1a\x12\x63ommon_enums.proto\x1a\x0evariable.proto\x1a\x0fobject_id.proto\"\xbc\x06\n\x12VariableAssignment\x12\x16\n\tjson_path\x18\x01 \x01(\tH\x01\x88\x01\x01\x12\x17\n\rvariable_name\x18\x02 \x01(\tH\x00\x12\x33\n\rliteral_value\x18\x03 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x12\x45\n\rformat_string\x18\x04 \x01(\x0b\x32,.littlehorse.VariableAssignment.FormatStringH\x00\x12J\n\x0bnode_output\x18\x05 \x01(\x0b\x32\x33.littlehorse.VariableAssignment.NodeOutputReferenceH\x00\x12@\n\nexpression\x18\x06 \x01(\x0b\x32*.littlehorse.VariableAssignment.ExpressionH\x00\x12\x37\n\x0ftype_to_cast_to\x18\x07 \x01(\x0e\x32\x19.littlehorse.VariableTypeH\x02\x88\x01\x01\x1an\n\x0c\x46ormatString\x12/\n\x06\x66ormat\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12-\n\x04\x61rgs\x18\x02 \x03(\x0b\x32\x1f.littlehorse.VariableAssignment\x1a(\n\x13NodeOutputReference\x12\x11\n\tnode_name\x18\x01 \x01(\t\x1a\xeb\x01\n\nExpression\x12,\n\x03lhs\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12\x34\n\toperation\x18\x02 \x01(\x0e\x32!.littlehorse.VariableMutationType\x12,\n\x03rhs\x18\x03 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12\x37\n\x0ftype_to_cast_to\x18\x04 \x01(\x0e\x32\x19.littlehorse.VariableTypeH\x00\x88\x01\x01\x42\x12\n\x10_type_to_cast_toB\x08\n\x06sourceB\x0c\n\n_json_pathB\x12\n\x10_type_to_cast_to\"\x84\x03\n\x10VariableMutation\x12\x10\n\x08lhs_name\x18\x01 \x01(\t\x12\x1a\n\rlhs_json_path\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x34\n\toperation\x18\x03 \x01(\x0e\x32!.littlehorse.VariableMutationType\x12\x39\n\x0erhs_assignment\x18\x04 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x12\x33\n\rliteral_value\x18\x05 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x12\x45\n\x0bnode_output\x18\x06 \x01(\x0b\x32..littlehorse.VariableMutation.NodeOutputSourceH\x00\x1a\x36\n\x10NodeOutputSource\x12\x15\n\x08jsonpath\x18\n \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_jsonpathB\x0b\n\trhs_valueB\x10\n\x0e_lhs_json_path\"\xa4\x01\n\x0bVariableDef\x12\'\n\x04type\x18\x01 \x01(\x0e\x32\x19.littlehorse.VariableType\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x36\n\rdefault_value\x18\x03 \x01(\x0b\x32\x1a.littlehorse.VariableValueH\x00\x88\x01\x01\x12\x14\n\x0cmasked_value\x18\x04 \x01(\x08\x42\x10\n\x0e_default_value\"\xef\x04\n\x0fUTActionTrigger\x12\x34\n\x04task\x18\x01 \x01(\x0b\x32$.littlehorse.UTActionTrigger.UTATaskH\x00\x12\x38\n\x06\x63\x61ncel\x18\x02 \x01(\x0b\x32&.littlehorse.UTActionTrigger.UTACancelH\x00\x12<\n\x08reassign\x18\x03 \x01(\x0b\x32(.littlehorse.UTActionTrigger.UTAReassignH\x00\x12\x36\n\rdelay_seconds\x18\x05 \x01(\x0b\x32\x1f.littlehorse.VariableAssignment\x12\x31\n\x04hook\x18\x06 \x01(\x0e\x32#.littlehorse.UTActionTrigger.UTHook\x1a\x0b\n\tUTACancel\x1a`\n\x07UTATask\x12#\n\x04task\x18\x01 \x01(\x0b\x32\x15.littlehorse.TaskNode\x12\x30\n\tmutations\x18\x02 \x03(\x0b\x32\x1d.littlehorse.VariableMutation\x1a\x99\x01\n\x0bUTAReassign\x12\x35\n\x07user_id\x18\x01 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x88\x01\x01\x12\x38\n\nuser_group\x18\x02 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x01\x88\x01\x01\x42\n\n\x08_user_idB\r\n\x0b_user_group\".\n\x06UTHook\x12\x0e\n\nON_ARRIVAL\x10\x00\x12\x14\n\x10ON_TASK_ASSIGNED\x10\x01\x42\x08\n\x06\x61\x63tion\"c\n\x1d\x45xponentialBackoffRetryPolicy\x12\x18\n\x10\x62\x61se_interval_ms\x18\x01 \x01(\x05\x12\x14\n\x0cmax_delay_ms\x18\x02 \x01(\x03\x12\x12\n\nmultiplier\x18\x03 \x01(\x02\"\xc9\x02\n\x08TaskNode\x12-\n\x0btask_def_id\x18\x01 \x01(\x0b\x32\x16.littlehorse.TaskDefIdH\x00\x12\x37\n\x0c\x64ynamic_task\x18\x06 \x01(\x0b\x32\x1f.littlehorse.VariableAssignmentH\x00\x12\x17\n\x0ftimeout_seconds\x18\x02 \x01(\x05\x12\x0f\n\x07retries\x18\x03 \x01(\x05\x12L\n\x13\x65xponential_backoff\x18\x05 \x01(\x0b\x32*.littlehorse.ExponentialBackoffRetryPolicyH\x01\x88\x01\x01\x12\x32\n\tvariables\x18\x04 \x03(\x0b\x32\x1f.littlehorse.VariableAssignmentB\x11\n\x0ftask_to_executeB\x16\n\x14_exponential_backoff*\x98\x01\n\x14VariableMutationType\x12\n\n\x06\x41SSIGN\x10\x00\x12\x07\n\x03\x41\x44\x44\x10\x01\x12\n\n\x06\x45XTEND\x10\x02\x12\x0c\n\x08SUBTRACT\x10\x03\x12\x0c\n\x08MULTIPLY\x10\x04\x12\n\n\x06\x44IVIDE\x10\x05\x12\x15\n\x11REMOVE_IF_PRESENT\x10\x06\x12\x10\n\x0cREMOVE_INDEX\x10\x07\x12\x0e\n\nREMOVE_KEY\x10\x08*\x84\x01\n\nComparator\x12\r\n\tLESS_THAN\x10\x00\x12\x10\n\x0cGREATER_THAN\x10\x01\x12\x10\n\x0cLESS_THAN_EQ\x10\x02\x12\x13\n\x0fGREATER_THAN_EQ\x10\x03\x12\n\n\x06\x45QUALS\x10\x04\x12\x0e\n\nNOT_EQUALS\x10\x05\x12\x06\n\x02IN\x10\x06\x12\n\n\x06NOT_IN\x10\x07\x42I\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x18LittleHorse.Common.Protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -25,36 +25,36 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\037io.littlehorse.sdk.common.protoP\001Z\t.;lhproto\252\002\030LittleHorse.Common.Proto' - _globals['_VARIABLEMUTATIONTYPE']._serialized_start=2384 - _globals['_VARIABLEMUTATIONTYPE']._serialized_end=2536 - _globals['_COMPARATOR']._serialized_start=2539 - _globals['_COMPARATOR']._serialized_end=2671 + _globals['_VARIABLEMUTATIONTYPE']._serialized_start=2538 + _globals['_VARIABLEMUTATIONTYPE']._serialized_end=2690 + _globals['_COMPARATOR']._serialized_start=2693 + _globals['_COMPARATOR']._serialized_end=2825 _globals['_VARIABLEASSIGNMENT']._serialized_start=90 - _globals['_VARIABLEASSIGNMENT']._serialized_end=764 - _globals['_VARIABLEASSIGNMENT_FORMATSTRING']._serialized_start=427 - _globals['_VARIABLEASSIGNMENT_FORMATSTRING']._serialized_end=537 - _globals['_VARIABLEASSIGNMENT_NODEOUTPUTREFERENCE']._serialized_start=539 - _globals['_VARIABLEASSIGNMENT_NODEOUTPUTREFERENCE']._serialized_end=579 - _globals['_VARIABLEASSIGNMENT_EXPRESSION']._serialized_start=582 - _globals['_VARIABLEASSIGNMENT_EXPRESSION']._serialized_end=740 - _globals['_VARIABLEMUTATION']._serialized_start=767 - _globals['_VARIABLEMUTATION']._serialized_end=1155 - _globals['_VARIABLEMUTATION_NODEOUTPUTSOURCE']._serialized_start=1070 - _globals['_VARIABLEMUTATION_NODEOUTPUTSOURCE']._serialized_end=1124 - _globals['_VARIABLEDEF']._serialized_start=1158 - _globals['_VARIABLEDEF']._serialized_end=1322 - _globals['_UTACTIONTRIGGER']._serialized_start=1325 - _globals['_UTACTIONTRIGGER']._serialized_end=1948 - _globals['_UTACTIONTRIGGER_UTACANCEL']._serialized_start=1625 - _globals['_UTACTIONTRIGGER_UTACANCEL']._serialized_end=1636 - _globals['_UTACTIONTRIGGER_UTATASK']._serialized_start=1638 - _globals['_UTACTIONTRIGGER_UTATASK']._serialized_end=1734 - _globals['_UTACTIONTRIGGER_UTAREASSIGN']._serialized_start=1737 - _globals['_UTACTIONTRIGGER_UTAREASSIGN']._serialized_end=1890 - _globals['_UTACTIONTRIGGER_UTHOOK']._serialized_start=1892 - _globals['_UTACTIONTRIGGER_UTHOOK']._serialized_end=1938 - _globals['_EXPONENTIALBACKOFFRETRYPOLICY']._serialized_start=1950 - _globals['_EXPONENTIALBACKOFFRETRYPOLICY']._serialized_end=2049 - _globals['_TASKNODE']._serialized_start=2052 - _globals['_TASKNODE']._serialized_end=2381 + _globals['_VARIABLEASSIGNMENT']._serialized_end=918 + _globals['_VARIABLEASSIGNMENT_FORMATSTRING']._serialized_start=484 + _globals['_VARIABLEASSIGNMENT_FORMATSTRING']._serialized_end=594 + _globals['_VARIABLEASSIGNMENT_NODEOUTPUTREFERENCE']._serialized_start=596 + _globals['_VARIABLEASSIGNMENT_NODEOUTPUTREFERENCE']._serialized_end=636 + _globals['_VARIABLEASSIGNMENT_EXPRESSION']._serialized_start=639 + _globals['_VARIABLEASSIGNMENT_EXPRESSION']._serialized_end=874 + _globals['_VARIABLEMUTATION']._serialized_start=921 + _globals['_VARIABLEMUTATION']._serialized_end=1309 + _globals['_VARIABLEMUTATION_NODEOUTPUTSOURCE']._serialized_start=1224 + _globals['_VARIABLEMUTATION_NODEOUTPUTSOURCE']._serialized_end=1278 + _globals['_VARIABLEDEF']._serialized_start=1312 + _globals['_VARIABLEDEF']._serialized_end=1476 + _globals['_UTACTIONTRIGGER']._serialized_start=1479 + _globals['_UTACTIONTRIGGER']._serialized_end=2102 + _globals['_UTACTIONTRIGGER_UTACANCEL']._serialized_start=1779 + _globals['_UTACTIONTRIGGER_UTACANCEL']._serialized_end=1790 + _globals['_UTACTIONTRIGGER_UTATASK']._serialized_start=1792 + _globals['_UTACTIONTRIGGER_UTATASK']._serialized_end=1888 + _globals['_UTACTIONTRIGGER_UTAREASSIGN']._serialized_start=1891 + _globals['_UTACTIONTRIGGER_UTAREASSIGN']._serialized_end=2044 + _globals['_UTACTIONTRIGGER_UTHOOK']._serialized_start=2046 + _globals['_UTACTIONTRIGGER_UTHOOK']._serialized_end=2092 + _globals['_EXPONENTIALBACKOFFRETRYPOLICY']._serialized_start=2104 + _globals['_EXPONENTIALBACKOFFRETRYPOLICY']._serialized_end=2203 + _globals['_TASKNODE']._serialized_start=2206 + _globals['_TASKNODE']._serialized_end=2535 # @@protoc_insertion_point(module_scope) diff --git a/sdk-python/littlehorse/model/common_wfspec_pb2.pyi b/sdk-python/littlehorse/model/common_wfspec_pb2.pyi index 6462238a7..799d19cda 100644 --- a/sdk-python/littlehorse/model/common_wfspec_pb2.pyi +++ b/sdk-python/littlehorse/model/common_wfspec_pb2.pyi @@ -50,7 +50,7 @@ IN: Comparator NOT_IN: Comparator class VariableAssignment(_message.Message): - __slots__ = ["json_path", "variable_name", "literal_value", "format_string", "node_output", "expression"] + __slots__ = ["json_path", "variable_name", "literal_value", "format_string", "node_output", "expression", "type_to_cast_to"] class FormatString(_message.Message): __slots__ = ["format", "args"] FORMAT_FIELD_NUMBER: _ClassVar[int] @@ -64,27 +64,31 @@ class VariableAssignment(_message.Message): node_name: str def __init__(self, node_name: _Optional[str] = ...) -> None: ... class Expression(_message.Message): - __slots__ = ["lhs", "operation", "rhs"] + __slots__ = ["lhs", "operation", "rhs", "type_to_cast_to"] LHS_FIELD_NUMBER: _ClassVar[int] OPERATION_FIELD_NUMBER: _ClassVar[int] RHS_FIELD_NUMBER: _ClassVar[int] + TYPE_TO_CAST_TO_FIELD_NUMBER: _ClassVar[int] lhs: VariableAssignment operation: VariableMutationType rhs: VariableAssignment - def __init__(self, lhs: _Optional[_Union[VariableAssignment, _Mapping]] = ..., operation: _Optional[_Union[VariableMutationType, str]] = ..., rhs: _Optional[_Union[VariableAssignment, _Mapping]] = ...) -> None: ... + type_to_cast_to: _common_enums_pb2.VariableType + def __init__(self, lhs: _Optional[_Union[VariableAssignment, _Mapping]] = ..., operation: _Optional[_Union[VariableMutationType, str]] = ..., rhs: _Optional[_Union[VariableAssignment, _Mapping]] = ..., type_to_cast_to: _Optional[_Union[_common_enums_pb2.VariableType, str]] = ...) -> None: ... JSON_PATH_FIELD_NUMBER: _ClassVar[int] VARIABLE_NAME_FIELD_NUMBER: _ClassVar[int] LITERAL_VALUE_FIELD_NUMBER: _ClassVar[int] FORMAT_STRING_FIELD_NUMBER: _ClassVar[int] NODE_OUTPUT_FIELD_NUMBER: _ClassVar[int] EXPRESSION_FIELD_NUMBER: _ClassVar[int] + TYPE_TO_CAST_TO_FIELD_NUMBER: _ClassVar[int] json_path: str variable_name: str literal_value: _variable_pb2.VariableValue format_string: VariableAssignment.FormatString node_output: VariableAssignment.NodeOutputReference expression: VariableAssignment.Expression - def __init__(self, json_path: _Optional[str] = ..., variable_name: _Optional[str] = ..., literal_value: _Optional[_Union[_variable_pb2.VariableValue, _Mapping]] = ..., format_string: _Optional[_Union[VariableAssignment.FormatString, _Mapping]] = ..., node_output: _Optional[_Union[VariableAssignment.NodeOutputReference, _Mapping]] = ..., expression: _Optional[_Union[VariableAssignment.Expression, _Mapping]] = ...) -> None: ... + type_to_cast_to: _common_enums_pb2.VariableType + def __init__(self, json_path: _Optional[str] = ..., variable_name: _Optional[str] = ..., literal_value: _Optional[_Union[_variable_pb2.VariableValue, _Mapping]] = ..., format_string: _Optional[_Union[VariableAssignment.FormatString, _Mapping]] = ..., node_output: _Optional[_Union[VariableAssignment.NodeOutputReference, _Mapping]] = ..., expression: _Optional[_Union[VariableAssignment.Expression, _Mapping]] = ..., type_to_cast_to: _Optional[_Union[_common_enums_pb2.VariableType, str]] = ...) -> None: ... class VariableMutation(_message.Message): __slots__ = ["lhs_name", "lhs_json_path", "operation", "rhs_assignment", "literal_value", "node_output"] diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/ThreadRunModel.java b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/ThreadRunModel.java index ef2637e66..a01cc1446 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/ThreadRunModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/ThreadRunModel.java @@ -761,77 +761,77 @@ public VariableValueModel assignVariable(VariableAssignmentModel assn) throws LH return assignVariable(assn, new HashMap<>()); } - public VariableValueModel assignVariable(VariableAssignmentModel assn, Map txnCache) - throws LHVarSubError { - VariableValueModel val = null; - switch (assn.getRhsSourceType()) { - case LITERAL_VALUE: - val = assn.getRhsLiteralValue(); - break; - case VARIABLE_NAME: - if (txnCache.containsKey(assn.getVariableName())) { - val = txnCache.get(assn.getVariableName()); - } else { - val = getVariable(assn.getVariableName()).getValue(); - } - - if (val == null) { - throw new LHVarSubError(null, "Variable " + assn.getVariableName() + " not in scope!"); - } - - break; - case FORMAT_STRING: - // first, assign the format string - VariableValueModel formatStringVarVal = - assignVariable(assn.getFormatString().getFormat(), txnCache); - if (formatStringVarVal.getType() != VariableType.STR) { - throw new LHVarSubError( - null, "Format String template isn't a STR; it's a " + formatStringVarVal.getType()); - } - - List formatArgs = new ArrayList<>(); - - // second, assign the vars - for (VariableAssignmentModel argAssn : assn.getFormatString().getArgs()) { - VariableValueModel variableValue = assignVariable(argAssn, txnCache); - formatArgs.add(variableValue.getVal()); - } - - // Finally, format the String. - try { - val = new VariableValueModel( - MessageFormat.format(formatStringVarVal.getStrVal(), formatArgs.toArray(new Object[0]))); - } catch (RuntimeException e) { - throw new LHVarSubError(e, "Error formatting variable"); - } - break; - case NODE_OUTPUT: - String nodeReferenceName = assn.getNodeOutputReference().getNodeName(); - NodeRunModel referencedNodeRun = getMostRecentNodeRun(nodeReferenceName); - Optional output = referencedNodeRun.getOutput(processorContext); - if (output.isEmpty()) { - throw new LHVarSubError( - null, - "Specified node " + nodeReferenceName + " of type " + referencedNodeRun.getType() - + ", number " + referencedNodeRun.getId().getPosition() + " has no output."); - } - val = output.get(); - break; - case EXPRESSION: - ExpressionModel expression = assn.getExpression(); - val = expression.evaluate(varAssn -> assignVariable(varAssn, txnCache)); - break; - case SOURCE_NOT_SET: - // This should have been caught by the WfSpecModel#validate() - throw new IllegalStateException("Invalid WfSpec with un-set VariableAssignment."); - } - - if (assn.getJsonPath() != null) { - val = val.jsonPath(assn.getJsonPath()); - } - - return val; - } + // private VariableValueModel assignVariable(VariableAssignmentModel assn, Map txnCache) + // throws LHVarSubError { + // VariableValueModel val = null; + // switch (assn.getRhsSourceType()) { + // case LITERAL_VALUE: + // val = assn.getRhsLiteralValue(); + // break; + // case VARIABLE_NAME: + // if (txnCache.containsKey(assn.getVariableName())) { + // val = txnCache.get(assn.getVariableName()); + // } else { + // val = getVariable(assn.getVariableName()).getValue(); + // } + + // if (val == null) { + // throw new LHVarSubError(null, "Variable " + assn.getVariableName() + " not in scope!"); + // } + + // break; + // case FORMAT_STRING: + // // first, assign the format string + // VariableValueModel formatStringVarVal = + // assignVariable(assn.getFormatString().getFormat(), txnCache); + // if (formatStringVarVal.getType() != VariableType.STR) { + // throw new LHVarSubError( + // null, "Format String template isn't a STR; it's a " + formatStringVarVal.getType()); + // } + + // List formatArgs = new ArrayList<>(); + + // // second, assign the vars + // for (VariableAssignmentModel argAssn : assn.getFormatString().getArgs()) { + // VariableValueModel variableValue = assignVariable(argAssn, txnCache); + // formatArgs.add(variableValue.getVal()); + // } + + // // Finally, format the String. + // try { + // val = new VariableValueModel( + // MessageFormat.format(formatStringVarVal.getStrVal(), formatArgs.toArray(new Object[0]))); + // } catch (RuntimeException e) { + // throw new LHVarSubError(e, "Error formatting variable"); + // } + // break; + // case NODE_OUTPUT: + // String nodeReferenceName = assn.getNodeOutputReference().getNodeName(); + // NodeRunModel referencedNodeRun = getMostRecentNodeRun(nodeReferenceName); + // Optional output = referencedNodeRun.getOutput(processorContext); + // if (output.isEmpty()) { + // throw new LHVarSubError( + // null, + // "Specified node " + nodeReferenceName + " of type " + referencedNodeRun.getType() + // + ", number " + referencedNodeRun.getId().getPosition() + " has no output."); + // } + // val = output.get(); + // break; + // case EXPRESSION: + // ExpressionModel expression = assn.getExpression(); + // val = expression.evaluate(varAssn -> assignVariable(varAssn, txnCache)); + // break; + // case SOURCE_NOT_SET: + // // This should have been caught by the WfSpecModel#validate() + // throw new IllegalStateException("Invalid WfSpec with un-set VariableAssignment."); + // } + + // if (assn.getJsonPath() != null) { + // val = val.jsonPath(assn.getJsonPath()); + // } + + // return val; + // } public void putNodeRun(NodeRunModel nr) { processorContext.getableManager().put(nr); diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableAssignerFunc.java b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableAssignerFunc.java deleted file mode 100644 index 32e5af4de..000000000 --- a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableAssignerFunc.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.littlehorse.common.model.getable.core.wfrun; - -import io.littlehorse.common.exceptions.LHVarSubError; -import io.littlehorse.common.model.getable.core.variable.VariableValueModel; -import io.littlehorse.common.model.getable.global.wfspec.variable.VariableAssignmentModel; - -public interface VariableAssignerFunc { - VariableValueModel assign(VariableAssignmentModel varAssn) throws LHVarSubError; -} diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableFetcher.java b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableFetcher.java new file mode 100644 index 000000000..a861a462a --- /dev/null +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableFetcher.java @@ -0,0 +1,31 @@ +package io.littlehorse.common.model.getable.core.wfrun; + +import io.littlehorse.common.exceptions.LHVarSubError; +import io.littlehorse.common.model.getable.core.variable.VariableValueModel; + +/** + * Functional interface used to assign the value of a single variable. Useful for + * making class responsibilities more explicit and keeping our Grumpy Maintainer + * somewhat happy. + */ +public interface VariableFetcher { + + /** + * Fetches the value of the variable with the provided name. + * @param variableName The name of the variable whose value we want to fetch. + * @return The value of the variable. + * @throws LHVarSubError If the variable does not exist or has not been assigned + * a value. + */ + VariableValueModel fetchVariable(String variableName) throws LHVarSubError; + + /** + * Fetches the output of the most recent instance NodeRun associated with the + * provided Node name. + * @param nodeName The name of the node whose output we want to fetch. + * @return The output of the most recent instance of the node. + * @throws LHVarSubError If the node does not exist, has not been run, or returned + * no output. + */ + VariableValueModel fetchNodeOutput(String nodeName) throws LHVarSubError; +} diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableSetter.java b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableSetter.java new file mode 100644 index 000000000..a226987cf --- /dev/null +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/VariableSetter.java @@ -0,0 +1,21 @@ +package io.littlehorse.common.model.getable.core.wfrun; + +import io.littlehorse.common.exceptions.LHVarSubError; +import io.littlehorse.common.model.getable.core.variable.VariableValueModel; + +/** + * Functional interface used to assign the value of a single variable. Useful for + * making class responsibilities more explicit and keeping our Grumpy Maintainer + * somewhat happy. + */ +public interface VariableSetter { + + /** + * Sets the value of the variable with the provided name. + * @param variableName The name of the variable whose value we want to set. + * @param value The value to assign to the variable. + * @throws LHVarSubError If the variable does not exist or has not been assigned + * a value. + */ + void setVariable(String variableName, VariableValueModel value) throws LHVarSubError; +} diff --git a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/ExpressionModel.java b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/ExpressionModel.java index 81296b7d6..a7a67e8cd 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/ExpressionModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/ExpressionModel.java @@ -4,7 +4,7 @@ import io.littlehorse.common.LHSerializable; import io.littlehorse.common.exceptions.LHVarSubError; import io.littlehorse.common.model.getable.core.variable.VariableValueModel; -import io.littlehorse.common.model.getable.core.wfrun.VariableAssignerFunc; +import io.littlehorse.common.model.getable.core.wfrun.VariableFetcher; import io.littlehorse.sdk.common.proto.VariableAssignment.Expression; import io.littlehorse.sdk.common.proto.VariableMutationType; import io.littlehorse.sdk.common.proto.VariableType; @@ -39,9 +39,9 @@ public void initFrom(Message proto, ExecutionContext ignored) { operation = p.getOperation(); } - public VariableValueModel evaluate(VariableAssignerFunc variableFinder) throws LHVarSubError { - VariableValueModel lhsVal = variableFinder.assign(lhs); - VariableValueModel rhsVal = variableFinder.assign(rhs); + public VariableValueModel evaluate(VariableFetcher variableFinder) throws LHVarSubError { + VariableValueModel lhsVal = lhs.assignVariable(variableFinder); + VariableValueModel rhsVal = rhs.assignVariable(variableFinder); VariableType typeToCoerceTo = lhsVal.getType(); diff --git a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/FormatStringModel.java b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/FormatStringModel.java index 343b3f071..afbd42575 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/FormatStringModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/FormatStringModel.java @@ -2,9 +2,15 @@ import com.google.protobuf.Message; import io.littlehorse.common.LHSerializable; +import io.littlehorse.common.exceptions.LHVarSubError; +import io.littlehorse.common.model.getable.core.variable.VariableValueModel; +import io.littlehorse.common.model.getable.core.wfrun.VariableFetcher; import io.littlehorse.sdk.common.proto.VariableAssignment; +import io.littlehorse.sdk.common.proto.VariableType; import io.littlehorse.sdk.common.proto.VariableAssignment.FormatString; import io.littlehorse.server.streams.topology.core.ExecutionContext; + +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import lombok.Data; @@ -21,10 +27,12 @@ public FormatStringModel() { args = new ArrayList<>(); } + @Override public Class getProtoBaseClass() { return FormatString.class; } + @Override public FormatString.Builder toProto() { FormatString.Builder out = FormatString.newBuilder().setFormat(format.toProto()); for (VariableAssignmentModel arg : args) { @@ -41,4 +49,28 @@ public void initFrom(Message proto, ExecutionContext context) { args.add(VariableAssignmentModel.fromProto(arg, context)); } } + + public VariableValueModel evaluate(VariableFetcher fetcher) throws LHVarSubError { + VariableValueModel formatStringVarVal = this.format.assignVariable(fetcher); + if (formatStringVarVal.getType() != VariableType.STR) { + throw new LHVarSubError( + null, "Format String template isn't a STR; it's a " + formatStringVarVal.getType()); + } + + List formatArgs = new ArrayList<>(); + + // second, assign the vars + for (VariableAssignmentModel argAssn : this.args) { + VariableValueModel variableValue = argAssn.assignVariable(fetcher); + formatArgs.add(variableValue.getVal()); + } + + // Finally, format the String. + try { + return new VariableValueModel( + MessageFormat.format(formatStringVarVal.getStrVal(), formatArgs.toArray(new Object[0]))); + } catch (RuntimeException e) { + throw new LHVarSubError(e, "Error formatting variable"); + } + } } diff --git a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableAssignmentModel.java b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableAssignmentModel.java index f5bf8efe9..f78b97f8f 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableAssignmentModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableAssignmentModel.java @@ -4,13 +4,21 @@ import io.grpc.Status; import io.littlehorse.common.LHSerializable; import io.littlehorse.common.exceptions.LHApiException; +import io.littlehorse.common.exceptions.LHVarSubError; +import io.littlehorse.common.model.getable.core.noderun.NodeRunModel; import io.littlehorse.common.model.getable.core.variable.VariableValueModel; +import io.littlehorse.common.model.getable.core.wfrun.VariableFetcher; import io.littlehorse.common.model.getable.global.wfspec.thread.ThreadSpecModel; import io.littlehorse.sdk.common.proto.VariableAssignment; import io.littlehorse.sdk.common.proto.VariableAssignment.SourceCase; import io.littlehorse.sdk.common.proto.VariableType; +import io.littlehorse.sdk.common.proto.VariableValue; import io.littlehorse.server.streams.topology.core.ExecutionContext; + +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; +import java.util.Optional; import java.util.Set; import lombok.Data; import lombok.EqualsAndHashCode; @@ -142,4 +150,42 @@ public boolean canBeType(VariableType type, ThreadSpecModel tspec) { return baseType == type; } + + public VariableValueModel assignVariable(VariableFetcher fetcher) throws LHVarSubError{ + VariableValueModel val = null; + switch (this.getRhsSourceType()) { + case LITERAL_VALUE: + val = this.getRhsLiteralValue(); + break; + + case VARIABLE_NAME: + val = fetcher.fetchVariable(variableName); + if (val == null) { + throw new LHVarSubError(null, "Variable " + this.getVariableName() + " not in scope!"); + } + break; + + case FORMAT_STRING: + // first, assign the format string + val = this.getFormatString().evaluate(fetcher); + break; + case NODE_OUTPUT: + String nodeReferenceName = this.getNodeOutputReference().getNodeName(); + val = fetcher.fetchNodeOutput(nodeReferenceName); + break; + case EXPRESSION: + ExpressionModel expression = this.getExpression(); + val = expression.evaluate(fetcher); + break; + case SOURCE_NOT_SET: + // This should have been caught by the WfSpecModel#validate() + throw new IllegalStateException("Invalid WfSpec with un-set VariableAssignment."); + } + + if (this.getJsonPath() != null) { + val = val.jsonPath(this.getJsonPath()); + } + + return val; + } } diff --git a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableMutationModel.java b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableMutationModel.java index dc17ff822..d0a7eb2d7 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableMutationModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/global/wfspec/variable/VariableMutationModel.java @@ -6,6 +6,8 @@ import io.littlehorse.common.model.getable.core.variable.VariableModel; import io.littlehorse.common.model.getable.core.variable.VariableValueModel; import io.littlehorse.common.model.getable.core.wfrun.ThreadRunModel; +import io.littlehorse.common.model.getable.core.wfrun.VariableFetcher; +import io.littlehorse.common.model.getable.core.wfrun.VariableSetter; import io.littlehorse.sdk.common.proto.VariableMutation; import io.littlehorse.sdk.common.proto.VariableMutation.RhsValueCase; import io.littlehorse.sdk.common.proto.VariableMutationType; @@ -110,32 +112,27 @@ private VariableValueModel getVarValFromThreadInTxn( return result.getCopy(); } - public VariableValueModel getRhsValue( - ThreadRunModel thread, Map txnCache, VariableValueModel nodeOutput) - throws LHVarSubError { - VariableValueModel out = null; - - if (rhsValueType == RhsValueCase.LITERAL_VALUE) { - out = rhsLiteralValue; - } else if (rhsValueType == RhsValueCase.RHS_ASSIGNMENT) { - out = thread.assignVariable(rhsRhsAssignment, txnCache); - } else if (rhsValueType == RhsValueCase.NODE_OUTPUT) { - out = nodeOutput; - if (nodeOutputSource.jsonPath != null) { - out = out.jsonPath(nodeOutputSource.jsonPath); - } - } else { - throw new RuntimeException("Unsupported RHS Value type: " + rhsValueType); + /* + * Refactored this to be separate in order to "hide" the complexity from supporting the LITERAL_VALUE + * and NODE_OUTPUT cases for backwards compatibility, which are now handled in the rhsAssignment. + */ + private VariableValueModel getRhsVal(VariableFetcher fetcher, String nodeName) throws LHVarSubError { + switch (rhsValueType) { + case LITERAL_VALUE: + return rhsLiteralValue; + case RHS_ASSIGNMENT: + return rhsRhsAssignment.assignVariable(fetcher); + case NODE_OUTPUT: + return fetcher.fetchNodeOutput(nodeName); + case RHSVALUE_NOT_SET: } - return out; + throw new IllegalStateException(); } - public void execute(ThreadRunModel thread, Map txnCache, VariableValueModel nodeOutput) - throws LHVarSubError { - VariableValueModel lhsVal = getLhsValue(thread, txnCache); - VariableValueModel rhsVal = getRhsValue(thread, txnCache, nodeOutput); - VariableType lhsRealType = - thread.getThreadSpec().getVarDef(lhsName).getVarDef().getType(); + public void execute(VariableFetcher variableFetcher, VariableSetter setter, String nodeName) throws LHVarSubError { + VariableValueModel lhsVal = variableFetcher.fetchVariable(lhsName); + VariableValueModel rhsVal = getRhsVal(variableFetcher, nodeName); + VariableType lhsType = lhsVal.getType(); try { // NOTE Part 2: see below @@ -149,13 +146,13 @@ public void execute(ThreadRunModel thread, Map txnCa ? rhsVal : lhsJsonPathed.operate(operation, rhsVal, typeToCoerceTo); - VariableValueModel currentLhs = getVarValFromThreadInTxn(lhsName, thread, txnCache); + VariableValueModel currentLhs = variableFetcher.fetchVariable(lhsName); currentLhs.updateJsonViaJsonPath(lhsJsonPath, thingToPut.getVal()); - txnCache.put(lhsName, currentLhs); + setter.setVariable(lhsName, currentLhs); } else { - VariableType typeToCoerceTo = lhsRealType; - txnCache.put(lhsName, lhsVal.operate(operation, rhsVal, typeToCoerceTo)); + VariableType typeToCoerceTo = lhsType; + setter.setVariable(lhsName, lhsVal.operate(operation, rhsVal, typeToCoerceTo)); } } catch (LHVarSubError exn) { throw exn; diff --git a/server/src/test/java/e2e/ExpressionTest.java b/server/src/test/java/e2e/ExpressionTest.java index 13f5b5117..57704b9a3 100644 --- a/server/src/test/java/e2e/ExpressionTest.java +++ b/server/src/test/java/e2e/ExpressionTest.java @@ -231,6 +231,20 @@ void shouldSetNullNestedFieldWhenFirstLayerProvided() { .start(); } + @Test + void testDoubleAndIntMultiplicationAsInputToTask() { + verifier.prepareRun(expressionWf, Arg.of("should-test-double-multiplication", true)) + .waitForStatus(LHStatus.COMPLETED) + .start(); + } + + @Test + void expressionThatEvaluatesToDoubleShouldNotBeCastToINt() { + verifier.prepareRun(expressionWf, Arg.of("should-test-int-and-double-multiplication", true)) + .waitForStatus(LHStatus.ERROR) + .start(); + } + /* * Each of the tests in here *could* be their own Workflow; however, registering a * workflow takes ~200ms in our testing. Each of these test cases takes about 15ms @@ -304,6 +318,18 @@ public Workflow getExpression() { wf.doIf(nestedJson.isNotEqualTo(null), then -> { nestedJson.jsonPath("$.foo.bar").assignTo("baz"); }); + + // Test that multiplying double and int with int first can be passed into a task + // that expects a double. + var shouldTestDoubleMultiplication = wf.declareBool("should-test-double-multiplication"); + wf.doIf(shouldTestDoubleMultiplication.isEqualTo(true), handler -> { + wf.execute("task-that-expects-double", wf.multiply(2, wf.execute("task-that-returns-double"))); + }); + + var shouldTestIntAndDoubleMultiplication = wf.declareBool("should-test-int-and-double-multiplication"); + wf.doIf(shouldTestIntAndDoubleMultiplication.isEqualTo(true), handler -> { + wf.execute("task-that-expects-int", wf.execute("task-that-returns-int").add(0.1)); + }); }); } @@ -311,4 +337,29 @@ public Workflow getExpression() { public int addOne(int input) { return input + 1; } + + @LHTaskMethod("task-that-returns-double") + public double returnDouble() { + return 2.2; + } + + @LHTaskMethod("task-that-expects-double") + public void expectDouble(double input) { + // if (((Double)4.4) != input) { + if (!Double.valueOf(4.4).equals(Double.valueOf(input))) { + throw new RuntimeException("Expected 4.4, got " + input); + } + } + + @LHTaskMethod("task-that-expects-int") + public void expectInt(int input) { + if (4 != input) { + throw new RuntimeException("Expected 4, got " + input); + } + } + + @LHTaskMethod("task-that-returns-int") + public int returnInt() { + return 4; + } }