Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: add composite PKs for worksheet (#19611)
ecmadao8db243722c52
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 6df49523fa..2a59409012 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -8967,6 +8967,12 @@ components:bytebase.v1.CreateWorksheetRequest:type: objectproperties:+ parent:+ type: string+ title: parent+ description: |-+ The parent resource where this worksheet will be created.+ Format: projects/{project}worksheet:title: worksheetdescription: The worksheet to create.@@ -9890,7 +9896,7 @@ components:title: namedescription: |-The name of the worksheet to delete.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}title: DeleteWorksheetRequestadditionalProperties: falsebytebase.v1.DependencyColumn:@@ -10992,7 +10998,7 @@ components:title: namedescription: |-The name of the worksheet to retrieve.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}title: GetWorksheetRequestadditionalProperties: falsebytebase.v1.GridLevel:@@ -16129,6 +16135,12 @@ components:bytebase.v1.SearchWorksheetsRequest:type: objectproperties:+ parent:+ type: string+ title: parent+ description: |-+ The parent resource of the worksheets.+ Format: projects/{project}filter:type: stringtitle: filter@@ -16140,7 +16152,6 @@ components:- creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.- starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.- visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.For example:creator == "users/{email}"@@ -16149,7 +16160,6 @@ components:starred == falsevisibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]visibility == "PRIVATE"- project == "projects/{project resource id}"title: SearchWorksheetsRequestadditionalProperties: falsebytebase.v1.SearchWorksheetsResponse:@@ -18482,7 +18492,7 @@ components:The organizer to update.The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}$ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'updateMask:title: update_mask@@ -18509,7 +18519,7 @@ components:The worksheet to update.The worksheet's `name` field is used to identify the worksheet to update.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}$ref: '#/components/schemas/bytebase.v1.Worksheet'updateMask:title: update_mask@@ -18795,7 +18805,7 @@ components:description: |-The name of the worksheet resource, generated by the server.Canonical parent is project.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}project:type: stringtitle: project@@ -18873,7 +18883,7 @@ components:title: worksheetdescription: |-The name of the worksheet.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}starred:type: booleantitle: starreddiff --git a/backend/api/v1/worksheet_service.go b/backend/api/v1/worksheet_service.goindex 65525a70dd..f3e318df62 100644--- a/backend/api/v1/worksheet_service.go+++ b/backend/api/v1/worksheet_service.go@@ -3,7 +3,6 @@ package v1import ("context""fmt"-"log/slog""connectrpc.com/connect"@@ -48,7 +47,7 @@ func (s *WorksheetService) CreateWorksheet(return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- projectResourceID, err := common.GetProjectID(request.Worksheet.Project)+ projectResourceID, err := common.GetProjectID(request.Parent)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}@@ -104,20 +103,12 @@ func (s *WorksheetService) GetWorksheet(ctx context.Context,req *connect.Request[v1pb.GetWorksheetRequest],) (*connect.Response[v1pb.Worksheet], error) {- request := req.Msg- worksheetUID, err := common.GetWorksheetUID(request.Name)+ projectID, worksheetID, err := common.GetProjectIDWorksheetID(req.Msg.Name)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}- if worksheetUID <= 0 {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid worksheet id %d, must be positive integer", worksheetUID))- }- find := &store.FindWorkSheetMessage{- UID: &worksheetUID,- LoadFull: true,- }- worksheet, err := s.findWorksheet(ctx, find)+ worksheet, err := s.findWorksheet(ctx, projectID, worksheetID, true /* loadFull */)if err != nil {return nil, err}@@ -145,14 +136,14 @@ func (s *WorksheetService) SearchWorksheets(return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- worksheetFind := &store.FindWorkSheetMessage{}- // TODO(zp): It is difficult to find all the worksheets visible to a principal atomically- // without adding a new store layer method, which has two parts:- // 1. creator = principal && visibility in (PROJECT, PUBLIC, PRIVATE)- // 2. creator ! = principal && visibility in (PROJECT, PUBLIC)- // So we don't allow empty filter for now.- if request.Filter == "" {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("filter should not be empty"))+ projectID, err := common.GetProjectID(request.Parent)+ if err != nil {+ return nil, connect.NewError(connect.CodeInvalidArgument, err)+ }++ worksheetFind := &store.FindWorkSheetMessage{+ ProjectIDs: []string{projectID},+ PrincipalEmail: user.Email,}filterQ, err := store.GetListSheetFilter(ctx, s.store, user.Email, request.Filter)@@ -161,7 +152,7 @@ func (s *WorksheetService) SearchWorksheets(}worksheetFind.FilterQ = filterQ- worksheetList, err := s.store.ListWorkSheets(ctx, worksheetFind, user.Email)+ worksheetList, err := s.store.ListWorkSheets(ctx, worksheetFind)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to list worksheets: %v", err))}@@ -200,26 +191,18 @@ func (s *WorksheetService) UpdateWorksheet(return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("worksheet name cannot be empty"))}- worksheetUID, err := common.GetWorksheetUID(request.Worksheet.Name)+ projectID, worksheetID, err := common.GetProjectIDWorksheetID(request.Worksheet.Name)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}- if worksheetUID <= 0 {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid worksheet id %d, must be positive integer", worksheetUID))- }user, ok := GetUserFromContext(ctx)if !ok {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- worksheet, err := s.store.GetWorkSheet(ctx, &store.FindWorkSheetMessage{- UID: &worksheetUID,- }, user.Email)+ worksheet, err := s.findWorksheet(ctx, projectID, worksheetID, false /* loadFull */)if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get worksheet: %v", err))- }- if worksheet == nil {- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("worksheet %q not found", request.Worksheet.Name))+ return nil, err}ok, err = s.canWriteWorksheet(ctx, worksheet)if err != nil {@@ -230,7 +213,7 @@ func (s *WorksheetService) UpdateWorksheet(}worksheetPatch := &store.PatchWorkSheetMessage{- UID: worksheet.UID,+ ResourceID: worksheet.ResourceID,}for _, path := range request.UpdateMask.Paths {switch path {@@ -281,8 +264,10 @@ func (s *WorksheetService) UpdateWorksheet(}worksheet, err = s.store.GetWorkSheet(ctx, &store.FindWorkSheetMessage{- UID: &worksheetUID,- }, user.Email)+ ProjectIDs: []string{worksheet.ProjectID},+ ResourceID: &worksheetID,+ PrincipalEmail: user.Email,+ })if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get worksheet: %v", err))}@@ -298,26 +283,16 @@ func (s *WorksheetService) DeleteWorksheet(ctx context.Context,req *connect.Request[v1pb.DeleteWorksheetRequest],) (*connect.Response[emptypb.Empty], error) {- request := req.Msg- worksheetUID, err := common.GetWorksheetUID(request.Name)+ projectID, worksheetID, err := common.GetProjectIDWorksheetID(req.Msg.Name)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}- user, ok := GetUserFromContext(ctx)- if !ok {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))- }- worksheet, err := s.store.GetWorkSheet(ctx, &store.FindWorkSheetMessage{- UID: &worksheetUID,- }, user.Email)+ worksheet, err := s.findWorksheet(ctx, projectID, worksheetID, false /* loadFull */)if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get worksheet: %v", err))- }- if worksheet == nil {- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("worksheet with id %d not found", worksheetUID))+ return nil, err}- ok, err = s.canWriteWorksheet(ctx, worksheet)+ ok, err := s.canWriteWorksheet(ctx, worksheet)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to check access with error: %v", err))}@@ -325,7 +300,7 @@ func (s *WorksheetService) DeleteWorksheet(return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("cannot write worksheet %s", worksheet.Title))}- if err := s.store.DeleteWorkSheet(ctx, worksheetUID); err != nil {+ if err := s.store.DeleteWorkSheet(ctx, worksheet.ResourceID); err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to delete worksheet: %v", err))}@@ -338,17 +313,12 @@ func (s *WorksheetService) UpdateWorksheetOrganizer(req *connect.Request[v1pb.UpdateWorksheetOrganizerRequest],) (*connect.Response[v1pb.WorksheetOrganizer], error) {request := req.Msg- worksheetUID, err := common.GetWorksheetUID(request.Organizer.Worksheet)+ projectID, worksheetID, err := common.GetProjectIDWorksheetID(request.Organizer.Worksheet)if err != nil {return nil, connect.NewError(connect.CodeInvalidArgument, err)}- if worksheetUID <= 0 {- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid worksheet id %d, must be positive integer", worksheetUID))- }- worksheet, err := s.findWorksheet(ctx, &store.FindWorkSheetMessage{- UID: &worksheetUID,- })+ worksheet, err := s.findWorksheet(ctx, projectID, worksheetID, false /* loadFull */)if err != nil {return nil, err}@@ -365,7 +335,7 @@ func (s *WorksheetService) UpdateWorksheetOrganizer(if !ok {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- worksheetOrganizerUpsert, err := s.store.GetWorksheetOrganizer(ctx, worksheetUID, user.Email)+ worksheetOrganizerUpsert, err := s.store.GetWorksheetOrganizer(ctx, worksheet.ResourceID, user.Email)if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to found worksheet organizer with error: %v", err))}@@ -408,12 +378,17 @@ func (s *WorksheetService) BatchUpdateWorksheetOrganizer(return connect.NewResponse(response), nil}-func (s *WorksheetService) findWorksheet(ctx context.Context, find *store.FindWorkSheetMessage) (*store.WorkSheetMessage, error) {+func (s *WorksheetService) findWorksheet(ctx context.Context, projectID string, worksheetID string, loadFull bool) (*store.WorkSheetMessage, error) {user, ok := GetUserFromContext(ctx)if !ok {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))}- worksheet, err := s.store.GetWorkSheet(ctx, find, user.Email)+ worksheet, err := s.store.GetWorkSheet(ctx, &store.FindWorkSheetMessage{+ ProjectIDs: []string{projectID},+ ResourceID: &worksheetID,+ LoadFull: loadFull,+ PrincipalEmail: user.Email,+ })if err != nil {return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get worksheet: %v", err))}@@ -530,7 +505,7 @@ func convertToAPIWorksheetMessage(worksheet *store.WorkSheetMessage) *v1pb.Works// Keep VISIBILITY_UNSPECIFIED}return &v1pb.Worksheet{- Name: fmt.Sprintf("%s%d", common.WorksheetIDPrefix, worksheet.UID),+ Name: common.FormatWorksheet(worksheet.ProjectID, worksheet.ResourceID),Project: common.FormatProject(worksheet.ProjectID),Database: databaseParent,Title: worksheet.Title,diff --git a/backend/common/resource_name.go b/backend/common/resource_name.goindex 40d468345d..249ce5094a 100644--- a/backend/common/resource_name.go+++ b/backend/common/resource_name.go@@ -433,17 +433,20 @@ func GetProjectResourceIDSheetSha256(name string) (string, string, error) {return tokens[0], tokens[1], nil}-// GetWorksheetUID returns the worksheet UID from a resource name.-func GetWorksheetUID(name string) (int, error) {- tokens, err := GetNameParentTokens(name, WorksheetIDPrefix)+// GetProjectIDWorksheetID returns the project ID and worksheet ID (resource_id) from a resource name.+// Format: projects/{project}/worksheets/{worksheet}+func GetProjectIDWorksheetID(name string) (string, string, error) {+ tokens, err := GetNameParentTokens(name, ProjectNamePrefix, WorksheetIDPrefix)if err != nil {- return 0, err- }- sheetUID, err := strconv.Atoi(tokens[0])- if err != nil {- return 0, errors.Wrapf(err, "failed to convert worksheet uid %q to int", tokens[1])+ return "", "", err}- return sheetUID, nil+ return tokens[0], tokens[1], nil+}++// FormatWorksheet formats a worksheet resource name.+// Format: projects/{project}/worksheets/{worksheet}+func FormatWorksheet(projectID, worksheetID string) string {+ return fmt.Sprintf("%s/%s%s", FormatProject(projectID), WorksheetIDPrefix, worksheetID)}// GetReviewConfigID returns the review config id from a resource name.diff --git a/backend/generated-go/v1/worksheet_service.pb.go b/backend/generated-go/v1/worksheet_service.pb.goindex d121904f04..3f41d9de7a 100644--- a/backend/generated-go/v1/worksheet_service.pb.go+++ b/backend/generated-go/v1/worksheet_service.pb.go@@ -83,8 +83,11 @@ func (Worksheet_Visibility) EnumDescriptor() ([]byte, []int) {type CreateWorksheetRequest struct {state protoimpl.MessageState `protogen:"open.v1"`+ // The parent resource where this worksheet will be created.+ // Format: projects/{project}+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`// The worksheet to create.- Worksheet *Worksheet `protobuf:"bytes,1,opt,name=worksheet,proto3" json:"worksheet,omitempty"`+ Worksheet *Worksheet `protobuf:"bytes,2,opt,name=worksheet,proto3" json:"worksheet,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -119,6 +122,13 @@ func (*CreateWorksheetRequest) Descriptor() ([]byte, []int) {return file_v1_worksheet_service_proto_rawDescGZIP(), []int{0}}+func (x *CreateWorksheetRequest) GetParent() string {+ if x != nil {+ return x.Parent+ }+ return ""+}+func (x *CreateWorksheetRequest) GetWorksheet() *Worksheet {if x != nil {return x.Worksheet@@ -129,7 +139,7 @@ func (x *CreateWorksheetRequest) GetWorksheet() *Worksheet {type GetWorksheetRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the worksheet to retrieve.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -177,7 +187,7 @@ type UpdateWorksheetRequest struct {// The worksheet to update.//// The worksheet's `name` field is used to identify the worksheet to update.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Worksheet *Worksheet `protobuf:"bytes,1,opt,name=worksheet,proto3" json:"worksheet,omitempty"`// The list of fields to be updated.// Fields are specified relative to the worksheet.@@ -329,7 +339,7 @@ type UpdateWorksheetOrganizerRequest struct {// The organizer to update.//// The organizer's `worksheet` field is used to identify the worksheet.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Organizer *WorksheetOrganizer `protobuf:"bytes,1,opt,name=organizer,proto3" json:"organizer,omitempty"`// The list of fields to be updated.// Fields are specified relative to the worksheet organizer.@@ -397,7 +407,7 @@ func (x *UpdateWorksheetOrganizerRequest) GetAllowMissing() bool {type WorksheetOrganizer struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the worksheet.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Worksheet string `protobuf:"bytes,1,opt,name=worksheet,proto3" json:"worksheet,omitempty"`// starred means if the worksheet is starred.Starred bool `protobuf:"varint,2,opt,name=starred,proto3" json:"starred,omitempty"`@@ -460,7 +470,7 @@ func (x *WorksheetOrganizer) GetFolders() []string {type DeleteWorksheetRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the worksheet to delete.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache@@ -505,6 +515,9 @@ func (x *DeleteWorksheetRequest) GetName() string {type SearchWorksheetsRequest struct {state protoimpl.MessageState `protogen:"open.v1"`+ // The parent resource of the worksheets.+ // Format: projects/{project}+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`// To filter the search result.// The syntax and semantics of CEL are documented at https://github.com/google/cel-spec//@@ -512,7 +525,6 @@ type SearchWorksheetsRequest struct {// - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.// - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.// - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.- // - project: the project full name in "projects/{id}" format, support "==" operator.//// For example:// creator == "users/{email}"@@ -521,8 +533,7 @@ type SearchWorksheetsRequest struct {// starred == false// visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]// visibility == "PRIVATE"- // project == "projects/{project resource id}"- Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`+ Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -557,6 +568,13 @@ func (*SearchWorksheetsRequest) Descriptor() ([]byte, []int) {return file_v1_worksheet_service_proto_rawDescGZIP(), []int{8}}+func (x *SearchWorksheetsRequest) GetParent() string {+ if x != nil {+ return x.Parent+ }+ return ""+}+func (x *SearchWorksheetsRequest) GetFilter() string {if x != nil {return x.Filter@@ -613,7 +631,7 @@ type Worksheet struct {state protoimpl.MessageState `protogen:"open.v1"`// The name of the worksheet resource, generated by the server.// Canonical parent is project.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The project resource name.// Format: projects/{project}@@ -763,9 +781,10 @@ var File_v1_worksheet_service_proto protoreflect.FileDescriptorconst file_v1_worksheet_service_proto_rawDesc = "" +"\n" +- "\x1av1/worksheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"S\n" +- "\x16CreateWorksheetRequest\x129\n" +- "\tworksheet\x18\x01 \x01(\v2\x16.bytebase.v1.WorksheetB\x03\xe0A\x02R\tworksheet\".\n" ++ "\x1av1/worksheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"p\n" ++ "\x16CreateWorksheetRequest\x12\x1b\n" ++ "\x06parent\x18\x01 \x01(\tB\x03\xe0A\x02R\x06parent\x129\n" ++ "\tworksheet\x18\x02 \x01(\v2\x16.bytebase.v1.WorksheetB\x03\xe0A\x02R\tworksheet\".\n" +"\x13GetWorksheetRequest\x12\x17\n" +"\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\x90\x01\n" +"\x16UpdateWorksheetRequest\x129\n" +@@ -786,16 +805,17 @@ const file_v1_worksheet_service_proto_rawDesc = "" +"\astarred\x18\x02 \x01(\bR\astarred\x12\x18\n" +"\afolders\x18\x03 \x03(\tR\afolders\"1\n" +"\x16DeleteWorksheetRequest\x12\x17\n" +- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"1\n" +- "\x17SearchWorksheetsRequest\x12\x16\n" +- "\x06filter\x18\x01 \x01(\tR\x06filter\"R\n" ++ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"N\n" ++ "\x17SearchWorksheetsRequest\x12\x1b\n" ++ "\x06parent\x18\x01 \x01(\tB\x03\xe0A\x02R\x06parent\x12\x16\n" ++ "\x06filter\x18\x02 \x01(\tR\x06filter\"R\n" +"\x18SearchWorksheetsResponse\x126\n" +"\n" +"worksheets\x18\x01 \x03(\v2\x16.bytebase.v1.WorksheetR\n" +"worksheets\"\xd1\x04\n" +"\tWorksheet\x12\x1a\n" +"\x04name\x18\x01 \x01(\tB\x06\xe0A\x02\xe0A\x05R\x04name\x12\x1d\n" +- "\aproject\x18\x02 \x01(\tB\x03\xe0A\x02R\aproject\x12\x1a\n" ++ "\aproject\x18\x02 \x01(\tB\x03\xe0A\x03R\aproject\x12\x1a\n" +"\bdatabase\x18\x03 \x01(\tR\bdatabase\x12!\n" +"\x05title\x18\x04 \x01(\tB\v\xe0A\x02\xbaH\x05r\x03\x18\xc8\x01R\x05title\x12\x1d\n" +"\acreator\x18\x05 \x01(\tB\x03\xe0A\x03R\acreator\x12@\n" +@@ -816,15 +836,15 @@ const file_v1_worksheet_service_proto_rawDesc = "" +"\x16VISIBILITY_UNSPECIFIED\x10\x00\x12\x10\n" +"\fPROJECT_READ\x10\x01\x12\x11\n" +"\rPROJECT_WRITE\x10\x02\x12\v\n" +- "\aPRIVATE\x10\x032\xbe\b\n" +- "\x10WorksheetService\x12\x81\x01\n" +- "\x0fCreateWorksheet\x12#.bytebase.v1.CreateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"1\xdaA\tworksheet\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1b:\tworksheet\"\x0e/v1/worksheets\x12t\n" +- "\fGetWorksheet\x12 .bytebase.v1.GetWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"*\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02\x19\x12\x17/v1/{name=worksheets/*}\x12\x85\x01\n" +- "\x10SearchWorksheets\x12$.bytebase.v1.SearchWorksheetsRequest\x1a%.bytebase.v1.SearchWorksheetsResponse\"$\x90\xea0\x02\x82\xd3\xe4\x93\x02\x1a:\x01*\"\x15/v1/worksheets:search\x12\xa0\x01\n" +- "\x0fUpdateWorksheet\x12#.bytebase.v1.UpdateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"P\xdaA\x15worksheet,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x02.:\tworksheet2!/v1/{worksheet.name=worksheets/*}\x12\xca\x01\n" +- "\x18UpdateWorksheetOrganizer\x12,.bytebase.v1.UpdateWorksheetOrganizerRequest\x1a\x1f.bytebase.v1.WorksheetOrganizer\"_\xdaA\x15organizer,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x02=:\torganizer20/v1/{organizer.worksheet=worksheets/*}/organizer\x12\xbb\x01\n" +- "\x1dBatchUpdateWorksheetOrganizer\x121.bytebase.v1.BatchUpdateWorksheetOrganizerRequest\x1a2.bytebase.v1.BatchUpdateWorksheetOrganizerResponse\"3\x90\xea0\x02\x82\xd3\xe4\x93\x02):\x01*2$/v1/worksheets/organizer:batchUpdate\x12z\n" +- "\x0fDeleteWorksheet\x12#.bytebase.v1.DeleteWorksheetRequest\x1a\x16.google.protobuf.Empty\"*\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02\x19*\x17/v1/{name=worksheets/*}B\xab\x01\n" ++ "\aPRIVATE\x10\x032\xa3\t\n" ++ "\x10WorksheetService\x12\x9c\x01\n" ++ "\x0fCreateWorksheet\x12#.bytebase.v1.CreateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"L\xdaA\x10parent,worksheet\x90\xea0\x02\x82\xd3\xe4\x93\x02/:\tworksheet\"\"/v1/{parent=projects/*}/worksheets\x12\x7f\n" ++ "\fGetWorksheet\x12 .bytebase.v1.GetWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"5\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02$\x12\"/v1/{name=projects/*/worksheets/*}\x12\xa2\x01\n" ++ "\x10SearchWorksheets\x12$.bytebase.v1.SearchWorksheetsRequest\x1a%.bytebase.v1.SearchWorksheetsResponse\"A\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02.:\x01*\")/v1/{parent=projects/*}/worksheets:search\x12\xab\x01\n" ++ "\x0fUpdateWorksheet\x12#.bytebase.v1.UpdateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"[\xdaA\x15worksheet,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x029:\tworksheet2,/v1/{worksheet.name=projects/*/worksheets/*}\x12\xd5\x01\n" ++ "\x18UpdateWorksheetOrganizer\x12,.bytebase.v1.UpdateWorksheetOrganizerRequest\x1a\x1f.bytebase.v1.WorksheetOrganizer\"j\xdaA\x15organizer,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x02H:\torganizer2;/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer\x12\xbb\x01\n" ++ "\x1dBatchUpdateWorksheetOrganizer\x121.bytebase.v1.BatchUpdateWorksheetOrganizerRequest\x1a2.bytebase.v1.BatchUpdateWorksheetOrganizerResponse\"3\x90\xea0\x02\x82\xd3\xe4\x93\x02):\x01*2$/v1/worksheets/organizer:batchUpdate\x12\x85\x01\n" ++ "\x0fDeleteWorksheet\x12#.bytebase.v1.DeleteWorksheetRequest\x1a\x16.google.protobuf.Empty\"5\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02$*\"/v1/{name=projects/*/worksheets/*}B\xab\x01\n" +"\x0fcom.bytebase.v1B\x15WorksheetServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"var (diff --git a/backend/generated-go/v1/worksheet_service.pb.gw.go b/backend/generated-go/v1/worksheet_service.pb.gw.goindex 7fcbf4f5ab..7b0bf221b5 100644--- a/backend/generated-go/v1/worksheet_service.pb.gw.go+++ b/backend/generated-go/v1/worksheet_service.pb.gw.go@@ -39,6 +39,7 @@ func request_WorksheetService_CreateWorksheet_0(ctx context.Context, marshaler rvar (protoReq CreateWorksheetRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Worksheet); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)@@ -46,6 +47,14 @@ func request_WorksheetService_CreateWorksheet_0(ctx context.Context, marshaler rif req.Body != nil {_, _ = io.Copy(io.Discard, req.Body)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }msg, err := client.CreateWorksheet(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))return msg, metadata, err}@@ -54,10 +63,19 @@ func local_request_WorksheetService_CreateWorksheet_0(ctx context.Context, marshvar (protoReq CreateWorksheetRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Worksheet); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }msg, err := server.CreateWorksheet(ctx, &protoReq)return msg, metadata, err}@@ -105,6 +123,7 @@ func request_WorksheetService_SearchWorksheets_0(ctx context.Context, marshalervar (protoReq SearchWorksheetsRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)@@ -112,6 +131,14 @@ func request_WorksheetService_SearchWorksheets_0(ctx context.Context, marshalerif req.Body != nil {_, _ = io.Copy(io.Discard, req.Body)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }msg, err := client.SearchWorksheets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))return msg, metadata, err}@@ -120,10 +147,19 @@ func local_request_WorksheetService_SearchWorksheets_0(ctx context.Context, marsvar (protoReq SearchWorksheetsRequestmetadata runtime.ServerMetadata+ err error)if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}+ val, ok := pathParams["parent"]+ if !ok {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")+ }+ protoReq.Parent, err = runtime.String(val)+ if err != nil {+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)+ }msg, err := server.SearchWorksheets(ctx, &protoReq)return msg, metadata, err}@@ -368,7 +404,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/CreateWorksheet", runtime.WithHTTPPathPattern("/v1/worksheets"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/CreateWorksheet", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -388,7 +424,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/GetWorksheet", runtime.WithHTTPPathPattern("/v1/{name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/GetWorksheet", runtime.WithHTTPPathPattern("/v1/{name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -408,7 +444,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/SearchWorksheets", runtime.WithHTTPPathPattern("/v1/worksheets:search"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/SearchWorksheets", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets:search"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -428,7 +464,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheet", runtime.WithHTTPPathPattern("/v1/{worksheet.name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheet", runtime.WithHTTPPathPattern("/v1/{worksheet.name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -448,7 +484,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.worksheet=worksheets/*}/organizer"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -488,7 +524,7 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Servar stream runtime.ServerTransportStreamctx = grpc.NewContextWithServerTransportStream(ctx, &stream)inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/DeleteWorksheet", runtime.WithHTTPPathPattern("/v1/{name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/DeleteWorksheet", runtime.WithHTTPPathPattern("/v1/{name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -546,7 +582,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/CreateWorksheet", runtime.WithHTTPPathPattern("/v1/worksheets"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/CreateWorksheet", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -563,7 +599,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/GetWorksheet", runtime.WithHTTPPathPattern("/v1/{name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/GetWorksheet", runtime.WithHTTPPathPattern("/v1/{name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -580,7 +616,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/SearchWorksheets", runtime.WithHTTPPathPattern("/v1/worksheets:search"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/SearchWorksheets", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets:search"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -597,7 +633,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheet", runtime.WithHTTPPathPattern("/v1/{worksheet.name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheet", runtime.WithHTTPPathPattern("/v1/{worksheet.name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -614,7 +650,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.worksheet=worksheets/*}/organizer"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/UpdateWorksheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -648,7 +684,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Serctx, cancel := context.WithCancel(req.Context())defer cancel()inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)- annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/DeleteWorksheet", runtime.WithHTTPPathPattern("/v1/{name=worksheets/*}"))+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/DeleteWorksheet", runtime.WithHTTPPathPattern("/v1/{name=projects/*/worksheets/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -665,13 +701,13 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Ser}var (- pattern_WorksheetService_CreateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "worksheets"}, ""))- pattern_WorksheetService_GetWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "worksheets", "name"}, ""))- pattern_WorksheetService_SearchWorksheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "worksheets"}, "search"))- pattern_WorksheetService_UpdateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "worksheets", "worksheet.name"}, ""))- pattern_WorksheetService_UpdateWorksheetOrganizer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "worksheets", "organizer.worksheet", "organizer"}, ""))+ pattern_WorksheetService_CreateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "worksheets"}, ""))+ pattern_WorksheetService_GetWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "worksheets", "name"}, ""))+ pattern_WorksheetService_SearchWorksheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "worksheets"}, "search"))+ pattern_WorksheetService_UpdateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "worksheets", "worksheet.name"}, ""))+ pattern_WorksheetService_UpdateWorksheetOrganizer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "projects", "worksheets", "organizer.worksheet", "organizer"}, ""))pattern_WorksheetService_BatchUpdateWorksheetOrganizer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "worksheets", "organizer"}, "batchUpdate"))- pattern_WorksheetService_DeleteWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "worksheets", "name"}, ""))+ pattern_WorksheetService_DeleteWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "worksheets", "name"}, "")))var (diff --git a/backend/generated-go/v1/worksheet_service_equal.pb.go b/backend/generated-go/v1/worksheet_service_equal.pb.goindex 96a6140c0d..7eadb19fe5 100644--- a/backend/generated-go/v1/worksheet_service_equal.pb.go+++ b/backend/generated-go/v1/worksheet_service_equal.pb.go@@ -15,6 +15,9 @@ func (x *CreateWorksheetRequest) Equal(y *CreateWorksheetRequest) bool {if x == nil || y == nil {return x == nil && y == nil}+ if x.Parent != y.Parent {+ return false+ }if !x.Worksheet.Equal(y.Worksheet) {return false}@@ -157,6 +160,9 @@ func (x *SearchWorksheetsRequest) Equal(y *SearchWorksheetsRequest) bool {if x == nil || y == nil {return x == nil && y == nil}+ if x.Parent != y.Parent {+ return false+ }if x.Filter != y.Filter {return false}diff --git a/backend/migrator/migration/3.17/0003##worksheet_composite_pk.sql b/backend/migrator/migration/3.17/0003##worksheet_composite_pk.sqlnew file mode 100644index 0000000000..b080190314--- /dev/null+++ b/backend/migrator/migration/3.17/0003##worksheet_composite_pk.sql@@ -0,0 +1,44 @@+-- Phase A: Drop old FKs and PKs+ALTER TABLE worksheet_organizer DROP CONSTRAINT IF EXISTS worksheet_organizer_worksheet_id_fkey;+ALTER TABLE worksheet_organizer DROP CONSTRAINT IF EXISTS worksheet_organizer_worksheet_fkey;+ALTER TABLE worksheet_organizer DROP CONSTRAINT IF EXISTS worksheet_organizer_pkey;+DROP INDEX IF EXISTS idx_worksheet_unique_resource_id;++-- Phase B: Change worksheet PK to resource_id+DO $$ BEGIN+ IF NOT EXISTS (+ SELECT 1 FROM pg_constraint+ WHERE conname = 'worksheet_pkey' AND conrelid = 'worksheet'::regclass+ AND array_length(conkey, 1) = 1+ AND conkey[1] = (SELECT attnum FROM pg_attribute WHERE attrelid = 'worksheet'::regclass AND attname = 'resource_id')+ ) THEN+ ALTER TABLE worksheet DROP CONSTRAINT IF EXISTS worksheet_pkey;+ ALTER TABLE worksheet ADD PRIMARY KEY (resource_id);+ END IF;+END $$;++-- Phase C: Convert worksheet_organizer to use worksheet.resource_id+ALTER TABLE worksheet_organizer ADD COLUMN IF NOT EXISTS worksheet text;+DO $$ BEGIN+ IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'worksheet_organizer' AND column_name = 'worksheet_id') THEN+ UPDATE worksheet_organizer wo SET worksheet = w.resource_id FROM worksheet w WHERE wo.worksheet_id = w.id AND wo.worksheet IS NULL;+ DELETE FROM worksheet_organizer WHERE worksheet IS NULL;+ ALTER TABLE worksheet_organizer DROP COLUMN worksheet_id;+ END IF;+END $$;+ALTER TABLE worksheet_organizer DROP COLUMN IF EXISTS project;+ALTER TABLE worksheet_organizer ALTER COLUMN worksheet SET NOT NULL;+DO $$ BEGIN+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'worksheet_organizer_pkey' AND conrelid = 'worksheet_organizer'::regclass) THEN+ ALTER TABLE worksheet_organizer ADD PRIMARY KEY (worksheet, principal);+ END IF;+END $$;++-- Phase D: Indexes and FK+CREATE INDEX IF NOT EXISTS idx_worksheet_project ON worksheet(project);+DO $$ BEGIN+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'worksheet_organizer_worksheet_fkey' AND conrelid = 'worksheet_organizer'::regclass) THEN+ ALTER TABLE worksheet_organizer ADD CONSTRAINT worksheet_organizer_worksheet_fkey+ FOREIGN KEY (worksheet) REFERENCES worksheet(resource_id) ON DELETE CASCADE;+ END IF;+END $$;diff --git a/backend/migrator/migration/LATEST.sql b/backend/migrator/migration/LATEST.sqlindex dba5e9ee62..6a00bf6ff9 100644--- a/backend/migrator/migration/LATEST.sql+++ b/backend/migrator/migration/LATEST.sql@@ -394,7 +394,7 @@ ALTER SEQUENCE query_history_id_seq RESTART WITH 101;-- worksheet table stores worksheets in SQL Editor.CREATE TABLE worksheet (- id serial PRIMARY KEY,+ id serial,resource_id text NOT NULL DEFAULT gen_random_uuid()::text,creator text NOT NULL,created_at timestamptz NOT NULL DEFAULT now(),@@ -407,20 +407,21 @@ CREATE TABLE worksheet (-- visibility: PROJECT_READ, PROJECT_WRITE, PRIVATE-- Enum: Worksheet.Visibility (proto/v1/v1/worksheet_service.proto)visibility text NOT NULL,- payload jsonb NOT NULL DEFAULT '{}'+ payload jsonb NOT NULL DEFAULT '{}',+ PRIMARY KEY (resource_id));+CREATE INDEX idx_worksheet_project ON worksheet(project);CREATE INDEX idx_worksheet_creator_project ON worksheet(creator, project);-CREATE UNIQUE INDEX idx_worksheet_unique_resource_id ON worksheet(resource_id);ALTER SEQUENCE worksheet_id_seq RESTART WITH 101;-- worksheet_organizer table stores the sheet status for a principal.CREATE TABLE worksheet_organizer (- worksheet_id integer NOT NULL REFERENCES worksheet(id) ON DELETE CASCADE,+ worksheet text NOT NULL REFERENCES worksheet(resource_id) ON DELETE CASCADE,principal text NOT NULL,payload jsonb NOT NULL DEFAULT '{}',- PRIMARY KEY (worksheet_id, principal)+ PRIMARY KEY (worksheet, principal));CREATE INDEX idx_worksheet_organizer_principal ON worksheet_organizer(principal);diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex ab92f6fa9f..0eaf9bec0e 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -15,8 +15,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.17.2"), *files[len(files)-1].version)- require.Equal(t, "migration/3.17/0002##add_project_to_issue_chain.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.17.3"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.17/0003##worksheet_composite_pk.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/store/worksheet.go b/backend/store/worksheet.goindex 067e9fe31a..63df565e01 100644--- a/backend/store/worksheet.go+++ b/backend/store/worksheet.go@@ -32,7 +32,8 @@ const (// WorkSheetMessage is the message for a sheet.type WorkSheetMessage struct {- ProjectID string+ ProjectID string+ ResourceID string// The DatabaseUID is optional.// If not NULL, the sheet ProjectID should always be equal to the id of the database related project.// A project must remove all linked sheets for a particular database before that database can be transferred to a different project.@@ -46,7 +47,6 @@ type WorkSheetMessage struct {Visibility WorkSheetVisibility// Output only fields- UID intSize int64CreatedAt time.TimeUpdatedAt time.Time@@ -56,7 +56,11 @@ type WorkSheetMessage struct {// FindWorkSheetMessage is the API message for finding sheets.type FindWorkSheetMessage struct {- UID *int+ // Required field+ ProjectIDs []string+ PrincipalEmail string++ ResourceID *string// LoadFull is used if we want to load the full sheet.LoadFull bool@@ -66,7 +70,7 @@ type FindWorkSheetMessage struct {// PatchWorkSheetMessage is the message to patch a sheet.type PatchWorkSheetMessage struct {- UID int+ ResourceID stringTitle *stringStatement *stringVisibility *string@@ -75,8 +79,8 @@ type PatchWorkSheetMessage struct {}// GetWorkSheet gets a sheet.-func (s *Store) GetWorkSheet(ctx context.Context, find *FindWorkSheetMessage, currentPrincipal string) (*WorkSheetMessage, error) {- sheets, err := s.ListWorkSheets(ctx, find, currentPrincipal)+func (s *Store) GetWorkSheet(ctx context.Context, find *FindWorkSheetMessage) (*WorkSheetMessage, error) {+ sheets, err := s.ListWorkSheets(ctx, find)if err != nil {return nil, err}@@ -92,7 +96,10 @@ func (s *Store) GetWorkSheet(ctx context.Context, find *FindWorkSheetMessage, cu}// ListWorkSheets returns a list of sheets.-func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage, currentPrincipal string) ([]*WorkSheetMessage, error) {+func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage) ([]*WorkSheetMessage, error) {+ if len(find.ProjectIDs) == 0 {+ return nil, errors.Errorf("empty project filter")+ }statementField := fmt.Sprintf("LEFT(worksheet.statement, %d)", common.MaxSheetSize)if find.LoadFull {statementField = "worksheet.statement"@@ -100,7 +107,7 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage,q := qb.Q().Space(fmt.Sprintf(`SELECT- worksheet.id,+ worksheet.resource_id,worksheet.creator,worksheet.created_at,worksheet.updated_at,@@ -113,15 +120,21 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage,OCTET_LENGTH(worksheet.statement),COALESCE(worksheet_organizer.payload, '{}')FROM worksheet- LEFT JOIN worksheet_organizer ON worksheet_organizer.worksheet_id = worksheet.id AND worksheet_organizer.principal = '%s'- WHERE TRUE`, statementField, currentPrincipal))+ LEFT JOIN worksheet_organizer ON worksheet_organizer.worksheet = worksheet.resource_id AND worksheet_organizer.principal = '%s'+ WHERE TRUE`, statementField, find.PrincipalEmail))++ if len(find.ProjectIDs) == 1 {+ q.And("worksheet.project = ?", find.ProjectIDs[0])+ } else {+ q.And("worksheet.project = ANY(?)", find.ProjectIDs)+ }if filterQ := find.FilterQ; filterQ != nil {q.And("?", filterQ)}- if v := find.UID; v != nil {- q.And("worksheet.id = ?", *v)+ if v := find.ResourceID; v != nil {+ q.And("worksheet.resource_id = ?", *v)}query, args, err := q.ToSQL()@@ -141,7 +154,7 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage,var instanceID, databaseName sql.NullStringvar payloadBytes []byteif err := rows.Scan(- &sheet.UID,+ &sheet.ResourceID,&sheet.Creator,&sheet.CreatedAt,&sheet.UpdatedAt,@@ -193,7 +206,7 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (payload)VALUES (?, ?, ?, ?, ?, ?, ?, '{}')- RETURNING id, created_at, updated_at, OCTET_LENGTH(statement)+ RETURNING resource_id, created_at, updated_at, OCTET_LENGTH(statement)`, create.Creator, create.ProjectID, create.InstanceID, create.DatabaseName, create.Title, create.Statement, create.Visibility)query, args, err := q.ToSQL()@@ -202,7 +215,7 @@ func (s *Store) CreateWorkSheet(ctx context.Context, create *WorkSheetMessage) (}if err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(- &create.UID,+ &create.ResourceID,&create.CreatedAt,&create.UpdatedAt,&create.Size,@@ -244,7 +257,7 @@ func (s *Store) PatchWorkSheet(ctx context.Context, patch *PatchWorkSheetMessage}}- query, args, err := qb.Q().Space("UPDATE worksheet SET ? WHERE id = ?", set, patch.UID).ToSQL()+ query, args, err := qb.Q().Space("UPDATE worksheet SET ? WHERE resource_id = ?", set, patch.ResourceID).ToSQL()if err != nil {return errors.Wrapf(err, "failed to build sql")}@@ -254,50 +267,34 @@ func (s *Store) PatchWorkSheet(ctx context.Context, patch *PatchWorkSheetMessagereturn nil}-// DeleteWorkSheet deletes an existing sheet by ID.-func (s *Store) DeleteWorkSheet(ctx context.Context, sheetUID int) error {- tx, err := s.GetDB().BeginTx(ctx, nil)- if err != nil {- return err- }- defer tx.Rollback()-- q1 := qb.Q().Space(`DELETE FROM worksheet_organizer WHERE worksheet_id = ?`, sheetUID)- query1, args1, err := q1.ToSQL()- if err != nil {- return errors.Wrapf(err, "failed to build sql")- }- if _, err := tx.ExecContext(ctx, query1, args1...); err != nil {- return err- }-- q2 := qb.Q().Space(`DELETE FROM worksheet WHERE id = ?`, sheetUID)- query2, args2, err := q2.ToSQL()+// DeleteWorkSheet deletes an existing sheet by resource ID.+// The worksheet_organizer rows are cascade-deleted via FK on worksheet(resource_id).+func (s *Store) DeleteWorkSheet(ctx context.Context, resourceID string) error {+ q := qb.Q().Space(`DELETE FROM worksheet WHERE resource_id = ?`, resourceID)+ query, args, err := q.ToSQL()if err != nil {return errors.Wrapf(err, "failed to build sql")}- if _, err := tx.ExecContext(ctx, query2, args2...); err != nil {+ if _, err := s.GetDB().ExecContext(ctx, query, args...); err != nil {return err}-- return tx.Commit()+ return nil}// WorksheetOrganizerMessage is the store message for worksheet organizer.type WorksheetOrganizerMessage struct {- // Related fields- WorksheetUID int- Principal string- Payload *storepb.WorkSheetOrganizerPayload+ WorksheetResourceID string+ Principal string+ Payload *storepb.WorkSheetOrganizerPayload}-func (s *Store) GetWorksheetOrganizer(ctx context.Context, worksheetUID int, principal string) (*WorksheetOrganizerMessage, error) {+func (s *Store) GetWorksheetOrganizer(ctx context.Context, worksheetResourceID string, principal string) (*WorksheetOrganizerMessage, error) {q := qb.Q().Space(`SELECTpayloadFROM worksheet_organizer- WHERE worksheet_id = ? AND principal = ?- `, worksheetUID, principal)+ WHERE worksheet = ? AND principal = ?+ `, worksheetResourceID, principal)query, args, err := q.ToSQL()if err != nil {@@ -305,9 +302,9 @@ func (s *Store) GetWorksheetOrganizer(ctx context.Context, worksheetUID int, pri}worksheetOrganizer := WorksheetOrganizerMessage{- WorksheetUID: worksheetUID,- Principal: principal,- Payload: &storepb.WorkSheetOrganizerPayload{},+ WorksheetResourceID: worksheetResourceID,+ Principal: principal,+ Payload: &storepb.WorkSheetOrganizerPayload{},}var payload []byteif err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(@@ -335,18 +332,18 @@ func (s *Store) UpsertWorksheetOrganizer(ctx context.Context, patch *WorksheetOr}q := qb.Q().Space(`INSERT INTO worksheet_organizer (- worksheet_id,+ worksheet,principal,payload)VALUES (?, ?, ?)- ON CONFLICT(worksheet_id, principal) DO UPDATE SET+ ON CONFLICT(worksheet, principal) DO UPDATE SETpayload = EXCLUDED.payloadRETURNING- worksheet_id,+ worksheet,principal,payload- `, patch.WorksheetUID, patch.Principal, payloadStr)+ `, patch.WorksheetResourceID, patch.Principal, payloadStr)query, args, err := q.ToSQL()if err != nil {@@ -356,7 +353,7 @@ func (s *Store) UpsertWorksheetOrganizer(ctx context.Context, patch *WorksheetOrvar worksheetOrganizer WorksheetOrganizerMessagevar payload []byteif err := s.GetDB().QueryRowContext(ctx, query, args...).Scan(- &worksheetOrganizer.WorksheetUID,+ &worksheetOrganizer.WorksheetResourceID,&worksheetOrganizer.Principal,&payload,); err != nil {@@ -395,8 +392,6 @@ func GetListSheetFilter(ctx context.Context, s *Store, caller string, filter strif creatorEmail == "" {return "", errors.New("invalid empty creator identifier")}- // Assuming we trust the email or validate existence elsewhere, or we can keep GetUserByEmail if strict validation needed.- // For now, let's keep validation but return email.user, err := s.GetUserByEmail(ctx, creatorEmail)if err != nil {return "", errors.Errorf("failed to get user: %v", err)@@ -417,18 +412,12 @@ func GetListSheetFilter(ctx context.Context, s *Store, caller string, filter strreturn qb.Q().Space("worksheet.creator = ?", userID), nilcase "starred":if starred, ok := value.(bool); ok {- return qb.Q().Space("worksheet.id IN (SELECT worksheet_id FROM worksheet_organizer WHERE principal = ? AND (payload->>'starred')::boolean = ?)", caller, starred), nil+ return qb.Q().Space("worksheet.resource_id IN (SELECT worksheet FROM worksheet_organizer WHERE principal = ? AND (payload->>'starred')::boolean = ?)", caller, starred), nil}return qb.Q().Space("TRUE"), nilcase "visibility":visibility := WorkSheetVisibility(value.(string))return qb.Q().Space("worksheet.visibility = ?", visibility), nil- case "project":- projectID, err := common.GetProjectID(value.(string))- if err != nil {- return nil, errors.Errorf("invalid project filter %q", value)- }- return qb.Q().Space("worksheet.project = ?", projectID), nildefault:return nil, errors.Errorf("unsupport variable %q", variable)}diff --git a/docs/plans/saas/01.prepare-for-saas.md b/docs/plans/saas/01.prepare-for-saas.mdindex ee0739b3bf..bd4b942280 100644--- a/docs/plans/saas/01.prepare-for-saas.md+++ b/docs/plans/saas/01.prepare-for-saas.md@@ -267,14 +267,14 @@ For SaaS, tables need different ID strategies depending on their scope:| `project_webhook` | `serial` | Project | Drop `id`, use `resource_id` as PK (no composite PK needed — `id` is unused, all lookups use `resource_id`) || `plan` | `bigserial` | Project | Per-project auto-increment id || `issue` | `serial` | Project | Per-project auto-increment id |-| `worksheet` | `serial` | Project | Per-project auto-increment id |+| `worksheet` | `serial` | Project | Composite PK `(project, id)`, keep `resource_id` as external identifier || `plan_check_run` | `serial` | Project (via plan) | Add project ref || `plan_webhook_delivery` | `plan_id bigint` | Project (via plan) | Add project ref || `task` | `serial` | Project (via plan) | Add project ref || `task_run` | `serial` | Project (via task) | Add project ref || `task_run_log` | `(task_run_id, created_at)` | Project (via task_run) | Add project ref || `issue_comment` | `bigserial` | Project (via issue) | Drop `id`, use `resource_id` as PK (no composite PK needed — `id` is unused, all lookups use `resource_id`) |-| `worksheet_organizer` | `serial` | Project (via worksheet) | Add project ref |+| `worksheet_organizer` | `(worksheet_id, principal)` | Project (via worksheet) | Rename `worksheet_id` to `worksheet text`, FK to `worksheet(resource_id)` || `db_group` | `(project, resource_id)` | Project | None (already has project) || `release` | `(project, train, iteration)` | Project | None (already has project) || **Cross-workspace (TEXT PK with uuid)** | | | |@@ -293,7 +293,7 @@ Drop `id` columns from tables that never use them — all lookups, JOINs, and FK**Done in PR #19582** for: `idp`, `project`, `setting`, `role`, `policy`, `instance`, `db`, `db_schema`, `task_run_log`, `db_group`, `release`.-**TODO:** `worksheet_organizer` — the `id serial PRIMARY KEY` is unused. All queries use `(worksheet_id, principal)` which already has a unique index. Drop `id` and promote `(worksheet_id, principal)` to PK.+**Done in Step 2c:** `worksheet_organizer` — renamed `worksheet_id` to `worksheet text`, FK to `worksheet(resource_id)`, PK `(worksheet, principal)`. No `project` column needed.#### Step 2: Add Project/Instance Reference and Composite PKs@@ -363,13 +363,27 @@ Tables: `worksheet`, `worksheet_organizer`Schema changes:```worksheet(id) → worksheet(project, id)- -- worksheet already has `project` column, just change PK--worksheet_organizer(worksheet_id, principal) → worksheet_organizer(project, worksheet_id, principal)- -- add `project` column, backfill from worksheet- -- worksheet_organizer.worksheet_id FK → (project, worksheet_id) REFERENCES worksheet(project, id)+ -- worksheet already has `project` and `resource_id` columns, just change PK+ -- keep `resource_id` (globally unique UUID) — used as the external identifier+ in API resource names and as the FK target for worksheet_organizer+ -- API resource name: projects/{project}/worksheets/{resource_id}++worksheet_organizer(worksheet_id integer, principal)+ → worksheet_organizer(worksheet text, principal)+ -- rename `worksheet_id` to `worksheet`, change type from integer to text+ -- backfill with worksheet.resource_id+ -- FK: worksheet_organizer.worksheet REFERENCES worksheet(resource_id) ON DELETE CASCADE+ -- no `project` column needed — resource_id is globally unique```+Code changes:+- `resource_name.go`: `GetProjectIDWorksheetID` returns `(projectID, worksheetID string)` — worksheetID is the UUID+- `FormatWorksheet(projectID, worksheetID string)` — both args are strings+- Store CRUD uses `resource_id` for all single-record operations (get, patch, delete)+- `WorkSheetMessage.UID` removed, `ResourceID` is the primary identifier+- `WorksheetOrganizerMessage` uses `WorksheetResourceID string` — no project needed+- Frontend: `extractWorksheetID` extracts UUID from resource name (no `Number()` conversion)+**Step 2d: `project_webhook`**```@@ -406,8 +420,9 @@ Convert `serial`/`bigserial` to `bigint` (drop the global sequence default). Imp3. **`SELECT COALESCE(MAX(id), 0) + 1`** with advisory lock on `(project, table_name)`.Tables affected:-- Project-scoped: `plan`, `issue`, `worksheet`, `plan_check_run`, `task`, `task_run`+- Project-scoped: `plan`, `issue`, `plan_check_run`, `task`, `task_run`- (`project_webhook` and `issue_comment` use `resource_id` as PK — no per-project auto-increment needed)+ - (`worksheet` uses `resource_id` (UUID) as the external identifier — per-project auto-increment not needed for API, but `id` still auto-increments via sequence for the composite PK)- Instance-scoped: `revision`, `sync_history`, `changelog`#### Step 4: Cross-Workspace Tables — Text UUID PKsdiff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vueindex e1604d9845..404d1c58c3 100644--- a/frontend/src/components/ProvideSQLEditorContext.vue+++ b/frontend/src/components/ProvideSQLEditorContext.vue@@ -68,7 +68,7 @@ import {extractInstanceResourceName,extractProjectResourceName,extractWorksheetConnection,- extractWorksheetUID,+ extractWorksheetID,getDefaultPagination,getSheetStatement,isWorksheetReadableV1,@@ -202,7 +202,7 @@ const prepareSheet = async () => {}await maybeSwitchProject(`projects/${projectId}`);- return await switchWorksheet(`worksheets/${sheetId}`);+ return await switchWorksheet(`projects/${projectId}/worksheets/${sheetId}`);};const prepareConnectionParams = async () => {@@ -295,7 +295,7 @@ const syncURLWithConnection = () => {name: SQL_EDITOR_WORKSHEET_MODULE,params: {project: extractProjectResourceName(sheet.project),- sheet: extractWorksheetUID(sheet.name),+ sheet: extractWorksheetID(sheet.name),},query,});diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.tsindex 675946b86d..f0942823ce 100644--- a/frontend/src/store/modules/v1/common.ts+++ b/frontend/src/store/modules/v1/common.ts@@ -159,8 +159,11 @@ export const getProjectIdPlanUidStageUidTaskUidFromRolloutName = (};export const getWorksheetId = (name: string): string => {- const tokens = getNameParentTokens(name, [worksheetNamePrefix]);- return tokens[0];+ const tokens = getNameParentTokens(name, [+ projectNamePrefix,+ worksheetNamePrefix,+ ]);+ return tokens[1] || "";};export const getInstanceId = (name: string): string[] => {diff --git a/frontend/src/store/modules/v1/worksheet.ts b/frontend/src/store/modules/v1/worksheet.tsindex e078d73117..360e178485 100644--- a/frontend/src/store/modules/v1/worksheet.ts+++ b/frontend/src/store/modules/v1/worksheet.ts@@ -23,7 +23,7 @@ import {WorksheetSchema,} from "@/types/proto-es/v1/worksheet_service_pb";import {- extractWorksheetUID,+ extractWorksheetID,getSheetStatement,getStatementSize,isWorksheetWritableV1,@@ -68,7 +68,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {// Utilitiesconst setCacheEntry = (worksheet: Worksheet, view: WorksheetView) => {- const uid = extractWorksheetUID(worksheet.name);+ const uid = extractWorksheetID(worksheet.name);if (uid === String(UNKNOWN_ID)) return;if (view === "FULL") {cacheByUID.invalidateEntity([uid, "BASIC"]);@@ -112,6 +112,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {? worksheet: clone(WorksheetSchema, worksheet);const request = create(CreateWorksheetRequestSchema, {+ parent: fullWorksheet.project,worksheet: fullWorksheet,});const response =@@ -130,7 +131,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {name: string,view: WorksheetView | undefined = undefined) => {- const uid = extractWorksheetUID(name);+ const uid = extractWorksheetID(name);if (!uid || uid === String(UNKNOWN_ID)) {return undefined;}@@ -146,7 +147,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {name: string,silent: boolean = false) => {- const uid = extractWorksheetUID(name);+ const uid = extractWorksheetID(name);if (uid.startsWith("-") || !uid) {return undefined;}@@ -169,7 +170,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {name: string,silent: boolean = false) => {- const uid = extractWorksheetUID(name);+ const uid = extractWorksheetID(name);if (uid.startsWith("-") || !uid) {return undefined;}@@ -196,8 +197,9 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {return promise;};- const fetchWorksheetList = async (filter: string) => {+ const fetchWorksheetList = async (parent: string, filter: string) => {const request = create(SearchWorksheetsRequestSchema, {+ parent,filter,});const response =@@ -227,7 +229,7 @@ export const useWorkSheetStore = defineStore("worksheet_v1", () => {const deleteWorksheetByName = async (name: string) => {const request = create(DeleteWorksheetRequestSchema, { name });await worksheetServiceClientConnect.deleteWorksheet(request);- const uid = extractWorksheetUID(name);+ const uid = extractWorksheetID(name);cacheByUID.invalidateEntity([uid, "FULL"]);cacheByUID.invalidateEntity([uid, "BASIC"]);};diff --git a/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts b/frontend/src/types/proto-es/v1/worksheet_service_pb.d.tsindex 88b023c903..998e6ead35 100644--- a/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts@@ -15,10 +15,18 @@ export declare const file_v1_worksheet_service: GenFile;* @generated from message bytebase.v1.CreateWorksheetRequest*/export declare type CreateWorksheetRequest = Message<"bytebase.v1.CreateWorksheetRequest"> & {+ /**+ * The parent resource where this worksheet will be created.+ * Format: projects/{project}+ *+ * @generated from field: string parent = 1;+ */+ parent: string;+/*** The worksheet to create.*- * @generated from field: bytebase.v1.Worksheet worksheet = 1;+ * @generated from field: bytebase.v1.Worksheet worksheet = 2;*/worksheet?: Worksheet;};@@ -35,7 +43,7 @@ export declare const CreateWorksheetRequestSchema: GenMessage<CreateWorksheetReqexport declare type GetWorksheetRequest = Message<"bytebase.v1.GetWorksheetRequest"> & {/*** The name of the worksheet to retrieve.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: string name = 1;*/@@ -56,7 +64,7 @@ export declare type UpdateWorksheetRequest = Message<"bytebase.v1.UpdateWorkshee* The worksheet to update.** The worksheet's `name` field is used to identify the worksheet to update.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: bytebase.v1.Worksheet worksheet = 1;*/@@ -123,7 +131,7 @@ export declare type UpdateWorksheetOrganizerRequest = Message<"bytebase.v1.Updat* The organizer to update.** The organizer's `worksheet` field is used to identify the worksheet.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: bytebase.v1.WorksheetOrganizer organizer = 1;*/@@ -160,7 +168,7 @@ export declare const UpdateWorksheetOrganizerRequestSchema: GenMessage<UpdateWorexport declare type WorksheetOrganizer = Message<"bytebase.v1.WorksheetOrganizer"> & {/*** The name of the worksheet.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: string worksheet = 1;*/@@ -191,7 +199,7 @@ export declare const WorksheetOrganizerSchema: GenMessage<WorksheetOrganizer>;export declare type DeleteWorksheetRequest = Message<"bytebase.v1.DeleteWorksheetRequest"> & {/*** The name of the worksheet to delete.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: string name = 1;*/@@ -208,6 +216,14 @@ export declare const DeleteWorksheetRequestSchema: GenMessage<DeleteWorksheetReq* @generated from message bytebase.v1.SearchWorksheetsRequest*/export declare type SearchWorksheetsRequest = Message<"bytebase.v1.SearchWorksheetsRequest"> & {+ /**+ * The parent resource of the worksheets.+ * Format: projects/{project}+ *+ * @generated from field: string parent = 1;+ */+ parent: string;+/*** To filter the search result.* The syntax and semantics of CEL are documented at https://github.com/google/cel-spec@@ -216,7 +232,6 @@ export declare type SearchWorksheetsRequest = Message<"bytebase.v1.SearchWorkshe* - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.* - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.* - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.- * - project: the project full name in "projects/{id}" format, support "==" operator.** For example:* creator == "users/{email}"@@ -225,9 +240,8 @@ export declare type SearchWorksheetsRequest = Message<"bytebase.v1.SearchWorkshe* starred == false* visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]* visibility == "PRIVATE"- * project == "projects/{project resource id}"*- * @generated from field: string filter = 1;+ * @generated from field: string filter = 2;*/filter: string;};@@ -263,7 +277,7 @@ export declare type Worksheet = Message<"bytebase.v1.Worksheet"> & {/*** The name of the worksheet resource, generated by the server.* Canonical parent is project.- * Format: worksheets/{worksheet}+ * Format: projects/{project}/worksheets/{worksheet}** @generated from field: string name = 1;*/diff --git a/frontend/src/types/proto-es/v1/worksheet_service_pb.js b/frontend/src/types/proto-es/v1/worksheet_service_pb.jsindex 8873cf5dfb..28273a96a0 100644--- a/frontend/src/types/proto-es/v1/worksheet_service_pb.js+++ b/frontend/src/types/proto-es/v1/worksheet_service_pb.js@@ -14,7 +14,7 @@ import { file_v1_annotation } from "./annotation_pb";* Describes the file v1/worksheet_service.proto.*/export const file_v1_worksheet_service = /*@__PURE__*/- fileDesc("Chp2MS93b3Jrc2hlZXRfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiSAoWQ3JlYXRlV29ya3NoZWV0UmVxdWVzdBIuCgl3b3Jrc2hlZXQYASABKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRCA+BBAiIoChNHZXRXb3Jrc2hlZXRSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiJ5ChZVcGRhdGVXb3Jrc2hlZXRSZXF1ZXN0Ei4KCXdvcmtzaGVldBgBIAEoCzIWLmJ5dGViYXNlLnYxLldvcmtzaGVldEID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzayJrCiRCYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlcXVlc3QSQwoIcmVxdWVzdHMYASADKAsyLC5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXF1ZXN0QgPgQQIiZgolQmF0Y2hVcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXNwb25zZRI9ChR3b3Jrc2hlZXRfb3JnYW5pemVycxgBIAMoCzIfLmJ5dGViYXNlLnYxLldvcmtzaGVldE9yZ2FuaXplciKiAQofVXBkYXRlV29ya3NoZWV0T3JnYW5pemVyUmVxdWVzdBI3Cglvcmdhbml6ZXIYASABKAsyHy5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRPcmdhbml6ZXJCA+BBAhIvCgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSFQoNYWxsb3dfbWlzc2luZxgDIAEoCCJOChJXb3Jrc2hlZXRPcmdhbml6ZXISFgoJd29ya3NoZWV0GAEgASgJQgPgQQISDwoHc3RhcnJlZBgCIAEoCBIPCgdmb2xkZXJzGAMgAygJIisKFkRlbGV0ZVdvcmtzaGVldFJlcXVlc3QSEQoEbmFtZRgBIAEoCUID4EECIikKF1NlYXJjaFdvcmtzaGVldHNSZXF1ZXN0Eg4KBmZpbHRlchgBIAEoCSJGChhTZWFyY2hXb3Jrc2hlZXRzUmVzcG9uc2USKgoKd29ya3NoZWV0cxgBIAMoCzIWLmJ5dGViYXNlLnYxLldvcmtzaGVldCLcAwoJV29ya3NoZWV0EhQKBG5hbWUYASABKAlCBuBBAuBBBRIUCgdwcm9qZWN0GAIgASgJQgPgQQISEAoIZGF0YWJhc2UYAyABKAkSGgoFdGl0bGUYBCABKAlCC+BBArpIBXIDGMgBEhQKB2NyZWF0b3IYBSABKAlCA+BBAxI0CgtjcmVhdGVfdGltZRgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxIUCgdjb250ZW50GAggASgMQgPgQQISGQoMY29udGVudF9zaXplGAkgASgDQgPgQQMSOgoKdmlzaWJpbGl0eRgKIAEoDjIhLmJ5dGViYXNlLnYxLldvcmtzaGVldC5WaXNpYmlsaXR5QgPgQQISFAoHc3RhcnJlZBgLIAEoCEID4EEDEhQKB2ZvbGRlcnMYDCADKAlCA+BBAyJaCgpWaXNpYmlsaXR5EhoKFlZJU0lCSUxJVFlfVU5TUEVDSUZJRUQQABIQCgxQUk9KRUNUX1JFQUQQARIRCg1QUk9KRUNUX1dSSVRFEAISCwoHUFJJVkFURRADMr4IChBXb3Jrc2hlZXRTZXJ2aWNlEoEBCg9DcmVhdGVXb3Jrc2hlZXQSIy5ieXRlYmFzZS52MS5DcmVhdGVXb3Jrc2hlZXRSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuV29ya3NoZWV0IjHaQQl3b3Jrc2hlZXSQ6jACgtPkkwIbOgl3b3Jrc2hlZXQiDi92MS93b3Jrc2hlZXRzEnQKDEdldFdvcmtzaGVldBIgLmJ5dGViYXNlLnYxLkdldFdvcmtzaGVldFJlcXVlc3QaFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXQiKtpBBG5hbWWQ6jACgtPkkwIZEhcvdjEve25hbWU9d29ya3NoZWV0cy8qfRKFAQoQU2VhcmNoV29ya3NoZWV0cxIkLmJ5dGViYXNlLnYxLlNlYXJjaFdvcmtzaGVldHNSZXF1ZXN0GiUuYnl0ZWJhc2UudjEuU2VhcmNoV29ya3NoZWV0c1Jlc3BvbnNlIiSQ6jACgtPkkwIaOgEqIhUvdjEvd29ya3NoZWV0czpzZWFyY2gSoAEKD1VwZGF0ZVdvcmtzaGVldBIjLmJ5dGViYXNlLnYxLlVwZGF0ZVdvcmtzaGVldFJlcXVlc3QaFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXQiUNpBFXdvcmtzaGVldCx1cGRhdGVfbWFza5DqMAKC0+STAi46CXdvcmtzaGVldDIhL3YxL3t3b3Jrc2hlZXQubmFtZT13b3Jrc2hlZXRzLyp9EsoBChhVcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXISLC5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXF1ZXN0Gh8uYnl0ZWJhc2UudjEuV29ya3NoZWV0T3JnYW5pemVyIl/aQRVvcmdhbml6ZXIsdXBkYXRlX21hc2uQ6jACgtPkkwI9Oglvcmdhbml6ZXIyMC92MS97b3JnYW5pemVyLndvcmtzaGVldD13b3Jrc2hlZXRzLyp9L29yZ2FuaXplchK7AQodQmF0Y2hVcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXISMS5ieXRlYmFzZS52MS5CYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlcXVlc3QaMi5ieXRlYmFzZS52MS5CYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlc3BvbnNlIjOQ6jACgtPkkwIpOgEqMiQvdjEvd29ya3NoZWV0cy9vcmdhbml6ZXI6YmF0Y2hVcGRhdGUSegoPRGVsZXRlV29ya3NoZWV0EiMuYnl0ZWJhc2UudjEuRGVsZXRlV29ya3NoZWV0UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIq2kEEbmFtZZDqMAKC0+STAhkqFy92MS97bmFtZT13b3Jrc2hlZXRzLyp9QqsBCg9jb20uYnl0ZWJhc2UudjFCFVdvcmtzaGVldFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation]);+ fileDesc("Chp2MS93b3Jrc2hlZXRfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiXQoWQ3JlYXRlV29ya3NoZWV0UmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhIuCgl3b3Jrc2hlZXQYAiABKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRCA+BBAiIoChNHZXRXb3Jrc2hlZXRSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiJ5ChZVcGRhdGVXb3Jrc2hlZXRSZXF1ZXN0Ei4KCXdvcmtzaGVldBgBIAEoCzIWLmJ5dGViYXNlLnYxLldvcmtzaGVldEID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzayJrCiRCYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlcXVlc3QSQwoIcmVxdWVzdHMYASADKAsyLC5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXF1ZXN0QgPgQQIiZgolQmF0Y2hVcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXNwb25zZRI9ChR3b3Jrc2hlZXRfb3JnYW5pemVycxgBIAMoCzIfLmJ5dGViYXNlLnYxLldvcmtzaGVldE9yZ2FuaXplciKiAQofVXBkYXRlV29ya3NoZWV0T3JnYW5pemVyUmVxdWVzdBI3Cglvcmdhbml6ZXIYASABKAsyHy5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRPcmdhbml6ZXJCA+BBAhIvCgt1cGRhdGVfbWFzaxgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSFQoNYWxsb3dfbWlzc2luZxgDIAEoCCJOChJXb3Jrc2hlZXRPcmdhbml6ZXISFgoJd29ya3NoZWV0GAEgASgJQgPgQQISDwoHc3RhcnJlZBgCIAEoCBIPCgdmb2xkZXJzGAMgAygJIisKFkRlbGV0ZVdvcmtzaGVldFJlcXVlc3QSEQoEbmFtZRgBIAEoCUID4EECIj4KF1NlYXJjaFdvcmtzaGVldHNSZXF1ZXN0EhMKBnBhcmVudBgBIAEoCUID4EECEg4KBmZpbHRlchgCIAEoCSJGChhTZWFyY2hXb3Jrc2hlZXRzUmVzcG9uc2USKgoKd29ya3NoZWV0cxgBIAMoCzIWLmJ5dGViYXNlLnYxLldvcmtzaGVldCLcAwoJV29ya3NoZWV0EhQKBG5hbWUYASABKAlCBuBBAuBBBRIUCgdwcm9qZWN0GAIgASgJQgPgQQMSEAoIZGF0YWJhc2UYAyABKAkSGgoFdGl0bGUYBCABKAlCC+BBArpIBXIDGMgBEhQKB2NyZWF0b3IYBSABKAlCA+BBAxI0CgtjcmVhdGVfdGltZRgGIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgHIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxIUCgdjb250ZW50GAggASgMQgPgQQISGQoMY29udGVudF9zaXplGAkgASgDQgPgQQMSOgoKdmlzaWJpbGl0eRgKIAEoDjIhLmJ5dGViYXNlLnYxLldvcmtzaGVldC5WaXNpYmlsaXR5QgPgQQISFAoHc3RhcnJlZBgLIAEoCEID4EEDEhQKB2ZvbGRlcnMYDCADKAlCA+BBAyJaCgpWaXNpYmlsaXR5EhoKFlZJU0lCSUxJVFlfVU5TUEVDSUZJRUQQABIQCgxQUk9KRUNUX1JFQUQQARIRCg1QUk9KRUNUX1dSSVRFEAISCwoHUFJJVkFURRADMqMJChBXb3Jrc2hlZXRTZXJ2aWNlEpwBCg9DcmVhdGVXb3Jrc2hlZXQSIy5ieXRlYmFzZS52MS5DcmVhdGVXb3Jrc2hlZXRSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuV29ya3NoZWV0IkzaQRBwYXJlbnQsd29ya3NoZWV0kOowAoLT5JMCLzoJd29ya3NoZWV0IiIvdjEve3BhcmVudD1wcm9qZWN0cy8qfS93b3Jrc2hlZXRzEn8KDEdldFdvcmtzaGVldBIgLmJ5dGViYXNlLnYxLkdldFdvcmtzaGVldFJlcXVlc3QaFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXQiNdpBBG5hbWWQ6jACgtPkkwIkEiIvdjEve25hbWU9cHJvamVjdHMvKi93b3Jrc2hlZXRzLyp9EqIBChBTZWFyY2hXb3Jrc2hlZXRzEiQuYnl0ZWJhc2UudjEuU2VhcmNoV29ya3NoZWV0c1JlcXVlc3QaJS5ieXRlYmFzZS52MS5TZWFyY2hXb3Jrc2hlZXRzUmVzcG9uc2UiQdpBBnBhcmVudJDqMAKC0+STAi46ASoiKS92MS97cGFyZW50PXByb2plY3RzLyp9L3dvcmtzaGVldHM6c2VhcmNoEqsBCg9VcGRhdGVXb3Jrc2hlZXQSIy5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc2hlZXRSZXF1ZXN0GhYuYnl0ZWJhc2UudjEuV29ya3NoZWV0IlvaQRV3b3Jrc2hlZXQsdXBkYXRlX21hc2uQ6jACgtPkkwI5Ogl3b3Jrc2hlZXQyLC92MS97d29ya3NoZWV0Lm5hbWU9cHJvamVjdHMvKi93b3Jrc2hlZXRzLyp9EtUBChhVcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXISLC5ieXRlYmFzZS52MS5VcGRhdGVXb3Jrc2hlZXRPcmdhbml6ZXJSZXF1ZXN0Gh8uYnl0ZWJhc2UudjEuV29ya3NoZWV0T3JnYW5pemVyImraQRVvcmdhbml6ZXIsdXBkYXRlX21hc2uQ6jACgtPkkwJIOglvcmdhbml6ZXIyOy92MS97b3JnYW5pemVyLndvcmtzaGVldD1wcm9qZWN0cy8qL3dvcmtzaGVldHMvKn0vb3JnYW5pemVyErsBCh1CYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplchIxLmJ5dGViYXNlLnYxLkJhdGNoVXBkYXRlV29ya3NoZWV0T3JnYW5pemVyUmVxdWVzdBoyLmJ5dGViYXNlLnYxLkJhdGNoVXBkYXRlV29ya3NoZWV0T3JnYW5pemVyUmVzcG9uc2UiM5DqMAKC0+STAik6ASoyJC92MS93b3Jrc2hlZXRzL29yZ2FuaXplcjpiYXRjaFVwZGF0ZRKFAQoPRGVsZXRlV29ya3NoZWV0EiMuYnl0ZWJhc2UudjEuRGVsZXRlV29ya3NoZWV0UmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSI12kEEbmFtZZDqMAKC0+STAiQqIi92MS97bmFtZT1wcm9qZWN0cy8qL3dvcmtzaGVldHMvKn1CqwEKD2NvbS5ieXRlYmFzZS52MUIVV29ya3NoZWV0U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation]);/*** Describes the message bytebase.v1.CreateWorksheetRequest.diff --git a/frontend/src/utils/v1/worksheet.ts b/frontend/src/utils/v1/worksheet.tsindex 35c16f58b5..2c28e5085e 100644--- a/frontend/src/utils/v1/worksheet.ts+++ b/frontend/src/utils/v1/worksheet.ts@@ -5,7 +5,11 @@ import {useProjectV1Store,} from "@/store";import { extractUserEmail } from "@/store/modules/v1/common";-import { type SQLEditorConnection, UNKNOWN_PROJECT_NAME } from "@/types";+import {+ type SQLEditorConnection,+ UNKNOWN_ID,+ UNKNOWN_PROJECT_NAME,+} from "@/types";import type { Database } from "@/types/proto-es/v1/database_service_pb";import { DataSourceType } from "@/types/proto-es/v1/instance_service_pb";import type { Worksheet } from "@/types/proto-es/v1/worksheet_service_pb";@@ -18,10 +22,10 @@ import {hasWorkspacePermissionV2,} from "@/utils";-export const extractWorksheetUID = (name: string) => {+export const extractWorksheetID = (name: string) => {const pattern = /(?:^|\/)worksheets\/([^/]+)(?:$|\/)/;const matches = name.match(pattern);- return matches?.[1] ?? "-1";+ return matches?.[1] ?? `${UNKNOWN_ID}`;};// readable todiff --git a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vueindex dfa906a28e..93ed00a87f 100644--- a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue@@ -39,7 +39,7 @@ import { useEmitteryEventListener } from "@/composables/useEmitteryEventListenerimport { useWorkSheetStore } from "@/store";import type { SQLEditorTab } from "@/types";import { UNKNOWN_ID } from "@/types";-import { extractWorksheetUID } from "@/utils";+import { extractWorksheetID } from "@/utils";import FolderForm from "@/views/sql-editor/AsidePanel/WorksheetPane/SheetList/FolderForm.vue";import { useSheetContextByView } from "@/views/sql-editor/Sheet";import { useSQLEditorContext } from "../context";@@ -79,8 +79,8 @@ const doSaveSheet = async () => {} = pendingEdit.value.rawTab;const folders = folderFormRef.value?.folders ?? [];- const sheetId = Number(extractWorksheetUID(worksheet ?? ""));- if (sheetId !== UNKNOWN_ID) {+ const sheetId = extractWorksheetID(worksheet ?? "");+ if (sheetId !== String(UNKNOWN_ID)) {await editorContext.maybeUpdateWorksheet({tabId,worksheet,diff --git a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vueindex a992c5e1e5..c36d2d083e 100644--- a/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SharePopover.vue@@ -103,7 +103,7 @@ import {type Worksheet,Worksheet_Visibility,} from "@/types/proto-es/v1/worksheet_service_pb";-import { extractProjectResourceName, extractWorksheetUID } from "@/utils";+import { extractProjectResourceName, extractWorksheetID } from "@/utils";type AccessOption = {label: string;@@ -206,7 +206,7 @@ const sharedTabLink = computed(() => {name: SQL_EDITOR_WORKSHEET_MODULE,params: {project: extractProjectResourceName(props.worksheet.project),- sheet: extractWorksheetUID(props.worksheet.name),+ sheet: extractWorksheetID(props.worksheet.name),},});return new URL(diff --git a/frontend/src/views/sql-editor/Sheet/context.ts b/frontend/src/views/sql-editor/Sheet/context.tsindex 4973fab255..679bf79e74 100644--- a/frontend/src/views/sql-editor/Sheet/context.ts+++ b/frontend/src/views/sql-editor/Sheet/context.ts@@ -292,16 +292,14 @@ const useSheetTreeByView = (switch (viewMode) {case "my":await sheetStore.fetchWorksheetList(- [- `project == "${project.value}"`,- `creator == "users/${me.value.email}"`,- ].join(" && ")+ project.value,+ `creator == "users/${me.value.email}"`);break;case "shared":await sheetStore.fetchWorksheetList(+ project.value,[- `project == "${project.value}"`,`creator != "users/${me.value.email}"`,// TODO(ed): do we need the visibility filter?// If not provide it, the call will fetch all worksheet with read access.diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex c6bf2b5256..eab7227e08 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -11775,15 +11775,15 @@ paths:application/json:schema:$ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'- /v1/projects/{project}:addWebhook:+ /v1/projects/{project}/worksheets:post:tags:- - ProjectService- summary: AddWebhook+ - WorksheetService+ summary: CreateWorksheetdescription: |-- Adds a webhook to a project for notifications.- Permissions required: bb.projects.update- operationId: ProjectService_AddWebhook+ Creates a personal worksheet used in SQL Editor. Any authenticated user can create their own worksheets.+ Permissions required: None (authenticated users only)+ operationId: WorksheetService_CreateWorksheetparameters:- name: projectin: path@@ -11792,36 +11792,33 @@ paths:schema:type: stringrequestBody:+ description: The worksheet to create.content:application/json:schema:- type: object- properties:- webhook:- title: webhook- description: The webhook to add.- $ref: '#/components/schemas/bytebase.v1.Webhook'- title: AddWebhookRequest- required:- - webhook- additionalProperties: false- required: true+ title: worksheet+ description: The worksheet to create.+ $ref: '#/components/schemas/bytebase.v1.Worksheet'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Project'- /v1/projects/{project}:getIamPolicy:+ $ref: '#/components/schemas/bytebase.v1.Worksheet'+ /v1/projects/{project}/worksheets/{worksheet}:get:tags:- - ProjectService- summary: GetIamPolicy+ - WorksheetService+ summary: GetWorksheetdescription: |-- Retrieves the IAM policy for a project.- Permissions required: bb.projects.getIamPolicy- operationId: ProjectService_GetIamPolicy+ Get a worksheet by name.+ The users can access this method if,+ - they are the creator of the worksheet;+ - they have bb.worksheets.get permission on the workspace;+ - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.+ Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)+ operationId: WorksheetService_GetWorksheetparameters:- name: projectin: path@@ -11829,64 +11826,28 @@ paths:required: trueschema:type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.IamPolicy'- /v1/projects/{project}:setIamPolicy:- post:- tags:- - ProjectService- summary: SetIamPolicy- description: |-- Sets the IAM policy for a project.- Permissions required: bb.projects.setIamPolicy- operationId: ProjectService_SetIamPolicy- parameters:- - name: project+ - name: worksheetin: path- description: The project id.+ description: The worksheet id.required: trueschema:type: string- requestBody:- content:- application/json:- schema:- type: object- properties:- policy:- title: policy- $ref: '#/components/schemas/bytebase.v1.IamPolicy'- etag:- type: string- title: etag- description: The current etag of the policy.- title: SetIamPolicyRequest- required:- - policy- additionalProperties: false- description: Request message for setting an IAM policy.- required: trueresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.IamPolicy'- /v1/projects/{project}:testWebhook:- post:+ $ref: '#/components/schemas/bytebase.v1.Worksheet'+ delete:tags:- - ProjectService- summary: TestWebhook+ - WorksheetService+ summary: DeleteWorksheetdescription: |-- Tests a webhook by sending a test notification.- Permissions required: bb.projects.update- operationId: ProjectService_TestWebhook+ Delete a worksheet.+ The access is the same as UpdateWorksheet method.+ Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)+ operationId: WorksheetService_DeleteWorksheetparameters:- name: projectin: path@@ -11894,37 +11855,31 @@ paths:required: trueschema:type: string- requestBody:- content:- application/json:- schema:- type: object- properties:- webhook:- title: webhook- description: The webhook to test. Identified by its url.- $ref: '#/components/schemas/bytebase.v1.Webhook'- title: TestWebhookRequest- required:- - webhook- additionalProperties: false- required: true+ - name: worksheet+ in: path+ description: The worksheet id.+ required: true+ schema:+ type: stringresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.TestWebhookResponse'- /v1/projects/{project}:undelete:- post:+ $ref: '#/components/schemas/google.protobuf.Empty'+ patch:tags:- - ProjectService- summary: UndeleteProject+ - WorksheetService+ summary: UpdateWorksheetdescription: |-- Restores a soft-deleted project.- Permissions required: bb.projects.undelete- operationId: ProjectService_UndeleteProject+ Update a worksheet.+ The users can access this method if,+ - they are the creator of the worksheet;+ - they have bb.worksheets.manage permission on the workspace;+ - the sheet is shared with them with PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.+ Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)+ operationId: WorksheetService_UpdateWorksheetparameters:- name: projectin: path@@ -11932,215 +11887,25 @@ paths:required: trueschema:type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.Project'- /v1/projects:batchDelete:- post:- tags:- - ProjectService- summary: BatchDeleteProjects- description: |-- Deletes multiple projects in a single operation.- Permissions required: bb.projects.delete- operationId: ProjectService_BatchDeleteProjects- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.BatchDeleteProjectsRequest'- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/google.protobuf.Empty'- /v1/projects:batchGet:- get:- tags:- - ProjectService- summary: BatchGetProjects- description: |-- BatchGetProjects retrieves multiple projects by their names.- Permissions required: bb.projects.get- operationId: ProjectService_BatchGetProjects- parameters:- - name: names+ - name: worksheet+ in: path+ description: The worksheet id.+ required: true+ schema:+ type: string+ - name: updateMaskin: querydescription: |-- The names of projects to retrieve.- Format: projects/{project}- required: true+ The list of fields to be updated.+ Fields are specified relative to the worksheet.+ (e.g., `title`, `statement`; *not* `worksheet.title` or `worksheet.statement`)+ Only support update the following fields for now:+ - `title`+ - `statement`+ - `starred`+ - `visibility`schema:- type: array- items:- type: string- title: names- description: |-- The names of projects to retrieve.- Format: projects/{project}- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.BatchGetProjectsResponse'- /v1/projects:search:- post:- tags:- - ProjectService- summary: SearchProjects- description: |-- Searches for projects with advanced filtering capabilities.- Permissions required: bb.projects.get (or project-level bb.projects.get for specific projects)- operationId: ProjectService_SearchProjects- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchProjectsRequest'- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchProjectsResponse'- /v1/queryHistories:search:- post:- tags:- - SQLService- summary: SearchQueryHistories- description: |-- SearchQueryHistories searches query histories for the caller.- Permissions required: None (only returns caller's own query histories)- operationId: SQLService_SearchQueryHistories- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesRequest'- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesResponse'- /v1/reviewConfigs:- get:- tags:- - ReviewConfigService- summary: ListReviewConfigs- description: |-- Lists all SQL review configurations.- Permissions required: bb.reviewConfigs.list- operationId: ReviewConfigService_ListReviewConfigs- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ListReviewConfigsResponse'- post:- tags:- - ReviewConfigService- summary: CreateReviewConfig- description: |-- Creates a new SQL review configuration.- Permissions required: bb.reviewConfigs.create- operationId: ReviewConfigService_CreateReviewConfig- requestBody:- description: The SQL review config to create.- content:- application/json:- schema:- title: review_config- description: The SQL review config to create.- $ref: '#/components/schemas/bytebase.v1.ReviewConfig'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ReviewConfig'- /v1/reviewConfigs/{reviewConfig}:- get:- tags:- - ReviewConfigService- summary: GetReviewConfig- description: |-- Retrieves a SQL review configuration by name.- Permissions required: bb.reviewConfigs.get- operationId: ReviewConfigService_GetReviewConfig- parameters:- - name: reviewConfig- in: path- description: The reviewConfig id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ReviewConfig'- delete:- tags:- - ReviewConfigService- summary: DeleteReviewConfig- description: |-- Deletes a SQL review configuration.- Permissions required: bb.reviewConfigs.delete- operationId: ReviewConfigService_DeleteReviewConfig- parameters:- - name: reviewConfig- in: path- description: The reviewConfig id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/google.protobuf.Empty'- patch:- tags:- - ReviewConfigService- summary: UpdateReviewConfig- description: |-- Updates a SQL review configuration.- Permissions required: bb.reviewConfigs.update- When allow_missing=true, also requires: bb.reviewConfigs.create- operationId: ReviewConfigService_UpdateReviewConfig- parameters:- - name: reviewConfig- in: path- description: The reviewConfig id.- required: true- schema:- type: string- - name: updateMask- in: query- description: The list of fields to update.- schema:- type: string+ type: stringdescription: |-`FieldMask` represents a set of symbolic field paths, for example:@@ -12341,160 +12106,59 @@ paths:The implementation of any API method which has a FieldMask type field in therequest should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.- - name: allowMissing- in: query- description: |-- If set to true, and the config is not found, a new config will be created.- In this situation, `update_mask` is ignored.- schema:- type: boolean- title: allow_missing- description: |-- If set to true, and the config is not found, a new config will be created.- In this situation, `update_mask` is ignored.requestBody:description: |-- The SQL review config to update.+ The worksheet to update.- The name field is used to identify the SQL review config to update.+ The worksheet's `name` field is used to identify the worksheet to update.+ Format: projects/{project}/worksheets/{worksheet}content:application/json:schema:- title: review_config+ title: worksheetdescription: |-- The SQL review config to update.-- The name field is used to identify the SQL review config to update.- $ref: '#/components/schemas/bytebase.v1.ReviewConfig'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ReviewConfig'- /v1/roles:- get:- tags:- - RoleService- summary: ListRoles- description: |-- Lists roles in the workspace.- Permissions required: bb.roles.list- operationId: RoleService_ListRoles- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.ListRolesResponse'- post:- tags:- - RoleService- summary: CreateRole- description: |-- Creates a new custom role.- Permissions required: bb.roles.create- operationId: RoleService_CreateRole- parameters:- - name: roleId- in: query- description: |-- The ID to use for the role, which will become the final component- of the role's resource name.-- This value should be 4-63 characters, and valid characters- are /[a-z][A-Z][0-9]/.- required: true- schema:- type: string- title: role_id- description: |-- The ID to use for the role, which will become the final component- of the role's resource name.+ The worksheet to update.- This value should be 4-63 characters, and valid characters- are /[a-z][A-Z][0-9]/.- requestBody:- description: The role to create.- content:- application/json:- schema:- title: role- description: The role to create.- $ref: '#/components/schemas/bytebase.v1.Role'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.Role'- /v1/roles/{role}:- get:- tags:- - RoleService- summary: GetRole- description: |-- Retrieves a role by name.- Permissions required: bb.roles.get- operationId: RoleService_GetRole- parameters:- - name: role- in: path- description: The role id.- required: true- schema:- type: string+ The worksheet's `name` field is used to identify the worksheet to update.+ Format: projects/{project}/worksheets/{worksheet}+ $ref: '#/components/schemas/bytebase.v1.Worksheet'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Role'- delete:+ $ref: '#/components/schemas/bytebase.v1.Worksheet'+ /v1/projects/{project}/worksheets/{worksheet}/organizer:+ patch:tags:- - RoleService- summary: DeleteRole+ - WorksheetService+ summary: UpdateWorksheetOrganizerdescription: |-- Deletes a custom role.- Permissions required: bb.roles.delete- operationId: RoleService_DeleteRole+ Update the organizer of a worksheet.+ The access is the same as UpdateWorksheet method.+ Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)+ operationId: WorksheetService_UpdateWorksheetOrganizerparameters:- - name: role+ - name: projectin: path- description: The role id.+ description: The project id.required: trueschema:type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/google.protobuf.Empty'- patch:- tags:- - RoleService- summary: UpdateRole- description: |-- Updates a role's properties.- Permissions required: bb.roles.update- When allow_missing=true, also requires: bb.roles.create- operationId: RoleService_UpdateRole- parameters:- - name: role+ - name: worksheetin: path- description: The role id.+ description: The worksheet id.required: trueschema:type: string- name: updateMaskin: query- description: The list of fields to update.+ description: |-+ The list of fields to be updated.+ Fields are specified relative to the worksheet organizer.+ Only support update the following fields for now:+ - `starred`schema:type: stringdescription: |-@@ -12700,43 +12364,343 @@ paths:- name: allowMissingin: querydescription: |-- If set to true, and the role is not found, a new role will be created.+ If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.In this situation, `update_mask` is ignored.schema:type: booleantitle: allow_missingdescription: |-- If set to true, and the role is not found, a new role will be created.+ If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.In this situation, `update_mask` is ignored.requestBody:- description: The role to update.+ description: |-+ The organizer to update.++ The organizer's `worksheet` field is used to identify the worksheet.+ Format: projects/{project}/worksheets/{worksheet}content:application/json:schema:- title: role- description: The role to update.- $ref: '#/components/schemas/bytebase.v1.Role'+ title: organizer+ description: |-+ The organizer to update.++ The organizer's `worksheet` field is used to identify the worksheet.+ Format: projects/{project}/worksheets/{worksheet}+ $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Role'- /v1/schemaDesign:diffMetadata:+ $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'+ /v1/projects/{project}/worksheets:search:+ post:+ tags:+ - WorksheetService+ summary: SearchWorksheets+ description: |-+ Search for worksheets.+ This is used for finding my worksheets or worksheets shared by other people.+ The sheet accessibility is the same as GetWorksheet().+ Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)+ operationId: WorksheetService_SearchWorksheets+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ filter:+ type: string+ title: filter+ description: |-+ To filter the search result.+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++ Supported filter:+ - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.+ - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.+ - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.++ For example:+ creator == "users/{email}"+ creator != "users/{email}"+ starred == true+ starred == false+ visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]+ visibility == "PRIVATE"+ title: SearchWorksheetsRequest+ additionalProperties: false+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsResponse'+ /v1/projects/{project}:addWebhook:+ post:+ tags:+ - ProjectService+ summary: AddWebhook+ description: |-+ Adds a webhook to a project for notifications.+ Permissions required: bb.projects.update+ operationId: ProjectService_AddWebhook+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ webhook:+ title: webhook+ description: The webhook to add.+ $ref: '#/components/schemas/bytebase.v1.Webhook'+ title: AddWebhookRequest+ required:+ - webhook+ additionalProperties: false+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Project'+ /v1/projects/{project}:getIamPolicy:+ get:+ tags:+ - ProjectService+ summary: GetIamPolicy+ description: |-+ Retrieves the IAM policy for a project.+ Permissions required: bb.projects.getIamPolicy+ operationId: ProjectService_GetIamPolicy+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.IamPolicy'+ /v1/projects/{project}:setIamPolicy:+ post:+ tags:+ - ProjectService+ summary: SetIamPolicy+ description: |-+ Sets the IAM policy for a project.+ Permissions required: bb.projects.setIamPolicy+ operationId: ProjectService_SetIamPolicy+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ policy:+ title: policy+ $ref: '#/components/schemas/bytebase.v1.IamPolicy'+ etag:+ type: string+ title: etag+ description: The current etag of the policy.+ title: SetIamPolicyRequest+ required:+ - policy+ additionalProperties: false+ description: Request message for setting an IAM policy.+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.IamPolicy'+ /v1/projects/{project}:testWebhook:+ post:+ tags:+ - ProjectService+ summary: TestWebhook+ description: |-+ Tests a webhook by sending a test notification.+ Permissions required: bb.projects.update+ operationId: ProjectService_TestWebhook+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ webhook:+ title: webhook+ description: The webhook to test. Identified by its url.+ $ref: '#/components/schemas/bytebase.v1.Webhook'+ title: TestWebhookRequest+ required:+ - webhook+ additionalProperties: false+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.TestWebhookResponse'+ /v1/projects/{project}:undelete:+ post:+ tags:+ - ProjectService+ summary: UndeleteProject+ description: |-+ Restores a soft-deleted project.+ Permissions required: bb.projects.undelete+ operationId: ProjectService_UndeleteProject+ parameters:+ - name: project+ in: path+ description: The project id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Project'+ /v1/projects:batchDelete:+ post:+ tags:+ - ProjectService+ summary: BatchDeleteProjects+ description: |-+ Deletes multiple projects in a single operation.+ Permissions required: bb.projects.delete+ operationId: ProjectService_BatchDeleteProjects+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.BatchDeleteProjectsRequest'+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/google.protobuf.Empty'+ /v1/projects:batchGet:+ get:+ tags:+ - ProjectService+ summary: BatchGetProjects+ description: |-+ BatchGetProjects retrieves multiple projects by their names.+ Permissions required: bb.projects.get+ operationId: ProjectService_BatchGetProjects+ parameters:+ - name: names+ in: query+ description: |-+ The names of projects to retrieve.+ Format: projects/{project}+ required: true+ schema:+ type: array+ items:+ type: string+ title: names+ description: |-+ The names of projects to retrieve.+ Format: projects/{project}+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.BatchGetProjectsResponse'+ /v1/projects:search:+ post:+ tags:+ - ProjectService+ summary: SearchProjects+ description: |-+ Searches for projects with advanced filtering capabilities.+ Permissions required: bb.projects.get (or project-level bb.projects.get for specific projects)+ operationId: ProjectService_SearchProjects+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchProjectsRequest'+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.SearchProjectsResponse'+ /v1/queryHistories:search:post:tags:- SQLService- summary: DiffMetadata+ summary: SearchQueryHistoriesdescription: |-- Computes schema differences between two database metadata.- Permissions required: None- operationId: SQLService_DiffMetadata+ SearchQueryHistories searches query histories for the caller.+ Permissions required: None (only returns caller's own query histories)+ operationId: SQLService_SearchQueryHistoriesrequestBody:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.DiffMetadataRequest'+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesRequest'required: trueresponses:"200":@@ -12744,20 +12708,59 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.DiffMetadataResponse'- /v1/serviceAccounts/{serviceAccount}:+ $ref: '#/components/schemas/bytebase.v1.SearchQueryHistoriesResponse'+ /v1/reviewConfigs:get:tags:- - ServiceAccountService- summary: GetServiceAccount+ - ReviewConfigService+ summary: ListReviewConfigsdescription: |-- Gets a service account by name.- Permissions required: bb.serviceAccounts.get- operationId: ServiceAccountService_GetServiceAccount+ Lists all SQL review configurations.+ Permissions required: bb.reviewConfigs.list+ operationId: ReviewConfigService_ListReviewConfigs+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListReviewConfigsResponse'+ post:+ tags:+ - ReviewConfigService+ summary: CreateReviewConfig+ description: |-+ Creates a new SQL review configuration.+ Permissions required: bb.reviewConfigs.create+ operationId: ReviewConfigService_CreateReviewConfig+ requestBody:+ description: The SQL review config to create.+ content:+ application/json:+ schema:+ title: review_config+ description: The SQL review config to create.+ $ref: '#/components/schemas/bytebase.v1.ReviewConfig'+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ReviewConfig'+ /v1/reviewConfigs/{reviewConfig}:+ get:+ tags:+ - ReviewConfigService+ summary: GetReviewConfig+ description: |-+ Retrieves a SQL review configuration by name.+ Permissions required: bb.reviewConfigs.get+ operationId: ReviewConfigService_GetReviewConfigparameters:- - name: serviceAccount+ - name: reviewConfigin: path- description: The serviceAccount id.+ description: The reviewConfig id.required: trueschema:type: string@@ -12767,19 +12770,19 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ServiceAccount'+ $ref: '#/components/schemas/bytebase.v1.ReviewConfig'delete:tags:- - ServiceAccountService- summary: DeleteServiceAccount+ - ReviewConfigService+ summary: DeleteReviewConfigdescription: |-- Deletes a service account.- Permissions required: bb.serviceAccounts.delete- operationId: ServiceAccountService_DeleteServiceAccount+ Deletes a SQL review configuration.+ Permissions required: bb.reviewConfigs.delete+ operationId: ReviewConfigService_DeleteReviewConfigparameters:- - name: serviceAccount+ - name: reviewConfigin: path- description: The serviceAccount id.+ description: The reviewConfig id.required: trueschema:type: string@@ -12792,24 +12795,23 @@ paths:$ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - ServiceAccountService- summary: UpdateServiceAccount+ - ReviewConfigService+ summary: UpdateReviewConfigdescription: |-- Updates a service account.- Permissions required: bb.serviceAccounts.update- operationId: ServiceAccountService_UpdateServiceAccount+ Updates a SQL review configuration.+ Permissions required: bb.reviewConfigs.update+ When allow_missing=true, also requires: bb.reviewConfigs.create+ operationId: ReviewConfigService_UpdateReviewConfigparameters:- - name: serviceAccount+ - name: reviewConfigin: path- description: The serviceAccount id.+ description: The reviewConfig id.required: trueschema:type: string- name: updateMaskin: query- description: |-- The list of fields to update.- Supported fields: title, service_key (triggers key rotation)+ description: The list of fields to update.schema:type: stringdescription: |-@@ -13012,81 +13014,131 @@ paths:The implementation of any API method which has a FieldMask type field in therequest should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.+ - name: allowMissing+ in: query+ description: |-+ If set to true, and the config is not found, a new config will be created.+ In this situation, `update_mask` is ignored.+ schema:+ type: boolean+ title: allow_missing+ description: |-+ If set to true, and the config is not found, a new config will be created.+ In this situation, `update_mask` is ignored.requestBody:description: |-- The service account to update.+ The SQL review config to update.- The service account's `name` field is used to identify the service account to update.- Format: serviceAccounts/{email}+ The name field is used to identify the SQL review config to update.content:application/json:schema:- title: service_account+ title: review_configdescription: |-- The service account to update.+ The SQL review config to update.- The service account's `name` field is used to identify the service account to update.- Format: serviceAccounts/{email}- $ref: '#/components/schemas/bytebase.v1.ServiceAccount'+ The name field is used to identify the SQL review config to update.+ $ref: '#/components/schemas/bytebase.v1.ReviewConfig'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ServiceAccount'- /v1/serviceAccounts/{serviceAccount}:undelete:+ $ref: '#/components/schemas/bytebase.v1.ReviewConfig'+ /v1/roles:+ get:+ tags:+ - RoleService+ summary: ListRoles+ description: |-+ Lists roles in the workspace.+ Permissions required: bb.roles.list+ operationId: RoleService_ListRoles+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.ListRolesResponse'post:tags:- - ServiceAccountService- summary: UndeleteServiceAccount+ - RoleService+ summary: CreateRoledescription: |-- Restores a deleted service account.- Permissions required: bb.serviceAccounts.undelete- operationId: ServiceAccountService_UndeleteServiceAccount+ Creates a new custom role.+ Permissions required: bb.roles.create+ operationId: RoleService_CreateRoleparameters:- - name: serviceAccount- in: path- description: The serviceAccount id.+ - name: roleId+ in: query+ description: |-+ The ID to use for the role, which will become the final component+ of the role's resource name.++ This value should be 4-63 characters, and valid characters+ are /[a-z][A-Z][0-9]/.required: trueschema:type: string+ title: role_id+ description: |-+ The ID to use for the role, which will become the final component+ of the role's resource name.++ This value should be 4-63 characters, and valid characters+ are /[a-z][A-Z][0-9]/.+ requestBody:+ description: The role to create.+ content:+ application/json:+ schema:+ title: role+ description: The role to create.+ $ref: '#/components/schemas/bytebase.v1.Role'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ServiceAccount'- /v1/settings:+ $ref: '#/components/schemas/bytebase.v1.Role'+ /v1/roles/{role}:get:tags:- - SettingService- summary: ListSettings+ - RoleService+ summary: GetRoledescription: |-- Lists all workspace settings.- Permissions required: bb.settings.list- operationId: SettingService_ListSettings+ Retrieves a role by name.+ Permissions required: bb.roles.get+ operationId: RoleService_GetRole+ parameters:+ - name: role+ in: path+ description: The role id.+ required: true+ schema:+ type: stringresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ListSettingsResponse'- /v1/settings/{setting}:- get:+ $ref: '#/components/schemas/bytebase.v1.Role'+ delete:tags:- - SettingService- summary: GetSetting+ - RoleService+ summary: DeleteRoledescription: |-- Retrieves a workspace setting by name.- Permissions required: bb.settings.get- operationId: SettingService_GetSetting+ Deletes a custom role.+ Permissions required: bb.roles.delete+ operationId: RoleService_DeleteRoleparameters:- - name: setting+ - name: rolein: path- description: The setting id.+ description: The role id.required: trueschema:type: string@@ -13096,40 +13148,26 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Setting'+ $ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - SettingService- summary: UpdateSetting+ - RoleService+ summary: UpdateRoledescription: |-- Updates a workspace setting.- Permissions required: bb.settings.set- operationId: SettingService_UpdateSetting+ Updates a role's properties.+ Permissions required: bb.roles.update+ When allow_missing=true, also requires: bb.roles.create+ operationId: RoleService_UpdateRoleparameters:- - name: setting+ - name: rolein: path- description: The setting id.+ description: The role id.required: trueschema:type: string- - name: validateOnly- in: query- description: |-- validate_only is a flag to indicate whether to validate the setting value,- server would not persist the setting value if it is true.- schema:- type: boolean- title: validate_only- description: |-- validate_only is a flag to indicate whether to validate the setting value,- server would not persist the setting value if it is true.- - name: allowMissing- in: query- schema:- type: boolean- title: allow_missing- name: updateMaskin: query+ description: The list of fields to update.schema:type: stringdescription: |-@@ -13318,264 +13356,81 @@ paths:paths: "name"}- Or:-- mask {- paths: "sub_message"- }-- Note that oneof type names ("test_oneof" in this case) cannot be used in- paths.-- ## Field Mask Verification-- The implementation of any API method which has a FieldMask type field in the- request should verify the included field paths, and return an- `INVALID_ARGUMENT` error if any path is unmappable.- requestBody:- description: The setting to update.- content:- application/json:- schema:- title: setting- description: The setting to update.- $ref: '#/components/schemas/bytebase.v1.Setting'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.Setting'- /v1/sql/aiCompletion:- post:- tags:- - SQLService- summary: AICompletion- description: |-- Provides AI-powered SQL completion and generation.- Permissions required: None (authenticated users only, requires AI to be enabled)- operationId: SQLService_AICompletion- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AICompletionRequest'- required: true- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.AICompletionResponse'- /v1/subscription:- get:- tags:- - SubscriptionService- summary: GetSubscription- description: |-- GetSubscription returns the current subscription.- If there is no license, we will return a free plan subscription without expiration time.- If there is expired license, we will return a free plan subscription with the expiration time of the expired license.- Permissions required: None- operationId: SubscriptionService_GetSubscription- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.Subscription'- patch:- tags:- - SubscriptionService- summary: UpdateSubscription- description: |-- Updates the enterprise license subscription.- Permissions required: bb.settings.set- operationId: SubscriptionService_UpdateSubscription- parameters:+ Or:++ mask {+ paths: "sub_message"+ }++ Note that oneof type names ("test_oneof" in this case) cannot be used in+ paths.++ ## Field Mask Verification++ The implementation of any API method which has a FieldMask type field in the+ request should verify the included field paths, and return an+ `INVALID_ARGUMENT` error if any path is unmappable.- name: allowMissingin: querydescription: |-- If set to true, and the subscription is not found, a new subscription will be created.+ If set to true, and the role is not found, a new role will be created.In this situation, `update_mask` is ignored.schema:type: booleantitle: allow_missingdescription: |-- If set to true, and the subscription is not found, a new subscription will be created.+ If set to true, and the role is not found, a new role will be created.In this situation, `update_mask` is ignored.requestBody:+ description: The role to update.content:application/json:schema:- type: string- title: license- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.Subscription'- /v1/users:- get:- tags:- - UserService- summary: ListUsers- description: |-- List all users.- Any authenticated user can list users.- Permissions required: bb.users.list- operationId: UserService_ListUsers- parameters:- - name: pageSize- in: query- description: |-- The maximum number of users to return. The service may return fewer than- this value.- If unspecified, at most 10 users will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.- schema:- type: integer- title: page_size- format: int32- description: |-- The maximum number of users to return. The service may return fewer than- this value.- If unspecified, at most 10 users will be returned.- The maximum value is 1000; values above 1000 will be coerced to 1000.- - name: pageToken- in: query- description: |-- A page token, received from a previous `ListUsers` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListUsers` must match- the call that provided the page token.- schema:- type: string- title: page_token- description: |-- A page token, received from a previous `ListUsers` call.- Provide this to retrieve the subsequent page.-- When paginating, all other parameters provided to `ListUsers` must match- the call that provided the page token.- - name: showDeleted- in: query- description: Show deleted users if specified.- schema:- type: boolean- title: show_deleted- description: Show deleted users if specified.- - name: filter- in: query- description: |-- Filter is used to filter users returned in the list.- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec-- Supported filter:- - name: the user name, support "==" and ".matches()" operator.- - email: the user email, support "==" and ".matches()" operator.- - state: check State enum for values, support "==" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.-- For example:- name == "ed"- name.matches("ed")- email == "[email protected]"- email.matches("ed")- state == "DELETED"- project == "projects/sample-project"- You can combine filter conditions like:- name.matches("ed") && project == "projects/sample-project"- (name == "ed" || email == "[email protected]") && project == "projects/sample-project"- schema:- type: string- title: filter- description: |-- Filter is used to filter users returned in the list.- The syntax and semantics of CEL are documented at https://github.com/google/cel-spec-- Supported filter:- - name: the user name, support "==" and ".matches()" operator.- - email: the user email, support "==" and ".matches()" operator.- - state: check State enum for values, support "==" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.-- For example:- name == "ed"- name.matches("ed")- email == "[email protected]"- email.matches("ed")- state == "DELETED"- project == "projects/sample-project"- You can combine filter conditions like:- name.matches("ed") && project == "projects/sample-project"- (name == "ed" || email == "[email protected]") && project == "projects/sample-project"+ title: role+ description: The role to update.+ $ref: '#/components/schemas/bytebase.v1.Role'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.ListUsersResponse'+ $ref: '#/components/schemas/bytebase.v1.Role'+ /v1/schemaDesign:diffMetadata:post:tags:- - UserService- summary: CreateUser+ - SQLService+ summary: DiffMetadatadescription: |-- Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up.- Permissions required: bb.users.create (only when Disallow Signup is enabled)- operationId: UserService_CreateUser+ Computes schema differences between two database metadata.+ Permissions required: None+ operationId: SQLService_DiffMetadatarequestBody:- description: The user to create.content:application/json:schema:- title: user- description: The user to create.- $ref: '#/components/schemas/bytebase.v1.User'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.User'- /v1/users/me:- get:- tags:- - UserService- summary: GetCurrentUser- description: |-- Get the current authenticated user.- Permissions required: None- operationId: UserService_GetCurrentUser+ $ref: '#/components/schemas/bytebase.v1.DiffMetadataRequest'+ required: trueresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.User'- /v1/users/{user}:+ $ref: '#/components/schemas/bytebase.v1.DiffMetadataResponse'+ /v1/serviceAccounts/{serviceAccount}:get:tags:- - UserService- summary: GetUser+ - ServiceAccountService+ summary: GetServiceAccountdescription: |-- Get the user.- Any authenticated user can get the user.- Permissions required: bb.users.get- operationId: UserService_GetUser+ Gets a service account by name.+ Permissions required: bb.serviceAccounts.get+ operationId: ServiceAccountService_GetServiceAccountparameters:- - name: user+ - name: serviceAccountin: path- description: The user id.+ description: The serviceAccount id.required: trueschema:type: string@@ -13585,19 +13440,19 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.User'+ $ref: '#/components/schemas/bytebase.v1.ServiceAccount'delete:tags:- - UserService- summary: DeleteUser+ - ServiceAccountService+ summary: DeleteServiceAccountdescription: |-- Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted.- Permissions required: bb.users.delete- operationId: UserService_DeleteUser+ Deletes a service account.+ Permissions required: bb.serviceAccounts.delete+ operationId: ServiceAccountService_DeleteServiceAccountparameters:- - name: user+ - name: serviceAccountin: path- description: The user id.+ description: The serviceAccount id.required: trueschema:type: string@@ -13610,23 +13465,24 @@ paths:$ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - UserService- summary: UpdateUser+ - ServiceAccountService+ summary: UpdateServiceAccountdescription: |-- Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user.- Note: Email updates are not supported through this API. Use UpdateEmail instead.- Permissions required: bb.users.update (or self)- operationId: UserService_UpdateUser+ Updates a service account.+ Permissions required: bb.serviceAccounts.update+ operationId: ServiceAccountService_UpdateServiceAccountparameters:- - name: user+ - name: serviceAccountin: path- description: The user id.+ description: The serviceAccount id.required: trueschema:type: string- name: updateMaskin: query- description: The list of fields to update.+ description: |-+ The list of fields to update.+ Supported fields: title, service_key (triggers key rotation)schema:type: stringdescription: |-@@ -13829,193 +13685,81 @@ paths:The implementation of any API method which has a FieldMask type field in therequest should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.- - name: otpCode- in: query- description: The otp_code is used to verify the user's identity by MFA.- schema:- type: string- title: otp_code- description: The otp_code is used to verify the user's identity by MFA.- - name: regenerateTempMfaSecret- in: query- description: |-- The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.- This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.- schema:- type: boolean- title: regenerate_temp_mfa_secret- description: |-- The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.- This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.- - name: regenerateRecoveryCodes- in: query- description: The regenerate_recovery_codes flag means to regenerate recovery codes for user.- schema:- type: boolean- title: regenerate_recovery_codes- description: The regenerate_recovery_codes flag means to regenerate recovery codes for user.- - name: allowMissing- in: query- description: |-- If set to true, and the user is not found, a new user will be created.- In this situation, `update_mask` is ignored.- schema:- type: boolean- title: allow_missing- description: |-- If set to true, and the user is not found, a new user will be created.- In this situation, `update_mask` is ignored.requestBody:description: |-- The user to update.+ The service account to update.- The user's `name` field is used to identify the user to update.- Format: users/{email}+ The service account's `name` field is used to identify the service account to update.+ Format: serviceAccounts/{email}content:application/json:schema:- title: user+ title: service_accountdescription: |-- The user to update.+ The service account to update.- The user's `name` field is used to identify the user to update.- Format: users/{email}- $ref: '#/components/schemas/bytebase.v1.User'- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.User'- /v1/users/{user}:undelete:- post:- tags:- - UserService- summary: UndeleteUser- description: |-- Restores a deleted user.- Permissions required: bb.users.undelete- operationId: UserService_UndeleteUser- parameters:- - name: user- in: path- description: The user id.- required: true- schema:- type: string+ The service account's `name` field is used to identify the service account to update.+ Format: serviceAccounts/{email}+ $ref: '#/components/schemas/bytebase.v1.ServiceAccount'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.User'- /v1/users/{user}:updateEmail:+ $ref: '#/components/schemas/bytebase.v1.ServiceAccount'+ /v1/serviceAccounts/{serviceAccount}:undelete:post:tags:- - UserService- summary: UpdateEmail+ - ServiceAccountService+ summary: UndeleteServiceAccountdescription: |-- Updates a user's email address.- Permissions required: bb.users.updateEmail- operationId: UserService_UpdateEmail+ Restores a deleted service account.+ Permissions required: bb.serviceAccounts.undelete+ operationId: ServiceAccountService_UndeleteServiceAccountparameters:- - name: user+ - name: serviceAccountin: path- description: The user id.+ description: The serviceAccount id.required: trueschema:type: string- requestBody:- content:- application/json:- schema:- type: object- properties:- email:- type: string- title: email- description: The new email address.- title: UpdateEmailRequest- required:- additionalProperties: false- required: trueresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.User'- /v1/users:batchGet:+ $ref: '#/components/schemas/bytebase.v1.ServiceAccount'+ /v1/settings:get:tags:- - UserService- summary: BatchGetUsers+ - SettingService+ summary: ListSettingsdescription: |-- Get the users in batch.- Any authenticated user can batch get users.- Permissions required: bb.users.get- operationId: UserService_BatchGetUsers- parameters:- - name: names- in: query- description: |-- The user names to retrieve.- Format: users/{email}- required: true- schema:- type: array- items:- type: string- title: names- description: |-- The user names to retrieve.- Format: users/{email}+ Lists all workspace settings.+ Permissions required: bb.settings.list+ operationId: SettingService_ListSettingsresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.BatchGetUsersResponse'- /v1/workloadIdentities/{workloadIdentity}:+ $ref: '#/components/schemas/bytebase.v1.ListSettingsResponse'+ /v1/settings/{setting}:get:tags:- - WorkloadIdentityService- summary: GetWorkloadIdentity- description: |-- Gets a workload identity by name.- Permissions required: bb.workloadIdentities.get- operationId: WorkloadIdentityService_GetWorkloadIdentity- parameters:- - name: workloadIdentity- in: path- description: The workloadIdentity id.- required: true- schema:- type: string- responses:- "200":- description: Success- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'- delete:- tags:- - WorkloadIdentityService- summary: DeleteWorkloadIdentity+ - SettingService+ summary: GetSettingdescription: |-- Deletes a workload identity.- Permissions required: bb.workloadIdentities.delete- operationId: WorkloadIdentityService_DeleteWorkloadIdentity+ Retrieves a workspace setting by name.+ Permissions required: bb.settings.get+ operationId: SettingService_GetSettingparameters:- - name: workloadIdentity+ - name: settingin: path- description: The workloadIdentity id.+ description: The setting id.required: trueschema:type: string@@ -14025,27 +13769,40 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/google.protobuf.Empty'+ $ref: '#/components/schemas/bytebase.v1.Setting'patch:tags:- - WorkloadIdentityService- summary: UpdateWorkloadIdentity+ - SettingService+ summary: UpdateSettingdescription: |-- Updates a workload identity.- Permissions required: bb.workloadIdentities.update- operationId: WorkloadIdentityService_UpdateWorkloadIdentity+ Updates a workspace setting.+ Permissions required: bb.settings.set+ operationId: SettingService_UpdateSettingparameters:- - name: workloadIdentity+ - name: settingin: path- description: The workloadIdentity id.+ description: The setting id.required: trueschema:type: string- - name: updateMask+ - name: validateOnlyin: querydescription: |-- The list of fields to update.- Supported fields: title, workload_identity_config+ validate_only is a flag to indicate whether to validate the setting value,+ server would not persist the setting value if it is true.+ schema:+ type: boolean+ title: validate_only+ description: |-+ validate_only is a flag to indicate whether to validate the setting value,+ server would not persist the setting value if it is true.+ - name: allowMissing+ in: query+ schema:+ type: boolean+ title: allow_missing+ - name: updateMask+ in: queryschema:type: stringdescription: |-@@ -14249,115 +14006,249 @@ paths:request should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.requestBody:- description: |-- The workload identity to update.-- The workload identity's `name` field is used to identify the workload identity to update.- Format: workloadIdentities/{email}+ description: The setting to update.content:application/json:schema:- title: workload_identity- description: |-- The workload identity to update.-- The workload identity's `name` field is used to identify the workload identity to update.- Format: workloadIdentities/{email}- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'+ title: setting+ description: The setting to update.+ $ref: '#/components/schemas/bytebase.v1.Setting'+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Setting'+ /v1/sql/aiCompletion:+ post:+ tags:+ - SQLService+ summary: AICompletion+ description: |-+ Provides AI-powered SQL completion and generation.+ Permissions required: None (authenticated users only, requires AI to be enabled)+ operationId: SQLService_AICompletion+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.AICompletionRequest'+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.AICompletionResponse'+ /v1/subscription:+ get:+ tags:+ - SubscriptionService+ summary: GetSubscription+ description: |-+ GetSubscription returns the current subscription.+ If there is no license, we will return a free plan subscription without expiration time.+ If there is expired license, we will return a free plan subscription with the expiration time of the expired license.+ Permissions required: None+ operationId: SubscriptionService_GetSubscription+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.Subscription'+ patch:+ tags:+ - SubscriptionService+ summary: UpdateSubscription+ description: |-+ Updates the enterprise license subscription.+ Permissions required: bb.settings.set+ operationId: SubscriptionService_UpdateSubscription+ parameters:+ - name: allowMissing+ in: query+ description: |-+ If set to true, and the subscription is not found, a new subscription will be created.+ In this situation, `update_mask` is ignored.+ schema:+ type: boolean+ title: allow_missing+ description: |-+ If set to true, and the subscription is not found, a new subscription will be created.+ In this situation, `update_mask` is ignored.+ requestBody:+ content:+ application/json:+ schema:+ type: string+ title: licenseresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'- /v1/workloadIdentities/{workloadIdentity}:undelete:- post:+ $ref: '#/components/schemas/bytebase.v1.Subscription'+ /v1/users:+ get:tags:- - WorkloadIdentityService- summary: UndeleteWorkloadIdentity+ - UserService+ summary: ListUsersdescription: |-- Restores a deleted workload identity.- Permissions required: bb.workloadIdentities.undelete- operationId: WorkloadIdentityService_UndeleteWorkloadIdentity+ List all users.+ Any authenticated user can list users.+ Permissions required: bb.users.list+ operationId: UserService_ListUsersparameters:- - name: workloadIdentity- in: path- description: The workloadIdentity id.- required: true+ - name: pageSize+ in: query+ description: |-+ The maximum number of users to return. The service may return fewer than+ this value.+ If unspecified, at most 10 users will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.+ schema:+ type: integer+ title: page_size+ format: int32+ description: |-+ The maximum number of users to return. The service may return fewer than+ this value.+ If unspecified, at most 10 users will be returned.+ The maximum value is 1000; values above 1000 will be coerced to 1000.+ - name: pageToken+ in: query+ description: |-+ A page token, received from a previous `ListUsers` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListUsers` must match+ the call that provided the page token.+ schema:+ type: string+ title: page_token+ description: |-+ A page token, received from a previous `ListUsers` call.+ Provide this to retrieve the subsequent page.++ When paginating, all other parameters provided to `ListUsers` must match+ the call that provided the page token.+ - name: showDeleted+ in: query+ description: Show deleted users if specified.+ schema:+ type: boolean+ title: show_deleted+ description: Show deleted users if specified.+ - name: filter+ in: query+ description: |-+ Filter is used to filter users returned in the list.+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++ Supported filter:+ - name: the user name, support "==" and ".matches()" operator.+ - email: the user email, support "==" and ".matches()" operator.+ - state: check State enum for values, support "==" operator.+ - project: the project full name in "projects/{id}" format, support "==" operator.++ For example:+ name == "ed"+ name.matches("ed")+ email == "[email protected]"+ email.matches("ed")+ state == "DELETED"+ project == "projects/sample-project"+ You can combine filter conditions like:+ name.matches("ed") && project == "projects/sample-project"+ (name == "ed" || email == "[email protected]") && project == "projects/sample-project"schema:type: string+ title: filter+ description: |-+ Filter is used to filter users returned in the list.+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec++ Supported filter:+ - name: the user name, support "==" and ".matches()" operator.+ - email: the user email, support "==" and ".matches()" operator.+ - state: check State enum for values, support "==" operator.+ - project: the project full name in "projects/{id}" format, support "==" operator.++ For example:+ name == "ed"+ name.matches("ed")+ email == "[email protected]"+ email.matches("ed")+ state == "DELETED"+ project == "projects/sample-project"+ You can combine filter conditions like:+ name.matches("ed") && project == "projects/sample-project"+ (name == "ed" || email == "[email protected]") && project == "projects/sample-project"responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'- /v1/worksheets:+ $ref: '#/components/schemas/bytebase.v1.ListUsersResponse'post:tags:- - WorksheetService- summary: CreateWorksheet+ - UserService+ summary: CreateUserdescription: |-- Creates a personal worksheet used in SQL Editor. Any authenticated user can create their own worksheets.- Permissions required: None (authenticated users only)- operationId: WorksheetService_CreateWorksheet+ Creates a user. When Disallow Signup is enabled, requires bb.users.create permission; otherwise any user can sign up.+ Permissions required: bb.users.create (only when Disallow Signup is enabled)+ operationId: UserService_CreateUserrequestBody:- description: The worksheet to create.+ description: The user to create.content:application/json:schema:- title: worksheet- description: The worksheet to create.- $ref: '#/components/schemas/bytebase.v1.Worksheet'+ title: user+ description: The user to create.+ $ref: '#/components/schemas/bytebase.v1.User'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Worksheet'- /v1/worksheets/organizer:batchUpdate:- patch:+ $ref: '#/components/schemas/bytebase.v1.User'+ /v1/users/me:+ get:tags:- - WorksheetService- summary: BatchUpdateWorksheetOrganizer+ - UserService+ summary: GetCurrentUserdescription: |-- Batch update the organizers of worksheets.- The access is the same as UpdateWorksheet method.- Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_BatchUpdateWorksheetOrganizer- requestBody:- content:- application/json:- schema:- $ref: '#/components/schemas/bytebase.v1.BatchUpdateWorksheetOrganizerRequest'- required: true+ Get the current authenticated user.+ Permissions required: None+ operationId: UserService_GetCurrentUserresponses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.BatchUpdateWorksheetOrganizerResponse'- /v1/worksheets/{worksheet}:+ $ref: '#/components/schemas/bytebase.v1.User'+ /v1/users/{user}:get:tags:- - WorksheetService- summary: GetWorksheet+ - UserService+ summary: GetUserdescription: |-- Get a worksheet by name.- The users can access this method if,- - they are the creator of the worksheet;- - they have bb.worksheets.get permission on the workspace;- - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.- Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_GetWorksheet+ Get the user.+ Any authenticated user can get the user.+ Permissions required: bb.users.get+ operationId: UserService_GetUserparameters:- - name: worksheet+ - name: userin: path- description: The worksheet id.+ description: The user id.required: trueschema:type: string@@ -14367,20 +14258,19 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Worksheet'+ $ref: '#/components/schemas/bytebase.v1.User'delete:tags:- - WorksheetService- summary: DeleteWorksheet+ - UserService+ summary: DeleteUserdescription: |-- Delete a worksheet.- The access is the same as UpdateWorksheet method.- Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)- operationId: WorksheetService_DeleteWorksheet+ Deletes a user. Requires bb.users.delete permission with additional validation: the last remaining workspace admin cannot be deleted.+ Permissions required: bb.users.delete+ operationId: UserService_DeleteUserparameters:- - name: worksheet+ - name: userin: path- description: The worksheet id.+ description: The user id.required: trueschema:type: string@@ -14393,34 +14283,23 @@ paths:$ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - WorksheetService- summary: UpdateWorksheet+ - UserService+ summary: UpdateUserdescription: |-- Update a worksheet.- The users can access this method if,- - they are the creator of the worksheet;- - they have bb.worksheets.manage permission on the workspace;- - the sheet is shared with them with PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.- Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)- operationId: WorksheetService_UpdateWorksheet+ Updates a user. Users can update their own profile, or users with bb.users.update permission can update any user.+ Note: Email updates are not supported through this API. Use UpdateEmail instead.+ Permissions required: bb.users.update (or self)+ operationId: UserService_UpdateUserparameters:- - name: worksheet+ - name: userin: path- description: The worksheet id.+ description: The user id.required: trueschema:type: string- name: updateMaskin: query- description: |-- The list of fields to be updated.- Fields are specified relative to the worksheet.- (e.g., `title`, `statement`; *not* `worksheet.title` or `worksheet.statement`)- Only support update the following fields for now:- - `title`- - `statement`- - `starred`- - `visibility`+ description: The list of fields to update.schema:type: stringdescription: |-@@ -14623,53 +14502,223 @@ paths:The implementation of any API method which has a FieldMask type field in therequest should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.+ - name: otpCode+ in: query+ description: The otp_code is used to verify the user's identity by MFA.+ schema:+ type: string+ title: otp_code+ description: The otp_code is used to verify the user's identity by MFA.+ - name: regenerateTempMfaSecret+ in: query+ description: |-+ The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.+ This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.+ schema:+ type: boolean+ title: regenerate_temp_mfa_secret+ description: |-+ The regenerate_temp_mfa_secret flag means to regenerate temporary MFA secret for user.+ This is used for MFA setup. The temporary MFA secret and recovery codes will be returned in the response.+ - name: regenerateRecoveryCodes+ in: query+ description: The regenerate_recovery_codes flag means to regenerate recovery codes for user.+ schema:+ type: boolean+ title: regenerate_recovery_codes+ description: The regenerate_recovery_codes flag means to regenerate recovery codes for user.+ - name: allowMissing+ in: query+ description: |-+ If set to true, and the user is not found, a new user will be created.+ In this situation, `update_mask` is ignored.+ schema:+ type: boolean+ title: allow_missing+ description: |-+ If set to true, and the user is not found, a new user will be created.+ In this situation, `update_mask` is ignored.requestBody:description: |-- The worksheet to update.+ The user to update.- The worksheet's `name` field is used to identify the worksheet to update.- Format: worksheets/{worksheet}+ The user's `name` field is used to identify the user to update.+ Format: users/{email}content:application/json:schema:- title: worksheet+ title: userdescription: |-- The worksheet to update.+ The user to update.- The worksheet's `name` field is used to identify the worksheet to update.- Format: worksheets/{worksheet}- $ref: '#/components/schemas/bytebase.v1.Worksheet'+ The user's `name` field is used to identify the user to update.+ Format: users/{email}+ $ref: '#/components/schemas/bytebase.v1.User'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.Worksheet'- /v1/worksheets/{worksheet}/organizer:+ $ref: '#/components/schemas/bytebase.v1.User'+ /v1/users/{user}:undelete:+ post:+ tags:+ - UserService+ summary: UndeleteUser+ description: |-+ Restores a deleted user.+ Permissions required: bb.users.undelete+ operationId: UserService_UndeleteUser+ parameters:+ - name: user+ in: path+ description: The user id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.User'+ /v1/users/{user}:updateEmail:+ post:+ tags:+ - UserService+ summary: UpdateEmail+ description: |-+ Updates a user's email address.+ Permissions required: bb.users.updateEmail+ operationId: UserService_UpdateEmail+ parameters:+ - name: user+ in: path+ description: The user id.+ required: true+ schema:+ type: string+ requestBody:+ content:+ application/json:+ schema:+ type: object+ properties:+ email:+ type: string+ title: email+ description: The new email address.+ title: UpdateEmailRequest+ required:+ additionalProperties: false+ required: true+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.User'+ /v1/users:batchGet:+ get:+ tags:+ - UserService+ summary: BatchGetUsers+ description: |-+ Get the users in batch.+ Any authenticated user can batch get users.+ Permissions required: bb.users.get+ operationId: UserService_BatchGetUsers+ parameters:+ - name: names+ in: query+ description: |-+ The user names to retrieve.+ Format: users/{email}+ required: true+ schema:+ type: array+ items:+ type: string+ title: names+ description: |-+ The user names to retrieve.+ Format: users/{email}+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.BatchGetUsersResponse'+ /v1/workloadIdentities/{workloadIdentity}:+ get:+ tags:+ - WorkloadIdentityService+ summary: GetWorkloadIdentity+ description: |-+ Gets a workload identity by name.+ Permissions required: bb.workloadIdentities.get+ operationId: WorkloadIdentityService_GetWorkloadIdentity+ parameters:+ - name: workloadIdentity+ in: path+ description: The workloadIdentity id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'+ delete:+ tags:+ - WorkloadIdentityService+ summary: DeleteWorkloadIdentity+ description: |-+ Deletes a workload identity.+ Permissions required: bb.workloadIdentities.delete+ operationId: WorkloadIdentityService_DeleteWorkloadIdentity+ parameters:+ - name: workloadIdentity+ in: path+ description: The workloadIdentity id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/google.protobuf.Empty'patch:tags:- - WorksheetService- summary: UpdateWorksheetOrganizer+ - WorkloadIdentityService+ summary: UpdateWorkloadIdentitydescription: |-- Update the organizer of a worksheet.- The access is the same as UpdateWorksheet method.- Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_UpdateWorksheetOrganizer+ Updates a workload identity.+ Permissions required: bb.workloadIdentities.update+ operationId: WorkloadIdentityService_UpdateWorkloadIdentityparameters:- - name: worksheet+ - name: workloadIdentityin: path- description: The worksheet id.+ description: The workloadIdentity id.required: trueschema:type: string- name: updateMaskin: querydescription: |-- The list of fields to be updated.- Fields are specified relative to the worksheet organizer.- Only support update the following fields for now:- - `starred`+ The list of fields to update.+ Supported fields: title, workload_identity_configschema:type: stringdescription: |-@@ -14872,56 +14921,67 @@ paths:The implementation of any API method which has a FieldMask type field in therequest should verify the included field paths, and return an`INVALID_ARGUMENT` error if any path is unmappable.- - name: allowMissing- in: query- description: |-- If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.- In this situation, `update_mask` is ignored.- schema:- type: boolean- title: allow_missing- description: |-- If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created.- In this situation, `update_mask` is ignored.requestBody:description: |-- The organizer to update.+ The workload identity to update.- The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}+ The workload identity's `name` field is used to identify the workload identity to update.+ Format: workloadIdentities/{email}content:application/json:schema:- title: organizer+ title: workload_identitydescription: |-- The organizer to update.+ The workload identity to update.- The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}- $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'+ The workload identity's `name` field is used to identify the workload identity to update.+ Format: workloadIdentities/{email}+ $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'responses:"200":description: Successcontent:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'- /v1/worksheets:search:+ $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'+ /v1/workloadIdentities/{workloadIdentity}:undelete:post:+ tags:+ - WorkloadIdentityService+ summary: UndeleteWorkloadIdentity+ description: |-+ Restores a deleted workload identity.+ Permissions required: bb.workloadIdentities.undelete+ operationId: WorkloadIdentityService_UndeleteWorkloadIdentity+ parameters:+ - name: workloadIdentity+ in: path+ description: The workloadIdentity id.+ required: true+ schema:+ type: string+ responses:+ "200":+ description: Success+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'+ /v1/worksheets/organizer:batchUpdate:+ patch:tags:- WorksheetService- summary: SearchWorksheets+ summary: BatchUpdateWorksheetOrganizerdescription: |-- Search for worksheets.- This is used for finding my worksheets or worksheets shared by other people.- The sheet accessibility is the same as GetWorksheet().+ Batch update the organizers of worksheets.+ The access is the same as UpdateWorksheet method.Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)- operationId: WorksheetService_SearchWorksheets+ operationId: WorksheetService_BatchUpdateWorksheetOrganizerrequestBody:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsRequest'+ $ref: '#/components/schemas/bytebase.v1.BatchUpdateWorksheetOrganizerRequest'required: trueresponses:"200":@@ -14929,7 +14989,7 @@ paths:content:application/json:schema:- $ref: '#/components/schemas/bytebase.v1.SearchWorksheetsResponse'+ $ref: '#/components/schemas/bytebase.v1.BatchUpdateWorksheetOrganizerResponse'/v1/workspaces/{workspace}/databases:get:tags:@@ -18153,12 +18213,19 @@ components:bytebase.v1.CreateWorksheetRequest:type: objectproperties:+ parent:+ type: string+ title: parent+ description: |-+ The parent resource where this worksheet will be created.+ Format: projects/{project}worksheet:title: worksheetdescription: The worksheet to create.$ref: '#/components/schemas/bytebase.v1.Worksheet'title: CreateWorksheetRequestrequired:+ - parent- worksheetadditionalProperties: falsebytebase.v1.DataClassificationSetting:@@ -19137,7 +19204,7 @@ components:title: namedescription: |-The name of the worksheet to delete.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}title: DeleteWorksheetRequestrequired:- name@@ -20313,7 +20380,7 @@ components:title: namedescription: |-The name of the worksheet to retrieve.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}title: GetWorksheetRequestrequired:- name@@ -25559,6 +25626,12 @@ components:bytebase.v1.SearchWorksheetsRequest:type: objectproperties:+ parent:+ type: string+ title: parent+ description: |-+ The parent resource of the worksheets.+ Format: projects/{project}filter:type: stringtitle: filter@@ -25570,7 +25643,6 @@ components:- creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.- starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.- visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.- - project: the project full name in "projects/{id}" format, support "==" operator.For example:creator == "users/{email}"@@ -25579,8 +25651,9 @@ components:starred == falsevisibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]visibility == "PRIVATE"- project == "projects/{project resource id}"title: SearchWorksheetsRequest+ required:+ - parentadditionalProperties: falsebytebase.v1.SearchWorksheetsResponse:type: object@@ -28007,7 +28080,7 @@ components:The organizer to update.The organizer's `worksheet` field is used to identify the worksheet.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}$ref: '#/components/schemas/bytebase.v1.WorksheetOrganizer'updateMask:title: update_mask@@ -28036,7 +28109,7 @@ components:The worksheet to update.The worksheet's `name` field is used to identify the worksheet to update.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}$ref: '#/components/schemas/bytebase.v1.Worksheet'updateMask:title: update_mask@@ -28336,13 +28409,14 @@ components:description: |-(IMMUTABLE) The name of the worksheet resource, generated by the server.Canonical parent is project.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}project:type: stringtitle: projectdescription: |-The project resource name.Format: projects/{project}+ readOnly: truedatabase:type: stringtitle: database@@ -28406,7 +28480,6 @@ components:title: Worksheetrequired:- name- - project- title- content- visibility@@ -28427,7 +28500,7 @@ components:title: worksheetdescription: |-The name of the worksheet.- Format: worksheets/{worksheet}+ Format: projects/{project}/worksheets/{worksheet}starred:type: booleantitle: starreddiff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 253a6b344c..1b860b1810 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -11064,6 +11064,7 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent resource where this worksheet will be created. Format: projects/{project} || worksheet | [Worksheet](#bytebase-v1-Worksheet) | | The worksheet to create. |@@ -11079,7 +11080,7 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the worksheet to delete. Format: worksheets/{worksheet} |+| name | [string](#string) | | The name of the worksheet to delete. Format: projects/{project}/worksheets/{worksheet} |@@ -11094,7 +11095,7 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the worksheet to retrieve. Format: worksheets/{worksheet} |+| name | [string](#string) | | The name of the worksheet to retrieve. Format: projects/{project}/worksheets/{worksheet} |@@ -11109,11 +11110,12 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |+| parent | [string](#string) | | The parent resource of the worksheets. Format: projects/{project} || filter | [string](#string) | | To filter the search result. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec-Supported filter: - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator. - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator. - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator. - project: the project full name in "projects/{id}" format, support "==" operator.+Supported filter: - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator. - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator. - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.-For example: creator == "users/{email}" creator != "users/{email}" starred == true starred == false visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"] visibility == "PRIVATE" project == "projects/{project resource id}" |+For example: creator == "users/{email}" creator != "users/{email}" starred == true starred == false visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"] visibility == "PRIVATE" |@@ -11145,7 +11147,7 @@ For example: creator == "users/{email}" creator != "users/{email}| ----- | ---- | ----- | ----------- || organizer | [WorksheetOrganizer](#bytebase-v1-WorksheetOrganizer) | | The organizer to update.-The organizer's `worksheet` field is used to identify the worksheet. Format: worksheets/{worksheet} |+The organizer's `worksheet` field is used to identify the worksheet. Format: projects/{project}/worksheets/{worksheet} || update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. Fields are specified relative to the worksheet organizer. Only support update the following fields for now: - `starred` || allow_missing | [bool](#bool) | | If set to true, and the worksheet organizer is not found, a new worksheet organizer will be created. In this situation, `update_mask` is ignored. |@@ -11164,7 +11166,7 @@ The organizer's `worksheet` field is used to identify the worksheet. Format:| ----- | ---- | ----- | ----------- || worksheet | [Worksheet](#bytebase-v1-Worksheet) | | The worksheet to update.-The worksheet's `name` field is used to identify the worksheet to update. Format: worksheets/{worksheet} |+The worksheet's `name` field is used to identify the worksheet to update. Format: projects/{project}/worksheets/{worksheet} || update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. Fields are specified relative to the worksheet. (e.g., `title`, `statement`; *not* `worksheet.title` or `worksheet.statement`) Only support update the following fields for now: - `title` - `statement` - `starred` - `visibility` |@@ -11180,7 +11182,7 @@ The worksheet's `name` field is used to identify the worksheet to update. Fo| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the worksheet resource, generated by the server. Canonical parent is project. Format: worksheets/{worksheet} |+| name | [string](#string) | | The name of the worksheet resource, generated by the server. Canonical parent is project. Format: projects/{project}/worksheets/{worksheet} || project | [string](#string) | | The project resource name. Format: projects/{project} || database | [string](#string) | | The database resource name. Format: instances/{instance}/databases/{database} If the database parent doesn't exist, the database field is empty. || title | [string](#string) | | The title of the worksheet. |@@ -11206,7 +11208,7 @@ The worksheet's `name` field is used to identify the worksheet to update. Fo| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| worksheet | [string](#string) | | The name of the worksheet. Format: worksheets/{worksheet} |+| worksheet | [string](#string) | | The name of the worksheet. Format: projects/{project}/worksheets/{worksheet} || starred | [bool](#bool) | | starred means if the worksheet is starred. || folders | [string](#string) | repeated | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 7a4eb4e67d..ecdb86af4d 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -31300,6 +31300,14 @@ Permissions required: bb.workloadIdentities.undelete</p></td></thead><tbody>+ <tr>+ <td>parent</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The parent resource where this worksheet will be created.+Format: projects/{project} </p></td>+ </tr>+<tr><td>worksheet</td><td><a href="#bytebase.v1.Worksheet">Worksheet</a></td>@@ -31329,7 +31337,7 @@ Permissions required: bb.workloadIdentities.undelete</p></td><td><a href="#string">string</a></td><td></td><td><p>The name of the worksheet to delete.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr></tbody>@@ -31354,7 +31362,7 @@ Format: worksheets/{worksheet} </p></td><td><a href="#string">string</a></td><td></td><td><p>The name of the worksheet to retrieve.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr></tbody>@@ -31374,6 +31382,14 @@ Format: worksheets/{worksheet} </p></td></thead><tbody>+ <tr>+ <td>parent</td>+ <td><a href="#string">string</a></td>+ <td></td>+ <td><p>The parent resource of the worksheets.+Format: projects/{project} </p></td>+ </tr>+<tr><td>filter</td><td><a href="#string">string</a></td>@@ -31385,7 +31401,6 @@ Supported filter:- creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.- starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.- visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.-- project: the project full name in "projects/{id}" format, support "==" operator.For example:creator == "users/{email}"@@ -31393,8 +31408,7 @@ creator != "users/{email}"starred == truestarred == falsevisibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]-visibility == "PRIVATE"-project == "projects/{project resource id}" </p></td>+visibility == "PRIVATE" </p></td></tr></tbody>@@ -31445,7 +31459,7 @@ project == "projects/{project resource id}" </p></td><td><p>The organizer to update.The organizer's `worksheet` field is used to identify the worksheet.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr><tr>@@ -31490,7 +31504,7 @@ In this situation, `update_mask` is ignored. </p></td><td><p>The worksheet to update.The worksheet's `name` field is used to identify the worksheet to update.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr><tr>@@ -31530,7 +31544,7 @@ Only support update the following fields for now:<td></td><td><p>The name of the worksheet resource, generated by the server.Canonical parent is project.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr><tr>@@ -31638,7 +31652,7 @@ use GetWorksheet() request to retrieve the full content. </p></td><td><a href="#string">string</a></td><td></td><td><p>The name of the worksheet.-Format: worksheets/{worksheet} </p></td>+Format: projects/{project}/worksheets/{worksheet} </p></td></tr><tr>@@ -31803,7 +31817,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>CreateWorksheet</td><td>POST</td>- <td>/v1/worksheets</td>+ <td>/v1/{parent=projects/*}/worksheets</td><td>worksheet</td></tr>@@ -31813,7 +31827,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>GetWorksheet</td><td>GET</td>- <td>/v1/{name=worksheets/*}</td>+ <td>/v1/{name=projects/*/worksheets/*}</td><td></td></tr>@@ -31823,7 +31837,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>SearchWorksheets</td><td>POST</td>- <td>/v1/worksheets:search</td>+ <td>/v1/{parent=projects/*}/worksheets:search</td><td>*</td></tr>@@ -31833,7 +31847,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>UpdateWorksheet</td><td>PATCH</td>- <td>/v1/{worksheet.name=worksheets/*}</td>+ <td>/v1/{worksheet.name=projects/*/worksheets/*}</td><td>worksheet</td></tr>@@ -31843,7 +31857,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>UpdateWorksheetOrganizer</td><td>PATCH</td>- <td>/v1/{organizer.worksheet=worksheets/*}/organizer</td>+ <td>/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer</td><td>organizer</td></tr>@@ -31863,7 +31877,7 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR<tr><td>DeleteWorksheet</td><td>DELETE</td>- <td>/v1/{name=worksheets/*}</td>+ <td>/v1/{name=projects/*/worksheets/*}</td><td></td></tr>diff --git a/proto/v1/v1/worksheet_service.proto b/proto/v1/v1/worksheet_service.protoindex 309397d0a5..9d2b0dd486 100644--- a/proto/v1/v1/worksheet_service.proto+++ b/proto/v1/v1/worksheet_service.proto@@ -19,10 +19,10 @@ service WorksheetService {// Permissions required: None (authenticated users only)rpc CreateWorksheet(CreateWorksheetRequest) returns (Worksheet) {option (google.api.http) = {- post: "/v1/worksheets"+ post: "/v1/{parent=projects/*}/worksheets"body: "worksheet"};- option (google.api.method_signature) = "worksheet";+ option (google.api.method_signature) = "parent,worksheet";option (bytebase.v1.auth_method) = CUSTOM;}@@ -33,7 +33,7 @@ service WorksheetService {// - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)rpc GetWorksheet(GetWorksheetRequest) returns (Worksheet) {- option (google.api.http) = {get: "/v1/{name=worksheets/*}"};+ option (google.api.http) = {get: "/v1/{name=projects/*/worksheets/*}"};option (google.api.method_signature) = "name";option (bytebase.v1.auth_method) = CUSTOM;}@@ -44,9 +44,10 @@ service WorksheetService {// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)rpc SearchWorksheets(SearchWorksheetsRequest) returns (SearchWorksheetsResponse) {option (google.api.http) = {- post: "/v1/worksheets:search"+ post: "/v1/{parent=projects/*}/worksheets:search"body: "*"};+ option (google.api.method_signature) = "parent";option (bytebase.v1.auth_method) = CUSTOM;}@@ -58,7 +59,7 @@ service WorksheetService {// Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)rpc UpdateWorksheet(UpdateWorksheetRequest) returns (Worksheet) {option (google.api.http) = {- patch: "/v1/{worksheet.name=worksheets/*}"+ patch: "/v1/{worksheet.name=projects/*/worksheets/*}"body: "worksheet"};option (google.api.method_signature) = "worksheet,update_mask";@@ -70,7 +71,7 @@ service WorksheetService {// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)rpc UpdateWorksheetOrganizer(UpdateWorksheetOrganizerRequest) returns (WorksheetOrganizer) {option (google.api.http) = {- patch: "/v1/{organizer.worksheet=worksheets/*}/organizer"+ patch: "/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer"body: "organizer"};option (google.api.method_signature) = "organizer,update_mask";@@ -92,20 +93,24 @@ service WorksheetService {// The access is the same as UpdateWorksheet method.// Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets)rpc DeleteWorksheet(DeleteWorksheetRequest) returns (google.protobuf.Empty) {- option (google.api.http) = {delete: "/v1/{name=worksheets/*}"};+ option (google.api.http) = {delete: "/v1/{name=projects/*/worksheets/*}"};option (google.api.method_signature) = "name";option (bytebase.v1.auth_method) = CUSTOM;}}message CreateWorksheetRequest {+ // The parent resource where this worksheet will be created.+ // Format: projects/{project}+ string parent = 1 [(google.api.field_behavior) = REQUIRED];+// The worksheet to create.- Worksheet worksheet = 1 [(google.api.field_behavior) = REQUIRED];+ Worksheet worksheet = 2 [(google.api.field_behavior) = REQUIRED];}message GetWorksheetRequest {// The name of the worksheet to retrieve.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}string name = 1 [(google.api.field_behavior) = REQUIRED];}@@ -113,7 +118,7 @@ message UpdateWorksheetRequest {// The worksheet to update.//// The worksheet's `name` field is used to identify the worksheet to update.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}Worksheet worksheet = 1 [(google.api.field_behavior) = REQUIRED];// The list of fields to be updated.@@ -139,7 +144,7 @@ message UpdateWorksheetOrganizerRequest {// The organizer to update.//// The organizer's `worksheet` field is used to identify the worksheet.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}WorksheetOrganizer organizer = 1 [(google.api.field_behavior) = REQUIRED];// The list of fields to be updated.@@ -155,7 +160,7 @@ message UpdateWorksheetOrganizerRequest {message WorksheetOrganizer {// The name of the worksheet.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}string worksheet = 1 [(google.api.field_behavior) = REQUIRED];// starred means if the worksheet is starred.@@ -166,11 +171,15 @@ message WorksheetOrganizer {message DeleteWorksheetRequest {// The name of the worksheet to delete.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}string name = 1 [(google.api.field_behavior) = REQUIRED];}message SearchWorksheetsRequest {+ // The parent resource of the worksheets.+ // Format: projects/{project}+ string parent = 1 [(google.api.field_behavior) = REQUIRED];+// To filter the search result.// The syntax and semantics of CEL are documented at https://github.com/google/cel-spec//@@ -178,7 +187,6 @@ message SearchWorksheetsRequest {// - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.// - starred: should be "true" or "false", filter starred/unstarred sheets, support "==" operator.// - visibility: check Visibility enum in the Worksheet message for values, support "==" and "in [xx]" operator.- // - project: the project full name in "projects/{id}" format, support "==" operator.//// For example:// creator == "users/{email}"@@ -187,8 +195,7 @@ message SearchWorksheetsRequest {// starred == false// visibility in ["PRIVATE", "PROJECT_READ", "PROJECT_WRITE"]// visibility == "PRIVATE"- // project == "projects/{project resource id}"- string filter = 1;+ string filter = 2;}message SearchWorksheetsResponse {@@ -199,7 +206,7 @@ message SearchWorksheetsResponse {message Worksheet {// The name of the worksheet resource, generated by the server.// Canonical parent is project.- // Format: worksheets/{worksheet}+ // Format: projects/{project}/worksheets/{worksheet}string name = 1 [(google.api.field_behavior) = REQUIRED,(google.api.field_behavior) = IMMUTABLE@@ -207,7 +214,7 @@ message Worksheet {// The project resource name.// Format: projects/{project}- string project = 2 [(google.api.field_behavior) = REQUIRED];+ string project = 2 [(google.api.field_behavior) = OUTPUT_ONLY];// The database resource name.// Format: instances/{instance}/databases/{database}