|
|
@ -5,10 +5,31 @@ import (
|
|
|
|
"reflect"
|
|
|
|
"reflect"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_interface_graph_node *graphql.Interface = nil
|
|
|
|
type Field *graphql.Field
|
|
|
|
func GQLInterfaceNode() *graphql.Interface {
|
|
|
|
|
|
|
|
if gql_interface_graph_node == nil {
|
|
|
|
func NewField(init func()*graphql.Field) Field {
|
|
|
|
gql_interface_graph_node = graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
return Field(init())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Singleton[K graphql.Type] struct {
|
|
|
|
|
|
|
|
Type K
|
|
|
|
|
|
|
|
List *graphql.List
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func NewSingleton[K graphql.Type](init func() K, post_init func(K, *graphql.List)) *Singleton[K] {
|
|
|
|
|
|
|
|
val := init()
|
|
|
|
|
|
|
|
list := graphql.NewList(val)
|
|
|
|
|
|
|
|
if post_init != nil {
|
|
|
|
|
|
|
|
post_init(val, list)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Singleton[K]{
|
|
|
|
|
|
|
|
Type: val,
|
|
|
|
|
|
|
|
List: list,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var GQLInterfaceNode = NewSingleton(func() *graphql.Interface {
|
|
|
|
|
|
|
|
i := graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
Name: "Node",
|
|
|
|
Name: "Node",
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -27,34 +48,21 @@ func GQLInterfaceNode() *graphql.Interface {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if p_type.Implements(node_type) {
|
|
|
|
if p_type.Implements(node_type) {
|
|
|
|
return GQLTypeGraphNode()
|
|
|
|
return ctx.GQL.BaseNodeType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Fields: graphql.Fields{},
|
|
|
|
Fields: graphql.Fields{},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
i.AddFieldConfig("ID", &graphql.Field{
|
|
|
|
gql_interface_graph_node.AddFieldConfig("ID", &graphql.Field{
|
|
|
|
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return i
|
|
|
|
|
|
|
|
}, nil)
|
|
|
|
return gql_interface_graph_node
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gql_list_thread *graphql.List = nil
|
|
|
|
|
|
|
|
func GQLListThread() *graphql.List {
|
|
|
|
|
|
|
|
if gql_list_thread == nil {
|
|
|
|
|
|
|
|
gql_list_thread = graphql.NewList(GQLInterfaceThread())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_list_thread
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gql_interface_thread *graphql.Interface = nil
|
|
|
|
var GQLInterfaceThread = NewSingleton(func() *graphql.Interface {
|
|
|
|
func GQLInterfaceThread() *graphql.Interface {
|
|
|
|
gql_interface_thread := graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
if gql_interface_thread == nil {
|
|
|
|
|
|
|
|
gql_interface_thread = graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
|
|
|
|
Name: "Thread",
|
|
|
|
Name: "Thread",
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -73,7 +81,7 @@ func GQLInterfaceThread() *graphql.Interface {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if p_type.Implements(thread_type) {
|
|
|
|
if p_type.Implements(thread_type) {
|
|
|
|
return GQLTypeSimpleThread()
|
|
|
|
return ctx.GQL.BaseThreadType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ctx.Log.Logf("gql", "Found no type that matches %+v: %+v", p_type, p_type.Implements(thread_type))
|
|
|
|
ctx.Log.Logf("gql", "Found no type that matches %+v: %+v", p_type, p_type.Implements(thread_type))
|
|
|
@ -94,42 +102,32 @@ func GQLInterfaceThread() *graphql.Interface {
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
|
|
|
|
Type: GQLListThread(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
|
|
|
|
Type: GQLInterfaceThread(),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
gql_interface_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
gql_interface_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
gql_interface_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: GQLInterfaceLockable(),
|
|
|
|
Type: GQLInterfaceLockable.Type,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return gql_interface_thread
|
|
|
|
return gql_interface_thread
|
|
|
|
}
|
|
|
|
}, func(thread *graphql.Interface, thread_list *graphql.List) {
|
|
|
|
|
|
|
|
thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
|
|
|
|
Type: thread_list,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
var gql_list_lockable *graphql.List = nil
|
|
|
|
thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
func GQLListLockable() *graphql.List {
|
|
|
|
Type: thread,
|
|
|
|
if gql_list_lockable == nil {
|
|
|
|
})
|
|
|
|
gql_list_lockable = graphql.NewList(GQLInterfaceLockable())
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return gql_list_lockable
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gql_interface_lockable *graphql.Interface = nil
|
|
|
|
var GQLInterfaceLockable = NewSingleton(func() *graphql.Interface {
|
|
|
|
func GQLInterfaceLockable() *graphql.Interface {
|
|
|
|
gql_interface_lockable := graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
if gql_interface_lockable == nil {
|
|
|
|
|
|
|
|
gql_interface_lockable = graphql.NewInterface(graphql.InterfaceConfig{
|
|
|
|
|
|
|
|
Name: "Lockable",
|
|
|
|
Name: "Lockable",
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ResolveType: func(p graphql.ResolveTypeParams) *graphql.Object {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -148,7 +146,7 @@ func GQLInterfaceLockable() *graphql.Interface {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if p_type.Implements(lockable_type) {
|
|
|
|
if p_type.Implements(lockable_type) {
|
|
|
|
return GQLTypeSimpleLockable()
|
|
|
|
return ctx.GQL.BaseThreadType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -162,44 +160,27 @@ func GQLInterfaceLockable() *graphql.Interface {
|
|
|
|
gql_interface_lockable.AddFieldConfig("Name", &graphql.Field{
|
|
|
|
gql_interface_lockable.AddFieldConfig("Name", &graphql.Field{
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
return gql_interface_lockable
|
|
|
|
if gql_list_lockable == nil {
|
|
|
|
}, func(lockable *graphql.Interface, lockable_list *graphql.List) {
|
|
|
|
gql_list_lockable = graphql.NewList(gql_interface_lockable)
|
|
|
|
lockable.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
}
|
|
|
|
Type: lockable_list,
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_lockable.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
|
|
|
|
Type: gql_list_lockable,
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_lockable.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
lockable.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: gql_list_lockable,
|
|
|
|
Type: lockable_list,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_interface_lockable.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
lockable.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: gql_interface_lockable,
|
|
|
|
Type: lockable,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
var GQLTypeUser = NewSingleton(func() *graphql.Object {
|
|
|
|
|
|
|
|
gql_type_user := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
return gql_interface_lockable
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gql_list_user *graphql.List = nil
|
|
|
|
|
|
|
|
func GQLListUser() *graphql.List {
|
|
|
|
|
|
|
|
if gql_list_user == nil {
|
|
|
|
|
|
|
|
gql_list_user = graphql.NewList(GQLTypeUser())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_list_user
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_user *graphql.Object = nil
|
|
|
|
|
|
|
|
func GQLTypeUser() * graphql.Object {
|
|
|
|
|
|
|
|
if gql_type_user == nil {
|
|
|
|
|
|
|
|
gql_type_user = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "User",
|
|
|
|
Name: "User",
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
GQLInterfaceNode(),
|
|
|
|
GQLInterfaceNode.Type,
|
|
|
|
GQLInterfaceLockable(),
|
|
|
|
GQLInterfaceLockable.Type,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -230,32 +211,29 @@ func GQLTypeUser() * graphql.Object {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_user.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
gql_type_user.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_user.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
gql_type_user.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: GQLInterfaceLockable(),
|
|
|
|
Type: GQLInterfaceLockable.Type,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_user.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
gql_type_user.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_user
|
|
|
|
return gql_type_user
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_gql_thread *graphql.Object = nil
|
|
|
|
var GQLTypeGQLThread = NewSingleton(func() *graphql.Object {
|
|
|
|
func GQLTypeGQLThread() * graphql.Object {
|
|
|
|
gql_type_gql_thread := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
if gql_type_gql_thread == nil {
|
|
|
|
|
|
|
|
gql_type_gql_thread = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "GQLThread",
|
|
|
|
Name: "GQLThread",
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
GQLInterfaceNode(),
|
|
|
|
GQLInterfaceNode.Type,
|
|
|
|
GQLInterfaceThread(),
|
|
|
|
GQLInterfaceThread.Type,
|
|
|
|
GQLInterfaceLockable(),
|
|
|
|
GQLInterfaceLockable.Type,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
_, ok := p.Value.(*GQLThread)
|
|
|
|
_, ok := p.Value.(*GQLThread)
|
|
|
@ -280,12 +258,12 @@ func GQLTypeGQLThread() * graphql.Object {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
Type: GQLListThread(),
|
|
|
|
Type: GQLInterfaceThread.List,
|
|
|
|
Resolve: GQLThreadChildren,
|
|
|
|
Resolve: GQLThreadChildren,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
Type: GQLInterfaceThread(),
|
|
|
|
Type: GQLInterfaceThread.Type,
|
|
|
|
Resolve: GQLThreadParent,
|
|
|
|
Resolve: GQLThreadParent,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
@ -295,37 +273,34 @@ func GQLTypeGQLThread() * graphql.Object {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: GQLInterfaceLockable(),
|
|
|
|
Type: GQLInterfaceLockable.Type,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Users", &graphql.Field{
|
|
|
|
gql_type_gql_thread.AddFieldConfig("Users", &graphql.Field{
|
|
|
|
Type: GQLListUser(),
|
|
|
|
Type: GQLTypeUser.List,
|
|
|
|
Resolve: GQLThreadUsers,
|
|
|
|
Resolve: GQLThreadUsers,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_gql_thread
|
|
|
|
return gql_type_gql_thread
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_simple_thread *graphql.Object = nil
|
|
|
|
var GQLTypeSimpleThread = NewSingleton(func() *graphql.Object {
|
|
|
|
func GQLTypeSimpleThread() * graphql.Object {
|
|
|
|
gql_type_simple_thread := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
if gql_type_simple_thread == nil {
|
|
|
|
|
|
|
|
gql_type_simple_thread = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "SimpleThread",
|
|
|
|
Name: "SimpleThread",
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
GQLInterfaceNode(),
|
|
|
|
GQLInterfaceNode.Type,
|
|
|
|
GQLInterfaceThread(),
|
|
|
|
GQLInterfaceThread.Type,
|
|
|
|
GQLInterfaceLockable(),
|
|
|
|
GQLInterfaceLockable.Type,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -361,41 +336,39 @@ func GQLTypeSimpleThread() * graphql.Object {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Children", &graphql.Field{
|
|
|
|
Type: GQLListThread(),
|
|
|
|
Type: GQLInterfaceThread.List,
|
|
|
|
Resolve: GQLThreadChildren,
|
|
|
|
Resolve: GQLThreadChildren,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Parent", &graphql.Field{
|
|
|
|
Type: GQLInterfaceThread(),
|
|
|
|
Type: GQLInterfaceThread.Type,
|
|
|
|
Resolve: GQLThreadParent,
|
|
|
|
Resolve: GQLThreadParent,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: GQLInterfaceLockable(),
|
|
|
|
Type: GQLInterfaceLockable.Type,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
gql_type_simple_thread.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_simple_thread
|
|
|
|
return gql_type_simple_thread
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_simple_lockable *graphql.Object = nil
|
|
|
|
var GQLTypeSimpleLockable = NewSingleton(func() *graphql.Object {
|
|
|
|
func GQLTypeSimpleLockable() * graphql.Object {
|
|
|
|
gql_type_simple_lockable := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
if gql_type_simple_lockable == nil {
|
|
|
|
|
|
|
|
gql_type_simple_lockable = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "SimpleLockable",
|
|
|
|
Name: "SimpleLockable",
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
GQLInterfaceNode(),
|
|
|
|
GQLInterfaceNode.Type,
|
|
|
|
GQLInterfaceLockable(),
|
|
|
|
GQLInterfaceLockable.Type,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -426,30 +399,28 @@ func GQLTypeSimpleLockable() * graphql.Object {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Requirements", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
Resolve: GQLLockableRequirements,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Owner", &graphql.Field{
|
|
|
|
Type: GQLInterfaceLockable(),
|
|
|
|
Type: GQLInterfaceLockable.Type,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
Resolve: GQLLockableOwner,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
gql_type_simple_lockable.AddFieldConfig("Dependencies", &graphql.Field{
|
|
|
|
Type: GQLListLockable(),
|
|
|
|
Type: GQLInterfaceLockable.List,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
Resolve: GQLLockableDependencies,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_simple_lockable
|
|
|
|
return gql_type_simple_lockable
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_simple_node *graphql.Object = nil
|
|
|
|
var GQLTypeGraphNode = NewSingleton(func() *graphql.Object {
|
|
|
|
func GQLTypeGraphNode() * graphql.Object {
|
|
|
|
object := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
if gql_type_simple_node == nil {
|
|
|
|
|
|
|
|
gql_type_simple_node = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "GraphNode",
|
|
|
|
Name: "GraphNode",
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
Interfaces: []*graphql.Interface{
|
|
|
|
GQLInterfaceNode(),
|
|
|
|
GQLInterfaceNode.Type,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
|
ctx, ok := p.Context.Value("graph_context").(*Context)
|
|
|
@ -469,24 +440,21 @@ func GQLTypeGraphNode() * graphql.Object {
|
|
|
|
Fields: graphql.Fields{},
|
|
|
|
Fields: graphql.Fields{},
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_node.AddFieldConfig("ID", &graphql.Field{
|
|
|
|
object.AddFieldConfig("ID", &graphql.Field{
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
Resolve: GQLNodeID,
|
|
|
|
Resolve: GQLNodeID,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
gql_type_simple_node.AddFieldConfig("Name", &graphql.Field{
|
|
|
|
object.AddFieldConfig("Name", &graphql.Field{
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
Resolve: GQLLockableName,
|
|
|
|
Resolve: GQLLockableName,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return gql_type_simple_node
|
|
|
|
return object
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_signal *graphql.Object = nil
|
|
|
|
var GQLTypeSignal = NewSingleton(func() *graphql.Object {
|
|
|
|
func GQLTypeSignal() *graphql.Object {
|
|
|
|
gql_type_signal := graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
if gql_type_signal == nil {
|
|
|
|
|
|
|
|
gql_type_signal = graphql.NewObject(graphql.ObjectConfig{
|
|
|
|
|
|
|
|
Name: "SignalOut",
|
|
|
|
Name: "SignalOut",
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
IsTypeOf: func(p graphql.IsTypeOfParams) bool {
|
|
|
|
_, ok := p.Value.(GraphSignal)
|
|
|
|
_, ok := p.Value.(GraphSignal)
|
|
|
@ -511,14 +479,11 @@ func GQLTypeSignal() *graphql.Object {
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
Resolve: GQLSignalString,
|
|
|
|
Resolve: GQLSignalString,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_signal
|
|
|
|
return gql_type_signal
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|
var gql_type_signal_input *graphql.InputObject = nil
|
|
|
|
var GQLTypeSignalInput = NewSingleton(func()*graphql.InputObject {
|
|
|
|
func GQLTypeSignalInput() *graphql.InputObject {
|
|
|
|
gql_type_signal_input := graphql.NewInputObject(graphql.InputObjectConfig{
|
|
|
|
if gql_type_signal_input == nil {
|
|
|
|
|
|
|
|
gql_type_signal_input = graphql.NewInputObject(graphql.InputObjectConfig{
|
|
|
|
|
|
|
|
Name: "SignalIn",
|
|
|
|
Name: "SignalIn",
|
|
|
|
Fields: graphql.InputObjectConfigFieldMap{},
|
|
|
|
Fields: graphql.InputObjectConfigFieldMap{},
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -530,7 +495,7 @@ func GQLTypeSignalInput() *graphql.InputObject {
|
|
|
|
Type: graphql.String,
|
|
|
|
Type: graphql.String,
|
|
|
|
DefaultValue: "down",
|
|
|
|
DefaultValue: "down",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return gql_type_signal_input
|
|
|
|
return gql_type_signal_input
|
|
|
|
}
|
|
|
|
}, nil)
|
|
|
|
|
|
|
|
|
|
|
|