diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..f24b757ba3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +secrets.env diff --git a/README.md b/README.md index 5c357471bf..7a8c78ecf4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,16 @@ Backstage is an open platform for building developer portals. ## Getting started +### Protobuf Definitions + +To generate the Protobuf definitions in Go and TypeScript, run the following command from the root with [Prototool](https://github.com/uber/prototool): + +```bash +$ prototool generate ./proto +``` + +See [proto/README.md](proto/README.md) for more information. + ## Plugins ### Creating a Plugin diff --git a/backend/builds/ghactions/client.go b/backend/builds/ghactions/client.go new file mode 100644 index 0000000000..647197571c --- /dev/null +++ b/backend/builds/ghactions/client.go @@ -0,0 +1,85 @@ +package ghactions + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "os" +) + +type Client struct { + client *http.Client + baseURL string + accessToken string +} + +func NewFromEnv() (*Client, error) { + accessToken := os.Getenv("BOSS_GH_ACCESS_TOKEN") + + if accessToken == "" { + return nil, fmt.Errorf("BOSS_GH_ACCESS_TOKEN not set") + } + + return New(http.DefaultClient, "https://api.github.com", accessToken), nil +} + +func New(client *http.Client, baseURL, accessToken string) *Client { + return &Client{ + client: client, + baseURL: baseURL, + accessToken: accessToken, + } +} + +func (c *Client) createRequest(ctx context.Context, owner, repo, path string) (*http.Request, error) { + url := fmt.Sprintf("%s/repos/%s/%s/actions%s", c.baseURL, owner, repo, path) + req, err := http.NewRequest(http.MethodGet, url, nil) + if err != nil { + return nil, err + } + + req.Header.Add("Authorization", "Bearer "+c.accessToken) + + return req.WithContext(ctx), nil +} + +func (c *Client) ListWorkflowRuns(ctx context.Context, owner, repo string) (*WorkflowRunsListResponse, error) { + req, err := c.createRequest(ctx, owner, repo, "/runs") + if err != nil { + return nil, err + } + + res, err := c.client.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + + var resData WorkflowRunsListResponse + if err := json.NewDecoder(res.Body).Decode(&resData); err != nil { + return nil, err + } + + return &resData, nil +} + +func (c *Client) GetWorkflowRun(ctx context.Context, owner, repo, runId string) (*WorkflowRunResponse, error) { + req, err := c.createRequest(ctx, owner, repo, fmt.Sprintf("/runs/%s", runId)) + if err != nil { + return nil, err + } + + res, err := c.client.Do(req) + if err != nil { + return nil, err + } + defer res.Body.Close() + + var resData WorkflowRunResponse + if err := json.NewDecoder(res.Body).Decode(&resData); err != nil { + return nil, err + } + + return &resData, nil +} diff --git a/backend/builds/ghactions/model.go b/backend/builds/ghactions/model.go new file mode 100644 index 0000000000..3b6844c2f7 --- /dev/null +++ b/backend/builds/ghactions/model.go @@ -0,0 +1,53 @@ +package ghactions + +type User struct { + Name string `json:"name"` // "Octo Cat" + Email string `json:"email"` // "octocat@github.com" +} + +type Commit struct { + ID string `json:"id"` // "acb5820ced9479c074f688cc328bf03f341a511d" + TreeID string `json:"tree_id"` // "d23f6eedb1e1b9610bbc754ddb5197bfe7271223" + Message string `json:"message"` // "Create linter.yml" + Timestamp string `json:"timestamp"` // "2020-01-22T19:33:05Z" + Author User `json:"author"` + Committer User `json:"committer"` +} + +type Repository struct { + ID int64 `json:"id"` // 217723378 + NodeID string `json:"node_id"` // MDEwOlJlcG9zaXRvcnkyMTc3MjMzNzg=" + Name string `json:"name"` // o-repo" + FullName string `json:"full_name"` // "octo-org/octo-repo" + HTMLURL string `json:"html_url"` // "https://github.com/octo-org/octo-repo" +} + +type WorkflowRunResponse struct { + ID int64 `json:"id"` // 30433642 + NodeID string `json:"node_id"` // "MDEyOldvcmtmbG93IFJ1bjI2OTI4OQ==" + HeadBranch string `json:"head_branch"` // "master" + HeadSha string `json:"head_sha"` // "acb5820ced9479c074f688cc328bf03f341a511d" + RunNumber int64 `json:"run_number"` // 562 + CheckSuiteID int64 `json:"check_suite_id"` // 414944374 + Event string `json:"event"` // "push" + Status string `json:"status"` // "queued" + Conclusion *string `json:"conclusion"` // null + URL string `json:"url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642" + HTMLURL string `json:"html_url"` // "https://github.com/octo-org/octo-repo/actions/runs/30433642" + CreatedAt string `json:"created_at"` // "2020-01-22T19:33:08Z" + UpdatedAt string `json:"updated_at"` // "2020-01-22T19:33:08Z" + JobsURL string `json:"jobs_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs" + LogsURL string `json:"logs_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs" + ArtifactsURL string `json:"artifacts_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts" + CancelURL string `json:"cancel_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel" + RerunURL string `json:"rerun_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun" + WorkflowURL string `json:"workflow_url"` // "https://api.github.com/repos/octo-org/octo-repo/actions/workflows/30433642" + HeadCommit Commit `json:"head_commit"` + Repository Repository `json:"repository"` + HeadRepository Repository `json:"head_repository"` +} + +type WorkflowRunsListResponse struct { + TotalCount int64 `json:"total_count"` + Runs []WorkflowRunResponse `json:"workflow_runs"` +} diff --git a/backend/builds/go.mod b/backend/builds/go.mod new file mode 100644 index 0000000000..de684f7593 --- /dev/null +++ b/backend/builds/go.mod @@ -0,0 +1,10 @@ +module github.com/spotify/backstage/builds + +go 1.12 + +replace github.com/spotify/backstage/proto => ../proto + +require ( + github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000 + google.golang.org/grpc v1.27.1 +) diff --git a/backend/builds/go.sum b/backend/builds/go.sum new file mode 100644 index 0000000000..2193d76f62 --- /dev/null +++ b/backend/builds/go.sum @@ -0,0 +1,54 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/backend/builds/main.go b/backend/builds/main.go new file mode 100644 index 0000000000..6dbf49de1f --- /dev/null +++ b/backend/builds/main.go @@ -0,0 +1,34 @@ +package main + +import ( + "log" + "net" + + "github.com/spotify/backstage/builds/ghactions" + "github.com/spotify/backstage/builds/service" + buildsv1 "github.com/spotify/backstage/proto/builds/v1" + + "google.golang.org/grpc" +) + +const ( + port = ":50051" +) + +func main() { + lis, err := net.Listen("tcp", port) + if err != nil { + log.Fatalf("Failed to listen: %v", err) + } + grpcServer := grpc.NewServer() + + ghClient, err := ghactions.NewFromEnv() + if err != nil { + log.Fatalf("Failed to create github client, %s", err) + } + + buildsv1.RegisterBuildsServer(grpcServer, service.New(ghClient)) + + log.Println("Serving Builds Service") + grpcServer.Serve(lis) +} diff --git a/backend/builds/service/service.go b/backend/builds/service/service.go new file mode 100644 index 0000000000..1b10fda980 --- /dev/null +++ b/backend/builds/service/service.go @@ -0,0 +1,116 @@ +package service + +import ( + "context" + "fmt" + "regexp" + + "github.com/spotify/backstage/builds/ghactions" + buildsv1 "github.com/spotify/backstage/proto/builds/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type service struct { + ghClient *ghactions.Client +} + +var _ buildsv1.BuildsServer = (*service)(nil) + +// New creates a new identity data server +func New(ghClient *ghactions.Client) buildsv1.BuildsServer { + return &service{ghClient} +} + +func (s *service) ListBuilds(ctx context.Context, req *buildsv1.ListBuildsRequest) (*buildsv1.ListBuildsReply, error) { + owner := "spotify" + repo := "backstage" + + result, err := s.ghClient.ListWorkflowRuns(ctx, owner, repo) + if err != nil { + return nil, status.Errorf(codes.Internal, "Failed to fetch workflow runs for %s/%s, %s", owner, repo, err) + } + + builds := make([]*buildsv1.Build, len(result.Runs)) + + for i, run := range result.Runs { + builds[i] = s.transformBuild(owner, repo, &run) + } + + return &buildsv1.ListBuildsReply{ + EntityUri: "", + Builds: builds, + }, nil +} + +func (s *service) GetBuild(ctx context.Context, req *buildsv1.GetBuildRequest) (*buildsv1.GetBuildReply, error) { + uri := req.GetBuildUri() + + owner, repo, runID, err := s.parseBuildURI(uri) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "Invalid build URI '%s', %s", uri, err) + } + + run, err := s.ghClient.GetWorkflowRun(ctx, owner, repo, runID) + if err != nil { + return nil, status.Errorf(codes.Internal, "Failed to fetch workflow run for %s/%s/%s, %s", owner, repo, runID, err) + } + + return &buildsv1.GetBuildReply{ + Build: s.transformBuild(owner, repo, run), + Details: &buildsv1.BuildDetails{ + Author: run.HeadCommit.Author.Name, + LogUrl: run.LogsURL, + OverviewUrl: run.HTMLURL, + }, + }, nil +} + +func (s *service) transformBuild(owner, repo string, run *ghactions.WorkflowRunResponse) *buildsv1.Build { + stat := buildsv1.BuildStatus_NULL + switch run.Status { + case "queued": + stat = buildsv1.BuildStatus_PENDING + case "in_progress": + stat = buildsv1.BuildStatus_RUNNING + case "completed": + if run.Conclusion != nil { + switch *run.Conclusion { + case "success": + stat = buildsv1.BuildStatus_SUCCESS + case "neutral": + stat = buildsv1.BuildStatus_SUCCESS + case "failure": + stat = buildsv1.BuildStatus_FAILURE + case "cancelled": + stat = buildsv1.BuildStatus_FAILURE + case "timed_out": + stat = buildsv1.BuildStatus_FAILURE + case "action_required": + stat = buildsv1.BuildStatus_RUNNING + } + } + } + + return &buildsv1.Build{ + Uri: fmt.Sprintf("entity:build:%s/%s/%d", owner, repo, run.ID), + CommitId: run.HeadCommit.ID, + Message: run.HeadCommit.Message, + Status: stat, + } +} + +var entityURIRegex = regexp.MustCompile("^entity:build:([^/:]+)/([^/:]+)/([^/:]+)$") + +func (s *service) parseBuildURI(uri string) (owner, repo, runID string, err error) { + if uri == "" { + return "", "", "", fmt.Errorf("uri is empty") + } + + match := entityURIRegex.FindStringSubmatch(uri) + if err != nil { + return "", "", "", fmt.Errorf("uri does not match") + } + + return match[1], match[2], match[3], nil +} diff --git a/backend/inventory/app/server.go b/backend/inventory/app/server.go index 5b756b7815..02b0b06f68 100644 --- a/backend/inventory/app/server.go +++ b/backend/inventory/app/server.go @@ -3,6 +3,7 @@ package app import ( "context" "fmt" + "github.com/spotify/backstage/inventory/storage" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -18,16 +19,41 @@ type Server struct { func (s *Server) CreateEntity(ctx context.Context, req *pb.CreateEntityRequest) (*pb.CreateEntityReply, error) { err := s.Storage.CreateEntity(req.GetEntity().GetUri()) if err != nil { - return nil, status.Error(codes.Internal, "could not create entity") + return nil, status.Error(codes.Internal, "could not create entity") } - return &pb.CreateEntityReply{Entity: req.GetEntity()} , nil + return &pb.CreateEntityReply{Entity: req.GetEntity()}, nil } // GetEntity returns an inventory Entity with the selected facts func (s *Server) GetEntity(ctx context.Context, req *pb.GetEntityRequest) (*pb.GetEntityReply, error) { + var facts []*pb.Fact entityUri, err := s.Storage.GetEntity(req.GetEntity().GetUri()) if err != nil { return nil, status.Error(codes.Internal, fmt.Sprintf("could not get entity %v", err)) } - return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri}}, nil + for _, factName := range req.GetIncludeFacts() { + value, err := s.Storage.GetFact(entityUri, factName) + if err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("could not get fact %v for %v" , factName, entityUri)) + } + facts = append(facts, &pb.Fact{Name: factName, Value: value}) + } + + return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri}, Facts: facts}, nil +} + +func (s *Server) SetFact(ctx context.Context, req *pb.SetFactRequest) (*pb.SetFactReply, error) { + err := s.Storage.SetFact(req.EntityUri, req.Name, req.Value) + if err != nil { + return nil, status.Error(codes.Internal, "could not set fact") + } + return &pb.SetFactReply{Fact: &pb.Fact{Name: req.GetName(), Value: req.GetValue()}}, nil +} + +func (s *Server) GetFact(ctx context.Context, req *pb.GetFactRequest) (*pb.GetFactReply, error) { + val, err := s.Storage.GetFact(req.EntityUri, req.Name) + if err != nil { + return nil, status.Error(codes.Internal, "could not set fact") + } + return &pb.GetFactReply{Fact: &pb.Fact{Name: req.GetName(), Value: val}}, nil } diff --git a/backend/inventory/app/server_test.go b/backend/inventory/app/server_test.go index 5f4253752a..fd6311645e 100644 --- a/backend/inventory/app/server_test.go +++ b/backend/inventory/app/server_test.go @@ -3,42 +3,16 @@ package app import ( "context" "fmt" - "github.com/spotify/backstage/inventory/storage" "io/ioutil" "os" + "reflect" "testing" + "github.com/spotify/backstage/inventory/storage" + pb "github.com/spotify/backstage/proto/inventory/v1" ) -type TestStorage struct { - Storage *storage.Storage - Path string -} - -// NewTestStorage returns a TestStorage using a temporary path. -func NewTestStorage() *TestStorage { - f, err := ioutil.TempFile("", "") - if err != nil { - panic(fmt.Sprintf("temp file: %s", err)) - } - path := f.Name() - f.Close() - os.Remove(path) - // Open the database. - - config := storage.Config{Path: path} - storage, _ := storage.OpenStorage(config) - // Return wrapped type. - return &TestStorage{Storage: storage, Path: path} -} - -// Close and delete Bolt database. -func (db *TestStorage) Close() { - defer os.Remove(db.Path) - db.Storage.Close() -} - func TestServerCreateEntity(t *testing.T) { testStorage := NewTestStorage() defer testStorage.Close() @@ -50,7 +24,7 @@ func TestServerCreateEntity(t *testing.T) { if err != nil { t.Errorf("ServerTest(CreateEntity) got unexpected error %v", err) } - if resp.GetEntity().GetUri() != entity.GetUri() { + if resp.GetEntity().GetUri() != entity.GetUri() { t.Errorf("ServerTest(CreateEntity) expected %v, but got %v", entity.GetUri(), resp.GetEntity().GetUri()) } } @@ -76,3 +50,97 @@ func TestServerGetEntity(t *testing.T) { t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetEntity().GetUri(), entity.GetUri()) } } + +func TestServerGetEntityWithIncludedFacts(t *testing.T) { + testStorage := NewTestStorage() + defer testStorage.Close() + s := Server{Storage: testStorage.Storage} + + entityUri := "boss://test/test" + setFactReq := &pb.SetFactRequest{EntityUri: entityUri, Name: "test-name", Value: "test-value"} + s.SetFact(context.Background(), setFactReq) + + entity := &pb.Entity{Uri: entityUri} + req := &pb.GetEntityRequest{Entity: entity, IncludeFacts: []string{"test-name"}} + + resp, err := s.GetEntity(context.Background(), req) + if err != nil { + t.Errorf("ServerTest(GetEntity) got unexpected error %v", err) + } + if resp == nil { + t.Errorf("ServerTest(GetEntity) returned nil") + } + expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}} + if !reflect.DeepEqual(resp.GetFacts(), expectedFacts) { + t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetFacts(), expectedFacts) + } +} + +func TestServerSetFactForExistingEntity(t *testing.T) { + testStorage := NewTestStorage() + defer testStorage.Close() + s := Server{Storage: testStorage.Storage} + + entity := &pb.Entity{Uri: "boss://test/test"} + createReq := &pb.CreateEntityRequest{Entity: entity} + s.CreateEntity(context.Background(), createReq) + + req := &pb.SetFactRequest{EntityUri: "boss://test/test", Name: "test-name", Value: "test-value"} + resp, err := s.SetFact(context.Background(), req) + if err != nil { + t.Errorf("ServerTest(SetFact) got unexpected error %v", err) + } + if resp == nil { + t.Errorf("ServerTest(SetFact) returned nil") + } + fact := &pb.Fact{Name: req.GetName(), Value: req.GetValue()} + if !reflect.DeepEqual(resp.GetFact(), fact) { + t.Errorf("ServerTest(SetFact) got %v, wanted %v", resp.GetFact(), fact) + } +} + +func TestServerSetFactForNonExistingEntity(t *testing.T) { + testStorage := NewTestStorage() + defer testStorage.Close() + s := Server{Storage: testStorage.Storage} + + entityUri := "boss://test/test" + req := &pb.SetFactRequest{EntityUri: entityUri, Name: "test-name", Value: "test-value"} + resp, err := s.SetFact(context.Background(), req) + if err != nil { + t.Errorf("ServerTest(SetFact) got unexpected error %v", err) + } + if resp == nil { + t.Errorf("ServerTest(SetFact) returned nil") + } + + fact := &pb.Fact{Name: req.GetName(), Value: req.GetValue()} + if !reflect.DeepEqual(resp.GetFact(), fact) { + t.Errorf("ServerTest(SetFact) got %v, wanted %v", resp.GetFact(), fact) + } +} + +type TestStorage struct { + Storage *storage.Storage + Path string +} + +// NewTestStorage returns a TestStorage using a temporary path. +func NewTestStorage() *TestStorage { + f, err := ioutil.TempFile("", "") + if err != nil { + panic(fmt.Sprintf("temp file: %s", err)) + } + path := f.Name() + f.Close() + os.Remove(path) + + config := storage.Config{Path: path} + storage, _ := storage.OpenStorage(config) + return &TestStorage{Storage: storage, Path: path} +} + +func (db *TestStorage) Close() { + defer os.Remove(db.Path) + db.Storage.Close() +} diff --git a/backend/inventory/gen-pb.sh b/backend/inventory/gen-pb.sh deleted file mode 100755 index 6f46277f8e..0000000000 --- a/backend/inventory/gen-pb.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -protoc -I ../../ protos/inventory.proto --go_out=plugins=grpc:. diff --git a/backend/inventory/go.mod b/backend/inventory/go.mod index a7148725b1..7a2e505cf6 100644 --- a/backend/inventory/go.mod +++ b/backend/inventory/go.mod @@ -8,5 +8,8 @@ require ( github.com/golang/protobuf v1.3.3 github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000 go.etcd.io/bbolt v1.3.3 + golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect + golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect google.golang.org/grpc v1.27.0 + honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect ) diff --git a/backend/inventory/storage/storage.go b/backend/inventory/storage/storage.go index 03849516b2..17cd09f35f 100644 --- a/backend/inventory/storage/storage.go +++ b/backend/inventory/storage/storage.go @@ -37,13 +37,17 @@ func (s *Storage) Close() error { return s.db.Close() } -func (s *Storage) SetFact(entityUri, name, value string) error { +func (s *Storage) SetFact(entityUri, name, value string) (err error) { return s.db.Update(func(tx *bbolt.Tx) error { b, err := tx.CreateBucketIfNotExists([]byte(entityUri)) if err != nil { return err } - return b.Put([]byte(name), []byte(value)) + err = b.Put([]byte(name), []byte(value)) + if err != nil { + return err + } + return nil }) } diff --git a/backend/proto/builds/v1/builds.pb.go b/backend/proto/builds/v1/builds.pb.go new file mode 100644 index 0000000000..2d00732d8b --- /dev/null +++ b/backend/proto/builds/v1/builds.pb.go @@ -0,0 +1,509 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: builds/v1/builds.proto + +package buildsv1 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type BuildStatus int32 + +const ( + BuildStatus_NULL BuildStatus = 0 + BuildStatus_SUCCESS BuildStatus = 1 + BuildStatus_FAILURE BuildStatus = 2 + BuildStatus_PENDING BuildStatus = 3 + BuildStatus_RUNNING BuildStatus = 4 +) + +var BuildStatus_name = map[int32]string{ + 0: "NULL", + 1: "SUCCESS", + 2: "FAILURE", + 3: "PENDING", + 4: "RUNNING", +} + +var BuildStatus_value = map[string]int32{ + "NULL": 0, + "SUCCESS": 1, + "FAILURE": 2, + "PENDING": 3, + "RUNNING": 4, +} + +func (x BuildStatus) String() string { + return proto.EnumName(BuildStatus_name, int32(x)) +} + +func (BuildStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{0} +} + +type ListBuildsRequest struct { + EntityUri string `protobuf:"bytes,1,opt,name=entity_uri,json=entityUri,proto3" json:"entity_uri,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListBuildsRequest) Reset() { *m = ListBuildsRequest{} } +func (m *ListBuildsRequest) String() string { return proto.CompactTextString(m) } +func (*ListBuildsRequest) ProtoMessage() {} +func (*ListBuildsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{0} +} + +func (m *ListBuildsRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListBuildsRequest.Unmarshal(m, b) +} +func (m *ListBuildsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListBuildsRequest.Marshal(b, m, deterministic) +} +func (m *ListBuildsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListBuildsRequest.Merge(m, src) +} +func (m *ListBuildsRequest) XXX_Size() int { + return xxx_messageInfo_ListBuildsRequest.Size(m) +} +func (m *ListBuildsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListBuildsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListBuildsRequest proto.InternalMessageInfo + +func (m *ListBuildsRequest) GetEntityUri() string { + if m != nil { + return m.EntityUri + } + return "" +} + +type ListBuildsReply struct { + EntityUri string `protobuf:"bytes,1,opt,name=entity_uri,json=entityUri,proto3" json:"entity_uri,omitempty"` + Builds []*Build `protobuf:"bytes,2,rep,name=builds,proto3" json:"builds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListBuildsReply) Reset() { *m = ListBuildsReply{} } +func (m *ListBuildsReply) String() string { return proto.CompactTextString(m) } +func (*ListBuildsReply) ProtoMessage() {} +func (*ListBuildsReply) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{1} +} + +func (m *ListBuildsReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListBuildsReply.Unmarshal(m, b) +} +func (m *ListBuildsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListBuildsReply.Marshal(b, m, deterministic) +} +func (m *ListBuildsReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListBuildsReply.Merge(m, src) +} +func (m *ListBuildsReply) XXX_Size() int { + return xxx_messageInfo_ListBuildsReply.Size(m) +} +func (m *ListBuildsReply) XXX_DiscardUnknown() { + xxx_messageInfo_ListBuildsReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ListBuildsReply proto.InternalMessageInfo + +func (m *ListBuildsReply) GetEntityUri() string { + if m != nil { + return m.EntityUri + } + return "" +} + +func (m *ListBuildsReply) GetBuilds() []*Build { + if m != nil { + return m.Builds + } + return nil +} + +type GetBuildRequest struct { + BuildUri string `protobuf:"bytes,1,opt,name=build_uri,json=buildUri,proto3" json:"build_uri,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetBuildRequest) Reset() { *m = GetBuildRequest{} } +func (m *GetBuildRequest) String() string { return proto.CompactTextString(m) } +func (*GetBuildRequest) ProtoMessage() {} +func (*GetBuildRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{2} +} + +func (m *GetBuildRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBuildRequest.Unmarshal(m, b) +} +func (m *GetBuildRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBuildRequest.Marshal(b, m, deterministic) +} +func (m *GetBuildRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBuildRequest.Merge(m, src) +} +func (m *GetBuildRequest) XXX_Size() int { + return xxx_messageInfo_GetBuildRequest.Size(m) +} +func (m *GetBuildRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetBuildRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetBuildRequest proto.InternalMessageInfo + +func (m *GetBuildRequest) GetBuildUri() string { + if m != nil { + return m.BuildUri + } + return "" +} + +type GetBuildReply struct { + Build *Build `protobuf:"bytes,1,opt,name=build,proto3" json:"build,omitempty"` + Details *BuildDetails `protobuf:"bytes,2,opt,name=details,proto3" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetBuildReply) Reset() { *m = GetBuildReply{} } +func (m *GetBuildReply) String() string { return proto.CompactTextString(m) } +func (*GetBuildReply) ProtoMessage() {} +func (*GetBuildReply) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{3} +} + +func (m *GetBuildReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetBuildReply.Unmarshal(m, b) +} +func (m *GetBuildReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetBuildReply.Marshal(b, m, deterministic) +} +func (m *GetBuildReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetBuildReply.Merge(m, src) +} +func (m *GetBuildReply) XXX_Size() int { + return xxx_messageInfo_GetBuildReply.Size(m) +} +func (m *GetBuildReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetBuildReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetBuildReply proto.InternalMessageInfo + +func (m *GetBuildReply) GetBuild() *Build { + if m != nil { + return m.Build + } + return nil +} + +func (m *GetBuildReply) GetDetails() *BuildDetails { + if m != nil { + return m.Details + } + return nil +} + +type Build struct { + Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` + CommitId string `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Status BuildStatus `protobuf:"varint,4,opt,name=status,proto3,enum=spotify.backstage.builds.v1.BuildStatus" json:"status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Build) Reset() { *m = Build{} } +func (m *Build) String() string { return proto.CompactTextString(m) } +func (*Build) ProtoMessage() {} +func (*Build) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{4} +} + +func (m *Build) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Build.Unmarshal(m, b) +} +func (m *Build) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Build.Marshal(b, m, deterministic) +} +func (m *Build) XXX_Merge(src proto.Message) { + xxx_messageInfo_Build.Merge(m, src) +} +func (m *Build) XXX_Size() int { + return xxx_messageInfo_Build.Size(m) +} +func (m *Build) XXX_DiscardUnknown() { + xxx_messageInfo_Build.DiscardUnknown(m) +} + +var xxx_messageInfo_Build proto.InternalMessageInfo + +func (m *Build) GetUri() string { + if m != nil { + return m.Uri + } + return "" +} + +func (m *Build) GetCommitId() string { + if m != nil { + return m.CommitId + } + return "" +} + +func (m *Build) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *Build) GetStatus() BuildStatus { + if m != nil { + return m.Status + } + return BuildStatus_NULL +} + +type BuildDetails struct { + Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` + OverviewUrl string `protobuf:"bytes,2,opt,name=overview_url,json=overviewUrl,proto3" json:"overview_url,omitempty"` + LogUrl string `protobuf:"bytes,3,opt,name=log_url,json=logUrl,proto3" json:"log_url,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BuildDetails) Reset() { *m = BuildDetails{} } +func (m *BuildDetails) String() string { return proto.CompactTextString(m) } +func (*BuildDetails) ProtoMessage() {} +func (*BuildDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_05a627abb7f9adb4, []int{5} +} + +func (m *BuildDetails) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BuildDetails.Unmarshal(m, b) +} +func (m *BuildDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BuildDetails.Marshal(b, m, deterministic) +} +func (m *BuildDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_BuildDetails.Merge(m, src) +} +func (m *BuildDetails) XXX_Size() int { + return xxx_messageInfo_BuildDetails.Size(m) +} +func (m *BuildDetails) XXX_DiscardUnknown() { + xxx_messageInfo_BuildDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_BuildDetails proto.InternalMessageInfo + +func (m *BuildDetails) GetAuthor() string { + if m != nil { + return m.Author + } + return "" +} + +func (m *BuildDetails) GetOverviewUrl() string { + if m != nil { + return m.OverviewUrl + } + return "" +} + +func (m *BuildDetails) GetLogUrl() string { + if m != nil { + return m.LogUrl + } + return "" +} + +func init() { + proto.RegisterEnum("spotify.backstage.builds.v1.BuildStatus", BuildStatus_name, BuildStatus_value) + proto.RegisterType((*ListBuildsRequest)(nil), "spotify.backstage.builds.v1.ListBuildsRequest") + proto.RegisterType((*ListBuildsReply)(nil), "spotify.backstage.builds.v1.ListBuildsReply") + proto.RegisterType((*GetBuildRequest)(nil), "spotify.backstage.builds.v1.GetBuildRequest") + proto.RegisterType((*GetBuildReply)(nil), "spotify.backstage.builds.v1.GetBuildReply") + proto.RegisterType((*Build)(nil), "spotify.backstage.builds.v1.Build") + proto.RegisterType((*BuildDetails)(nil), "spotify.backstage.builds.v1.BuildDetails") +} + +func init() { proto.RegisterFile("builds/v1/builds.proto", fileDescriptor_05a627abb7f9adb4) } + +var fileDescriptor_05a627abb7f9adb4 = []byte{ + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x25, 0x6b, 0x97, 0xb6, 0x5f, 0x07, 0x0b, 0x3e, 0x8c, 0x68, 0x13, 0x52, 0xc9, 0xa9, 0x4c, + 0x28, 0x53, 0xcb, 0x05, 0x71, 0x82, 0x75, 0x65, 0xaa, 0xa8, 0x22, 0xe4, 0x2a, 0x17, 0x2e, 0x55, + 0xda, 0x98, 0x62, 0x70, 0x71, 0xb0, 0x9d, 0xa0, 0xfc, 0x09, 0x0e, 0xfc, 0x3c, 0x7e, 0x0d, 0xb2, + 0x9d, 0xa8, 0x11, 0x93, 0xda, 0xde, 0xfc, 0xbe, 0xf7, 0xbd, 0xbc, 0xf7, 0x49, 0x2f, 0x70, 0xb1, + 0xca, 0x29, 0x4b, 0xe5, 0x4d, 0x31, 0xba, 0xb1, 0xaf, 0x30, 0x13, 0x5c, 0x71, 0x74, 0x25, 0x33, + 0xae, 0xe8, 0x97, 0x32, 0x5c, 0x25, 0xeb, 0xef, 0x52, 0x25, 0x1b, 0x12, 0x56, 0x7c, 0x31, 0x0a, + 0xc6, 0xf0, 0x74, 0x4e, 0xa5, 0xba, 0x35, 0x03, 0x4c, 0x7e, 0xe6, 0x44, 0x2a, 0xf4, 0x1c, 0x80, + 0xfc, 0x50, 0x54, 0x95, 0xcb, 0x5c, 0x50, 0xdf, 0x19, 0x38, 0xc3, 0x1e, 0xee, 0xd9, 0x49, 0x2c, + 0x68, 0xc0, 0xe0, 0xbc, 0xa9, 0xc9, 0x58, 0x79, 0x40, 0x81, 0xde, 0x82, 0x6b, 0x2d, 0xfd, 0x93, + 0x41, 0x6b, 0xd8, 0x1f, 0x07, 0xe1, 0x9e, 0x4c, 0xa1, 0xf9, 0x30, 0xae, 0x14, 0x41, 0x08, 0xe7, + 0xf7, 0xc4, 0x9a, 0xd5, 0xf9, 0xae, 0xa0, 0x67, 0xc8, 0x86, 0x59, 0xd7, 0x0c, 0x74, 0xba, 0xdf, + 0x0e, 0x3c, 0xde, 0x09, 0x74, 0xb8, 0x37, 0x70, 0x6a, 0x58, 0xb3, 0x7a, 0x9c, 0xb9, 0x15, 0xa0, + 0x09, 0x74, 0x52, 0xa2, 0x12, 0xca, 0x74, 0x70, 0xad, 0x7d, 0x79, 0x58, 0x7b, 0x67, 0x05, 0xb8, + 0x56, 0x06, 0x7f, 0x1c, 0x38, 0x35, 0x0c, 0xf2, 0xa0, 0xb5, 0x4b, 0xac, 0x9f, 0xfa, 0x92, 0x35, + 0xdf, 0x6e, 0xa9, 0x5a, 0xd2, 0xd4, 0x58, 0xf4, 0x70, 0xd7, 0x0e, 0x66, 0x29, 0xf2, 0xa1, 0xb3, + 0x25, 0x52, 0x26, 0x1b, 0xe2, 0xb7, 0x0c, 0x55, 0x43, 0xf4, 0x0e, 0x5c, 0xa9, 0x12, 0x95, 0x4b, + 0xbf, 0x3d, 0x70, 0x86, 0x4f, 0xc6, 0xc3, 0xc3, 0xb1, 0x16, 0x66, 0x1f, 0x57, 0xba, 0x60, 0x05, + 0x67, 0xcd, 0xb4, 0xe8, 0x02, 0xdc, 0x24, 0x57, 0x5f, 0xb9, 0xa8, 0xd2, 0x55, 0x08, 0xbd, 0x80, + 0x33, 0x5e, 0x10, 0x51, 0x50, 0xf2, 0x6b, 0x99, 0x0b, 0x56, 0x65, 0xec, 0xd7, 0xb3, 0x58, 0x30, + 0xf4, 0x0c, 0x3a, 0x8c, 0x6f, 0x0c, 0x6b, 0x63, 0xba, 0x8c, 0x6f, 0x62, 0xc1, 0xae, 0x3f, 0x42, + 0xbf, 0x61, 0x8d, 0xba, 0xd0, 0x8e, 0xe2, 0xf9, 0xdc, 0x7b, 0x84, 0xfa, 0xd0, 0x59, 0xc4, 0x93, + 0xc9, 0x74, 0xb1, 0xf0, 0x1c, 0x0d, 0x3e, 0xbc, 0x9f, 0xcd, 0x63, 0x3c, 0xf5, 0x4e, 0x34, 0xf8, + 0x34, 0x8d, 0xee, 0x66, 0xd1, 0xbd, 0xd7, 0xd2, 0x00, 0xc7, 0x51, 0xa4, 0x41, 0x7b, 0xfc, 0xd7, + 0x01, 0xd7, 0x36, 0x0e, 0x7d, 0x03, 0xd8, 0xf5, 0x0f, 0x85, 0x7b, 0x6f, 0x7f, 0x50, 0xee, 0xcb, + 0x57, 0x47, 0xef, 0xeb, 0xee, 0xa4, 0xd0, 0xad, 0xcb, 0x84, 0xf6, 0x2b, 0xff, 0x2b, 0xe9, 0xe5, + 0xf5, 0x91, 0xdb, 0x19, 0x2b, 0x6f, 0xe1, 0xb3, 0xed, 0xaf, 0x2c, 0x46, 0x2b, 0xd7, 0xfc, 0xb5, + 0xaf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x40, 0xf3, 0x96, 0x0b, 0xcf, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// BuildsClient is the client API for Builds service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type BuildsClient interface { + ListBuilds(ctx context.Context, in *ListBuildsRequest, opts ...grpc.CallOption) (*ListBuildsReply, error) + GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*GetBuildReply, error) +} + +type buildsClient struct { + cc grpc.ClientConnInterface +} + +func NewBuildsClient(cc grpc.ClientConnInterface) BuildsClient { + return &buildsClient{cc} +} + +func (c *buildsClient) ListBuilds(ctx context.Context, in *ListBuildsRequest, opts ...grpc.CallOption) (*ListBuildsReply, error) { + out := new(ListBuildsReply) + err := c.cc.Invoke(ctx, "/spotify.backstage.builds.v1.Builds/ListBuilds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *buildsClient) GetBuild(ctx context.Context, in *GetBuildRequest, opts ...grpc.CallOption) (*GetBuildReply, error) { + out := new(GetBuildReply) + err := c.cc.Invoke(ctx, "/spotify.backstage.builds.v1.Builds/GetBuild", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BuildsServer is the server API for Builds service. +type BuildsServer interface { + ListBuilds(context.Context, *ListBuildsRequest) (*ListBuildsReply, error) + GetBuild(context.Context, *GetBuildRequest) (*GetBuildReply, error) +} + +// UnimplementedBuildsServer can be embedded to have forward compatible implementations. +type UnimplementedBuildsServer struct { +} + +func (*UnimplementedBuildsServer) ListBuilds(ctx context.Context, req *ListBuildsRequest) (*ListBuildsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListBuilds not implemented") +} +func (*UnimplementedBuildsServer) GetBuild(ctx context.Context, req *GetBuildRequest) (*GetBuildReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBuild not implemented") +} + +func RegisterBuildsServer(s *grpc.Server, srv BuildsServer) { + s.RegisterService(&_Builds_serviceDesc, srv) +} + +func _Builds_ListBuilds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListBuildsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BuildsServer).ListBuilds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/spotify.backstage.builds.v1.Builds/ListBuilds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BuildsServer).ListBuilds(ctx, req.(*ListBuildsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Builds_GetBuild_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBuildRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BuildsServer).GetBuild(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/spotify.backstage.builds.v1.Builds/GetBuild", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BuildsServer).GetBuild(ctx, req.(*GetBuildRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Builds_serviceDesc = grpc.ServiceDesc{ + ServiceName: "spotify.backstage.builds.v1.Builds", + HandlerType: (*BuildsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListBuilds", + Handler: _Builds_ListBuilds_Handler, + }, + { + MethodName: "GetBuild", + Handler: _Builds_GetBuild_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "builds/v1/builds.proto", +} diff --git a/backend/proto/inventory/v1/inventory.pb.go b/backend/proto/inventory/v1/inventory.pb.go index ea981e1ed8..151557d0a0 100644 --- a/backend/proto/inventory/v1/inventory.pb.go +++ b/backend/proto/inventory/v1/inventory.pb.go @@ -196,6 +196,186 @@ func (m *CreateEntityReply) GetEntity() *Entity { return nil } +type SetFactRequest struct { + EntityUri string `protobuf:"bytes,1,opt,name=entityUri,proto3" json:"entityUri,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetFactRequest) Reset() { *m = SetFactRequest{} } +func (m *SetFactRequest) String() string { return proto.CompactTextString(m) } +func (*SetFactRequest) ProtoMessage() {} +func (*SetFactRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{4} +} + +func (m *SetFactRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetFactRequest.Unmarshal(m, b) +} +func (m *SetFactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetFactRequest.Marshal(b, m, deterministic) +} +func (m *SetFactRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFactRequest.Merge(m, src) +} +func (m *SetFactRequest) XXX_Size() int { + return xxx_messageInfo_SetFactRequest.Size(m) +} +func (m *SetFactRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SetFactRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SetFactRequest proto.InternalMessageInfo + +func (m *SetFactRequest) GetEntityUri() string { + if m != nil { + return m.EntityUri + } + return "" +} + +func (m *SetFactRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *SetFactRequest) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +type SetFactReply struct { + Fact *Fact `protobuf:"bytes,1,opt,name=fact,proto3" json:"fact,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetFactReply) Reset() { *m = SetFactReply{} } +func (m *SetFactReply) String() string { return proto.CompactTextString(m) } +func (*SetFactReply) ProtoMessage() {} +func (*SetFactReply) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{5} +} + +func (m *SetFactReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetFactReply.Unmarshal(m, b) +} +func (m *SetFactReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetFactReply.Marshal(b, m, deterministic) +} +func (m *SetFactReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFactReply.Merge(m, src) +} +func (m *SetFactReply) XXX_Size() int { + return xxx_messageInfo_SetFactReply.Size(m) +} +func (m *SetFactReply) XXX_DiscardUnknown() { + xxx_messageInfo_SetFactReply.DiscardUnknown(m) +} + +var xxx_messageInfo_SetFactReply proto.InternalMessageInfo + +func (m *SetFactReply) GetFact() *Fact { + if m != nil { + return m.Fact + } + return nil +} + +type GetFactRequest struct { + EntityUri string `protobuf:"bytes,1,opt,name=entityUri,proto3" json:"entityUri,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetFactRequest) Reset() { *m = GetFactRequest{} } +func (m *GetFactRequest) String() string { return proto.CompactTextString(m) } +func (*GetFactRequest) ProtoMessage() {} +func (*GetFactRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{6} +} + +func (m *GetFactRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFactRequest.Unmarshal(m, b) +} +func (m *GetFactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFactRequest.Marshal(b, m, deterministic) +} +func (m *GetFactRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFactRequest.Merge(m, src) +} +func (m *GetFactRequest) XXX_Size() int { + return xxx_messageInfo_GetFactRequest.Size(m) +} +func (m *GetFactRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetFactRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetFactRequest proto.InternalMessageInfo + +func (m *GetFactRequest) GetEntityUri() string { + if m != nil { + return m.EntityUri + } + return "" +} + +func (m *GetFactRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +type GetFactReply struct { + Fact *Fact `protobuf:"bytes,1,opt,name=fact,proto3" json:"fact,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetFactReply) Reset() { *m = GetFactReply{} } +func (m *GetFactReply) String() string { return proto.CompactTextString(m) } +func (*GetFactReply) ProtoMessage() {} +func (*GetFactReply) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{7} +} + +func (m *GetFactReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFactReply.Unmarshal(m, b) +} +func (m *GetFactReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFactReply.Marshal(b, m, deterministic) +} +func (m *GetFactReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFactReply.Merge(m, src) +} +func (m *GetFactReply) XXX_Size() int { + return xxx_messageInfo_GetFactReply.Size(m) +} +func (m *GetFactReply) XXX_DiscardUnknown() { + xxx_messageInfo_GetFactReply.DiscardUnknown(m) +} + +var xxx_messageInfo_GetFactReply proto.InternalMessageInfo + +func (m *GetFactReply) GetFact() *Fact { + if m != nil { + return m.Fact + } + return nil +} + type Entity struct { Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -207,7 +387,7 @@ func (m *Entity) Reset() { *m = Entity{} } func (m *Entity) String() string { return proto.CompactTextString(m) } func (*Entity) ProtoMessage() {} func (*Entity) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{4} + return fileDescriptor_70be9028e322f9d8, []int{8} } func (m *Entity) XXX_Unmarshal(b []byte) error { @@ -247,7 +427,7 @@ func (m *Fact) Reset() { *m = Fact{} } func (m *Fact) String() string { return proto.CompactTextString(m) } func (*Fact) ProtoMessage() {} func (*Fact) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{5} + return fileDescriptor_70be9028e322f9d8, []int{9} } func (m *Fact) XXX_Unmarshal(b []byte) error { @@ -287,6 +467,10 @@ func init() { proto.RegisterType((*GetEntityReply)(nil), "spotify.backstage.inventory.v1.GetEntityReply") proto.RegisterType((*CreateEntityRequest)(nil), "spotify.backstage.inventory.v1.CreateEntityRequest") proto.RegisterType((*CreateEntityReply)(nil), "spotify.backstage.inventory.v1.CreateEntityReply") + proto.RegisterType((*SetFactRequest)(nil), "spotify.backstage.inventory.v1.SetFactRequest") + proto.RegisterType((*SetFactReply)(nil), "spotify.backstage.inventory.v1.SetFactReply") + proto.RegisterType((*GetFactRequest)(nil), "spotify.backstage.inventory.v1.GetFactRequest") + proto.RegisterType((*GetFactReply)(nil), "spotify.backstage.inventory.v1.GetFactReply") proto.RegisterType((*Entity)(nil), "spotify.backstage.inventory.v1.Entity") proto.RegisterType((*Fact)(nil), "spotify.backstage.inventory.v1.Fact") } @@ -294,27 +478,32 @@ func init() { func init() { proto.RegisterFile("inventory/v1/inventory.proto", fileDescriptor_70be9028e322f9d8) } var fileDescriptor_70be9028e322f9d8 = []byte{ - // 307 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0xcc, 0x2b, 0x4b, - 0xcd, 0x2b, 0xc9, 0x2f, 0xaa, 0xd4, 0x2f, 0x33, 0xd4, 0x87, 0x73, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, - 0xf2, 0x85, 0xe4, 0x8a, 0x0b, 0xf2, 0x4b, 0x32, 0xd3, 0x2a, 0xf5, 0x92, 0x12, 0x93, 0xb3, 0x8b, - 0x4b, 0x12, 0xd3, 0x53, 0xf5, 0x10, 0x4a, 0xca, 0x0c, 0x95, 0xca, 0xb9, 0x04, 0xdc, 0x53, 0x4b, - 0x5c, 0xf3, 0x4a, 0x32, 0x4b, 0x2a, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0xec, 0xb8, - 0xd8, 0x52, 0xc1, 0x02, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x6a, 0x7a, 0xf8, 0x0d, 0xd1, - 0x83, 0x6a, 0x87, 0xea, 0x12, 0x52, 0xe6, 0xe2, 0xcd, 0xcc, 0x4b, 0xce, 0x29, 0x4d, 0x49, 0x8d, - 0x4f, 0x4b, 0x4c, 0x2e, 0x29, 0x96, 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x0c, 0xe2, 0x81, 0x0a, 0xba, - 0x81, 0xc4, 0x94, 0x7a, 0x18, 0xb9, 0xf8, 0x90, 0x6c, 0x2e, 0xc8, 0xa9, 0xa4, 0xd8, 0x5e, 0x2b, - 0x2e, 0x56, 0x84, 0x7d, 0xdc, 0x46, 0x2a, 0x84, 0xb4, 0x83, 0x1c, 0x12, 0x04, 0xd1, 0xa2, 0x14, - 0xca, 0x25, 0xec, 0x5c, 0x94, 0x9a, 0x58, 0x92, 0x4a, 0xd5, 0xa0, 0x50, 0x0a, 0xe6, 0x12, 0x44, - 0x35, 0x96, 0x0a, 0xfe, 0x54, 0x92, 0xe2, 0x62, 0x83, 0x88, 0x08, 0x09, 0x70, 0x31, 0x97, 0x16, - 0x65, 0x82, 0x8d, 0xe1, 0x0c, 0x02, 0x31, 0x95, 0x0c, 0xb8, 0x58, 0x40, 0xde, 0x12, 0x12, 0xe2, - 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x85, 0x4a, 0x81, 0xd9, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, - 0xa5, 0xa9, 0x12, 0x4c, 0x60, 0x41, 0x08, 0xc7, 0xe8, 0x13, 0x23, 0x17, 0xa7, 0x27, 0xcc, 0x36, - 0xa1, 0x5c, 0x2e, 0x4e, 0x78, 0xac, 0x08, 0x19, 0x10, 0x72, 0x18, 0x7a, 0xd2, 0x91, 0xd2, 0x23, - 0x41, 0x07, 0x28, 0x28, 0xca, 0xb8, 0x78, 0x90, 0xc3, 0x47, 0xc8, 0x98, 0x90, 0x7e, 0x2c, 0x91, - 0x24, 0x65, 0x48, 0x9a, 0xa6, 0x82, 0x9c, 0x4a, 0x27, 0xde, 0x28, 0x6e, 0xb8, 0x8a, 0x32, 0xc3, - 0x24, 0x36, 0x70, 0x66, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x24, 0xd0, 0xf1, 0x50, 0x4c, - 0x03, 0x00, 0x00, + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x4f, 0xc2, 0x40, + 0x10, 0x4d, 0x29, 0x60, 0x3a, 0x7c, 0x04, 0x57, 0x0f, 0x4d, 0x43, 0x0c, 0x59, 0x8d, 0xe1, 0x60, + 0x0a, 0x85, 0x8b, 0xf1, 0xe0, 0x01, 0xa3, 0xd5, 0x6b, 0x09, 0x89, 0xf1, 0x62, 0x0a, 0x2e, 0xa4, + 0x11, 0x5a, 0x6c, 0xb7, 0x35, 0xfd, 0x0f, 0xfe, 0x2c, 0x7f, 0x98, 0xd9, 0xed, 0x5a, 0x8a, 0x21, + 0x16, 0x02, 0xb7, 0xdd, 0x99, 0x79, 0xf3, 0x5e, 0x5f, 0x5f, 0x0b, 0x4d, 0xc7, 0x8d, 0x88, 0x4b, + 0x3d, 0x3f, 0xee, 0x44, 0x46, 0x27, 0xbd, 0xe8, 0x4b, 0xdf, 0xa3, 0x1e, 0x3a, 0x0b, 0x96, 0x1e, + 0x75, 0xa6, 0xb1, 0x3e, 0xb6, 0x27, 0xef, 0x01, 0xb5, 0x67, 0x44, 0x5f, 0x8d, 0x44, 0x06, 0xfe, + 0x84, 0x86, 0x49, 0xe8, 0xbd, 0x4b, 0x1d, 0x1a, 0x5b, 0xe4, 0x23, 0x24, 0x01, 0x45, 0xb7, 0x50, + 0x26, 0xbc, 0xa0, 0x4a, 0x2d, 0xa9, 0x5d, 0xe9, 0x5d, 0xea, 0xff, 0x2f, 0xd1, 0x05, 0x5c, 0xa0, + 0xd0, 0x39, 0xd4, 0x1c, 0x77, 0x32, 0x0f, 0xdf, 0xc8, 0xeb, 0xd4, 0x9e, 0xd0, 0x40, 0x2d, 0xb4, + 0xe4, 0xb6, 0x62, 0x55, 0x45, 0xf1, 0x81, 0xd5, 0xf0, 0x97, 0x04, 0xf5, 0x0c, 0xf3, 0x72, 0x1e, + 0xef, 0xcd, 0x7b, 0x03, 0xa5, 0x15, 0x5f, 0xa5, 0x77, 0x91, 0x07, 0x67, 0x42, 0xac, 0x04, 0x82, + 0x47, 0x70, 0x72, 0xe7, 0x13, 0x9b, 0x92, 0x83, 0x5a, 0x81, 0x87, 0x70, 0xbc, 0xbe, 0xf6, 0x00, + 0xcf, 0x89, 0x9f, 0xa1, 0x3e, 0x24, 0x94, 0xab, 0x17, 0x32, 0x9b, 0xa0, 0x24, 0xbd, 0x91, 0xef, + 0xf0, 0xa5, 0x8a, 0xb5, 0x2a, 0x20, 0x04, 0x45, 0xd7, 0x5e, 0x10, 0xb5, 0xc0, 0x1b, 0xfc, 0x8c, + 0x4e, 0xa1, 0x14, 0xd9, 0xf3, 0x90, 0xa8, 0x32, 0x2f, 0x26, 0x17, 0xfc, 0x08, 0xd5, 0x74, 0x33, + 0x53, 0x7a, 0x0d, 0x45, 0x66, 0x8f, 0xd0, 0xb9, 0x9d, 0xa1, 0x1c, 0x81, 0x07, 0xfc, 0xed, 0xee, + 0xa5, 0x91, 0xa9, 0x31, 0x0f, 0xa3, 0x46, 0x83, 0x72, 0xe2, 0x21, 0x6a, 0x80, 0x1c, 0xa6, 0xfc, + 0xec, 0x88, 0xbb, 0x50, 0x64, 0x93, 0xa9, 0x02, 0x69, 0x93, 0x4b, 0x85, 0x8c, 0x4b, 0xbd, 0x6f, + 0x19, 0x94, 0xa7, 0x5f, 0x26, 0xb4, 0x00, 0x25, 0xcd, 0x31, 0xea, 0xe6, 0x89, 0xfa, 0xfb, 0xb1, + 0x69, 0xfa, 0x0e, 0x08, 0x66, 0x42, 0x04, 0xd5, 0x6c, 0xa2, 0x50, 0x3f, 0x0f, 0xbf, 0x21, 0xd6, + 0x9a, 0xb1, 0x1b, 0x88, 0xf1, 0xce, 0xe0, 0x48, 0x44, 0x03, 0xe5, 0x4a, 0x5e, 0x4f, 0xa7, 0x76, + 0xb5, 0xf5, 0xbc, 0x20, 0x32, 0xb7, 0x25, 0x32, 0x77, 0x24, 0xca, 0xc6, 0x69, 0x50, 0x7b, 0xa9, + 0xa4, 0xcd, 0xc8, 0x18, 0x97, 0xf9, 0x0f, 0xb3, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xab, + 0xd5, 0x54, 0x50, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -331,6 +520,8 @@ const _ = grpc.SupportPackageIsVersion6 type InventoryClient interface { GetEntity(ctx context.Context, in *GetEntityRequest, opts ...grpc.CallOption) (*GetEntityReply, error) CreateEntity(ctx context.Context, in *CreateEntityRequest, opts ...grpc.CallOption) (*CreateEntityReply, error) + SetFact(ctx context.Context, in *SetFactRequest, opts ...grpc.CallOption) (*SetFactReply, error) + GetFact(ctx context.Context, in *GetFactRequest, opts ...grpc.CallOption) (*GetFactReply, error) } type inventoryClient struct { @@ -359,10 +550,30 @@ func (c *inventoryClient) CreateEntity(ctx context.Context, in *CreateEntityRequ return out, nil } +func (c *inventoryClient) SetFact(ctx context.Context, in *SetFactRequest, opts ...grpc.CallOption) (*SetFactReply, error) { + out := new(SetFactReply) + err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/SetFact", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryClient) GetFact(ctx context.Context, in *GetFactRequest, opts ...grpc.CallOption) (*GetFactReply, error) { + out := new(GetFactReply) + err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/GetFact", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // InventoryServer is the server API for Inventory service. type InventoryServer interface { GetEntity(context.Context, *GetEntityRequest) (*GetEntityReply, error) CreateEntity(context.Context, *CreateEntityRequest) (*CreateEntityReply, error) + SetFact(context.Context, *SetFactRequest) (*SetFactReply, error) + GetFact(context.Context, *GetFactRequest) (*GetFactReply, error) } // UnimplementedInventoryServer can be embedded to have forward compatible implementations. @@ -375,6 +586,12 @@ func (*UnimplementedInventoryServer) GetEntity(ctx context.Context, req *GetEnti func (*UnimplementedInventoryServer) CreateEntity(ctx context.Context, req *CreateEntityRequest) (*CreateEntityReply, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateEntity not implemented") } +func (*UnimplementedInventoryServer) SetFact(ctx context.Context, req *SetFactRequest) (*SetFactReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetFact not implemented") +} +func (*UnimplementedInventoryServer) GetFact(ctx context.Context, req *GetFactRequest) (*GetFactReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFact not implemented") +} func RegisterInventoryServer(s *grpc.Server, srv InventoryServer) { s.RegisterService(&_Inventory_serviceDesc, srv) @@ -416,6 +633,42 @@ func _Inventory_CreateEntity_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Inventory_SetFact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetFactRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServer).SetFact(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/spotify.backstage.inventory.v1.Inventory/SetFact", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServer).SetFact(ctx, req.(*SetFactRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Inventory_GetFact_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFactRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServer).GetFact(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/spotify.backstage.inventory.v1.Inventory/GetFact", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServer).GetFact(ctx, req.(*GetFactRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Inventory_serviceDesc = grpc.ServiceDesc{ ServiceName: "spotify.backstage.inventory.v1.Inventory", HandlerType: (*InventoryServer)(nil), @@ -428,6 +681,14 @@ var _Inventory_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateEntity", Handler: _Inventory_CreateEntity_Handler, }, + { + MethodName: "SetFact", + Handler: _Inventory_SetFact_Handler, + }, + { + MethodName: "GetFact", + Handler: _Inventory_GetFact_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "inventory/v1/inventory.proto", diff --git a/backend/scaffolder/app/server.go b/backend/scaffolder/app/server.go index ae89cb81ca..b4bcb590ab 100644 --- a/backend/scaffolder/app/server.go +++ b/backend/scaffolder/app/server.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/status" identity "github.com/spotify/backstage/backend/proto/identity/v1" - pb "github.com/spotify/backstage/proto/scaffolder/v1" + pb "github.com/spotify/backstage/backend/proto/scaffolder/v1" "github.com/spotify/backstage/scaffolder/fs" "github.com/spotify/backstage/scaffolder/remote" "github.com/spotify/backstage/scaffolder/repository" diff --git a/backend/scaffolder/main.go b/backend/scaffolder/main.go index e875470b7f..8bd6f3f5c0 100644 --- a/backend/scaffolder/main.go +++ b/backend/scaffolder/main.go @@ -4,7 +4,7 @@ import ( "log" "net" - pb "github.com/spotify/backstage/proto/scaffolder/v1" + pb "github.com/spotify/backstage/backend/proto/scaffolder/v1" "github.com/spotify/backstage/scaffolder/app" "google.golang.org/grpc" ) diff --git a/docker-compose.yaml b/docker-compose.yaml index ece7545eb6..d9d5f2490b 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,6 +21,15 @@ services: volumes: - ./backend/identity/identity-data.json:/app/identity-data.json + builds: + container_name: boss-builds + build: + context: backend + args: + service: builds + restart: unless-stopped + env_file: secrets.env + scaffolder: container_name: boss-scaffolder build: diff --git a/frontend/packages/app/package.json b/frontend/packages/app/package.json index 130e7972ad..55f747560a 100644 --- a/frontend/packages/app/package.json +++ b/frontend/packages/app/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@backstage/core": "0.0.0", + "@backstage/plugin-github-actions": "0.0.0", "@backstage/plugin-hello-world": "0.0.0", "@backstage/plugin-home-page": "0.0.0", "@backstage/plugin-login": "0.0.0", @@ -16,10 +17,13 @@ "@types/react": "^16.9.0", "@types/react-dom": "^16.9.0", "@types/react-router-dom": "^5.1.3", + "@types/zen-observable": "^0.8.0", "cross-env": "^7.0.0", "react": "^16.12.0", "react-dom": "^16.12.0", - "react-router-dom": "^5.1.2" + "react-router-dom": "^5.1.2", + "react-use": "^13.24.0", + "zen-observable": "^0.8.15" }, "workspaces": { "nohoist": [ diff --git a/frontend/packages/app/src/App.test.tsx b/frontend/packages/app/src/App.test.tsx deleted file mode 100644 index 3dc39e48b7..0000000000 --- a/frontend/packages/app/src/App.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import { render } from '@testing-library/react'; -import App from './App'; - -describe('App', () => { - it('renders learn react link', () => { - const rendered = render(); - rendered.getByText('This is Backstage!'); - }); -}); diff --git a/frontend/packages/app/src/App.tsx b/frontend/packages/app/src/App.tsx index c172c2bd38..1936c63c98 100644 --- a/frontend/packages/app/src/App.tsx +++ b/frontend/packages/app/src/App.tsx @@ -6,20 +6,17 @@ import { Page, theme, } from '@backstage/core'; +import HomePagePlugin from '@backstage/plugin-home-page'; //import PageHeader from './components/PageHeader'; import { LoginComponent } from '@backstage/plugin-login'; -import HomePagePlugin from '@backstage/plugin-home-page'; import { CssBaseline, makeStyles, ThemeProvider } from '@material-ui/core'; import React, { FC } from 'react'; -import { - BrowserRouter as Router, - Link as RouterLink, - Route, - Switch, -} from 'react-router-dom'; +import { BrowserRouter as Router } from 'react-router-dom'; import HomePageTimer from './components/HomepageTimer'; import SideBar from './components/SideBar'; import entities from './entities'; +import { LoginBarrier } from './login/LoginBarrier'; +import { MockCurrentUser } from './login/MockCurrentUser'; const useStyles = makeStyles(theme => ({ '@global': { @@ -39,7 +36,7 @@ const useStyles = makeStyles(theme => ({ root: { display: 'grid', // FIXME: Don't used a fixed width here - gridTemplateColumns: '224px auto', + gridTemplateColumns: '64px auto', gridTemplateRows: 'auto 1fr', width: '100%', height: '100vh', @@ -56,13 +53,12 @@ const useStyles = makeStyles(theme => ({ }, })); +const currentUser = new MockCurrentUser(); + const Login: FC<{}> = () => { return ( - -
- Go to Home -
+ currentUser.login(username)} />
); }; @@ -96,18 +92,13 @@ const App: FC<{}> = () => { return ( - - - - - - - - - - - - + + + + + + + ); diff --git a/frontend/packages/app/src/components/SideBar/SideBar.tsx b/frontend/packages/app/src/components/SideBar/SideBar.tsx index 4bf19afcf1..395ae45410 100644 --- a/frontend/packages/app/src/components/SideBar/SideBar.tsx +++ b/frontend/packages/app/src/components/SideBar/SideBar.tsx @@ -1,60 +1,221 @@ -import Avatar from '@material-ui/core/Avatar'; -import Grid from '@material-ui/core/Grid'; -import Link from '@material-ui/core/Link'; -import List from '@material-ui/core/List'; -import ListItem from '@material-ui/core/ListItem'; -import ListItemText from '@material-ui/core/ListItemText'; -import { makeStyles } from '@material-ui/core/styles'; -import Typography from '@material-ui/core/Typography'; -import React, { FC } from 'react'; +import React, { FC, useState, createContext, useContext } from 'react'; +import clsx from 'clsx'; +import { + makeStyles, + SvgIcon, + Typography, + Link, + styled, +} from '@material-ui/core'; + +import HomeIcon from '@material-ui/icons/Home'; +import ServiceIcon from '@material-ui/icons/DeviceHub'; +import WebIcon from '@material-ui/icons/Language'; +import LibIcon from '@material-ui/icons/LocalLibrary'; +import CreateIcon from '@material-ui/icons/AddCircleOutline'; + +const drawerWidthClosed = 64; +const drawerWidthOpen = 220; + +const Context = createContext(false); + +const useSidebarItemStyles = makeStyles({ + root: { + color: '#b5b5b5', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'center', + height: 40, + cursor: 'pointer', + }, + closed: { + width: drawerWidthClosed, + justifyContent: 'center', + }, + open: { + width: drawerWidthOpen, + }, + iconContainer: { + height: '100%', + width: drawerWidthClosed, + marginRight: -16, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, +}); + +type SidebarItemProps = { + icon: typeof SvgIcon; + text: string; + to?: string; + onClick?: () => void; +}; + +const SidebarItem: FC = ({ + icon: Icon, + text, + to, + onClick, +}) => { + const classes = useSidebarItemStyles(); + const open = useContext(Context); + + if (!open) { + return ( + + + + ); + } + + return ( + +
+ +
+ {text} + + ); +}; + +const useSidebarLogoStyles = makeStyles({ + root: { + height: drawerWidthClosed, + color: '#fff', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'center', + }, + logoContainer: { + width: drawerWidthClosed, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, + logo: { + fontSize: 32, + }, + title: { + fontSize: 24, + fontWeight: 'bold', + marginLeft: 22, + whiteSpace: 'nowrap', + }, + titleDot: { + color: '#1DB954', + }, +}); + +const SidebarLogo: FC<{}> = () => { + const classes = useSidebarLogoStyles(); + const open = useContext(Context); + + return ( +
+ + {open ? 'Backstage' : 'B'} + . + +
+ ); +}; + +const Space = styled('div')({ + flex: 1, +}); + +const Spacer = styled('div')({ + height: 8, +}); + +const Divider = styled('hr')({ + height: 1, + width: '100%', + background: '#383838', + border: 'none', +}); const useStyles = makeStyles(theme => ({ root: { - background: '#181818', - color: 'white', + zIndex: 1000, + position: 'relative', + overflow: 'visible', + width: theme.spacing(7) + 1, height: '100vh', - paddingLeft: theme.spacing(2), - paddingTop: theme.spacing(2), + }, + drawer: { + display: 'flex', + flexFlow: 'column nowrap', + alignItems: 'flex-start', + position: 'absolute', + left: 0, + top: 0, + bottom: 0, + padding: 0, + background: '#171717', + overflowX: 'hidden', + width: drawerWidthClosed, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.shortest, + }), + }, + drawerOpen: { + width: drawerWidthOpen, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.shorter, + }), }, })); const SideBar: FC<{}> = () => { const classes = useStyles(); + const [open, setOpen] = useState(false); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; return ( -
- - [Co-brand Logo] - - - - - - - - - - - - - - - - - - - - - A - - $userName - +
+ +
+ + + + + + + + + + + +
+
); }; diff --git a/frontend/packages/app/src/entities/index.ts b/frontend/packages/app/src/entities/index.ts index f32f99ab06..38e529d87f 100644 --- a/frontend/packages/app/src/entities/index.ts +++ b/frontend/packages/app/src/entities/index.ts @@ -1,20 +1,22 @@ import { createEntityKind, createWidgetView, - createEntityView, + createEntityPage, } from '@backstage/core'; import ComputerIcon from '@material-ui/icons/Computer'; import MockEntityPage from './MockEntityPage'; import MockEntityCard from './MockEntityCard'; +import GithubActionsPlugin from '@backstage/plugin-github-actions'; /* SERVICE */ const serviceOverviewPage = createWidgetView() .addComponent(MockEntityCard) .addComponent(MockEntityCard); -const serviceView = createEntityView() - .addPage('Overview', 'overview', serviceOverviewPage) - .addComponent('CI/CD', 'ci-cd', MockEntityPage); +const serviceView = createEntityPage() + .addPage('Overview', '/overview', serviceOverviewPage) + .register(GithubActionsPlugin) + .addComponent('Deployment', '/deployment', MockEntityPage); const serviceEntity = createEntityKind({ kind: 'service', diff --git a/frontend/packages/app/src/login/LoginBarrier.test.tsx b/frontend/packages/app/src/login/LoginBarrier.test.tsx new file mode 100644 index 0000000000..14389cea43 --- /dev/null +++ b/frontend/packages/app/src/login/LoginBarrier.test.tsx @@ -0,0 +1,57 @@ +import { render, wait, act } from '@testing-library/react'; +import React from 'react'; +import Observable from 'zen-observable'; +import { LoginBarrier } from './LoginBarrier'; +import { LoginState } from './types'; + +describe('LoginBarrier', () => { + it('passes through when logged in', async () => { + const state$ = Observable.of({ + type: 'LOGGED_IN', + user: 'apa', + }); + const rendered = render( +
{state.type}
} + > + Logged in! +
, + ); + await wait(() => rendered.getByText('Logged in!')); + }); + + it('goes to fallback when not logged in', async () => { + const state$ = Observable.of({ type: 'LOGGED_OUT' }); + const rendered = render( +
{state.type}
} + > + Logged in! +
, + ); + await wait(() => rendered.getByText('LOGGED_OUT')); + }); + + it('transitions between states', async () => { + let subscriber: ZenObservable.SubscriptionObserver | undefined; + const state$ = new Observable(s => { + subscriber = s; + }); + + const rendered = render( +
{state.type}
} + > + Logged in! +
, + ); + + await wait(() => rendered.getByText('LOGGED_OUT')); + // @ts-ignore: Object is possibly 'undefined' + act(() => subscriber.next({ type: 'LOGGED_IN', user: 'apa' })); + await wait(() => rendered.getByText('Logged in!')); + }); +}); diff --git a/frontend/packages/app/src/login/LoginBarrier.tsx b/frontend/packages/app/src/login/LoginBarrier.tsx new file mode 100644 index 0000000000..56caf04bb8 --- /dev/null +++ b/frontend/packages/app/src/login/LoginBarrier.tsx @@ -0,0 +1,22 @@ +import React, { FC } from 'react'; +import Observable from 'zen-observable'; +import { useObservable } from 'react-use'; +import { LoginState } from './types'; + +type LoginBarrierProps = { + fallback: React.ComponentType<{ state: LoginState }>; + state$: Observable; +}; + +export const LoginBarrier: FC = ({ + fallback: Fallback, + state$, + children, +}) => { + const state = useObservable(state$, { type: 'LOGGED_OUT' }); + if (state.type === 'LOGGED_IN') { + return <>{children}; + } else { + return ; + } +}; diff --git a/frontend/packages/app/src/login/MockCurrentUser.test.ts b/frontend/packages/app/src/login/MockCurrentUser.test.ts new file mode 100644 index 0000000000..598c5e53ba --- /dev/null +++ b/frontend/packages/app/src/login/MockCurrentUser.test.ts @@ -0,0 +1,38 @@ +import { MockCurrentUser } from './MockCurrentUser'; +import { wait } from '@testing-library/react'; + +describe('MockCurrentUser', () => { + it('notifies immediately on subscribe', async () => { + const next = jest.fn(); + const current = new MockCurrentUser(); + current.state.subscribe(next); + await wait(); + expect(next).toHaveBeenNthCalledWith( + 1, + expect.objectContaining({ type: 'LOGGED_OUT' }), + ); + }); + + it('logs in and out', async () => { + const next = jest.fn(); + const current = new MockCurrentUser(); + current.state.subscribe(next); + await wait(); + expect(next).toHaveBeenNthCalledWith( + 1, + expect.objectContaining({ type: 'LOGGED_OUT' }), + ); + current.login('apa'); + await wait(); + expect(next).toHaveBeenNthCalledWith( + 2, + expect.objectContaining({ type: 'LOGGED_IN', user: 'apa' }), + ); + current.logout(); + await wait(); + expect(next).toHaveBeenNthCalledWith( + 3, + expect.objectContaining({ type: 'LOGGED_OUT' }), + ); + }); +}); diff --git a/frontend/packages/app/src/login/MockCurrentUser.ts b/frontend/packages/app/src/login/MockCurrentUser.ts new file mode 100644 index 0000000000..0b90e25fab --- /dev/null +++ b/frontend/packages/app/src/login/MockCurrentUser.ts @@ -0,0 +1,67 @@ +import Observable from 'zen-observable'; +import { LoginState } from './types'; + +const LOCAL_STORAGE_KEY = 'mock_current_user'; + +export class MockCurrentUser { + private listeners: ZenObservable.SubscriptionObserver[]; + private currentUser: string | undefined; + + constructor() { + this.listeners = []; + this.currentUser = undefined; + this.loadPrevious(); + } + + login(user: string) { + this.currentUser = user; + this.saveCurrent(); + this.notify(); + } + + logout() { + this.currentUser = undefined; + this.saveCurrent(); + this.notify(); + } + + get state(): Observable { + return new Observable(subscriber => { + this.listeners.push(subscriber); + subscriber.next(this.getState()); + return () => { + this.listeners = this.listeners.filter(x => x !== subscriber); + }; + }); + } + + private loadPrevious() { + const user = localStorage.getItem(LOCAL_STORAGE_KEY); + if (user) { + try { + this.currentUser = JSON.parse(user); + } catch (e) { + localStorage.removeItem(LOCAL_STORAGE_KEY); + } + } + } + + private saveCurrent() { + if (!this.currentUser) { + localStorage.removeItem(LOCAL_STORAGE_KEY); + } else { + localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(this.currentUser)); + } + } + + private notify() { + const state = this.getState(); + this.listeners.forEach(listener => listener.next(state)); + } + + private getState(): LoginState { + return this.currentUser + ? { type: 'LOGGED_IN', user: this.currentUser } + : { type: 'LOGGED_OUT' }; + } +} diff --git a/frontend/packages/app/src/login/types.ts b/frontend/packages/app/src/login/types.ts new file mode 100644 index 0000000000..9a341917ad --- /dev/null +++ b/frontend/packages/app/src/login/types.ts @@ -0,0 +1,11 @@ +export type LoggedOutState = { type: 'LOGGED_OUT' }; +export type LoggingInState = { type: 'LOGGING_IN' }; +export type LoggedInState = { type: 'LOGGED_IN'; user: string }; +export type LoggingOutState = { type: 'LOGGING_OUT' }; +export type LoginFailedState = { type: 'LOGIN_FAILED'; error: Error }; +export type LoginState = + | LoggedOutState + | LoggingInState + | LoggedInState + | LoggingOutState + | LoginFailedState; diff --git a/frontend/packages/core/src/api/api.ts b/frontend/packages/core/src/api/api.ts index 73ca5c1da3..9bff1e2a46 100644 --- a/frontend/packages/core/src/api/api.ts +++ b/frontend/packages/core/src/api/api.ts @@ -1,7 +1,7 @@ import AppBuilder from './app/AppBuilder'; import EntityKind, { EntityConfig } from './entity/EntityKind'; import WidgetViewBuilder from './widgetView/WidgetViewBuilder'; -import EntityViewBuilder from './entityView/EntityViewPageBuilder'; +import EntityPageBuilder from './entityView/EntityPageBuilder'; import BackstagePlugin, { PluginConfig } from './plugin/Plugin'; export function createApp() { @@ -16,8 +16,8 @@ export function createWidgetView() { return new WidgetViewBuilder(); } -export function createEntityView() { - return new EntityViewBuilder(); +export function createEntityPage() { + return new EntityPageBuilder(); } export function createPlugin(config: PluginConfig): BackstagePlugin { diff --git a/frontend/packages/core/src/api/app/AppBuilder.tsx b/frontend/packages/core/src/api/app/AppBuilder.tsx index 349d9a7b06..1d2f9deb4d 100644 --- a/frontend/packages/core/src/api/app/AppBuilder.tsx +++ b/frontend/packages/core/src/api/app/AppBuilder.tsx @@ -1,10 +1,10 @@ import React, { ComponentType, FC } from 'react'; -import { Route, Switch, useParams } from 'react-router-dom'; +import { Route, Switch, useParams, Redirect } from 'react-router-dom'; import { AppContextProvider } from './AppContext'; import { App, AppComponentBuilder } from './types'; import EntityKind, { EntityConfig } from '../entity/EntityKind'; import { EntityContextProvider } from '../entityView/EntityContext'; -import BackstagePlugin, { registerSymbol } from '../plugin/Plugin'; +import BackstagePlugin from '../plugin/Plugin'; class AppImpl implements App { constructor(private readonly entities: Map) {} @@ -97,8 +97,31 @@ export default class AppBuilder { const pluginRoutes = new Array(); for (const plugin of this.plugins.values()) { - const { routes = [] } = plugin[registerSymbol](); - pluginRoutes.push(...routes); + for (const output of plugin.output()) { + switch (output.type) { + case 'route': { + const { path, component, options = {} } = output; + const { exact = true } = options; + pluginRoutes.push( + , + ); + break; + } + case 'redirect-route': { + const { path, target, options = {} } = output; + const { exact = true } = options; + pluginRoutes.push( + , + ); + break; + } + } + } } const routes = [...pluginRoutes, ...entityRoutes]; diff --git a/frontend/packages/core/src/api/entityView/EntityPageBuilder.tsx b/frontend/packages/core/src/api/entityView/EntityPageBuilder.tsx new file mode 100644 index 0000000000..8dbf6ba2a0 --- /dev/null +++ b/frontend/packages/core/src/api/entityView/EntityPageBuilder.tsx @@ -0,0 +1,167 @@ +import React, { ComponentType, FC } from 'react'; +import { Route, Redirect, Switch } from 'react-router-dom'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import { AppComponentBuilder, App } from '../app/types'; +import { useEntity, useEntityUri, useEntityConfig } from './EntityContext'; +import EntityLink from '../../components/EntityLink/EntityLink'; +import BackstagePlugin from '../plugin/Plugin'; + +const EntityLayout: FC<{}> = ({ children }) => { + const config = useEntityConfig(); + return ( +
{children}
+ ); +}; + +const EntitySidebar: FC<{}> = ({ children }) => { + return {children}; +}; + +const EntitySidebarItem: FC<{ title: string; path: string }> = ({ + title, + path, +}) => { + const entityUri = useEntityUri(); + + return ( + + + {title} + + + ); +}; + +type EntityPageNavItem = { + title: string; + target: string; +}; + +type EntityPageView = { + path: string; + component: ComponentType; +}; + +type Props = { + navItems: EntityPageNavItem[]; + views: EntityPageView[]; +}; + +const EntityPageComponent: FC = ({ navItems, views }) => { + const { kind, id } = useEntity(); + const basePath = `/entity/${kind}/${id}`; + + return ( + + + {navItems.map(({ title, target }) => ( + + ))} + + + {views.map(({ path, component }) => ( + + ))} + + + + ); +}; + +type EntityPageRegistration = + | { + type: 'page'; + title: string; + path: string; + page: AppComponentBuilder; + } + | { + type: 'plugin'; + plugin: BackstagePlugin; + } + | { + type: 'component'; + title: string; + path: string; + component: ComponentType; + }; + +export default class EntityPageBuilder extends AppComponentBuilder { + private readonly registrations = new Array(); + + addPage( + title: string, + path: string, + page: AppComponentBuilder, + ): EntityPageBuilder { + this.registrations.push({ type: 'page', title, path, page }); + return this; + } + + addComponent( + title: string, + path: string, + component: ComponentType, + ): EntityPageBuilder { + this.registrations.push({ type: 'component', title, path, component }); + return this; + } + + register(plugin: BackstagePlugin): EntityPageBuilder { + this.registrations.push({ type: 'plugin', plugin }); + return this; + } + + build(app: App): ComponentType { + const navItems = new Array(); + const views = new Array(); + + for (const reg of this.registrations) { + switch (reg.type) { + case 'page': { + const { title, path, page } = reg; + navItems.push({ title, target: path }); + views.push({ path, component: page.build(app) }); + break; + } + case 'component': { + const { title, path, component } = reg; + navItems.push({ title, target: path }); + views.push({ path, component }); + break; + } + case 'plugin': { + let added = false; + for (const output of reg.plugin.output()) { + switch (output.type) { + case 'entity-page-nav-item': + const { title, target } = output; + navItems.push({ title, target }); + added = true; + break; + case 'entity-page-view-route': + const { path, component } = output; + views.push({ path, component }); + added = true; + break; + } + } + if (!added) { + throw new Error( + `Plugin ${reg.plugin} was registered as entity view, but did not provide any output`, + ); + } + break; + } + } + } + + return () => ; + } +} diff --git a/frontend/packages/core/src/api/entityView/EntityViewPageBuilder.tsx b/frontend/packages/core/src/api/entityView/EntityViewPageBuilder.tsx deleted file mode 100644 index 10985325fc..0000000000 --- a/frontend/packages/core/src/api/entityView/EntityViewPageBuilder.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import React, { ComponentType, FC } from 'react'; -import { Route, Redirect, Switch } from 'react-router-dom'; -import List from '@material-ui/core/List'; -import ListItem from '@material-ui/core/ListItem'; -import { AppComponentBuilder, App } from '../app/types'; -import { useEntity, useEntityUri, useEntityConfig } from './EntityContext'; -import EntityLink from '../../components/EntityLink/EntityLink'; - -const EntityLayout: FC<{}> = ({ children }) => { - const config = useEntityConfig(); - return ( -
{children}
- ); -}; - -const EntitySidebar: FC<{}> = ({ children }) => { - return {children}; -}; - -const EntitySidebarItem: FC<{ title: string; path: string }> = ({ - title, - path, -}) => { - const entityUri = useEntityUri(); - - return ( - - - {title} - - - ); -}; - -type EntityViewPage = { - title: string; - path: string; - component: ComponentType; -}; - -type Props = { - pages: EntityViewPage[]; -}; - -const EntityViewComponent: FC = ({ pages }) => { - const { kind, id } = useEntity(); - const basePath = `/entity/${kind}/${id}`; - - return ( - - - {pages.map(({ title, path }) => ( - - ))} - - - {pages.map(({ path, component }) => ( - - ))} - - - - ); -}; - -type EntityViewRegistration = - | { - type: 'page'; - title: string; - path: string; - page: AppComponentBuilder; - } - | { - type: 'component'; - title: string; - path: string; - component: ComponentType; - }; - -export default class EntityViewBuilder extends AppComponentBuilder { - private readonly registrations = new Array(); - - addPage( - title: string, - path: string, - page: AppComponentBuilder, - ): EntityViewBuilder { - this.registrations.push({ type: 'page', title, path, page }); - return this; - } - - addComponent( - title: string, - path: string, - component: ComponentType, - ): EntityViewBuilder { - this.registrations.push({ type: 'component', title, path, component }); - return this; - } - - build(app: App): ComponentType { - const pages = this.registrations.map(registration => { - switch (registration.type) { - case 'page': { - const { title, path, page } = registration; - return { title, path, component: page.build(app) }; - } - case 'component': { - const { title, path, component } = registration; - return { title, path, component }; - } - default: - throw new Error(`Unknown EntityViewBuilder registration`); - } - }); - - return () => ; - } -} diff --git a/frontend/packages/core/src/api/plugin/Plugin.tsx b/frontend/packages/core/src/api/plugin/Plugin.tsx index 13caa40475..e351801047 100644 --- a/frontend/packages/core/src/api/plugin/Plugin.tsx +++ b/frontend/packages/core/src/api/plugin/Plugin.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import { Route, Redirect } from 'react-router-dom'; +import { ComponentType } from 'react'; +import { PluginOutput, RoutePath, RouteOptions } from './types'; export type PluginConfig = { id: string; @@ -7,89 +7,98 @@ export type PluginConfig = { }; export type PluginHooks = { - router: Router; + router: RouterHooks; + entityPage: EntityPageHooks; }; -export type RouteOptions = { - // Whether the route path must match exactly, defaults to true. - exact?: boolean; -}; - -export type RedirectOptions = { - // Whether the route path must match exactly, defaults to true. - exact?: boolean; -}; - -export type Router = { +export type RouterHooks = { registerRoute( - path: string, - Component: React.ComponentType, + path: RoutePath, + Component: ComponentType, options?: RouteOptions, ): void; + registerRedirect( - path: string, - target: string, - options?: RedirectOptions, + path: RoutePath, + target: RoutePath, + options?: RouteOptions, ): void; }; -export type PluginRegistrationResult = { - routes?: JSX.Element[]; +type EntityPageSidebarItemOptions = { + title: string; + target: RoutePath; +}; + +export type EntityPageHooks = { + navItem(options: EntityPageSidebarItemOptions): void; + route( + path: RoutePath, + component: ComponentType, + options?: RouteOptions, + ): void; }; export const registerSymbol = Symbol('plugin-register'); +export const outputSymbol = Symbol('plugin-output'); export default class Plugin { - private result?: PluginRegistrationResult; + private storedOutput?: PluginOutput[]; constructor(private readonly config: PluginConfig) {} - [registerSymbol](): PluginRegistrationResult { - if (this.result) { - return this.result; + output(): PluginOutput[] { + if (this.storedOutput) { + return this.storedOutput; } if (!this.config.register) { - return {}; + return []; } const { id } = this.config; - const routes = new Array(); + const outputs = new Array(); this.config.register({ router: { - registerRoute(path, component, options = {}) { + registerRoute(path, component, options) { if (path.startsWith('/entity/')) { throw new Error( `Plugin ${id} tried to register forbidden route ${path}`, ); } - const { exact = true } = options; - routes.push( - , - ); + outputs.push({ type: 'route', path, component, options }); }, - registerRedirect(path, target, options = {}) { + registerRedirect(path, target, options) { if (path.startsWith('/entity/')) { throw new Error( `Plugin ${id} tried to register forbidden redirect ${path}`, ); } - const { exact = true } = options; - routes.push( - , - ); + outputs.push({ type: 'redirect-route', path, target, options }); + }, + }, + entityPage: { + navItem({ title, target }) { + outputs.push({ + type: 'entity-page-nav-item', + target, + title, + }); + }, + route(path, component, options) { + outputs.push({ + type: 'entity-page-view-route', + path, + component, + options, + }); }, }, }); - this.result = { routes }; - return this.result; + this.storedOutput = outputs; + return this.storedOutput; } toString() { diff --git a/frontend/packages/core/src/api/plugin/types.ts b/frontend/packages/core/src/api/plugin/types.ts new file mode 100644 index 0000000000..ddc6364ec5 --- /dev/null +++ b/frontend/packages/core/src/api/plugin/types.ts @@ -0,0 +1,41 @@ +import { ComponentType } from 'react'; + +export type RouteOptions = { + // Whether the route path must match exactly, defaults to true. + exact?: boolean; +}; + +export type RoutePath = string; + +export type RouteOutput = { + type: 'route'; + path: RoutePath; + component: ComponentType<{}>; + options?: RouteOptions; +}; + +export type RedirectRouteOutput = { + type: 'redirect-route'; + path: RoutePath; + target: RoutePath; + options?: RouteOptions; +}; + +export type EntityPageViewRouteOutput = { + type: 'entity-page-view-route'; + path: RoutePath; + component: ComponentType; + options?: RouteOptions; +}; + +export type EntityPageNavItemOutput = { + type: 'entity-page-nav-item'; + title: string; + target: RoutePath; +}; + +export type PluginOutput = + | RouteOutput + | RedirectRouteOutput + | EntityPageViewRouteOutput + | EntityPageNavItemOutput; diff --git a/frontend/packages/core/src/api/widgetView/WidgetViewBuilder.tsx b/frontend/packages/core/src/api/widgetView/WidgetViewBuilder.tsx index eb9f5d1ed0..3ab13c2f8c 100644 --- a/frontend/packages/core/src/api/widgetView/WidgetViewBuilder.tsx +++ b/frontend/packages/core/src/api/widgetView/WidgetViewBuilder.tsx @@ -9,8 +9,8 @@ type Props = { const WidgetViewComponent: FC = ({ cards }) => { return (
- {cards.map(CardComponent => ( - + {cards.map((CardComponent, index) => ( + ))}
); diff --git a/frontend/packages/core/src/components/EntityLink/EntityLink.tsx b/frontend/packages/core/src/components/EntityLink/EntityLink.tsx index c26972c467..04b070e397 100644 --- a/frontend/packages/core/src/components/EntityLink/EntityLink.tsx +++ b/frontend/packages/core/src/components/EntityLink/EntityLink.tsx @@ -13,10 +13,10 @@ type Props = { } ); -function buildPath(kind: string, id?: string, subPath?: string) { +export function buildPath(kind: string, id?: string, subPath?: string) { if (id) { if (subPath) { - return `/entity/${kind}/${id}/${subPath}`; + return `/entity/${kind}/${id}/${subPath.replace(/^\//, '')}`; } return `/entity/${kind}/${id}`; } diff --git a/frontend/packages/core/src/components/EntityLink/RelativeEntityLink.tsx b/frontend/packages/core/src/components/EntityLink/RelativeEntityLink.tsx new file mode 100644 index 0000000000..aa61abcc01 --- /dev/null +++ b/frontend/packages/core/src/components/EntityLink/RelativeEntityLink.tsx @@ -0,0 +1,16 @@ +import React, { FC } from 'react'; +import { Link } from 'react-router-dom'; +import { useEntity } from '../../api'; +import { buildPath } from './EntityLink'; + +type Props = { + view: string; +}; + +const RelativeEntityLink: FC = ({ view, children }) => { + const entity = useEntity(); + + return {children}; +}; + +export default RelativeEntityLink; diff --git a/frontend/packages/core/src/components/EntityLink/index.ts b/frontend/packages/core/src/components/EntityLink/index.ts index d35b5bee26..f067ebf3e2 100644 --- a/frontend/packages/core/src/components/EntityLink/index.ts +++ b/frontend/packages/core/src/components/EntityLink/index.ts @@ -1 +1,2 @@ export { default } from './EntityLink'; +export { default as RelativeEntityLink } from './RelativeEntityLink'; diff --git a/frontend/packages/core/src/index.ts b/frontend/packages/core/src/index.ts index 3dc9c80d41..ccca30231a 100644 --- a/frontend/packages/core/src/index.ts +++ b/frontend/packages/core/src/index.ts @@ -1,5 +1,8 @@ export * from './api'; -export { default as EntityLink } from './components/EntityLink'; +export { + default as EntityLink, + RelativeEntityLink, +} from './components/EntityLink'; export { default as Page } from '../src/layout/Page'; export { gradients, theme } from '../src/layout/Page'; export { default as Header } from '../src/layout/Header/Header'; diff --git a/frontend/packages/core/src/layout/Header/Header.js b/frontend/packages/core/src/layout/Header/Header.js index f78e43ee76..5ddb7865e4 100644 --- a/frontend/packages/core/src/layout/Header/Header.js +++ b/frontend/packages/core/src/layout/Header/Header.js @@ -26,9 +26,9 @@ class Header extends Component { return typeLink ? ( // - {type} - // + {type} ) : ( + // {type} ); } @@ -69,12 +69,17 @@ class Header extends Component { const { title, pageTitleOverride, children, style, classes } = this.props; const pageTitle = pageTitleOverride || title; if (typeof pageTitle !== 'string') { - console.warn('
title prop is not a string, pageTitleOverride should be provided.'); + console.warn( + '
title prop is not a string, pageTitleOverride should be provided.', + ); } return ( - + {theme => (
@@ -98,7 +103,7 @@ const styles = theme => ({ gridArea: 'pageHeader', padding: theme.spacing(3), minHeight: 118, - width: 'calc(100vw - 224px)', + width: '100vw', boxShadow: '0 0 8px 3px rgba(20, 20, 20, 0.3)', position: 'relative', zIndex: 100, @@ -117,6 +122,7 @@ const styles = theme => ({ flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', + marginRight: theme.spacing(6), }, title: { color: theme.palette.bursts.fontColor, diff --git a/frontend/packages/plugins/github-actions/README.md b/frontend/packages/plugins/github-actions/README.md new file mode 100644 index 0000000000..d55e47c5b1 --- /dev/null +++ b/frontend/packages/plugins/github-actions/README.md @@ -0,0 +1 @@ +Welcome to your github-actions plugin! diff --git a/frontend/packages/plugins/github-actions/jest.config.js b/frontend/packages/plugins/github-actions/jest.config.js new file mode 100644 index 0000000000..6b28dacb3d --- /dev/null +++ b/frontend/packages/plugins/github-actions/jest.config.js @@ -0,0 +1,4 @@ +module.exports = { + ...require('@spotify/web-scripts/config/jest.config.js'), + setupFilesAfterEnv: ['../jest.setup.ts'], +}; diff --git a/frontend/packages/plugins/github-actions/jest.setup.ts b/frontend/packages/plugins/github-actions/jest.setup.ts new file mode 100644 index 0000000000..666127af39 --- /dev/null +++ b/frontend/packages/plugins/github-actions/jest.setup.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom/extend-expect'; diff --git a/frontend/packages/plugins/github-actions/package.json b/frontend/packages/plugins/github-actions/package.json new file mode 100644 index 0000000000..cfe203d986 --- /dev/null +++ b/frontend/packages/plugins/github-actions/package.json @@ -0,0 +1,28 @@ +{ + "name": "@backstage/plugin-github-actions", + "version": "0.0.0", + "main": "src/index.ts", + "main:src": "src/index.ts", + "devDependencies": { + "@backstage/core": "0.0.0", + "@spotify/web-scripts": "^6.0.0", + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^7.1.2", + "@types/jest": "^24.0.0", + "@types/node": "^12.0.0", + "@types/react": "^16.9.0", + "@types/react-dom": "^16.9.0", + "@types/react-router-dom": "^5.1.3", + "react": "^16.12.0", + "react-dom": "^16.12.0", + "react-router-dom": "^5.1.2", + "@material-ui/core": "^4.9.1", + "@material-ui/icons": "^4.9.1" + }, + "scripts": { + "lint": "web-scripts lint", + "test": "web-scripts test" + }, + "license": "Apache-2.0" +} diff --git a/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx new file mode 100644 index 0000000000..5cd5e21bf7 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx @@ -0,0 +1,20 @@ +import React, { FC } from 'react'; +import Button from '@material-ui/core/Button'; + +type Props = { + buildId: string; +}; + +const BuildDetailsPage: FC = ({ buildId }) => { + return ( + + ); +}; + +export default BuildDetailsPage; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/index.ts b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/index.ts new file mode 100644 index 0000000000..a2b6def3b0 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/index.ts @@ -0,0 +1 @@ +export { default } from './BuildDetailsPage'; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/BuildInfoCard.tsx b/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/BuildInfoCard.tsx new file mode 100644 index 0000000000..38fc2266db --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/BuildInfoCard.tsx @@ -0,0 +1,8 @@ +import React, { FC } from 'react'; +import { InfoCard } from '@backstage/core'; + +const BuildInfoCard: FC<{}> = () => { + return Last build was acb67fa3b5472w; +}; + +export default BuildInfoCard; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/index.ts b/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/index.ts new file mode 100644 index 0000000000..21c0b99099 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildInfoCard/index.ts @@ -0,0 +1 @@ +export { default } from './BuildInfoCard'; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx b/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx new file mode 100644 index 0000000000..697d9edfa6 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx @@ -0,0 +1,46 @@ +import React, { FC } from 'react'; +import { + TableContainer, + Table, + TableHead, + TableRow, + TableCell, + Paper, + TableBody, +} from '@material-ui/core'; +import { RelativeEntityLink } from '@backstage/core'; + +const BuildListPage: FC<{}> = () => { + const rows = [ + { message: 'Fixed a Bar', commit: 'fb46ca3dfbd7af5bc43da', id: 165 }, + { message: 'Fixed a Foo', commit: 'd7af5bc43dafb46ca3dfb', id: 164 }, + ]; + return ( + + + + + Message + Commit + Build ID + + + + {rows.map(row => ( + + {row.message} + {row.commit} + + + {row.commit} + + + + ))} + +
+
+ ); +}; + +export default BuildListPage; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildListPage/index.ts b/frontend/packages/plugins/github-actions/src/components/BuildListPage/index.ts new file mode 100644 index 0000000000..497fb05ab5 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/components/BuildListPage/index.ts @@ -0,0 +1 @@ +export { default } from './BuildListPage'; diff --git a/frontend/packages/plugins/github-actions/src/index.ts b/frontend/packages/plugins/github-actions/src/index.ts new file mode 100644 index 0000000000..b68aea57f9 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/index.ts @@ -0,0 +1 @@ +export { default } from './plugin'; diff --git a/frontend/packages/plugins/github-actions/src/plugin.test.ts b/frontend/packages/plugins/github-actions/src/plugin.test.ts new file mode 100644 index 0000000000..c202f56231 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/plugin.test.ts @@ -0,0 +1,7 @@ +import plugin from './plugin'; + +describe('github-actions', () => { + it('should export plugin', () => { + expect(plugin).toBeDefined(); + }); +}); diff --git a/frontend/packages/plugins/github-actions/src/plugin.ts b/frontend/packages/plugins/github-actions/src/plugin.ts new file mode 100644 index 0000000000..cecf142ca6 --- /dev/null +++ b/frontend/packages/plugins/github-actions/src/plugin.ts @@ -0,0 +1,16 @@ +import { createPlugin } from '@backstage/core'; +import BuildDetailsPage from './components/BuildDetailsPage'; +import BuildListPage from './components/BuildListPage'; + +// export const buildListRoute = createEntityRoute<[]>('/builds') +// export const buildDetailsRoute = createEntityRoute<[number]>('/builds/:buildId') + +export default createPlugin({ + id: 'github-actions', + + register({ entityPage }) { + entityPage.navItem({ title: 'CI/CD', target: '/builds' }); + entityPage.route('/builds', BuildListPage); + entityPage.route('/builds/:buildId', BuildDetailsPage); + }, +}); diff --git a/frontend/packages/plugins/hello-world/package.json b/frontend/packages/plugins/hello-world/package.json index d63c6f3d7a..5b8b6e3b9f 100644 --- a/frontend/packages/plugins/hello-world/package.json +++ b/frontend/packages/plugins/hello-world/package.json @@ -22,8 +22,7 @@ }, "scripts": { "lint": "web-scripts lint", - "test": "web-scripts test", - "proto": "../../../scripts/gen-proto.sh hello.proto" + "test": "web-scripts test" }, "license": "Apache-2.0" } diff --git a/frontend/packages/plugins/home-page/src/components/HomePage/HomePage.tsx b/frontend/packages/plugins/home-page/src/components/HomePage/HomePage.tsx index d9cb7217a6..d84256ac42 100644 --- a/frontend/packages/plugins/home-page/src/components/HomePage/HomePage.tsx +++ b/frontend/packages/plugins/home-page/src/components/HomePage/HomePage.tsx @@ -1,14 +1,12 @@ -import React, { FC } from 'react'; -import { InfoCard, EntityLink } from '@backstage/core'; -import { Link } from 'react-router-dom'; +import { EntityLink, InfoCard } from '@backstage/core'; import { Typography } from '@material-ui/core'; +import React, { FC } from 'react'; const HomePage: FC<{}> = () => { return ( Welcome to Backstage!
- Go to Login Backstage Backend diff --git a/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.test.tsx b/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.test.tsx index 5262db4a5b..52e3341d6c 100644 --- a/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.test.tsx +++ b/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.test.tsx @@ -4,7 +4,8 @@ import LoginComponent from './LoginComponent'; describe('LoginComponent', () => { it('should render', () => { - const rendered = render(); + const onLogin = jest.fn(); + const rendered = render(); expect(rendered.getByText('Login')).toBeInTheDocument(); }); }); diff --git a/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.tsx b/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.tsx index 8826eceda7..f0915bed2e 100644 --- a/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.tsx +++ b/frontend/packages/plugins/login/src/components/LoginComponent/LoginComponent.tsx @@ -1,11 +1,36 @@ -import React, { FC, Fragment } from 'react'; +import React, { FC, useState } from 'react'; import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; import Grid from '@material-ui/core/Grid'; +import { Typography } from '@material-ui/core'; + +type Props = { + onLogin: (username: string) => Promise | void; +}; + +const LoginComponent: FC = ({ onLogin }) => { + const [error, setError] = useState(''); + const [username, setUsername] = useState(''); + + const onUsernameChanged = async (e: React.ChangeEvent) => { + setUsername(e.target.value); + }; + + const onSubmit = async () => { + if (!username) { + setError('You have to supply a username'); + } + + setError(''); + try { + await onLogin(username); + } catch (e) { + setError(`Login failed: ${e.message}`); + } + }; -const LoginComponent: FC<{}> = () => { return ( - +
= () => { type="email" autoFocus required + value={username} + onChange={onUsernameChanged} /> @@ -23,14 +50,17 @@ const LoginComponent: FC<{}> = () => { style={{ marginTop: '24px', marginBottom: '24px' }} > - + {error || 'Just enter any fake username'} +
); }; diff --git a/frontend/packages/proto/package.json b/frontend/packages/proto/package.json new file mode 100644 index 0000000000..b6a52085f5 --- /dev/null +++ b/frontend/packages/proto/package.json @@ -0,0 +1,8 @@ +{ + "private": true, + "name": "@backstage/protobuf-definitions", + "version": "0.0.0", + "devDependencies": { + "ts-protoc-gen": "^0.12.0" + } +} diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.d.ts b/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.d.ts new file mode 100644 index 0000000000..18b2187499 --- /dev/null +++ b/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.d.ts @@ -0,0 +1,46 @@ +import * as grpcWeb from 'grpc-web'; + +import { + GetBuildReply, + GetBuildRequest, + ListBuildsReply, + ListBuildsRequest} from './builds_pb'; + +export class BuildsClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + listBuilds( + request: ListBuildsRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: ListBuildsReply) => void + ): grpcWeb.ClientReadableStream; + + getBuild( + request: GetBuildRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetBuildReply) => void + ): grpcWeb.ClientReadableStream; + +} + +export class BuildsPromiseClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + listBuilds( + request: ListBuildsRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + getBuild( + request: GetBuildRequest, + metadata?: grpcWeb.Metadata + ): Promise; + +} + diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.js b/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.js new file mode 100644 index 0000000000..b7b5369f0b --- /dev/null +++ b/frontend/packages/proto/src/generated/builds/v1/builds_grpc_web_pb.js @@ -0,0 +1,233 @@ +/** + * @fileoverview gRPC-Web generated client stub for spotify.backstage.builds.v1 + * @enhanceable + * @public + */ + +// GENERATED CODE -- DO NOT EDIT! + + + +const grpc = {}; +grpc.web = require('grpc-web'); + +const proto = {}; +proto.spotify = {}; +proto.spotify.backstage = {}; +proto.spotify.backstage.builds = {}; +proto.spotify.backstage.builds.v1 = require('./builds_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.builds.v1.BuildsClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.builds.v1.BuildsPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.builds.v1.ListBuildsRequest, + * !proto.spotify.backstage.builds.v1.ListBuildsReply>} + */ +const methodDescriptor_Builds_ListBuilds = new grpc.web.MethodDescriptor( + '/spotify.backstage.builds.v1.Builds/ListBuilds', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.builds.v1.ListBuildsRequest, + proto.spotify.backstage.builds.v1.ListBuildsReply, + /** + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.builds.v1.ListBuildsReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.builds.v1.ListBuildsRequest, + * !proto.spotify.backstage.builds.v1.ListBuildsReply>} + */ +const methodInfo_Builds_ListBuilds = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.builds.v1.ListBuildsReply, + /** + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.builds.v1.ListBuildsReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.builds.v1.ListBuildsReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.builds.v1.BuildsClient.prototype.listBuilds = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.builds.v1.Builds/ListBuilds', + request, + metadata || {}, + methodDescriptor_Builds_ListBuilds, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.builds.v1.BuildsPromiseClient.prototype.listBuilds = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.builds.v1.Builds/ListBuilds', + request, + metadata || {}, + methodDescriptor_Builds_ListBuilds); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.builds.v1.GetBuildRequest, + * !proto.spotify.backstage.builds.v1.GetBuildReply>} + */ +const methodDescriptor_Builds_GetBuild = new grpc.web.MethodDescriptor( + '/spotify.backstage.builds.v1.Builds/GetBuild', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.builds.v1.GetBuildRequest, + proto.spotify.backstage.builds.v1.GetBuildReply, + /** + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.builds.v1.GetBuildReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.builds.v1.GetBuildRequest, + * !proto.spotify.backstage.builds.v1.GetBuildReply>} + */ +const methodInfo_Builds_GetBuild = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.builds.v1.GetBuildReply, + /** + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.builds.v1.GetBuildReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.builds.v1.GetBuildReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.builds.v1.BuildsClient.prototype.getBuild = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.builds.v1.Builds/GetBuild', + request, + metadata || {}, + methodDescriptor_Builds_GetBuild, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.builds.v1.BuildsPromiseClient.prototype.getBuild = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.builds.v1.Builds/GetBuild', + request, + metadata || {}, + methodDescriptor_Builds_GetBuild); +}; + + +module.exports = proto.spotify.backstage.builds.v1; + diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts b/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts new file mode 100644 index 0000000000..ff0c1489cf --- /dev/null +++ b/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts @@ -0,0 +1,151 @@ +import * as jspb from "google-protobuf" + +export class ListBuildsRequest extends jspb.Message { + getEntityUri(): string; + setEntityUri(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListBuildsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListBuildsRequest): ListBuildsRequest.AsObject; + static serializeBinaryToWriter(message: ListBuildsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListBuildsRequest; + static deserializeBinaryFromReader(message: ListBuildsRequest, reader: jspb.BinaryReader): ListBuildsRequest; +} + +export namespace ListBuildsRequest { + export type AsObject = { + entityUri: string, + } +} + +export class ListBuildsReply extends jspb.Message { + getEntityUri(): string; + setEntityUri(value: string): void; + + getBuildsList(): Array; + setBuildsList(value: Array): void; + clearBuildsList(): void; + addBuilds(value?: Build, index?: number): Build; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListBuildsReply.AsObject; + static toObject(includeInstance: boolean, msg: ListBuildsReply): ListBuildsReply.AsObject; + static serializeBinaryToWriter(message: ListBuildsReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListBuildsReply; + static deserializeBinaryFromReader(message: ListBuildsReply, reader: jspb.BinaryReader): ListBuildsReply; +} + +export namespace ListBuildsReply { + export type AsObject = { + entityUri: string, + buildsList: Array, + } +} + +export class GetBuildRequest extends jspb.Message { + getBuildUri(): string; + setBuildUri(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBuildRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetBuildRequest): GetBuildRequest.AsObject; + static serializeBinaryToWriter(message: GetBuildRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBuildRequest; + static deserializeBinaryFromReader(message: GetBuildRequest, reader: jspb.BinaryReader): GetBuildRequest; +} + +export namespace GetBuildRequest { + export type AsObject = { + buildUri: string, + } +} + +export class GetBuildReply extends jspb.Message { + getBuild(): Build | undefined; + setBuild(value?: Build): void; + hasBuild(): boolean; + clearBuild(): void; + + getDetails(): BuildDetails | undefined; + setDetails(value?: BuildDetails): void; + hasDetails(): boolean; + clearDetails(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetBuildReply.AsObject; + static toObject(includeInstance: boolean, msg: GetBuildReply): GetBuildReply.AsObject; + static serializeBinaryToWriter(message: GetBuildReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetBuildReply; + static deserializeBinaryFromReader(message: GetBuildReply, reader: jspb.BinaryReader): GetBuildReply; +} + +export namespace GetBuildReply { + export type AsObject = { + build?: Build.AsObject, + details?: BuildDetails.AsObject, + } +} + +export class Build extends jspb.Message { + getUri(): string; + setUri(value: string): void; + + getCommitId(): string; + setCommitId(value: string): void; + + getMessage(): string; + setMessage(value: string): void; + + getStatus(): BuildStatus; + setStatus(value: BuildStatus): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Build.AsObject; + static toObject(includeInstance: boolean, msg: Build): Build.AsObject; + static serializeBinaryToWriter(message: Build, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Build; + static deserializeBinaryFromReader(message: Build, reader: jspb.BinaryReader): Build; +} + +export namespace Build { + export type AsObject = { + uri: string, + commitId: string, + message: string, + status: BuildStatus, + } +} + +export class BuildDetails extends jspb.Message { + getAuthor(): string; + setAuthor(value: string): void; + + getOverviewUrl(): string; + setOverviewUrl(value: string): void; + + getLogUrl(): string; + setLogUrl(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): BuildDetails.AsObject; + static toObject(includeInstance: boolean, msg: BuildDetails): BuildDetails.AsObject; + static serializeBinaryToWriter(message: BuildDetails, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): BuildDetails; + static deserializeBinaryFromReader(message: BuildDetails, reader: jspb.BinaryReader): BuildDetails; +} + +export namespace BuildDetails { + export type AsObject = { + author: string, + overviewUrl: string, + logUrl: string, + } +} + +export enum BuildStatus { + NULL = 0, + SUCCESS = 1, + FAILURE = 2, + PENDING = 3, + RUNNING = 4, +} diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_pb.js b/frontend/packages/proto/src/generated/builds/v1/builds_pb.js new file mode 100644 index 0000000000..1f00094a1d --- /dev/null +++ b/frontend/packages/proto/src/generated/builds/v1/builds_pb.js @@ -0,0 +1,1178 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.spotify.backstage.builds.v1.Build', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.BuildDetails', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.BuildStatus', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.GetBuildReply', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.GetBuildRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.ListBuildsReply', null, global); +goog.exportSymbol('proto.spotify.backstage.builds.v1.ListBuildsRequest', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.ListBuildsRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.ListBuildsRequest.displayName = 'proto.spotify.backstage.builds.v1.ListBuildsRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.ListBuildsReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.builds.v1.ListBuildsReply.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.ListBuildsReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.ListBuildsReply.displayName = 'proto.spotify.backstage.builds.v1.ListBuildsReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.GetBuildRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.GetBuildRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.GetBuildRequest.displayName = 'proto.spotify.backstage.builds.v1.GetBuildRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.GetBuildReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.GetBuildReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.GetBuildReply.displayName = 'proto.spotify.backstage.builds.v1.GetBuildReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.Build = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.Build, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.Build.displayName = 'proto.spotify.backstage.builds.v1.Build'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.builds.v1.BuildDetails = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.builds.v1.BuildDetails, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.builds.v1.BuildDetails.displayName = 'proto.spotify.backstage.builds.v1.BuildDetails'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.ListBuildsRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.toObject = function(includeInstance, msg) { + var f, obj = { + entityUri: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.ListBuildsRequest} + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.ListBuildsRequest; + return proto.spotify.backstage.builds.v1.ListBuildsRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.ListBuildsRequest} + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEntityUri(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.ListBuildsRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.ListBuildsRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntityUri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string entity_uri = 1; + * @return {string} + */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.prototype.getEntityUri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.ListBuildsRequest.prototype.setEntityUri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.ListBuildsReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.ListBuildsReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.toObject = function(includeInstance, msg) { + var f, obj = { + entityUri: jspb.Message.getFieldWithDefault(msg, 1, ""), + buildsList: jspb.Message.toObjectList(msg.getBuildsList(), + proto.spotify.backstage.builds.v1.Build.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.ListBuildsReply} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.ListBuildsReply; + return proto.spotify.backstage.builds.v1.ListBuildsReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.ListBuildsReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.ListBuildsReply} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEntityUri(value); + break; + case 2: + var value = new proto.spotify.backstage.builds.v1.Build; + reader.readMessage(value,proto.spotify.backstage.builds.v1.Build.deserializeBinaryFromReader); + msg.addBuilds(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.ListBuildsReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.ListBuildsReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntityUri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getBuildsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.spotify.backstage.builds.v1.Build.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string entity_uri = 1; + * @return {string} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.getEntityUri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.setEntityUri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated Build builds = 2; + * @return {!Array} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.getBuildsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.builds.v1.Build, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.setBuildsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spotify.backstage.builds.v1.Build=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.builds.v1.Build} + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.addBuilds = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.builds.v1.Build, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.builds.v1.ListBuildsReply.prototype.clearBuildsList = function() { + this.setBuildsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.GetBuildRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.toObject = function(includeInstance, msg) { + var f, obj = { + buildUri: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.GetBuildRequest} + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.GetBuildRequest; + return proto.spotify.backstage.builds.v1.GetBuildRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.GetBuildRequest} + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBuildUri(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.GetBuildRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.GetBuildRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBuildUri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string build_uri = 1; + * @return {string} + */ +proto.spotify.backstage.builds.v1.GetBuildRequest.prototype.getBuildUri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.GetBuildRequest.prototype.setBuildUri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.GetBuildReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.GetBuildReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.GetBuildReply.toObject = function(includeInstance, msg) { + var f, obj = { + build: (f = msg.getBuild()) && proto.spotify.backstage.builds.v1.Build.toObject(includeInstance, f), + details: (f = msg.getDetails()) && proto.spotify.backstage.builds.v1.BuildDetails.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.GetBuildReply} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.GetBuildReply; + return proto.spotify.backstage.builds.v1.GetBuildReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.GetBuildReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.GetBuildReply} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.builds.v1.Build; + reader.readMessage(value,proto.spotify.backstage.builds.v1.Build.deserializeBinaryFromReader); + msg.setBuild(value); + break; + case 2: + var value = new proto.spotify.backstage.builds.v1.BuildDetails; + reader.readMessage(value,proto.spotify.backstage.builds.v1.BuildDetails.deserializeBinaryFromReader); + msg.setDetails(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.GetBuildReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.GetBuildReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.GetBuildReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBuild(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.builds.v1.Build.serializeBinaryToWriter + ); + } + f = message.getDetails(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.spotify.backstage.builds.v1.BuildDetails.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Build build = 1; + * @return {?proto.spotify.backstage.builds.v1.Build} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.getBuild = function() { + return /** @type{?proto.spotify.backstage.builds.v1.Build} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.builds.v1.Build, 1)); +}; + + +/** @param {?proto.spotify.backstage.builds.v1.Build|undefined} value */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.setBuild = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.clearBuild = function() { + this.setBuild(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.hasBuild = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional BuildDetails details = 2; + * @return {?proto.spotify.backstage.builds.v1.BuildDetails} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.getDetails = function() { + return /** @type{?proto.spotify.backstage.builds.v1.BuildDetails} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.builds.v1.BuildDetails, 2)); +}; + + +/** @param {?proto.spotify.backstage.builds.v1.BuildDetails|undefined} value */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.setDetails = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.clearDetails = function() { + this.setDetails(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.builds.v1.GetBuildReply.prototype.hasDetails = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.Build.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.Build.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.Build} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.Build.toObject = function(includeInstance, msg) { + var f, obj = { + uri: jspb.Message.getFieldWithDefault(msg, 1, ""), + commitId: jspb.Message.getFieldWithDefault(msg, 2, ""), + message: jspb.Message.getFieldWithDefault(msg, 3, ""), + status: jspb.Message.getFieldWithDefault(msg, 4, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.Build} + */ +proto.spotify.backstage.builds.v1.Build.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.Build; + return proto.spotify.backstage.builds.v1.Build.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.Build} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.Build} + */ +proto.spotify.backstage.builds.v1.Build.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUri(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setCommitId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + case 4: + var value = /** @type {!proto.spotify.backstage.builds.v1.BuildStatus} */ (reader.readEnum()); + msg.setStatus(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.Build.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.Build.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.Build} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.Build.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCommitId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getStatus(); + if (f !== 0.0) { + writer.writeEnum( + 4, + f + ); + } +}; + + +/** + * optional string uri = 1; + * @return {string} + */ +proto.spotify.backstage.builds.v1.Build.prototype.getUri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.Build.prototype.setUri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string commit_id = 2; + * @return {string} + */ +proto.spotify.backstage.builds.v1.Build.prototype.getCommitId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.Build.prototype.setCommitId = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string message = 3; + * @return {string} + */ +proto.spotify.backstage.builds.v1.Build.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.Build.prototype.setMessage = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional BuildStatus status = 4; + * @return {!proto.spotify.backstage.builds.v1.BuildStatus} + */ +proto.spotify.backstage.builds.v1.Build.prototype.getStatus = function() { + return /** @type {!proto.spotify.backstage.builds.v1.BuildStatus} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); +}; + + +/** @param {!proto.spotify.backstage.builds.v1.BuildStatus} value */ +proto.spotify.backstage.builds.v1.Build.prototype.setStatus = function(value) { + jspb.Message.setProto3EnumField(this, 4, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.builds.v1.BuildDetails.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.builds.v1.BuildDetails} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.BuildDetails.toObject = function(includeInstance, msg) { + var f, obj = { + author: jspb.Message.getFieldWithDefault(msg, 1, ""), + overviewUrl: jspb.Message.getFieldWithDefault(msg, 2, ""), + logUrl: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.builds.v1.BuildDetails} + */ +proto.spotify.backstage.builds.v1.BuildDetails.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.builds.v1.BuildDetails; + return proto.spotify.backstage.builds.v1.BuildDetails.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.builds.v1.BuildDetails} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.builds.v1.BuildDetails} + */ +proto.spotify.backstage.builds.v1.BuildDetails.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAuthor(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setOverviewUrl(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setLogUrl(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.builds.v1.BuildDetails.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.builds.v1.BuildDetails} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.builds.v1.BuildDetails.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAuthor(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getOverviewUrl(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getLogUrl(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string author = 1; + * @return {string} + */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.getAuthor = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.setAuthor = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string overview_url = 2; + * @return {string} + */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.getOverviewUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.setOverviewUrl = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string log_url = 3; + * @return {string} + */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.getLogUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.BuildDetails.prototype.setLogUrl = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * @enum {number} + */ +proto.spotify.backstage.builds.v1.BuildStatus = { + NULL: 0, + SUCCESS: 1, + FAILURE: 2, + PENDING: 3, + RUNNING: 4 +}; + +goog.object.extend(exports, proto.spotify.backstage.builds.v1); diff --git a/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.d.ts b/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.d.ts new file mode 100644 index 0000000000..ab4076b19c --- /dev/null +++ b/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.d.ts @@ -0,0 +1,46 @@ +import * as grpcWeb from 'grpc-web'; + +import { + GetGroupReply, + GetGroupRequest, + GetUserReply, + GetUserRequest} from './identity_pb'; + +export class IdentityClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getUser( + request: GetUserRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetUserReply) => void + ): grpcWeb.ClientReadableStream; + + getGroup( + request: GetGroupRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetGroupReply) => void + ): grpcWeb.ClientReadableStream; + +} + +export class IdentityPromiseClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getUser( + request: GetUserRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + getGroup( + request: GetGroupRequest, + metadata?: grpcWeb.Metadata + ): Promise; + +} + diff --git a/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.js b/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.js new file mode 100644 index 0000000000..6fc2bc948b --- /dev/null +++ b/frontend/packages/proto/src/generated/identity/v1/identity_grpc_web_pb.js @@ -0,0 +1,233 @@ +/** + * @fileoverview gRPC-Web generated client stub for spotify.backstage.identity.v1 + * @enhanceable + * @public + */ + +// GENERATED CODE -- DO NOT EDIT! + + + +const grpc = {}; +grpc.web = require('grpc-web'); + +const proto = {}; +proto.spotify = {}; +proto.spotify.backstage = {}; +proto.spotify.backstage.identity = {}; +proto.spotify.backstage.identity.v1 = require('./identity_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.identity.v1.IdentityClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.identity.v1.IdentityPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.identity.v1.GetUserRequest, + * !proto.spotify.backstage.identity.v1.GetUserReply>} + */ +const methodDescriptor_Identity_GetUser = new grpc.web.MethodDescriptor( + '/spotify.backstage.identity.v1.Identity/GetUser', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.identity.v1.GetUserRequest, + proto.spotify.backstage.identity.v1.GetUserReply, + /** + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.identity.v1.GetUserReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.identity.v1.GetUserRequest, + * !proto.spotify.backstage.identity.v1.GetUserReply>} + */ +const methodInfo_Identity_GetUser = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.identity.v1.GetUserReply, + /** + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.identity.v1.GetUserReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.identity.v1.GetUserReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.identity.v1.IdentityClient.prototype.getUser = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.identity.v1.Identity/GetUser', + request, + metadata || {}, + methodDescriptor_Identity_GetUser, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.identity.v1.IdentityPromiseClient.prototype.getUser = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.identity.v1.Identity/GetUser', + request, + metadata || {}, + methodDescriptor_Identity_GetUser); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.identity.v1.GetGroupRequest, + * !proto.spotify.backstage.identity.v1.GetGroupReply>} + */ +const methodDescriptor_Identity_GetGroup = new grpc.web.MethodDescriptor( + '/spotify.backstage.identity.v1.Identity/GetGroup', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.identity.v1.GetGroupRequest, + proto.spotify.backstage.identity.v1.GetGroupReply, + /** + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.identity.v1.GetGroupReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.identity.v1.GetGroupRequest, + * !proto.spotify.backstage.identity.v1.GetGroupReply>} + */ +const methodInfo_Identity_GetGroup = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.identity.v1.GetGroupReply, + /** + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.identity.v1.GetGroupReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.identity.v1.GetGroupReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.identity.v1.IdentityClient.prototype.getGroup = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.identity.v1.Identity/GetGroup', + request, + metadata || {}, + methodDescriptor_Identity_GetGroup, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.identity.v1.IdentityPromiseClient.prototype.getGroup = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.identity.v1.Identity/GetGroup', + request, + metadata || {}, + methodDescriptor_Identity_GetGroup); +}; + + +module.exports = proto.spotify.backstage.identity.v1; + diff --git a/frontend/packages/proto/src/generated/identity/v1/identity_pb.d.ts b/frontend/packages/proto/src/generated/identity/v1/identity_pb.d.ts new file mode 100644 index 0000000000..ac0f4de095 --- /dev/null +++ b/frontend/packages/proto/src/generated/identity/v1/identity_pb.d.ts @@ -0,0 +1,136 @@ +import * as jspb from "google-protobuf" + +export class GetUserRequest extends jspb.Message { + getId(): string; + setId(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetUserRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetUserRequest): GetUserRequest.AsObject; + static serializeBinaryToWriter(message: GetUserRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetUserRequest; + static deserializeBinaryFromReader(message: GetUserRequest, reader: jspb.BinaryReader): GetUserRequest; +} + +export namespace GetUserRequest { + export type AsObject = { + id: string, + } +} + +export class GetUserReply extends jspb.Message { + getUser(): User | undefined; + setUser(value?: User): void; + hasUser(): boolean; + clearUser(): void; + + getGroupsList(): Array; + setGroupsList(value: Array): void; + clearGroupsList(): void; + addGroups(value?: Group, index?: number): Group; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetUserReply.AsObject; + static toObject(includeInstance: boolean, msg: GetUserReply): GetUserReply.AsObject; + static serializeBinaryToWriter(message: GetUserReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetUserReply; + static deserializeBinaryFromReader(message: GetUserReply, reader: jspb.BinaryReader): GetUserReply; +} + +export namespace GetUserReply { + export type AsObject = { + user?: User.AsObject, + groupsList: Array, + } +} + +export class GetGroupRequest extends jspb.Message { + getId(): string; + setId(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetGroupRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetGroupRequest): GetGroupRequest.AsObject; + static serializeBinaryToWriter(message: GetGroupRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetGroupRequest; + static deserializeBinaryFromReader(message: GetGroupRequest, reader: jspb.BinaryReader): GetGroupRequest; +} + +export namespace GetGroupRequest { + export type AsObject = { + id: string, + } +} + +export class GetGroupReply extends jspb.Message { + getGroup(): Group | undefined; + setGroup(value?: Group): void; + hasGroup(): boolean; + clearGroup(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetGroupReply.AsObject; + static toObject(includeInstance: boolean, msg: GetGroupReply): GetGroupReply.AsObject; + static serializeBinaryToWriter(message: GetGroupReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetGroupReply; + static deserializeBinaryFromReader(message: GetGroupReply, reader: jspb.BinaryReader): GetGroupReply; +} + +export namespace GetGroupReply { + export type AsObject = { + group?: Group.AsObject, + } +} + +export class User extends jspb.Message { + getId(): string; + setId(value: string): void; + + getName(): string; + setName(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): User.AsObject; + static toObject(includeInstance: boolean, msg: User): User.AsObject; + static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): User; + static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User; +} + +export namespace User { + export type AsObject = { + id: string, + name: string, + } +} + +export class Group extends jspb.Message { + getId(): string; + setId(value: string): void; + + getUsersList(): Array; + setUsersList(value: Array): void; + clearUsersList(): void; + addUsers(value?: User, index?: number): User; + + getGroupsList(): Array; + setGroupsList(value: Array): void; + clearGroupsList(): void; + addGroups(value?: Group, index?: number): Group; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Group.AsObject; + static toObject(includeInstance: boolean, msg: Group): Group.AsObject; + static serializeBinaryToWriter(message: Group, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Group; + static deserializeBinaryFromReader(message: Group, reader: jspb.BinaryReader): Group; +} + +export namespace Group { + export type AsObject = { + id: string, + usersList: Array, + groupsList: Array, + } +} + diff --git a/frontend/packages/proto/src/generated/identity/v1/identity_pb.js b/frontend/packages/proto/src/generated/identity/v1/identity_pb.js new file mode 100644 index 0000000000..f298cad9bd --- /dev/null +++ b/frontend/packages/proto/src/generated/identity/v1/identity_pb.js @@ -0,0 +1,1136 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.spotify.backstage.identity.v1.GetGroupReply', null, global); +goog.exportSymbol('proto.spotify.backstage.identity.v1.GetGroupRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.identity.v1.GetUserReply', null, global); +goog.exportSymbol('proto.spotify.backstage.identity.v1.GetUserRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.identity.v1.Group', null, global); +goog.exportSymbol('proto.spotify.backstage.identity.v1.User', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.GetUserRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.GetUserRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.GetUserRequest.displayName = 'proto.spotify.backstage.identity.v1.GetUserRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.GetUserReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.identity.v1.GetUserReply.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.GetUserReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.GetUserReply.displayName = 'proto.spotify.backstage.identity.v1.GetUserReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.GetGroupRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.GetGroupRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.GetGroupRequest.displayName = 'proto.spotify.backstage.identity.v1.GetGroupRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.GetGroupReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.GetGroupReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.GetGroupReply.displayName = 'proto.spotify.backstage.identity.v1.GetGroupReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.User = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.User, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.User.displayName = 'proto.spotify.backstage.identity.v1.User'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.identity.v1.Group = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.identity.v1.Group.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.identity.v1.Group, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.identity.v1.Group.displayName = 'proto.spotify.backstage.identity.v1.Group'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.GetUserRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.GetUserRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetUserRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.GetUserRequest} + */ +proto.spotify.backstage.identity.v1.GetUserRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.GetUserRequest; + return proto.spotify.backstage.identity.v1.GetUserRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.GetUserRequest} + */ +proto.spotify.backstage.identity.v1.GetUserRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.GetUserRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.GetUserRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.GetUserRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetUserRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.spotify.backstage.identity.v1.GetUserRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.identity.v1.GetUserRequest.prototype.setId = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.identity.v1.GetUserReply.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.GetUserReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.GetUserReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetUserReply.toObject = function(includeInstance, msg) { + var f, obj = { + user: (f = msg.getUser()) && proto.spotify.backstage.identity.v1.User.toObject(includeInstance, f), + groupsList: jspb.Message.toObjectList(msg.getGroupsList(), + proto.spotify.backstage.identity.v1.Group.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.GetUserReply} + */ +proto.spotify.backstage.identity.v1.GetUserReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.GetUserReply; + return proto.spotify.backstage.identity.v1.GetUserReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.GetUserReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.GetUserReply} + */ +proto.spotify.backstage.identity.v1.GetUserReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.identity.v1.User; + reader.readMessage(value,proto.spotify.backstage.identity.v1.User.deserializeBinaryFromReader); + msg.setUser(value); + break; + case 2: + var value = new proto.spotify.backstage.identity.v1.Group; + reader.readMessage(value,proto.spotify.backstage.identity.v1.Group.deserializeBinaryFromReader); + msg.addGroups(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.GetUserReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.GetUserReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetUserReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUser(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.identity.v1.User.serializeBinaryToWriter + ); + } + f = message.getGroupsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.spotify.backstage.identity.v1.Group.serializeBinaryToWriter + ); + } +}; + + +/** + * optional User user = 1; + * @return {?proto.spotify.backstage.identity.v1.User} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.getUser = function() { + return /** @type{?proto.spotify.backstage.identity.v1.User} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.identity.v1.User, 1)); +}; + + +/** @param {?proto.spotify.backstage.identity.v1.User|undefined} value */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.setUser = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.clearUser = function() { + this.setUser(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.hasUser = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated Group groups = 2; + * @return {!Array} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.getGroupsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.identity.v1.Group, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.setGroupsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spotify.backstage.identity.v1.Group=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.identity.v1.Group} + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.addGroups = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.identity.v1.Group, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.identity.v1.GetUserReply.prototype.clearGroupsList = function() { + this.setGroupsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.GetGroupRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.GetGroupRequest} + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.GetGroupRequest; + return proto.spotify.backstage.identity.v1.GetGroupRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.GetGroupRequest} + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.GetGroupRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.GetGroupRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.spotify.backstage.identity.v1.GetGroupRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.identity.v1.GetGroupRequest.prototype.setId = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.GetGroupReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.GetGroupReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetGroupReply.toObject = function(includeInstance, msg) { + var f, obj = { + group: (f = msg.getGroup()) && proto.spotify.backstage.identity.v1.Group.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.GetGroupReply} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.GetGroupReply; + return proto.spotify.backstage.identity.v1.GetGroupReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.GetGroupReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.GetGroupReply} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.identity.v1.Group; + reader.readMessage(value,proto.spotify.backstage.identity.v1.Group.deserializeBinaryFromReader); + msg.setGroup(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.GetGroupReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.GetGroupReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.GetGroupReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroup(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.identity.v1.Group.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Group group = 1; + * @return {?proto.spotify.backstage.identity.v1.Group} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.getGroup = function() { + return /** @type{?proto.spotify.backstage.identity.v1.Group} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.identity.v1.Group, 1)); +}; + + +/** @param {?proto.spotify.backstage.identity.v1.Group|undefined} value */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.setGroup = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.clearGroup = function() { + this.setGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.identity.v1.GetGroupReply.prototype.hasGroup = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.User.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.User.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.User} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.User.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.User} + */ +proto.spotify.backstage.identity.v1.User.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.User; + return proto.spotify.backstage.identity.v1.User.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.User} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.User} + */ +proto.spotify.backstage.identity.v1.User.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.User.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.User.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.User} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.User.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.spotify.backstage.identity.v1.User.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.identity.v1.User.prototype.setId = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string name = 2; + * @return {string} + */ +proto.spotify.backstage.identity.v1.User.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.identity.v1.User.prototype.setName = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.identity.v1.Group.repeatedFields_ = [2,3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.identity.v1.Group.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.identity.v1.Group.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.identity.v1.Group} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.Group.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + usersList: jspb.Message.toObjectList(msg.getUsersList(), + proto.spotify.backstage.identity.v1.User.toObject, includeInstance), + groupsList: jspb.Message.toObjectList(msg.getGroupsList(), + proto.spotify.backstage.identity.v1.Group.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.identity.v1.Group} + */ +proto.spotify.backstage.identity.v1.Group.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.identity.v1.Group; + return proto.spotify.backstage.identity.v1.Group.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.identity.v1.Group} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.identity.v1.Group} + */ +proto.spotify.backstage.identity.v1.Group.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var value = new proto.spotify.backstage.identity.v1.User; + reader.readMessage(value,proto.spotify.backstage.identity.v1.User.deserializeBinaryFromReader); + msg.addUsers(value); + break; + case 3: + var value = new proto.spotify.backstage.identity.v1.Group; + reader.readMessage(value,proto.spotify.backstage.identity.v1.Group.deserializeBinaryFromReader); + msg.addGroups(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.identity.v1.Group.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.identity.v1.Group.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.identity.v1.Group} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.identity.v1.Group.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getUsersList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.spotify.backstage.identity.v1.User.serializeBinaryToWriter + ); + } + f = message.getGroupsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 3, + f, + proto.spotify.backstage.identity.v1.Group.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.spotify.backstage.identity.v1.Group.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.identity.v1.Group.prototype.setId = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated User users = 2; + * @return {!Array} + */ +proto.spotify.backstage.identity.v1.Group.prototype.getUsersList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.identity.v1.User, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.identity.v1.Group.prototype.setUsersList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spotify.backstage.identity.v1.User=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.identity.v1.User} + */ +proto.spotify.backstage.identity.v1.Group.prototype.addUsers = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.identity.v1.User, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.identity.v1.Group.prototype.clearUsersList = function() { + this.setUsersList([]); +}; + + +/** + * repeated Group groups = 3; + * @return {!Array} + */ +proto.spotify.backstage.identity.v1.Group.prototype.getGroupsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.identity.v1.Group, 3)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.identity.v1.Group.prototype.setGroupsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 3, value); +}; + + +/** + * @param {!proto.spotify.backstage.identity.v1.Group=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.identity.v1.Group} + */ +proto.spotify.backstage.identity.v1.Group.prototype.addGroups = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.spotify.backstage.identity.v1.Group, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.identity.v1.Group.prototype.clearGroupsList = function() { + this.setGroupsList([]); +}; + + +goog.object.extend(exports, proto.spotify.backstage.identity.v1); diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts new file mode 100644 index 0000000000..a01cbd4a18 --- /dev/null +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts @@ -0,0 +1,46 @@ +import * as grpcWeb from 'grpc-web'; + +import { + CreateEntityReply, + CreateEntityRequest, + GetEntityReply, + GetEntityRequest} from './inventory_pb'; + +export class InventoryClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getEntity( + request: GetEntityRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetEntityReply) => void + ): grpcWeb.ClientReadableStream; + + createEntity( + request: CreateEntityRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: CreateEntityReply) => void + ): grpcWeb.ClientReadableStream; + +} + +export class InventoryPromiseClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getEntity( + request: GetEntityRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + createEntity( + request: CreateEntityRequest, + metadata?: grpcWeb.Metadata + ): Promise; + +} + diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js new file mode 100644 index 0000000000..e17a3ee3e6 --- /dev/null +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js @@ -0,0 +1,233 @@ +/** + * @fileoverview gRPC-Web generated client stub for spotify.backstage.inventory.v1 + * @enhanceable + * @public + */ + +// GENERATED CODE -- DO NOT EDIT! + + + +const grpc = {}; +grpc.web = require('grpc-web'); + +const proto = {}; +proto.spotify = {}; +proto.spotify.backstage = {}; +proto.spotify.backstage.inventory = {}; +proto.spotify.backstage.inventory.v1 = require('./inventory_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.inventory.v1.InventoryClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.inventory.v1.GetEntityRequest, + * !proto.spotify.backstage.inventory.v1.GetEntityReply>} + */ +const methodDescriptor_Inventory_GetEntity = new grpc.web.MethodDescriptor( + '/spotify.backstage.inventory.v1.Inventory/GetEntity', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.inventory.v1.GetEntityRequest, + proto.spotify.backstage.inventory.v1.GetEntityReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.inventory.v1.GetEntityRequest, + * !proto.spotify.backstage.inventory.v1.GetEntityReply>} + */ +const methodInfo_Inventory_GetEntity = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.inventory.v1.GetEntityReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.inventory.v1.GetEntityReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.inventory.v1.InventoryClient.prototype.getEntity = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/GetEntity', + request, + metadata || {}, + methodDescriptor_Inventory_GetEntity, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.getEntity = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/GetEntity', + request, + metadata || {}, + methodDescriptor_Inventory_GetEntity); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.inventory.v1.CreateEntityRequest, + * !proto.spotify.backstage.inventory.v1.CreateEntityReply>} + */ +const methodDescriptor_Inventory_CreateEntity = new grpc.web.MethodDescriptor( + '/spotify.backstage.inventory.v1.Inventory/CreateEntity', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.inventory.v1.CreateEntityRequest, + proto.spotify.backstage.inventory.v1.CreateEntityReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.CreateEntityReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.inventory.v1.CreateEntityRequest, + * !proto.spotify.backstage.inventory.v1.CreateEntityReply>} + */ +const methodInfo_Inventory_CreateEntity = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.inventory.v1.CreateEntityReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.CreateEntityReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.inventory.v1.CreateEntityReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.inventory.v1.InventoryClient.prototype.createEntity = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/CreateEntity', + request, + metadata || {}, + methodDescriptor_Inventory_CreateEntity, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.createEntity = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/CreateEntity', + request, + metadata || {}, + methodDescriptor_Inventory_CreateEntity); +}; + + +module.exports = proto.spotify.backstage.inventory.v1; + diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts new file mode 100644 index 0000000000..9f50e094ce --- /dev/null +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts @@ -0,0 +1,182 @@ +import * as jspb from "google-protobuf" + +export class GetEntityRequest extends jspb.Message { + getEntity(): Entity | undefined; + setEntity(value?: Entity): void; + hasEntity(): boolean; + clearEntity(): void; + + getIncludeFactsList(): Array; + setIncludeFactsList(value: Array): void; + clearIncludeFactsList(): void; + addIncludeFacts(value: string, index?: number): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetEntityRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetEntityRequest): GetEntityRequest.AsObject; + static serializeBinaryToWriter(message: GetEntityRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetEntityRequest; + static deserializeBinaryFromReader(message: GetEntityRequest, reader: jspb.BinaryReader): GetEntityRequest; +} + +export namespace GetEntityRequest { + export type AsObject = { + entity?: Entity.AsObject, + includeFactsList: Array, + } +} + +export class GetEntityReply extends jspb.Message { + getEntity(): Entity | undefined; + setEntity(value?: Entity): void; + hasEntity(): boolean; + clearEntity(): void; + + getFactsList(): Array; + setFactsList(value: Array): void; + clearFactsList(): void; + addFacts(value?: Fact, index?: number): Fact; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetEntityReply.AsObject; + static toObject(includeInstance: boolean, msg: GetEntityReply): GetEntityReply.AsObject; + static serializeBinaryToWriter(message: GetEntityReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetEntityReply; + static deserializeBinaryFromReader(message: GetEntityReply, reader: jspb.BinaryReader): GetEntityReply; +} + +export namespace GetEntityReply { + export type AsObject = { + entity?: Entity.AsObject, + factsList: Array, + } +} + +export class CreateEntityRequest extends jspb.Message { + getEntity(): Entity | undefined; + setEntity(value?: Entity): void; + hasEntity(): boolean; + clearEntity(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CreateEntityRequest.AsObject; + static toObject(includeInstance: boolean, msg: CreateEntityRequest): CreateEntityRequest.AsObject; + static serializeBinaryToWriter(message: CreateEntityRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CreateEntityRequest; + static deserializeBinaryFromReader(message: CreateEntityRequest, reader: jspb.BinaryReader): CreateEntityRequest; +} + +export namespace CreateEntityRequest { + export type AsObject = { + entity?: Entity.AsObject, + } +} + +export class CreateEntityReply extends jspb.Message { + getEntity(): Entity | undefined; + setEntity(value?: Entity): void; + hasEntity(): boolean; + clearEntity(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CreateEntityReply.AsObject; + static toObject(includeInstance: boolean, msg: CreateEntityReply): CreateEntityReply.AsObject; + static serializeBinaryToWriter(message: CreateEntityReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CreateEntityReply; + static deserializeBinaryFromReader(message: CreateEntityReply, reader: jspb.BinaryReader): CreateEntityReply; +} + +export namespace CreateEntityReply { + export type AsObject = { + entity?: Entity.AsObject, + } +} + +export class SetFactRequest extends jspb.Message { + getEntityuri(): string; + setEntityuri(value: string): void; + + getName(): string; + setName(value: string): void; + + getValue(): string; + setValue(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SetFactRequest.AsObject; + static toObject(includeInstance: boolean, msg: SetFactRequest): SetFactRequest.AsObject; + static serializeBinaryToWriter(message: SetFactRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SetFactRequest; + static deserializeBinaryFromReader(message: SetFactRequest, reader: jspb.BinaryReader): SetFactRequest; +} + +export namespace SetFactRequest { + export type AsObject = { + entityuri: string, + name: string, + value: string, + } +} + +export class SetFactReply extends jspb.Message { + getFacturi(): string; + setFacturi(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SetFactReply.AsObject; + static toObject(includeInstance: boolean, msg: SetFactReply): SetFactReply.AsObject; + static serializeBinaryToWriter(message: SetFactReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SetFactReply; + static deserializeBinaryFromReader(message: SetFactReply, reader: jspb.BinaryReader): SetFactReply; +} + +export namespace SetFactReply { + export type AsObject = { + facturi: string, + } +} + +export class Entity extends jspb.Message { + getUri(): string; + setUri(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Entity.AsObject; + static toObject(includeInstance: boolean, msg: Entity): Entity.AsObject; + static serializeBinaryToWriter(message: Entity, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Entity; + static deserializeBinaryFromReader(message: Entity, reader: jspb.BinaryReader): Entity; +} + +export namespace Entity { + export type AsObject = { + uri: string, + } +} + +export class Fact extends jspb.Message { + getEntityuri(): string; + setEntityuri(value: string): void; + + getName(): string; + setName(value: string): void; + + getValue(): string; + setValue(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Fact.AsObject; + static toObject(includeInstance: boolean, msg: Fact): Fact.AsObject; + static serializeBinaryToWriter(message: Fact, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Fact; + static deserializeBinaryFromReader(message: Fact, reader: jspb.BinaryReader): Fact; +} + +export namespace Fact { + export type AsObject = { + entityuri: string, + name: string, + value: string, + } +} + diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js new file mode 100644 index 0000000000..85a0dc2482 --- /dev/null +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js @@ -0,0 +1,1501 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.spotify.backstage.inventory.v1.CreateEntityReply', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.CreateEntityRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.Entity', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.Fact', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetEntityReply', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetEntityRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.SetFactReply', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.SetFactRequest', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.GetEntityRequest.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.GetEntityRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.GetEntityRequest.displayName = 'proto.spotify.backstage.inventory.v1.GetEntityRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.GetEntityReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.GetEntityReply.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.GetEntityReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.GetEntityReply.displayName = 'proto.spotify.backstage.inventory.v1.GetEntityReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.CreateEntityRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.CreateEntityRequest.displayName = 'proto.spotify.backstage.inventory.v1.CreateEntityRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.CreateEntityReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.CreateEntityReply.displayName = 'proto.spotify.backstage.inventory.v1.CreateEntityReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.SetFactRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.SetFactRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.SetFactRequest.displayName = 'proto.spotify.backstage.inventory.v1.SetFactRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.SetFactReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.SetFactReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.SetFactReply.displayName = 'proto.spotify.backstage.inventory.v1.SetFactReply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.Entity = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.Entity, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.Entity.displayName = 'proto.spotify.backstage.inventory.v1.Entity'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.Fact = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.Fact, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.Fact.displayName = 'proto.spotify.backstage.inventory.v1.Fact'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.GetEntityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f), + includeFactsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.GetEntityRequest} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.GetEntityRequest; + return proto.spotify.backstage.inventory.v1.GetEntityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.GetEntityRequest} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); + msg.setEntity(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addIncludeFacts(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.GetEntityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.GetEntityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntity(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter + ); + } + f = message.getIncludeFactsList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * optional Entity entity = 1; + * @return {?proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.getEntity = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Entity} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Entity|undefined} value */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.setEntity = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.clearEntity = function() { + this.setEntity(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.hasEntity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string include_facts = 2; + * @return {!Array} + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.getIncludeFactsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.setIncludeFactsList = function(value) { + jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.addIncludeFacts = function(value, opt_index) { + jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.clearIncludeFactsList = function() { + this.setIncludeFactsList([]); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.GetEntityReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.GetEntityReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.toObject = function(includeInstance, msg) { + var f, obj = { + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f), + factsList: jspb.Message.toObjectList(msg.getFactsList(), + proto.spotify.backstage.inventory.v1.Fact.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.GetEntityReply} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.GetEntityReply; + return proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.GetEntityReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.GetEntityReply} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); + msg.setEntity(value); + break; + case 2: + var value = new proto.spotify.backstage.inventory.v1.Fact; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader); + msg.addFacts(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.GetEntityReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.GetEntityReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntity(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter + ); + } + f = message.getFactsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Entity entity = 1; + * @return {?proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.getEntity = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Entity} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Entity|undefined} value */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.setEntity = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.clearEntity = function() { + this.setEntity(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.hasEntity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated Fact facts = 2; + * @return {!Array} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.getFactsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Fact, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.setFactsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.Fact=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.addFacts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.inventory.v1.Fact, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.clearFactsList = function() { + this.setFactsList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.CreateEntityRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.toObject = function(includeInstance, msg) { + var f, obj = { + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.CreateEntityRequest; + return proto.spotify.backstage.inventory.v1.CreateEntityRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); + msg.setEntity(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.CreateEntityRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntity(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Entity entity = 1; + * @return {?proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.getEntity = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Entity} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Entity|undefined} value */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.setEntity = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.clearEntity = function() { + this.setEntity(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.CreateEntityRequest.prototype.hasEntity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.CreateEntityReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.toObject = function(includeInstance, msg) { + var f, obj = { + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.CreateEntityReply} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.CreateEntityReply; + return proto.spotify.backstage.inventory.v1.CreateEntityReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.CreateEntityReply} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); + msg.setEntity(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.CreateEntityReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.CreateEntityReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntity(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Entity entity = 1; + * @return {?proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.getEntity = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Entity} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Entity|undefined} value */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.setEntity = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.clearEntity = function() { + this.setEntity(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.CreateEntityReply.prototype.hasEntity = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.SetFactRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.toObject = function(includeInstance, msg) { + var f, obj = { + entityuri: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + value: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.SetFactRequest} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.SetFactRequest; + return proto.spotify.backstage.inventory.v1.SetFactRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.SetFactRequest} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEntityuri(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.SetFactRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntityuri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getValue(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string entityUri = 1; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.getEntityuri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.setEntityuri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string name = 2; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.setName = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string value = 3; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.SetFactRequest.prototype.setValue = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.SetFactReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.SetFactReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.SetFactReply.toObject = function(includeInstance, msg) { + var f, obj = { + facturi: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.SetFactReply} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.SetFactReply; + return proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.SetFactReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.SetFactReply} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setFacturi(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.SetFactReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.SetFactReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.SetFactReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFacturi(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string factUri = 1; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.getFacturi = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.setFacturi = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.Entity.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.Entity} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.Entity.toObject = function(includeInstance, msg) { + var f, obj = { + uri: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.Entity.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.Entity; + return proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.Entity} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUri(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.Entity} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string uri = 1; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.getUri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.Entity.prototype.setUri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.Fact.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.Fact.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.Fact} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.Fact.toObject = function(includeInstance, msg) { + var f, obj = { + entityuri: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + value: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.Fact.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.Fact; + return proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.Fact} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEntityuri(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setValue(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.Fact.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.Fact} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntityuri(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getValue(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string entityUri = 1; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.Fact.prototype.getEntityuri = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.Fact.prototype.setEntityuri = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string name = 2; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.Fact.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.Fact.prototype.setName = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string value = 3; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.Fact.prototype.getValue = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.Fact.prototype.setValue = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +goog.object.extend(exports, proto.spotify.backstage.inventory.v1); diff --git a/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.d.ts b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.d.ts new file mode 100644 index 0000000000..4777abdb9b --- /dev/null +++ b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.d.ts @@ -0,0 +1,34 @@ +import * as grpcWeb from 'grpc-web'; + +import * as identity_v1_identity_pb from '../../identity/v1/identity_pb'; + +import { + Empty, + GetAllTemplatesReply} from './scaffolder_pb'; + +export class ScaffolderClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getAllTemplates( + request: Empty, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetAllTemplatesReply) => void + ): grpcWeb.ClientReadableStream; + +} + +export class ScaffolderPromiseClient { + constructor (hostname: string, + credentials?: null | { [index: string]: string; }, + options?: null | { [index: string]: string; }); + + getAllTemplates( + request: Empty, + metadata?: grpcWeb.Metadata + ): Promise; + +} + diff --git a/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.js b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.js new file mode 100644 index 0000000000..af6eef700a --- /dev/null +++ b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_grpc_web_pb.js @@ -0,0 +1,155 @@ +/** + * @fileoverview gRPC-Web generated client stub for spotify.backstage.scaffolder.v1 + * @enhanceable + * @public + */ + +// GENERATED CODE -- DO NOT EDIT! + + + +const grpc = {}; +grpc.web = require('grpc-web'); + + +var identity_v1_identity_pb = require('../../identity/v1/identity_pb.js') +const proto = {}; +proto.spotify = {}; +proto.spotify.backstage = {}; +proto.spotify.backstage.scaffolder = {}; +proto.spotify.backstage.scaffolder.v1 = require('./scaffolder_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.scaffolder.v1.ScaffolderClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.spotify.backstage.scaffolder.v1.ScaffolderPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.scaffolder.v1.Empty, + * !proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply>} + */ +const methodDescriptor_Scaffolder_GetAllTemplates = new grpc.web.MethodDescriptor( + '/spotify.backstage.scaffolder.v1.Scaffolder/GetAllTemplates', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.scaffolder.v1.Empty, + proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply, + /** + * @param {!proto.spotify.backstage.scaffolder.v1.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.scaffolder.v1.Empty, + * !proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply>} + */ +const methodInfo_Scaffolder_GetAllTemplates = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply, + /** + * @param {!proto.spotify.backstage.scaffolder.v1.Empty} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.scaffolder.v1.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.scaffolder.v1.GetAllTemplatesReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.scaffolder.v1.ScaffolderClient.prototype.getAllTemplates = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.scaffolder.v1.Scaffolder/GetAllTemplates', + request, + metadata || {}, + methodDescriptor_Scaffolder_GetAllTemplates, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.scaffolder.v1.Empty} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.scaffolder.v1.ScaffolderPromiseClient.prototype.getAllTemplates = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.scaffolder.v1.Scaffolder/GetAllTemplates', + request, + metadata || {}, + methodDescriptor_Scaffolder_GetAllTemplates); +}; + + +module.exports = proto.spotify.backstage.scaffolder.v1; + diff --git a/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_pb.d.ts b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_pb.d.ts new file mode 100644 index 0000000000..0a795dc5f8 --- /dev/null +++ b/frontend/packages/proto/src/generated/scaffolder/v1/scaffolder_pb.d.ts @@ -0,0 +1,70 @@ +import * as jspb from "google-protobuf" + +import * as identity_v1_identity_pb from '../../identity/v1/identity_pb'; + +export class Empty extends jspb.Message { + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Empty.AsObject; + static toObject(includeInstance: boolean, msg: Empty): Empty.AsObject; + static serializeBinaryToWriter(message: Empty, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Empty; + static deserializeBinaryFromReader(message: Empty, reader: jspb.BinaryReader): Empty; +} + +export namespace Empty { + export type AsObject = { + } +} + +export class GetAllTemplatesReply extends jspb.Message { + getTemplatesList(): Array