mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
graphqlbackend: Move utils to internal/ (#64117)
The utils are currently used outside of cmd/frontend, so to break the internal -> cmd import I'm moving and merging the utils package with internal/gqlutil. Test plan: Just moved around and renamed a package, the go compiler doesn't complain.
This commit is contained in:
parent
2c73f72e85
commit
55cdb4961c
@ -237,7 +237,6 @@ go_library(
|
||||
"//cmd/frontend/auth",
|
||||
"//cmd/frontend/envvar",
|
||||
"//cmd/frontend/graphqlbackend/externallink",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//cmd/frontend/hubspot",
|
||||
"//cmd/frontend/hubspot/hubspotutil",
|
||||
"//cmd/frontend/internal/auth/providers",
|
||||
@ -479,7 +478,6 @@ go_test(
|
||||
"//cmd/frontend/enterprise",
|
||||
"//cmd/frontend/graphqlbackend/apitest",
|
||||
"//cmd/frontend/graphqlbackend/externallink",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//cmd/frontend/internal/auth/providers",
|
||||
"//cmd/frontend/internal/auth/userpasswd",
|
||||
"//cmd/frontend/internal/backend",
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -16,10 +15,10 @@ import (
|
||||
|
||||
type AccessRequestsArgs struct {
|
||||
database.AccessRequestsFilterArgs
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
}
|
||||
|
||||
func (r *schemaResolver) AccessRequests(ctx context.Context, args *AccessRequestsArgs) (*graphqlutil.ConnectionResolver[*accessRequestResolver], error) {
|
||||
func (r *schemaResolver) AccessRequests(ctx context.Context, args *AccessRequestsArgs) (*gqlutil.ConnectionResolver[*accessRequestResolver], error) {
|
||||
// 🚨 SECURITY: Only site admins can see access requests.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
@ -31,12 +30,12 @@ func (r *schemaResolver) AccessRequests(ctx context.Context, args *AccessRequest
|
||||
}
|
||||
|
||||
reverse := false
|
||||
connectionOptions := graphqlutil.ConnectionResolverOptions{
|
||||
connectionOptions := gqlutil.ConnectionResolverOptions{
|
||||
Reverse: &reverse,
|
||||
OrderBy: database.OrderBy{{Field: string(database.AccessRequestListID)}},
|
||||
Ascending: false,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[*accessRequestResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
return gqlutil.NewConnectionResolver[*accessRequestResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
}
|
||||
|
||||
type accessRequestConnectionStore struct {
|
||||
|
||||
@ -13,12 +13,12 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbtest"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -300,5 +300,5 @@ func TestAccessRequestConnectionStore(t *testing.T) {
|
||||
db: db,
|
||||
}
|
||||
|
||||
graphqlutil.TestConnectionResolverStoreSuite(t, connectionStore, nil)
|
||||
gqlutil.TestConnectionResolverStoreSuite(t, connectionStore, nil)
|
||||
}
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -19,6 +18,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -265,7 +265,7 @@ func (r *schemaResolver) DeleteAccessToken(ctx context.Context, args *deleteAcce
|
||||
}
|
||||
|
||||
func (r *siteResolver) AccessTokens(ctx context.Context, args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
}) (*accessTokenConnectionResolver, error) {
|
||||
// 🚨 SECURITY: Only site admins can list all access tokens. This is safe as the
|
||||
// token values themselves are not stored in our database.
|
||||
@ -279,7 +279,7 @@ func (r *siteResolver) AccessTokens(ctx context.Context, args *struct {
|
||||
}
|
||||
|
||||
func (r *UserResolver) AccessTokens(ctx context.Context, args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
}) (*accessTokenConnectionResolver, error) {
|
||||
// 🚨 SECURITY: Only site admins and the user can list a user's access tokens.
|
||||
if err := auth.CheckSiteAdminOrSameUser(ctx, r.db, r.user.ID); err != nil {
|
||||
@ -340,12 +340,12 @@ func (r *accessTokenConnectionResolver) TotalCount(ctx context.Context) (int32,
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *accessTokenConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *accessTokenConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
accessTokens, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return graphqlutil.HasNextPage(r.opt.LimitOffset != nil && len(accessTokens) > r.opt.Limit), nil
|
||||
return gqlutil.HasNextPage(r.opt.LimitOffset != nil && len(accessTokens) > r.opt.Limit), nil
|
||||
}
|
||||
|
||||
func getMaxExpiryDuration(allowedOptionsInDays []int) (int32, error) {
|
||||
|
||||
@ -3,11 +3,11 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
func (r *UserResolver) AffiliatedNamespaces(ctx context.Context) (graphqlutil.SliceConnectionResolver[*NamespaceResolver], error) {
|
||||
func (r *UserResolver) AffiliatedNamespaces(ctx context.Context) (gqlutil.SliceConnectionResolver[*NamespaceResolver], error) {
|
||||
// Start with the user's own account (which is a namespace they are always affiliated with).
|
||||
namespaces := []*NamespaceResolver{
|
||||
{Namespace: r},
|
||||
@ -30,6 +30,6 @@ func (r *UserResolver) AffiliatedNamespaces(ctx context.Context) (graphqlutil.Sl
|
||||
return newNamespaceConnection(namespaces), nil
|
||||
}
|
||||
|
||||
func (visitorResolver) AffiliatedNamespaces(context.Context) (graphqlutil.SliceConnectionResolver[*NamespaceResolver], error) {
|
||||
func (visitorResolver) AffiliatedNamespaces(context.Context) (gqlutil.SliceConnectionResolver[*NamespaceResolver], error) {
|
||||
return newNamespaceConnection(nil), nil
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
func (r *siteResolver) AuthProviders(ctx context.Context) (*authProviderConnectionResolver, error) {
|
||||
@ -30,6 +30,6 @@ func (r *authProviderConnectionResolver) Nodes(ctx context.Context) ([]*authProv
|
||||
}
|
||||
|
||||
func (r *authProviderConnectionResolver) TotalCount() int32 { return int32(len(r.authProviders)) }
|
||||
func (r *authProviderConnectionResolver) PageInfo() *graphqlutil.PageInfo {
|
||||
return graphqlutil.HasNextPage(false)
|
||||
func (r *authProviderConnectionResolver) PageInfo() *gqlutil.PageInfo {
|
||||
return gqlutil.HasNextPage(false)
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
@ -26,7 +24,7 @@ type AuthzResolver interface {
|
||||
UsersWithPendingPermissions(ctx context.Context) ([]string, error)
|
||||
AuthorizedUsers(ctx context.Context, args *RepoAuthorizedUserArgs) (UserConnectionResolver, error)
|
||||
BitbucketProjectPermissionJobs(ctx context.Context, args *BitbucketProjectPermissionJobsArgs) (BitbucketProjectsPermissionJobsResolver, error)
|
||||
PermissionsSyncJobs(ctx context.Context, args ListPermissionsSyncJobsArgs) (*graphqlutil.ConnectionResolver[PermissionsSyncJobResolver], error)
|
||||
PermissionsSyncJobs(ctx context.Context, args ListPermissionsSyncJobsArgs) (*gqlutil.ConnectionResolver[PermissionsSyncJobResolver], error)
|
||||
PermissionsSyncingStats(ctx context.Context) (PermissionsSyncingStatsResolver, error)
|
||||
|
||||
// RepositoryPermissionsInfo and UserPermissionsInfo are helpers functions.
|
||||
@ -126,8 +124,8 @@ type PermissionsInfoResolver interface {
|
||||
UpdatedAt() *gqlutil.DateTime
|
||||
Source() *string
|
||||
Unrestricted(ctx context.Context) bool
|
||||
Repositories(ctx context.Context, args PermissionsInfoRepositoriesArgs) (*graphqlutil.ConnectionResolver[PermissionsInfoRepositoryResolver], error)
|
||||
Users(ctx context.Context, args PermissionsInfoUsersArgs) (*graphqlutil.ConnectionResolver[PermissionsInfoUserResolver], error)
|
||||
Repositories(ctx context.Context, args PermissionsInfoRepositoriesArgs) (*gqlutil.ConnectionResolver[PermissionsInfoRepositoryResolver], error)
|
||||
Users(ctx context.Context, args PermissionsInfoUsersArgs) (*gqlutil.ConnectionResolver[PermissionsInfoUserResolver], error)
|
||||
}
|
||||
|
||||
type PermissionsInfoRepositoryResolver interface {
|
||||
@ -138,7 +136,7 @@ type PermissionsInfoRepositoryResolver interface {
|
||||
}
|
||||
|
||||
type PermissionsInfoRepositoriesArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
}
|
||||
|
||||
@ -150,7 +148,7 @@ type PermissionsInfoUserResolver interface {
|
||||
}
|
||||
|
||||
type PermissionsInfoUsersArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/goroutine/recorder"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -120,16 +120,16 @@ func (r *backgroundJobConnectionResolver) TotalCount(context.Context) (int32, er
|
||||
return int32(len(resolvers)), nil
|
||||
}
|
||||
|
||||
func (r *backgroundJobConnectionResolver) PageInfo(context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *backgroundJobConnectionResolver) PageInfo(context.Context) (*gqlutil.PageInfo, error) {
|
||||
resolvers, err := r.compute()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.first != nil && *r.first > -1 && len(resolvers) > int(*r.first) {
|
||||
return graphqlutil.NextPageCursor(string(resolvers[*r.first-1].ID())), nil
|
||||
return gqlutil.NextPageCursor(string(resolvers[*r.first-1].ID())), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *backgroundJobConnectionResolver) compute() ([]*BackgroundJobResolver, error) {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/lib/batches"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/externallink"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -304,14 +303,14 @@ type BatchChangesResolver interface {
|
||||
|
||||
MaxUnlicensedChangesets(ctx context.Context) int32
|
||||
|
||||
GetChangesetsByIDs(ctx context.Context, args *GetChangesetsByIDsArgs) (graphqlutil.SliceConnectionResolver[ChangesetResolver], error)
|
||||
GetChangesetsByIDs(ctx context.Context, args *GetChangesetsByIDsArgs) (gqlutil.SliceConnectionResolver[ChangesetResolver], error)
|
||||
|
||||
NodeResolvers() map[string]NodeByIDFunc
|
||||
}
|
||||
|
||||
type BulkOperationConnectionResolver interface {
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(ctx context.Context) ([]BulkOperationResolver, error)
|
||||
}
|
||||
|
||||
@ -459,14 +458,14 @@ type ChangesetApplyPreviewConnectionStatsResolver interface {
|
||||
|
||||
type ChangesetApplyPreviewConnectionResolver interface {
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(ctx context.Context) ([]ChangesetApplyPreviewResolver, error)
|
||||
Stats(ctx context.Context) (ChangesetApplyPreviewConnectionStatsResolver, error)
|
||||
}
|
||||
|
||||
type ChangesetSpecConnectionResolver interface {
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(ctx context.Context) ([]ChangesetSpecResolver, error)
|
||||
}
|
||||
|
||||
@ -548,7 +547,7 @@ type ForkTargetInterface interface {
|
||||
type BatchChangesCodeHostConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]BatchChangesCodeHostResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type BatchChangesCodeHostResolver interface {
|
||||
@ -681,18 +680,18 @@ type BatchChangeResolver interface {
|
||||
type BatchChangesConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]BatchChangeResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type BatchSpecConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]BatchSpecResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type BatchSpecWorkspaceFileConnectionResolver interface {
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(ctx context.Context) ([]BatchWorkspaceFileResolver, error)
|
||||
}
|
||||
|
||||
@ -754,7 +753,7 @@ type ChangesetsStatsResolver interface {
|
||||
type ChangesetsConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]ChangesetResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type ChangesetLabelResolver interface {
|
||||
@ -842,7 +841,7 @@ type GitHubCommitVerificationResolver interface {
|
||||
type ChangesetEventsConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]ChangesetEventResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type ChangesetEventResolver interface {
|
||||
@ -878,7 +877,7 @@ type BatchSpecWorkspaceResolutionResolver interface {
|
||||
type BatchSpecWorkspaceConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]BatchSpecWorkspaceResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Stats(ctx context.Context) (BatchSpecWorkspacesStatsResolver, error)
|
||||
}
|
||||
|
||||
@ -948,7 +947,7 @@ type BatchSpecWorkspaceStagesResolver interface {
|
||||
|
||||
type BatchSpecWorkspaceStepOutputLineConnectionResolver interface {
|
||||
TotalCount() (int32, error)
|
||||
PageInfo() (*graphqlutil.PageInfo, error)
|
||||
PageInfo() (*gqlutil.PageInfo, error)
|
||||
Nodes() ([]string, error)
|
||||
}
|
||||
|
||||
|
||||
@ -7,10 +7,10 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/oobmigration"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
@ -90,15 +90,15 @@ func (r *codeHostConnectionResolver) TotalCount(ctx context.Context) (int32, err
|
||||
return r.db.CodeHosts().Count(ctx, opt)
|
||||
}
|
||||
|
||||
func (r *codeHostConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *codeHostConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(string(MarshalCodeHostID(next))), nil
|
||||
return gqlutil.NextPageCursor(string(MarshalCodeHostID(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
@ -39,7 +38,7 @@ type CodeMonitorsResolver interface {
|
||||
type MonitorConnectionResolver interface {
|
||||
Nodes() []MonitorResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type MonitorResolver interface {
|
||||
@ -66,7 +65,7 @@ type MonitorQueryResolver interface {
|
||||
type MonitorTriggerEventConnectionResolver interface {
|
||||
Nodes() []MonitorTriggerEventResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type MonitorTriggerEventResolver interface {
|
||||
@ -82,7 +81,7 @@ type MonitorTriggerEventResolver interface {
|
||||
type MonitorActionConnectionResolver interface {
|
||||
Nodes() []MonitorAction
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type MonitorAction interface {
|
||||
@ -125,13 +124,13 @@ type MonitorEmailRecipient interface {
|
||||
type MonitorActionEmailRecipientsConnectionResolver interface {
|
||||
Nodes() []NamespaceResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type MonitorActionEventConnectionResolver interface {
|
||||
Nodes() []MonitorActionEventResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type MonitorActionEventResolver interface {
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -42,7 +41,7 @@ type ProductSubscription interface {
|
||||
Name() string
|
||||
Account(context.Context) (*UserResolver, error)
|
||||
ActiveLicense(context.Context) (ProductLicense, error)
|
||||
ProductLicenses(context.Context, *graphqlutil.ConnectionArgs) (ProductLicenseConnection, error)
|
||||
ProductLicenses(context.Context, *gqlutil.ConnectionArgs) (ProductLicenseConnection, error)
|
||||
CodyGatewayAccess() CodyGatewayAccess
|
||||
CreatedAt() gqlutil.DateTime
|
||||
IsArchived() bool
|
||||
@ -77,7 +76,7 @@ type ProductSubscriptionArgs struct {
|
||||
}
|
||||
|
||||
type ProductSubscriptionsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Account *graphql.ID
|
||||
Query *string
|
||||
}
|
||||
@ -87,7 +86,7 @@ type ProductSubscriptionsArgs struct {
|
||||
type ProductSubscriptionConnection interface {
|
||||
Nodes(context.Context) ([]ProductSubscription, error)
|
||||
TotalCount(context.Context) (int32, error)
|
||||
PageInfo(context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
// ProductLicense is the interface for the GraphQL type ProductLicense.
|
||||
@ -113,7 +112,7 @@ type ProductLicenseInput struct {
|
||||
}
|
||||
|
||||
type ProductLicensesArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
LicenseKeySubstring *string
|
||||
ProductSubscriptionID *graphql.ID
|
||||
}
|
||||
@ -122,7 +121,7 @@ type ProductLicensesArgs struct {
|
||||
type ProductLicenseConnection interface {
|
||||
Nodes(context.Context) ([]ProductLicense, error)
|
||||
TotalCount(context.Context) (int32, error)
|
||||
PageInfo(context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type ProductSubscriptionByAccessTokenArgs struct {
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -13,7 +12,7 @@ type EmbeddingsResolver interface {
|
||||
EmbeddingsSearch(ctx context.Context, args EmbeddingsSearchInputArgs) (EmbeddingsSearchResultsResolver, error)
|
||||
EmbeddingsMultiSearch(ctx context.Context, args EmbeddingsMultiSearchInputArgs) (EmbeddingsSearchResultsResolver, error)
|
||||
IsContextRequiredForChatQuery(ctx context.Context, args IsContextRequiredForChatQueryInputArgs) (bool, error)
|
||||
RepoEmbeddingJobs(ctx context.Context, args ListRepoEmbeddingJobsArgs) (*graphqlutil.ConnectionResolver[RepoEmbeddingJobResolver], error)
|
||||
RepoEmbeddingJobs(ctx context.Context, args ListRepoEmbeddingJobsArgs) (*gqlutil.ConnectionResolver[RepoEmbeddingJobResolver], error)
|
||||
|
||||
ScheduleRepositoriesForEmbedding(ctx context.Context, args ScheduleRepositoriesForEmbeddingArgs) (*EmptyResponse, error)
|
||||
CancelRepoEmbeddingJob(ctx context.Context, args CancelRepoEmbeddingJobArgs) (*EmptyResponse, error)
|
||||
@ -57,7 +56,7 @@ type EmbeddingsSearchResultResolver interface {
|
||||
}
|
||||
|
||||
type ListRepoEmbeddingJobsArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
State *string
|
||||
Repo *graphql.ID
|
||||
|
||||
@ -3,13 +3,13 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type eventLogsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
EventName *string // return only event logs matching the event name
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ func (r *userEventLogsConnectionResolver) TotalCount(ctx context.Context) (int32
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *userEventLogsConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *userEventLogsConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
var count int
|
||||
var err error
|
||||
|
||||
@ -72,5 +72,5 @@ func (r *userEventLogsConnectionResolver) PageInfo(ctx context.Context) (*graphq
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return graphqlutil.HasNextPage(r.opt.LimitOffset != nil && count > r.opt.Limit), nil
|
||||
return gqlutil.HasNextPage(r.opt.LimitOffset != nil && count > r.opt.Limit), nil
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type executorConnectionResolver struct {
|
||||
@ -20,9 +20,9 @@ func (r *executorConnectionResolver) TotalCount(ctx context.Context) int32 {
|
||||
return int32(r.totalCount)
|
||||
}
|
||||
|
||||
func (r *executorConnectionResolver) PageInfo(ctx context.Context) *graphqlutil.PageInfo {
|
||||
func (r *executorConnectionResolver) PageInfo(ctx context.Context) *gqlutil.PageInfo {
|
||||
if r.nextOffset == nil {
|
||||
return graphqlutil.HasNextPage(false)
|
||||
return gqlutil.HasNextPage(false)
|
||||
}
|
||||
return graphqlutil.EncodeIntCursor(r.nextOffset)
|
||||
return gqlutil.EncodeIntCursor(r.nextOffset)
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
@ -123,7 +122,7 @@ func (r *executorSecretResolver) AccessLogs(args ExecutorSecretAccessLogListArgs
|
||||
// so access to the access logs is acceptable as well.
|
||||
limit := &database.LimitOffset{Limit: int(args.First)}
|
||||
if args.After != nil {
|
||||
offset, err := graphqlutil.DecodeIntCursor(args.After)
|
||||
offset, err := gqlutil.DecodeIntCursor(args.After)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -54,7 +54,7 @@ func (r *executorSecretAccessLogConnectionResolver) TotalCount(ctx context.Conte
|
||||
return int32(totalCount), err
|
||||
}
|
||||
|
||||
func (r *executorSecretAccessLogConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *executorSecretAccessLogConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, _, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -62,9 +62,9 @@ func (r *executorSecretAccessLogConnectionResolver) PageInfo(ctx context.Context
|
||||
|
||||
if next != 0 {
|
||||
n := int32(next)
|
||||
return graphqlutil.EncodeIntCursor(&n), nil
|
||||
return gqlutil.EncodeIntCursor(&n), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *executorSecretAccessLogConnectionResolver) compute(ctx context.Context) (_ []*database.ExecutorSecretAccessLog, _ []*types.User, next int, err error) {
|
||||
|
||||
@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type executorSecretConnectionResolver struct {
|
||||
@ -40,7 +40,7 @@ func (r *executorSecretConnectionResolver) TotalCount(ctx context.Context) (int3
|
||||
return int32(totalCount), err
|
||||
}
|
||||
|
||||
func (r *executorSecretConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *executorSecretConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,9 +48,9 @@ func (r *executorSecretConnectionResolver) PageInfo(ctx context.Context) (*graph
|
||||
|
||||
if next != 0 {
|
||||
n := int32(next)
|
||||
return graphqlutil.EncodeIntCursor(&n), nil
|
||||
return gqlutil.EncodeIntCursor(&n), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *executorSecretConnectionResolver) compute(ctx context.Context) ([]*database.ExecutorSecret, int, error) {
|
||||
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"github.com/grafana/regexp"
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -203,7 +203,7 @@ type ExecutorSecretsListArgs struct {
|
||||
func (o ExecutorSecretsListArgs) LimitOffset() (*database.LimitOffset, error) {
|
||||
limit := &database.LimitOffset{Limit: int(o.First)}
|
||||
if o.After != nil {
|
||||
offset, err := graphqlutil.DecodeIntCursor(o.After)
|
||||
offset, err := gqlutil.DecodeIntCursor(o.After)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
func unmarshalExecutorID(id graphql.ID) (executorID int64, err error) {
|
||||
@ -30,7 +30,7 @@ func (r *schemaResolver) Executors(ctx context.Context, args ExecutorsListArgs)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
offset, err := graphqlutil.DecodeIntCursor(args.After)
|
||||
offset, err := gqlutil.DecodeIntCursor(args.After)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -61,7 +61,7 @@ func (r *schemaResolver) Executors(ctx context.Context, args ExecutorsListArgs)
|
||||
resolvers = append(resolvers, &ExecutorResolver{executor: executor})
|
||||
}
|
||||
|
||||
nextOffset := graphqlutil.NextOffset(offset, len(execs), totalCount)
|
||||
nextOffset := gqlutil.NextOffset(offset, len(execs), totalCount)
|
||||
|
||||
executorConnection = &executorConnectionResolver{
|
||||
resolvers: resolvers,
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/sourcegraphoperator"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -15,11 +14,12 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
gext "github.com/sourcegraph/sourcegraph/internal/extsvc/gerrit/externalaccount"
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
func (r *siteResolver) ExternalAccounts(ctx context.Context, args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
User *graphql.ID
|
||||
ServiceType *string
|
||||
ServiceID *string
|
||||
@ -53,7 +53,7 @@ func (r *siteResolver) ExternalAccounts(ctx context.Context, args *struct {
|
||||
}
|
||||
|
||||
func (r *UserResolver) ExternalAccounts(ctx context.Context, args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
},
|
||||
) (*externalAccountConnectionResolver, error) {
|
||||
// 🚨 SECURITY: Only site admins and the user can list a user's external accounts.
|
||||
@ -114,12 +114,12 @@ func (r *externalAccountConnectionResolver) TotalCount(ctx context.Context) (int
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *externalAccountConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *externalAccountConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
externalAccounts, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return graphqlutil.HasNextPage(r.opt.LimitOffset != nil && len(externalAccounts) > r.opt.Limit), nil
|
||||
return gqlutil.HasNextPage(r.opt.LimitOffset != nil && len(externalAccounts) > r.opt.Limit), nil
|
||||
}
|
||||
|
||||
func (r *schemaResolver) DeleteExternalAccount(ctx context.Context, args *struct {
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
@ -419,12 +418,12 @@ func (r *externalServiceSyncJobConnectionResolver) TotalCount(ctx context.Contex
|
||||
return int32(totalCount), err
|
||||
}
|
||||
|
||||
func (r *externalServiceSyncJobConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *externalServiceSyncJobConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
jobs, totalCount, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return graphqlutil.HasNextPage(len(jobs) != int(totalCount)), nil
|
||||
return gqlutil.HasNextPage(len(jobs) != int(totalCount)), nil
|
||||
}
|
||||
|
||||
func (r *externalServiceSyncJobConnectionResolver) compute(ctx context.Context) ([]*types.ExternalServiceSyncJob, int64, error) {
|
||||
|
||||
@ -16,7 +16,6 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/envvar"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -24,6 +23,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/repos"
|
||||
"github.com/sourcegraph/sourcegraph/internal/repoupdater"
|
||||
"github.com/sourcegraph/sourcegraph/internal/trace"
|
||||
@ -361,7 +361,7 @@ func (r *schemaResolver) DeleteExternalService(ctx context.Context, args *delete
|
||||
}
|
||||
|
||||
type ExternalServicesArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
Namespace *graphql.ID
|
||||
Repo *graphql.ID
|
||||
@ -434,7 +434,7 @@ func (r *externalServiceConnectionResolver) TotalCount(ctx context.Context) (int
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *externalServiceConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *externalServiceConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
externalServices, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -442,12 +442,12 @@ func (r *externalServiceConnectionResolver) PageInfo(ctx context.Context) (*grap
|
||||
|
||||
// We would have had all results when no limit set
|
||||
if r.opt.LimitOffset == nil {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
// We got less results than limit, means we've had all results
|
||||
if len(externalServices) < r.opt.Limit {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
// In case the number of results happens to be the same as the limit,
|
||||
@ -460,18 +460,18 @@ func (r *externalServiceConnectionResolver) PageInfo(ctx context.Context) (*grap
|
||||
|
||||
if count > len(externalServices) {
|
||||
endCursorID := externalServices[len(externalServices)-1].ID
|
||||
return graphqlutil.NextPageCursor(string(MarshalExternalServiceID(endCursorID))), nil
|
||||
return gqlutil.NextPageCursor(string(MarshalExternalServiceID(endCursorID))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
type ComputedExternalServiceConnectionResolver struct {
|
||||
args graphqlutil.ConnectionArgs
|
||||
args gqlutil.ConnectionArgs
|
||||
externalServices []*types.ExternalService
|
||||
db database.DB
|
||||
}
|
||||
|
||||
func NewComputedExternalServiceConnectionResolver(db database.DB, externalServices []*types.ExternalService, args graphqlutil.ConnectionArgs) *ComputedExternalServiceConnectionResolver {
|
||||
func NewComputedExternalServiceConnectionResolver(db database.DB, externalServices []*types.ExternalService, args gqlutil.ConnectionArgs) *ComputedExternalServiceConnectionResolver {
|
||||
return &ComputedExternalServiceConnectionResolver{
|
||||
db: db,
|
||||
externalServices: externalServices,
|
||||
@ -495,8 +495,8 @@ func (r *ComputedExternalServiceConnectionResolver) TotalCount(_ context.Context
|
||||
return int32(len(r.externalServices))
|
||||
}
|
||||
|
||||
func (r *ComputedExternalServiceConnectionResolver) PageInfo(_ context.Context) *graphqlutil.PageInfo {
|
||||
return graphqlutil.HasNextPage(r.args.First != nil && len(r.externalServices) >= int(*r.args.First))
|
||||
func (r *ComputedExternalServiceConnectionResolver) PageInfo(_ context.Context) *gqlutil.PageInfo {
|
||||
return gqlutil.HasNextPage(r.args.First != nil && len(r.externalServices) >= int(*r.args.First))
|
||||
}
|
||||
|
||||
type ExternalServiceMutationType int
|
||||
|
||||
@ -11,27 +11,25 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
gqlerrors "github.com/graph-gophers/graphql-go/errors"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/github"
|
||||
"github.com/sourcegraph/sourcegraph/internal/ratelimit"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/basestore"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc/github"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/ratelimit"
|
||||
"github.com/sourcegraph/sourcegraph/internal/timeutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
"github.com/sourcegraph/sourcegraph/schema"
|
||||
)
|
||||
|
||||
@ -1021,20 +1019,20 @@ func TestExternalServices(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExternalServices_PageInfo(t *testing.T) {
|
||||
cmpOpts := cmp.AllowUnexported(graphqlutil.PageInfo{})
|
||||
cmpOpts := cmp.AllowUnexported(gqlutil.PageInfo{})
|
||||
tests := []struct {
|
||||
name string
|
||||
opt database.ExternalServicesListOptions
|
||||
mockList func(ctx context.Context, opt database.ExternalServicesListOptions) ([]*types.ExternalService, error)
|
||||
mockCount func(ctx context.Context, opt database.ExternalServicesListOptions) (int, error)
|
||||
wantPageInfo *graphqlutil.PageInfo
|
||||
wantPageInfo *gqlutil.PageInfo
|
||||
}{
|
||||
{
|
||||
name: "no limit set",
|
||||
mockList: func(_ context.Context, opt database.ExternalServicesListOptions) ([]*types.ExternalService, error) {
|
||||
return []*types.ExternalService{{ID: 1, Config: extsvc.NewEmptyConfig()}}, nil
|
||||
},
|
||||
wantPageInfo: graphqlutil.HasNextPage(false),
|
||||
wantPageInfo: gqlutil.HasNextPage(false),
|
||||
},
|
||||
{
|
||||
name: "less results than the limit",
|
||||
@ -1046,7 +1044,7 @@ func TestExternalServices_PageInfo(t *testing.T) {
|
||||
mockList: func(_ context.Context, opt database.ExternalServicesListOptions) ([]*types.ExternalService, error) {
|
||||
return []*types.ExternalService{{ID: 1, Config: extsvc.NewEmptyConfig()}}, nil
|
||||
},
|
||||
wantPageInfo: graphqlutil.HasNextPage(false),
|
||||
wantPageInfo: gqlutil.HasNextPage(false),
|
||||
},
|
||||
{
|
||||
name: "same number of results as the limit, and no more",
|
||||
@ -1061,7 +1059,7 @@ func TestExternalServices_PageInfo(t *testing.T) {
|
||||
mockCount: func(ctx context.Context, opt database.ExternalServicesListOptions) (int, error) {
|
||||
return 1, nil
|
||||
},
|
||||
wantPageInfo: graphqlutil.HasNextPage(false),
|
||||
wantPageInfo: gqlutil.HasNextPage(false),
|
||||
},
|
||||
{
|
||||
name: "same number of results as the limit, and has more",
|
||||
@ -1076,7 +1074,7 @@ func TestExternalServices_PageInfo(t *testing.T) {
|
||||
mockCount: func(ctx context.Context, opt database.ExternalServicesListOptions) (int, error) {
|
||||
return 2, nil
|
||||
},
|
||||
wantPageInfo: graphqlutil.NextPageCursor(string(MarshalExternalServiceID(1))),
|
||||
wantPageInfo: gqlutil.NextPageCursor(string(MarshalExternalServiceID(1))),
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
|
||||
@ -16,12 +16,12 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/externallink"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/trace"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -375,7 +375,7 @@ func (r *GitCommitResolver) LanguageStatistics(ctx context.Context) ([]*language
|
||||
}
|
||||
|
||||
type AncestorsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Query *string
|
||||
Path *string
|
||||
Follow bool
|
||||
|
||||
@ -7,10 +7,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
)
|
||||
@ -158,7 +158,7 @@ func (r *gitCommitConnectionResolver) TotalCount(ctx context.Context) (*int32, e
|
||||
return &n, nil
|
||||
}
|
||||
|
||||
func (r *gitCommitConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *gitCommitConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
commits, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -167,7 +167,7 @@ func (r *gitCommitConnectionResolver) PageInfo(ctx context.Context) (*graphqluti
|
||||
totalCommits := len(commits)
|
||||
// If no limit is set, we have retrieved all the commits and there is no next page.
|
||||
if r.first == nil {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
limit := int(*r.first)
|
||||
@ -200,8 +200,8 @@ func (r *gitCommitConnectionResolver) PageInfo(ctx context.Context) (*graphqluti
|
||||
}
|
||||
|
||||
endCursor := limit + after
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(endCursor)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(endCursor)), nil
|
||||
}
|
||||
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/trace"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -21,7 +21,7 @@ func (r *GitTreeEntryResolver) IsRoot() bool {
|
||||
}
|
||||
|
||||
type gitTreeEntryConnectionArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Recursive bool
|
||||
// If Ancestors is true and the tree is loaded from a subdirectory, we will
|
||||
// return a flat list of all entries in all parent directories.
|
||||
|
||||
@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
"io/fs"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
)
|
||||
|
||||
type HistoryArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
|
||||
// TODO(@camdencheek): implement follow. Right now, we wouldn't have
|
||||
@ -52,6 +52,6 @@ func (r *treeEntryHistoryConnection) TotalCount(ctx context.Context) (*int32, er
|
||||
return r.commits.TotalCount(ctx)
|
||||
}
|
||||
|
||||
func (r *treeEntryHistoryConnection) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *treeEntryHistoryConnection) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
return r.commits.PageInfo(ctx)
|
||||
}
|
||||
|
||||
@ -9,13 +9,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/fileutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
@ -257,28 +257,28 @@ func TestGitTree_Entries(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Pagination", func(t *testing.T) {
|
||||
entries, err := gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: graphqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
entries, err := gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: gqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
require.NoError(t, err)
|
||||
assertEntries(t, []fs.FileInfo{
|
||||
CreateFileInfo(".aspect/", true),
|
||||
}, entries)
|
||||
entries, err = gitTree.Files(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: graphqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
entries, err = gitTree.Files(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: gqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
require.NoError(t, err)
|
||||
assertEntries(t, []fs.FileInfo{
|
||||
CreateFileInfo("file", false),
|
||||
}, entries)
|
||||
entries, err = gitTree.Directories(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: graphqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
entries, err = gitTree.Directories(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: gqlutil.ConnectionArgs{First: pointers.Ptr(int32(1))}})
|
||||
require.NoError(t, err)
|
||||
assertEntries(t, []fs.FileInfo{
|
||||
CreateFileInfo(".aspect/", true),
|
||||
}, entries)
|
||||
|
||||
// Invalid first.
|
||||
_, err = gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: graphqlutil.ConnectionArgs{First: pointers.Ptr(int32(-1))}})
|
||||
_, err = gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: gqlutil.ConnectionArgs{First: pointers.Ptr(int32(-1))}})
|
||||
require.Error(t, err)
|
||||
|
||||
// First is bigger than the number of entries.
|
||||
entries, err = gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: graphqlutil.ConnectionArgs{First: pointers.Ptr(int32(100))}})
|
||||
entries, err = gitTree.Entries(context.Background(), &gitTreeEntryConnectionArgs{ConnectionArgs: gqlutil.ConnectionArgs{First: pointers.Ptr(int32(100))}})
|
||||
require.NoError(t, err)
|
||||
assertEntries(t, []fs.FileInfo{
|
||||
CreateFileInfo(".aspect/", true),
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
@ -119,6 +118,6 @@ func (ghai GitHubAppInstallation) Account() GitHubAppInstallationAccount {
|
||||
return ghai.InstallAccount
|
||||
}
|
||||
|
||||
func (ghai GitHubAppInstallation) ExternalServices(args *struct{ graphqlutil.ConnectionArgs }) *ComputedExternalServiceConnectionResolver {
|
||||
func (ghai GitHubAppInstallation) ExternalServices(args *struct{ gqlutil.ConnectionArgs }) *ComputedExternalServiceConnectionResolver {
|
||||
return NewComputedExternalServiceConnectionResolver(ghai.DB, ghai.InstallExternalServices, args.ConnectionArgs)
|
||||
}
|
||||
|
||||
@ -6,8 +6,8 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
const gitserverIDKind = "GitserverInstance"
|
||||
@ -42,7 +42,7 @@ func (r *schemaResolver) gitserverByID(ctx context.Context, id graphql.ID) (*git
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *schemaResolver) Gitservers(ctx context.Context) (graphqlutil.SliceConnectionResolver[*gitserverResolver], error) {
|
||||
func (r *schemaResolver) Gitservers(ctx context.Context) (gqlutil.SliceConnectionResolver[*gitserverResolver], error) {
|
||||
// 🚨 SECURITY: Only site admins can query gitserver information.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
@ -62,7 +62,7 @@ func (r *schemaResolver) Gitservers(ctx context.Context) (graphqlutil.SliceConne
|
||||
})
|
||||
}
|
||||
noOfResolvers := len(resolvers)
|
||||
return graphqlutil.NewSliceConnectionResolver(resolvers, noOfResolvers, noOfResolvers), nil
|
||||
return gqlutil.NewSliceConnectionResolver(resolvers, noOfResolvers, noOfResolvers), nil
|
||||
}
|
||||
|
||||
type gitserverResolver struct {
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
load("//dev:go_defs.bzl", "go_test")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "graphqlutil",
|
||||
srcs = [
|
||||
"connection.go",
|
||||
"connection_resolver.go",
|
||||
"cursors.go",
|
||||
"doc.go",
|
||||
"offset.go",
|
||||
"page_info.go",
|
||||
"slice_connection_resolver.go",
|
||||
],
|
||||
importpath = "github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//internal/database",
|
||||
"//lib/errors",
|
||||
"//lib/pointers",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "graphqlutil_test",
|
||||
timeout = "short",
|
||||
srcs = [
|
||||
"connection_resolver_test.go",
|
||||
"slice_connection_resolver_test.go",
|
||||
],
|
||||
embed = [":graphqlutil"],
|
||||
deps = [
|
||||
"//internal/database",
|
||||
"@com_github_google_go_cmp//cmp",
|
||||
"@com_github_graph_gophers_graphql_go//:graphql-go",
|
||||
],
|
||||
)
|
||||
@ -1,2 +0,0 @@
|
||||
// Package graphqlutil contains utilities for working with GraphQL.
|
||||
package graphqlutil
|
||||
@ -3,7 +3,7 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type GuardrailsResolver interface {
|
||||
@ -11,7 +11,7 @@ type GuardrailsResolver interface {
|
||||
}
|
||||
|
||||
type SnippetAttributionArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Snippet string
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ type SnippetAttributionConnectionResolver interface {
|
||||
TotalCount() int32
|
||||
LimitHit() bool
|
||||
SnippetThreshold() AttributionSnippetThresholdResolver
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
Nodes() []SnippetAttributionResolver
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -44,7 +43,7 @@ type InsightsResolver interface {
|
||||
// Admin Management
|
||||
InsightSeriesQueryStatus(ctx context.Context) ([]InsightSeriesQueryStatusResolver, error)
|
||||
InsightViewDebug(ctx context.Context, args InsightViewDebugArgs) (InsightViewDebugResolver, error)
|
||||
InsightAdminBackfillQueue(ctx context.Context, args *AdminBackfillQueueArgs) (*graphqlutil.ConnectionResolver[*BackfillQueueItemResolver], error)
|
||||
InsightAdminBackfillQueue(ctx context.Context, args *AdminBackfillQueueArgs) (*gqlutil.ConnectionResolver[*BackfillQueueItemResolver], error)
|
||||
// Admin Mutations
|
||||
UpdateInsightSeries(ctx context.Context, args *UpdateInsightSeriesArgs) (InsightSeriesMetadataPayloadResolver, error)
|
||||
RetryInsightSeriesBackfill(ctx context.Context, args *BackfillArgs) (*BackfillQueueItemResolver, error)
|
||||
@ -139,7 +138,7 @@ type InsightsDashboardsArgs struct {
|
||||
|
||||
type InsightsDashboardConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]InsightsDashboardResolver, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type InsightsDashboardResolver interface {
|
||||
@ -192,7 +191,7 @@ type DeleteInsightsDashboardArgs struct {
|
||||
type InsightViewConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]InsightViewResolver, error)
|
||||
TotalCount(ctx context.Context) (*int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type InsightViewResolver interface {
|
||||
@ -583,7 +582,7 @@ type BackfillArgs struct {
|
||||
}
|
||||
|
||||
type AdminBackfillQueueArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
OrderBy string
|
||||
Descending bool
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -149,6 +149,6 @@ func (r NamespaceResolver) ToUser() (*UserResolver, bool) {
|
||||
return n, ok
|
||||
}
|
||||
|
||||
func newNamespaceConnection(namespaces []*NamespaceResolver) graphqlutil.SliceConnectionResolver[*NamespaceResolver] {
|
||||
return graphqlutil.NewSliceConnectionResolver(namespaces, len(namespaces), len(namespaces))
|
||||
func newNamespaceConnection(namespaces []*NamespaceResolver) gqlutil.SliceConnectionResolver[*NamespaceResolver] {
|
||||
return gqlutil.NewSliceConnectionResolver(namespaces, len(namespaces), len(namespaces))
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -33,7 +32,7 @@ type NotebooksResolver interface {
|
||||
type NotebookConnectionResolver interface {
|
||||
Nodes(ctx context.Context) []NotebookResolver
|
||||
TotalCount(ctx context.Context) int32
|
||||
PageInfo(ctx context.Context) *graphqlutil.PageInfo
|
||||
PageInfo(ctx context.Context) *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type NotebookStarResolver interface {
|
||||
@ -44,7 +43,7 @@ type NotebookStarResolver interface {
|
||||
type NotebookStarConnectionResolver interface {
|
||||
Nodes() []NotebookStarResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type NotebookResolver interface {
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/suspiciousnames"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
sgactor "github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
@ -99,10 +98,10 @@ func (o *OrgResolver) SettingsURL() *string { return strptr(o.URL() + "/settings
|
||||
func (o *OrgResolver) CreatedAt() gqlutil.DateTime { return gqlutil.DateTime{Time: o.org.CreatedAt} }
|
||||
|
||||
func (o *OrgResolver) Members(ctx context.Context, args struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
},
|
||||
) (*graphqlutil.ConnectionResolver[*UserResolver], error) {
|
||||
) (*gqlutil.ConnectionResolver[*UserResolver], error) {
|
||||
// 🚨 SECURITY: On dotcom, only an org's members can list its members.
|
||||
if dotcom.SourcegraphDotComMode() {
|
||||
if err := auth.CheckOrgAccessOrSiteAdmin(ctx, o.db, o.org.ID); err != nil {
|
||||
@ -116,7 +115,7 @@ func (o *OrgResolver) Members(ctx context.Context, args struct {
|
||||
query: args.Query,
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[*UserResolver](connectionStore, &args.ConnectionResolverArgs, &graphqlutil.ConnectionResolverOptions{
|
||||
return gqlutil.NewConnectionResolver[*UserResolver](connectionStore, &args.ConnectionResolverArgs, &gqlutil.ConnectionResolverOptions{
|
||||
AllowNoLimit: true,
|
||||
})
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -35,8 +34,8 @@ func (r *organizationMembershipConnectionResolver) Nodes() []*organizationMember
|
||||
return r.nodes
|
||||
}
|
||||
func (r *organizationMembershipConnectionResolver) TotalCount() int32 { return int32(len(r.nodes)) }
|
||||
func (r *organizationMembershipConnectionResolver) PageInfo() *graphqlutil.PageInfo {
|
||||
return graphqlutil.HasNextPage(false)
|
||||
func (r *organizationMembershipConnectionResolver) PageInfo() *gqlutil.PageInfo {
|
||||
return gqlutil.HasNextPage(false)
|
||||
}
|
||||
|
||||
type organizationMembershipResolver struct {
|
||||
|
||||
@ -14,7 +14,6 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
"github.com/sourcegraph/log/logtest"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/authz/permssync"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
@ -22,6 +21,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbtest"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/schema"
|
||||
)
|
||||
@ -490,5 +490,5 @@ func TestMembersConnectionStore(t *testing.T) {
|
||||
orgID: org.ID,
|
||||
}
|
||||
|
||||
graphqlutil.TestConnectionResolverStoreSuite(t, connectionStore, nil)
|
||||
gqlutil.TestConnectionResolverStoreSuite(t, connectionStore, nil)
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@ import (
|
||||
|
||||
logger "github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
func (r *schemaResolver) Organizations(args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Query *string
|
||||
}) *orgConnectionResolver {
|
||||
var opt database.OrgsListOptions
|
||||
@ -74,6 +74,6 @@ type orgConnectionStaticResolver struct {
|
||||
|
||||
func (r *orgConnectionStaticResolver) Nodes() []*OrgResolver { return r.nodes }
|
||||
func (r *orgConnectionStaticResolver) TotalCount() int32 { return int32(len(r.nodes)) }
|
||||
func (r *orgConnectionStaticResolver) PageInfo() *graphqlutil.PageInfo {
|
||||
return graphqlutil.HasNextPage(false)
|
||||
func (r *orgConnectionStaticResolver) PageInfo() *gqlutil.PageInfo {
|
||||
return gqlutil.HasNextPage(false)
|
||||
}
|
||||
|
||||
@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
@ -123,16 +122,16 @@ func (r *outboundRequestConnectionResolver) TotalCount(ctx context.Context) (int
|
||||
return int32(len(resolvers)), nil
|
||||
}
|
||||
|
||||
func (r *outboundRequestConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *outboundRequestConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
resolvers, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if r.first != nil && *r.first > -1 && len(resolvers) > int(*r.first) {
|
||||
return graphqlutil.NextPageCursor(string(resolvers[*r.first-1].ID())), nil
|
||||
return gqlutil.NextPageCursor(string(resolvers[*r.first-1].ID())), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *outboundRequestConnectionResolver) compute(ctx context.Context) ([]*OutboundRequestResolver, error) {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
@ -27,7 +26,7 @@ type OutboundWebhookLogStatsResolver interface {
|
||||
type OutboundWebhookLogConnectionResolver interface {
|
||||
Nodes() ([]OutboundWebhookLogResolver, error)
|
||||
TotalCount() (int32, error)
|
||||
PageInfo() (*graphqlutil.PageInfo, error)
|
||||
PageInfo() (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type OutboundWebhookLogResolver interface {
|
||||
@ -121,16 +120,16 @@ func (r *outboundWebhookLogConnectionResolver) TotalCount() (int32, error) {
|
||||
return r.totalCount()
|
||||
}
|
||||
|
||||
func (r *outboundWebhookLogConnectionResolver) PageInfo() (*graphqlutil.PageInfo, error) {
|
||||
func (r *outboundWebhookLogConnectionResolver) PageInfo() (*gqlutil.PageInfo, error) {
|
||||
nodes, err := r.nodes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(nodes) > r.first {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(r.first + r.offset)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(r.first + r.offset)), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
type outboundWebhookLogResolver struct {
|
||||
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/webhooks/outbound"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
@ -24,7 +24,7 @@ const outboundWebhookIDKind = "OutboundWebhook"
|
||||
type OutboundWebhookConnectionResolver interface {
|
||||
Nodes() ([]OutboundWebhookResolver, error)
|
||||
TotalCount() (int32, error)
|
||||
PageInfo() (*graphqlutil.PageInfo, error)
|
||||
PageInfo() (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type OutboundWebhookEventTypeResolver interface {
|
||||
@ -293,16 +293,16 @@ func (r *outboundWebhookConnectionResolver) TotalCount() (int32, error) {
|
||||
return r.totalCount()
|
||||
}
|
||||
|
||||
func (r *outboundWebhookConnectionResolver) PageInfo() (*graphqlutil.PageInfo, error) {
|
||||
func (r *outboundWebhookConnectionResolver) PageInfo() (*gqlutil.PageInfo, error) {
|
||||
nodes, err := r.nodes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(nodes) > r.first {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(r.first + r.offset)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(r.first + r.offset)), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
type outboundWebhookEventTypeResolver struct {
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
@ -77,7 +76,7 @@ type OwnResolver interface {
|
||||
type OwnershipConnectionResolver interface {
|
||||
TotalCount(context.Context) (int32, error)
|
||||
TotalOwners(context.Context) (int32, error)
|
||||
PageInfo(context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(context.Context) ([]OwnershipResolver, error)
|
||||
}
|
||||
|
||||
@ -192,7 +191,7 @@ type CodeownersIngestedFileResolver interface {
|
||||
type CodeownersIngestedFileConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]CodeownersIngestedFileResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
type SignalConfigurationResolver interface {
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/codeintel/dependencies"
|
||||
"github.com/sourcegraph/sourcegraph/internal/codeintel/dependencies/shared"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -39,7 +39,7 @@ func (r *filterMatchingResolver) ToPackageRepoReferenceVersionConnection() (*pac
|
||||
func (r *schemaResolver) PackageRepoReferencesMatchingFilter(ctx context.Context, args struct {
|
||||
Kind string
|
||||
Filter inputPackageFilter
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
},
|
||||
) (_ *filterMatchingResolver, err error) {
|
||||
|
||||
@ -7,20 +7,20 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/codeintel/dependencies"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf/reposource"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
type PackageRepoReferenceConnectionArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
Kind *string
|
||||
Name *string
|
||||
@ -123,14 +123,14 @@ func (r *packageRepoReferenceConnectionResolver) TotalCount(ctx context.Context)
|
||||
return int32(r.total), nil
|
||||
}
|
||||
|
||||
func (r *packageRepoReferenceConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *packageRepoReferenceConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
if len(r.deps) == 0 || !r.hasMore {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
next := r.deps[len(r.deps)-1].ID
|
||||
cursor := string(relay.MarshalID("PackageRepoReference", next))
|
||||
return graphqlutil.NextPageCursor(cursor), nil
|
||||
return gqlutil.NextPageCursor(cursor), nil
|
||||
}
|
||||
|
||||
type packageRepoReferenceVersionConnectionResolver struct {
|
||||
@ -152,14 +152,14 @@ func (r *packageRepoReferenceVersionConnectionResolver) TotalCount(ctx context.C
|
||||
return int32(r.total), nil
|
||||
}
|
||||
|
||||
func (r *packageRepoReferenceVersionConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *packageRepoReferenceVersionConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
if len(r.versions) == 0 || !r.hasMore {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
next := r.versions[len(r.versions)-1].ID
|
||||
cursor := string(relay.MarshalID("PackageRepoReferenceVersion", next))
|
||||
return graphqlutil.NextPageCursor(cursor), nil
|
||||
return gqlutil.NextPageCursor(cursor), nil
|
||||
}
|
||||
|
||||
type packageRepoReferenceResolver struct {
|
||||
|
||||
@ -5,9 +5,9 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -35,7 +35,7 @@ func (r *schemaResolver) permissionByID(ctx context.Context, id graphql.ID) (Per
|
||||
return &permissionResolver{permission: permission}, nil
|
||||
}
|
||||
|
||||
func (r *schemaResolver) Permissions(ctx context.Context, args *ListPermissionArgs) (*graphqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
func (r *schemaResolver) Permissions(ctx context.Context, args *ListPermissionArgs) (*gqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
connectionStore := permissionConnectionStore{
|
||||
db: r.db,
|
||||
}
|
||||
@ -73,10 +73,10 @@ func (r *schemaResolver) Permissions(ctx context.Context, args *ListPermissionAr
|
||||
connectionStore.roleID = roleID
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[PermissionResolver](
|
||||
return gqlutil.NewConnectionResolver[PermissionResolver](
|
||||
&connectionStore,
|
||||
&args.ConnectionResolverArgs,
|
||||
&graphqlutil.ConnectionResolverOptions{
|
||||
&gqlutil.ConnectionResolverOptions{
|
||||
OrderBy: database.OrderBy{
|
||||
{Field: "permissions.id"},
|
||||
},
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
@ -60,7 +60,7 @@ type PermissionsSyncJobSubject interface {
|
||||
}
|
||||
|
||||
type ListPermissionsSyncJobsArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
ReasonGroup *database.PermissionsSyncJobReasonGroup
|
||||
State *database.PermissionsSyncJobState
|
||||
SearchType *database.PermissionsSyncSearchType
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -46,7 +45,7 @@ func (v PromptVisibility) IsSecret() bool {
|
||||
return v != PromptVisibilityPublic
|
||||
}
|
||||
|
||||
type PromptConnectionResolver = graphqlutil.ConnectionResolver[PromptResolver]
|
||||
type PromptConnectionResolver = gqlutil.ConnectionResolver[PromptResolver]
|
||||
|
||||
type PromptResolver interface {
|
||||
ID() graphql.ID
|
||||
@ -74,7 +73,7 @@ func (r PromptDefinitionResolver) Text() string {
|
||||
}
|
||||
|
||||
type PromptsArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
Owner *graphql.ID
|
||||
ViewerIsAffiliated *bool
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -14,7 +13,7 @@ type RoleResolver interface {
|
||||
Name() string
|
||||
System() bool
|
||||
CreatedAt() gqlutil.DateTime
|
||||
Permissions(context.Context, *ListPermissionArgs) (*graphqlutil.ConnectionResolver[PermissionResolver], error)
|
||||
Permissions(context.Context, *ListPermissionArgs) (*gqlutil.ConnectionResolver[PermissionResolver], error)
|
||||
}
|
||||
|
||||
type PermissionResolver interface {
|
||||
@ -43,14 +42,14 @@ type CreateRoleArgs struct {
|
||||
}
|
||||
|
||||
type ListRoleArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
|
||||
System bool
|
||||
User *graphql.ID
|
||||
}
|
||||
|
||||
type ListPermissionArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
|
||||
Role *graphql.ID
|
||||
User *graphql.ID
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -32,7 +31,7 @@ type RecordedCommandsArgs struct {
|
||||
Offset int32
|
||||
}
|
||||
|
||||
func (r *RepositoryResolver) RecordedCommands(ctx context.Context, args *RecordedCommandsArgs) (graphqlutil.SliceConnectionResolver[RecordedCommandResolver], error) {
|
||||
func (r *RepositoryResolver) RecordedCommands(ctx context.Context, args *RecordedCommandsArgs) (gqlutil.SliceConnectionResolver[RecordedCommandResolver], error) {
|
||||
// 🚨 SECURITY: Only site admins are allowed to view recorded commands
|
||||
err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db)
|
||||
if err != nil {
|
||||
@ -49,7 +48,7 @@ func (r *RepositoryResolver) RecordedCommands(ctx context.Context, args *Recorde
|
||||
|
||||
recordingConf := conf.Get().SiteConfig().GitRecorder
|
||||
if recordingConf == nil {
|
||||
return graphqlutil.NewSliceConnectionResolver([]RecordedCommandResolver{}, 0, currentEnd), nil
|
||||
return gqlutil.NewSliceConnectionResolver([]RecordedCommandResolver{}, 0, currentEnd), nil
|
||||
}
|
||||
store := rcache.NewFIFOList(redispool.Cache, wrexec.GetFIFOListKey(r.Name()), recordingConf.Size)
|
||||
empty, err := store.IsEmpty()
|
||||
@ -57,7 +56,7 @@ func (r *RepositoryResolver) RecordedCommands(ctx context.Context, args *Recorde
|
||||
return nil, err
|
||||
}
|
||||
if empty {
|
||||
return graphqlutil.NewSliceConnectionResolver([]RecordedCommandResolver{}, 0, currentEnd), nil
|
||||
return gqlutil.NewSliceConnectionResolver([]RecordedCommandResolver{}, 0, currentEnd), nil
|
||||
}
|
||||
|
||||
// the FIFO list is zero-indexed, so we need to deduct one from the limit
|
||||
@ -82,7 +81,7 @@ func (r *RepositoryResolver) RecordedCommands(ctx context.Context, args *Recorde
|
||||
resolvers[i] = NewRecordedCommandResolver(command)
|
||||
}
|
||||
|
||||
return graphqlutil.NewSliceConnectionResolver(resolvers, size, currentEnd), nil
|
||||
return gqlutil.NewSliceConnectionResolver(resolvers, size, currentEnd), nil
|
||||
}
|
||||
|
||||
type RecordedCommandResolver interface {
|
||||
|
||||
@ -9,12 +9,12 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -39,7 +39,7 @@ type repositoryArgs struct {
|
||||
|
||||
OrderBy string
|
||||
Descending bool
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
}
|
||||
|
||||
func (args *repositoryArgs) toReposListOptions() (database.ReposListOptions, error) {
|
||||
@ -102,7 +102,7 @@ func (args *repositoryArgs) toReposListOptions() (database.ReposListOptions, err
|
||||
return opt, nil
|
||||
}
|
||||
|
||||
func (r *schemaResolver) Repositories(ctx context.Context, args *repositoryArgs) (*graphqlutil.ConnectionResolver[*RepositoryResolver], error) {
|
||||
func (r *schemaResolver) Repositories(ctx context.Context, args *repositoryArgs) (*gqlutil.ConnectionResolver[*RepositoryResolver], error) {
|
||||
opt, err := args.toReposListOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -123,13 +123,13 @@ func (r *schemaResolver) Repositories(ctx context.Context, args *repositoryArgs)
|
||||
orderBy = args.OrderBy
|
||||
}
|
||||
|
||||
connectionOptions := graphqlutil.ConnectionResolverOptions{
|
||||
connectionOptions := gqlutil.ConnectionResolverOptions{
|
||||
MaxPageSize: maxPageSize,
|
||||
OrderBy: database.OrderBy{{Field: string(toDBRepoListColumn(orderBy))}, {Field: "id"}},
|
||||
Ascending: !args.Descending,
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[*RepositoryResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
return gqlutil.NewConnectionResolver[*RepositoryResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
}
|
||||
|
||||
type repositoriesConnectionStore struct {
|
||||
@ -250,7 +250,7 @@ type TotalCountArgs struct {
|
||||
type RepositoryConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]*RepositoryResolver, error)
|
||||
TotalCount(ctx context.Context, args *TotalCountArgs) (*int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
func toDBRepoListColumn(ob string) database.RepoListColumn {
|
||||
|
||||
@ -15,7 +15,6 @@ import (
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/externallink"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -122,7 +121,7 @@ func (r *RepositoryResolver) EmbeddingExists(ctx context.Context) (bool, error)
|
||||
return r.db.Repos().RepoEmbeddingExists(ctx, r.IDInt32())
|
||||
}
|
||||
|
||||
func (r *RepositoryResolver) EmbeddingJobs(ctx context.Context, args ListRepoEmbeddingJobsArgs) (*graphqlutil.ConnectionResolver[RepoEmbeddingJobResolver], error) {
|
||||
func (r *RepositoryResolver) EmbeddingJobs(ctx context.Context, args ListRepoEmbeddingJobsArgs) (*gqlutil.ConnectionResolver[RepoEmbeddingJobResolver], error) {
|
||||
// Ensure that we only return jobs for this repository.
|
||||
gqlID := r.ID()
|
||||
args.Repo = &gqlID
|
||||
|
||||
@ -15,12 +15,12 @@ import (
|
||||
"github.com/sourcegraph/conc/pool"
|
||||
"github.com/sourcegraph/go-diff/diff"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/highlight"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gosyntect"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
)
|
||||
@ -48,7 +48,7 @@ type RepositoryComparisonInterface interface {
|
||||
type FileDiffConnection interface {
|
||||
Nodes(ctx context.Context) ([]FileDiff, error)
|
||||
TotalCount(ctx context.Context) (*int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
DiffStat(ctx context.Context) (*DiffStat, error)
|
||||
RawDiff(ctx context.Context) (string, error)
|
||||
}
|
||||
@ -168,7 +168,7 @@ func (r *RepositoryComparisonResolver) Range() *gitRevisionRange {
|
||||
|
||||
// RepositoryComparisonCommitsArgs is a set of arguments for listing commits on the RepositoryComparisonResolver
|
||||
type RepositoryComparisonCommitsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Path *string
|
||||
}
|
||||
|
||||
@ -363,19 +363,19 @@ func (r *fileDiffConnectionResolver) TotalCount(ctx context.Context) (*int32, er
|
||||
return nil, nil // total count is not available
|
||||
}
|
||||
|
||||
func (r *fileDiffConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *fileDiffConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, afterIdx, hasNextPage, err := r.compute(ctx, r.args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !hasNextPage {
|
||||
return graphqlutil.HasNextPage(hasNextPage), nil
|
||||
return gqlutil.HasNextPage(hasNextPage), nil
|
||||
}
|
||||
next := afterIdx
|
||||
if r.args.First != nil {
|
||||
next += *r.args.First
|
||||
}
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
|
||||
func (r *fileDiffConnectionResolver) DiffStat(ctx context.Context) (*DiffStat, error) {
|
||||
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver/gitdomain"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -21,8 +21,8 @@ type repositoryContributorsArgs struct {
|
||||
|
||||
func (r *RepositoryResolver) Contributors(args *struct {
|
||||
repositoryContributorsArgs
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
}) (*graphqlutil.ConnectionResolver[*repositoryContributorResolver], error) {
|
||||
gqlutil.ConnectionResolverArgs
|
||||
}) (*gqlutil.ConnectionResolver[*repositoryContributorResolver], error) {
|
||||
var after time.Time
|
||||
if args.AfterDate != nil && *args.AfterDate != "" {
|
||||
var err error
|
||||
@ -39,10 +39,10 @@ func (r *RepositoryResolver) Contributors(args *struct {
|
||||
repo: r,
|
||||
}
|
||||
reverse := false
|
||||
connectionOptions := graphqlutil.ConnectionResolverOptions{
|
||||
connectionOptions := gqlutil.ConnectionResolverOptions{
|
||||
Reverse: &reverse,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[*repositoryContributorResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
return gqlutil.NewConnectionResolver[*repositoryContributorResolver](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
}
|
||||
|
||||
type repositoryContributorConnectionStore struct {
|
||||
|
||||
@ -3,9 +3,9 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -43,7 +43,7 @@ func (r *externalRepositoryResolver) ServiceID(ctx context.Context) (string, err
|
||||
}
|
||||
|
||||
func (r *RepositoryResolver) ExternalServices(ctx context.Context, args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
}) (*ComputedExternalServiceConnectionResolver, error) {
|
||||
// 🚨 SECURITY: Only site admins may read external services (they have secrets).
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
|
||||
@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type refsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Query *string
|
||||
Type *string
|
||||
}
|
||||
@ -81,6 +81,6 @@ func (r *gitRefConnectionResolver) TotalCount() int32 {
|
||||
return int32(len(r.refs))
|
||||
}
|
||||
|
||||
func (r *gitRefConnectionResolver) PageInfo() *graphqlutil.PageInfo {
|
||||
return graphqlutil.HasNextPage(r.first != nil && int(*r.first) < len(r.refs))
|
||||
func (r *gitRefConnectionResolver) PageInfo() *gqlutil.PageInfo {
|
||||
return gqlutil.HasNextPage(r.first != nil && int(*r.first) < len(r.refs))
|
||||
}
|
||||
|
||||
@ -8,11 +8,11 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/deviceid"
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/rbac"
|
||||
"github.com/sourcegraph/sourcegraph/internal/usagestats"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
@ -188,10 +188,10 @@ func (r *schemaResolver) RepoMeta(ctx context.Context) (*repoMetaResolver, error
|
||||
|
||||
type RepoMetadataKeysArgs struct {
|
||||
database.RepoKVPListKeysOptions
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
}
|
||||
|
||||
func (r *repoMetaResolver) Keys(ctx context.Context, args *RepoMetadataKeysArgs) (*graphqlutil.ConnectionResolver[string], error) {
|
||||
func (r *repoMetaResolver) Keys(ctx context.Context, args *RepoMetadataKeysArgs) (*gqlutil.ConnectionResolver[string], error) {
|
||||
if err := rbac.CheckCurrentUserHasPermission(ctx, r.db, rbac.RepoMetadataWritePermission); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -207,12 +207,12 @@ func (r *repoMetaResolver) Keys(ctx context.Context, args *RepoMetadataKeysArgs)
|
||||
}
|
||||
|
||||
reverse := false
|
||||
connectionOptions := graphqlutil.ConnectionResolverOptions{
|
||||
connectionOptions := gqlutil.ConnectionResolverOptions{
|
||||
Reverse: &reverse,
|
||||
OrderBy: database.OrderBy{{Field: string(database.RepoKVPListKeyColumn)}},
|
||||
Ascending: true,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[string](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
return gqlutil.NewConnectionResolver[string](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
}
|
||||
|
||||
type repoMetaKeysConnectionStore struct {
|
||||
@ -258,10 +258,10 @@ type repoMetaKeyResolver struct {
|
||||
|
||||
type RepoMetadataValuesArgs struct {
|
||||
Query *string
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
}
|
||||
|
||||
func (r *repoMetaKeyResolver) Values(ctx context.Context, args *RepoMetadataValuesArgs) (*graphqlutil.ConnectionResolver[string], error) {
|
||||
func (r *repoMetaKeyResolver) Values(ctx context.Context, args *RepoMetadataValuesArgs) (*gqlutil.ConnectionResolver[string], error) {
|
||||
if err := rbac.CheckCurrentUserHasPermission(ctx, r.db, rbac.RepoMetadataWritePermission); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -279,12 +279,12 @@ func (r *repoMetaKeyResolver) Values(ctx context.Context, args *RepoMetadataValu
|
||||
}
|
||||
|
||||
reverse := false
|
||||
connectionOptions := graphqlutil.ConnectionResolverOptions{
|
||||
connectionOptions := gqlutil.ConnectionResolverOptions{
|
||||
Reverse: &reverse,
|
||||
OrderBy: database.OrderBy{{Field: string(database.RepoKVPListValueColumn)}},
|
||||
Ascending: true,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[string](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
return gqlutil.NewConnectionResolver[string](connectionStore, &args.ConnectionResolverArgs, &connectionOptions)
|
||||
}
|
||||
|
||||
type repoMetaValuesConnectionStore struct {
|
||||
|
||||
@ -6,7 +6,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -45,7 +44,7 @@ func (r *roleResolver) System() bool {
|
||||
return r.role.System
|
||||
}
|
||||
|
||||
func (r *roleResolver) Permissions(ctx context.Context, args *ListPermissionArgs) (*graphqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
func (r *roleResolver) Permissions(ctx context.Context, args *ListPermissionArgs) (*gqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
// 🚨 SECURITY: Only viewable by site admins.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
@ -58,10 +57,10 @@ func (r *roleResolver) Permissions(ctx context.Context, args *ListPermissionArgs
|
||||
db: r.db,
|
||||
roleID: r.role.ID,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[PermissionResolver](
|
||||
return gqlutil.NewConnectionResolver[PermissionResolver](
|
||||
connectionStore,
|
||||
&args.ConnectionResolverArgs,
|
||||
&graphqlutil.ConnectionResolverOptions{
|
||||
&gqlutil.ConnectionResolverOptions{
|
||||
AllowNoLimit: true,
|
||||
},
|
||||
)
|
||||
|
||||
@ -5,13 +5,13 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
func (r *schemaResolver) Roles(ctx context.Context, args *ListRoleArgs) (*graphqlutil.ConnectionResolver[RoleResolver], error) {
|
||||
func (r *schemaResolver) Roles(ctx context.Context, args *ListRoleArgs) (*gqlutil.ConnectionResolver[RoleResolver], error) {
|
||||
connectionStore := roleConnectionStore{
|
||||
db: r.db,
|
||||
system: args.System,
|
||||
@ -37,10 +37,10 @@ func (r *schemaResolver) Roles(ctx context.Context, args *ListRoleArgs) (*graphq
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[RoleResolver](
|
||||
return gqlutil.NewConnectionResolver[RoleResolver](
|
||||
&connectionStore,
|
||||
&args.ConnectionResolverArgs,
|
||||
&graphqlutil.ConnectionResolverOptions{
|
||||
&gqlutil.ConnectionResolverOptions{
|
||||
OrderBy: database.OrderBy{
|
||||
{Field: "roles.system"},
|
||||
{Field: "roles.created_at"},
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -46,7 +45,7 @@ func (v SavedSearchVisibility) IsSecret() bool {
|
||||
return v != SavedSearchVisibilityPublic
|
||||
}
|
||||
|
||||
type SavedSearchConnectionResolver = graphqlutil.ConnectionResolver[SavedSearchResolver]
|
||||
type SavedSearchConnectionResolver = gqlutil.ConnectionResolver[SavedSearchResolver]
|
||||
|
||||
type SavedSearchResolver interface {
|
||||
ID() graphql.ID
|
||||
@ -64,7 +63,7 @@ type SavedSearchResolver interface {
|
||||
}
|
||||
|
||||
type SavedSearchesArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
Owner *graphql.ID
|
||||
ViewerIsAffiliated *bool
|
||||
|
||||
@ -8,10 +8,10 @@ import (
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/client"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
@ -106,7 +106,7 @@ func (r *schemaResolver) indexedSearchInstanceByID(ctx context.Context, id graph
|
||||
return &indexedSearchInstance{address: address}, nil
|
||||
}
|
||||
|
||||
func (r *schemaResolver) IndexedSearchInstances(ctx context.Context) (graphqlutil.SliceConnectionResolver[*indexedSearchInstance], error) {
|
||||
func (r *schemaResolver) IndexedSearchInstances(ctx context.Context) (gqlutil.SliceConnectionResolver[*indexedSearchInstance], error) {
|
||||
// 🚨 SECURITY: Site admins only.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
@ -126,5 +126,5 @@ func (r *schemaResolver) IndexedSearchInstances(ctx context.Context) (graphqluti
|
||||
}
|
||||
n := len(resolvers)
|
||||
|
||||
return graphqlutil.NewSliceConnectionResolver(resolvers, n, n), nil
|
||||
return gqlutil.NewSliceConnectionResolver(resolvers, n, n), nil
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
@ -56,7 +55,7 @@ type SearchContextResolver interface {
|
||||
type SearchContextConnectionResolver interface {
|
||||
Nodes() []SearchContextResolver
|
||||
TotalCount() int32
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type SearchContextRepositoryRevisionsResolver interface {
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -16,7 +15,7 @@ type SearchJobsResolver interface {
|
||||
DeleteSearchJob(ctx context.Context, args *DeleteSearchJobArgs) (*EmptyResponse, error)
|
||||
|
||||
// Queries
|
||||
SearchJobs(ctx context.Context, args *SearchJobsArgs) (*graphqlutil.ConnectionResolver[SearchJobResolver], error)
|
||||
SearchJobs(ctx context.Context, args *SearchJobsArgs) (*gqlutil.ConnectionResolver[SearchJobResolver], error)
|
||||
ValidateSearchJob(ctx context.Context, args *CreateSearchJobArgs) (*EmptyResponse, error)
|
||||
|
||||
NodeResolvers() map[string]NodeByIDFunc
|
||||
@ -83,7 +82,7 @@ type SearchJobArgs struct {
|
||||
}
|
||||
|
||||
type SearchJobsArgs struct {
|
||||
graphqlutil.ConnectionResolverArgs
|
||||
gqlutil.ConnectionResolverArgs
|
||||
Query *string
|
||||
States *[]string
|
||||
OrderBy string
|
||||
@ -93,6 +92,6 @@ type SearchJobsArgs struct {
|
||||
|
||||
type SearchJobsConnectionResolver interface {
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
Nodes(ctx context.Context) ([]SearchJobResolver, error)
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ import (
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/cody"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -276,7 +275,7 @@ func (r *siteConfigurationResolver) ValidationMessages(ctx context.Context) ([]s
|
||||
return conf.ValidateSite(string(contents))
|
||||
}
|
||||
|
||||
func (r *siteConfigurationResolver) History(ctx context.Context, args *graphqlutil.ConnectionResolverArgs) (*graphqlutil.ConnectionResolver[*SiteConfigurationChangeResolver], error) {
|
||||
func (r *siteConfigurationResolver) History(ctx context.Context, args *gqlutil.ConnectionResolverArgs) (*gqlutil.ConnectionResolver[*SiteConfigurationChangeResolver], error) {
|
||||
// 🚨 SECURITY: The site configuration contains secret tokens and credentials,
|
||||
// so only admins may view the history.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
@ -285,7 +284,7 @@ func (r *siteConfigurationResolver) History(ctx context.Context, args *graphqlut
|
||||
|
||||
connectionStore := SiteConfigurationChangeConnectionStore{db: r.db}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[*SiteConfigurationChangeResolver](
|
||||
return gqlutil.NewConnectionResolver[*SiteConfigurationChangeResolver](
|
||||
&connectionStore,
|
||||
args,
|
||||
nil,
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
)
|
||||
|
||||
@ -57,17 +57,17 @@ func TestSiteConfigurationDiff(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args *graphqlutil.ConnectionResolverArgs
|
||||
args *gqlutil.ConnectionResolverArgs
|
||||
}{
|
||||
// We have tests for pagination so we can skip that here and just check for the diff for all
|
||||
// the nodes in both the directions.
|
||||
{
|
||||
name: "first: 10",
|
||||
args: &graphqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(10))},
|
||||
args: &gqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(10))},
|
||||
},
|
||||
{
|
||||
name: "last: 10",
|
||||
args: &graphqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(10))},
|
||||
args: &gqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(10))},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -11,12 +11,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/oobmigration"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
@ -174,42 +174,42 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args *graphqlutil.ConnectionResolverArgs
|
||||
args *gqlutil.ConnectionResolverArgs
|
||||
expectedSiteConfigIDs []int32
|
||||
}{
|
||||
{
|
||||
name: "first: 2",
|
||||
args: &graphqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(2))},
|
||||
args: &gqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(2))},
|
||||
expectedSiteConfigIDs: []int32{6, 4},
|
||||
},
|
||||
{
|
||||
name: "first: 6 (exact number of items that exist in the database)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(6))},
|
||||
args: &gqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(6))},
|
||||
expectedSiteConfigIDs: []int32{6, 4, 3, 2, 1},
|
||||
},
|
||||
{
|
||||
name: "first: 20 (more items than what exists in the database)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(20))},
|
||||
args: &gqlutil.ConnectionResolverArgs{First: pointers.Ptr(int32(20))},
|
||||
expectedSiteConfigIDs: []int32{6, 4, 3, 2, 1},
|
||||
},
|
||||
{
|
||||
name: "last: 2",
|
||||
args: &graphqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(2))},
|
||||
args: &gqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(2))},
|
||||
expectedSiteConfigIDs: []int32{2, 1},
|
||||
},
|
||||
{
|
||||
name: "last: 6 (exact number of items that exist in the database)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(6))},
|
||||
args: &gqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(6))},
|
||||
expectedSiteConfigIDs: []int32{6, 4, 3, 2, 1},
|
||||
},
|
||||
{
|
||||
name: "last: 20 (more items than what exists in the database)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(20))},
|
||||
args: &gqlutil.ConnectionResolverArgs{Last: pointers.Ptr(int32(20))},
|
||||
expectedSiteConfigIDs: []int32{6, 4, 3, 2, 1},
|
||||
},
|
||||
{
|
||||
name: "first: 2, after: 4",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
First: pointers.Ptr(int32(2)),
|
||||
After: pointers.Ptr(string(marshalSiteConfigurationChangeID(4))),
|
||||
},
|
||||
@ -217,7 +217,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "first: 10, after: 4 (overflow)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
First: pointers.Ptr(int32(10)),
|
||||
After: pointers.Ptr(string(marshalSiteConfigurationChangeID(4))),
|
||||
},
|
||||
@ -225,7 +225,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "first: 10, after: 7 (same as get all items, but latest ID in DB is 6)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
First: pointers.Ptr(int32(10)),
|
||||
After: pointers.Ptr(string(marshalSiteConfigurationChangeID(7))),
|
||||
},
|
||||
@ -233,7 +233,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "first: 10, after: 1 (beyond the last cursor in DB which is 1)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
First: pointers.Ptr(int32(10)),
|
||||
After: pointers.Ptr(string(marshalSiteConfigurationChangeID(1))),
|
||||
},
|
||||
@ -241,7 +241,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "last: 2, before: 1",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
Last: pointers.Ptr(int32(2)),
|
||||
Before: pointers.Ptr(string(marshalSiteConfigurationChangeID(1))),
|
||||
},
|
||||
@ -249,7 +249,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "last: 10, before: 1 (overflow)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
Last: pointers.Ptr(int32(10)),
|
||||
Before: pointers.Ptr(string(marshalSiteConfigurationChangeID(1))),
|
||||
},
|
||||
@ -257,7 +257,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "last: 10, before: 0 (same as get all items, but oldest ID in DB is 1)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
Last: pointers.Ptr(int32(10)),
|
||||
Before: pointers.Ptr(string(marshalSiteConfigurationChangeID(0))),
|
||||
},
|
||||
@ -265,7 +265,7 @@ func TestSiteConfigurationHistory(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "last: 10, before: 7 (beyond the latest cursor in DB which is 6)",
|
||||
args: &graphqlutil.ConnectionResolverArgs{
|
||||
args: &gqlutil.ConnectionResolverArgs{
|
||||
Last: pointers.Ptr(int32(10)),
|
||||
Before: pointers.Ptr(string(marshalSiteConfigurationChangeID(7))),
|
||||
},
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
@ -144,7 +143,7 @@ func (r *slowRequestConnectionResolver) TotalCount(ctx context.Context) (int32,
|
||||
return r.totalCount, err
|
||||
}
|
||||
|
||||
func (r *slowRequestConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *slowRequestConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
reqs, err := r.fetch(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -159,9 +158,9 @@ func (r *slowRequestConnectionResolver) PageInfo(ctx context.Context) (*graphqlu
|
||||
return nil, err
|
||||
}
|
||||
if int32(n+r.perPage) >= total {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
} else {
|
||||
return graphqlutil.NextPageCursor(reqs[len(reqs)-1].Index), nil
|
||||
return gqlutil.NextPageCursor(reqs[len(reqs)-1].Index), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type surveyResponseConnectionResolver struct {
|
||||
@ -14,7 +14,7 @@ type surveyResponseConnectionResolver struct {
|
||||
}
|
||||
|
||||
func (r *schemaResolver) SurveyResponses(args *struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
}) *surveyResponseConnectionResolver {
|
||||
var opt database.SurveyResponseListOptions
|
||||
args.ConnectionArgs.Set(&opt.LimitOffset)
|
||||
|
||||
@ -4,17 +4,17 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/result"
|
||||
"github.com/sourcegraph/sourcegraph/internal/search/symbol"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
type symbolsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
Query *string
|
||||
IncludePatterns *[]string
|
||||
}
|
||||
@ -111,8 +111,8 @@ func (r *symbolConnectionResolver) Nodes(ctx context.Context) ([]symbolResolver,
|
||||
return symbols, nil
|
||||
}
|
||||
|
||||
func (r *symbolConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
return graphqlutil.HasNextPage(len(r.symbols) > limitOrDefault(r.first)), nil
|
||||
func (r *symbolConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
return gqlutil.HasNextPage(len(r.symbols) > limitOrDefault(r.first)), nil
|
||||
}
|
||||
|
||||
type symbolResolver struct {
|
||||
|
||||
@ -11,12 +11,12 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/own"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
@ -50,7 +50,7 @@ type teamConnectionResolver struct {
|
||||
teams []*types.Team
|
||||
onlyRootTeams bool
|
||||
exceptAncestorID int32
|
||||
pageInfo *graphqlutil.PageInfo
|
||||
pageInfo *gqlutil.PageInfo
|
||||
err error
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ type teamConnectionResolver struct {
|
||||
// into `teamConnectionResolver` fields for convenient use in database query.
|
||||
func (r *teamConnectionResolver) applyArgs(args *ListTeamsArgs) error {
|
||||
if args.After != nil {
|
||||
cursor, err := graphqlutil.DecodeIntCursor(args.After)
|
||||
cursor, err := gqlutil.DecodeIntCursor(args.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -100,9 +100,9 @@ func (r *teamConnectionResolver) compute(ctx context.Context) {
|
||||
}
|
||||
r.teams = teams
|
||||
if next > 0 {
|
||||
r.pageInfo = graphqlutil.EncodeIntCursor(&next)
|
||||
r.pageInfo = gqlutil.EncodeIntCursor(&next)
|
||||
} else {
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -117,7 +117,7 @@ func (r *teamConnectionResolver) TotalCount(ctx context.Context) (int32, error)
|
||||
return r.db.Teams().CountTeams(ctx, opts)
|
||||
}
|
||||
|
||||
func (r *teamConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *teamConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
r.compute(ctx)
|
||||
return r.pageInfo, r.err
|
||||
}
|
||||
@ -262,7 +262,7 @@ type teamMemberConnection struct {
|
||||
limit int
|
||||
once sync.Once
|
||||
nodes []*types.TeamMember
|
||||
pageInfo *graphqlutil.PageInfo
|
||||
pageInfo *gqlutil.PageInfo
|
||||
err error
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ type teamMemberListCursor struct {
|
||||
// into `teamMemberConnection` fields for convenient use in database query.
|
||||
func (r *teamMemberConnection) applyArgs(args *ListTeamMembersArgs) error {
|
||||
if args.After != nil && *args.After != "" {
|
||||
cursorText, err := graphqlutil.DecodeCursor(args.After)
|
||||
cursorText, err := gqlutil.DecodeCursor(args.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -326,9 +326,9 @@ func (r *teamMemberConnection) compute(ctx context.Context) {
|
||||
r.err = errors.Wrap(err, "error encoding pageInfo")
|
||||
}
|
||||
cursorString := string(cursorBytes)
|
||||
r.pageInfo = graphqlutil.EncodeCursor(&cursorString)
|
||||
r.pageInfo = gqlutil.EncodeCursor(&cursorString)
|
||||
} else {
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -342,7 +342,7 @@ func (r *teamMemberConnection) TotalCount(ctx context.Context) (int32, error) {
|
||||
return r.db.Teams().CountTeamMembers(ctx, opts)
|
||||
}
|
||||
|
||||
func (r *teamMemberConnection) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *teamMemberConnection) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
r.compute(ctx)
|
||||
if r.err != nil {
|
||||
return nil, r.err
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -37,7 +36,7 @@ type ExportedEventResolver interface {
|
||||
type ExportedEventsConnectionResolver interface {
|
||||
Nodes() []ExportedEventResolver
|
||||
TotalCount() (int32, error)
|
||||
PageInfo() *graphqlutil.PageInfo
|
||||
PageInfo() *gqlutil.PageInfo
|
||||
}
|
||||
|
||||
type RecordEventArgs struct{ Event TelemetryEventInput }
|
||||
|
||||
@ -7,22 +7,19 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/graph-gophers/graphql-go/relay"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/cody"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/ssc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
|
||||
"github.com/keegancsmith/sqlf"
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/providers"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/backend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/cody"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/ssc"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/suspiciousnames"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/conf"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
@ -766,7 +763,7 @@ func (r *UserResolver) BatchChangesCodeHosts(ctx context.Context, args *ListBatc
|
||||
return EnterpriseResolvers.batchChangesResolver.BatchChangesCodeHosts(ctx, args)
|
||||
}
|
||||
|
||||
func (r *UserResolver) Roles(ctx context.Context, args *ListRoleArgs) (*graphqlutil.ConnectionResolver[RoleResolver], error) {
|
||||
func (r *UserResolver) Roles(ctx context.Context, args *ListRoleArgs) (*gqlutil.ConnectionResolver[RoleResolver], error) {
|
||||
// 🚨 SECURITY: In dotcom mode, only allow site admins to check roles.
|
||||
if dotcom.SourcegraphDotComMode() && auth.CheckCurrentUserIsSiteAdmin(ctx, r.db) != nil {
|
||||
return nil, errors.New("unauthorized")
|
||||
@ -776,16 +773,16 @@ func (r *UserResolver) Roles(ctx context.Context, args *ListRoleArgs) (*graphqlu
|
||||
db: r.db,
|
||||
userID: userID,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[RoleResolver](
|
||||
return gqlutil.NewConnectionResolver[RoleResolver](
|
||||
connectionStore,
|
||||
&args.ConnectionResolverArgs,
|
||||
&graphqlutil.ConnectionResolverOptions{
|
||||
&gqlutil.ConnectionResolverOptions{
|
||||
AllowNoLimit: true,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (r *UserResolver) Permissions() (*graphqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
func (r *UserResolver) Permissions() (*gqlutil.ConnectionResolver[PermissionResolver], error) {
|
||||
userID := r.user.ID
|
||||
if err := auth.CheckSiteAdminOrSameUserFromActor(r.actor, r.db, userID); err != nil {
|
||||
return nil, err
|
||||
@ -794,10 +791,10 @@ func (r *UserResolver) Permissions() (*graphqlutil.ConnectionResolver[Permission
|
||||
db: r.db,
|
||||
userID: userID,
|
||||
}
|
||||
return graphqlutil.NewConnectionResolver[PermissionResolver](
|
||||
return gqlutil.NewConnectionResolver[PermissionResolver](
|
||||
connectionStore,
|
||||
&graphqlutil.ConnectionResolverArgs{},
|
||||
&graphqlutil.ConnectionResolverOptions{
|
||||
&gqlutil.ConnectionResolverArgs{},
|
||||
&gqlutil.ConnectionResolverOptions{
|
||||
AllowNoLimit: true,
|
||||
},
|
||||
)
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type usersArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
Query *string
|
||||
ActivePeriod *string
|
||||
@ -55,7 +54,7 @@ func (r *schemaResolver) Users(ctx context.Context, args *usersArgs) (*userConne
|
||||
type UserConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]*UserResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
var _ UserConnectionResolver = &userConnectionResolver{}
|
||||
@ -120,7 +119,7 @@ func (r *userConnectionResolver) TotalCount(ctx context.Context) (int32, error)
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *userConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *userConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
users, totalCount, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -128,18 +127,18 @@ func (r *userConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.Pag
|
||||
|
||||
// We would have had all results when no limit set
|
||||
if r.opt.LimitOffset == nil {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
after := r.opt.LimitOffset.Offset + len(users)
|
||||
|
||||
// We got less results than limit, means we've had all results
|
||||
if after < r.opt.Limit {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
if totalCount > after {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(after)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(after)), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@ package graphqlbackend
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
func (r *schemaResolver) Viewer(ctx context.Context) (*viewerResolver, error) {
|
||||
@ -27,7 +27,7 @@ func (r *schemaResolver) Viewer(ctx context.Context) (*viewerResolver, error) {
|
||||
|
||||
// viewer is the interface for the GraphQL viewer interface.
|
||||
type viewer interface {
|
||||
AffiliatedNamespaces(ctx context.Context) (graphqlutil.SliceConnectionResolver[*NamespaceResolver], error)
|
||||
AffiliatedNamespaces(ctx context.Context) (gqlutil.SliceConnectionResolver[*NamespaceResolver], error)
|
||||
}
|
||||
|
||||
// viewerResolver resolves the GraphQL Viewer interface to a type.
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/encryption/keyring"
|
||||
@ -25,7 +24,7 @@ import (
|
||||
// access to webhook logs: the webhookLogs method on the top level query, and on
|
||||
// the ExternalService type.
|
||||
type WebhookLogsArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
OnlyErrors *bool
|
||||
Since *time.Time
|
||||
@ -178,16 +177,16 @@ func (r *WebhookLogConnectionResolver) TotalCount(ctx context.Context) (int32, e
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *WebhookLogConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *WebhookLogConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if next == 0 {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
return graphqlutil.NextPageCursor(fmt.Sprint(next)), nil
|
||||
return gqlutil.NextPageCursor(fmt.Sprint(next)), nil
|
||||
}
|
||||
|
||||
func (r *WebhookLogConnectionResolver) compute(ctx context.Context) ([]*types.WebhookLog, int64, error) {
|
||||
|
||||
@ -10,9 +10,9 @@ import (
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/pointers"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
@ -54,7 +54,7 @@ func TestWebhookLogsArgs(t *testing.T) {
|
||||
"all arguments": {
|
||||
id: webhookLogsExternalServiceID(1),
|
||||
input: WebhookLogsArgs{
|
||||
ConnectionArgs: graphqlutil.ConnectionArgs{
|
||||
ConnectionArgs: gqlutil.ConnectionArgs{
|
||||
First: pointers.Ptr(int32(25)),
|
||||
},
|
||||
After: pointers.Ptr("40"),
|
||||
@ -156,7 +156,7 @@ func TestWebhookLogConnectionResolver(t *testing.T) {
|
||||
|
||||
r := &WebhookLogConnectionResolver{
|
||||
args: &WebhookLogsArgs{
|
||||
ConnectionArgs: graphqlutil.ConnectionArgs{
|
||||
ConnectionArgs: gqlutil.ConnectionArgs{
|
||||
First: pointers.Ptr(int32(20)),
|
||||
},
|
||||
},
|
||||
@ -189,7 +189,7 @@ func TestWebhookLogConnectionResolver(t *testing.T) {
|
||||
|
||||
r := &WebhookLogConnectionResolver{
|
||||
args: &WebhookLogsArgs{
|
||||
ConnectionArgs: graphqlutil.ConnectionArgs{
|
||||
ConnectionArgs: gqlutil.ConnectionArgs{
|
||||
First: pointers.Ptr(int32(20)),
|
||||
},
|
||||
},
|
||||
@ -225,7 +225,7 @@ func TestWebhookLogConnectionResolver(t *testing.T) {
|
||||
|
||||
r := &WebhookLogConnectionResolver{
|
||||
args: &WebhookLogsArgs{
|
||||
ConnectionArgs: graphqlutil.ConnectionArgs{
|
||||
ConnectionArgs: gqlutil.ConnectionArgs{
|
||||
First: pointers.Ptr(int32(20)),
|
||||
},
|
||||
},
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
@ -22,7 +22,7 @@ type WebhooksResolver interface {
|
||||
type WebhookConnectionResolver interface {
|
||||
Nodes(ctx context.Context) ([]WebhookResolver, error)
|
||||
TotalCount(ctx context.Context) (int32, error)
|
||||
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
|
||||
PageInfo(ctx context.Context) (*gqlutil.PageInfo, error)
|
||||
}
|
||||
|
||||
// WebhookResolver is an interface for querying a single webhook.
|
||||
@ -61,7 +61,7 @@ type UpdateWebhookArgs struct {
|
||||
}
|
||||
|
||||
type ListWebhookArgs struct {
|
||||
graphqlutil.ConnectionArgs
|
||||
gqlutil.ConnectionArgs
|
||||
After *string
|
||||
Kind *string
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ go_library(
|
||||
visibility = ["//cmd/frontend:__subpackages__"],
|
||||
deps = [
|
||||
"//cmd/frontend/graphqlbackend",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//internal/actor",
|
||||
"//internal/api",
|
||||
"//internal/auth",
|
||||
@ -53,7 +52,6 @@ go_test(
|
||||
tags = [TAG_PLATFORM_SOURCE],
|
||||
deps = [
|
||||
"//cmd/frontend/graphqlbackend",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//internal/actor",
|
||||
"//internal/api",
|
||||
"//internal/auth",
|
||||
@ -65,6 +63,7 @@ go_test(
|
||||
"//internal/dotcom",
|
||||
"//internal/executor",
|
||||
"//internal/extsvc",
|
||||
"//internal/gqlutil",
|
||||
"//internal/licensing",
|
||||
"//internal/observation",
|
||||
"//internal/timeutil",
|
||||
|
||||
@ -7,14 +7,12 @@ import (
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/authz"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
@ -59,13 +57,13 @@ func (r *permissionsInfoResolver) Unrestricted(_ context.Context) bool {
|
||||
|
||||
var permissionsInfoRepositoryConnectionMaxPageSize = 100
|
||||
|
||||
var permissionsInfoRepositoryConnectionOptions = &graphqlutil.ConnectionResolverOptions{
|
||||
var permissionsInfoRepositoryConnectionOptions = &gqlutil.ConnectionResolverOptions{
|
||||
OrderBy: database.OrderBy{{Field: "repo.id"}},
|
||||
Ascending: true,
|
||||
MaxPageSize: permissionsInfoRepositoryConnectionMaxPageSize,
|
||||
}
|
||||
|
||||
func (r *permissionsInfoResolver) Repositories(_ context.Context, args graphqlbackend.PermissionsInfoRepositoriesArgs) (*graphqlutil.ConnectionResolver[graphqlbackend.PermissionsInfoRepositoryResolver], error) {
|
||||
func (r *permissionsInfoResolver) Repositories(_ context.Context, args graphqlbackend.PermissionsInfoRepositoriesArgs) (*gqlutil.ConnectionResolver[graphqlbackend.PermissionsInfoRepositoryResolver], error) {
|
||||
if r.userID == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@ -81,7 +79,7 @@ func (r *permissionsInfoResolver) Repositories(_ context.Context, args graphqlba
|
||||
query: query,
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[graphqlbackend.PermissionsInfoRepositoryResolver](connectionStore, &args.ConnectionResolverArgs, permissionsInfoRepositoryConnectionOptions)
|
||||
return gqlutil.NewConnectionResolver[graphqlbackend.PermissionsInfoRepositoryResolver](connectionStore, &args.ConnectionResolverArgs, permissionsInfoRepositoryConnectionOptions)
|
||||
}
|
||||
|
||||
type permissionsInfoRepositoriesStore struct {
|
||||
@ -157,13 +155,13 @@ func (r permissionsInfoRepositoryResolver) UpdatedAt() *gqlutil.DateTime {
|
||||
|
||||
var permissionsInfoUserConnectionMaxPageSize = 100
|
||||
|
||||
var permissionsInfoUserConnectionOptions = &graphqlutil.ConnectionResolverOptions{
|
||||
var permissionsInfoUserConnectionOptions = &gqlutil.ConnectionResolverOptions{
|
||||
OrderBy: database.OrderBy{{Field: "users.username"}},
|
||||
Ascending: true,
|
||||
MaxPageSize: permissionsInfoUserConnectionMaxPageSize,
|
||||
}
|
||||
|
||||
func (r *permissionsInfoResolver) Users(ctx context.Context, args graphqlbackend.PermissionsInfoUsersArgs) (*graphqlutil.ConnectionResolver[graphqlbackend.PermissionsInfoUserResolver], error) {
|
||||
func (r *permissionsInfoResolver) Users(ctx context.Context, args graphqlbackend.PermissionsInfoUsersArgs) (*gqlutil.ConnectionResolver[graphqlbackend.PermissionsInfoUserResolver], error) {
|
||||
if r.repoID == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@ -180,7 +178,7 @@ func (r *permissionsInfoResolver) Users(ctx context.Context, args graphqlbackend
|
||||
query: query,
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[graphqlbackend.PermissionsInfoUserResolver](connectionStore, &args.ConnectionResolverArgs, permissionsInfoUserConnectionOptions)
|
||||
return gqlutil.NewConnectionResolver[graphqlbackend.PermissionsInfoUserResolver](connectionStore, &args.ConnectionResolverArgs, permissionsInfoUserConnectionOptions)
|
||||
}
|
||||
|
||||
type permissionsInfoUsersStore struct {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
@ -21,7 +20,7 @@ import (
|
||||
|
||||
const permissionsSyncJobIDKind = "PermissionsSyncJob"
|
||||
|
||||
func NewPermissionsSyncJobsResolver(logger log.Logger, db database.DB, args graphqlbackend.ListPermissionsSyncJobsArgs) (*graphqlutil.ConnectionResolver[graphqlbackend.PermissionsSyncJobResolver], error) {
|
||||
func NewPermissionsSyncJobsResolver(logger log.Logger, db database.DB, args graphqlbackend.ListPermissionsSyncJobsArgs) (*gqlutil.ConnectionResolver[graphqlbackend.PermissionsSyncJobResolver], error) {
|
||||
store := &permissionsSyncJobConnectionStore{
|
||||
logger: logger.Scoped("permissions_sync_jobs_resolver"),
|
||||
db: db,
|
||||
@ -32,7 +31,7 @@ func NewPermissionsSyncJobsResolver(logger log.Logger, db database.DB, args grap
|
||||
return nil, errors.New("please provide either userID or repoID, but not both.")
|
||||
}
|
||||
|
||||
return graphqlutil.NewConnectionResolver[graphqlbackend.PermissionsSyncJobResolver](
|
||||
return gqlutil.NewConnectionResolver[graphqlbackend.PermissionsSyncJobResolver](
|
||||
store, &args.ConnectionResolverArgs, nil)
|
||||
}
|
||||
|
||||
|
||||
@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database/dbmocks"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -19,7 +19,7 @@ import (
|
||||
func TestPermissionSyncJobsResolver(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
first := int32(1337)
|
||||
args := graphqlutil.ConnectionResolverArgs{First: &first}
|
||||
args := gqlutil.ConnectionResolverArgs{First: &first}
|
||||
|
||||
t.Run("No jobs found", func(t *testing.T) {
|
||||
db := dbmocks.NewMockDB()
|
||||
|
||||
@ -7,11 +7,11 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -28,7 +28,7 @@ type repositoryConnectionResolver struct {
|
||||
// cache results because they are used by multiple fields
|
||||
once sync.Once
|
||||
repos []*types.Repo
|
||||
pageInfo *graphqlutil.PageInfo
|
||||
pageInfo *gqlutil.PageInfo
|
||||
err error
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ type repositoryConnectionResolver struct {
|
||||
// r.ids - the full slice of sorted repo IDs
|
||||
// r.after - (optional) the repo ID to start the paging after (does not include the after ID itself)
|
||||
// r.first - the # of repo IDs to return
|
||||
func (r *repositoryConnectionResolver) compute(ctx context.Context) ([]*types.Repo, *graphqlutil.PageInfo, error) {
|
||||
func (r *repositoryConnectionResolver) compute(ctx context.Context) ([]*types.Repo, *gqlutil.PageInfo, error) {
|
||||
r.once.Do(func() {
|
||||
var idSubset []int32
|
||||
if r.after == nil {
|
||||
@ -68,7 +68,7 @@ func (r *repositoryConnectionResolver) compute(ctx context.Context) ([]*types.Re
|
||||
// No IDs to find, return early
|
||||
if len(idSubset) == 0 {
|
||||
r.repos = []*types.Repo{}
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
return
|
||||
}
|
||||
// If we have more ids than we need, trim them
|
||||
@ -90,10 +90,10 @@ func (r *repositoryConnectionResolver) compute(ctx context.Context) ([]*types.Re
|
||||
|
||||
// The last id in this page is the last id in r.ids, no more pages
|
||||
if int32(repoIDs[len(repoIDs)-1]) == r.ids[len(r.ids)-1] {
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
} else { // Additional repo IDs to paginate through.
|
||||
endCursor := string(graphqlbackend.MarshalRepositoryID(repoIDs[len(repoIDs)-1]))
|
||||
r.pageInfo = graphqlutil.NextPageCursor(endCursor)
|
||||
r.pageInfo = gqlutil.NextPageCursor(endCursor)
|
||||
}
|
||||
})
|
||||
return r.repos, r.pageInfo, r.err
|
||||
@ -127,7 +127,7 @@ func (r *repositoryConnectionResolver) TotalCount(ctx context.Context, args *gra
|
||||
return &count, nil
|
||||
}
|
||||
|
||||
func (r *repositoryConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *repositoryConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
// 🚨 SECURITY: Only site admins may access this method.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/actor"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
@ -23,6 +22,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/dotcom"
|
||||
"github.com/sourcegraph/sourcegraph/internal/errcode"
|
||||
"github.com/sourcegraph/sourcegraph/internal/extsvc"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/licensing"
|
||||
"github.com/sourcegraph/sourcegraph/internal/observation"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
@ -635,7 +635,7 @@ func (r *Resolver) UserPermissionsInfo(ctx context.Context, id graphql.ID) (grap
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *Resolver) PermissionsSyncJobs(ctx context.Context, args graphqlbackend.ListPermissionsSyncJobsArgs) (*graphqlutil.ConnectionResolver[graphqlbackend.PermissionsSyncJobResolver], error) {
|
||||
func (r *Resolver) PermissionsSyncJobs(ctx context.Context, args graphqlbackend.ListPermissionsSyncJobsArgs) (*gqlutil.ConnectionResolver[graphqlbackend.PermissionsSyncJobResolver], error) {
|
||||
// 🚨 SECURITY: Only site admins can query sync jobs records or the users themselves.
|
||||
if args.UserID != nil {
|
||||
userID, err := graphqlbackend.UnmarshalUserID(*args.UserID)
|
||||
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/auth"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -26,7 +26,7 @@ type userConnectionResolver struct {
|
||||
// cache results because they are used by multiple fields
|
||||
once sync.Once
|
||||
users []*types.User
|
||||
pageInfo *graphqlutil.PageInfo
|
||||
pageInfo *gqlutil.PageInfo
|
||||
err error
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ type userConnectionResolver struct {
|
||||
// r.ids - the full slice of sorted user IDs
|
||||
// r.after - (optional) the user ID to start the paging after (does not include the after ID itself)
|
||||
// r.first - the # of user IDs to return
|
||||
func (r *userConnectionResolver) compute(ctx context.Context) ([]*types.User, *graphqlutil.PageInfo, error) {
|
||||
func (r *userConnectionResolver) compute(ctx context.Context) ([]*types.User, *gqlutil.PageInfo, error) {
|
||||
r.once.Do(func() {
|
||||
var idSubset []int32
|
||||
if r.after == nil {
|
||||
@ -66,7 +66,7 @@ func (r *userConnectionResolver) compute(ctx context.Context) ([]*types.User, *g
|
||||
|
||||
if len(idSubset) == 0 {
|
||||
r.users = []*types.User{}
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
return
|
||||
}
|
||||
|
||||
@ -84,10 +84,10 @@ func (r *userConnectionResolver) compute(ctx context.Context) ([]*types.User, *g
|
||||
|
||||
// No more user IDs to paginate through.
|
||||
if idSubset[len(idSubset)-1] == r.ids[len(r.ids)-1] {
|
||||
r.pageInfo = graphqlutil.HasNextPage(false)
|
||||
r.pageInfo = gqlutil.HasNextPage(false)
|
||||
} else { // Additional user IDs to paginate through.
|
||||
endCursor := string(graphqlbackend.MarshalUserID(idSubset[len(idSubset)-1]))
|
||||
r.pageInfo = graphqlutil.NextPageCursor(endCursor)
|
||||
r.pageInfo = gqlutil.NextPageCursor(endCursor)
|
||||
}
|
||||
})
|
||||
return r.users, r.pageInfo, r.err
|
||||
@ -119,7 +119,7 @@ func (r *userConnectionResolver) TotalCount(ctx context.Context) (int32, error)
|
||||
return int32(len(r.ids)), nil
|
||||
}
|
||||
|
||||
func (r *userConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *userConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
// 🚨 SECURITY: Only site admins may access this method.
|
||||
if err := auth.CheckCurrentUserIsSiteAdmin(ctx, r.db); err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -42,7 +42,6 @@ go_library(
|
||||
"//cmd/frontend/enterprise",
|
||||
"//cmd/frontend/graphqlbackend",
|
||||
"//cmd/frontend/graphqlbackend/externallink",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//cmd/frontend/internal/githubapp",
|
||||
"//internal/actor",
|
||||
"//internal/api",
|
||||
|
||||
@ -8,10 +8,10 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
var _ graphqlbackend.BatchChangesConnectionResolver = &batchChangesConnectionResolver{}
|
||||
@ -55,15 +55,15 @@ func (r *batchChangesConnectionResolver) TotalCount(ctx context.Context) (int32,
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *batchChangesConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *batchChangesConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *batchChangesConnectionResolver) compute(ctx context.Context) ([]*btypes.BatchChange, int64, error) {
|
||||
|
||||
@ -8,9 +8,9 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type batchSpecConnectionResolver struct {
|
||||
@ -49,15 +49,15 @@ func (r *batchSpecConnectionResolver) TotalCount(ctx context.Context) (int32, er
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *batchSpecConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *batchSpecConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *batchSpecConnectionResolver) compute(ctx context.Context) ([]*btypes.BatchSpec, int64, error) {
|
||||
|
||||
@ -8,10 +8,10 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
|
||||
@ -80,15 +80,15 @@ func (r *batchSpecWorkspaceConnectionResolver) TotalCount(ctx context.Context) (
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *batchSpecWorkspaceConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceConnectionResolver) compute(ctx context.Context) ([]*btypes.BatchSpecWorkspace, int64, error) {
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
var _ graphqlbackend.BatchSpecWorkspaceFileConnectionResolver = &batchSpecWorkspaceFileConnectionResolver{}
|
||||
@ -29,15 +29,15 @@ func (r *batchSpecWorkspaceFileConnectionResolver) TotalCount(ctx context.Contex
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceFileConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *batchSpecWorkspaceFileConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceFileConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.BatchWorkspaceFileResolver, error) {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/executor"
|
||||
@ -440,12 +439,12 @@ func (r *batchSpecWorkspaceOutputLinesResolver) TotalCount() (int32, error) {
|
||||
return totalCount, r.err
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceOutputLinesResolver) PageInfo() (*graphqlutil.PageInfo, error) {
|
||||
func (r *batchSpecWorkspaceOutputLinesResolver) PageInfo() (*gqlutil.PageInfo, error) {
|
||||
_, _, hasNextPage := r.compute()
|
||||
if hasNextPage {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(r.endCursor))), r.err
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(r.endCursor))), r.err
|
||||
}
|
||||
return graphqlutil.HasNextPage(hasNextPage), r.err
|
||||
return gqlutil.HasNextPage(hasNextPage), r.err
|
||||
}
|
||||
|
||||
func (r *batchSpecWorkspaceOutputLinesResolver) Nodes() ([]string, error) {
|
||||
|
||||
@ -8,10 +8,10 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type bulkOperationConnectionResolver struct {
|
||||
@ -41,17 +41,17 @@ func (r *bulkOperationConnectionResolver) TotalCount(ctx context.Context) (int32
|
||||
return int32(count), nil
|
||||
}
|
||||
|
||||
func (r *bulkOperationConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *bulkOperationConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *bulkOperationConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.BulkOperationResolver, error) {
|
||||
|
||||
@ -9,13 +9,13 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/service"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/syncer"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/lib/batches"
|
||||
"github.com/sourcegraph/sourcegraph/lib/errors"
|
||||
)
|
||||
@ -54,18 +54,18 @@ func (r *changesetApplyPreviewConnectionResolver) TotalCount(ctx context.Context
|
||||
return int32(page.TotalCount), nil
|
||||
}
|
||||
|
||||
func (r *changesetApplyPreviewConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *changesetApplyPreviewConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
if r.opts.LimitOffset == nil {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
mappings, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if (r.opts.LimitOffset.Limit + r.opts.LimitOffset.Offset) >= len(mappings.All) {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(r.opts.LimitOffset.Limit + r.opts.LimitOffset.Offset)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(r.opts.LimitOffset.Limit + r.opts.LimitOffset.Offset)), nil
|
||||
}
|
||||
|
||||
func (r *changesetApplyPreviewConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.ChangesetApplyPreviewResolver, error) {
|
||||
|
||||
@ -9,11 +9,11 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/syncer"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type changesetsConnectionResolver struct {
|
||||
@ -100,15 +100,15 @@ func (r *changesetsConnectionResolver) compute(ctx context.Context) (cs btypes.C
|
||||
return r.changesets, r.next, r.err
|
||||
}
|
||||
|
||||
func (r *changesetsConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *changesetsConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if next > 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
@ -6,9 +6,9 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type changesetEventsConnectionResolver struct {
|
||||
@ -46,15 +46,15 @@ func (r *changesetEventsConnectionResolver) TotalCount(ctx context.Context) (int
|
||||
return int32(count), err
|
||||
}
|
||||
|
||||
func (r *changesetEventsConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *changesetEventsConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if next != 0 {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *changesetEventsConnectionResolver) compute(ctx context.Context) ([]*btypes.ChangesetEvent, int64, error) {
|
||||
|
||||
@ -6,10 +6,10 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/api"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/types"
|
||||
)
|
||||
|
||||
@ -39,7 +39,7 @@ func (r *changesetSpecConnectionResolver) TotalCount(ctx context.Context) (int32
|
||||
return int32(count), nil
|
||||
}
|
||||
|
||||
func (r *changesetSpecConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (r *changesetSpecConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
_, _, next, err := r.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,10 +48,10 @@ func (r *changesetSpecConnectionResolver) PageInfo(ctx context.Context) (*graphq
|
||||
if next != 0 {
|
||||
// We don't use the RandID for pagination, because we can't paginate database
|
||||
// entries based on the RandID.
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(int(next))), nil
|
||||
}
|
||||
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (r *changesetSpecConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.ChangesetSpecResolver, error) {
|
||||
|
||||
@ -8,10 +8,10 @@ import (
|
||||
"github.com/sourcegraph/log"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/batches/store"
|
||||
btypes "github.com/sourcegraph/sourcegraph/internal/batches/types"
|
||||
"github.com/sourcegraph/sourcegraph/internal/database"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
)
|
||||
|
||||
type batchChangesCodeHostConnectionResolver struct {
|
||||
@ -40,7 +40,7 @@ func (c *batchChangesCodeHostConnectionResolver) TotalCount(ctx context.Context)
|
||||
return int32(len(chs)), err
|
||||
}
|
||||
|
||||
func (c *batchChangesCodeHostConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
func (c *batchChangesCodeHostConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
chs, _, _, err := c.compute(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -48,10 +48,10 @@ func (c *batchChangesCodeHostConnectionResolver) PageInfo(ctx context.Context) (
|
||||
|
||||
idx := c.limitOffset.Limit + c.limitOffset.Offset
|
||||
if idx < len(chs) {
|
||||
return graphqlutil.NextPageCursor(strconv.Itoa(idx)), nil
|
||||
return gqlutil.NextPageCursor(strconv.Itoa(idx)), nil
|
||||
}
|
||||
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (c *batchChangesCodeHostConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.BatchChangesCodeHostResolver, error) {
|
||||
@ -169,8 +169,8 @@ func (c *emptyBatchChangesCodeHostConnectionResolver) TotalCount(ctx context.Con
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (c *emptyBatchChangesCodeHostConnectionResolver) PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error) {
|
||||
return graphqlutil.HasNextPage(false), nil
|
||||
func (c *emptyBatchChangesCodeHostConnectionResolver) PageInfo(ctx context.Context) (*gqlutil.PageInfo, error) {
|
||||
return gqlutil.HasNextPage(false), nil
|
||||
}
|
||||
|
||||
func (c *emptyBatchChangesCodeHostConnectionResolver) Nodes(ctx context.Context) ([]graphqlbackend.BatchChangesCodeHostResolver, error) {
|
||||
|
||||
@ -7,8 +7,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/graphqlutil"
|
||||
|
||||
"github.com/graph-gophers/graphql-go"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
|
||||
@ -32,6 +30,7 @@ import (
|
||||
"github.com/sourcegraph/sourcegraph/internal/featureflag"
|
||||
ghstore "github.com/sourcegraph/sourcegraph/internal/github_apps/store"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gitserver"
|
||||
"github.com/sourcegraph/sourcegraph/internal/gqlutil"
|
||||
"github.com/sourcegraph/sourcegraph/internal/licensing"
|
||||
"github.com/sourcegraph/sourcegraph/internal/rbac"
|
||||
"github.com/sourcegraph/sourcegraph/internal/trace"
|
||||
@ -2005,7 +2004,7 @@ func (r *Resolver) MaxUnlicensedChangesets(ctx context.Context) int32 {
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Resolver) GetChangesetsByIDs(ctx context.Context, args *graphqlbackend.GetChangesetsByIDsArgs) (_ graphqlutil.SliceConnectionResolver[graphqlbackend.ChangesetResolver], err error) {
|
||||
func (r *Resolver) GetChangesetsByIDs(ctx context.Context, args *graphqlbackend.GetChangesetsByIDsArgs) (_ gqlutil.SliceConnectionResolver[graphqlbackend.ChangesetResolver], err error) {
|
||||
tr, ctx := trace.New(ctx, "Resolver.GetChangesetsByIDs",
|
||||
attribute.String("batchChange", string(args.BatchChange)),
|
||||
attribute.Int("changesets.len", len(args.Changesets)))
|
||||
@ -2048,7 +2047,7 @@ func (r *Resolver) GetChangesetsByIDs(ctx context.Context, args *graphqlbackend.
|
||||
cs[i] = NewChangesetResolver(r.store, r.gitserverClient, r.logger, changeset, repo)
|
||||
}
|
||||
|
||||
return graphqlutil.NewSliceConnectionResolver(cs, len(cs), len(cs)), nil
|
||||
return gqlutil.NewSliceConnectionResolver(cs, len(cs), len(cs)), nil
|
||||
}
|
||||
|
||||
func parseBatchChangeStates(ss *[]string) ([]btypes.BatchChangeState, error) {
|
||||
|
||||
@ -9,7 +9,6 @@ go_library(
|
||||
visibility = ["//cmd/frontend:__subpackages__"],
|
||||
deps = [
|
||||
"//cmd/frontend/graphqlbackend",
|
||||
"//cmd/frontend/graphqlbackend/graphqlutil",
|
||||
"//internal/auth",
|
||||
"//internal/codemonitors",
|
||||
"//internal/codemonitors/background",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user