diff --git a/app/store/calendar.ts b/app/store/calendar.ts index 4d1c6b05e..1381a70a7 100644 --- a/app/store/calendar.ts +++ b/app/store/calendar.ts @@ -3,7 +3,6 @@ import Dexie, { type Table } from 'dexie'; import 'dexie-observable'; import 'dexie-syncable'; import { defineStore } from 'pinia'; -import '~/utils/dexie.ts'; import type { Calendar, CalendarEntry } from '~~/gen/ts/resources/calendar/calendar'; import { RsvpResponses } from '~~/gen/ts/resources/calendar/calendar'; import { NotificationCategory, NotificationType } from '~~/gen/ts/resources/notifications/notifications'; diff --git a/gen/go/proto/resources/common/cron/cron.pb.go b/gen/go/proto/resources/common/cron/cron.pb.go index 46934b8f0..048209c8e 100644 --- a/gen/go/proto/resources/common/cron/cron.pb.go +++ b/gen/go/proto/resources/common/cron/cron.pb.go @@ -7,8 +7,10 @@ package cron import ( + timestamp "github.com/fivenet-app/fivenet/gen/go/proto/resources/timestamp" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" ) @@ -20,10 +22,68 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type CronjobState int32 + +const ( + CronjobState_CRONJOB_STATE_UNSPECIFIED CronjobState = 0 + CronjobState_CRONJOB_STATE_WAITING CronjobState = 1 + CronjobState_CRONJOB_STATE_PENDING CronjobState = 2 + CronjobState_CRONJOB_STATE_RUNNING CronjobState = 3 +) + +// Enum value maps for CronjobState. +var ( + CronjobState_name = map[int32]string{ + 0: "CRONJOB_STATE_UNSPECIFIED", + 1: "CRONJOB_STATE_WAITING", + 2: "CRONJOB_STATE_PENDING", + 3: "CRONJOB_STATE_RUNNING", + } + CronjobState_value = map[string]int32{ + "CRONJOB_STATE_UNSPECIFIED": 0, + "CRONJOB_STATE_WAITING": 1, + "CRONJOB_STATE_PENDING": 2, + "CRONJOB_STATE_RUNNING": 3, + } +) + +func (x CronjobState) Enum() *CronjobState { + p := new(CronjobState) + *p = x + return p +} + +func (x CronjobState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CronjobState) Descriptor() protoreflect.EnumDescriptor { + return file_resources_common_cron_cron_proto_enumTypes[0].Descriptor() +} + +func (CronjobState) Type() protoreflect.EnumType { + return &file_resources_common_cron_cron_proto_enumTypes[0] +} + +func (x CronjobState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CronjobState.Descriptor instead. +func (CronjobState) EnumDescriptor() ([]byte, []int) { + return file_resources_common_cron_cron_proto_rawDescGZIP(), []int{0} +} + type Cronjob struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Schedule string `protobuf:"bytes,2,opt,name=schedule,proto3" json:"schedule,omitempty"` + State CronjobState `protobuf:"varint,3,opt,name=state,proto3,enum=resources.common.cron.CronjobState" json:"state,omitempty"` + NextScheduleTime *timestamp.Timestamp `protobuf:"bytes,4,opt,name=next_schedule_time,json=nextScheduleTime,proto3" json:"next_schedule_time,omitempty"` + LastAttemptTime *timestamp.Timestamp `protobuf:"bytes,5,opt,name=last_attempt_time,json=lastAttemptTime,proto3" json:"last_attempt_time,omitempty"` } func (x *Cronjob) Reset() { @@ -58,19 +118,146 @@ func (*Cronjob) Descriptor() ([]byte, []int) { return file_resources_common_cron_cron_proto_rawDescGZIP(), []int{0} } +func (x *Cronjob) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Cronjob) GetSchedule() string { + if x != nil { + return x.Schedule + } + return "" +} + +func (x *Cronjob) GetState() CronjobState { + if x != nil { + return x.State + } + return CronjobState_CRONJOB_STATE_UNSPECIFIED +} + +func (x *Cronjob) GetNextScheduleTime() *timestamp.Timestamp { + if x != nil { + return x.NextScheduleTime + } + return nil +} + +func (x *Cronjob) GetLastAttemptTime() *timestamp.Timestamp { + if x != nil { + return x.LastAttemptTime + } + return nil +} + +type CronjobData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UpdatedAt *timestamp.Timestamp `protobuf:"bytes,1,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Data *anypb.Any `protobuf:"bytes,2,opt,name=data,proto3,oneof" json:"data,omitempty"` +} + +func (x *CronjobData) Reset() { + *x = CronjobData{} + if protoimpl.UnsafeEnabled { + mi := &file_resources_common_cron_cron_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CronjobData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CronjobData) ProtoMessage() {} + +func (x *CronjobData) ProtoReflect() protoreflect.Message { + mi := &file_resources_common_cron_cron_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 CronjobData.ProtoReflect.Descriptor instead. +func (*CronjobData) Descriptor() ([]byte, []int) { + return file_resources_common_cron_cron_proto_rawDescGZIP(), []int{1} +} + +func (x *CronjobData) GetUpdatedAt() *timestamp.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *CronjobData) GetData() *anypb.Any { + if x != nil { + return x.Data + } + return nil +} + var File_resources_common_cron_cron_proto protoreflect.FileDescriptor var file_resources_common_cron_cron_proto_rawDesc = []byte{ 0x0a, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x63, 0x72, 0x6f, 0x6e, 0x22, 0x09, 0x0a, 0x07, 0x43, 0x72, 0x6f, - 0x6e, 0x6a, 0x6f, 0x62, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x74, 0x2d, 0x61, 0x70, 0x70, 0x2f, 0x66, - 0x69, 0x76, 0x65, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x3b, 0x63, 0x72, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x63, 0x72, 0x6f, 0x6e, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x02, 0x0a, 0x07, 0x43, 0x72, + 0x6f, 0x6e, 0x6a, 0x6f, 0x62, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x68, + 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x63, 0x72, 0x6f, 0x6e, 0x2e, 0x43, 0x72, 0x6f, + 0x6e, 0x6a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x4c, 0x0a, 0x12, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, + 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x6e, 0x65, + 0x78, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4a, + 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x41, + 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x0b, 0x43, + 0x72, 0x6f, 0x6e, 0x6a, 0x6f, 0x62, 0x44, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, + 0x61, 0x2a, 0x7e, 0x0a, 0x0c, 0x43, 0x72, 0x6f, 0x6e, 0x6a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x43, 0x52, 0x4f, 0x4e, 0x4a, 0x4f, 0x42, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x19, 0x0a, 0x15, 0x43, 0x52, 0x4f, 0x4e, 0x4a, 0x4f, 0x42, 0x5f, 0x53, 0x54, 0x41, 0x54, + 0x45, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x43, + 0x52, 0x4f, 0x4e, 0x4a, 0x4f, 0x42, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x50, 0x45, 0x4e, + 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x52, 0x4f, 0x4e, 0x4a, 0x4f, + 0x42, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, + 0x03, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x66, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x74, 0x2d, 0x61, 0x70, 0x70, 0x2f, 0x66, 0x69, 0x76, 0x65, + 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x3b, 0x63, 0x72, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -85,16 +272,26 @@ func file_resources_common_cron_cron_proto_rawDescGZIP() []byte { return file_resources_common_cron_cron_proto_rawDescData } -var file_resources_common_cron_cron_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_resources_common_cron_cron_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_resources_common_cron_cron_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_resources_common_cron_cron_proto_goTypes = []any{ - (*Cronjob)(nil), // 0: resources.common.cron.Cronjob + (CronjobState)(0), // 0: resources.common.cron.CronjobState + (*Cronjob)(nil), // 1: resources.common.cron.Cronjob + (*CronjobData)(nil), // 2: resources.common.cron.CronjobData + (*timestamp.Timestamp)(nil), // 3: resources.timestamp.Timestamp + (*anypb.Any)(nil), // 4: google.protobuf.Any } var file_resources_common_cron_cron_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: resources.common.cron.Cronjob.state:type_name -> resources.common.cron.CronjobState + 3, // 1: resources.common.cron.Cronjob.next_schedule_time:type_name -> resources.timestamp.Timestamp + 3, // 2: resources.common.cron.Cronjob.last_attempt_time:type_name -> resources.timestamp.Timestamp + 3, // 3: resources.common.cron.CronjobData.updated_at:type_name -> resources.timestamp.Timestamp + 4, // 4: resources.common.cron.CronjobData.data:type_name -> google.protobuf.Any + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_resources_common_cron_cron_proto_init() } @@ -115,19 +312,33 @@ func file_resources_common_cron_cron_proto_init() { return nil } } + file_resources_common_cron_cron_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*CronjobData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } + file_resources_common_cron_cron_proto_msgTypes[1].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_resources_common_cron_cron_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, + NumEnums: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, GoTypes: file_resources_common_cron_cron_proto_goTypes, DependencyIndexes: file_resources_common_cron_cron_proto_depIdxs, + EnumInfos: file_resources_common_cron_cron_proto_enumTypes, MessageInfos: file_resources_common_cron_cron_proto_msgTypes, }.Build() File_resources_common_cron_cron_proto = out.File diff --git a/gen/go/proto/resources/common/cron/cron.pb.validate.go b/gen/go/proto/resources/common/cron/cron.pb.validate.go index 4bbe7ae5a..b6a9d977f 100644 --- a/gen/go/proto/resources/common/cron/cron.pb.validate.go +++ b/gen/go/proto/resources/common/cron/cron.pb.validate.go @@ -56,6 +56,70 @@ func (m *Cronjob) validate(all bool) error { var errors []error + // no validation rules for Name + + // no validation rules for Schedule + + // no validation rules for State + + if all { + switch v := interface{}(m.GetNextScheduleTime()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CronjobValidationError{ + field: "NextScheduleTime", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CronjobValidationError{ + field: "NextScheduleTime", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetNextScheduleTime()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CronjobValidationError{ + field: "NextScheduleTime", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetLastAttemptTime()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CronjobValidationError{ + field: "LastAttemptTime", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CronjobValidationError{ + field: "LastAttemptTime", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetLastAttemptTime()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CronjobValidationError{ + field: "LastAttemptTime", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { return CronjobMultiError(errors) } @@ -132,3 +196,164 @@ var _ interface { Cause() error ErrorName() string } = CronjobValidationError{} + +// Validate checks the field values on CronjobData with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *CronjobData) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CronjobData with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in CronjobDataMultiError, or +// nil if none found. +func (m *CronjobData) ValidateAll() error { + return m.validate(true) +} + +func (m *CronjobData) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetUpdatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CronjobDataValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CronjobDataValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CronjobDataValidationError{ + field: "UpdatedAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if m.Data != nil { + + if all { + switch v := interface{}(m.GetData()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CronjobDataValidationError{ + field: "Data", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CronjobDataValidationError{ + field: "Data", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CronjobDataValidationError{ + field: "Data", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return CronjobDataMultiError(errors) + } + + return nil +} + +// CronjobDataMultiError is an error wrapping multiple validation errors +// returned by CronjobData.ValidateAll() if the designated constraints aren't met. +type CronjobDataMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CronjobDataMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CronjobDataMultiError) AllErrors() []error { return m } + +// CronjobDataValidationError is the validation error returned by +// CronjobData.Validate if the designated constraints aren't met. +type CronjobDataValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CronjobDataValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CronjobDataValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CronjobDataValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CronjobDataValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CronjobDataValidationError) ErrorName() string { return "CronjobDataValidationError" } + +// Error satisfies the builtin error interface +func (e CronjobDataValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCronjobData.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CronjobDataValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CronjobDataValidationError{} diff --git a/gen/go/proto/resources/common/uuid.go b/gen/go/proto/resources/common/uuid.go new file mode 100644 index 000000000..dd747a611 --- /dev/null +++ b/gen/go/proto/resources/common/uuid.go @@ -0,0 +1,31 @@ +package common + +import ( + "database/sql/driver" + + "github.com/google/uuid" +) + +// Scan implements driver.Valuer for protobuf UUID. +func (x *UUID) Scan(value any) error { + switch t := value.(type) { + case string: + uid, err := uuid.FromBytes([]byte(t)) + x.Uuid = uid.String() + return err + case []byte: + uid, err := uuid.FromBytes(t) + x.Uuid = uid.String() + return err + } + return nil +} + +// Value marshals the value into driver.Valuer. +func (x *UUID) Value() (driver.Value, error) { + if x == nil { + return nil, nil + } + + return x.Uuid, nil +} diff --git a/gen/go/proto/resources/common/uuid.pb.go b/gen/go/proto/resources/common/uuid.pb.go new file mode 100644 index 000000000..fba3b14f0 --- /dev/null +++ b/gen/go/proto/resources/common/uuid.pb.go @@ -0,0 +1,149 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v3.20.3 +// source: resources/common/uuid.proto + +package common + +import ( + _ "github.com/envoyproxy/protoc-gen-validate/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +type UUID struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` +} + +func (x *UUID) Reset() { + *x = UUID{} + if protoimpl.UnsafeEnabled { + mi := &file_resources_common_uuid_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UUID) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UUID) ProtoMessage() {} + +func (x *UUID) ProtoReflect() protoreflect.Message { + mi := &file_resources_common_uuid_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 UUID.ProtoReflect.Descriptor instead. +func (*UUID) Descriptor() ([]byte, []int) { + return file_resources_common_uuid_proto_rawDescGZIP(), []int{0} +} + +func (x *UUID) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +var File_resources_common_uuid_proto protoreflect.FileDescriptor + +var file_resources_common_uuid_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2f, 0x75, 0x75, 0x69, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x1a, + 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x04, 0x55, 0x55, 0x49, 0x44, + 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, + 0xfa, 0x42, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x42, 0x45, + 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x69, 0x76, + 0x65, 0x6e, 0x65, 0x74, 0x2d, 0x61, 0x70, 0x70, 0x2f, 0x66, 0x69, 0x76, 0x65, 0x6e, 0x65, 0x74, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_resources_common_uuid_proto_rawDescOnce sync.Once + file_resources_common_uuid_proto_rawDescData = file_resources_common_uuid_proto_rawDesc +) + +func file_resources_common_uuid_proto_rawDescGZIP() []byte { + file_resources_common_uuid_proto_rawDescOnce.Do(func() { + file_resources_common_uuid_proto_rawDescData = protoimpl.X.CompressGZIP(file_resources_common_uuid_proto_rawDescData) + }) + return file_resources_common_uuid_proto_rawDescData +} + +var file_resources_common_uuid_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_resources_common_uuid_proto_goTypes = []any{ + (*UUID)(nil), // 0: resources.common.UUID +} +var file_resources_common_uuid_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_resources_common_uuid_proto_init() } +func file_resources_common_uuid_proto_init() { + if File_resources_common_uuid_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_resources_common_uuid_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*UUID); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_resources_common_uuid_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_resources_common_uuid_proto_goTypes, + DependencyIndexes: file_resources_common_uuid_proto_depIdxs, + MessageInfos: file_resources_common_uuid_proto_msgTypes, + }.Build() + File_resources_common_uuid_proto = out.File + file_resources_common_uuid_proto_rawDesc = nil + file_resources_common_uuid_proto_goTypes = nil + file_resources_common_uuid_proto_depIdxs = nil +} diff --git a/gen/go/proto/resources/common/uuid.pb.validate.go b/gen/go/proto/resources/common/uuid.pb.validate.go new file mode 100644 index 000000000..94759337f --- /dev/null +++ b/gen/go/proto/resources/common/uuid.pb.validate.go @@ -0,0 +1,157 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: resources/common/uuid.proto + +package common + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// define the regex for a UUID once up-front +var _uuid_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$") + +// Validate checks the field values on UUID with the rules defined in the proto +// definition for this message. If any rules are violated, the first error +// encountered is returned, or nil if there are no violations. +func (m *UUID) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UUID with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in UUIDMultiError, or nil if none found. +func (m *UUID) ValidateAll() error { + return m.validate(true) +} + +func (m *UUID) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if err := m._validateUuid(m.GetUuid()); err != nil { + err = UUIDValidationError{ + field: "Uuid", + reason: "value must be a valid UUID", + cause: err, + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return UUIDMultiError(errors) + } + + return nil +} + +func (m *UUID) _validateUuid(uuid string) error { + if matched := _uuid_uuidPattern.MatchString(uuid); !matched { + return errors.New("invalid uuid format") + } + + return nil +} + +// UUIDMultiError is an error wrapping multiple validation errors returned by +// UUID.ValidateAll() if the designated constraints aren't met. +type UUIDMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UUIDMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UUIDMultiError) AllErrors() []error { return m } + +// UUIDValidationError is the validation error returned by UUID.Validate if the +// designated constraints aren't met. +type UUIDValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UUIDValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UUIDValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UUIDValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UUIDValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UUIDValidationError) ErrorName() string { return "UUIDValidationError" } + +// Error satisfies the builtin error interface +func (e UUIDValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUUID.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UUIDValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UUIDValidationError{} diff --git a/gen/grpc-api.md b/gen/grpc-api.md index 82fb1522f..03ca4de0f 100644 --- a/gen/grpc-api.md +++ b/gen/grpc-api.md @@ -67,6 +67,12 @@ - [resources/common/cron/cron.proto](#resources_common_cron_cron-proto) - [Cronjob](#resources-common-cron-Cronjob) + - [CronjobData](#resources-common-cron-CronjobData) + + - [CronjobState](#resources-common-cron-CronjobState) + +- [resources/common/uuid.proto](#resources_common_uuid-proto) + - [UUID](#resources-common-UUID) - [resources/documents/access.proto](#resources_documents_access-proto) - [DocumentAccess](#resources-documents-DocumentAccess) @@ -1612,6 +1618,76 @@ +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | | +| schedule | [string](#string) | | | +| state | [CronjobState](#resources-common-cron-CronjobState) | | | +| next_schedule_time | [resources.timestamp.Timestamp](#resources-timestamp-Timestamp) | | | +| last_attempt_time | [resources.timestamp.Timestamp](#resources-timestamp-Timestamp) | | | + + + + + + + + +### CronjobData + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| updated_at | [resources.timestamp.Timestamp](#resources-timestamp-Timestamp) | | | +| data | [google.protobuf.Any](#google-protobuf-Any) | optional | | + + + + + + + + + + +### CronjobState + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| CRONJOB_STATE_UNSPECIFIED | 0 | | +| CRONJOB_STATE_WAITING | 1 | | +| CRONJOB_STATE_PENDING | 2 | | +| CRONJOB_STATE_RUNNING | 3 | | + + + + + + + + + + + +
+ +## resources/common/uuid.proto + + + + + +### UUID + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| uuid | [string](#string) | | | + + diff --git a/gen/ts/google/protobuf/any.ts b/gen/ts/google/protobuf/any.ts new file mode 100644 index 000000000..c359a3366 --- /dev/null +++ b/gen/ts/google/protobuf/any.ts @@ -0,0 +1,322 @@ +// @generated by protobuf-ts 2.9.4 with parameter optimize_speed,long_type_number,force_server_none +// @generated from protobuf file "google/protobuf/any.proto" (package "google.protobuf", syntax proto3) +// @ts-nocheck +// +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; +import type { IBinaryWriter } from "@protobuf-ts/runtime"; +import { WireType } from "@protobuf-ts/runtime"; +import type { IBinaryReader } from "@protobuf-ts/runtime"; +import { UnknownFieldHandler } from "@protobuf-ts/runtime"; +import type { PartialMessage } from "@protobuf-ts/runtime"; +import { reflectionMergePartial } from "@protobuf-ts/runtime"; +import { isJsonObject } from "@protobuf-ts/runtime"; +import { typeofJsonValue } from "@protobuf-ts/runtime"; +import type { JsonValue } from "@protobuf-ts/runtime"; +import { jsonWriteOptions } from "@protobuf-ts/runtime"; +import type { JsonReadOptions } from "@protobuf-ts/runtime"; +import type { JsonWriteOptions } from "@protobuf-ts/runtime"; +import type { BinaryReadOptions } from "@protobuf-ts/runtime"; +import type { IMessageType } from "@protobuf-ts/runtime"; +import { MessageType } from "@protobuf-ts/runtime"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName":