Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into expand-resource-labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Forfold committed Dec 28, 2023
2 parents 816cba6 + 26c13cb commit d7f5eff
Show file tree
Hide file tree
Showing 64 changed files with 5,220 additions and 2,580 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,6 +70,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: '/language:${{matrix.language}}'
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ cy-mobile-prod-run: web/src/build/static/app.js cypress
swo/swodb/queries.sql.go: $(BIN_DIR)/tools/sqlc sqlc.yaml swo/*/*.sql migrate/migrations/*.sql */queries.sql */*/queries.sql migrate/schema.sql
$(BIN_DIR)/tools/sqlc generate

web/src/schema.d.ts: graphql2/schema.graphql $(NODE_DEPS) web/src/genschema.go
web/src/schema.d.ts: graphql2/schema.graphql graphql2/graph/*.graphqls $(NODE_DEPS) web/src/genschema.go
go generate ./web/src

help: ## Show all valid options
Expand Down Expand Up @@ -220,7 +220,7 @@ graphql2/mapconfig.go: $(CFGPARAMS) config/config.go graphql2/generated.go devto
graphql2/maplimit.go: $(CFGPARAMS) limit/id.go graphql2/generated.go devtools/limitapigen/*
(cd ./graphql2 && go run ../devtools/limitapigen -out maplimit.go && go run golang.org/x/tools/cmd/goimports -w ./maplimit.go) || go generate ./graphql2

graphql2/generated.go: graphql2/schema.graphql graphql2/gqlgen.yml go.mod
graphql2/generated.go: graphql2/schema.graphql graphql2/gqlgen.yml go.mod graphql2/graph/*.graphqls
go generate ./graphql2

pkg/sysapi/sysapi_grpc.pb.go: pkg/sysapi/sysapi.proto $(BIN_DIR)/tools/protoc-gen-go-grpc $(BIN_DIR)/tools/protoc
Expand Down Expand Up @@ -293,7 +293,7 @@ web/src/build/static: web/src/esbuild.config.js $(NODE_DEPS) $(shell find ./web/
$(MAKE) ensure-yarn
rm -rf web/src/build/static
mkdir -p web/src/build/static
cp -f web/src/app/public/icons/favicon-* web/src/app/public/logos/black/goalert-alt-logo.png web/src/build/static/
cp -f web/src/app/public/icons/favicon-* web/src/app/public/logos/lightmode_* web/src/app/public/logos/darkmode_* web/src/build/static/
GOALERT_VERSION=$(GIT_VERSION) yarn run esbuild

web/src/build/static/app.js: web/src/build/static $(NODE_DEPS)
Expand Down
70 changes: 61 additions & 9 deletions devtools/gqltsgen/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,36 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"slices"

"github.com/vektah/gqlparser/v2"
"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser"
)

func main() {
out := flag.String("out", "", "Output file.")
flag.Parse()
log.SetFlags(log.Lshortfile)
var src []*ast.Source
for _, file := range flag.Args() {
data, err := os.ReadFile(file)
for _, pattern := range flag.Args() {
files, err := filepath.Glob(pattern)
if err != nil {
log.Fatal("ERROR:", err)
}
src = append(src, &ast.Source{
Name: file,
Input: string(data),
})
for _, file := range files {
data, err := os.ReadFile(file)
if err != nil {
log.Fatal("ERROR:", err)
}
src = append(src, &ast.Source{
Name: file,
Input: string(data),
})
}
}

doc, err := parser.ParseSchemas(src...)
sch, err := gqlparser.LoadSchema(src...)
if err != nil {
log.Fatal("ERROR:", err)
}
Expand Down Expand Up @@ -65,16 +73,60 @@ func main() {

fmt.Fprintf(w, "// Code generated by devtools/gqltsgen DO NOT EDIT.\n\n")

for _, def := range doc.Definitions {
var types []*ast.Definition
for _, typ := range sch.Types {
types = append(types, typ)
}

// sort by name to ensure consistent output
slices.SortFunc(types, func(a, b *ast.Definition) int {
if a.Name == b.Name {
return 0
}

if a.Name < b.Name {
return -1
}

return 1
})

for _, def := range types {
switch def.Kind {
case ast.Enum:
fmt.Fprintf(w, "export type %s = ", def.Name)

slices.SortFunc(def.EnumValues, func(a, b *ast.EnumValueDefinition) int {
if a.Name == b.Name {
return 0
}

if a.Name < b.Name {
return -1
}

return 1
})

for _, e := range def.EnumValues {
fmt.Fprintf(w, " | '%s'", e.Name)
}
fmt.Fprintf(w, "\n\n")
case ast.InputObject, ast.Object:
fmt.Fprintf(w, "export interface %s {\n", def.Name)

slices.SortFunc(def.Fields, func(a, b *ast.FieldDefinition) int {
if a.Name == b.Name {
return 0
}

if a.Name < b.Name {
return -1
}

return 1
})

for _, e := range def.Fields {
mod := "?"
modTypeName := "null | "
Expand Down
2 changes: 1 addition & 1 deletion escalation/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var searchTemplate = template.Must(template.New("search").Funcs(search.Helpers()
AND NOT pol.id = any(:omit)
{{end}}
{{if .Search}}
AND ({{orderedPrefixSearch "search" "pol.name"}} OR {{contains "search" "pol.description"}})
AND ({{orderedPrefixSearch "search" "pol.name"}} OR {{contains "search" "pol.description"}} OR {{contains "search" "pol.name"}})
{{end}}
{{if .After.Name}}
AND
Expand Down
2 changes: 2 additions & 0 deletions expflag/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ type Flag string
const (
Example Flag = "example"
GQLAPIKey Flag = "gql-api-keys"
DestTypes Flag = "dest-types"
)

var desc = map[Flag]string{
Example: "An example experimental flag to demonstrate usage.",
GQLAPIKey: "Admin-only GraphQL API key support.",
DestTypes: "Generic destination type API.",
}

// AllFlags returns a slice of all experimental flags sorted by name.
Expand Down
54 changes: 27 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ module github.com/target/goalert
go 1.21

require (
github.com/99designs/gqlgen v0.17.40
github.com/brianvoe/gofakeit/v6 v6.24.0
github.com/coreos/go-oidc/v3 v3.7.0
github.com/99designs/gqlgen v0.17.41
github.com/brianvoe/gofakeit/v6 v6.26.3
github.com/coreos/go-oidc/v3 v3.9.0
github.com/creack/pty/v2 v2.0.1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/emersion/go-smtp v0.19.0
github.com/fatih/color v1.16.0
github.com/felixge/httpsnoop v1.0.4
github.com/fullstorydev/grpcui v1.3.3
github.com/golang-jwt/jwt/v5 v5.1.0
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/google/go-github/v56 v56.0.0
github.com/google/uuid v1.4.0
github.com/google/uuid v1.5.0
github.com/gordonklaus/ineffassign v0.1.0
github.com/hashicorp/yamux v0.1.1
github.com/jackc/pgtype v1.14.0
github.com/jackc/pgx/v5 v5.5.0
github.com/jackc/pgx/v5 v5.5.1
github.com/jmespath/go-jmespath v0.4.0
github.com/joho/godotenv v1.5.1
github.com/kffl/speedbump v1.1.0
Expand All @@ -30,33 +30,33 @@ require (
github.com/mailhog/storage v1.0.1
github.com/matcornic/hermes/v2 v2.1.0
github.com/mnako/letters v0.2.2
github.com/nyaruka/phonenumbers v1.2.2
github.com/nyaruka/phonenumbers v1.3.0
github.com/oauth2-proxy/mockoidc v0.0.0-20220308204021-b9169deeb282
github.com/pelletier/go-toml/v2 v2.1.0
github.com/pelletier/go-toml/v2 v2.1.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.17.0
github.com/rubenv/sql-migrate v1.5.2
github.com/rubenv/sql-migrate v1.6.0
github.com/sirupsen/logrus v1.9.3
github.com/slack-go/slack v0.12.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
github.com/spf13/viper v1.18.2
github.com/sqlc-dev/pqtype v0.3.0
github.com/stretchr/testify v1.8.4
github.com/vektah/gqlparser/v2 v2.5.10
golang.org/x/crypto v0.15.0
golang.org/x/oauth2 v0.14.0
golang.org/x/sys v0.14.0
golang.org/x/term v0.14.0
golang.org/x/tools v0.15.0
google.golang.org/grpc v1.59.0
golang.org/x/crypto v0.17.0
golang.org/x/oauth2 v0.15.0
golang.org/x/sys v0.15.0
golang.org/x/term v0.15.0
golang.org/x/tools v0.16.1
google.golang.org/grpc v1.60.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf v1.31.0
google.golang.org/protobuf v1.32.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
honnef.co/go/tools v0.4.6
)

require (
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
Expand All @@ -78,7 +78,7 @@ require (
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 // indirect
github.com/envoyproxy/go-control-plane v0.11.1 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fullstorydev/grpcurl v1.8.8 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
Expand Down Expand Up @@ -129,13 +129,13 @@ require (
github.com/prometheus/procfs v0.11.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
github.com/sosodev/duration v1.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
github.com/subosito/gotenv v1.6.0 // indirect
Expand All @@ -147,16 +147,16 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 // indirect
golang.org/x/exp/typeparams v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit d7f5eff

Please sign in to comment.