diff --git a/backend/genproto/activity/v1alpha/activity.pb.go b/backend/genproto/activity/v1alpha/activity.pb.go new file mode 100644 index 000000000..f72b0fd86 --- /dev/null +++ b/backend/genproto/activity/v1alpha/activity.pb.go @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.32.0 +// protoc v3.21.12 +// source: activity/v1alpha/activity.proto + +package activity + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The request to list the events. +type ListEventsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Optional. The size of the page. The default is defined by the server. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // Optional. The page token for requesting next pages. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListEventsRequest) Reset() { + *x = ListEventsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_activity_v1alpha_activity_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEventsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEventsRequest) ProtoMessage() {} + +func (x *ListEventsRequest) ProtoReflect() protoreflect.Message { + mi := &file_activity_v1alpha_activity_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListEventsRequest.ProtoReflect.Descriptor instead. +func (*ListEventsRequest) Descriptor() ([]byte, []int) { + return file_activity_v1alpha_activity_proto_rawDescGZIP(), []int{0} +} + +func (x *ListEventsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListEventsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +// The response with the list of events. +type ListEventsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of events. + Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` + // The token to request the next page. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListEventsResponse) Reset() { + *x = ListEventsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_activity_v1alpha_activity_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEventsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEventsResponse) ProtoMessage() {} + +func (x *ListEventsResponse) ProtoReflect() protoreflect.Message { + mi := &file_activity_v1alpha_activity_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListEventsResponse.ProtoReflect.Descriptor instead. +func (*ListEventsResponse) Descriptor() ([]byte, []int) { + return file_activity_v1alpha_activity_proto_rawDescGZIP(), []int{1} +} + +func (x *ListEventsResponse) GetEvents() []*Event { + if x != nil { + return x.Events + } + return nil +} + +func (x *ListEventsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// Description of the event occurred in the system. +type Event struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Union type of different event types. + // Eventually we'll have more event types. + // + // Types that are assignable to Data: + // + // *Event_NewBlob + Data isEvent_Data `protobuf_oneof:"data"` + // The ID of the user account that has caused the event. + Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` + // Timestamp of the event as per the event itself. + EventTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"` + // Locally perceived time of the event. + // I.e. time when we have received the event on our machine. + ObserveTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=observe_time,json=observeTime,proto3" json:"observe_time,omitempty"` +} + +func (x *Event) Reset() { + *x = Event{} + if protoimpl.UnsafeEnabled { + mi := &file_activity_v1alpha_activity_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_activity_v1alpha_activity_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_activity_v1alpha_activity_proto_rawDescGZIP(), []int{2} +} + +func (m *Event) GetData() isEvent_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *Event) GetNewBlob() *NewBlobEvent { + if x, ok := x.GetData().(*Event_NewBlob); ok { + return x.NewBlob + } + return nil +} + +func (x *Event) GetAccount() string { + if x != nil { + return x.Account + } + return "" +} + +func (x *Event) GetEventTime() *timestamppb.Timestamp { + if x != nil { + return x.EventTime + } + return nil +} + +func (x *Event) GetObserveTime() *timestamppb.Timestamp { + if x != nil { + return x.ObserveTime + } + return nil +} + +type isEvent_Data interface { + isEvent_Data() +} + +type Event_NewBlob struct { + // Event type describing the appearance of a new blob in the system. + NewBlob *NewBlobEvent `protobuf:"bytes,1,opt,name=new_blob,json=newBlob,proto3,oneof"` +} + +func (*Event_NewBlob) isEvent_Data() {} + +// The event describing the +type NewBlobEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The CID of the blob that was created. + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` + // The type of the blob that was created. + // Defined as string for extensibility. + // Some of the currently supported blob types are: + // - KeyDelegation + // - Change + // - Comment + // - DagPB + BlobType string `protobuf:"bytes,2,opt,name=blob_type,json=blobType,proto3" json:"blob_type,omitempty"` + // The user account ID that has created the blob. + Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"` + // The resource ID that the blob is related to. + Resource string `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"` +} + +func (x *NewBlobEvent) Reset() { + *x = NewBlobEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_activity_v1alpha_activity_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NewBlobEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewBlobEvent) ProtoMessage() {} + +func (x *NewBlobEvent) ProtoReflect() protoreflect.Message { + mi := &file_activity_v1alpha_activity_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewBlobEvent.ProtoReflect.Descriptor instead. +func (*NewBlobEvent) Descriptor() ([]byte, []int) { + return file_activity_v1alpha_activity_proto_rawDescGZIP(), []int{3} +} + +func (x *NewBlobEvent) GetCid() string { + if x != nil { + return x.Cid + } + return "" +} + +func (x *NewBlobEvent) GetBlobType() string { + if x != nil { + return x.BlobType + } + return "" +} + +func (x *NewBlobEvent) GetAuthor() string { + if x != nil { + return x.Author + } + return "" +} + +func (x *NewBlobEvent) GetResource() string { + if x != nil { + return x.Resource + } + return "" +} + +var File_activity_v1alpha_activity_proto protoreflect.FileDescriptor + +var file_activity_v1alpha_activity_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x1a, + 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x4f, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x79, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x69, + 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, + 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xec, 0x01, 0x0a, + 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x62, 0x6c, + 0x6f, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, + 0x69, 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x62, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x62, 0x12, + 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 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, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 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, 0x0b, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x71, 0x0a, 0x0c, 0x4e, + 0x65, 0x77, 0x42, 0x6c, 0x6f, 0x62, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x32, 0x7f, + 0x0a, 0x0c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x64, 0x12, 0x6f, + 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x76, + 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, + 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x69, 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x69, 0x74, 0x79, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x34, 0x5a, 0x32, 0x6d, 0x69, 0x6e, 0x74, 0x74, 0x65, 0x72, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x63, 0x74, 0x69, + 0x76, 0x69, 0x74, 0x79, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x3b, 0x61, 0x63, 0x74, + 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_activity_v1alpha_activity_proto_rawDescOnce sync.Once + file_activity_v1alpha_activity_proto_rawDescData = file_activity_v1alpha_activity_proto_rawDesc +) + +func file_activity_v1alpha_activity_proto_rawDescGZIP() []byte { + file_activity_v1alpha_activity_proto_rawDescOnce.Do(func() { + file_activity_v1alpha_activity_proto_rawDescData = protoimpl.X.CompressGZIP(file_activity_v1alpha_activity_proto_rawDescData) + }) + return file_activity_v1alpha_activity_proto_rawDescData +} + +var file_activity_v1alpha_activity_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_activity_v1alpha_activity_proto_goTypes = []interface{}{ + (*ListEventsRequest)(nil), // 0: com.mintter.activity.v1alpha.ListEventsRequest + (*ListEventsResponse)(nil), // 1: com.mintter.activity.v1alpha.ListEventsResponse + (*Event)(nil), // 2: com.mintter.activity.v1alpha.Event + (*NewBlobEvent)(nil), // 3: com.mintter.activity.v1alpha.NewBlobEvent + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp +} +var file_activity_v1alpha_activity_proto_depIdxs = []int32{ + 2, // 0: com.mintter.activity.v1alpha.ListEventsResponse.events:type_name -> com.mintter.activity.v1alpha.Event + 3, // 1: com.mintter.activity.v1alpha.Event.new_blob:type_name -> com.mintter.activity.v1alpha.NewBlobEvent + 4, // 2: com.mintter.activity.v1alpha.Event.event_time:type_name -> google.protobuf.Timestamp + 4, // 3: com.mintter.activity.v1alpha.Event.observe_time:type_name -> google.protobuf.Timestamp + 0, // 4: com.mintter.activity.v1alpha.ActivityFeed.ListEvents:input_type -> com.mintter.activity.v1alpha.ListEventsRequest + 1, // 5: com.mintter.activity.v1alpha.ActivityFeed.ListEvents:output_type -> com.mintter.activity.v1alpha.ListEventsResponse + 5, // [5:6] is the sub-list for method output_type + 4, // [4:5] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_activity_v1alpha_activity_proto_init() } +func file_activity_v1alpha_activity_proto_init() { + if File_activity_v1alpha_activity_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_activity_v1alpha_activity_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEventsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_activity_v1alpha_activity_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEventsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_activity_v1alpha_activity_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_activity_v1alpha_activity_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NewBlobEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_activity_v1alpha_activity_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*Event_NewBlob)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_activity_v1alpha_activity_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_activity_v1alpha_activity_proto_goTypes, + DependencyIndexes: file_activity_v1alpha_activity_proto_depIdxs, + MessageInfos: file_activity_v1alpha_activity_proto_msgTypes, + }.Build() + File_activity_v1alpha_activity_proto = out.File + file_activity_v1alpha_activity_proto_rawDesc = nil + file_activity_v1alpha_activity_proto_goTypes = nil + file_activity_v1alpha_activity_proto_depIdxs = nil +} diff --git a/backend/genproto/activity/v1alpha/activity_grpc.pb.go b/backend/genproto/activity/v1alpha/activity_grpc.pb.go new file mode 100644 index 000000000..e11ed767c --- /dev/null +++ b/backend/genproto/activity/v1alpha/activity_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.12 +// source: activity/v1alpha/activity.proto + +package activity + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// ActivityFeedClient is the client API for ActivityFeed service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ActivityFeedClient interface { + // Lists the recent activity events, + // sorted by locally observed time (newest first). + ListEvents(ctx context.Context, in *ListEventsRequest, opts ...grpc.CallOption) (*ListEventsResponse, error) +} + +type activityFeedClient struct { + cc grpc.ClientConnInterface +} + +func NewActivityFeedClient(cc grpc.ClientConnInterface) ActivityFeedClient { + return &activityFeedClient{cc} +} + +func (c *activityFeedClient) ListEvents(ctx context.Context, in *ListEventsRequest, opts ...grpc.CallOption) (*ListEventsResponse, error) { + out := new(ListEventsResponse) + err := c.cc.Invoke(ctx, "/com.mintter.activity.v1alpha.ActivityFeed/ListEvents", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ActivityFeedServer is the server API for ActivityFeed service. +// All implementations should embed UnimplementedActivityFeedServer +// for forward compatibility +type ActivityFeedServer interface { + // Lists the recent activity events, + // sorted by locally observed time (newest first). + ListEvents(context.Context, *ListEventsRequest) (*ListEventsResponse, error) +} + +// UnimplementedActivityFeedServer should be embedded to have forward compatible implementations. +type UnimplementedActivityFeedServer struct { +} + +func (UnimplementedActivityFeedServer) ListEvents(context.Context, *ListEventsRequest) (*ListEventsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEvents not implemented") +} + +// UnsafeActivityFeedServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ActivityFeedServer will +// result in compilation errors. +type UnsafeActivityFeedServer interface { + mustEmbedUnimplementedActivityFeedServer() +} + +func RegisterActivityFeedServer(s grpc.ServiceRegistrar, srv ActivityFeedServer) { + s.RegisterService(&ActivityFeed_ServiceDesc, srv) +} + +func _ActivityFeed_ListEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEventsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ActivityFeedServer).ListEvents(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.mintter.activity.v1alpha.ActivityFeed/ListEvents", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ActivityFeedServer).ListEvents(ctx, req.(*ListEventsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ActivityFeed_ServiceDesc is the grpc.ServiceDesc for ActivityFeed service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ActivityFeed_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "com.mintter.activity.v1alpha.ActivityFeed", + HandlerType: (*ActivityFeedServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListEvents", + Handler: _ActivityFeed_ListEvents_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "activity/v1alpha/activity.proto", +} diff --git a/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_connect.ts b/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_connect.ts new file mode 100644 index 000000000..21d633e52 --- /dev/null +++ b/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_connect.ts @@ -0,0 +1,31 @@ +// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=ts,import_extension=none" +// @generated from file activity/v1alpha/activity.proto (package com.mintter.activity.v1alpha, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ListEventsRequest, ListEventsResponse } from "./activity_pb"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * ActivityFeed service provides information about the recent activity events happened in the system. + * + * @generated from service com.mintter.activity.v1alpha.ActivityFeed + */ +export const ActivityFeed = { + typeName: "com.mintter.activity.v1alpha.ActivityFeed", + methods: { + /** + * Lists the recent activity events, + * sorted by locally observed time (newest first). + * + * @generated from rpc com.mintter.activity.v1alpha.ActivityFeed.ListEvents + */ + listEvents: { + name: "ListEvents", + I: ListEventsRequest, + O: ListEventsResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_pb.ts b/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_pb.ts new file mode 100644 index 000000000..3a013c4e9 --- /dev/null +++ b/frontend/packages/shared/src/client/.generated/activity/v1alpha/activity_pb.ts @@ -0,0 +1,252 @@ +// @generated by protoc-gen-es v1.4.1 with parameter "target=ts,import_extension=none" +// @generated from file activity/v1alpha/activity.proto (package com.mintter.activity.v1alpha, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, Timestamp } from "@bufbuild/protobuf"; + +/** + * The request to list the events. + * + * @generated from message com.mintter.activity.v1alpha.ListEventsRequest + */ +export class ListEventsRequest extends Message { + /** + * Optional. The size of the page. The default is defined by the server. + * + * @generated from field: int32 page_size = 1; + */ + pageSize = 0; + + /** + * Optional. The page token for requesting next pages. + * + * @generated from field: string page_token = 2; + */ + pageToken = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "com.mintter.activity.v1alpha.ListEventsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "page_size", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 2, name: "page_token", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ListEventsRequest { + return new ListEventsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ListEventsRequest { + return new ListEventsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ListEventsRequest { + return new ListEventsRequest().fromJsonString(jsonString, options); + } + + static equals(a: ListEventsRequest | PlainMessage | undefined, b: ListEventsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ListEventsRequest, a, b); + } +} + +/** + * The response with the list of events. + * + * @generated from message com.mintter.activity.v1alpha.ListEventsResponse + */ +export class ListEventsResponse extends Message { + /** + * The list of events. + * + * @generated from field: repeated com.mintter.activity.v1alpha.Event events = 1; + */ + events: Event[] = []; + + /** + * The token to request the next page. + * + * @generated from field: string next_page_token = 2; + */ + nextPageToken = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "com.mintter.activity.v1alpha.ListEventsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "events", kind: "message", T: Event, repeated: true }, + { no: 2, name: "next_page_token", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ListEventsResponse { + return new ListEventsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ListEventsResponse { + return new ListEventsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ListEventsResponse { + return new ListEventsResponse().fromJsonString(jsonString, options); + } + + static equals(a: ListEventsResponse | PlainMessage | undefined, b: ListEventsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ListEventsResponse, a, b); + } +} + +/** + * Description of the event occurred in the system. + * + * @generated from message com.mintter.activity.v1alpha.Event + */ +export class Event extends Message { + /** + * Union type of different event types. + * Eventually we'll have more event types. + * + * @generated from oneof com.mintter.activity.v1alpha.Event.data + */ + data: { + /** + * Event type describing the appearance of a new blob in the system. + * + * @generated from field: com.mintter.activity.v1alpha.NewBlobEvent new_blob = 1; + */ + value: NewBlobEvent; + case: "newBlob"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + /** + * The ID of the user account that has caused the event. + * + * @generated from field: string account = 2; + */ + account = ""; + + /** + * Timestamp of the event as per the event itself. + * + * @generated from field: google.protobuf.Timestamp event_time = 3; + */ + eventTime?: Timestamp; + + /** + * Locally perceived time of the event. + * I.e. time when we have received the event on our machine. + * + * @generated from field: google.protobuf.Timestamp observe_time = 4; + */ + observeTime?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "com.mintter.activity.v1alpha.Event"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "new_blob", kind: "message", T: NewBlobEvent, oneof: "data" }, + { no: 2, name: "account", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "event_time", kind: "message", T: Timestamp }, + { no: 4, name: "observe_time", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Event { + return new Event().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Event { + return new Event().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Event { + return new Event().fromJsonString(jsonString, options); + } + + static equals(a: Event | PlainMessage | undefined, b: Event | PlainMessage | undefined): boolean { + return proto3.util.equals(Event, a, b); + } +} + +/** + * The event describing the + * + * @generated from message com.mintter.activity.v1alpha.NewBlobEvent + */ +export class NewBlobEvent extends Message { + /** + * The CID of the blob that was created. + * + * @generated from field: string cid = 1; + */ + cid = ""; + + /** + * The type of the blob that was created. + * Defined as string for extensibility. + * Some of the currently supported blob types are: + * - KeyDelegation + * - Change + * - Comment + * - DagPB + * + * @generated from field: string blob_type = 2; + */ + blobType = ""; + + /** + * The user account ID that has created the blob. + * + * @generated from field: string author = 3; + */ + author = ""; + + /** + * The resource ID that the blob is related to. + * + * @generated from field: string resource = 4; + */ + resource = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "com.mintter.activity.v1alpha.NewBlobEvent"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "cid", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "blob_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "author", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "resource", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NewBlobEvent { + return new NewBlobEvent().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NewBlobEvent { + return new NewBlobEvent().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NewBlobEvent { + return new NewBlobEvent().fromJsonString(jsonString, options); + } + + static equals(a: NewBlobEvent | PlainMessage | undefined, b: NewBlobEvent | PlainMessage | undefined): boolean { + return proto3.util.equals(NewBlobEvent, a, b); + } +} + diff --git a/proto/activity/v1alpha/BUILD.plz b/proto/activity/v1alpha/BUILD.plz new file mode 100644 index 000000000..e8078ca63 --- /dev/null +++ b/proto/activity/v1alpha/BUILD.plz @@ -0,0 +1,9 @@ +subinclude("//build/rules/mintter:defs") + +mtt_proto_codegen( + srcs = glob(["*.proto"]), + languages = [ + "go", + "js", + ], +) diff --git a/proto/activity/v1alpha/activity.proto b/proto/activity/v1alpha/activity.proto new file mode 100644 index 000000000..84777e4a3 --- /dev/null +++ b/proto/activity/v1alpha/activity.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package com.mintter.activity.v1alpha; + +import "google/protobuf/timestamp.proto"; + +option go_package = "mintter/backend/genproto/activity/v1alpha;activity"; + +// ActivityFeed service provides information about the recent activity events happened in the system. +service ActivityFeed { + // Lists the recent activity events, + // sorted by locally observed time (newest first). + rpc ListEvents(ListEventsRequest) returns (ListEventsResponse); +} + +// The request to list the events. +message ListEventsRequest { + // Optional. The size of the page. The default is defined by the server. + int32 page_size = 1; + + // Optional. The page token for requesting next pages. + string page_token = 2; + + // TODO: add filtering options. +} + +// The response with the list of events. +message ListEventsResponse { + // The list of events. + repeated Event events = 1; + + // The token to request the next page. + string next_page_token = 2; +} + +// Description of the event occurred in the system. +message Event { + // Union type of different event types. + // Eventually we'll have more event types. + oneof data { + // Event type describing the appearance of a new blob in the system. + NewBlobEvent new_blob = 1; + } + + // The ID of the user account that has caused the event. + string account = 2; + + // Timestamp of the event as per the event itself. + google.protobuf.Timestamp event_time = 3; + + // Locally perceived time of the event. + // I.e. time when we have received the event on our machine. + google.protobuf.Timestamp observe_time = 4; +} + +// The event describing the +message NewBlobEvent { + // The CID of the blob that was created. + string cid = 1; + + // The type of the blob that was created. + // Defined as string for extensibility. + // Some of the currently supported blob types are: + // - KeyDelegation + // - Change + // - Comment + // - DagPB + string blob_type = 2; + + // The user account ID that has created the blob. + string author = 3; + + // The resource ID that the blob is related to. + string resource = 4; +} diff --git a/proto/activity/v1alpha/go.gensum b/proto/activity/v1alpha/go.gensum new file mode 100644 index 000000000..2b2f2df1a --- /dev/null +++ b/proto/activity/v1alpha/go.gensum @@ -0,0 +1,2 @@ +srcs: 67073275389dafc231a09fc47630ec57 +outs: 89ed2f89f62bf355718fabc3f8d15d2d diff --git a/proto/activity/v1alpha/js.gensum b/proto/activity/v1alpha/js.gensum new file mode 100644 index 000000000..4659eeb31 --- /dev/null +++ b/proto/activity/v1alpha/js.gensum @@ -0,0 +1,2 @@ +srcs: 67073275389dafc231a09fc47630ec57 +outs: ff6e3daacd6da650a65cce6d39dc5dec