diff --git a/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/mock_TransformersServiceClient.go b/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/mock_TransformersServiceClient.go index ed862bdbe6..b344872dbe 100644 --- a/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/mock_TransformersServiceClient.go +++ b/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/mock_TransformersServiceClient.go @@ -437,6 +437,65 @@ func (_c *MockTransformersServiceClient_UpdateUserDefinedTransformer_Call) RunAn return _c } +// ValidateUserJavascriptCode provides a mock function with given fields: _a0, _a1 +func (_m *MockTransformersServiceClient) ValidateUserJavascriptCode(_a0 context.Context, _a1 *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for ValidateUserJavascriptCode") + } + + var r0 *connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) *connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTransformersServiceClient_ValidateUserJavascriptCode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateUserJavascriptCode' +type MockTransformersServiceClient_ValidateUserJavascriptCode_Call struct { + *mock.Call +} + +// ValidateUserJavascriptCode is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest] +func (_e *MockTransformersServiceClient_Expecter) ValidateUserJavascriptCode(_a0 interface{}, _a1 interface{}) *MockTransformersServiceClient_ValidateUserJavascriptCode_Call { + return &MockTransformersServiceClient_ValidateUserJavascriptCode_Call{Call: _e.mock.On("ValidateUserJavascriptCode", _a0, _a1)} +} + +func (_c *MockTransformersServiceClient_ValidateUserJavascriptCode_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest])) *MockTransformersServiceClient_ValidateUserJavascriptCode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest])) + }) + return _c +} + +func (_c *MockTransformersServiceClient_ValidateUserJavascriptCode_Call) Return(_a0 *connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse], _a1 error) *MockTransformersServiceClient_ValidateUserJavascriptCode_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTransformersServiceClient_ValidateUserJavascriptCode_Call) RunAndReturn(run func(context.Context, *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse], error)) *MockTransformersServiceClient_ValidateUserJavascriptCode_Call { + _c.Call.Return(run) + return _c +} + // NewMockTransformersServiceClient creates a new instance of MockTransformersServiceClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewMockTransformersServiceClient(t interface { diff --git a/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/transformer.connect.go b/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/transformer.connect.go index 97c1f0e8d3..da59804052 100644 --- a/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/transformer.connect.go +++ b/backend/gen/go/protos/mgmt/v1alpha1/mgmtv1alpha1connect/transformer.connect.go @@ -54,6 +54,9 @@ const ( // TransformersServiceIsTransformerNameAvailableProcedure is the fully-qualified name of the // TransformersService's IsTransformerNameAvailable RPC. TransformersServiceIsTransformerNameAvailableProcedure = "/mgmt.v1alpha1.TransformersService/IsTransformerNameAvailable" + // TransformersServiceValidateUserJavascriptCodeProcedure is the fully-qualified name of the + // TransformersService's ValidateUserJavascriptCode RPC. + TransformersServiceValidateUserJavascriptCodeProcedure = "/mgmt.v1alpha1.TransformersService/ValidateUserJavascriptCode" ) // TransformersServiceClient is a client for the mgmt.v1alpha1.TransformersService service. @@ -65,6 +68,7 @@ type TransformersServiceClient interface { DeleteUserDefinedTransformer(context.Context, *connect.Request[v1alpha1.DeleteUserDefinedTransformerRequest]) (*connect.Response[v1alpha1.DeleteUserDefinedTransformerResponse], error) UpdateUserDefinedTransformer(context.Context, *connect.Request[v1alpha1.UpdateUserDefinedTransformerRequest]) (*connect.Response[v1alpha1.UpdateUserDefinedTransformerResponse], error) IsTransformerNameAvailable(context.Context, *connect.Request[v1alpha1.IsTransformerNameAvailableRequest]) (*connect.Response[v1alpha1.IsTransformerNameAvailableResponse], error) + ValidateUserJavascriptCode(context.Context, *connect.Request[v1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[v1alpha1.ValidateUserJavascriptCodeResponse], error) } // NewTransformersServiceClient constructs a client for the mgmt.v1alpha1.TransformersService @@ -112,6 +116,11 @@ func NewTransformersServiceClient(httpClient connect.HTTPClient, baseURL string, baseURL+TransformersServiceIsTransformerNameAvailableProcedure, opts..., ), + validateUserJavascriptCode: connect.NewClient[v1alpha1.ValidateUserJavascriptCodeRequest, v1alpha1.ValidateUserJavascriptCodeResponse]( + httpClient, + baseURL+TransformersServiceValidateUserJavascriptCodeProcedure, + opts..., + ), } } @@ -124,6 +133,7 @@ type transformersServiceClient struct { deleteUserDefinedTransformer *connect.Client[v1alpha1.DeleteUserDefinedTransformerRequest, v1alpha1.DeleteUserDefinedTransformerResponse] updateUserDefinedTransformer *connect.Client[v1alpha1.UpdateUserDefinedTransformerRequest, v1alpha1.UpdateUserDefinedTransformerResponse] isTransformerNameAvailable *connect.Client[v1alpha1.IsTransformerNameAvailableRequest, v1alpha1.IsTransformerNameAvailableResponse] + validateUserJavascriptCode *connect.Client[v1alpha1.ValidateUserJavascriptCodeRequest, v1alpha1.ValidateUserJavascriptCodeResponse] } // GetSystemTransformers calls mgmt.v1alpha1.TransformersService.GetSystemTransformers. @@ -165,6 +175,11 @@ func (c *transformersServiceClient) IsTransformerNameAvailable(ctx context.Conte return c.isTransformerNameAvailable.CallUnary(ctx, req) } +// ValidateUserJavascriptCode calls mgmt.v1alpha1.TransformersService.ValidateUserJavascriptCode. +func (c *transformersServiceClient) ValidateUserJavascriptCode(ctx context.Context, req *connect.Request[v1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[v1alpha1.ValidateUserJavascriptCodeResponse], error) { + return c.validateUserJavascriptCode.CallUnary(ctx, req) +} + // TransformersServiceHandler is an implementation of the mgmt.v1alpha1.TransformersService service. type TransformersServiceHandler interface { GetSystemTransformers(context.Context, *connect.Request[v1alpha1.GetSystemTransformersRequest]) (*connect.Response[v1alpha1.GetSystemTransformersResponse], error) @@ -174,6 +189,7 @@ type TransformersServiceHandler interface { DeleteUserDefinedTransformer(context.Context, *connect.Request[v1alpha1.DeleteUserDefinedTransformerRequest]) (*connect.Response[v1alpha1.DeleteUserDefinedTransformerResponse], error) UpdateUserDefinedTransformer(context.Context, *connect.Request[v1alpha1.UpdateUserDefinedTransformerRequest]) (*connect.Response[v1alpha1.UpdateUserDefinedTransformerResponse], error) IsTransformerNameAvailable(context.Context, *connect.Request[v1alpha1.IsTransformerNameAvailableRequest]) (*connect.Response[v1alpha1.IsTransformerNameAvailableResponse], error) + ValidateUserJavascriptCode(context.Context, *connect.Request[v1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[v1alpha1.ValidateUserJavascriptCodeResponse], error) } // NewTransformersServiceHandler builds an HTTP handler from the service implementation. It returns @@ -217,6 +233,11 @@ func NewTransformersServiceHandler(svc TransformersServiceHandler, opts ...conne svc.IsTransformerNameAvailable, opts..., ) + transformersServiceValidateUserJavascriptCodeHandler := connect.NewUnaryHandler( + TransformersServiceValidateUserJavascriptCodeProcedure, + svc.ValidateUserJavascriptCode, + opts..., + ) return "/mgmt.v1alpha1.TransformersService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case TransformersServiceGetSystemTransformersProcedure: @@ -233,6 +254,8 @@ func NewTransformersServiceHandler(svc TransformersServiceHandler, opts ...conne transformersServiceUpdateUserDefinedTransformerHandler.ServeHTTP(w, r) case TransformersServiceIsTransformerNameAvailableProcedure: transformersServiceIsTransformerNameAvailableHandler.ServeHTTP(w, r) + case TransformersServiceValidateUserJavascriptCodeProcedure: + transformersServiceValidateUserJavascriptCodeHandler.ServeHTTP(w, r) default: http.NotFound(w, r) } @@ -269,3 +292,7 @@ func (UnimplementedTransformersServiceHandler) UpdateUserDefinedTransformer(cont func (UnimplementedTransformersServiceHandler) IsTransformerNameAvailable(context.Context, *connect.Request[v1alpha1.IsTransformerNameAvailableRequest]) (*connect.Response[v1alpha1.IsTransformerNameAvailableResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("mgmt.v1alpha1.TransformersService.IsTransformerNameAvailable is not implemented")) } + +func (UnimplementedTransformersServiceHandler) ValidateUserJavascriptCode(context.Context, *connect.Request[v1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[v1alpha1.ValidateUserJavascriptCodeResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("mgmt.v1alpha1.TransformersService.ValidateUserJavascriptCode is not implemented")) +} diff --git a/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go b/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go index 406ff3cfec..d4c5b170a7 100644 --- a/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go +++ b/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go @@ -969,6 +969,7 @@ type TransformerConfig struct { // *TransformerConfig_Nullconfig // *TransformerConfig_UserDefinedTransformerConfig // *TransformerConfig_GenerateDefaultConfig + // *TransformerConfig_TransformJavascriptConfig Config isTransformerConfig_Config `protobuf_oneof:"config"` } @@ -1277,6 +1278,13 @@ func (x *TransformerConfig) GetGenerateDefaultConfig() *GenerateDefault { return nil } +func (x *TransformerConfig) GetTransformJavascriptConfig() *TransformJavascript { + if x, ok := x.GetConfig().(*TransformerConfig_TransformJavascriptConfig); ok { + return x.TransformJavascriptConfig + } + return nil +} + type isTransformerConfig_Config interface { isTransformerConfig_Config() } @@ -1433,6 +1441,10 @@ type TransformerConfig_GenerateDefaultConfig struct { GenerateDefaultConfig *GenerateDefault `protobuf:"bytes,38,opt,name=generate_default_config,json=generateDefaultConfig,proto3,oneof"` } +type TransformerConfig_TransformJavascriptConfig struct { + TransformJavascriptConfig *TransformJavascript `protobuf:"bytes,39,opt,name=transform_javascript_config,json=transformJavascriptConfig,proto3,oneof"` +} + func (*TransformerConfig_GenerateEmailConfig) isTransformerConfig_Config() {} func (*TransformerConfig_TransformEmailConfig) isTransformerConfig_Config() {} @@ -1509,6 +1521,8 @@ func (*TransformerConfig_UserDefinedTransformerConfig) isTransformerConfig_Confi func (*TransformerConfig_GenerateDefaultConfig) isTransformerConfig_Config() {} +func (*TransformerConfig_TransformJavascriptConfig) isTransformerConfig_Config() {} + type GenerateEmail struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3165,6 +3179,53 @@ func (*Null) Descriptor() ([]byte, []int) { return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{53} } +type TransformJavascript struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *TransformJavascript) Reset() { + *x = TransformJavascript{} + if protoimpl.UnsafeEnabled { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransformJavascript) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransformJavascript) ProtoMessage() {} + +func (x *TransformJavascript) ProtoReflect() protoreflect.Message { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[54] + 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 TransformJavascript.ProtoReflect.Descriptor instead. +func (*TransformJavascript) Descriptor() ([]byte, []int) { + return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{54} +} + +func (x *TransformJavascript) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + type UserDefinedTransformerConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3176,7 +3237,7 @@ type UserDefinedTransformerConfig struct { func (x *UserDefinedTransformerConfig) Reset() { *x = UserDefinedTransformerConfig{} if protoimpl.UnsafeEnabled { - mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[54] + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3189,7 +3250,7 @@ func (x *UserDefinedTransformerConfig) String() string { func (*UserDefinedTransformerConfig) ProtoMessage() {} func (x *UserDefinedTransformerConfig) ProtoReflect() protoreflect.Message { - mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[54] + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[55] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3202,7 +3263,7 @@ func (x *UserDefinedTransformerConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use UserDefinedTransformerConfig.ProtoReflect.Descriptor instead. func (*UserDefinedTransformerConfig) Descriptor() ([]byte, []int) { - return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{54} + return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{55} } func (x *UserDefinedTransformerConfig) GetId() string { @@ -3212,6 +3273,108 @@ func (x *UserDefinedTransformerConfig) GetId() string { return "" } +type ValidateUserJavascriptCodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AccountId string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *ValidateUserJavascriptCodeRequest) Reset() { + *x = ValidateUserJavascriptCodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ValidateUserJavascriptCodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateUserJavascriptCodeRequest) ProtoMessage() {} + +func (x *ValidateUserJavascriptCodeRequest) ProtoReflect() protoreflect.Message { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[56] + 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 ValidateUserJavascriptCodeRequest.ProtoReflect.Descriptor instead. +func (*ValidateUserJavascriptCodeRequest) Descriptor() ([]byte, []int) { + return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{56} +} + +func (x *ValidateUserJavascriptCodeRequest) GetAccountId() string { + if x != nil { + return x.AccountId + } + return "" +} + +func (x *ValidateUserJavascriptCodeRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type ValidateUserJavascriptCodeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` +} + +func (x *ValidateUserJavascriptCodeResponse) Reset() { + *x = ValidateUserJavascriptCodeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ValidateUserJavascriptCodeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateUserJavascriptCodeResponse) ProtoMessage() {} + +func (x *ValidateUserJavascriptCodeResponse) ProtoReflect() protoreflect.Message { + mi := &file_mgmt_v1alpha1_transformer_proto_msgTypes[57] + 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 ValidateUserJavascriptCodeResponse.ProtoReflect.Descriptor instead. +func (*ValidateUserJavascriptCodeResponse) Descriptor() ([]byte, []int) { + return file_mgmt_v1alpha1_transformer_proto_rawDescGZIP(), []int{57} +} + +func (x *ValidateUserJavascriptCodeResponse) GetValid() bool { + if x != nil { + return x.Valid + } + return false +} + var File_mgmt_v1alpha1_transformer_proto protoreflect.FileDescriptor var file_mgmt_v1alpha1_transformer_proto_rawDesc = []byte{ @@ -3355,7 +3518,7 @@ var file_mgmt_v1alpha1_transformer_proto_rawDesc = []byte{ 0x63, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0xcc, 0x1c, 0x0a, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0xb2, 0x1d, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x52, 0x0a, 0x15, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, @@ -3583,198 +3746,225 @@ var file_mgmt_v1alpha1_transformer_proto_rawDesc = []byte{ 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x48, 0x00, 0x52, 0x15, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x44, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x0f, 0x0a, 0x06, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x05, 0xba, 0x48, 0x02, 0x08, 0x01, 0x22, 0x0f, 0x0a, 0x0d, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0x62, 0x0a, 0x0e, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x27, - 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x64, 0x0a, 0x1b, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x6a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x27, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x48, 0x00, 0x52, 0x19, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x4a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x42, 0x0f, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x05, 0xba, 0x48, 0x02, 0x08, + 0x01, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x22, 0x62, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x45, + 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x27, 0x0a, + 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x0e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x33, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x43, 0x61, 0x72, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6c, 0x75, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x4c, 0x75, 0x68, 0x6e, 0x22, 0x0e, 0x0a, 0x0c, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x69, 0x74, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0x3d, + 0x0a, 0x17, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x45, 0x31, 0x36, 0x34, 0x50, 0x68, + 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, + 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x22, 0x13, 0x0a, + 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x36, 0x34, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, + 0x7a, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x72, + 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, + 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, + 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x15, + 0x0a, 0x13, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x0e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x47, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x61, + 0x62, 0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0a, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x5a, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, + 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, + 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, + 0x6d, 0x61, 0x78, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x4c, + 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x48, 0x61, 0x73, 0x68, 0x22, 0x0d, 0x0a, + 0x0b, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x53, 0x4e, 0x22, 0x0f, 0x0a, 0x0d, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x17, 0x0a, + 0x15, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x44, 0x0a, 0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, + 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x48, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x22, 0x34, 0x0a, 0x0e, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x10, + 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, 0x6e, + 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, + 0x61, 0x78, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, + 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x12, 0x0a, 0x10, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x16, 0x0a, 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x74, 0x63, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x37, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x55, 0x75, 0x69, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, + 0x64, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x48, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, + 0x22, 0x11, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5a, 0x69, 0x70, 0x63, + 0x6f, 0x64, 0x65, 0x22, 0x43, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x45, 0x31, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x3d, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x82, 0x01, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x36, 0x34, 0x12, 0x36, 0x0a, 0x17, + 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, + 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x15, 0x72, + 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, + 0x65, 0x4d, 0x69, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x15, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x78, 0x22, 0x3c, 0x0a, 0x11, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x44, 0x0a, 0x19, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0x0e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6c, - 0x22, 0x33, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x64, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, - 0x6c, 0x75, 0x68, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x4c, 0x75, 0x68, 0x6e, 0x22, 0x0e, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x43, 0x69, 0x74, 0x79, 0x22, 0x11, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0x3d, 0x0a, 0x17, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x45, 0x31, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x0f, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x36, 0x34, 0x12, - 0x25, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x5f, 0x73, 0x69, 0x67, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, - 0x7a, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, - 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, - 0x72, 0x65, 0x63, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, - 0x12, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x22, 0x30, 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x47, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x69, - 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x62, 0x62, 0x72, 0x65, - 0x76, 0x69, 0x61, 0x74, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x22, 0x5a, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x74, - 0x36, 0x34, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x5f, - 0x73, 0x69, 0x67, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x72, 0x61, 0x6e, 0x64, - 0x6f, 0x6d, 0x69, 0x7a, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, - 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x22, 0x12, 0x0a, - 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, - 0x65, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, - 0x32, 0x35, 0x36, 0x48, 0x61, 0x73, 0x68, 0x22, 0x0d, 0x0a, 0x0b, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x53, 0x53, 0x4e, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x65, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x22, 0x44, 0x0a, 0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, - 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x48, - 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x22, 0x34, 0x0a, 0x0e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x22, 0x17, 0x0a, 0x15, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x74, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x22, 0x37, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x55, 0x75, 0x69, - 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x79, 0x70, - 0x68, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, - 0x75, 0x64, 0x65, 0x48, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x47, 0x65, - 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5a, 0x69, 0x70, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x43, 0x0a, - 0x18, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x31, 0x36, 0x34, 0x50, 0x68, + 0x22, 0x80, 0x01, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x6e, + 0x74, 0x36, 0x34, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x69, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x72, + 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, + 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x72, 0x61, + 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, + 0x4d, 0x61, 0x78, 0x22, 0x3c, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0x68, 0x0a, 0x14, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0x3d, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x46, - 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0x82, 0x01, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x46, - 0x6c, 0x6f, 0x61, 0x74, 0x36, 0x34, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x15, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x69, 0x6e, 0x12, 0x36, - 0x0a, 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, - 0x15, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x78, 0x22, 0x3c, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x6f, 0x72, 0x6d, 0x46, 0x75, 0x6c, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, - 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x22, 0x44, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, - 0x6d, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x80, 0x01, 0x0a, 0x0e, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x36, 0x0a, - 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, - 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, - 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x4d, 0x69, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6d, 0x61, 0x78, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4d, 0x61, 0x78, 0x22, 0x3c, 0x0a, - 0x11, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x68, 0x0a, 0x14, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x0f, - 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x48, 0x79, - 0x70, 0x68, 0x65, 0x6e, 0x73, 0x22, 0x3a, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, - 0x72, 0x6d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x61, 0x73, 0x73, 0x74, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, - 0x22, 0x06, 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0x38, 0x0a, 0x1c, 0x55, 0x73, 0x65, 0x72, - 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x02, - 0x69, 0x64, 0x32, 0xca, 0x07, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x74, 0x0a, 0x15, 0x47, 0x65, - 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, + 0x74, 0x68, 0x12, 0x27, 0x0a, 0x0f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x68, 0x79, + 0x70, 0x68, 0x65, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x6e, 0x63, + 0x6c, 0x75, 0x64, 0x65, 0x48, 0x79, 0x70, 0x68, 0x65, 0x6e, 0x73, 0x22, 0x3a, 0x0a, 0x0f, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x27, + 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x61, 0x73, 0x73, 0x74, + 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x22, 0x06, 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x22, 0x29, + 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4a, 0x61, 0x76, 0x61, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x38, 0x0a, 0x1c, 0x55, 0x73, 0x65, + 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, + 0x6d, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x21, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x64, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0x48, + 0x05, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x09, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x3a, 0x0a, 0x22, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x32, 0xd0, 0x08, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, + 0x72, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x74, 0x0a, 0x15, 0x47, 0x65, 0x74, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, + 0x72, 0x73, 0x12, 0x2b, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2c, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, + 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x83, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, + 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x12, 0x30, + 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2c, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, - 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x12, - 0x30, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x31, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8c, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, - 0x72, 0x6d, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x12, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x1a, 0x31, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8c, 0x01, 0x0a, 0x1d, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, + 0x6d, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x12, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, + 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, + 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6d, + 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x89, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, - 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x89, 0x01, 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x32, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, - 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, - 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, - 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x89, 0x01, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x89, 0x01, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, + 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, + 0x72, 0x12, 0x32, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, + 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x12, 0x32, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, - 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, - 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x89, 0x01, - 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, - 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x32, - 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, - 0x69, 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x49, 0x73, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x73, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, - 0x62, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6d, 0x67, 0x6d, - 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x73, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x76, 0x61, 0x69, - 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, - 0xcc, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x75, 0x63, 0x6c, 0x65, 0x75, 0x73, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x2f, 0x6e, 0x65, 0x6f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2f, 0x6d, 0x67, 0x6d, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x6d, - 0x67, 0x6d, 0x74, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, - 0x58, 0xaa, 0x02, 0x0d, 0x4d, 0x67, 0x6d, 0x74, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0xca, 0x02, 0x0d, 0x4d, 0x67, 0x6d, 0x74, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0xe2, 0x02, 0x19, 0x4d, 0x67, 0x6d, 0x74, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, - 0x4d, 0x67, 0x6d, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x89, 0x01, 0x0a, + 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, + 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x32, 0x2e, + 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, + 0x6e, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x83, 0x01, 0x0a, 0x1a, 0x49, 0x73, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x76, + 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x73, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6d, 0x67, 0x6d, 0x74, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x49, 0x73, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x83, + 0x01, 0x0a, 0x1a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4a, + 0x61, 0x76, 0x61, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x30, 0x2e, + 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x31, 0x2e, 0x6d, 0x67, 0x6d, 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x61, 0x76, 0x61, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x42, 0xcc, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x67, 0x6d, + 0x74, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x10, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x50, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x75, 0x63, 0x6c, 0x65, + 0x75, 0x73, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x6e, 0x65, 0x6f, 0x73, 0x79, 0x6e, 0x63, 0x2f, + 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x6d, 0x67, 0x6d, 0x74, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x6d, 0x67, 0x6d, 0x74, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0d, 0x4d, 0x67, 0x6d, 0x74, 0x2e, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x0d, 0x4d, 0x67, 0x6d, 0x74, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x19, 0x4d, 0x67, 0x6d, 0x74, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x67, 0x6d, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3789,7 +3979,7 @@ func file_mgmt_v1alpha1_transformer_proto_rawDescGZIP() []byte { return file_mgmt_v1alpha1_transformer_proto_rawDescData } -var file_mgmt_v1alpha1_transformer_proto_msgTypes = make([]protoimpl.MessageInfo, 55) +var file_mgmt_v1alpha1_transformer_proto_msgTypes = make([]protoimpl.MessageInfo, 58) var file_mgmt_v1alpha1_transformer_proto_goTypes = []interface{}{ (*GetSystemTransformersRequest)(nil), // 0: mgmt.v1alpha1.GetSystemTransformersRequest (*GetSystemTransformersResponse)(nil), // 1: mgmt.v1alpha1.GetSystemTransformersResponse @@ -3845,8 +4035,11 @@ var file_mgmt_v1alpha1_transformer_proto_goTypes = []interface{}{ (*TransformString)(nil), // 51: mgmt.v1alpha1.TransformString (*Passthrough)(nil), // 52: mgmt.v1alpha1.Passthrough (*Null)(nil), // 53: mgmt.v1alpha1.Null - (*UserDefinedTransformerConfig)(nil), // 54: mgmt.v1alpha1.UserDefinedTransformerConfig - (*timestamppb.Timestamp)(nil), // 55: google.protobuf.Timestamp + (*TransformJavascript)(nil), // 54: mgmt.v1alpha1.TransformJavascript + (*UserDefinedTransformerConfig)(nil), // 55: mgmt.v1alpha1.UserDefinedTransformerConfig + (*ValidateUserJavascriptCodeRequest)(nil), // 56: mgmt.v1alpha1.ValidateUserJavascriptCodeRequest + (*ValidateUserJavascriptCodeResponse)(nil), // 57: mgmt.v1alpha1.ValidateUserJavascriptCodeResponse + (*timestamppb.Timestamp)(nil), // 58: google.protobuf.Timestamp } var file_mgmt_v1alpha1_transformer_proto_depIdxs = []int32{ 15, // 0: mgmt.v1alpha1.GetSystemTransformersResponse.transformers:type_name -> mgmt.v1alpha1.SystemTransformer @@ -3857,8 +4050,8 @@ var file_mgmt_v1alpha1_transformer_proto_depIdxs = []int32{ 16, // 5: mgmt.v1alpha1.UpdateUserDefinedTransformerRequest.transformer_config:type_name -> mgmt.v1alpha1.TransformerConfig 14, // 6: mgmt.v1alpha1.UpdateUserDefinedTransformerResponse.transformer:type_name -> mgmt.v1alpha1.UserDefinedTransformer 16, // 7: mgmt.v1alpha1.UserDefinedTransformer.config:type_name -> mgmt.v1alpha1.TransformerConfig - 55, // 8: mgmt.v1alpha1.UserDefinedTransformer.created_at:type_name -> google.protobuf.Timestamp - 55, // 9: mgmt.v1alpha1.UserDefinedTransformer.updated_at:type_name -> google.protobuf.Timestamp + 58, // 8: mgmt.v1alpha1.UserDefinedTransformer.created_at:type_name -> google.protobuf.Timestamp + 58, // 9: mgmt.v1alpha1.UserDefinedTransformer.updated_at:type_name -> google.protobuf.Timestamp 16, // 10: mgmt.v1alpha1.SystemTransformer.config:type_name -> mgmt.v1alpha1.TransformerConfig 17, // 11: mgmt.v1alpha1.TransformerConfig.generate_email_config:type_name -> mgmt.v1alpha1.GenerateEmail 18, // 12: mgmt.v1alpha1.TransformerConfig.transform_email_config:type_name -> mgmt.v1alpha1.TransformEmail @@ -3896,27 +4089,30 @@ var file_mgmt_v1alpha1_transformer_proto_depIdxs = []int32{ 51, // 44: mgmt.v1alpha1.TransformerConfig.transform_string_config:type_name -> mgmt.v1alpha1.TransformString 52, // 45: mgmt.v1alpha1.TransformerConfig.passthrough_config:type_name -> mgmt.v1alpha1.Passthrough 53, // 46: mgmt.v1alpha1.TransformerConfig.nullconfig:type_name -> mgmt.v1alpha1.Null - 54, // 47: mgmt.v1alpha1.TransformerConfig.user_defined_transformer_config:type_name -> mgmt.v1alpha1.UserDefinedTransformerConfig + 55, // 47: mgmt.v1alpha1.TransformerConfig.user_defined_transformer_config:type_name -> mgmt.v1alpha1.UserDefinedTransformerConfig 22, // 48: mgmt.v1alpha1.TransformerConfig.generate_default_config:type_name -> mgmt.v1alpha1.GenerateDefault - 0, // 49: mgmt.v1alpha1.TransformersService.GetSystemTransformers:input_type -> mgmt.v1alpha1.GetSystemTransformersRequest - 2, // 50: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformers:input_type -> mgmt.v1alpha1.GetUserDefinedTransformersRequest - 4, // 51: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformerById:input_type -> mgmt.v1alpha1.GetUserDefinedTransformerByIdRequest - 6, // 52: mgmt.v1alpha1.TransformersService.CreateUserDefinedTransformer:input_type -> mgmt.v1alpha1.CreateUserDefinedTransformerRequest - 8, // 53: mgmt.v1alpha1.TransformersService.DeleteUserDefinedTransformer:input_type -> mgmt.v1alpha1.DeleteUserDefinedTransformerRequest - 10, // 54: mgmt.v1alpha1.TransformersService.UpdateUserDefinedTransformer:input_type -> mgmt.v1alpha1.UpdateUserDefinedTransformerRequest - 12, // 55: mgmt.v1alpha1.TransformersService.IsTransformerNameAvailable:input_type -> mgmt.v1alpha1.IsTransformerNameAvailableRequest - 1, // 56: mgmt.v1alpha1.TransformersService.GetSystemTransformers:output_type -> mgmt.v1alpha1.GetSystemTransformersResponse - 3, // 57: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformers:output_type -> mgmt.v1alpha1.GetUserDefinedTransformersResponse - 5, // 58: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformerById:output_type -> mgmt.v1alpha1.GetUserDefinedTransformerByIdResponse - 7, // 59: mgmt.v1alpha1.TransformersService.CreateUserDefinedTransformer:output_type -> mgmt.v1alpha1.CreateUserDefinedTransformerResponse - 9, // 60: mgmt.v1alpha1.TransformersService.DeleteUserDefinedTransformer:output_type -> mgmt.v1alpha1.DeleteUserDefinedTransformerResponse - 11, // 61: mgmt.v1alpha1.TransformersService.UpdateUserDefinedTransformer:output_type -> mgmt.v1alpha1.UpdateUserDefinedTransformerResponse - 13, // 62: mgmt.v1alpha1.TransformersService.IsTransformerNameAvailable:output_type -> mgmt.v1alpha1.IsTransformerNameAvailableResponse - 56, // [56:63] is the sub-list for method output_type - 49, // [49:56] is the sub-list for method input_type - 49, // [49:49] is the sub-list for extension type_name - 49, // [49:49] is the sub-list for extension extendee - 0, // [0:49] is the sub-list for field type_name + 54, // 49: mgmt.v1alpha1.TransformerConfig.transform_javascript_config:type_name -> mgmt.v1alpha1.TransformJavascript + 0, // 50: mgmt.v1alpha1.TransformersService.GetSystemTransformers:input_type -> mgmt.v1alpha1.GetSystemTransformersRequest + 2, // 51: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformers:input_type -> mgmt.v1alpha1.GetUserDefinedTransformersRequest + 4, // 52: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformerById:input_type -> mgmt.v1alpha1.GetUserDefinedTransformerByIdRequest + 6, // 53: mgmt.v1alpha1.TransformersService.CreateUserDefinedTransformer:input_type -> mgmt.v1alpha1.CreateUserDefinedTransformerRequest + 8, // 54: mgmt.v1alpha1.TransformersService.DeleteUserDefinedTransformer:input_type -> mgmt.v1alpha1.DeleteUserDefinedTransformerRequest + 10, // 55: mgmt.v1alpha1.TransformersService.UpdateUserDefinedTransformer:input_type -> mgmt.v1alpha1.UpdateUserDefinedTransformerRequest + 12, // 56: mgmt.v1alpha1.TransformersService.IsTransformerNameAvailable:input_type -> mgmt.v1alpha1.IsTransformerNameAvailableRequest + 56, // 57: mgmt.v1alpha1.TransformersService.ValidateUserJavascriptCode:input_type -> mgmt.v1alpha1.ValidateUserJavascriptCodeRequest + 1, // 58: mgmt.v1alpha1.TransformersService.GetSystemTransformers:output_type -> mgmt.v1alpha1.GetSystemTransformersResponse + 3, // 59: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformers:output_type -> mgmt.v1alpha1.GetUserDefinedTransformersResponse + 5, // 60: mgmt.v1alpha1.TransformersService.GetUserDefinedTransformerById:output_type -> mgmt.v1alpha1.GetUserDefinedTransformerByIdResponse + 7, // 61: mgmt.v1alpha1.TransformersService.CreateUserDefinedTransformer:output_type -> mgmt.v1alpha1.CreateUserDefinedTransformerResponse + 9, // 62: mgmt.v1alpha1.TransformersService.DeleteUserDefinedTransformer:output_type -> mgmt.v1alpha1.DeleteUserDefinedTransformerResponse + 11, // 63: mgmt.v1alpha1.TransformersService.UpdateUserDefinedTransformer:output_type -> mgmt.v1alpha1.UpdateUserDefinedTransformerResponse + 13, // 64: mgmt.v1alpha1.TransformersService.IsTransformerNameAvailable:output_type -> mgmt.v1alpha1.IsTransformerNameAvailableResponse + 57, // 65: mgmt.v1alpha1.TransformersService.ValidateUserJavascriptCode:output_type -> mgmt.v1alpha1.ValidateUserJavascriptCodeResponse + 58, // [58:66] is the sub-list for method output_type + 50, // [50:58] is the sub-list for method input_type + 50, // [50:50] is the sub-list for extension type_name + 50, // [50:50] is the sub-list for extension extendee + 0, // [0:50] is the sub-list for field type_name } func init() { file_mgmt_v1alpha1_transformer_proto_init() } @@ -4574,6 +4770,18 @@ func file_mgmt_v1alpha1_transformer_proto_init() { } } file_mgmt_v1alpha1_transformer_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransformJavascript); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mgmt_v1alpha1_transformer_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserDefinedTransformerConfig); i { case 0: return &v.state @@ -4585,6 +4793,30 @@ func file_mgmt_v1alpha1_transformer_proto_init() { return nil } } + file_mgmt_v1alpha1_transformer_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidateUserJavascriptCodeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mgmt_v1alpha1_transformer_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ValidateUserJavascriptCodeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_mgmt_v1alpha1_transformer_proto_msgTypes[16].OneofWrappers = []interface{}{ (*TransformerConfig_GenerateEmailConfig)(nil), @@ -4625,6 +4857,7 @@ func file_mgmt_v1alpha1_transformer_proto_init() { (*TransformerConfig_Nullconfig)(nil), (*TransformerConfig_UserDefinedTransformerConfig)(nil), (*TransformerConfig_GenerateDefaultConfig)(nil), + (*TransformerConfig_TransformJavascriptConfig)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -4632,7 +4865,7 @@ func file_mgmt_v1alpha1_transformer_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mgmt_v1alpha1_transformer_proto_rawDesc, NumEnums: 0, - NumMessages: 55, + NumMessages: 58, NumExtensions: 0, NumServices: 1, }, diff --git a/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.validate.go b/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.validate.go index 67f2bd30e1..2cc416cf12 100644 --- a/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.validate.go +++ b/backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.validate.go @@ -3663,6 +3663,47 @@ func (m *TransformerConfig) validate(all bool) error { } } + case *TransformerConfig_TransformJavascriptConfig: + if v == nil { + err := TransformerConfigValidationError{ + field: "Config", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetTransformJavascriptConfig()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TransformerConfigValidationError{ + field: "TransformJavascriptConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TransformerConfigValidationError{ + field: "TransformJavascriptConfig", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTransformJavascriptConfig()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TransformerConfigValidationError{ + field: "TransformJavascriptConfig", + reason: "embedded message failed validation", + cause: err, + } + } + } + default: _ = v // ensures v is used } @@ -7530,6 +7571,110 @@ var _ interface { ErrorName() string } = NullValidationError{} +// Validate checks the field values on TransformJavascript 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 *TransformJavascript) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on TransformJavascript 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 +// TransformJavascriptMultiError, or nil if none found. +func (m *TransformJavascript) ValidateAll() error { + return m.validate(true) +} + +func (m *TransformJavascript) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Code + + if len(errors) > 0 { + return TransformJavascriptMultiError(errors) + } + + return nil +} + +// TransformJavascriptMultiError is an error wrapping multiple validation +// errors returned by TransformJavascript.ValidateAll() if the designated +// constraints aren't met. +type TransformJavascriptMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TransformJavascriptMultiError) 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 TransformJavascriptMultiError) AllErrors() []error { return m } + +// TransformJavascriptValidationError is the validation error returned by +// TransformJavascript.Validate if the designated constraints aren't met. +type TransformJavascriptValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TransformJavascriptValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TransformJavascriptValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TransformJavascriptValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TransformJavascriptValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TransformJavascriptValidationError) ErrorName() string { + return "TransformJavascriptValidationError" +} + +// Error satisfies the builtin error interface +func (e TransformJavascriptValidationError) 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 %sTransformJavascript.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TransformJavascriptValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TransformJavascriptValidationError{} + // Validate checks the field values on UserDefinedTransformerConfig 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. @@ -7634,3 +7779,219 @@ var _ interface { Cause() error ErrorName() string } = UserDefinedTransformerConfigValidationError{} + +// Validate checks the field values on ValidateUserJavascriptCodeRequest 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 *ValidateUserJavascriptCodeRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ValidateUserJavascriptCodeRequest +// 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 +// ValidateUserJavascriptCodeRequestMultiError, or nil if none found. +func (m *ValidateUserJavascriptCodeRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ValidateUserJavascriptCodeRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for AccountId + + // no validation rules for Code + + if len(errors) > 0 { + return ValidateUserJavascriptCodeRequestMultiError(errors) + } + + return nil +} + +// ValidateUserJavascriptCodeRequestMultiError is an error wrapping multiple +// validation errors returned by +// ValidateUserJavascriptCodeRequest.ValidateAll() if the designated +// constraints aren't met. +type ValidateUserJavascriptCodeRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ValidateUserJavascriptCodeRequestMultiError) 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 ValidateUserJavascriptCodeRequestMultiError) AllErrors() []error { return m } + +// ValidateUserJavascriptCodeRequestValidationError is the validation error +// returned by ValidateUserJavascriptCodeRequest.Validate if the designated +// constraints aren't met. +type ValidateUserJavascriptCodeRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ValidateUserJavascriptCodeRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ValidateUserJavascriptCodeRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ValidateUserJavascriptCodeRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ValidateUserJavascriptCodeRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ValidateUserJavascriptCodeRequestValidationError) ErrorName() string { + return "ValidateUserJavascriptCodeRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e ValidateUserJavascriptCodeRequestValidationError) 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 %sValidateUserJavascriptCodeRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ValidateUserJavascriptCodeRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ValidateUserJavascriptCodeRequestValidationError{} + +// Validate checks the field values on ValidateUserJavascriptCodeResponse 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 *ValidateUserJavascriptCodeResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ValidateUserJavascriptCodeResponse +// 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 +// ValidateUserJavascriptCodeResponseMultiError, or nil if none found. +func (m *ValidateUserJavascriptCodeResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ValidateUserJavascriptCodeResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Valid + + if len(errors) > 0 { + return ValidateUserJavascriptCodeResponseMultiError(errors) + } + + return nil +} + +// ValidateUserJavascriptCodeResponseMultiError is an error wrapping multiple +// validation errors returned by +// ValidateUserJavascriptCodeResponse.ValidateAll() if the designated +// constraints aren't met. +type ValidateUserJavascriptCodeResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ValidateUserJavascriptCodeResponseMultiError) 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 ValidateUserJavascriptCodeResponseMultiError) AllErrors() []error { return m } + +// ValidateUserJavascriptCodeResponseValidationError is the validation error +// returned by ValidateUserJavascriptCodeResponse.Validate if the designated +// constraints aren't met. +type ValidateUserJavascriptCodeResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ValidateUserJavascriptCodeResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ValidateUserJavascriptCodeResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ValidateUserJavascriptCodeResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ValidateUserJavascriptCodeResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ValidateUserJavascriptCodeResponseValidationError) ErrorName() string { + return "ValidateUserJavascriptCodeResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e ValidateUserJavascriptCodeResponseValidationError) 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 %sValidateUserJavascriptCodeResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ValidateUserJavascriptCodeResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ValidateUserJavascriptCodeResponseValidationError{} diff --git a/backend/go.mod b/backend/go.mod index 8f3d67f2e3..e794948654 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -20,6 +20,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7 github.com/aws/aws-sdk-go-v2/service/sts v1.26.6 github.com/aws/smithy-go v1.19.0 + github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d github.com/golang-migrate/migrate/v4 v4.17.0 github.com/google/uuid v1.5.0 github.com/jackc/pgx/v5 v5.5.1 @@ -108,6 +109,7 @@ require ( github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/denisenkom/go-mssqldb v0.12.3 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/cli v23.0.3+incompatible // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect @@ -129,6 +131,7 @@ require ( github.com/go-faster/errors v0.6.1 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gocql/gocql v1.6.0 // indirect @@ -150,6 +153,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-github/v39 v39.2.0 // indirect github.com/google/go-querystring v1.1.0 // indirect + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect diff --git a/backend/go.sum b/backend/go.sum index 9cf754897a..881b8a636e 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -236,8 +236,11 @@ github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91 github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -265,6 +268,7 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7 github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369 h1:XNT/Zf5l++1Pyg08/HV04ppB0gKxAqtZQBRYiYrUuYk= github.com/cznic/mathutil v0.0.0-20180504122225-ca4c9f2c1369/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= @@ -277,6 +281,9 @@ github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+ github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= github.com/dhui/dktest v0.4.0 h1:z05UmuXZHO/bgj/ds2bGMBu8FI4WA+Ag/m3ghL+om7M= github.com/dhui/dktest v0.4.0/go.mod h1:v/Dbz1LgCBOi2Uki2nUqLBGa83hWBGFMu5MrgMDCc78= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= @@ -290,6 +297,13 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d h1:wi6jN5LVt/ljaBG4ue79Ekzb12QfJ52L9Q98tl8SWhw= +github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= +github.com/dop251/goja_nodejs v0.0.0-20220808115320-bac29516aae9 h1:7nszERfxMR5Gyw+M21EbrZZyTtVbRhNdRmtW/Vr3hzc= +github.com/dop251/goja_nodejs v0.0.0-20220808115320-bac29516aae9/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= @@ -367,6 +381,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-quicktest/qt v1.100.0 h1:I7iSLgIwNp0E0UnSvKJzs7ig0jg/Iq83zsZjtQNW7jY= github.com/go-quicktest/qt v1.100.0/go.mod h1:leyLsQ4jksGmF1KaQEyabnqGIiJTbOU5S46QegToEj4= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= @@ -475,8 +491,8 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= @@ -538,6 +554,7 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -680,6 +697,7 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -861,6 +879,7 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rqlite/gorqlite v0.0.0-20230708021416-2acd02b70b79 h1:V7x0hCAgL8lNGezuex1RW1sh7VXXCqfw8nXZti66iFg= @@ -897,6 +916,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/snowflakedb/gosnowflake v1.7.1 h1:c9JjyjjDlvxex9ud71TwKL+Wu54Vfx+39h4DAwbIdqU= +github.com/snowflakedb/gosnowflake v1.7.1/go.mod h1:JI3eRZL8CpimPek6CJO0aTbDQjDGOt7Rxv9A/ti4f5c= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -1216,6 +1236,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/backend/protos/mgmt/v1alpha1/transformer.proto b/backend/protos/mgmt/v1alpha1/transformer.proto index a29bb0f490..3e43c4ccad 100644 --- a/backend/protos/mgmt/v1alpha1/transformer.proto +++ b/backend/protos/mgmt/v1alpha1/transformer.proto @@ -128,6 +128,7 @@ message TransformerConfig { Null nullconfig = 36; UserDefinedTransformerConfig user_defined_transformer_config = 37; GenerateDefault generate_default_config = 38; + TransformJavascript transform_javascript_config = 39; } } @@ -252,10 +253,23 @@ message Passthrough {} message Null {} +message TransformJavascript { + string code = 1; +} + message UserDefinedTransformerConfig { string id = 1 [(buf.validate.field).string.uuid = true]; } +message ValidateUserJavascriptCodeRequest { + string account_id = 1 [(buf.validate.field).string.uuid = true]; + string code = 2; +} + +message ValidateUserJavascriptCodeResponse { + bool valid = 1; +} + service TransformersService { rpc GetSystemTransformers(GetSystemTransformersRequest) returns (GetSystemTransformersResponse) {} rpc GetUserDefinedTransformers(GetUserDefinedTransformersRequest) returns (GetUserDefinedTransformersResponse) {} @@ -264,4 +278,5 @@ service TransformersService { rpc DeleteUserDefinedTransformer(DeleteUserDefinedTransformerRequest) returns (DeleteUserDefinedTransformerResponse) {} rpc UpdateUserDefinedTransformer(UpdateUserDefinedTransformerRequest) returns (UpdateUserDefinedTransformerResponse) {} rpc IsTransformerNameAvailable(IsTransformerNameAvailableRequest) returns (IsTransformerNameAvailableResponse) {} + rpc ValidateUserJavascriptCode(ValidateUserJavascriptCodeRequest) returns (ValidateUserJavascriptCodeResponse) {} } diff --git a/backend/services/mgmt/v1alpha1/transformers-service/transformers.go b/backend/services/mgmt/v1alpha1/transformers-service/transformers.go index 13a89ef732..c28d9c8fb7 100644 --- a/backend/services/mgmt/v1alpha1/transformers-service/transformers.go +++ b/backend/services/mgmt/v1alpha1/transformers-service/transformers.go @@ -2,8 +2,10 @@ package v1alpha1_transformersservice import ( "context" + "fmt" "connectrpc.com/connect" + "github.com/dop251/goja" db_queries "github.com/nucleuscloud/neosync/backend/gen/go/db" mgmtv1alpha1 "github.com/nucleuscloud/neosync/backend/gen/go/protos/mgmt/v1alpha1" logger_interceptor "github.com/nucleuscloud/neosync/backend/internal/connect/interceptors/logger" @@ -54,6 +56,7 @@ const ( Passthrough Transformation = "passthrough" Null Transformation = "null" Invalid Transformation = "invalid" + TransformJavascript Transformation = "transform_javascript" ) func (s *Service) GetSystemTransformers( @@ -516,6 +519,17 @@ func (s *Service) GetSystemTransformers( }, }, }, + { + Name: "Transform Javascript", + Description: "Write custom javascript to transform data", + DataType: "any", + Source: string(TransformJavascript), + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{Code: ""}, + }, + }, + }, }, }), nil } @@ -711,3 +725,36 @@ func (s *Service) IsTransformerNameAvailable(ctx context.Context, req *connect.R }), nil } + +// use the goja library to validate that the javascript can compile and theoretically run +func (s *Service) ValidateUserJavascriptCode(ctx context.Context, req *connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]) (*connect.Response[mgmtv1alpha1.ValidateUserJavascriptCodeResponse], error) { + + _, err := s.verifyUserInAccount(ctx, req.Msg.AccountId) + if err != nil { + return nil, err + } + + js := constructJavascriptCode(req.Msg.Code) + + _, err = goja.Compile("test", js, true) + if err != nil { + return connect.NewResponse(&mgmtv1alpha1.ValidateUserJavascriptCodeResponse{ + Valid: false, + }), nil + } + + return connect.NewResponse(&mgmtv1alpha1.ValidateUserJavascriptCodeResponse{ + Valid: true, + }), nil +} + +func constructJavascriptCode(jsCode string) string { + if jsCode != "" { + return fmt.Sprintf(`(()=>{ + function fn1(value){ + %s + }})();`, jsCode) + } else { + return "" + } +} diff --git a/backend/services/mgmt/v1alpha1/transformers-service/transformers_test.go b/backend/services/mgmt/v1alpha1/transformers-service/transformers_test.go index 96a5472307..4fbd49e1e8 100644 --- a/backend/services/mgmt/v1alpha1/transformers-service/transformers_test.go +++ b/backend/services/mgmt/v1alpha1/transformers-service/transformers_test.go @@ -39,7 +39,7 @@ func Test_GetSystemTransformers(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, resp) - assert.Equal(t, 37, len(resp.Msg.GetTransformers())) // the number of system transformers + assert.NotEmpty(t, resp.Msg.GetTransformers()) } func Test_GetUserDefinedTransformers(t *testing.T) { @@ -397,7 +397,7 @@ func Test_IsTtransformerNameAvailable_True(t *testing.T) { assert.Equal(t, true, resp.Msg.IsAvailable) } -func Test_IsConnectionNameAvailable_False(t *testing.T) { +func Test_IsTransformerNameAvailable_False(t *testing.T) { m := createServiceMock(t) defer m.SqlDbMock.Close() @@ -420,6 +420,45 @@ func Test_IsConnectionNameAvailable_False(t *testing.T) { assert.Equal(t, false, resp.Msg.IsAvailable) } +func Test_ValidateUserJavascriptCode_True(t *testing.T) { + m := createServiceMock(t) + + code := ` + var payload = value+=" hello"; + return payload;` + + mockIsUserInAccount(m.UserAccountServiceMock, true) + + resp, err := m.Service.ValidateUserJavascriptCode(context.Background(), &connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]{ + Msg: &mgmtv1alpha1.ValidateUserJavascriptCodeRequest{ + AccountId: mockAccountId, + Code: code, + }, + }) + assert.NoError(t, err) + assert.NotNil(t, resp) + assert.Equal(t, true, resp.Msg.Valid) +} + +func Test_ValidateUserJavascriptCode_False(t *testing.T) { + m := createServiceMock(t) + + code := `var payload = value" hello";return payload;` + + mockIsUserInAccount(m.UserAccountServiceMock, true) + resp, err := m.Service.ValidateUserJavascriptCode(context.Background(), &connect.Request[mgmtv1alpha1.ValidateUserJavascriptCodeRequest]{ + Msg: &mgmtv1alpha1.ValidateUserJavascriptCodeRequest{ + AccountId: mockAccountId, + Code: code, + }, + }) + + // Assert no error was returned and the response is as expected. + assert.NoError(t, err) + assert.NotNil(t, resp) + assert.Equal(t, resp.Msg.Valid, false) +} + //nolint:all func mockTransformer(accountId, userId, transformerId string) db_queries.NeosyncApiTransformer { diff --git a/backend/sql/postgresql/models/transformers.go b/backend/sql/postgresql/models/transformers.go index 8445fa3248..b7febcb47b 100644 --- a/backend/sql/postgresql/models/transformers.go +++ b/backend/sql/postgresql/models/transformers.go @@ -48,6 +48,7 @@ type TransformerConfigs struct { Passthrough *PassthroughConfig `json:"passthrough,omitempty"` Null *NullConfig `json:"null,omitempty"` UserDefinedTransformer *UserDefinedTransformerConfig `json:"userDefinedTransformer,omitempty"` + TransformJavascript *TransformJavascriptConfig `json:"transformJavascript,omitempty"` } type GenerateEmailConfig struct{} @@ -175,6 +176,10 @@ type UserDefinedTransformerConfig struct { Id string `json:"id"` } +type TransformJavascriptConfig struct { + Code string `json:"code"` +} + // from API -> DB func (t *JobMappingTransformerModel) FromTransformerDto(tr *mgmtv1alpha1.JobMappingTransformer) error { @@ -319,6 +324,10 @@ func (t *TransformerConfigs) FromTransformerConfigDto(tr *mgmtv1alpha1.Transform t.UserDefinedTransformer = &UserDefinedTransformerConfig{ Id: tr.GetUserDefinedTransformerConfig().Id, } + case *mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig: + t.TransformJavascript = &TransformJavascriptConfig{ + Code: tr.GetTransformJavascriptConfig().Code, + } default: t = &TransformerConfigs{} } @@ -612,6 +621,14 @@ func (t *TransformerConfigs) ToTransformerConfigDto() *mgmtv1alpha1.TransformerC }, }, } + case t.TransformJavascript != nil: + return &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: t.TransformJavascript.Code, + }, + }, + } default: return &mgmtv1alpha1.TransformerConfig{} } diff --git a/cli/go.sum b/cli/go.sum index e20ffea291..d0322981b7 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -107,36 +107,55 @@ github.com/aws/aws-sdk-go v1.49.6 h1:yNldzF5kzLBRvKlKz1S0bkvc2+04R1kt13KfBWQBfFA github.com/aws/aws-sdk-go v1.49.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.7.1/go.mod h1:L5LuPC1ZgDr2xQS7AmIec/Jlc7O/Y1u2KxJyNVab250= github.com/aws/aws-sdk-go-v2 v1.24.0 h1:890+mqQ+hTpNuw0gGP6/4akolQkSToDJgHfQE7AwGuk= +github.com/aws/aws-sdk-go-v2 v1.24.0/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo= github.com/aws/aws-sdk-go-v2/config v1.5.0/go.mod h1:RWlPOAW3E3tbtNAqTwvSW54Of/yP3oiZXMI0xfUdjyA= github.com/aws/aws-sdk-go-v2/config v1.26.2 h1:+RWLEIWQIGgrz2pBPAUoGgNGs1TOyF4Hml7hCnYj2jc= +github.com/aws/aws-sdk-go-v2/config v1.26.2/go.mod h1:l6xqvUxt0Oj7PI/SUXYLNyZ9T/yBPn3YTQcJLLOdtR8= github.com/aws/aws-sdk-go-v2/credentials v1.3.1/go.mod h1:r0n73xwsIVagq8RsxmZbGSRQFj9As3je72C2WzUIToc= github.com/aws/aws-sdk-go-v2/credentials v1.16.13 h1:WLABQ4Cp4vXtXfOWOS3MEZKr6AAYUpMczLhgKtAjQ/8= +github.com/aws/aws-sdk-go-v2/credentials v1.16.13/go.mod h1:Qg6x82FXwW0sJHzYruxGiuApNo31UEtJvXVSZAXeWiw= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.3.0/go.mod h1:2LAuqPx1I6jNfaGDucWfA2zqQCYCOMCDHiCOciALyNw= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 h1:w98BT5w+ao1/r5sUuiH6JkVzjowOKeOJRHERyy1vh58= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10/go.mod h1:K2WGI7vUvkIv1HoNbfBA1bvIZ+9kL3YVmWxeKuLQsiw= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.3.2/go.mod h1:qaqQiHSrOUVOfKe6fhgQ6UzhxjwqVW8aHNegd6Ws4w4= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.9 h1:5zA8qVCXMPGt6YneFnll5B157SfdK2SewU85PH9/yM0= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.15.9/go.mod h1:t4gy210hPxkbtYM8xOzrWdxVq1PyekR76OOKXy3s0Vs= github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9 h1:v+HbZaCGmOwnTTVS86Fleq0vPzOd7tnJGbFhP0stNLs= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.9/go.mod h1:Xjqy+Nyj7VDLBtCMkQYOw1QYfAEZCVLrfI0ezve8wd4= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9 h1:N94sVhRACtXyVcjXxrwK1SKFIJrA9pOJ5yu2eSHnmls= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.9/go.mod h1:hqamLz7g1/4EJP+GH5NBhcUMLjW+gKLQabgyz6/7WAU= github.com/aws/aws-sdk-go-v2/internal/ini v1.1.1/go.mod h1:Zy8smImhTdOETZqfyn01iNOe0CNggVbPjCajyaz6Gvg= github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsMJDJ2sLur1gRBhEM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 h1:ugD6qzjYtB7zM5PN/ZIeaAIyefPaD82G8+SJopgvUpw= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9/go.mod h1:YD0aYBWCrPENpHolhKw2XDlTIWae2GKXT1T4o6N6hiM= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.2.1/go.mod h1:v33JQ57i2nekYTA70Mb+O18KeH4KqhdqxTJZNK1zdRE= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 h1:/90OR2XbSYfXucBMJ4U14wrjlfleq/0SB6dZDPncgmo= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9/go.mod h1:dN/Of9/fNZet7UrQQ6kTDo/VSwKPIq94vjlU16bRARc= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.2.1/go.mod h1:zceowr5Z1Nh2WVP8bf/3ikB41IZW59E4yIYbg+pC6mw= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 h1:Nf2sHxjMJR8CSImIVCONRi4g0Su3J+TSTbS7G0pUeMU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9/go.mod h1:idky4TER38YIjr2cADF1/ugFMKvZV7p//pVeV5LZbF0= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.5.1/go.mod h1:6EQZIwNNvHpq/2/QSJnp4+ECvqIy55w95Ofs0ze+nGQ= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 h1:iEAeF6YC3l4FzlJPP9H3Ko1TXpdjdqWffxXjp8SY6uk= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9/go.mod h1:kjsXoK23q9Z/tLBrckZLLyvjhZoS+AGrzqzUfEClvMM= github.com/aws/aws-sdk-go-v2/service/s3 v1.11.1/go.mod h1:XLAGFrEjbvMCLvAtWLLP32yTv8GpBquCApZEycDLunI= github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7 h1:o0ASbVwUAIrfp/WcCac+6jioZt4Hd8k/1X8u7GJ/QeM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.47.7/go.mod h1:vADO6Jn+Rq4nDtfwNjhgR84qkZwiC6FqCaXdw/kYwjA= github.com/aws/aws-sdk-go-v2/service/sso v1.3.1/go.mod h1:J3A3RGUvuCZjvSuZEcOpHDnzZP/sKbhDWV2T1EOzFIM= github.com/aws/aws-sdk-go-v2/service/sso v1.18.5 h1:ldSFWz9tEHAwHNmjx2Cvy1MjP5/L9kNoR0skc6wyOOM= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.5/go.mod h1:CaFfXLYL376jgbP7VKC96uFcU8Rlavak0UlAwk1Dlhc= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 h1:2k9KmFawS63euAkY4/ixVNsYYwrwnd5fIvgEKkfZFNM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5/go.mod h1:W+nd4wWDVkSUIox9bacmkBP5NMFQeTJ/xqNabpzSR38= github.com/aws/aws-sdk-go-v2/service/sts v1.6.0/go.mod h1:q7o0j7d7HrJk/vr9uUt3BVRASvcU7gYZB9PUgPiByXg= github.com/aws/aws-sdk-go-v2/service/sts v1.26.6 h1:HJeiuZ2fldpd0WqngyMR6KW7ofkXNLyOaHwEIGm39Cs= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.6/go.mod h1:XX5gh4CB7wAs4KhcF46G6C8a2i7eupU19dcAAE+EydU= github.com/aws/smithy-go v1.6.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= +github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= @@ -336,8 +355,8 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= @@ -615,6 +634,7 @@ github.com/sijms/go-ora/v2 v2.7.22/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/snowflakedb/gosnowflake v1.7.1 h1:c9JjyjjDlvxex9ud71TwKL+Wu54Vfx+39h4DAwbIdqU= +github.com/snowflakedb/gosnowflake v1.7.1/go.mod h1:JI3eRZL8CpimPek6CJO0aTbDQjDGOt7Rxv9A/ti4f5c= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= diff --git a/docs/protos/data/proto_docs.json b/docs/protos/data/proto_docs.json index 9845342bf4..439744975a 100644 --- a/docs/protos/data/proto_docs.json +++ b/docs/protos/data/proto_docs.json @@ -3987,6 +3987,30 @@ } ] }, + { + "name": "TransformJavascript", + "longName": "TransformJavascript", + "fullName": "mgmt.v1alpha1.TransformJavascript", + "description": "", + "hasExtensions": false, + "hasFields": true, + "hasOneofs": false, + "extensions": [], + "fields": [ + { + "name": "code", + "description": "", + "label": "", + "type": "string", + "longType": "string", + "fullType": "string", + "ismap": false, + "isoneof": false, + "oneofdecl": "", + "defaultValue": "" + } + ] + }, { "name": "TransformLastName", "longName": "TransformLastName", @@ -4536,6 +4560,18 @@ "isoneof": true, "oneofdecl": "config", "defaultValue": "" + }, + { + "name": "transform_javascript_config", + "description": "", + "label": "", + "type": "TransformJavascript", + "longType": "TransformJavascript", + "fullType": "mgmt.v1alpha1.TransformJavascript", + "ismap": false, + "isoneof": true, + "oneofdecl": "config", + "defaultValue": "" } ] }, @@ -4766,6 +4802,66 @@ "defaultValue": "" } ] + }, + { + "name": "ValidateUserJavascriptCodeRequest", + "longName": "ValidateUserJavascriptCodeRequest", + "fullName": "mgmt.v1alpha1.ValidateUserJavascriptCodeRequest", + "description": "", + "hasExtensions": false, + "hasFields": true, + "hasOneofs": false, + "extensions": [], + "fields": [ + { + "name": "account_id", + "description": "", + "label": "", + "type": "string", + "longType": "string", + "fullType": "string", + "ismap": false, + "isoneof": false, + "oneofdecl": "", + "defaultValue": "" + }, + { + "name": "code", + "description": "", + "label": "", + "type": "string", + "longType": "string", + "fullType": "string", + "ismap": false, + "isoneof": false, + "oneofdecl": "", + "defaultValue": "" + } + ] + }, + { + "name": "ValidateUserJavascriptCodeResponse", + "longName": "ValidateUserJavascriptCodeResponse", + "fullName": "mgmt.v1alpha1.ValidateUserJavascriptCodeResponse", + "description": "", + "hasExtensions": false, + "hasFields": true, + "hasOneofs": false, + "extensions": [], + "fields": [ + { + "name": "valid", + "description": "", + "label": "", + "type": "bool", + "longType": "bool", + "fullType": "bool", + "ismap": false, + "isoneof": false, + "oneofdecl": "", + "defaultValue": "" + } + ] } ], "services": [ @@ -4858,6 +4954,18 @@ "responseLongType": "IsTransformerNameAvailableResponse", "responseFullType": "mgmt.v1alpha1.IsTransformerNameAvailableResponse", "responseStreaming": false + }, + { + "name": "ValidateUserJavascriptCode", + "description": "", + "requestType": "ValidateUserJavascriptCodeRequest", + "requestLongType": "ValidateUserJavascriptCodeRequest", + "requestFullType": "mgmt.v1alpha1.ValidateUserJavascriptCodeRequest", + "requestStreaming": false, + "responseType": "ValidateUserJavascriptCodeResponse", + "responseLongType": "ValidateUserJavascriptCodeResponse", + "responseFullType": "mgmt.v1alpha1.ValidateUserJavascriptCodeResponse", + "responseStreaming": false } ] } diff --git a/frontend/apps/web/app/[account]/new/transformer/schema.ts b/frontend/apps/web/app/[account]/new/transformer/schema.ts index 85d0a5bf44..8655b964ce 100644 --- a/frontend/apps/web/app/[account]/new/transformer/schema.ts +++ b/frontend/apps/web/app/[account]/new/transformer/schema.ts @@ -159,6 +159,10 @@ const userDefinedTransformerConfig = Yup.object().shape({ id: Yup.string().required('This field is required.'), }); +const transformJavascriptConfig = Yup.object().shape({ + code: Yup.string().required('This field is required.'), +}); + type ConfigType = TransformerConfig['config']; // Helper function to extract the 'case' property from a config type @@ -216,6 +220,7 @@ const TRANSFORMER_SCHEMA_CONFIGS: Record< transformPhoneNumberConfig: transformPhoneNumberConfig, transformStringConfig: transformStringConfig, userDefinedTransformerConfig: userDefinedTransformerConfig, + transformJavascriptConfig: transformJavascriptConfig, }; export const TransformerConfigSchema = Yup.lazy((v) => { diff --git a/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_connect.ts b/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_connect.ts index 4d4e2b8cf1..2da4d8767d 100644 --- a/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_connect.ts +++ b/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_connect.ts @@ -3,7 +3,7 @@ /* eslint-disable */ // @ts-nocheck -import { CreateUserDefinedTransformerRequest, CreateUserDefinedTransformerResponse, DeleteUserDefinedTransformerRequest, DeleteUserDefinedTransformerResponse, GetSystemTransformersRequest, GetSystemTransformersResponse, GetUserDefinedTransformerByIdRequest, GetUserDefinedTransformerByIdResponse, GetUserDefinedTransformersRequest, GetUserDefinedTransformersResponse, IsTransformerNameAvailableRequest, IsTransformerNameAvailableResponse, UpdateUserDefinedTransformerRequest, UpdateUserDefinedTransformerResponse } from "./transformer_pb.js"; +import { CreateUserDefinedTransformerRequest, CreateUserDefinedTransformerResponse, DeleteUserDefinedTransformerRequest, DeleteUserDefinedTransformerResponse, GetSystemTransformersRequest, GetSystemTransformersResponse, GetUserDefinedTransformerByIdRequest, GetUserDefinedTransformerByIdResponse, GetUserDefinedTransformersRequest, GetUserDefinedTransformersResponse, IsTransformerNameAvailableRequest, IsTransformerNameAvailableResponse, UpdateUserDefinedTransformerRequest, UpdateUserDefinedTransformerResponse, ValidateUserJavascriptCodeRequest, ValidateUserJavascriptCodeResponse } from "./transformer_pb.js"; import { MethodKind } from "@bufbuild/protobuf"; /** @@ -75,6 +75,15 @@ export const TransformersService = { O: IsTransformerNameAvailableResponse, kind: MethodKind.Unary, }, + /** + * @generated from rpc mgmt.v1alpha1.TransformersService.ValidateUserJavascriptCode + */ + validateUserJavascriptCode: { + name: "ValidateUserJavascriptCode", + I: ValidateUserJavascriptCodeRequest, + O: ValidateUserJavascriptCodeResponse, + kind: MethodKind.Unary, + }, } } as const; diff --git a/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_pb.ts b/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_pb.ts index 3bf450cf9c..35955dc894 100644 --- a/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_pb.ts +++ b/frontend/packages/sdk/src/client/mgmt/v1alpha1/transformer_pb.ts @@ -947,6 +947,12 @@ export class TransformerConfig extends Message { */ value: GenerateDefault; case: "generateDefaultConfig"; + } | { + /** + * @generated from field: mgmt.v1alpha1.TransformJavascript transform_javascript_config = 39; + */ + value: TransformJavascript; + case: "transformJavascriptConfig"; } | { case: undefined; value?: undefined } = { case: undefined }; constructor(data?: PartialMessage) { @@ -995,6 +1001,7 @@ export class TransformerConfig extends Message { { no: 36, name: "nullconfig", kind: "message", T: Null, oneof: "config" }, { no: 37, name: "user_defined_transformer_config", kind: "message", T: UserDefinedTransformerConfig, oneof: "config" }, { no: 38, name: "generate_default_config", kind: "message", T: GenerateDefault, oneof: "config" }, + { no: 39, name: "transform_javascript_config", kind: "message", T: TransformJavascript, oneof: "config" }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): TransformerConfig { @@ -2335,6 +2342,43 @@ export class Null extends Message { } } +/** + * @generated from message mgmt.v1alpha1.TransformJavascript + */ +export class TransformJavascript extends Message { + /** + * @generated from field: string code = 1; + */ + code = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mgmt.v1alpha1.TransformJavascript"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "code", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransformJavascript { + return new TransformJavascript().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransformJavascript { + return new TransformJavascript().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransformJavascript { + return new TransformJavascript().fromJsonString(jsonString, options); + } + + static equals(a: TransformJavascript | PlainMessage | undefined, b: TransformJavascript | PlainMessage | undefined): boolean { + return proto3.util.equals(TransformJavascript, a, b); + } +} + /** * @generated from message mgmt.v1alpha1.UserDefinedTransformerConfig */ @@ -2372,3 +2416,83 @@ export class UserDefinedTransformerConfig extends Message { + /** + * @generated from field: string account_id = 1; + */ + accountId = ""; + + /** + * @generated from field: string code = 2; + */ + code = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mgmt.v1alpha1.ValidateUserJavascriptCodeRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "account_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "code", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ValidateUserJavascriptCodeRequest { + return new ValidateUserJavascriptCodeRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ValidateUserJavascriptCodeRequest { + return new ValidateUserJavascriptCodeRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ValidateUserJavascriptCodeRequest { + return new ValidateUserJavascriptCodeRequest().fromJsonString(jsonString, options); + } + + static equals(a: ValidateUserJavascriptCodeRequest | PlainMessage | undefined, b: ValidateUserJavascriptCodeRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ValidateUserJavascriptCodeRequest, a, b); + } +} + +/** + * @generated from message mgmt.v1alpha1.ValidateUserJavascriptCodeResponse + */ +export class ValidateUserJavascriptCodeResponse extends Message { + /** + * @generated from field: bool valid = 1; + */ + valid = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "mgmt.v1alpha1.ValidateUserJavascriptCodeResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "valid", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ValidateUserJavascriptCodeResponse { + return new ValidateUserJavascriptCodeResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ValidateUserJavascriptCodeResponse { + return new ValidateUserJavascriptCodeResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ValidateUserJavascriptCodeResponse { + return new ValidateUserJavascriptCodeResponse().fromJsonString(jsonString, options); + } + + static equals(a: ValidateUserJavascriptCodeResponse | PlainMessage | undefined, b: ValidateUserJavascriptCodeResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ValidateUserJavascriptCodeResponse, a, b); + } +} + diff --git a/worker/go.mod b/worker/go.mod index a4f4c25186..4997a75c92 100644 --- a/worker/go.mod +++ b/worker/go.mod @@ -71,7 +71,10 @@ require ( github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/denisenkom/go-mssqldb v0.12.3 // indirect + github.com/dlclark/regexp2 v1.7.0 // indirect github.com/docker/docker v24.0.7+incompatible // indirect + github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d // indirect + github.com/dop251/goja_nodejs v0.0.0-20220808115320-bac29516aae9 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/eapache/go-resiliency v1.4.0 // indirect @@ -89,6 +92,7 @@ require ( github.com/go-faster/errors v0.6.1 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-sql-driver/mysql v1.7.1 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -104,6 +108,7 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v23.5.26+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect + github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect diff --git a/worker/go.sum b/worker/go.sum index 63178a44fe..0ecc597cc3 100644 --- a/worker/go.sum +++ b/worker/go.sum @@ -181,6 +181,7 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.12.3 h1:pBSGx9Tq67pBOTLmxNuirNTeB8Vjmf886Kx+8Y+8shw= github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= +github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v23.0.3+incompatible h1:Zcse1DuDqBdgI7OQDV8Go7b83xLgfhW1eza4HfEdxpY= @@ -191,6 +192,8 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349d h1:wi6jN5LVt/ljaBG4ue79Ekzb12QfJ52L9Q98tl8SWhw= +github.com/dop251/goja_nodejs v0.0.0-20220808115320-bac29516aae9 h1:7nszERfxMR5Gyw+M21EbrZZyTtVbRhNdRmtW/Vr3hzc= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= @@ -255,6 +258,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-quicktest/qt v1.100.0 h1:I7iSLgIwNp0E0UnSvKJzs7ig0jg/Iq83zsZjtQNW7jY= github.com/go-quicktest/qt v1.100.0/go.mod h1:leyLsQ4jksGmF1KaQEyabnqGIiJTbOU5S46QegToEj4= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= @@ -337,8 +341,7 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= diff --git a/worker/internal/benthos/config.go b/worker/internal/benthos/config.go index 49290f369d..3a52c46a17 100644 --- a/worker/internal/benthos/config.go +++ b/worker/internal/benthos/config.go @@ -58,7 +58,12 @@ type PipelineConfig struct { } type ProcessorConfig struct { - Mutation string `json:"mutation" yaml:"mutation"` + Mutation *string `json:"mutation,omitempty" yaml:"mutation,omitempty"` + Javascript *JavascriptConfig `json:"javascript,omitempty" yaml:"javascript,omitempty"` +} + +type JavascriptConfig struct { + Code string `json:"code" yaml:"code"` } type OutputConfig struct { diff --git a/worker/pkg/workflows/datasync/activities/activities.go b/worker/pkg/workflows/datasync/activities/activities.go index 513d7208bd..05609bf66f 100644 --- a/worker/pkg/workflows/datasync/activities/activities.go +++ b/worker/pkg/workflows/datasync/activities/activities.go @@ -117,7 +117,7 @@ type sqlSourceTableOptions struct { WhereClause *string } -func (b *benthosBuilder) buildBenthosSqlSourceConfigReponses( +func (b *benthosBuilder) buildBenthosSqlSourceConfigResponses( ctx context.Context, mappings []*TableMapping, dsn string, @@ -168,15 +168,17 @@ func (b *benthosBuilder) buildBenthosSqlSourceConfigReponses( }, }, } - mutation, err := b.buildProcessorMutation(ctx, tableMapping.Mappings) + + processorConfig, err := b.buildProcessorConfig(ctx, tableMapping.Mappings) if err != nil { return nil, err } - if mutation != "" { - bc.StreamConfig.Pipeline.Processors = append(bc.StreamConfig.Pipeline.Processors, neosync_benthos.ProcessorConfig{ - Mutation: mutation, - }) + + if (processorConfig.Mutation != nil && *processorConfig.Mutation != "") || + (processorConfig.Javascript != nil && processorConfig.Javascript.Code != "") { + bc.StreamConfig.Pipeline.Processors = append(bc.StreamConfig.Pipeline.Processors, *processorConfig) } + responses = append(responses, &BenthosConfigResponse{ Name: neosync_benthos.BuildBenthosTable(tableMapping.Schema, tableMapping.Table), // todo: may need to expand on this Config: bc, @@ -541,32 +543,97 @@ func getMysqlDsn( } } -func (b *benthosBuilder) buildProcessorMutation(ctx context.Context, cols []*mgmtv1alpha1.JobMapping) (string, error) { - pieces := []string{} +func (b *benthosBuilder) buildProcessorConfig(ctx context.Context, cols []*mgmtv1alpha1.JobMapping) (*neosync_benthos.ProcessorConfig, error) { + mutations := []string{} + jsFunctions := []string{} + benthosOutputs := []string{} for _, col := range cols { - if col.Transformer != nil && col.Transformer.Source != "" && col.Transformer.Source != "passthrough" && col.Transformer.Source != "generate_default" { + if shouldProcessColumn(col.Transformer) { if _, ok := col.Transformer.Config.Config.(*mgmtv1alpha1.TransformerConfig_UserDefinedTransformerConfig); ok { // handle user defined transformer -> get the user defined transformer configs using the id - val, err := b.convertUserDefinedFunctionConfig(ctx, col.Transformer) if err != nil { - return "", errors.New("unable to look up user defined transformer config by id") + return nil, errors.New("unable to look up user defined transformer config by id") } col.Transformer = val - } - mutation, err := computeMutationFunction(col) - if err != nil { - return "", fmt.Errorf("%s is not a supported transformer: %w", col.Transformer, err) + if col.Transformer.Source == "transform_javascript" { + + code := col.Transformer.Config.GetTransformJavascriptConfig().Code + // construct the js code and only append if there is code available + if code != "" { + jsFunctions = append(jsFunctions, constructJsFunction(code, col.Column)) + benthosOutputs = append(benthosOutputs, constructBenthosOutput(col.Column)) + } + } else { + mutation, err := computeMutationFunction(col) + if err != nil { + return nil, fmt.Errorf("%s is not a supported transformer: %w", col.Transformer, err) + } + mutations = append(mutations, fmt.Sprintf("root.%s = %s", col.Column, mutation)) } - pieces = append(pieces, fmt.Sprintf("root.%s = %s", col.Column, mutation)) + + } + } + + mutationStr := strings.Join(mutations, "\n") + + pc := &neosync_benthos.ProcessorConfig{} + if len(mutationStr) > 0 { + pc.Mutation = &mutationStr + } + if len(jsFunctions) > 0 { + javascriptConfig := neosync_benthos.JavascriptConfig{ + Code: constructBenthosJsProcessor(jsFunctions, benthosOutputs), } + pc.Javascript = &javascriptConfig } - return strings.Join(pieces, "\n"), nil + + return pc, nil +} + +func shouldProcessColumn(t *mgmtv1alpha1.JobMappingTransformer) bool { + return t != nil && + t.Source != "" && + t.Source != "passthrough" && + t.Source != "generate_default" +} + +func constructJsFunction(jsCode, col string) string { + if jsCode != "" { + return fmt.Sprintf(` +function fn_%s(value){ + %s +}; +`, col, jsCode) + } else { + return "" + } +} + +func constructBenthosJsProcessor(jsFunctions, benthosOutputs []string) string { + + jsFunctionStrings := strings.Join(jsFunctions, "\n") + + benthosOutputString := strings.Join(benthosOutputs, "\n") + + jsCode := fmt.Sprintf(` +(() => { +%s +const input = benthos.v0_msg_as_structured(); +const output = { ...input }; +%s +benthos.v0_msg_set_structured(output); +})();`, jsFunctionStrings, benthosOutputString) + return jsCode +} + +func constructBenthosOutput(col string) string { + return fmt.Sprintf(`output["%[1]s"] = fn_%[1]s(input["%[1]s"]);`, col) } // takes in an user defined config with just an id field and return the right transformer config for that user defined function id diff --git a/worker/pkg/workflows/datasync/activities/activities_test.go b/worker/pkg/workflows/datasync/activities/activities_test.go index 6c3862ef79..a98b6d0cc7 100644 --- a/worker/pkg/workflows/datasync/activities/activities_test.go +++ b/worker/pkg/workflows/datasync/activities/activities_test.go @@ -5,12 +5,15 @@ import ( "context" "crypto/sha256" "encoding/hex" + "fmt" + "os" "strconv" "strings" "testing" "connectrpc.com/connect" "github.com/benthosdev/benthos/v4/public/bloblang" + _ "github.com/benthosdev/benthos/v4/public/components/javascript" db_queries "github.com/nucleuscloud/neosync/backend/gen/go/db" mysql_queries "github.com/nucleuscloud/neosync/backend/gen/go/db/dbschemas/mysql" pg_queries "github.com/nucleuscloud/neosync/backend/gen/go/db/dbschemas/postgresql" @@ -186,7 +189,121 @@ output: require.NoError(t, err) } -func Test_buildProcessorMutation(t *testing.T) { +func Test_Sync_Run_Success_Javascript(t *testing.T) { + testSuite := &testsuite.WorkflowTestSuite{} + env := testSuite.NewTestActivityEnvironment() + + activities := &Activities{} + env.RegisterActivity(activities) + + tmpFile, err := os.CreateTemp("", "test") + if err != nil { + t.Fatalf("Failed to create temp file: %v", err) + } + defer os.Remove(tmpFile.Name()) + + val, err := env.ExecuteActivity(activities.Sync, &SyncRequest{ + BenthosConfig: strings.TrimSpace(fmt.Sprintf(` +input: + generate: + mapping: root = {"name":"evis"} + interval: 1s + count: 1 +pipeline: + processors: + - javascript: + code: | + (() => { + function fn_name(value){ + var a = value + "test"; + return a }; + const input = benthos.v0_msg_as_structured(); + const output = { ...input }; + output["name"] = fn_name(input["name"]); + benthos.v0_msg_set_structured(output); + })(); +output: + label: "" + file: + path: %s + codec: lines +`, tmpFile.Name())), + }, &SyncMetadata{Schema: "public", Table: "test"}) + assert.NoError(t, err) + res := &SyncResponse{} + err = val.Get(res) + assert.NoError(t, err) + + stdoutBytes, err := os.ReadFile(tmpFile.Name()) + if err != nil { + t.Fatalf("Failed to read from temp file: %v", err) + } + stringResult := string(stdoutBytes) + + returnValue := strings.TrimSpace(stringResult) // remove new line at the end of the stdout line + + assert.Equal(t, `{"name":"evistest"}`, returnValue) +} + +func Test_Sync_Run_Success_MutataionAndJavascript(t *testing.T) { + testSuite := &testsuite.WorkflowTestSuite{} + env := testSuite.NewTestActivityEnvironment() + + activities := &Activities{} + env.RegisterActivity(activities) + + tmpFile, err := os.CreateTemp("", "test") + if err != nil { + t.Fatalf("Failed to create temp file: %v", err) + } + defer os.Remove(tmpFile.Name()) + + val, err := env.ExecuteActivity(activities.Sync, &SyncRequest{ + BenthosConfig: strings.TrimSpace(fmt.Sprintf(` +input: + generate: + mapping: root = {"name":"evis"} + interval: 1s + count: 1 +pipeline: + processors: + - mutation: + root.name = this.name.reverse() + - javascript: + code: | + (() => { + function fn1(value){ + var a = value + "test"; + return a }; + const input = benthos.v0_msg_as_structured(); + const output = { ...input }; + output["name"] = fn1(input["name"]); + benthos.v0_msg_set_structured(output); + })(); +output: + label: "" + file: + path: %s + codec: lines + `, tmpFile.Name())), + }, &SyncMetadata{Schema: "public", Table: "test"}) + assert.NoError(t, err) + res := &SyncResponse{} + err = val.Get(res) + assert.NoError(t, err) + + stdoutBytes, err := os.ReadFile(tmpFile.Name()) + if err != nil { + t.Fatalf("Failed to read from temp file: %v", err) + } + stringResult := string(stdoutBytes) + + returnValue := strings.TrimSpace(stringResult) // remove new line at the end of the stdout line + + assert.Equal(t, `{"name":"sivetest"}`, returnValue) +} + +func Test_buildProcessorConfigMutation(t *testing.T) { mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) @@ -202,33 +319,34 @@ func Test_buildProcessorMutation(t *testing.T) { bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) ctx := context.Background() - output, err := bbuilder.buildProcessorMutation(ctx, nil) + output, err := bbuilder.buildProcessorConfig(ctx, nil) + assert.Nil(t, err) - assert.Empty(t, output) + assert.Empty(t, output.Mutation) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{}) + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{}) assert.Nil(t, err) - assert.Empty(t, output) + assert.Empty(t, output.Mutation) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id"}, }) assert.Nil(t, err) - assert.Empty(t, output) + assert.Empty(t, output.Mutation) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{}}, }) assert.Nil(t, err) - assert.Empty(t, output) + assert.Empty(t, output.Mutation) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: "passthrough"}}, }) assert.Nil(t, err) - assert.Empty(t, output) + assert.Empty(t, output.Mutation) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: "null", Config: &mgmtv1alpha1.TransformerConfig{ Config: &mgmtv1alpha1.TransformerConfig_Nullconfig{ Nullconfig: &mgmtv1alpha1.Null{}, @@ -242,46 +360,30 @@ func Test_buildProcessorMutation(t *testing.T) { }) assert.Nil(t, err) - assert.Equal(t, output, "root.id = null\nroot.name = null") + assert.Equal(t, *output.Mutation, "root.id = null\nroot.name = null") - mockTransformerClient.On( - "GetUserDefinedTransformerById", - mock.Anything, - connect.NewRequest(&mgmtv1alpha1.GetUserDefinedTransformerByIdRequest{ - TransformerId: "123", - }), - ).Return(connect.NewResponse(&mgmtv1alpha1.GetUserDefinedTransformerByIdResponse{ - Transformer: &mgmtv1alpha1.UserDefinedTransformer{ - Id: "123", - Name: "stage", - Description: "description", - DataType: "string", - Source: "transform_email", - Config: &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_TransformEmailConfig{ - TransformEmailConfig: &mgmtv1alpha1.TransformEmail{ - PreserveDomain: true, - PreserveLength: false, - }, + jsT := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_email", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformEmailConfig{ + TransformEmailConfig: &mgmtv1alpha1.TransformEmail{ + PreserveDomain: true, + PreserveLength: false, }, }, }, - }), nil) + } - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ - {Schema: "public", Table: "users", Column: "email", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: "transform_email", Config: &mgmtv1alpha1.TransformerConfig{ - Config: &mgmtv1alpha1.TransformerConfig_UserDefinedTransformerConfig{ - UserDefinedTransformerConfig: &mgmtv1alpha1.UserDefinedTransformerConfig{ - Id: "123", - }, - }, - }}}, - }) + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ + {Schema: "public", Table: "users", Column: "email", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT.Source, Config: jsT.Config}}}) assert.Nil(t, err) - assert.Equal(t, output, `root.email = transform_email(email:this.email,preserve_domain:true,preserve_length:false)`) + assert.Equal(t, *output.Mutation, `root.email = transform_email(email:this.email,preserve_domain:true,preserve_length:false)`) - output, err = bbuilder.buildProcessorMutation(ctx, []*mgmtv1alpha1.JobMapping{ + output, err = bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: "i_do_not_exist", Config: &mgmtv1alpha1.TransformerConfig{ Config: &mgmtv1alpha1.TransformerConfig_Nullconfig{ Nullconfig: &mgmtv1alpha1.Null{}, @@ -290,6 +392,311 @@ func Test_buildProcessorMutation(t *testing.T) { }) assert.Error(t, err) assert.Empty(t, output) + +} + +const code = `var payload = value+=" hello";return payload;` + +func Test_buildProcessorConfigJavascript(t *testing.T) { + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + ctx := context.Background() + + col := "address" + + jsT := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: code, + }, + }, + }, + } + + res, err := bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ + {Schema: "public", Table: "users", Column: col, Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT.Source, Config: jsT.Config}}}) + + assert.NoError(t, err) + assert.Equal(t, ` +(() => { + +function fn_address(value){ + var payload = value+=" hello";return payload; +}; + +const input = benthos.v0_msg_as_structured(); +const output = { ...input }; +output["address"] = fn_address(input["address"]); +benthos.v0_msg_set_structured(output); +})();`, + res.Javascript.Code, + ) +} + +const col = "name" + +func Test_buildProcessorConfigJavascriptMultiLineScript(t *testing.T) { + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + ctx := context.Background() + + code := + `var payload = value+=" hello"; + payload.replace("hello","newHello"); + return payload;` + + jsT := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: code, + }, + }, + }, + } + + res, err := bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ + {Schema: "public", Table: "users", Column: col, Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT.Source, Config: jsT.Config}}}) + + assert.NoError(t, err) + assert.Equal(t, ` +(() => { + +function fn_name(value){ + var payload = value+=" hello"; + payload.replace("hello","newHello"); + return payload; +}; + +const input = benthos.v0_msg_as_structured(); +const output = { ...input }; +output["name"] = fn_name(input["name"]); +benthos.v0_msg_set_structured(output); +})();`, + res.Javascript.Code, + ) +} + +func Test_buildProcessorConfigJavascriptMultiple(t *testing.T) { + + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + ctx := context.Background() + + code2 := `var payload = value*2;return payload;` + col2 := "age" + + jsT := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: code, + }, + }, + }, + } + + jsT2 := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: code2, + }, + }, + }, + } + + res, err := bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ + {Schema: "public", Table: "users", Column: col, Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT.Source, Config: jsT.Config}}, + {Schema: "public", Table: "users", Column: col2, Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT2.Source, Config: jsT2.Config}}}) + + assert.NoError(t, err) + assert.Equal(t, ` +(() => { + +function fn_name(value){ + var payload = value+=" hello";return payload; +}; + + +function fn_age(value){ + var payload = value*2;return payload; +}; + +const input = benthos.v0_msg_as_structured(); +const output = { ...input }; +output["name"] = fn_name(input["name"]); +output["age"] = fn_age(input["age"]); +benthos.v0_msg_set_structured(output); +})();`, + res.Javascript.Code, + ) +} + +func Test_ShouldProcessColumnTrue(t *testing.T) { + + val := &mgmtv1alpha1.JobMappingTransformer{ + Source: "generate_email", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_Nullconfig{ + Nullconfig: &mgmtv1alpha1.Null{}, + }, + }, + } + + res := shouldProcessColumn(val) + assert.Equal(t, true, res) +} + +func Test_ShouldProcessColumnFalse(t *testing.T) { + + val := &mgmtv1alpha1.JobMappingTransformer{ + Source: "passthrough", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_PassthroughConfig{ + PassthroughConfig: &mgmtv1alpha1.Passthrough{}, + }, + }, + } + + res := shouldProcessColumn(val) + assert.Equal(t, false, res) +} + +func Test_ConstructJsFunction(t *testing.T) { + + col := "col" + + res := constructJsFunction(code, col) + assert.Equal(t, ` +function fn_col(value){ + var payload = value+=" hello";return payload; +}; +`, res) +} + +func Test_ConstructBenthosJsProcessor(t *testing.T) { + + jsFunctions := []string{} + benthosOutputs := []string{} + + benthosOutput := constructBenthosOutput(col) + jsFunction := constructJsFunction(code, col) + benthosOutputs = append(benthosOutputs, benthosOutput) + + jsFunctions = append(jsFunctions, jsFunction) + + res := constructBenthosJsProcessor(jsFunctions, benthosOutputs) + + assert.Equal(t, ` +(() => { + +function fn_name(value){ + var payload = value+=" hello";return payload; +}; + +const input = benthos.v0_msg_as_structured(); +const output = { ...input }; +output["name"] = fn_name(input["name"]); +benthos.v0_msg_set_structured(output); +})();`, res) +} + +func Test_ConstructBenthosOutput(t *testing.T) { + + col := "col" + + res := constructBenthosOutput(col) + + assert.Equal(t, `output["col"] = fn_col(input["col"]);`, res) +} + +func Test_buildProcessorConfigJavascriptEmpty(t *testing.T) { + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + ctx := context.Background() + + jsT := mgmtv1alpha1.SystemTransformer{ + Name: "stage", + Description: "description", + DataType: "string", + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{ + Code: ``, + }, + }, + }, + } + + resp, err := bbuilder.buildProcessorConfig(ctx, []*mgmtv1alpha1.JobMapping{ + {Schema: "public", Table: "users", Column: "id", Transformer: &mgmtv1alpha1.JobMappingTransformer{Source: jsT.Source, Config: jsT.Config}}}) + + assert.NoError(t, err) + assert.Empty(t, resp.Javascript) + } func Test_convertUserDefinedFunctionConfig(t *testing.T) { diff --git a/worker/pkg/workflows/datasync/activities/benthos-builder.go b/worker/pkg/workflows/datasync/activities/benthos-builder.go index 7dca7265d5..20e3faf495 100644 --- a/worker/pkg/workflows/datasync/activities/benthos-builder.go +++ b/worker/pkg/workflows/datasync/activities/benthos-builder.go @@ -176,7 +176,7 @@ func (b *benthosBuilder) GenerateBenthosConfigs( sourceTableOpts = groupPostgresSourceOptionsByTable(sqlOpts.Schemas) } - sourceResponses, err := b.buildBenthosSqlSourceConfigReponses(ctx, groupedMappings, dsn, "postgres", sourceTableOpts) + sourceResponses, err := b.buildBenthosSqlSourceConfigResponses(ctx, groupedMappings, dsn, "postgres", sourceTableOpts) if err != nil { return nil, err } @@ -240,7 +240,7 @@ func (b *benthosBuilder) GenerateBenthosConfigs( sourceTableOpts = groupMysqlSourceOptionsByTable(sqlOpts.Schemas) } - sourceResponses, err := b.buildBenthosSqlSourceConfigReponses(ctx, groupedMappings, dsn, "mysql", sourceTableOpts) + sourceResponses, err := b.buildBenthosSqlSourceConfigResponses(ctx, groupedMappings, dsn, "mysql", sourceTableOpts) if err != nil { return nil, err } @@ -579,11 +579,11 @@ func (b *benthosBuilder) buildBenthosGenerateSourceConfigResponses( count = tableOpt.Count } - mapping, err := b.buildProcessorMutation(ctx, tableMapping.Mappings) + mapping, err := b.buildProcessorConfig(ctx, tableMapping.Mappings) if err != nil { return nil, err } - if mapping == "" { + if mapping.Mutation == nil { return nil, errors.New("unable to generate config mapping for table") // workshop this more } @@ -594,7 +594,7 @@ func (b *benthosBuilder) buildBenthosGenerateSourceConfigResponses( Generate: &neosync_benthos.Generate{ Interval: "", Count: count, - Mapping: mapping, + Mapping: *mapping.Mutation, }, }, }, diff --git a/worker/pkg/workflows/datasync/activities/benthos-builder_test.go b/worker/pkg/workflows/datasync/activities/benthos-builder_test.go index 3b820adea8..5578f12eaa 100644 --- a/worker/pkg/workflows/datasync/activities/benthos-builder_test.go +++ b/worker/pkg/workflows/datasync/activities/benthos-builder_test.go @@ -312,6 +312,13 @@ output: processors: [] `), ) + + // create a new streambuilder instance so we can access the SetYaml method + newSB := sb.NewStreamBuilder() + + // SetYAML parses a full Benthos config and uses it to configure the builder. + err = newSB.SetYAML(string(out)) + assert.NoError(t, err) } func Test_BenthosBuilder_GenerateBenthosConfigs_Basic_Pg_Pg(t *testing.T) { @@ -1796,6 +1803,191 @@ func getBenthosConfigByName(resps []*BenthosConfigResponse, name string) *Bentho return nil } +func Test_ProcessorConfigEmpty(t *testing.T) { + + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + + tableMappings := []*TableMapping{ + {Schema: "public", + Table: "users", + Mappings: []*mgmtv1alpha1.JobMapping{ + { + Schema: "public", + Table: "users", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "generate_default", + }, + }, + { + Schema: "public", + Table: "users", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "", + }, + }, + }, + }} + + dsn := "dsn" + driver := "driver" + sourceTableOpts := map[string]*sqlSourceTableOptions{"where": {WhereClause: &dsn}} + + res, err := bbuilder.buildBenthosSqlSourceConfigResponses(context.Background(), tableMappings, dsn, driver, sourceTableOpts) + assert.Nil(t, err) + assert.Empty(t, res[0].Config.StreamConfig.Pipeline.Processors) + +} +func Test_ProcessorConfigEmptyJavascript(t *testing.T) { + + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + + tableMappings := []*TableMapping{ + {Schema: "public", + Table: "users", + Mappings: []*mgmtv1alpha1.JobMapping{ + { + Schema: "public", + Table: "users", + Column: "id", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "generate_default", + }, + }, + { + Schema: "public", + Table: "users", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{Code: ""}, + }, + }, + }, + }, + }, + }} + + dsn := "dsn" + driver := "driver" + sourceTableOpts := map[string]*sqlSourceTableOptions{"where": {WhereClause: &dsn}} + + res, err := bbuilder.buildBenthosSqlSourceConfigResponses(context.Background(), tableMappings, dsn, driver, sourceTableOpts) + assert.Nil(t, err) + assert.Empty(t, res[0].Config.StreamConfig.Pipeline.Processors) + +} + +func Test_ProcessorConfigMultiJavascript(t *testing.T) { + + mockJobClient := mgmtv1alpha1connect.NewMockJobServiceClient(t) + mockConnectionClient := mgmtv1alpha1connect.NewMockConnectionServiceClient(t) + mockTransformerClient := mgmtv1alpha1connect.NewMockTransformersServiceClient(t) + + pgcache := map[string]pg_queries.DBTX{ + "fake-prod-url": pg_queries.NewMockDBTX(t), + "fake-stage-url": pg_queries.NewMockDBTX(t), + } + pgquerier := pg_queries.NewMockQuerier(t) + mysqlcache := map[string]mysql_queries.DBTX{} + mysqlquerier := mysql_queries.NewMockQuerier(t) + + bbuilder := newBenthosBuilder(pgcache, pgquerier, mysqlcache, mysqlquerier, mockJobClient, mockConnectionClient, mockTransformerClient) + + tableMappings := []*TableMapping{ + {Schema: "public", + Table: "users", + Mappings: []*mgmtv1alpha1.JobMapping{ + { + Schema: "public", + Table: "users", + Column: "name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{Code: `var payload = value + " hello";return payload;`}, + }, + }, + }, + }, + { + Schema: "public", + Table: "users", + Column: "first_name", + Transformer: &mgmtv1alpha1.JobMappingTransformer{ + Source: "transform_javascript", + Config: &mgmtv1alpha1.TransformerConfig{ + Config: &mgmtv1alpha1.TransformerConfig_TransformJavascriptConfig{ + TransformJavascriptConfig: &mgmtv1alpha1.TransformJavascript{Code: `var payload = value + " firstname";return payload;`}, + }, + }, + }, + }, + }, + }} + + dsn := "test" + driver := "test" + sourceTableOpts := map[string]*sqlSourceTableOptions{"test": {WhereClause: &dsn}} + + res, err := bbuilder.buildBenthosSqlSourceConfigResponses(context.Background(), tableMappings, dsn, driver, sourceTableOpts) + assert.Nil(t, err) + + out, err := yaml.Marshal(res[0].Config.Pipeline.Processors) + assert.NoError(t, err) + assert.Equal( + t, + strings.TrimSpace(` +- javascript: + code: |4- + (() => { + + function fn_name(value){ + var payload = value + " hello";return payload; + }; + + + function fn_first_name(value){ + var payload = value + " firstname";return payload; + }; + + const input = benthos.v0_msg_as_structured(); + const output = { ...input }; + output["name"] = fn_name(input["name"]); + output["first_name"] = fn_first_name(input["first_name"]); + benthos.v0_msg_set_structured(output); + })(); + `), strings.TrimSpace(string(out))) +} + // Generate -> S3 // PG -> S3 // Mysql -> S3