diff --git a/docs/docs/08-api.md b/docs/docs/08-api.md index 8170029e3..959e4c201 100644 --- a/docs/docs/08-api.md +++ b/docs/docs/08-api.md @@ -4033,6 +4033,7 @@ world. | `id` | | [WorkflowEventId](#workfloweventid) | The ID of the WorkflowEvent. Contains WfRunId and WorkflowEventDefId. | | `content` | | [VariableValue](#variablevalue) | The content of the WorkflowEvent. | | `created_at` | | google.protobuf.Timestamp | The time that the WorkflowEvent was created. | +| `node_run_id` | | [NodeRunId](#noderunid) | The NodeRun with which the WorkflowEvent is associated. | diff --git a/schemas/littlehorse/workflow_event.proto b/schemas/littlehorse/workflow_event.proto index 3d9a8f70f..49338b2d2 100644 --- a/schemas/littlehorse/workflow_event.proto +++ b/schemas/littlehorse/workflow_event.proto @@ -27,6 +27,9 @@ message WorkflowEvent { // The time that the WorkflowEvent was created. google.protobuf.Timestamp created_at = 3; + + // The NodeRun with which the WorkflowEvent is associated. + NodeRunId node_run_id = 4; } // The WorkflowEventDef defines the blueprint for a WorkflowEvent. diff --git a/sdk-go/lhproto/workflow_event.pb.go b/sdk-go/lhproto/workflow_event.pb.go index 93cdf011d..98860a4a0 100644 --- a/sdk-go/lhproto/workflow_event.pb.go +++ b/sdk-go/lhproto/workflow_event.pb.go @@ -38,6 +38,8 @@ type WorkflowEvent struct { Content *VariableValue `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // The time that the WorkflowEvent was created. CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + // The NodeRun with which the WorkflowEvent is associated. + NodeRunId *NodeRunId `protobuf:"bytes,4,opt,name=node_run_id,json=nodeRunId,proto3" json:"node_run_id,omitempty"` } func (x *WorkflowEvent) Reset() { @@ -93,6 +95,13 @@ func (x *WorkflowEvent) GetCreatedAt() *timestamppb.Timestamp { return nil } +func (x *WorkflowEvent) GetNodeRunId() *NodeRunId { + if x != nil { + return x.NodeRunId + } + return nil +} + // The WorkflowEventDef defines the blueprint for a WorkflowEvent. type WorkflowEventDef struct { state protoimpl.MessageState @@ -170,7 +179,7 @@ var file_workflow_event_proto_rawDesc = []byte{ 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, 0x1a, 0x12, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, - 0x75, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x01, 0x0a, 0x0d, 0x57, 0x6f, + 0x75, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x01, 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x76, @@ -181,23 +190,27 @@ var file_workflow_event_proto_rawDesc = []byte{ 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xad, 0x01, 0x0a, 0x10, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x12, - 0x2f, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, - 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x03, 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, 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, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x6e, 0x6f, + 0x64, 0x65, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, 0x65, 0x2e, 0x4e, 0x6f, + 0x64, 0x65, 0x52, 0x75, 0x6e, 0x49, 0x64, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x52, 0x75, 0x6e, + 0x49, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x66, 0x12, 0x2f, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x74, 0x74, 0x6c, 0x65, 0x68, 0x6f, 0x72, 0x73, + 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x44, + 0x65, 0x66, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 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, 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 ( @@ -219,21 +232,23 @@ var file_workflow_event_proto_goTypes = []interface{}{ (*WorkflowEventId)(nil), // 2: littlehorse.WorkflowEventId (*VariableValue)(nil), // 3: littlehorse.VariableValue (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp - (*WorkflowEventDefId)(nil), // 5: littlehorse.WorkflowEventDefId - (VariableType)(0), // 6: littlehorse.VariableType + (*NodeRunId)(nil), // 5: littlehorse.NodeRunId + (*WorkflowEventDefId)(nil), // 6: littlehorse.WorkflowEventDefId + (VariableType)(0), // 7: littlehorse.VariableType } var file_workflow_event_proto_depIdxs = []int32{ 2, // 0: littlehorse.WorkflowEvent.id:type_name -> littlehorse.WorkflowEventId 3, // 1: littlehorse.WorkflowEvent.content:type_name -> littlehorse.VariableValue 4, // 2: littlehorse.WorkflowEvent.created_at:type_name -> google.protobuf.Timestamp - 5, // 3: littlehorse.WorkflowEventDef.id:type_name -> littlehorse.WorkflowEventDefId - 4, // 4: littlehorse.WorkflowEventDef.created_at:type_name -> google.protobuf.Timestamp - 6, // 5: littlehorse.WorkflowEventDef.type:type_name -> littlehorse.VariableType - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 5, // 3: littlehorse.WorkflowEvent.node_run_id:type_name -> littlehorse.NodeRunId + 6, // 4: littlehorse.WorkflowEventDef.id:type_name -> littlehorse.WorkflowEventDefId + 4, // 5: littlehorse.WorkflowEventDef.created_at:type_name -> google.protobuf.Timestamp + 7, // 6: littlehorse.WorkflowEventDef.type:type_name -> littlehorse.VariableType + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_workflow_event_proto_init() } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEvent.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEvent.java index 54633ddcb..21ac6e3e0 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEvent.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEvent.java @@ -161,6 +161,44 @@ public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() { return createdAt_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createdAt_; } + public static final int NODE_RUN_ID_FIELD_NUMBER = 4; + private io.littlehorse.sdk.common.proto.NodeRunId nodeRunId_; + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return Whether the nodeRunId field is set. + */ + @java.lang.Override + public boolean hasNodeRunId() { + return nodeRunId_ != null; + } + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return The nodeRunId. + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.NodeRunId getNodeRunId() { + return nodeRunId_ == null ? io.littlehorse.sdk.common.proto.NodeRunId.getDefaultInstance() : nodeRunId_; + } + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + @java.lang.Override + public io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder getNodeRunIdOrBuilder() { + return nodeRunId_ == null ? io.littlehorse.sdk.common.proto.NodeRunId.getDefaultInstance() : nodeRunId_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -184,6 +222,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (createdAt_ != null) { output.writeMessage(3, getCreatedAt()); } + if (nodeRunId_ != null) { + output.writeMessage(4, getNodeRunId()); + } getUnknownFields().writeTo(output); } @@ -205,6 +246,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, getCreatedAt()); } + if (nodeRunId_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getNodeRunId()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -235,6 +280,11 @@ public boolean equals(final java.lang.Object obj) { if (!getCreatedAt() .equals(other.getCreatedAt())) return false; } + if (hasNodeRunId() != other.hasNodeRunId()) return false; + if (hasNodeRunId()) { + if (!getNodeRunId() + .equals(other.getNodeRunId())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -258,6 +308,10 @@ public int hashCode() { hash = (37 * hash) + CREATED_AT_FIELD_NUMBER; hash = (53 * hash) + getCreatedAt().hashCode(); } + if (hasNodeRunId()) { + hash = (37 * hash) + NODE_RUN_ID_FIELD_NUMBER; + hash = (53 * hash) + getNodeRunId().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -413,6 +467,11 @@ public Builder clear() { createdAtBuilder_.dispose(); createdAtBuilder_ = null; } + nodeRunId_ = null; + if (nodeRunIdBuilder_ != null) { + nodeRunIdBuilder_.dispose(); + nodeRunIdBuilder_ = null; + } return this; } @@ -461,6 +520,11 @@ private void buildPartial0(io.littlehorse.sdk.common.proto.WorkflowEvent result) ? createdAt_ : createdAtBuilder_.build(); } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.nodeRunId_ = nodeRunIdBuilder_ == null + ? nodeRunId_ + : nodeRunIdBuilder_.build(); + } } @java.lang.Override @@ -516,6 +580,9 @@ public Builder mergeFrom(io.littlehorse.sdk.common.proto.WorkflowEvent other) { if (other.hasCreatedAt()) { mergeCreatedAt(other.getCreatedAt()); } + if (other.hasNodeRunId()) { + mergeNodeRunId(other.getNodeRunId()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -563,6 +630,13 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 34: { + input.readMessage( + getNodeRunIdFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag @@ -1044,6 +1118,161 @@ public com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder() { } return createdAtBuilder_; } + + private io.littlehorse.sdk.common.proto.NodeRunId nodeRunId_; + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.NodeRunId, io.littlehorse.sdk.common.proto.NodeRunId.Builder, io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder> nodeRunIdBuilder_; + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return Whether the nodeRunId field is set. + */ + public boolean hasNodeRunId() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return The nodeRunId. + */ + public io.littlehorse.sdk.common.proto.NodeRunId getNodeRunId() { + if (nodeRunIdBuilder_ == null) { + return nodeRunId_ == null ? io.littlehorse.sdk.common.proto.NodeRunId.getDefaultInstance() : nodeRunId_; + } else { + return nodeRunIdBuilder_.getMessage(); + } + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public Builder setNodeRunId(io.littlehorse.sdk.common.proto.NodeRunId value) { + if (nodeRunIdBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nodeRunId_ = value; + } else { + nodeRunIdBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public Builder setNodeRunId( + io.littlehorse.sdk.common.proto.NodeRunId.Builder builderForValue) { + if (nodeRunIdBuilder_ == null) { + nodeRunId_ = builderForValue.build(); + } else { + nodeRunIdBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public Builder mergeNodeRunId(io.littlehorse.sdk.common.proto.NodeRunId value) { + if (nodeRunIdBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && + nodeRunId_ != null && + nodeRunId_ != io.littlehorse.sdk.common.proto.NodeRunId.getDefaultInstance()) { + getNodeRunIdBuilder().mergeFrom(value); + } else { + nodeRunId_ = value; + } + } else { + nodeRunIdBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public Builder clearNodeRunId() { + bitField0_ = (bitField0_ & ~0x00000008); + nodeRunId_ = null; + if (nodeRunIdBuilder_ != null) { + nodeRunIdBuilder_.dispose(); + nodeRunIdBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public io.littlehorse.sdk.common.proto.NodeRunId.Builder getNodeRunIdBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getNodeRunIdFieldBuilder().getBuilder(); + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + public io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder getNodeRunIdOrBuilder() { + if (nodeRunIdBuilder_ != null) { + return nodeRunIdBuilder_.getMessageOrBuilder(); + } else { + return nodeRunId_ == null ? + io.littlehorse.sdk.common.proto.NodeRunId.getDefaultInstance() : nodeRunId_; + } + } + /** + *
+     * The NodeRun with which the WorkflowEvent is associated.
+     * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.NodeRunId, io.littlehorse.sdk.common.proto.NodeRunId.Builder, io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder> + getNodeRunIdFieldBuilder() { + if (nodeRunIdBuilder_ == null) { + nodeRunIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + io.littlehorse.sdk.common.proto.NodeRunId, io.littlehorse.sdk.common.proto.NodeRunId.Builder, io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder>( + getNodeRunId(), + getParentForChildren(), + isClean()); + nodeRunId_ = null; + } + return nodeRunIdBuilder_; + } @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/WorkflowEventOrBuilder.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOrBuilder.java index 808a4c787..5d0520ce1 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOrBuilder.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOrBuilder.java @@ -87,4 +87,31 @@ public interface WorkflowEventOrBuilder extends * .google.protobuf.Timestamp created_at = 3; */ com.google.protobuf.TimestampOrBuilder getCreatedAtOrBuilder(); + + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return Whether the nodeRunId field is set. + */ + boolean hasNodeRunId(); + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + * @return The nodeRunId. + */ + io.littlehorse.sdk.common.proto.NodeRunId getNodeRunId(); + /** + *
+   * The NodeRun with which the WorkflowEvent is associated.
+   * 
+ * + * .littlehorse.NodeRunId node_run_id = 4; + */ + io.littlehorse.sdk.common.proto.NodeRunIdOrBuilder getNodeRunIdOrBuilder(); } diff --git a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOuterClass.java b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOuterClass.java index 57534f0ad..2a4c830a3 100644 --- a/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOuterClass.java +++ b/sdk-java/src/main/java/io/littlehorse/sdk/common/proto/WorkflowEventOuterClass.java @@ -36,16 +36,17 @@ public static void registerAllExtensions( "\n\024workflow_event.proto\022\013littlehorse\032\037goo" + "gle/protobuf/timestamp.proto\032\016variable.p" + "roto\032\017object_id.proto\032\022common_enums.prot" + - "o\"\226\001\n\rWorkflowEvent\022(\n\002id\030\001 \001(\0132\034.little" + + "o\"\303\001\n\rWorkflowEvent\022(\n\002id\030\001 \001(\0132\034.little" + "horse.WorkflowEventId\022+\n\007content\030\002 \001(\0132\032" + ".littlehorse.VariableValue\022.\n\ncreated_at" + - "\030\003 \001(\0132\032.google.protobuf.Timestamp\"\230\001\n\020W" + - "orkflowEventDef\022+\n\002id\030\001 \001(\0132\037.littlehors" + - "e.WorkflowEventDefId\022.\n\ncreated_at\030\002 \001(\013" + - "2\032.google.protobuf.Timestamp\022\'\n\004type\030\003 \001" + - "(\0162\031.littlehorse.VariableTypeBI\n\037io.litt" + - "lehorse.sdk.common.protoP\001Z\t.;lhproto\252\002\030" + - "LittleHorse.Common.Protob\006proto3" + "\030\003 \001(\0132\032.google.protobuf.Timestamp\022+\n\013no" + + "de_run_id\030\004 \001(\0132\026.littlehorse.NodeRunId\"" + + "\230\001\n\020WorkflowEventDef\022+\n\002id\030\001 \001(\0132\037.littl" + + "ehorse.WorkflowEventDefId\022.\n\ncreated_at\030" + + "\002 \001(\0132\032.google.protobuf.Timestamp\022\'\n\004typ" + + "e\030\003 \001(\0162\031.littlehorse.VariableTypeBI\n\037io" + + ".littlehorse.sdk.common.protoP\001Z\t.;lhpro" + + "to\252\002\030LittleHorse.Common.Protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -60,7 +61,7 @@ public static void registerAllExtensions( internal_static_littlehorse_WorkflowEvent_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_littlehorse_WorkflowEvent_descriptor, - new java.lang.String[] { "Id", "Content", "CreatedAt", }); + new java.lang.String[] { "Id", "Content", "CreatedAt", "NodeRunId", }); internal_static_littlehorse_WorkflowEventDef_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_littlehorse_WorkflowEventDef_fieldAccessorTable = new diff --git a/sdk-js/src/proto/workflow_event.ts b/sdk-js/src/proto/workflow_event.ts index 01bfa02e6..dcef481be 100644 --- a/sdk-js/src/proto/workflow_event.ts +++ b/sdk-js/src/proto/workflow_event.ts @@ -8,7 +8,7 @@ import _m0 from "protobufjs/minimal"; import { VariableType, variableTypeFromJSON, variableTypeToNumber } from "./common_enums"; import { Timestamp } from "./google/protobuf/timestamp"; -import { WorkflowEventDefId, WorkflowEventId } from "./object_id"; +import { NodeRunId, WorkflowEventDefId, WorkflowEventId } from "./object_id"; import { VariableValue } from "./variable"; /** @@ -29,7 +29,11 @@ export interface WorkflowEvent { | VariableValue | undefined; /** The time that the WorkflowEvent was created. */ - createdAt: string | undefined; + createdAt: + | string + | undefined; + /** The NodeRun with which the WorkflowEvent is associated. */ + nodeRunId: NodeRunId | undefined; } /** The WorkflowEventDef defines the blueprint for a WorkflowEvent. */ @@ -47,7 +51,7 @@ export interface WorkflowEventDef { } function createBaseWorkflowEvent(): WorkflowEvent { - return { id: undefined, content: undefined, createdAt: undefined }; + return { id: undefined, content: undefined, createdAt: undefined, nodeRunId: undefined }; } export const WorkflowEvent = { @@ -61,6 +65,9 @@ export const WorkflowEvent = { if (message.createdAt !== undefined) { Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(26).fork()).ldelim(); } + if (message.nodeRunId !== undefined) { + NodeRunId.encode(message.nodeRunId, writer.uint32(34).fork()).ldelim(); + } return writer; }, @@ -92,6 +99,13 @@ export const WorkflowEvent = { message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); continue; + case 4: + if (tag !== 34) { + break; + } + + message.nodeRunId = NodeRunId.decode(reader, reader.uint32()); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -111,6 +125,9 @@ export const WorkflowEvent = { ? VariableValue.fromPartial(object.content) : undefined; message.createdAt = object.createdAt ?? undefined; + message.nodeRunId = (object.nodeRunId !== undefined && object.nodeRunId !== null) + ? NodeRunId.fromPartial(object.nodeRunId) + : undefined; return message; }, }; diff --git a/sdk-python/littlehorse/model/__init__.py b/sdk-python/littlehorse/model/__init__.py index c956189c7..85f573b7e 100644 --- a/sdk-python/littlehorse/model/__init__.py +++ b/sdk-python/littlehorse/model/__init__.py @@ -5,8 +5,8 @@ from .node_run_pb2 import * from .object_id_pb2 import * from .scheduled_wf_run_pb2 import * -from .service_pb2_grpc import * from .service_pb2 import * +from .service_pb2_grpc import * from .task_def_pb2 import * from .task_run_pb2 import * from .user_tasks_pb2 import * diff --git a/sdk-python/littlehorse/model/workflow_event_pb2.py b/sdk-python/littlehorse/model/workflow_event_pb2.py index 19ff1829d..c64aec9a8 100644 --- a/sdk-python/littlehorse/model/workflow_event_pb2.py +++ b/sdk-python/littlehorse/model/workflow_event_pb2.py @@ -17,7 +17,7 @@ import littlehorse.model.common_enums_pb2 as common__enums__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14workflow_event.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x0evariable.proto\x1a\x0fobject_id.proto\x1a\x12\x63ommon_enums.proto\"\x96\x01\n\rWorkflowEvent\x12(\n\x02id\x18\x01 \x01(\x0b\x32\x1c.littlehorse.WorkflowEventId\x12+\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x1a.littlehorse.VariableValue\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x98\x01\n\x10WorkflowEventDef\x12+\n\x02id\x18\x01 \x01(\x0b\x32\x1f.littlehorse.WorkflowEventDefId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x04type\x18\x03 \x01(\x0e\x32\x19.littlehorse.VariableTypeBI\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x18LittleHorse.Common.Protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14workflow_event.proto\x12\x0blittlehorse\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x0evariable.proto\x1a\x0fobject_id.proto\x1a\x12\x63ommon_enums.proto\"\xc3\x01\n\rWorkflowEvent\x12(\n\x02id\x18\x01 \x01(\x0b\x32\x1c.littlehorse.WorkflowEventId\x12+\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x1a.littlehorse.VariableValue\x12.\n\ncreated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\x0bnode_run_id\x18\x04 \x01(\x0b\x32\x16.littlehorse.NodeRunId\"\x98\x01\n\x10WorkflowEventDef\x12+\n\x02id\x18\x01 \x01(\x0b\x32\x1f.littlehorse.WorkflowEventDefId\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\x04type\x18\x03 \x01(\x0e\x32\x19.littlehorse.VariableTypeBI\n\x1fio.littlehorse.sdk.common.protoP\x01Z\t.;lhproto\xaa\x02\x18LittleHorse.Common.Protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -27,7 +27,7 @@ DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\037io.littlehorse.sdk.common.protoP\001Z\t.;lhproto\252\002\030LittleHorse.Common.Proto' _globals['_WORKFLOWEVENT']._serialized_start=124 - _globals['_WORKFLOWEVENT']._serialized_end=274 - _globals['_WORKFLOWEVENTDEF']._serialized_start=277 - _globals['_WORKFLOWEVENTDEF']._serialized_end=429 + _globals['_WORKFLOWEVENT']._serialized_end=319 + _globals['_WORKFLOWEVENTDEF']._serialized_start=322 + _globals['_WORKFLOWEVENTDEF']._serialized_end=474 # @@protoc_insertion_point(module_scope) diff --git a/sdk-python/littlehorse/model/workflow_event_pb2.pyi b/sdk-python/littlehorse/model/workflow_event_pb2.pyi index b255e0790..538bcb024 100644 --- a/sdk-python/littlehorse/model/workflow_event_pb2.pyi +++ b/sdk-python/littlehorse/model/workflow_event_pb2.pyi @@ -9,14 +9,16 @@ from typing import ClassVar as _ClassVar, Mapping as _Mapping, Optional as _Opti DESCRIPTOR: _descriptor.FileDescriptor class WorkflowEvent(_message.Message): - __slots__ = ["id", "content", "created_at"] + __slots__ = ["id", "content", "created_at", "node_run_id"] ID_FIELD_NUMBER: _ClassVar[int] CONTENT_FIELD_NUMBER: _ClassVar[int] CREATED_AT_FIELD_NUMBER: _ClassVar[int] + NODE_RUN_ID_FIELD_NUMBER: _ClassVar[int] id: _object_id_pb2.WorkflowEventId content: _variable_pb2.VariableValue created_at: _timestamp_pb2.Timestamp - def __init__(self, id: _Optional[_Union[_object_id_pb2.WorkflowEventId, _Mapping]] = ..., content: _Optional[_Union[_variable_pb2.VariableValue, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ... + node_run_id: _object_id_pb2.NodeRunId + def __init__(self, id: _Optional[_Union[_object_id_pb2.WorkflowEventId, _Mapping]] = ..., content: _Optional[_Union[_variable_pb2.VariableValue, _Mapping]] = ..., created_at: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., node_run_id: _Optional[_Union[_object_id_pb2.NodeRunId, _Mapping]] = ...) -> None: ... class WorkflowEventDef(_message.Message): __slots__ = ["id", "created_at", "type"] diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModel.java b/server/src/main/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModel.java index 897dd2312..c948b39c0 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModel.java @@ -4,7 +4,9 @@ import io.littlehorse.common.LHSerializable; import io.littlehorse.common.model.AbstractGetable; import io.littlehorse.common.model.CoreGetable; +import io.littlehorse.common.model.getable.core.noderun.NodeRunModel; import io.littlehorse.common.model.getable.core.variable.VariableValueModel; +import io.littlehorse.common.model.getable.objectId.NodeRunIdModel; import io.littlehorse.common.model.getable.objectId.WorkflowEventIdModel; import io.littlehorse.common.proto.TagStorageType; import io.littlehorse.common.util.LHUtil; @@ -25,13 +27,15 @@ public class WorkflowEventModel extends CoreGetable { private WorkflowEventIdModel id; private VariableValueModel content; private Date createdAt; + private NodeRunIdModel nodeRunId; public WorkflowEventModel() {} - public WorkflowEventModel(WorkflowEventIdModel id, VariableValueModel content) { + public WorkflowEventModel(WorkflowEventIdModel id, VariableValueModel content, NodeRunModel nodeRunModel) { this.id = id; this.content = content; this.createdAt = new Date(); + this.nodeRunId = nodeRunModel.getObjectId(); } @Override @@ -40,6 +44,7 @@ public void initFrom(Message proto, ExecutionContext context) throws LHSerdeErro this.id = LHSerializable.fromProto(p.getId(), WorkflowEventIdModel.class, context); this.createdAt = LHUtil.fromProtoTs(p.getCreatedAt()); this.content = LHSerializable.fromProto(p.getContent(), VariableValueModel.class, context); + this.nodeRunId = LHSerializable.fromProto(p.getNodeRunId(), NodeRunIdModel.class, context); } @Override @@ -47,7 +52,8 @@ public WorkflowEvent.Builder toProto() { return WorkflowEvent.newBuilder() .setId(id.toProto()) .setContent(content.toProto()) - .setCreatedAt(LHUtil.fromDate(createdAt)); + .setCreatedAt(LHUtil.fromDate(createdAt)) + .setNodeRunId(nodeRunId.toProto()); } @Override diff --git a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/subnoderun/ThrowEventNodeRunModel.java b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/subnoderun/ThrowEventNodeRunModel.java index 3d85f51ac..f8dedb08a 100644 --- a/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/subnoderun/ThrowEventNodeRunModel.java +++ b/server/src/main/java/io/littlehorse/common/model/getable/core/wfrun/subnoderun/ThrowEventNodeRunModel.java @@ -67,7 +67,7 @@ public void arrive(Date time, ProcessorExecutionContext processorContext) throws VariableValueModel content = getNodeRun() .getThreadRun() .assignVariable(getNode().getThrowEventNode().getContent()); - WorkflowEventModel event = new WorkflowEventModel(workflowEventId, content); + WorkflowEventModel event = new WorkflowEventModel(workflowEventId, content, nodeRun); processorContext.getableManager().put(event); processorContext.notifyOfEventThrown(event); diff --git a/server/src/test/java/io/littlehorse/TestUtil.java b/server/src/test/java/io/littlehorse/TestUtil.java index 58023a42e..76bea203a 100644 --- a/server/src/test/java/io/littlehorse/TestUtil.java +++ b/server/src/test/java/io/littlehorse/TestUtil.java @@ -252,7 +252,8 @@ public static ExternalEventModel externalEvent(String wfRunId) { public static WorkflowEventModel workflowEvent(String wfRunId) { WorkflowEventModel workflowEvent = new WorkflowEventModel( new WorkflowEventIdModel(new WfRunIdModel(wfRunId), new WorkflowEventDefIdModel("test-name"), 0), - variableValue()); + variableValue(), + nodeRun(wfRunId)); return workflowEvent; } diff --git a/server/src/test/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModelTest.java b/server/src/test/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModelTest.java index 0312ad143..a3750e8fa 100644 --- a/server/src/test/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModelTest.java +++ b/server/src/test/java/io/littlehorse/common/model/getable/core/events/WorkflowEventModelTest.java @@ -32,7 +32,7 @@ public void shouldStoreNewWorkflowEvent() { WfRunIdModel wfRunId = TestUtil.wfRun(UUID.randomUUID().toString()).getId(); VariableValueModel content = TestUtil.variableValue(); WorkflowEventIdModel eventId = new WorkflowEventIdModel(wfRunId, workflowEventDefId, 1); - WorkflowEventModel eventToStore = new WorkflowEventModel(eventId, content); + WorkflowEventModel eventToStore = new WorkflowEventModel(eventId, content, null); testProcessorContext.getableManager().put(eventToStore); testProcessorContext.endExecution(); WorkflowEventModel storedEvent = testProcessorContext.getableManager().get(eventId);