Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: fix deparse

d-bytebase01445c0fcbc8
diff --git a/frontend/src/types/proto/v1/cel_service.ts b/frontend/src/types/proto/v1/cel_service.ts
index bf65fefdc7..afbd642f41 100644
--- a/frontend/src/types/proto/v1/cel_service.ts
+++ b/frontend/src/types/proto/v1/cel_service.ts
@@ -568,6 +568,42 @@ export const CelServiceDefinition = {
},
},
},
+ deparse: {
+ name: "Deparse",
+ requestType: DeparseRequest,
+ requestStream: false,
+ responseType: DeparseResponse,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 578365826: [
+ new Uint8Array([
+ 20,
+ 58,
+ 1,
+ 42,
+ 34,
+ 15,
+ 47,
+ 118,
+ 49,
+ 47,
+ 99,
+ 101,
+ 108,
+ 47,
+ 100,
+ 101,
+ 112,
+ 97,
+ 114,
+ 115,
+ 101,
+ ]),
+ ],
+ },
+ },
+ },
batchDeparse: {
name: "BatchDeparse",
requestType: BatchDeparseRequest,
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 2823d0c58e..6ff9ff4101 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2171,6 +2171,7 @@ When paginating, all other parameters provided to `ListBookmarks` must match the
| ----------- | ------------ | ------------- | ------------|
| Parse | [ParseRequest](#bytebase-v1-ParseRequest) | [ParseResponse](#bytebase-v1-ParseResponse) | |
| BatchParse | [BatchParseRequest](#bytebase-v1-BatchParseRequest) | [BatchParseResponse](#bytebase-v1-BatchParseResponse) | |
+| Deparse | [DeparseRequest](#bytebase-v1-DeparseRequest) | [DeparseResponse](#bytebase-v1-DeparseResponse) | |
| BatchDeparse | [BatchDeparseRequest](#bytebase-v1-BatchDeparseRequest) | [BatchDeparseResponse](#bytebase-v1-BatchDeparseResponse) | |
diff --git a/proto/generated-go/v1/cel_service.pb.go b/proto/generated-go/v1/cel_service.pb.go
index a84016fbd7..4cf085f1c9 100644
--- a/proto/generated-go/v1/cel_service.pb.go
+++ b/proto/generated-go/v1/cel_service.pb.go
@@ -443,7 +443,7 @@ var file_v1_cel_service_proto_rawDesc = []byte{
0x0a, 0x14, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x78, 0x70,
- 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xca, 0x02, 0x0a, 0x0a, 0x43, 0x65, 0x6c,
+ 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xac, 0x03, 0x0a, 0x0a, 0x43, 0x65, 0x6c,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65,
0x12, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50,
0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x62, 0x79,
@@ -457,15 +457,22 @@ var file_v1_cel_service_proto_rawDesc = []byte{
0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31,
0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12,
- 0x74, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x12,
- 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61,
- 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22,
- 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65,
- 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
- 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x60, 0x0a, 0x07, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1b, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a,
+ 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x73,
+ 0x65, 0x12, 0x74, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73,
+ 0x65, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
+ 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01,
+ 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x65, 0x6c, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68,
+ 0x44, 0x65, 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72,
+ 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
}
var (
@@ -499,12 +506,14 @@ var file_v1_cel_service_proto_depIdxs = []int32{
8, // 3: bytebase.v1.BatchDeparseRequest.expressions:type_name -> google.api.expr.v1alpha1.ParsedExpr
0, // 4: bytebase.v1.CelService.Parse:input_type -> bytebase.v1.ParseRequest
1, // 5: bytebase.v1.CelService.BatchParse:input_type -> bytebase.v1.BatchParseRequest
- 5, // 6: bytebase.v1.CelService.BatchDeparse:input_type -> bytebase.v1.BatchDeparseRequest
- 2, // 7: bytebase.v1.CelService.Parse:output_type -> bytebase.v1.ParseResponse
- 3, // 8: bytebase.v1.CelService.BatchParse:output_type -> bytebase.v1.BatchParseResponse
- 7, // 9: bytebase.v1.CelService.BatchDeparse:output_type -> bytebase.v1.BatchDeparseResponse
- 7, // [7:10] is the sub-list for method output_type
- 4, // [4:7] is the sub-list for method input_type
+ 4, // 6: bytebase.v1.CelService.Deparse:input_type -> bytebase.v1.DeparseRequest
+ 5, // 7: bytebase.v1.CelService.BatchDeparse:input_type -> bytebase.v1.BatchDeparseRequest
+ 2, // 8: bytebase.v1.CelService.Parse:output_type -> bytebase.v1.ParseResponse
+ 3, // 9: bytebase.v1.CelService.BatchParse:output_type -> bytebase.v1.BatchParseResponse
+ 6, // 10: bytebase.v1.CelService.Deparse:output_type -> bytebase.v1.DeparseResponse
+ 7, // 11: bytebase.v1.CelService.BatchDeparse:output_type -> bytebase.v1.BatchDeparseResponse
+ 8, // [8:12] is the sub-list for method output_type
+ 4, // [4:8] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
diff --git a/proto/generated-go/v1/cel_service.pb.gw.go b/proto/generated-go/v1/cel_service.pb.gw.go
index ca4fb47ea9..45fe1f002a 100644
--- a/proto/generated-go/v1/cel_service.pb.gw.go
+++ b/proto/generated-go/v1/cel_service.pb.gw.go
@@ -99,6 +99,40 @@ func local_request_CelService_BatchParse_0(ctx context.Context, marshaler runtim
}
+func request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq DeparseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.Deparse(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_CelService_Deparse_0(ctx context.Context, marshaler runtime.Marshaler, server CelServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq DeparseRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.Deparse(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
func request_CelService_BatchDeparse_0(ctx context.Context, marshaler runtime.Marshaler, client CelServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq BatchDeparseRequest
var metadata runtime.ServerMetadata
@@ -189,6 +223,31 @@ func RegisterCelServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux,
})
+ mux.Handle("POST", pattern_CelService_Deparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_CelService_Deparse_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("POST", pattern_CelService_BatchDeparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -299,6 +358,28 @@ func RegisterCelServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
})
+ mux.Handle("POST", pattern_CelService_Deparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.CelService/Deparse", runtime.WithHTTPPathPattern("/v1/cel/deparse"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_CelService_Deparse_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_CelService_Deparse_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("POST", pattern_CelService_BatchDeparse_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -329,6 +410,8 @@ var (
pattern_CelService_BatchParse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "batchParse"}, ""))
+ pattern_CelService_Deparse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "deparse"}, ""))
+
pattern_CelService_BatchDeparse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "cel", "batchDeparse"}, ""))
)
@@ -337,5 +420,7 @@ var (
forward_CelService_BatchParse_0 = runtime.ForwardResponseMessage
+ forward_CelService_Deparse_0 = runtime.ForwardResponseMessage
+
forward_CelService_BatchDeparse_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/generated-go/v1/cel_service_grpc.pb.go b/proto/generated-go/v1/cel_service_grpc.pb.go
index 3f9b608a7e..aef7923c6f 100644
--- a/proto/generated-go/v1/cel_service_grpc.pb.go
+++ b/proto/generated-go/v1/cel_service_grpc.pb.go
@@ -21,6 +21,7 @@ const _ = grpc.SupportPackageIsVersion7
const (
CelService_Parse_FullMethodName = "/bytebase.v1.CelService/Parse"
CelService_BatchParse_FullMethodName = "/bytebase.v1.CelService/BatchParse"
+ CelService_Deparse_FullMethodName = "/bytebase.v1.CelService/Deparse"
CelService_BatchDeparse_FullMethodName = "/bytebase.v1.CelService/BatchDeparse"
)
@@ -30,6 +31,7 @@ const (
type CelServiceClient interface {
Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
BatchParse(ctx context.Context, in *BatchParseRequest, opts ...grpc.CallOption) (*BatchParseResponse, error)
+ Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error)
BatchDeparse(ctx context.Context, in *BatchDeparseRequest, opts ...grpc.CallOption) (*BatchDeparseResponse, error)
}
@@ -59,6 +61,15 @@ func (c *celServiceClient) BatchParse(ctx context.Context, in *BatchParseRequest
return out, nil
}
+func (c *celServiceClient) Deparse(ctx context.Context, in *DeparseRequest, opts ...grpc.CallOption) (*DeparseResponse, error) {
+ out := new(DeparseResponse)
+ err := c.cc.Invoke(ctx, CelService_Deparse_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *celServiceClient) BatchDeparse(ctx context.Context, in *BatchDeparseRequest, opts ...grpc.CallOption) (*BatchDeparseResponse, error) {
out := new(BatchDeparseResponse)
err := c.cc.Invoke(ctx, CelService_BatchDeparse_FullMethodName, in, out, opts...)
@@ -74,6 +85,7 @@ func (c *celServiceClient) BatchDeparse(ctx context.Context, in *BatchDeparseReq
type CelServiceServer interface {
Parse(context.Context, *ParseRequest) (*ParseResponse, error)
BatchParse(context.Context, *BatchParseRequest) (*BatchParseResponse, error)
+ Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error)
BatchDeparse(context.Context, *BatchDeparseRequest) (*BatchDeparseResponse, error)
mustEmbedUnimplementedCelServiceServer()
}
@@ -88,6 +100,9 @@ func (UnimplementedCelServiceServer) Parse(context.Context, *ParseRequest) (*Par
func (UnimplementedCelServiceServer) BatchParse(context.Context, *BatchParseRequest) (*BatchParseResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchParse not implemented")
}
+func (UnimplementedCelServiceServer) Deparse(context.Context, *DeparseRequest) (*DeparseResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method Deparse not implemented")
+}
func (UnimplementedCelServiceServer) BatchDeparse(context.Context, *BatchDeparseRequest) (*BatchDeparseResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BatchDeparse not implemented")
}
@@ -140,6 +155,24 @@ func _CelService_BatchParse_Handler(srv interface{}, ctx context.Context, dec fu
return interceptor(ctx, in, info, handler)
}
+func _CelService_Deparse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeparseRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(CelServiceServer).Deparse(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: CelService_Deparse_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(CelServiceServer).Deparse(ctx, req.(*DeparseRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _CelService_BatchDeparse_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BatchDeparseRequest)
if err := dec(in); err != nil {
@@ -173,6 +206,10 @@ var CelService_ServiceDesc = grpc.ServiceDesc{
MethodName: "BatchParse",
Handler: _CelService_BatchParse_Handler,
},
+ {
+ MethodName: "Deparse",
+ Handler: _CelService_Deparse_Handler,
+ },
{
MethodName: "BatchDeparse",
Handler: _CelService_BatchDeparse_Handler,
diff --git a/proto/v1/cel_service.proto b/proto/v1/cel_service.proto
index 4555eccdfe..592d365479 100644
--- a/proto/v1/cel_service.proto
+++ b/proto/v1/cel_service.proto
@@ -20,6 +20,12 @@ service CelService {
body: "*"
};
}
+ rpc Deparse(DeparseRequest) returns (DeparseResponse) {
+ option (google.api.http) = {
+ post: "/v1/cel/deparse"
+ body: "*"
+ };
+ }
rpc BatchDeparse(BatchDeparseRequest) returns (BatchDeparseResponse) {
option (google.api.http) = {
post: "/v1/cel/batchDeparse"