From b8d45ab42ebf8ef5b966ac700d3582b70366eb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 25 Mar 2022 14:12:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=84=9A=E6=9C=AC=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=85=8D=E7=BD=AE=E5=92=8CRPC=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/nodeconfigs/node_config.go | 3 + pkg/rpc/pb/model_script.pb.go | 203 +++ pkg/rpc/pb/service_script.pb.go | 1518 ++++++++++++++++++++++ pkg/rpc/protos/models/model_script.proto | 14 + pkg/rpc/protos/service_script.proto | 111 ++ pkg/serverconfigs/script_common.go | 11 + 6 files changed, 1860 insertions(+) create mode 100644 pkg/rpc/pb/model_script.pb.go create mode 100644 pkg/rpc/pb/service_script.pb.go create mode 100644 pkg/rpc/protos/models/model_script.proto create mode 100644 pkg/rpc/protos/service_script.proto create mode 100644 pkg/serverconfigs/script_common.go diff --git a/pkg/nodeconfigs/node_config.go b/pkg/nodeconfigs/node_config.go index 1190cd7..d2c4a5d 100644 --- a/pkg/nodeconfigs/node_config.go +++ b/pkg/nodeconfigs/node_config.go @@ -65,6 +65,9 @@ type NodeConfig struct { // 自动白名单 AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"` + // 脚本 + CommonScripts []*serverconfigs.CommonScript `yaml:"commonScripts" json:"commonScripts"` + paddedId string // firewall diff --git a/pkg/rpc/pb/model_script.pb.go b/pkg/rpc/pb/model_script.pb.go new file mode 100644 index 0000000..94e02f7 --- /dev/null +++ b/pkg/rpc/pb/model_script.pb.go @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.19.4 +// source: models/model_script.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Script struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"` + IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Filename string `protobuf:"bytes,5,opt,name=filename,proto3" json:"filename,omitempty"` + Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"` + UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` +} + +func (x *Script) Reset() { + *x = Script{} + if protoimpl.UnsafeEnabled { + mi := &file_models_model_script_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Script) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Script) ProtoMessage() {} + +func (x *Script) ProtoReflect() protoreflect.Message { + mi := &file_models_model_script_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 Script.ProtoReflect.Descriptor instead. +func (*Script) Descriptor() ([]byte, []int) { + return file_models_model_script_proto_rawDescGZIP(), []int{0} +} + +func (x *Script) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Script) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Script) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +func (x *Script) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Script) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *Script) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Script) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +var File_models_model_script_proto protoreflect.FileDescriptor + +var file_models_model_script_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, + 0xa6, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, + 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, + 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, + 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_models_model_script_proto_rawDescOnce sync.Once + file_models_model_script_proto_rawDescData = file_models_model_script_proto_rawDesc +) + +func file_models_model_script_proto_rawDescGZIP() []byte { + file_models_model_script_proto_rawDescOnce.Do(func() { + file_models_model_script_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_script_proto_rawDescData) + }) + return file_models_model_script_proto_rawDescData +} + +var file_models_model_script_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_models_model_script_proto_goTypes = []interface{}{ + (*Script)(nil), // 0: pb.Script +} +var file_models_model_script_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_models_model_script_proto_init() } +func file_models_model_script_proto_init() { + if File_models_model_script_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_models_model_script_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Script); 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_models_model_script_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_models_model_script_proto_goTypes, + DependencyIndexes: file_models_model_script_proto_depIdxs, + MessageInfos: file_models_model_script_proto_msgTypes, + }.Build() + File_models_model_script_proto = out.File + file_models_model_script_proto_rawDesc = nil + file_models_model_script_proto_goTypes = nil + file_models_model_script_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/service_script.pb.go b/pkg/rpc/pb/service_script.pb.go new file mode 100644 index 0000000..caf5935 --- /dev/null +++ b/pkg/rpc/pb/service_script.pb.go @@ -0,0 +1,1518 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.19.4 +// source: service_script.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 添加脚本 +type CreateScriptRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"` + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *CreateScriptRequest) Reset() { + *x = CreateScriptRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateScriptRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScriptRequest) ProtoMessage() {} + +func (x *CreateScriptRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_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 CreateScriptRequest.ProtoReflect.Descriptor instead. +func (*CreateScriptRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateScriptRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateScriptRequest) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *CreateScriptRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type CreateScriptResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptId int64 `protobuf:"varint,1,opt,name=scriptId,proto3" json:"scriptId,omitempty"` +} + +func (x *CreateScriptResponse) Reset() { + *x = CreateScriptResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateScriptResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScriptResponse) ProtoMessage() {} + +func (x *CreateScriptResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_script_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 CreateScriptResponse.ProtoReflect.Descriptor instead. +func (*CreateScriptResponse) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateScriptResponse) GetScriptId() int64 { + if x != nil { + return x.ScriptId + } + return 0 +} + +// 删除脚本 +type DeleteScriptRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptId int64 `protobuf:"varint,1,opt,name=scriptId,proto3" json:"scriptId,omitempty"` +} + +func (x *DeleteScriptRequest) Reset() { + *x = DeleteScriptRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteScriptRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScriptRequest) ProtoMessage() {} + +func (x *DeleteScriptRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_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 DeleteScriptRequest.ProtoReflect.Descriptor instead. +func (*DeleteScriptRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{2} +} + +func (x *DeleteScriptRequest) GetScriptId() int64 { + if x != nil { + return x.ScriptId + } + return 0 +} + +// 计算脚本数量 +type CountAllEnabledScriptsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *CountAllEnabledScriptsRequest) Reset() { + *x = CountAllEnabledScriptsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledScriptsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledScriptsRequest) ProtoMessage() {} + +func (x *CountAllEnabledScriptsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_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 CountAllEnabledScriptsRequest.ProtoReflect.Descriptor instead. +func (*CountAllEnabledScriptsRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{3} +} + +func (x *CountAllEnabledScriptsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +// 列出单页脚本 +type ListEnabledScriptsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListEnabledScriptsRequest) Reset() { + *x = ListEnabledScriptsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledScriptsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledScriptsRequest) ProtoMessage() {} + +func (x *ListEnabledScriptsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[4] + 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 ListEnabledScriptsRequest.ProtoReflect.Descriptor instead. +func (*ListEnabledScriptsRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{4} +} + +func (x *ListEnabledScriptsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ListEnabledScriptsRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListEnabledScriptsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListEnabledScriptsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Scripts []*Script `protobuf:"bytes,1,rep,name=scripts,proto3" json:"scripts,omitempty"` +} + +func (x *ListEnabledScriptsResponse) Reset() { + *x = ListEnabledScriptsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledScriptsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledScriptsResponse) ProtoMessage() {} + +func (x *ListEnabledScriptsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[5] + 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 ListEnabledScriptsResponse.ProtoReflect.Descriptor instead. +func (*ListEnabledScriptsResponse) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{5} +} + +func (x *ListEnabledScriptsResponse) GetScripts() []*Script { + if x != nil { + return x.Scripts + } + return nil +} + +// 发布脚本 +type PublishScriptsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *PublishScriptsRequest) Reset() { + *x = PublishScriptsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishScriptsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishScriptsRequest) ProtoMessage() {} + +func (x *PublishScriptsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[6] + 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 PublishScriptsRequest.ProtoReflect.Descriptor instead. +func (*PublishScriptsRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{6} +} + +func (x *PublishScriptsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +// 检查脚本是否需要有更新 +type CheckScriptUpdatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *CheckScriptUpdatesRequest) Reset() { + *x = CheckScriptUpdatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckScriptUpdatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckScriptUpdatesRequest) ProtoMessage() {} + +func (x *CheckScriptUpdatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[7] + 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 CheckScriptUpdatesRequest.ProtoReflect.Descriptor instead. +func (*CheckScriptUpdatesRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{7} +} + +func (x *CheckScriptUpdatesRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type CheckScriptUpdatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HasUpdates bool `protobuf:"varint,1,opt,name=hasUpdates,proto3" json:"hasUpdates,omitempty"` + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *CheckScriptUpdatesResponse) Reset() { + *x = CheckScriptUpdatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckScriptUpdatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckScriptUpdatesResponse) ProtoMessage() {} + +func (x *CheckScriptUpdatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[8] + 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 CheckScriptUpdatesResponse.ProtoReflect.Descriptor instead. +func (*CheckScriptUpdatesResponse) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{8} +} + +func (x *CheckScriptUpdatesResponse) GetHasUpdates() bool { + if x != nil { + return x.HasUpdates + } + return false +} + +func (x *CheckScriptUpdatesResponse) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +// 查找单个脚本 +type FindEnabledScriptRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptId int64 `protobuf:"varint,1,opt,name=scriptId,proto3" json:"scriptId,omitempty"` +} + +func (x *FindEnabledScriptRequest) Reset() { + *x = FindEnabledScriptRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledScriptRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledScriptRequest) ProtoMessage() {} + +func (x *FindEnabledScriptRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[9] + 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 FindEnabledScriptRequest.ProtoReflect.Descriptor instead. +func (*FindEnabledScriptRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{9} +} + +func (x *FindEnabledScriptRequest) GetScriptId() int64 { + if x != nil { + return x.ScriptId + } + return 0 +} + +type FindEnabledScriptResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Script *Script `protobuf:"bytes,1,opt,name=script,proto3" json:"script,omitempty"` +} + +func (x *FindEnabledScriptResponse) Reset() { + *x = FindEnabledScriptResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledScriptResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledScriptResponse) ProtoMessage() {} + +func (x *FindEnabledScriptResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[10] + 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 FindEnabledScriptResponse.ProtoReflect.Descriptor instead. +func (*FindEnabledScriptResponse) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{10} +} + +func (x *FindEnabledScriptResponse) GetScript() *Script { + if x != nil { + return x.Script + } + return nil +} + +// 修改脚本 +type UpdateScriptRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptId int64 `protobuf:"varint,1,opt,name=scriptId,proto3" json:"scriptId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` + Code string `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"` + IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` +} + +func (x *UpdateScriptRequest) Reset() { + *x = UpdateScriptRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateScriptRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateScriptRequest) ProtoMessage() {} + +func (x *UpdateScriptRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[11] + 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 UpdateScriptRequest.ProtoReflect.Descriptor instead. +func (*UpdateScriptRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdateScriptRequest) GetScriptId() int64 { + if x != nil { + return x.ScriptId + } + return 0 +} + +func (x *UpdateScriptRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateScriptRequest) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *UpdateScriptRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *UpdateScriptRequest) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +// 组合脚本配置 +type ComposeScriptConfigsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ComposeScriptConfigsRequest) Reset() { + *x = ComposeScriptConfigsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComposeScriptConfigsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComposeScriptConfigsRequest) ProtoMessage() {} + +func (x *ComposeScriptConfigsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[12] + 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 ComposeScriptConfigsRequest.ProtoReflect.Descriptor instead. +func (*ComposeScriptConfigsRequest) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{12} +} + +type ComposeScriptConfigsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ScriptConfigsJSON []byte `protobuf:"bytes,1,opt,name=scriptConfigsJSON,proto3" json:"scriptConfigsJSON,omitempty"` +} + +func (x *ComposeScriptConfigsResponse) Reset() { + *x = ComposeScriptConfigsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_script_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ComposeScriptConfigsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComposeScriptConfigsResponse) ProtoMessage() {} + +func (x *ComposeScriptConfigsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_script_proto_msgTypes[13] + 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 ComposeScriptConfigsResponse.ProtoReflect.Descriptor instead. +func (*ComposeScriptConfigsResponse) Descriptor() ([]byte, []int) { + return file_service_script_proto_rawDescGZIP(), []int{13} +} + +func (x *ComposeScriptConfigsResponse) GetScriptConfigsJSON() []byte { + if x != nil { + return x.ScriptConfigsJSON + } + return nil +} + +var File_service_script_proto protoreflect.FileDescriptor + +var file_service_script_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, + 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x59, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x32, 0x0a, 0x14, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x22, + 0x31, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x49, 0x64, 0x22, 0x37, 0x0a, 0x1d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x5f, 0x0a, 0x19, 0x4c, + 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a, + 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, + 0x2e, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x07, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, + 0x22, 0x2f, 0x0a, 0x15, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x53, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, + 0x64, 0x22, 0x33, 0x0a, 0x19, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x56, 0x0a, 0x1a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x61, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x68, 0x61, 0x73, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x36, + 0x0a, 0x18, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, + 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x08, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, + 0x73, 0x4f, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x4c, 0x0a, 0x1c, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x4a, 0x53, 0x4f, 0x4e, + 0x32, 0xab, 0x05, 0x0a, 0x0d, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, + 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, + 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, + 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, + 0x68, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x73, 0x68, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x1c, 0x2e, + 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x12, 0x59, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, + 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_script_proto_rawDescOnce sync.Once + file_service_script_proto_rawDescData = file_service_script_proto_rawDesc +) + +func file_service_script_proto_rawDescGZIP() []byte { + file_service_script_proto_rawDescOnce.Do(func() { + file_service_script_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_script_proto_rawDescData) + }) + return file_service_script_proto_rawDescData +} + +var file_service_script_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_service_script_proto_goTypes = []interface{}{ + (*CreateScriptRequest)(nil), // 0: pb.CreateScriptRequest + (*CreateScriptResponse)(nil), // 1: pb.CreateScriptResponse + (*DeleteScriptRequest)(nil), // 2: pb.DeleteScriptRequest + (*CountAllEnabledScriptsRequest)(nil), // 3: pb.CountAllEnabledScriptsRequest + (*ListEnabledScriptsRequest)(nil), // 4: pb.ListEnabledScriptsRequest + (*ListEnabledScriptsResponse)(nil), // 5: pb.ListEnabledScriptsResponse + (*PublishScriptsRequest)(nil), // 6: pb.PublishScriptsRequest + (*CheckScriptUpdatesRequest)(nil), // 7: pb.CheckScriptUpdatesRequest + (*CheckScriptUpdatesResponse)(nil), // 8: pb.CheckScriptUpdatesResponse + (*FindEnabledScriptRequest)(nil), // 9: pb.FindEnabledScriptRequest + (*FindEnabledScriptResponse)(nil), // 10: pb.FindEnabledScriptResponse + (*UpdateScriptRequest)(nil), // 11: pb.UpdateScriptRequest + (*ComposeScriptConfigsRequest)(nil), // 12: pb.ComposeScriptConfigsRequest + (*ComposeScriptConfigsResponse)(nil), // 13: pb.ComposeScriptConfigsResponse + (*Script)(nil), // 14: pb.Script + (*RPCSuccess)(nil), // 15: pb.RPCSuccess + (*RPCCountResponse)(nil), // 16: pb.RPCCountResponse +} +var file_service_script_proto_depIdxs = []int32{ + 14, // 0: pb.ListEnabledScriptsResponse.scripts:type_name -> pb.Script + 14, // 1: pb.FindEnabledScriptResponse.script:type_name -> pb.Script + 0, // 2: pb.ScriptService.createScript:input_type -> pb.CreateScriptRequest + 2, // 3: pb.ScriptService.deleteScript:input_type -> pb.DeleteScriptRequest + 3, // 4: pb.ScriptService.countAllEnabledScripts:input_type -> pb.CountAllEnabledScriptsRequest + 4, // 5: pb.ScriptService.listEnabledScripts:input_type -> pb.ListEnabledScriptsRequest + 6, // 6: pb.ScriptService.publishScripts:input_type -> pb.PublishScriptsRequest + 7, // 7: pb.ScriptService.checkScriptUpdates:input_type -> pb.CheckScriptUpdatesRequest + 9, // 8: pb.ScriptService.findEnabledScript:input_type -> pb.FindEnabledScriptRequest + 11, // 9: pb.ScriptService.updateScript:input_type -> pb.UpdateScriptRequest + 12, // 10: pb.ScriptService.composeScriptConfigs:input_type -> pb.ComposeScriptConfigsRequest + 1, // 11: pb.ScriptService.createScript:output_type -> pb.CreateScriptResponse + 15, // 12: pb.ScriptService.deleteScript:output_type -> pb.RPCSuccess + 16, // 13: pb.ScriptService.countAllEnabledScripts:output_type -> pb.RPCCountResponse + 5, // 14: pb.ScriptService.listEnabledScripts:output_type -> pb.ListEnabledScriptsResponse + 15, // 15: pb.ScriptService.publishScripts:output_type -> pb.RPCSuccess + 8, // 16: pb.ScriptService.checkScriptUpdates:output_type -> pb.CheckScriptUpdatesResponse + 10, // 17: pb.ScriptService.findEnabledScript:output_type -> pb.FindEnabledScriptResponse + 15, // 18: pb.ScriptService.updateScript:output_type -> pb.RPCSuccess + 13, // 19: pb.ScriptService.composeScriptConfigs:output_type -> pb.ComposeScriptConfigsResponse + 11, // [11:20] is the sub-list for method output_type + 2, // [2:11] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_service_script_proto_init() } +func file_service_script_proto_init() { + if File_service_script_proto != nil { + return + } + file_models_model_script_proto_init() + file_models_rpc_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_script_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateScriptRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateScriptResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteScriptRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledScriptsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledScriptsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledScriptsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishScriptsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckScriptUpdatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckScriptUpdatesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledScriptRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledScriptResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateScriptRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComposeScriptConfigsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_script_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ComposeScriptConfigsResponse); 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_service_script_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_script_proto_goTypes, + DependencyIndexes: file_service_script_proto_depIdxs, + MessageInfos: file_service_script_proto_msgTypes, + }.Build() + File_service_script_proto = out.File + file_service_script_proto_rawDesc = nil + file_service_script_proto_goTypes = nil + file_service_script_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ScriptServiceClient is the client API for ScriptService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ScriptServiceClient interface { + // 添加脚本 + CreateScript(ctx context.Context, in *CreateScriptRequest, opts ...grpc.CallOption) (*CreateScriptResponse, error) + // 删除脚本 + DeleteScript(ctx context.Context, in *DeleteScriptRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 计算脚本数量 + CountAllEnabledScripts(ctx context.Context, in *CountAllEnabledScriptsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) + // 列出单页脚本 + ListEnabledScripts(ctx context.Context, in *ListEnabledScriptsRequest, opts ...grpc.CallOption) (*ListEnabledScriptsResponse, error) + // 发布脚本 + PublishScripts(ctx context.Context, in *PublishScriptsRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 检查脚本是否需要有更新 + CheckScriptUpdates(ctx context.Context, in *CheckScriptUpdatesRequest, opts ...grpc.CallOption) (*CheckScriptUpdatesResponse, error) + // 查找单个脚本 + FindEnabledScript(ctx context.Context, in *FindEnabledScriptRequest, opts ...grpc.CallOption) (*FindEnabledScriptResponse, error) + // 修改脚本 + UpdateScript(ctx context.Context, in *UpdateScriptRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 组合脚本配置 + ComposeScriptConfigs(ctx context.Context, in *ComposeScriptConfigsRequest, opts ...grpc.CallOption) (*ComposeScriptConfigsResponse, error) +} + +type scriptServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewScriptServiceClient(cc grpc.ClientConnInterface) ScriptServiceClient { + return &scriptServiceClient{cc} +} + +func (c *scriptServiceClient) CreateScript(ctx context.Context, in *CreateScriptRequest, opts ...grpc.CallOption) (*CreateScriptResponse, error) { + out := new(CreateScriptResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/createScript", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) DeleteScript(ctx context.Context, in *DeleteScriptRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.ScriptService/deleteScript", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) CountAllEnabledScripts(ctx context.Context, in *CountAllEnabledScriptsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) { + out := new(RPCCountResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/countAllEnabledScripts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) ListEnabledScripts(ctx context.Context, in *ListEnabledScriptsRequest, opts ...grpc.CallOption) (*ListEnabledScriptsResponse, error) { + out := new(ListEnabledScriptsResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/listEnabledScripts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) PublishScripts(ctx context.Context, in *PublishScriptsRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.ScriptService/publishScripts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) CheckScriptUpdates(ctx context.Context, in *CheckScriptUpdatesRequest, opts ...grpc.CallOption) (*CheckScriptUpdatesResponse, error) { + out := new(CheckScriptUpdatesResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/checkScriptUpdates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) FindEnabledScript(ctx context.Context, in *FindEnabledScriptRequest, opts ...grpc.CallOption) (*FindEnabledScriptResponse, error) { + out := new(FindEnabledScriptResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/findEnabledScript", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) UpdateScript(ctx context.Context, in *UpdateScriptRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.ScriptService/updateScript", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *scriptServiceClient) ComposeScriptConfigs(ctx context.Context, in *ComposeScriptConfigsRequest, opts ...grpc.CallOption) (*ComposeScriptConfigsResponse, error) { + out := new(ComposeScriptConfigsResponse) + err := c.cc.Invoke(ctx, "/pb.ScriptService/composeScriptConfigs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ScriptServiceServer is the server API for ScriptService service. +type ScriptServiceServer interface { + // 添加脚本 + CreateScript(context.Context, *CreateScriptRequest) (*CreateScriptResponse, error) + // 删除脚本 + DeleteScript(context.Context, *DeleteScriptRequest) (*RPCSuccess, error) + // 计算脚本数量 + CountAllEnabledScripts(context.Context, *CountAllEnabledScriptsRequest) (*RPCCountResponse, error) + // 列出单页脚本 + ListEnabledScripts(context.Context, *ListEnabledScriptsRequest) (*ListEnabledScriptsResponse, error) + // 发布脚本 + PublishScripts(context.Context, *PublishScriptsRequest) (*RPCSuccess, error) + // 检查脚本是否需要有更新 + CheckScriptUpdates(context.Context, *CheckScriptUpdatesRequest) (*CheckScriptUpdatesResponse, error) + // 查找单个脚本 + FindEnabledScript(context.Context, *FindEnabledScriptRequest) (*FindEnabledScriptResponse, error) + // 修改脚本 + UpdateScript(context.Context, *UpdateScriptRequest) (*RPCSuccess, error) + // 组合脚本配置 + ComposeScriptConfigs(context.Context, *ComposeScriptConfigsRequest) (*ComposeScriptConfigsResponse, error) +} + +// UnimplementedScriptServiceServer can be embedded to have forward compatible implementations. +type UnimplementedScriptServiceServer struct { +} + +func (*UnimplementedScriptServiceServer) CreateScript(context.Context, *CreateScriptRequest) (*CreateScriptResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateScript not implemented") +} +func (*UnimplementedScriptServiceServer) DeleteScript(context.Context, *DeleteScriptRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteScript not implemented") +} +func (*UnimplementedScriptServiceServer) CountAllEnabledScripts(context.Context, *CountAllEnabledScriptsRequest) (*RPCCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledScripts not implemented") +} +func (*UnimplementedScriptServiceServer) ListEnabledScripts(context.Context, *ListEnabledScriptsRequest) (*ListEnabledScriptsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEnabledScripts not implemented") +} +func (*UnimplementedScriptServiceServer) PublishScripts(context.Context, *PublishScriptsRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublishScripts not implemented") +} +func (*UnimplementedScriptServiceServer) CheckScriptUpdates(context.Context, *CheckScriptUpdatesRequest) (*CheckScriptUpdatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckScriptUpdates not implemented") +} +func (*UnimplementedScriptServiceServer) FindEnabledScript(context.Context, *FindEnabledScriptRequest) (*FindEnabledScriptResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindEnabledScript not implemented") +} +func (*UnimplementedScriptServiceServer) UpdateScript(context.Context, *UpdateScriptRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateScript not implemented") +} +func (*UnimplementedScriptServiceServer) ComposeScriptConfigs(context.Context, *ComposeScriptConfigsRequest) (*ComposeScriptConfigsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ComposeScriptConfigs not implemented") +} + +func RegisterScriptServiceServer(s *grpc.Server, srv ScriptServiceServer) { + s.RegisterService(&_ScriptService_serviceDesc, srv) +} + +func _ScriptService_CreateScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).CreateScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/CreateScript", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).CreateScript(ctx, req.(*CreateScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_DeleteScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).DeleteScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/DeleteScript", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).DeleteScript(ctx, req.(*DeleteScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_CountAllEnabledScripts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllEnabledScriptsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).CountAllEnabledScripts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/CountAllEnabledScripts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).CountAllEnabledScripts(ctx, req.(*CountAllEnabledScriptsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_ListEnabledScripts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEnabledScriptsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).ListEnabledScripts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/ListEnabledScripts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).ListEnabledScripts(ctx, req.(*ListEnabledScriptsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_PublishScripts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishScriptsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).PublishScripts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/PublishScripts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).PublishScripts(ctx, req.(*PublishScriptsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_CheckScriptUpdates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckScriptUpdatesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).CheckScriptUpdates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/CheckScriptUpdates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).CheckScriptUpdates(ctx, req.(*CheckScriptUpdatesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_FindEnabledScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindEnabledScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).FindEnabledScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/FindEnabledScript", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).FindEnabledScript(ctx, req.(*FindEnabledScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_UpdateScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).UpdateScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/UpdateScript", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).UpdateScript(ctx, req.(*UpdateScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ScriptService_ComposeScriptConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ComposeScriptConfigsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ScriptServiceServer).ComposeScriptConfigs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ScriptService/ComposeScriptConfigs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ScriptServiceServer).ComposeScriptConfigs(ctx, req.(*ComposeScriptConfigsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ScriptService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.ScriptService", + HandlerType: (*ScriptServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createScript", + Handler: _ScriptService_CreateScript_Handler, + }, + { + MethodName: "deleteScript", + Handler: _ScriptService_DeleteScript_Handler, + }, + { + MethodName: "countAllEnabledScripts", + Handler: _ScriptService_CountAllEnabledScripts_Handler, + }, + { + MethodName: "listEnabledScripts", + Handler: _ScriptService_ListEnabledScripts_Handler, + }, + { + MethodName: "publishScripts", + Handler: _ScriptService_PublishScripts_Handler, + }, + { + MethodName: "checkScriptUpdates", + Handler: _ScriptService_CheckScriptUpdates_Handler, + }, + { + MethodName: "findEnabledScript", + Handler: _ScriptService_FindEnabledScript_Handler, + }, + { + MethodName: "updateScript", + Handler: _ScriptService_UpdateScript_Handler, + }, + { + MethodName: "composeScriptConfigs", + Handler: _ScriptService_ComposeScriptConfigs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_script.proto", +} diff --git a/pkg/rpc/protos/models/model_script.proto b/pkg/rpc/protos/models/model_script.proto new file mode 100644 index 0000000..4d470c2 --- /dev/null +++ b/pkg/rpc/protos/models/model_script.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message Script { + int64 id = 1; + int64 userId = 2; + bool isOn = 3; + string name = 4; + string filename = 5; + string code = 6; + int64 updatedAt = 7; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_script.proto b/pkg/rpc/protos/service_script.proto new file mode 100644 index 0000000..2ed5771 --- /dev/null +++ b/pkg/rpc/protos/service_script.proto @@ -0,0 +1,111 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "models/model_script.proto"; +import "models/rpc_messages.proto"; + +// 脚本相关服务 +service ScriptService { + // 添加脚本 + rpc createScript(CreateScriptRequest) returns (CreateScriptResponse); + + // 删除脚本 + rpc deleteScript(DeleteScriptRequest) returns (RPCSuccess); + + // 计算脚本数量 + rpc countAllEnabledScripts(CountAllEnabledScriptsRequest) returns (RPCCountResponse); + + // 列出单页脚本 + rpc listEnabledScripts(ListEnabledScriptsRequest) returns (ListEnabledScriptsResponse); + + // 发布脚本 + rpc publishScripts(PublishScriptsRequest) returns (RPCSuccess); + + // 检查脚本是否需要有更新 + rpc checkScriptUpdates(CheckScriptUpdatesRequest) returns (CheckScriptUpdatesResponse); + + // 查找单个脚本 + rpc findEnabledScript(FindEnabledScriptRequest) returns (FindEnabledScriptResponse); + + // 修改脚本 + rpc updateScript(UpdateScriptRequest) returns (RPCSuccess); + + // 组合脚本配置 + rpc composeScriptConfigs(ComposeScriptConfigsRequest) returns (ComposeScriptConfigsResponse); +} + +// 添加脚本 +message CreateScriptRequest { + string name = 1; + string filename = 2; + string code = 3; +} + +message CreateScriptResponse { + int64 scriptId = 1; +} + +// 删除脚本 +message DeleteScriptRequest { + int64 scriptId = 1; +} + +// 计算脚本数量 +message CountAllEnabledScriptsRequest { + int64 userId = 1; +} + +// 列出单页脚本 +message ListEnabledScriptsRequest { + int64 userId = 1; + int64 offset = 2; + int64 size = 3; +} + +message ListEnabledScriptsResponse { + repeated Script scripts = 1; +} + +// 发布脚本 +message PublishScriptsRequest { + int64 userId = 1; +} + +// 检查脚本是否需要有更新 +message CheckScriptUpdatesRequest { + int64 userId = 1; +} + +message CheckScriptUpdatesResponse { + bool hasUpdates = 1; + int64 version = 2; +} + +// 查找单个脚本 +message FindEnabledScriptRequest { + int64 scriptId = 1; +} + +message FindEnabledScriptResponse { + Script script = 1; +} + +// 修改脚本 +message UpdateScriptRequest { + int64 scriptId = 1; + string name = 2; + string filename = 3; + string code = 4; + bool isOn = 5; +} + +// 组合脚本配置 +message ComposeScriptConfigsRequest { + +} + +message ComposeScriptConfigsResponse { + bytes scriptConfigsJSON = 1; +} \ No newline at end of file diff --git a/pkg/serverconfigs/script_common.go b/pkg/serverconfigs/script_common.go new file mode 100644 index 0000000..7350ff0 --- /dev/null +++ b/pkg/serverconfigs/script_common.go @@ -0,0 +1,11 @@ +// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package serverconfigs + +// CommonScript 公共脚本 +type CommonScript struct { + Id int64 `yaml:"id" json:"id"` + IsOn bool `yaml:"isOn" json:"isOn"` + Filename string `yaml:"filename" json:"filename"` + Code string `yaml:"code" json:"code"` +}