From 08dcdbc3c561792369a6572fa73f0efc33a0ac65 Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Fri, 27 Sep 2024 15:58:59 +0900 Subject: [PATCH] send auth to version check, if logged in --- cmd/humanlog/helper.go | 8 +- cmd/humanlog/main.go | 51 +- cmd/humanlog/versions.go | 23 +- go.mod | 6 +- internal/pkg/state/state.go | 1 + pkg/auth/token_source.go | 13 +- .../ntcharts/barchart/barchart.go | 509 ------------------ .../ntcharts/barchart/options.go | 90 ---- .../organizationv1connect/service.connect.go | 36 +- .../api/go/svc/organization/v1/service.pb.go | 291 +++++++--- vendor/modules.txt | 1 - 11 files changed, 312 insertions(+), 717 deletions(-) delete mode 100644 vendor/github.com/NimbleMarkets/ntcharts/barchart/barchart.go delete mode 100644 vendor/github.com/NimbleMarkets/ntcharts/barchart/options.go diff --git a/cmd/humanlog/helper.go b/cmd/humanlog/helper.go index a44fe05c..c1ed71e0 100644 --- a/cmd/humanlog/helper.go +++ b/cmd/humanlog/helper.go @@ -45,7 +45,9 @@ func ensureLoggedIn( Title("You're logged out. Would you like to login?"). Affirmative("Yes!"). Negative("No."). - Value(&confirms).Run() + Value(&confirms). + WithTheme(huh.ThemeBase16()). + Run() if !confirms { return nil, fmt.Errorf("aborting") } @@ -71,7 +73,9 @@ func ensureLoggedIn( Title("Your session has expired. Would you like to login again?"). Affirmative("Yes!"). Negative("No."). - Value(&confirms).Run() + Value(&confirms). + WithTheme(huh.ThemeBase16()). + Run() if !confirms { return nil, fmt.Errorf("aborting") } diff --git a/cmd/humanlog/main.go b/cmd/humanlog/main.go index a3a49257..8efa97e6 100644 --- a/cmd/humanlog/main.go +++ b/cmd/humanlog/main.go @@ -11,7 +11,6 @@ import ( "net/url" "os" "os/signal" - "runtime" "strconv" "strings" "time" @@ -201,6 +200,24 @@ func newApp() *cli.App { promptedToUpdate *semver.Version updateRes <-chan *checkForUpdateRes apiURL = "https://api.humanlog.io" + + getCtx = func(*cli.Context) context.Context { return ctx } + getLogger = func(*cli.Context) *slog.Logger { return slog.New(slog.NewJSONHandler(os.Stderr, nil)) } + getCfg = func(*cli.Context) *config.Config { return cfg } + getState = func(*cli.Context) *state.State { return statefile } + getTokenSource = func(*cli.Context) *auth.UserRefreshableTokenSource { return auth.NewRefreshableTokenSource() } + getAPIUrl = func(*cli.Context) string { log.Printf("using api at %q", apiURL); return apiURL } + getHTTPClient = func(*cli.Context) *http.Client { + u, _ := url.Parse(apiURL) + if host, _, _ := net.SplitHostPort(u.Host); host == "localhost" { + log.Printf("DEBUG: using localhost client") + return localhostHttpClient + } + return httpClient + } + getLocalhostHTTPClient = func(*cli.Context) *http.Client { + return localhostHttpClient + } ) app.Before = func(c *cli.Context) error { @@ -250,13 +267,9 @@ func newApp() *cli.App { promptToUpdate(semverVersion, *statefile.LatestKnownVersion) } } - - req := &checkForUpdateReq{ - arch: runtime.GOARCH, - os: runtime.GOOS, - current: version, - } - updateRes = asyncCheckForUpdate(ctx, req, cfg, statefile, apiURL, httpClient) + ll := getLogger(c) + tokenSource := getTokenSource(c) + updateRes = asyncCheckForUpdate(ctx, ll, cfg, statefile, apiURL, httpClient, tokenSource) } return nil @@ -280,27 +293,9 @@ func newApp() *cli.App { } return nil } - var ( - getCtx = func(*cli.Context) context.Context { return ctx } - getCfg = func(*cli.Context) *config.Config { return cfg } - getState = func(*cli.Context) *state.State { return statefile } - getTokenSource = func(*cli.Context) *auth.UserRefreshableTokenSource { return auth.NewRefreshableTokenSource() } - getAPIUrl = func(*cli.Context) string { log.Printf("using api at %q", apiURL); return apiURL } - getHTTPClient = func(*cli.Context) *http.Client { - u, _ := url.Parse(apiURL) - if host, _, _ := net.SplitHostPort(u.Host); host == "localhost" { - log.Printf("DEBUG: using localhost client") - return localhostHttpClient - } - return httpClient - } - getLocalhostHTTPClient = func(*cli.Context) *http.Client { - return localhostHttpClient - } - ) app.Commands = append( app.Commands, - versionCmd(getCtx, getCfg, getState, getAPIUrl, getHTTPClient), + versionCmd(getCtx, getLogger, getCfg, getState, getTokenSource, getAPIUrl, getHTTPClient), authCmd(getCtx, getCfg, getState, getTokenSource, getAPIUrl, getHTTPClient), queryCmd(getCtx, getCfg, getState, getTokenSource, getAPIUrl, getHTTPClient), gennyCmd(getCtx, getCfg, getState), @@ -392,7 +387,7 @@ func newApp() *cli.App { state := getState(cctx) // TODO(antoine): all logs to a single location, right now there's code logging // randomly everywhere - ll := slog.New(slog.NewJSONHandler(os.Stderr, nil)) + ll := getLogger(cctx) var machineID uint64 for state.MachineID == nil { // no machine ID assigned, ensure machine gets onboarded via the loggin flow diff --git a/cmd/humanlog/versions.go b/cmd/humanlog/versions.go index 8f6de21d..69ce2bdf 100644 --- a/cmd/humanlog/versions.go +++ b/cmd/humanlog/versions.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "log" + "log/slog" "net/http" "os" "runtime" @@ -19,6 +20,7 @@ import ( "github.com/humanlogio/humanlog/internal/pkg/config" "github.com/humanlogio/humanlog/internal/pkg/selfupdate" "github.com/humanlogio/humanlog/internal/pkg/state" + "github.com/humanlogio/humanlog/pkg/auth" "github.com/mattn/go-isatty" "github.com/urfave/cli" ) @@ -93,8 +95,10 @@ const versionCmdName = "version" func versionCmd( getCtx func(cctx *cli.Context) context.Context, + getLogger func(cctx *cli.Context) *slog.Logger, getCfg func(cctx *cli.Context) *config.Config, getState func(cctx *cli.Context) *state.State, + getTokenSource func(cctx *cli.Context) *auth.UserRefreshableTokenSource, getAPIUrl func(cctx *cli.Context) string, getHTTPClient func(*cli.Context) *http.Client, ) cli.Command { @@ -107,11 +111,13 @@ func versionCmd( Usage: "checks whether a newer version is available", Action: func(cctx *cli.Context) error { ctx := getCtx(cctx) + ll := getLogger(cctx) cfg := getCfg(cctx) state := getState(cctx) + tokenSource := getTokenSource(cctx) apiURL := getAPIUrl(cctx) httpClient := getHTTPClient(cctx) - nextVersion, nextArtifact, hasUpdate, err := checkForUpdate(ctx, cfg, state, apiURL, httpClient) + nextVersion, nextArtifact, hasUpdate, err := checkForUpdate(ctx, ll, cfg, state, apiURL, httpClient, tokenSource) if err != nil { return err } @@ -135,11 +141,13 @@ func versionCmd( Usage: "self-update to the latest version", Action: func(cctx *cli.Context) error { ctx := getCtx(cctx) + ll := getLogger(cctx) cfg := getCfg(cctx) state := getState(cctx) + tokenSource := getTokenSource(cctx) apiURL := getAPIUrl(cctx) httpClient := getHTTPClient(cctx) - _, _, hasUpdate, err := checkForUpdate(ctx, cfg, state, apiURL, httpClient) + _, _, hasUpdate, err := checkForUpdate(ctx, ll, cfg, state, apiURL, httpClient, tokenSource) if err != nil { return err } @@ -165,13 +173,14 @@ type checkForUpdateRes struct { hasUpdate bool } -func checkForUpdate(ctx context.Context, cfg *config.Config, state *state.State, apiURL string, httpClient *http.Client) (v *types.Version, a *types.VersionArtifact, hasUpdate bool, err error) { +func checkForUpdate(ctx context.Context, ll *slog.Logger, cfg *config.Config, state *state.State, apiURL string, httpClient *http.Client, tokenSource *auth.UserRefreshableTokenSource) (v *types.Version, a *types.VersionArtifact, hasUpdate bool, err error) { currentSV, err := version.AsSemver() if err != nil { return nil, nil, false, err } - - updateClient := cliupdatev1connect.NewUpdateServiceClient(httpClient, apiURL) + var clOpts []connect.ClientOption + clOpts = append(clOpts, connect.WithInterceptors(auth.NewRefreshedUserAuthInterceptor(ll, tokenSource))) + updateClient := cliupdatev1connect.NewUpdateServiceClient(httpClient, apiURL, clOpts...) res, err := updateClient.GetNextUpdate(ctx, connect.NewRequest(&cliupdatepb.GetNextUpdateRequest{ ProjectName: "humanlog", CurrentVersion: version, @@ -196,11 +205,11 @@ func checkForUpdate(ctx context.Context, cfg *config.Config, state *state.State, return msg.NextVersion, msg.NextArtifact, currentSV.LT(nextSV), nil } -func asyncCheckForUpdate(ctx context.Context, req *checkForUpdateReq, cfg *config.Config, state *state.State, apiURL string, httpClient *http.Client) <-chan *checkForUpdateRes { +func asyncCheckForUpdate(ctx context.Context, ll *slog.Logger, cfg *config.Config, state *state.State, apiURL string, httpClient *http.Client, tokenSource *auth.UserRefreshableTokenSource) <-chan *checkForUpdateRes { out := make(chan *checkForUpdateRes, 1) go func() { defer close(out) - nextVersion, _, hasUpdate, err := checkForUpdate(ctx, cfg, state, apiURL, httpClient) + nextVersion, _, hasUpdate, err := checkForUpdate(ctx, ll, cfg, state, apiURL, httpClient, tokenSource) if err != nil { if errors.Is(errors.Unwrap(err), context.Canceled) { return diff --git a/go.mod b/go.mod index dda17786..a487a863 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/charmbracelet/bubbletea v1.1.1 github.com/charmbracelet/huh v0.4.2 github.com/charmbracelet/lipgloss v0.13.0 + github.com/charmbracelet/x/term v0.2.0 github.com/cli/safeexec v1.0.1 github.com/fatih/color v1.16.0 github.com/go-logfmt/logfmt v0.5.1 @@ -29,6 +30,8 @@ require ( github.com/urfave/cli v1.22.14 golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/net v0.23.0 + golang.org/x/sync v0.8.0 + golang.org/x/sys v0.25.0 gonum.org/v1/gonum v0.15.1 google.golang.org/protobuf v1.33.0 ) @@ -40,7 +43,6 @@ require ( github.com/catppuccin/go v0.2.0 // indirect github.com/charmbracelet/x/ansi v0.3.1 // indirect github.com/charmbracelet/x/exp/strings v0.0.0-20240524151031-ff83003bf67a // indirect - github.com/charmbracelet/x/term v0.2.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -59,8 +61,6 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/internal/pkg/state/state.go b/internal/pkg/state/state.go index c5d39317..9721798c 100644 --- a/internal/pkg/state/state.go +++ b/internal/pkg/state/state.go @@ -105,6 +105,7 @@ type State struct { IngestionToken *typesv1.AccountToken `json:"ingestion_token,omitempty"` + // preferences set in the TUI when querying CurrentOrgID *int64 `json:"current_org_id,omitempty"` CurrentAccountID *int64 `json:"current_account_id,omitempty"` CurrentMachineID *int64 `json:"current_machine_id,omitempty"` diff --git a/pkg/auth/token_source.go b/pkg/auth/token_source.go index 980d0db2..570917f3 100644 --- a/pkg/auth/token_source.go +++ b/pkg/auth/token_source.go @@ -27,7 +27,8 @@ func NewRefreshableTokenSource() *UserRefreshableTokenSource { func (rts *UserRefreshableTokenSource) ClearToken(ctx context.Context) error { ring, err := keyring.Open(keyring.Config{ - ServiceName: KeyringName, + ServiceName: KeyringName, + KeychainSynchronizable: true, }) if err != nil { return fmt.Errorf("opening keyring: %v", err) @@ -49,7 +50,10 @@ func (rts *UserRefreshableTokenSource) GetUserToken(ctx context.Context) (*types return rts.ut, nil } - ring, err := keyring.Open(keyring.Config{ServiceName: KeyringName}) + ring, err := keyring.Open(keyring.Config{ + ServiceName: KeyringName, + KeychainSynchronizable: true, + }) if err != nil { return nil, fmt.Errorf("opening keyring: %v", err) } @@ -82,7 +86,10 @@ func (rts *UserRefreshableTokenSource) SetUserToken(ctx context.Context, userTok if err != nil { return fmt.Errorf("marshaling token to proto: %v", err) } - ring, err := keyring.Open(keyring.Config{ServiceName: KeyringName}) + ring, err := keyring.Open(keyring.Config{ + ServiceName: KeyringName, + KeychainSynchronizable: true, + }) if err != nil { return fmt.Errorf("opening keyring: %v", err) } diff --git a/vendor/github.com/NimbleMarkets/ntcharts/barchart/barchart.go b/vendor/github.com/NimbleMarkets/ntcharts/barchart/barchart.go deleted file mode 100644 index 400266f1..00000000 --- a/vendor/github.com/NimbleMarkets/ntcharts/barchart/barchart.go +++ /dev/null @@ -1,509 +0,0 @@ -// ntcharts - Copyright (c) 2024 Neomantra Corp. - -// Package barchart implements a canvas that displays a bar chart -// with bars going either horizontally or vertically. -package barchart - -import ( - "math" - - "github.com/NimbleMarkets/ntcharts/canvas" - "github.com/NimbleMarkets/ntcharts/canvas/buffer" - "github.com/NimbleMarkets/ntcharts/canvas/graph" - - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" - zone "github.com/lrstanley/bubblezone" -) - -// BarValue contain bar segment name, value and style for drawing. -type BarValue struct { - Name string - Value float64 - Style lipgloss.Style -} - -// BarData contains a label for the bar and a list of BarValues. -// If displaying vertical bars, the length of the label string will be -// bounded by the width of each bar. -// If displaying horizontal bars, the length of the label string -// will not be bounded and will affect where the vertical axis line starts. -type BarData struct { - Label string - Values []BarValue -} - -type dataSet struct { - bd BarData - buf *buffer.Float64ScaleBuffer // contains bar values -} - -// Model contains state of a barchart -type Model struct { - Canvas canvas.Model - AxisStyle lipgloss.Style // style applied when drawing axis - LabelStyle lipgloss.Style // style applied when drawing axis labels - AutoMaxValue bool // whether to automatically set max value when adding data - AutoBarWidth bool // whether to automatically set bar width - - showAxis bool // whether to display axis and labels - horizontal bool // whether to display bars horizontally - origin canvas.Point // start of axis line on canvas for graphing area - - barWidth int // width of each bar on the canvas - barGap int // number of empty spaces between each bar on the canvas - barIndices []int // size of graphing area, index value is which bar will be drawn - - max float64 // expected maximum data value - sf float64 // scale factor - data []*dataSet // each index is a unique bar - - zoneManager *zone.Manager // provides mouse functionality - zoneID string -} - -// New returns a barchart Model initialized with given width, height -// and various options. -// By default, barchart will automatically scale bar to new maximum data values, -// bar width to fill up the canvas and have one gap between bars, and display -// bars vertically. -// If the given data values are too small compared to the max value, -// then it is possible that the rendering of the bars will not be accurate -// in terms of proportions due to the limitations of the block element runes. -func New(w, h int, opts ...Option) Model { - m := Model{ - AutoMaxValue: true, - AutoBarWidth: true, - Canvas: canvas.New(w, h), - showAxis: true, - horizontal: false, - origin: canvas.Point{X: 0, Y: h - 2}, - barWidth: 1, - barGap: 1, - barIndices: make([]int, w), - max: 1, - sf: 1, - data: []*dataSet{}, - } - for _, opt := range opts { - opt(&m) - } - return m -} - -// newDataSet returns a new initialize *dataSet. -func (m *Model) newDataSet(lv BarData) *dataSet { - ds := &dataSet{ - bd: lv, - buf: buffer.NewFloat64ScaleBuffer(0, m.sf), - } - for _, v := range lv.Values { - ds.buf.Push(v.Value) - } - return ds -} - -// resetScale will recompute scale factor and scale -// all existing data sets -func (m *Model) resetScale() { - if m.horizontal { - m.sf = float64(m.Canvas.Width()-m.origin.X) / m.max - } else { - m.sf = float64(m.origin.Y) / m.max - } - for _, ds := range m.data { - ds.buf.SetScale(m.sf) - } -} - -// resetOrigin will set origin for axis and labels -func (m *Model) resetOrigin() { - if m.showAxis { - if m.horizontal { - var maxLen int - for _, ds := range m.data { - lw := len(ds.bd.Label) - if lw > maxLen { - maxLen = lw - } - } - m.origin = canvas.Point{X: maxLen, Y: 0} - } else { - m.origin = canvas.Point{X: 0, Y: m.Canvas.Height() - 2} - } - } else { - if m.horizontal { - m.origin = canvas.Point{X: 0, Y: 0} - } else { - m.origin = canvas.Point{X: 0, Y: m.Canvas.Height()} - } - } -} - -// resetBarWidth will recalculate the width of each bar such that -// the bars will fill up the graph if AutoBarWidth is enabled. -func (m *Model) resetBarWidth() { - if m.AutoBarWidth { - graphSize := m.Canvas.Width() - if m.horizontal { - graphSize = m.Canvas.Height() - } - dLen := len(m.data) - gaps := (dLen - 1) * m.barGap // total space used by gaps - size := graphSize - gaps // total available space for bars - if dLen > 0 { - m.barWidth = size / dLen // each bar width - } - } -} - -// resetBarIndices will reset the barIndices -// containing with bar to display for that row or column. -// If AutoBarWidth is enabled, then will recompute -// the bar widths such that the bars are as wide as possible -// to fit the graph with the given bar gap. -// It is possible that the bar widths and bar gap is such -// that the bars do not all fit on the graph. -func (m *Model) resetBarIndices() { - m.resetBarWidth() - if m.horizontal { - if len(m.barIndices) != m.Canvas.Height() { - m.barIndices = make([]int, m.Canvas.Height()) - } - } else { - if len(m.barIndices) != m.Canvas.Width() { - m.barIndices = make([]int, m.Canvas.Width()) - } - } - for i := range m.barIndices { // reset indices - m.barIndices[i] = -1 //indicates no bar - } - barIdx := 0 - barCount := len(m.data) // number of bars to display - end := len(m.barIndices) - for i := 0; i < end; i += m.barWidth { - j := i - jEnd := i + m.barWidth - for j < jEnd { - m.barIndices[j] = barIdx - j++ - if j >= end { - break - } - } - barIdx++ - if barIdx >= barCount { - break - } - i += m.barGap - } -} - -// Resize will change barchart display width and height. -// Existing data values will be updated to new scaling. -func (m *Model) Resize(w, h int) { - m.Canvas.Resize(w, h) - m.Canvas.ViewWidth = w - m.Canvas.ViewHeight = h - m.resetOrigin() - m.resetScale() - m.resetBarIndices() -} - -// Clear will reset barchart canvas and data. -func (m *Model) Clear() { - m.Canvas.Clear() - m.data = []*dataSet{} - if m.AutoMaxValue { - m.max = 1 - m.sf = 1 - } -} - -// SetZoneManager enables mouse functionality -// by setting a bubblezone.Manager to the linechart. -// To disable mouse functionality after enabling, call SetZoneManager on nil. -func (m *Model) SetZoneManager(zm *zone.Manager) { - m.zoneManager = zm - if (zm != nil) && (m.zoneID == "") { - m.zoneID = zm.NewPrefix() - } -} - -// ZoneManager will return linechart zone Manager. -func (m *Model) ZoneManager() *zone.Manager { - return m.zoneManager -} - -// ZoneID will return linechart zone ID used by zone Manager. -func (m *Model) ZoneID() string { - return m.zoneID -} - -// Width returns barchart width. -func (m *Model) Width() int { - return m.Canvas.Width() -} - -// Height returns barchart height. -func (m *Model) Height() int { - return m.Canvas.Height() -} - -// MaxValue returns expected maximum data value. -func (m *Model) MaxValue() float64 { - return m.max -} - -// Scale returns data scaling factor. -func (m *Model) Scale() float64 { - return m.sf -} - -// BarGap returns number of empty spaces between bars. -func (m *Model) BarGap() int { - return m.barGap -} - -// BarWidth returns the bar width drawn for each bar. -func (m *Model) BarWidth() int { - return m.barWidth -} - -// ShowAxis returns whether drawing axis and labels -// on to the barchart canvas. -func (m *Model) ShowAxis() bool { - return m.showAxis -} - -// Horizontal returns whether displaying bars horizontally. -func (m *Model) Horizontal() bool { - return m.horizontal -} - -// BarDataFromPoint returns a possible BarData containing -// all BarValues drawn for the rune on the barchart canvas -// at the given Point. -func (m *Model) BarDataFromPoint(p canvas.Point) (r BarData) { - bIdx := p.X // which bar is selected - vIdx := m.origin.Y - p.Y - 1 // which bar rune is selected - if m.horizontal { - bIdx = p.Y - vIdx = p.X - m.origin.X - if m.showAxis { - vIdx -= 1 - } - } - if bIdx >= len(m.barIndices) { - return - } - // get bar data and return all values that - // can be drawn onto that point on the canvas - if idx := m.barIndices[bIdx]; idx != -1 { - r.Label = m.data[idx].bd.Label - v := m.data[idx].bd.Values - // can use scaled data to check if which - // values are drawn on the canvas since - sv := m.data[idx].buf.ReadAll() - var sum float64 - var oLen int - for i, f := range sv { - newSum := sum + f - nLen := int(math.Floor(newSum)) - if oLen <= vIdx && vIdx <= nLen { - r.Values = append(r.Values, v[i]) - } - sum = newSum - oLen = nLen - } - } - return -} - -// SetHorizontal will either enable or disable drawing -// bars horizontally on to the barchart canvas. -func (m *Model) SetHorizontal(b bool) { - m.horizontal = b - m.resetOrigin() - m.resetScale() - m.resetBarIndices() -} - -// SetShowAxis will either enable or disable drawing -// axis and labels on to the barchart canvas. -func (m *Model) SetShowAxis(b bool) { - m.showAxis = b - m.resetOrigin() - m.resetScale() -} - -// SetBarWidth will set the bar width drawn of each bar. -// If AutoBarWidth is enabled, then this method will do nothing. -func (m *Model) SetBarWidth(w int) { - if m.AutoBarWidth { - return - } - m.barWidth = w - if m.barWidth < 1 { - m.barWidth = 1 - } - m.resetBarIndices() -} - -// SetBarGap will set the number of empty spaces between each bar. -func (m *Model) SetBarGap(g int) { - m.barGap = g - if m.barGap < 0 { - m.barGap = 0 - } - m.resetBarIndices() -} - -// SetMax will update the expected maximum values and scale factor. -// Existing values will be updated to new scaling. -func (m *Model) SetMax(f float64) { - m.max = f - m.resetScale() -} - -// Push adds given BarData to barchart data set. -// Negative values will be treated as the value 0. -// Data will be scaled using expected max value and barchart size. -func (m *Model) Push(lv BarData) { - var sum float64 // assumes no overflow - for _, v := range lv.Values { - v.Value = math.Max(v.Value, 0) - sum += v.Value - } - if m.AutoMaxValue && sum > m.max { - m.SetMax(sum) - } - m.data = append(m.data, m.newDataSet(lv)) - m.resetBarIndices() -} - -// PushAll adds all data values in []BarData to barchart data set. -// Negative values will be treated as the value 0. -// Data will be scaled using expected max value and barchart size. -func (m *Model) PushAll(lv []BarData) { - for _, v := range lv { - m.Push(v) - } -} - -// Draw will display the the scaled data values as bars on to the barchart canvas. -// The order of the bars will be displayed from left to right, or from top to bottom -// in the same order as the data was inserted. -func (m *Model) Draw() { - m.Canvas.Clear() - m.drawAxisAndLabels() - m.drawBars() -} - -// drawBars will draw columns from bottom to top -// for each data values, from left to right of the graph -// for the data set for vertical bars. -// The function will draw rows from left to right -// for each data values, from top to bottom of the graph -// for the data set for horizontal bars. -func (m *Model) drawBars() { - // value bounded by bar length - startX := m.origin.X - barLen := float64(m.origin.Y) - if m.horizontal { - barLen = float64(m.Canvas.Width() - m.origin.X) - if m.showAxis { - startX += 1 - barLen -= 1 - } - } - dLen := len(m.data) - for i, b := range m.barIndices { - if b >= 0 && b < dLen { - v := m.data[b].buf.ReadAll() - s := m.data[b].bd.Values - var sum float64 - for _, f := range v { - sum += f - } - startIdx := len(v) - 1 - for j := startIdx; j >= 0; j-- { - style := s[j].Style.Copy() - if j+1 < startIdx { - // in case of edge cases where column top runes - // are replaced, use the previous style's colors - // as the background to avoid a gap in the column - style.Background(s[j+1].Style.GetForeground()) - } - if m.horizontal { - graph.DrawRowLeftToRight(&m.Canvas, - canvas.Point{startX, i}, - math.Min(sum, barLen), - style) - } else { - graph.DrawColumnBottomToTop(&m.Canvas, - canvas.Point{i, m.origin.Y - 1}, - math.Min(sum, barLen), style) - } - sum -= v[j] - } - } - } -} - -// drawAxisAndLabels will draw axis and labels -// on to the barchart for horizontal or vertical bars -func (m *Model) drawAxisAndLabels() { - if !m.showAxis { - return - } - if m.horizontal { - graph.DrawVerticalLineDown(&m.Canvas, m.origin, m.AxisStyle) - } else { - graph.DrawHorizonalLineRight(&m.Canvas, m.origin, m.AxisStyle) - } - // attempt to draw the label under the axis for each bar - // the label string width will be bound by the bar width - lastIdx := -1 - dLen := len(m.data) - for i, b := range m.barIndices { - if b >= 0 && b < dLen { - if b != lastIdx { - l := m.data[b].bd.Label - p := canvas.Point{i, m.origin.Y + 1} - if m.horizontal { - if len(l) > m.origin.X { - l = l[:m.origin.X] - } - p = canvas.Point{0, i} - } else { - if len(l) > m.barWidth { - l = l[:m.barWidth] - } - } - m.Canvas.SetStringWithStyle(p, l, m.LabelStyle) - lastIdx = b - } - } - } -} - -func (m Model) Init() tea.Cmd { - return m.Canvas.Init() -} - -// Update forwards bubbletea Msg to underlying canvas. -func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { - var cmd tea.Cmd - m.Canvas, cmd = m.Canvas.Update(msg) - return m, cmd -} - -// View returns a string used by the bubbletea framework to display the barchart. -func (m Model) View() (r string) { - r = m.Canvas.View() - if m.zoneManager != nil { - r = m.zoneManager.Mark(m.zoneID, r) - } - return -} diff --git a/vendor/github.com/NimbleMarkets/ntcharts/barchart/options.go b/vendor/github.com/NimbleMarkets/ntcharts/barchart/options.go deleted file mode 100644 index e5044914..00000000 --- a/vendor/github.com/NimbleMarkets/ntcharts/barchart/options.go +++ /dev/null @@ -1,90 +0,0 @@ -// ntcharts - Copyright (c) 2024 Neomantra Corp. - -package barchart - -import ( - "github.com/charmbracelet/lipgloss" - zone "github.com/lrstanley/bubblezone" -) - -// Option is used to set options when initializing a barchart. Example: -// -// bc := New(width, height, WithMaxValue(someValue)) -type Option func(*Model) - -// WithZoneManager sets the bubblezone Manager used -// when processing bubbletea Msg mouse events in Update(). -func WithZoneManager(zm *zone.Manager) Option { - return func(m *Model) { - m.SetZoneManager(zm) - } -} - -// WithStyles sets the axis line and label string styles. -func WithStyles(as lipgloss.Style, ls lipgloss.Style) Option { - return func(m *Model) { - m.AxisStyle = as - m.LabelStyle = ls - } -} - -// WithNoAxis disables drawing axis and labels on to the barchart. -func WithNoAxis() Option { - return func(m *Model) { - m.SetShowAxis(false) - } -} - -// WithHorizontalBars displays bars horizontally from right to left, -// with each bar displayed from top to bottom. -func WithHorizontalBars() Option { - return func(m *Model) { - m.SetHorizontal(true) - } -} - -// WithNoAutoMaxValue disables automatically setting the max value -// if new data greater than the current max is added. -func WithNoAutoMaxValue() Option { - return func(m *Model) { - m.AutoMaxValue = false - } -} - -// WithMaxValue sets the expected maximum data value -// to given float64. -func WithMaxValue(f float64) Option { - return func(m *Model) { - m.SetMax(f) - } -} - -// WithNoAutoBarWidth disables automatically setting the bar widths -// to fill the canvas when drawing. -func WithNoAutoBarWidth() Option { - return func(m *Model) { - m.AutoBarWidth = false - } -} - -// WithBarWidth sets the bar widths when when drawing. -func WithBarWidth(w int) Option { - return func(m *Model) { - m.SetBarWidth(w) - } -} - -// WithBarGap sets the empty spaces between bars when drawing. -func WithBarGap(g int) Option { - return func(m *Model) { - m.SetBarGap(g) - } -} - -// WithDataSet adds all bar data values in -// []BarData to barchart data set. -func WithDataSet(d []BarData) Option { - return func(m *Model) { - m.PushAll(d) - } -} diff --git a/vendor/github.com/humanlogio/api/go/svc/organization/v1/organizationv1connect/service.connect.go b/vendor/github.com/humanlogio/api/go/svc/organization/v1/organizationv1connect/service.connect.go index 4efb315e..0434eee1 100644 --- a/vendor/github.com/humanlogio/api/go/svc/organization/v1/organizationv1connect/service.connect.go +++ b/vendor/github.com/humanlogio/api/go/svc/organization/v1/organizationv1connect/service.connect.go @@ -33,6 +33,9 @@ const ( // reflection-formatted method names, remove the leading slash and convert the remaining slash to a // period. const ( + // OrganizationServiceCreateAccountProcedure is the fully-qualified name of the + // OrganizationService's CreateAccount RPC. + OrganizationServiceCreateAccountProcedure = "/svc.organization.v1.OrganizationService/CreateAccount" // OrganizationServiceListAccountProcedure is the fully-qualified name of the OrganizationService's // ListAccount RPC. OrganizationServiceListAccountProcedure = "/svc.organization.v1.OrganizationService/ListAccount" @@ -40,12 +43,14 @@ const ( // These variables are the protoreflect.Descriptor objects for the RPCs defined in this package. var ( - organizationServiceServiceDescriptor = v1.File_svc_organization_v1_service_proto.Services().ByName("OrganizationService") - organizationServiceListAccountMethodDescriptor = organizationServiceServiceDescriptor.Methods().ByName("ListAccount") + organizationServiceServiceDescriptor = v1.File_svc_organization_v1_service_proto.Services().ByName("OrganizationService") + organizationServiceCreateAccountMethodDescriptor = organizationServiceServiceDescriptor.Methods().ByName("CreateAccount") + organizationServiceListAccountMethodDescriptor = organizationServiceServiceDescriptor.Methods().ByName("ListAccount") ) // OrganizationServiceClient is a client for the svc.organization.v1.OrganizationService service. type OrganizationServiceClient interface { + CreateAccount(context.Context, *connect.Request[v1.CreateAccountRequest]) (*connect.Response[v1.CreateAccountResponse], error) ListAccount(context.Context, *connect.Request[v1.ListAccountRequest]) (*connect.Response[v1.ListAccountResponse], error) } @@ -59,6 +64,12 @@ type OrganizationServiceClient interface { func NewOrganizationServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) OrganizationServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &organizationServiceClient{ + createAccount: connect.NewClient[v1.CreateAccountRequest, v1.CreateAccountResponse]( + httpClient, + baseURL+OrganizationServiceCreateAccountProcedure, + connect.WithSchema(organizationServiceCreateAccountMethodDescriptor), + connect.WithClientOptions(opts...), + ), listAccount: connect.NewClient[v1.ListAccountRequest, v1.ListAccountResponse]( httpClient, baseURL+OrganizationServiceListAccountProcedure, @@ -70,7 +81,13 @@ func NewOrganizationServiceClient(httpClient connect.HTTPClient, baseURL string, // organizationServiceClient implements OrganizationServiceClient. type organizationServiceClient struct { - listAccount *connect.Client[v1.ListAccountRequest, v1.ListAccountResponse] + createAccount *connect.Client[v1.CreateAccountRequest, v1.CreateAccountResponse] + listAccount *connect.Client[v1.ListAccountRequest, v1.ListAccountResponse] +} + +// CreateAccount calls svc.organization.v1.OrganizationService.CreateAccount. +func (c *organizationServiceClient) CreateAccount(ctx context.Context, req *connect.Request[v1.CreateAccountRequest]) (*connect.Response[v1.CreateAccountResponse], error) { + return c.createAccount.CallUnary(ctx, req) } // ListAccount calls svc.organization.v1.OrganizationService.ListAccount. @@ -81,6 +98,7 @@ func (c *organizationServiceClient) ListAccount(ctx context.Context, req *connec // OrganizationServiceHandler is an implementation of the svc.organization.v1.OrganizationService // service. type OrganizationServiceHandler interface { + CreateAccount(context.Context, *connect.Request[v1.CreateAccountRequest]) (*connect.Response[v1.CreateAccountResponse], error) ListAccount(context.Context, *connect.Request[v1.ListAccountRequest]) (*connect.Response[v1.ListAccountResponse], error) } @@ -90,6 +108,12 @@ type OrganizationServiceHandler interface { // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. func NewOrganizationServiceHandler(svc OrganizationServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + organizationServiceCreateAccountHandler := connect.NewUnaryHandler( + OrganizationServiceCreateAccountProcedure, + svc.CreateAccount, + connect.WithSchema(organizationServiceCreateAccountMethodDescriptor), + connect.WithHandlerOptions(opts...), + ) organizationServiceListAccountHandler := connect.NewUnaryHandler( OrganizationServiceListAccountProcedure, svc.ListAccount, @@ -98,6 +122,8 @@ func NewOrganizationServiceHandler(svc OrganizationServiceHandler, opts ...conne ) return "/svc.organization.v1.OrganizationService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { + case OrganizationServiceCreateAccountProcedure: + organizationServiceCreateAccountHandler.ServeHTTP(w, r) case OrganizationServiceListAccountProcedure: organizationServiceListAccountHandler.ServeHTTP(w, r) default: @@ -109,6 +135,10 @@ func NewOrganizationServiceHandler(svc OrganizationServiceHandler, opts ...conne // UnimplementedOrganizationServiceHandler returns CodeUnimplemented from all methods. type UnimplementedOrganizationServiceHandler struct{} +func (UnimplementedOrganizationServiceHandler) CreateAccount(context.Context, *connect.Request[v1.CreateAccountRequest]) (*connect.Response[v1.CreateAccountResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.organization.v1.OrganizationService.CreateAccount is not implemented")) +} + func (UnimplementedOrganizationServiceHandler) ListAccount(context.Context, *connect.Request[v1.ListAccountRequest]) (*connect.Response[v1.ListAccountResponse], error) { return nil, connect.NewError(connect.CodeUnimplemented, errors.New("svc.organization.v1.OrganizationService.ListAccount is not implemented")) } diff --git a/vendor/github.com/humanlogio/api/go/svc/organization/v1/service.pb.go b/vendor/github.com/humanlogio/api/go/svc/organization/v1/service.pb.go index 040765d0..4901e004 100644 --- a/vendor/github.com/humanlogio/api/go/svc/organization/v1/service.pb.go +++ b/vendor/github.com/humanlogio/api/go/svc/organization/v1/service.pb.go @@ -21,6 +21,108 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type CreateAccountRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrganizationId int64 `protobuf:"varint,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + AccountName string `protobuf:"bytes,2,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"` +} + +func (x *CreateAccountRequest) Reset() { + *x = CreateAccountRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_svc_organization_v1_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateAccountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountRequest) ProtoMessage() {} + +func (x *CreateAccountRequest) ProtoReflect() protoreflect.Message { + mi := &file_svc_organization_v1_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAccountRequest.ProtoReflect.Descriptor instead. +func (*CreateAccountRequest) Descriptor() ([]byte, []int) { + return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateAccountRequest) GetOrganizationId() int64 { + if x != nil { + return x.OrganizationId + } + return 0 +} + +func (x *CreateAccountRequest) GetAccountName() string { + if x != nil { + return x.AccountName + } + return "" +} + +type CreateAccountResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Account *v1.Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` +} + +func (x *CreateAccountResponse) Reset() { + *x = CreateAccountResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_svc_organization_v1_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateAccountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateAccountResponse) ProtoMessage() {} + +func (x *CreateAccountResponse) ProtoReflect() protoreflect.Message { + mi := &file_svc_organization_v1_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateAccountResponse.ProtoReflect.Descriptor instead. +func (*CreateAccountResponse) Descriptor() ([]byte, []int) { + return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateAccountResponse) GetAccount() *v1.Account { + if x != nil { + return x.Account + } + return nil +} + type ListAccountRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -34,7 +136,7 @@ type ListAccountRequest struct { func (x *ListAccountRequest) Reset() { *x = ListAccountRequest{} if protoimpl.UnsafeEnabled { - mi := &file_svc_organization_v1_service_proto_msgTypes[0] + mi := &file_svc_organization_v1_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +149,7 @@ func (x *ListAccountRequest) String() string { func (*ListAccountRequest) ProtoMessage() {} func (x *ListAccountRequest) ProtoReflect() protoreflect.Message { - mi := &file_svc_organization_v1_service_proto_msgTypes[0] + mi := &file_svc_organization_v1_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +162,7 @@ func (x *ListAccountRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListAccountRequest.ProtoReflect.Descriptor instead. func (*ListAccountRequest) Descriptor() ([]byte, []int) { - return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{0} + return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{2} } func (x *ListAccountRequest) GetCursor() *v1.Cursor { @@ -96,7 +198,7 @@ type ListAccountResponse struct { func (x *ListAccountResponse) Reset() { *x = ListAccountResponse{} if protoimpl.UnsafeEnabled { - mi := &file_svc_organization_v1_service_proto_msgTypes[1] + mi := &file_svc_organization_v1_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109,7 +211,7 @@ func (x *ListAccountResponse) String() string { func (*ListAccountResponse) ProtoMessage() {} func (x *ListAccountResponse) ProtoReflect() protoreflect.Message { - mi := &file_svc_organization_v1_service_proto_msgTypes[1] + mi := &file_svc_organization_v1_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122,7 +224,7 @@ func (x *ListAccountResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListAccountResponse.ProtoReflect.Descriptor instead. func (*ListAccountResponse) Descriptor() ([]byte, []int) { - return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{1} + return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{3} } func (x *ListAccountResponse) GetNext() *v1.Cursor { @@ -150,7 +252,7 @@ type ListAccountResponse_ListItem struct { func (x *ListAccountResponse_ListItem) Reset() { *x = ListAccountResponse_ListItem{} if protoimpl.UnsafeEnabled { - mi := &file_svc_organization_v1_service_proto_msgTypes[2] + mi := &file_svc_organization_v1_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -163,7 +265,7 @@ func (x *ListAccountResponse_ListItem) String() string { func (*ListAccountResponse_ListItem) ProtoMessage() {} func (x *ListAccountResponse_ListItem) ProtoReflect() protoreflect.Message { - mi := &file_svc_organization_v1_service_proto_msgTypes[2] + mi := &file_svc_organization_v1_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -176,7 +278,7 @@ func (x *ListAccountResponse_ListItem) ProtoReflect() protoreflect.Message { // Deprecated: Use ListAccountResponse_ListItem.ProtoReflect.Descriptor instead. func (*ListAccountResponse_ListItem) Descriptor() ([]byte, []int) { - return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{1, 0} + return file_svc_organization_v1_service_proto_rawDescGZIP(), []int{3, 0} } func (x *ListAccountResponse_ListItem) GetAccount() *v1.Account { @@ -197,48 +299,66 @@ var file_svc_organization_v1_service_proto_rawDesc = []byte{ 0x1a, 0x15, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x63, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x06, 0x63, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, - 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x22, 0xbd, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x6e, - 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x04, 0x6e, 0x65, 0x78, - 0x74, 0x12, 0x47, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x31, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, - 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x37, 0x0a, 0x08, 0x4c, 0x69, - 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x32, 0x79, 0x0a, 0x13, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x62, 0x0a, 0x0b, 0x4c, 0x69, - 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x73, 0x76, 0x63, 0x2e, - 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xd6, - 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x75, 0x6d, 0x61, 0x6e, 0x6c, 0x6f, 0x67, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x73, 0x76, 0x63, 0x2f, 0x6f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4f, - 0x58, 0xaa, 0x02, 0x13, 0x53, 0x76, 0x63, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x53, 0x76, 0x63, 0x5c, 0x4f, 0x72, - 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, - 0x53, 0x76, 0x63, 0x5c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x15, 0x53, 0x76, 0x63, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x62, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x44, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7d, + 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbd, 0x01, + 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x04, 0x6e, 0x65, 0x78, 0x74, 0x12, 0x47, 0x0a, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x73, 0x76, 0x63, + 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, + 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x37, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, + 0x12, 0x2b, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xe3, 0x01, + 0x0a, 0x13, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x68, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2a, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x41, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x62, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x27, + 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x42, 0xd6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x76, 0x63, 0x2e, + 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x75, 0x6d, 0x61, + 0x6e, 0x6c, 0x6f, 0x67, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x73, 0x76, + 0x63, 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, + 0x31, 0x3b, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, + 0xa2, 0x02, 0x03, 0x53, 0x4f, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x76, 0x63, 0x2e, 0x4f, 0x72, 0x67, + 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x53, + 0x76, 0x63, 0x5c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x53, 0x76, 0x63, 0x5c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x53, 0x76, 0x63, 0x3a, 0x3a, 0x4f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -253,26 +373,31 @@ func file_svc_organization_v1_service_proto_rawDescGZIP() []byte { return file_svc_organization_v1_service_proto_rawDescData } -var file_svc_organization_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_svc_organization_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_svc_organization_v1_service_proto_goTypes = []any{ - (*ListAccountRequest)(nil), // 0: svc.organization.v1.ListAccountRequest - (*ListAccountResponse)(nil), // 1: svc.organization.v1.ListAccountResponse - (*ListAccountResponse_ListItem)(nil), // 2: svc.organization.v1.ListAccountResponse.ListItem - (*v1.Cursor)(nil), // 3: types.v1.Cursor - (*v1.Account)(nil), // 4: types.v1.Account + (*CreateAccountRequest)(nil), // 0: svc.organization.v1.CreateAccountRequest + (*CreateAccountResponse)(nil), // 1: svc.organization.v1.CreateAccountResponse + (*ListAccountRequest)(nil), // 2: svc.organization.v1.ListAccountRequest + (*ListAccountResponse)(nil), // 3: svc.organization.v1.ListAccountResponse + (*ListAccountResponse_ListItem)(nil), // 4: svc.organization.v1.ListAccountResponse.ListItem + (*v1.Account)(nil), // 5: types.v1.Account + (*v1.Cursor)(nil), // 6: types.v1.Cursor } var file_svc_organization_v1_service_proto_depIdxs = []int32{ - 3, // 0: svc.organization.v1.ListAccountRequest.cursor:type_name -> types.v1.Cursor - 3, // 1: svc.organization.v1.ListAccountResponse.next:type_name -> types.v1.Cursor - 2, // 2: svc.organization.v1.ListAccountResponse.items:type_name -> svc.organization.v1.ListAccountResponse.ListItem - 4, // 3: svc.organization.v1.ListAccountResponse.ListItem.account:type_name -> types.v1.Account - 0, // 4: svc.organization.v1.OrganizationService.ListAccount:input_type -> svc.organization.v1.ListAccountRequest - 1, // 5: svc.organization.v1.OrganizationService.ListAccount:output_type -> svc.organization.v1.ListAccountResponse - 5, // [5:6] is the sub-list for method output_type - 4, // [4:5] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 5, // 0: svc.organization.v1.CreateAccountResponse.account:type_name -> types.v1.Account + 6, // 1: svc.organization.v1.ListAccountRequest.cursor:type_name -> types.v1.Cursor + 6, // 2: svc.organization.v1.ListAccountResponse.next:type_name -> types.v1.Cursor + 4, // 3: svc.organization.v1.ListAccountResponse.items:type_name -> svc.organization.v1.ListAccountResponse.ListItem + 5, // 4: svc.organization.v1.ListAccountResponse.ListItem.account:type_name -> types.v1.Account + 0, // 5: svc.organization.v1.OrganizationService.CreateAccount:input_type -> svc.organization.v1.CreateAccountRequest + 2, // 6: svc.organization.v1.OrganizationService.ListAccount:input_type -> svc.organization.v1.ListAccountRequest + 1, // 7: svc.organization.v1.OrganizationService.CreateAccount:output_type -> svc.organization.v1.CreateAccountResponse + 3, // 8: svc.organization.v1.OrganizationService.ListAccount:output_type -> svc.organization.v1.ListAccountResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_svc_organization_v1_service_proto_init() } @@ -282,7 +407,7 @@ func file_svc_organization_v1_service_proto_init() { } if !protoimpl.UnsafeEnabled { file_svc_organization_v1_service_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*ListAccountRequest); i { + switch v := v.(*CreateAccountRequest); i { case 0: return &v.state case 1: @@ -294,7 +419,7 @@ func file_svc_organization_v1_service_proto_init() { } } file_svc_organization_v1_service_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ListAccountResponse); i { + switch v := v.(*CreateAccountResponse); i { case 0: return &v.state case 1: @@ -306,6 +431,30 @@ func file_svc_organization_v1_service_proto_init() { } } file_svc_organization_v1_service_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*ListAccountRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_svc_organization_v1_service_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*ListAccountResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_svc_organization_v1_service_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ListAccountResponse_ListItem); i { case 0: return &v.state @@ -324,7 +473,7 @@ func file_svc_organization_v1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_svc_organization_v1_service_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/vendor/modules.txt b/vendor/modules.txt index 571caeb6..999527b5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -13,7 +13,6 @@ github.com/99designs/go-keychain github.com/99designs/keyring # github.com/NimbleMarkets/ntcharts v0.1.2 ## explicit; go 1.22.0 -github.com/NimbleMarkets/ntcharts/barchart github.com/NimbleMarkets/ntcharts/canvas github.com/NimbleMarkets/ntcharts/canvas/buffer github.com/NimbleMarkets/ntcharts/canvas/graph